diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-12 10:06:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-12 10:06:28 +0000 |
commit | 918abde014f9e5c75dfbe21110c379f7f70435c9 (patch) | |
tree | 3419a01e34958bffbd917fa9e600eda126ea3a87 | |
parent | Releasing debian version 10.6.3-1. (diff) | |
download | sqlglot-918abde014f9e5c75dfbe21110c379f7f70435c9.tar.xz sqlglot-918abde014f9e5c75dfbe21110c379f7f70435c9.zip |
Merging upstream version 11.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
112 files changed, 126100 insertions, 230 deletions
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8cd3634..555ac5b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -22,5 +22,17 @@ jobs: python -m pip install --upgrade pip make install-dev - name: Run checks (linter, code style, tests) + run: make check + - name: Update documentation run: | - make check + make docs + git add docs + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -m "CI: Auto-generated documentation" -a | exit 0 + if: ${{ matrix.python-version == '3.10' && github.event_name == 'push' }} + - name: Push changes + if: ${{ matrix.python-version == '3.10' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 76c9e96..3b70b85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,39 @@ Changelog ========= +v11.0.0 +------ + +Changes: + +- Breaking: Renamed ESCAPES to STRING_ESCAPES in the Tokenizer class. + +- New: Deployed pdoc documentation page. + +- New: Add support for read locking using the FOR UPDATE/SHARE syntax (e.g. MySQL). + +- New: Added support for CASCADE, SET NULL and SET DEFAULT constraints. + +- New: Added "cast" expression helper. + +- New: Add support for transpiling Postgres GENERATE_SERIES into Presto SEQUENCE. + +- Improvement: Fix tokenizing of identifier escapes. + +- Improvement: Fix eliminate_subqueries [bug](https://github.com/tobymao/sqlglot/commit/b5df65e3fb5ee1ebc3cbab64b6d89598cf47a10b) related to unions. + +- Improvement: IFNULL is now transpiled to COALESCE by default for every dialect. + +- Improvement: Refactored the way properties are handled. Now it's easier to add them and specify their position in a SQL expression. + +- Improvement: Fixed alias quoting bug. + +- Improvement: Fixed CUBE / ROLLUP / GROUPING SETS parsing and generation. + +- Improvement: Fixed get_or_raise Dialect/t.Type[Dialect] argument bug. + +- Improvement: Improved python type hints. + v10.6.0 ------ @@ -18,7 +18,7 @@ style: check: style test docs: - python pdoc/cli.py -o pdoc/docs + python pdoc/cli.py -o docs docs-serve: - python pdoc/cli.py + python pdoc/cli.py --port 8002 diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..bd9a7c8 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +sqlglot.com
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..ef64b90 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,7 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + <meta http-equiv="refresh" content="0; url=./sqlglot.html"/> +</head> +</html> diff --git a/docs/search.js b/docs/search.js new file mode 100644 index 0000000..0cb5e81 --- /dev/null +++ b/docs/search.js @@ -0,0 +1,46 @@ +window.pdocSearch = (function(){ +/** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.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){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("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)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.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){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=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);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u<s.length;u++){var a=s[u];r[a]=this.pipeline.run(t.tokenizer(e[a]))}var l={};for(var c in o){var d=r[c]||r.any;if(d){var f=this.fieldSearch(d,c,o),h=o[c].boost;for(var p in f)f[p]=f[p]*h;for(var p in f)p in l?l[p]+=f[p]:l[p]=f[p]}}var v,g=[];for(var p in l)v={ref:p,score:l[p]},this.documentStore.hasDoc(p)&&(v.doc=this.documentStore.getDoc(p)),g.push(v);return g.sort(function(e,t){return t.score-e.score}),g},t.Index.prototype.fieldSearch=function(e,t,n){var i=n[t].bool,o=n[t].expand,r=n[t].boost,s=null,u={};return 0!==r?(e.forEach(function(e){var n=[e];1==o&&(n=this.index[t].expandToken(e));var r={};n.forEach(function(n){var o=this.index[t].getDocs(n),a=this.idf(n,t);if(s&&"AND"==i){var l={};for(var c in s)c in o&&(l[c]=o[c]);o=l}n==e&&this.fieldSearchStats(u,n,o);for(var c in o){var d=this.index[t].getTermFrequency(n,c),f=this.documentStore.getFieldLength(c,t),h=1;0!=f&&(h=1/Math.sqrt(f));var p=1;n!=e&&(p=.15*(1-(n.length-e.length)/n.length));var v=d*a*h*p;c in r?r[c]+=v:r[c]=v}},this),s=this.mergeScores(s,r,i)},this),s=this.coordNorm(s,u,e.length)):void 0},t.Index.prototype.mergeScores=function(e,t,n){if(!e)return t;if("AND"==n){var i={};for(var o in t)o in e&&(i[o]=e[o]+t[o]);return i}for(var o in t)o in e?e[o]+=t[o]:e[o]=t[o];return e},t.Index.prototype.fieldSearchStats=function(e,t,n){for(var i in n)i in e?e[i].push(t):e[i]=[t]},t.Index.prototype.coordNorm=function(e,t,n){for(var i in e)if(i in t){var o=t[i].length;e[i]=e[i]*o/n}return e},t.Index.prototype.toJSON=function(){var e={};return this._fields.forEach(function(t){e[t]=this.index[t].toJSON()},this),{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),index:e,pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},t.DocumentStore=function(e){this._save=null===e||void 0===e?!0:e,this.docs={},this.docInfo={},this.length=0},t.DocumentStore.load=function(e){var t=new this;return t.length=e.length,t.docs=e.docs,t.docInfo=e.docInfo,t._save=e.save,t},t.DocumentStore.prototype.isDocStored=function(){return this._save},t.DocumentStore.prototype.addDoc=function(t,n){this.hasDoc(t)||this.length++,this.docs[t]=this._save===!0?e(n):null},t.DocumentStore.prototype.getDoc=function(e){return this.hasDoc(e)===!1?null:this.docs[e]},t.DocumentStore.prototype.hasDoc=function(e){return e in this.docs},t.DocumentStore.prototype.removeDoc=function(e){this.hasDoc(e)&&(delete this.docs[e],delete this.docInfo[e],this.length--)},t.DocumentStore.prototype.addFieldLength=function(e,t,n){null!==e&&void 0!==e&&0!=this.hasDoc(e)&&(this.docInfo[e]||(this.docInfo[e]={}),this.docInfo[e][t]=n)},t.DocumentStore.prototype.updateFieldLength=function(e,t,n){null!==e&&void 0!==e&&0!=this.hasDoc(e)&&this.addFieldLength(e,t,n)},t.DocumentStore.prototype.getFieldLength=function(e,t){return null===e||void 0===e?0:e in this.docs&&t in this.docInfo[e]?this.docInfo[e][t]:0},t.DocumentStore.prototype.toJSON=function(){return{docs:this.docs,docInfo:this.docInfo,length:this.length,save:this._save}},t.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,u="^("+o+")?"+r+o+"("+r+")?$",a="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,c=new RegExp(s),d=new RegExp(a),f=new RegExp(u),h=new RegExp(l),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,x=new RegExp("([^aeiouylsz])\\1$"),w=new RegExp("^"+o+i+"[^aeiouwxy]$"),I=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,D=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,_=/^(.+?)e$/,P=/ll$/,k=new RegExp("^"+o+i+"[^aeiouwxy]$"),z=function(n){var i,o,r,s,u,a,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,u=v,s.test(n)?n=n.replace(s,"$1$2"):u.test(n)&&(n=n.replace(u,"$1$2")),s=g,u=m,s.test(n)){var z=s.exec(n);s=c,s.test(z[1])&&(s=y,n=n.replace(s,""))}else if(u.test(n)){var z=u.exec(n);i=z[1],u=h,u.test(i)&&(n=i,u=S,a=x,l=w,u.test(n)?n+="e":a.test(n)?(s=y,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=I,s.test(n)){var z=s.exec(n);i=z[1],n=i+"i"}if(s=b,s.test(n)){var z=s.exec(n);i=z[1],o=z[2],s=c,s.test(i)&&(n=i+e[o])}if(s=E,s.test(n)){var z=s.exec(n);i=z[1],o=z[2],s=c,s.test(i)&&(n=i+t[o])}if(s=D,u=F,s.test(n)){var z=s.exec(n);i=z[1],s=d,s.test(i)&&(n=i)}else if(u.test(n)){var z=u.exec(n);i=z[1]+z[2],u=d,u.test(i)&&(n=i)}if(s=_,s.test(n)){var z=s.exec(n);i=z[1],s=d,u=f,a=k,(s.test(i)||u.test(i)&&!a.test(i))&&(n=i)}return s=P,u=d,s.test(n)&&u.test(n)&&(s=y,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return z}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==!0?e:void 0},t.clearStopWords=function(){t.stopWordFilter.stopWords={}},t.addStopWords=function(e){null!=e&&Array.isArray(e)!==!1&&e.forEach(function(e){t.stopWordFilter.stopWords[e]=!0},this)},t.resetStopWords=function(){t.stopWordFilter.stopWords=t.defaultStopWords},t.defaultStopWords={"":!0,a:!0,able:!0,about:!0,across:!0,after:!0,all:!0,almost:!0,also:!0,am:!0,among:!0,an:!0,and:!0,any:!0,are:!0,as:!0,at:!0,be:!0,because:!0,been:!0,but:!0,by:!0,can:!0,cannot:!0,could:!0,dear:!0,did:!0,"do":!0,does:!0,either:!0,"else":!0,ever:!0,every:!0,"for":!0,from:!0,get:!0,got:!0,had:!0,has:!0,have:!0,he:!0,her:!0,hers:!0,him:!0,his:!0,how:!0,however:!0,i:!0,"if":!0,"in":!0,into:!0,is:!0,it:!0,its:!0,just:!0,least:!0,let:!0,like:!0,likely:!0,may:!0,me:!0,might:!0,most:!0,must:!0,my:!0,neither:!0,no:!0,nor:!0,not:!0,of:!0,off:!0,often:!0,on:!0,only:!0,or:!0,other:!0,our:!0,own:!0,rather:!0,said:!0,say:!0,says:!0,she:!0,should:!0,since:!0,so:!0,some:!0,than:!0,that:!0,the:!0,their:!0,them:!0,then:!0,there:!0,these:!0,they:!0,"this":!0,tis:!0,to:!0,too:!0,twas:!0,us:!0,wants:!0,was:!0,we:!0,were:!0,what:!0,when:!0,where:!0,which:!0,"while":!0,who:!0,whom:!0,why:!0,will:!0,"with":!0,would:!0,yet:!0,you:!0,your:!0},t.stopWordFilter.stopWords=t.defaultStopWords,t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(e){if(null===e||void 0===e)throw new Error("token should not be undefined");return e.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.InvertedIndex=function(){this.root={docs:{},df:0}},t.InvertedIndex.load=function(e){var t=new this;return t.root=e.root,t},t.InvertedIndex.prototype.addToken=function(e,t,n){for(var n=n||this.root,i=0;i<=e.length-1;){var o=e[i];o in n||(n[o]={docs:{},df:0}),i+=1,n=n[o]}var r=t.ref;n.docs[r]?n.docs[r]={tf:t.tf}:(n.docs[r]={tf:t.tf},n.df+=1)},t.InvertedIndex.prototype.hasToken=function(e){if(!e)return!1;for(var t=this.root,n=0;n<e.length;n++){if(!t[e[n]])return!1;t=t[e[n]]}return!0},t.InvertedIndex.prototype.getNode=function(e){if(!e)return null;for(var t=this.root,n=0;n<e.length;n++){if(!t[e[n]])return null;t=t[e[n]]}return t},t.InvertedIndex.prototype.getDocs=function(e){var t=this.getNode(e);return null==t?{}:t.docs},t.InvertedIndex.prototype.getTermFrequency=function(e,t){var n=this.getNode(e);return null==n?0:t in n.docs?n.docs[t].tf:0},t.InvertedIndex.prototype.getDocFreq=function(e){var t=this.getNode(e);return null==t?0:t.df},t.InvertedIndex.prototype.removeToken=function(e,t){if(e){var n=this.getNode(e);null!=n&&t in n.docs&&(delete n.docs[t],n.df-=1)}},t.InvertedIndex.prototype.expandToken=function(e,t,n){if(null==e||""==e)return[];var t=t||[];if(void 0==n&&(n=this.getNode(e),null==n))return t;n.df>0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e<arguments.length;e++)t=arguments[e],~this.indexOf(t)||this.elements.splice(this.locationFor(t),0,t);this.length=this.elements.length},lunr.SortedSet.prototype.toArray=function(){return this.elements.slice()},lunr.SortedSet.prototype.map=function(e,t){return this.elements.map(e,t)},lunr.SortedSet.prototype.forEach=function(e,t){return this.elements.forEach(e,t)},lunr.SortedSet.prototype.indexOf=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]<u[i]?n++:s[n]>u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();o<r.length;o++)i.add(r[o]);return i},lunr.SortedSet.prototype.toJSON=function(){return this.toArray()},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.elasticlunr=t()}(this,function(){return t})}(); + /** pdoc search index */const docs = {"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": "<h1 id=\"sqlglot\">SQLGlot</h1>\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><span class=\"o\">=</span><span class=\"s2\">"duckdb"</span><span class=\"p\">,</span> <span class=\"n\">write</span><span class=\"o\">=</span><span class=\"s2\">"hive"</span><span class=\"p\">)[</span><span class=\"mi\">0</span><span class=\"p\">]</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"s1\">'SELECT FROM_UNIXTIME(1618088028295 / 1000)'</span>\n</code></pre>\n</div>\n\n<p>SQLGlot can even translate custom time formats:</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 STRFTIME(x, '%y-%-m-%S')"</span><span class=\"p\">,</span> <span class=\"n\">read</span><span class=\"o\">=</span><span class=\"s2\">"duckdb"</span><span class=\"p\">,</span> <span class=\"n\">write</span><span class=\"o\">=</span><span class=\"s2\">"hive"</span><span class=\"p\">)[</span><span class=\"mi\">0</span><span class=\"p\">]</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"ss\">"SELECT DATE_FORMAT(x, 'yy-M-ss')"</span>\n</code></pre>\n</div>\n\n<p>As another example, let's suppose that we want to read in a SQL query that contains a CTE and a cast to <code>REAL</code>, and then transpile it to Spark, which uses backticks for identifiers and <code>FLOAT</code> instead of <code>REAL</code>:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n\n<span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"""WITH baz AS (SELECT a, c FROM foo WHERE a = 1) SELECT f.a, b.b, baz.c, CAST("b"."a" AS REAL) d FROM foo f JOIN bar b ON f.a = b.a LEFT JOIN baz ON f.a = baz.a"""</span>\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">transpile</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">,</span> <span class=\"n\">write</span><span class=\"o\">=</span><span class=\"s2\">"spark"</span><span class=\"p\">,</span> <span class=\"n\">identify</span><span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">,</span> <span class=\"n\">pretty</span><span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">)[</span><span class=\"mi\">0</span><span class=\"p\">])</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">WITH</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">baz</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"k\">SELECT</span>\n<span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span><span class=\"p\">,</span>\n<span class=\"w\"> </span><span class=\"o\">`</span><span class=\"k\">c</span><span class=\"o\">`</span>\n<span class=\"w\"> </span><span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">foo</span><span class=\"o\">`</span>\n<span class=\"w\"> </span><span class=\"k\">WHERE</span>\n<span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"mi\">1</span>\n<span class=\"p\">)</span>\n<span class=\"k\">SELECT</span>\n<span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">f</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span><span class=\"p\">,</span>\n<span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">b</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">b</span><span class=\"o\">`</span><span class=\"p\">,</span>\n<span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">baz</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"k\">c</span><span class=\"o\">`</span><span class=\"p\">,</span>\n<span class=\"w\"> </span><span class=\"k\">CAST</span><span class=\"p\">(</span><span class=\"o\">`</span><span class=\"n\">b</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"nb\">FLOAT</span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">d</span><span class=\"o\">`</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">foo</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">f</span><span class=\"o\">`</span>\n<span class=\"k\">JOIN</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">bar</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">b</span><span class=\"o\">`</span>\n<span class=\"w\"> </span><span class=\"k\">ON</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">f</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">b</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span>\n<span class=\"k\">LEFT</span><span class=\"w\"> </span><span class=\"k\">JOIN</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">baz</span><span class=\"o\">`</span>\n<span class=\"w\"> </span><span class=\"k\">ON</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">f</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"o\">`</span><span class=\"n\">baz</span><span class=\"o\">`</span><span class=\"p\">.</span><span class=\"o\">`</span><span class=\"n\">a</span><span class=\"o\">`</span>\n</code></pre>\n</div>\n\n<p>Comments are also preserved in a best-effort basis when transpiling SQL code:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"""</span>\n<span class=\"s2\">/* multi</span>\n<span class=\"s2\"> line</span>\n<span class=\"s2\"> comment</span>\n<span class=\"s2\">*/</span>\n<span class=\"s2\">SELECT</span>\n<span class=\"s2\"> tbl.cola /* comment 1 */ + tbl.colb /* comment 2 */,</span>\n<span class=\"s2\"> CAST(x AS INT), # comment 3</span>\n<span class=\"s2\"> y -- comment 4</span>\n<span class=\"s2\">FROM</span>\n<span class=\"s2\"> bar /* comment 5 */,</span>\n<span class=\"s2\"> tbl # comment 6</span>\n<span class=\"s2\">"""</span>\n\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">transpile</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">,</span> <span class=\"n\">read</span><span class=\"o\">=</span><span class=\"s1\">'mysql'</span><span class=\"p\">,</span> <span class=\"n\">pretty</span><span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">)[</span><span class=\"mi\">0</span><span class=\"p\">])</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"cm\">/* multi</span>\n<span class=\"cm\"> line</span>\n<span class=\"cm\"> comment</span>\n<span class=\"cm\">*/</span>\n<span class=\"k\">SELECT</span>\n<span class=\"w\"> </span><span class=\"n\">tbl</span><span class=\"p\">.</span><span class=\"n\">cola</span><span class=\"w\"> </span><span class=\"cm\">/* comment 1 */</span><span class=\"w\"> </span><span class=\"o\">+</span><span class=\"w\"> </span><span class=\"n\">tbl</span><span class=\"p\">.</span><span class=\"n\">colb</span><span class=\"w\"> </span><span class=\"cm\">/* comment 2 */</span><span class=\"p\">,</span>\n<span class=\"w\"> </span><span class=\"k\">CAST</span><span class=\"p\">(</span><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"nb\">INT</span><span class=\"p\">),</span><span class=\"w\"> </span><span class=\"cm\">/* comment 3 */</span>\n<span class=\"w\"> </span><span class=\"n\">y</span><span class=\"w\"> </span><span class=\"cm\">/* comment 4 */</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">bar</span><span class=\"w\"> </span><span class=\"cm\">/* comment 5 */</span><span class=\"p\">,</span><span class=\"w\"> </span><span class=\"n\">tbl</span><span class=\"w\"> </span><span class=\"cm\">/* comment 6 */</span>\n</code></pre>\n</div>\n\n<h3 id=\"metadata\">Metadata</h3>\n\n<p>You can explore SQL with expression helpers to do things like find columns and tables:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span><span class=\"p\">,</span> <span class=\"n\">exp</span>\n\n<span class=\"c1\"># print all column references (a and b)</span>\n<span class=\"k\">for</span> <span class=\"n\">column</span> <span class=\"ow\">in</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a, b + 1 AS c FROM d"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">find_all</span><span class=\"p\">(</span><span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">):</span>\n <span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">alias_or_name</span><span class=\"p\">)</span>\n\n<span class=\"c1\"># find all projections in select statements (a and c)</span>\n<span class=\"k\">for</span> <span class=\"n\">select</span> <span class=\"ow\">in</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a, b + 1 AS c FROM d"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">find_all</span><span class=\"p\">(</span><span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Select</span><span class=\"p\">):</span>\n <span class=\"k\">for</span> <span class=\"n\">projection</span> <span class=\"ow\">in</span> <span class=\"n\">select</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">:</span>\n <span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">projection</span><span class=\"o\">.</span><span class=\"n\">alias_or_name</span><span class=\"p\">)</span>\n\n<span class=\"c1\"># find all tables (x, y, z)</span>\n<span class=\"k\">for</span> <span class=\"n\">table</span> <span class=\"ow\">in</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM x JOIN y JOIN z"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">find_all</span><span class=\"p\">(</span><span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Table</span><span class=\"p\">):</span>\n <span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">table</span><span class=\"o\">.</span><span class=\"n\">name</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<h3 id=\"parser-errors\">Parser Errors</h3>\n\n<p>When the parser detects an error in the syntax, it raises a ParserError:</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 foo( FROM bar"</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<pre><code>sqlglot.errors.ParseError: Expecting ). Line 1, Col: 13.\n select foo( FROM bar\n ~~~~\n</code></pre>\n\n<p>Structured syntax errors are accessible for programmatic use:</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=\"k\">try</span><span class=\"p\">:</span>\n <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">transpile</span><span class=\"p\">(</span><span class=\"s2\">"SELECT foo( FROM bar"</span><span class=\"p\">)</span>\n<span class=\"k\">except</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">errors</span><span class=\"o\">.</span><span class=\"n\">ParseError</span> <span class=\"k\">as</span> <span class=\"n\">e</span><span class=\"p\">:</span>\n <span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"o\">.</span><span class=\"n\">errors</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"p\">[{</span>\n <span class=\"s1\">'description'</span><span class=\"p\">:</span> <span class=\"s1\">'Expecting )'</span><span class=\"p\">,</span>\n <span class=\"s1\">'line'</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span>\n <span class=\"s1\">'col'</span><span class=\"p\">:</span> <span class=\"mi\">13</span><span class=\"p\">,</span>\n <span class=\"s1\">'start_context'</span><span class=\"p\">:</span> <span class=\"s1\">'SELECT foo( '</span><span class=\"p\">,</span>\n <span class=\"s1\">'highlight'</span><span class=\"p\">:</span> <span class=\"s1\">'FROM'</span><span class=\"p\">,</span>\n <span class=\"s1\">'end_context'</span><span class=\"p\">:</span> <span class=\"s1\">' bar'</span>\n<span class=\"p\">}]</span>\n</code></pre>\n</div>\n\n<h3 id=\"unsupported-errors\">Unsupported Errors</h3>\n\n<p>Presto <code>APPROX_DISTINCT</code> supports the accuracy argument which is not supported in Hive:</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 APPROX_DISTINCT(a, 0.1) FROM foo"</span><span class=\"p\">,</span> <span class=\"n\">read</span><span class=\"o\">=</span><span class=\"s2\">"presto"</span><span class=\"p\">,</span> <span class=\"n\">write</span><span class=\"o\">=</span><span class=\"s2\">"hive"</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">APPROX_COUNT_DISTINCT</span><span class=\"w\"> </span><span class=\"n\">does</span><span class=\"w\"> </span><span class=\"k\">not</span><span class=\"w\"> </span><span class=\"n\">support</span><span class=\"w\"> </span><span class=\"n\">accuracy</span>\n<span class=\"s1\">'SELECT APPROX_COUNT_DISTINCT(a) FROM foo'</span>\n</code></pre>\n</div>\n\n<h3 id=\"build-and-modify-sql\">Build and Modify SQL</h3>\n\n<p>SQLGlot supports incrementally building sql expressions:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">select</span><span class=\"p\">,</span> <span class=\"n\">condition</span>\n\n<span class=\"n\">where</span> <span class=\"o\">=</span> <span class=\"n\">condition</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">and_</span><span class=\"p\">(</span><span class=\"s2\">"y=1"</span><span class=\"p\">)</span>\n<span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"*"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"y"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">where</span><span class=\"p\">(</span><span class=\"n\">where</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"s1\">'SELECT * FROM y WHERE x = 1 AND y = 1'</span>\n</code></pre>\n</div>\n\n<p>You can also modify a parsed tree:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT x FROM y"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"z"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"s1\">'SELECT x FROM y, z'</span>\n</code></pre>\n</div>\n\n<p>There is also a way to recursively transform the parsed tree by applying a mapping function to each tree node:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">exp</span><span class=\"p\">,</span> <span class=\"n\">parse_one</span>\n\n<span class=\"n\">expression_tree</span> <span class=\"o\">=</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a FROM x"</span><span class=\"p\">)</span>\n\n<span class=\"k\">def</span> <span class=\"nf\">transformer</span><span class=\"p\">(</span><span class=\"n\">node</span><span class=\"p\">):</span>\n <span class=\"k\">if</span> <span class=\"nb\">isinstance</span><span class=\"p\">(</span><span class=\"n\">node</span><span class=\"p\">,</span> <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">)</span> <span class=\"ow\">and</span> <span class=\"n\">node</span><span class=\"o\">.</span><span class=\"n\">name</span> <span class=\"o\">==</span> <span class=\"s2\">"a"</span><span class=\"p\">:</span>\n <span class=\"k\">return</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"FUN(a)"</span><span class=\"p\">)</span>\n <span class=\"k\">return</span> <span class=\"n\">node</span>\n\n<span class=\"n\">transformed_tree</span> <span class=\"o\">=</span> <span class=\"n\">expression_tree</span><span class=\"o\">.</span><span class=\"n\">transform</span><span class=\"p\">(</span><span class=\"n\">transformer</span><span class=\"p\">)</span>\n<span class=\"n\">transformed_tree</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"s1\">'SELECT FUN(a) FROM x'</span>\n</code></pre>\n</div>\n\n<h3 id=\"sql-optimizer\">SQL Optimizer</h3>\n\n<p>SQLGlot can rewrite queries into an \"optimized\" form. It performs a variety of <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/optimizer/optimizer.py\">techniques</a> to create a new canonical AST. This AST can be used to standardize queries or provide the foundations for implementing an actual engine. For example:</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=\"kn\">from</span> <span class=\"nn\">sqlglot.optimizer</span> <span class=\"kn\">import</span> <span class=\"n\">optimize</span>\n\n<span class=\"nb\">print</span><span class=\"p\">(</span>\n <span class=\"n\">optimize</span><span class=\"p\">(</span>\n <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"""</span>\n<span class=\"s2\"> SELECT A OR (B OR (C AND D))</span>\n<span class=\"s2\"> FROM x</span>\n<span class=\"s2\"> WHERE Z = date '2021-01-01' + INTERVAL '1' month OR 1 = 0</span>\n<span class=\"s2\"> """</span><span class=\"p\">),</span>\n <span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s2\">"x"</span><span class=\"p\">:</span> <span class=\"p\">{</span><span class=\"s2\">"A"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"B"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"C"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"D"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"Z"</span><span class=\"p\">:</span> <span class=\"s2\">"STRING"</span><span class=\"p\">}}</span>\n <span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">pretty</span><span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">)</span>\n<span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">SELECT</span>\n<span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"a"</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"b"</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"c"</span>\n<span class=\"w\"> </span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"a"</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"b"</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"d"</span>\n<span class=\"w\"> </span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"ss\">"_col_0"</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"ss\">"x"</span>\n<span class=\"k\">WHERE</span>\n<span class=\"w\"> </span><span class=\"k\">CAST</span><span class=\"p\">(</span><span class=\"ss\">"x"</span><span class=\"p\">.</span><span class=\"ss\">"z"</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"nb\">DATE</span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"k\">CAST</span><span class=\"p\">(</span><span class=\"s1\">'2021-02-01'</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"nb\">DATE</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<h3 id=\"ast-introspection\">AST Introspection</h3>\n\n<p>You can see the AST version of the sql by calling <code>repr</code>:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"nb\">repr</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a + 1 AS z"</span><span class=\"p\">)))</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"p\">(</span><span class=\"n\">SELECT</span> <span class=\"n\">expressions</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">ALIAS</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">ADD</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">COLUMN</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">a</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)),</span> <span class=\"n\">expression</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">LITERAL</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"n\">is_string</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)),</span> <span class=\"n\">alias</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">z</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)))</span>\n</code></pre>\n</div>\n\n<h3 id=\"ast-diff\">AST Diff</h3>\n\n<p>SQLGlot can calculate the difference between two expressions and output changes in a form of a sequence of actions needed to transform a source expression into a target one:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">diff</span><span class=\"p\">,</span> <span class=\"n\">parse_one</span>\n<span class=\"n\">diff</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a + b, c, d"</span><span class=\"p\">),</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT c, a - b, d"</span><span class=\"p\">))</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"p\">[</span>\n <span class=\"n\">Remove</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"o\">=</span><span class=\"p\">(</span><span class=\"n\">ADD</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">COLUMN</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">a</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)),</span> <span class=\"n\">expression</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">COLUMN</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">b</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)))),</span>\n <span class=\"n\">Insert</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"o\">=</span><span class=\"p\">(</span><span class=\"n\">SUB</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">COLUMN</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">a</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)),</span> <span class=\"n\">expression</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">COLUMN</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">b</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)))),</span>\n <span class=\"n\">Move</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"o\">=</span><span class=\"p\">(</span><span class=\"n\">COLUMN</span> <span class=\"n\">this</span><span class=\"p\">:</span>\n <span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">c</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">))),</span>\n <span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">source</span><span class=\"o\">=</span><span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">b</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">),</span> <span class=\"n\">target</span><span class=\"o\">=</span><span class=\"p\">(</span><span class=\"n\">IDENTIFIER</span> <span class=\"n\">this</span><span class=\"p\">:</span> <span class=\"n\">b</span><span class=\"p\">,</span> <span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">)),</span>\n <span class=\"o\">...</span>\n<span class=\"p\">]</span>\n</code></pre>\n</div>\n\n<p>See also: <a href=\"https://github.com/tobymao/sqlglot/blob/main/posts/sql_diff.md\">Semantic Diff for SQL</a>.</p>\n\n<h3 id=\"custom-dialects\">Custom Dialects</h3>\n\n<p><a href=\"https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects\">Dialects</a> can be added by subclassing <code>Dialect</code>:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">exp</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dialects.dialect</span> <span class=\"kn\">import</span> <span class=\"n\">Dialect</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.generator</span> <span class=\"kn\">import</span> <span class=\"n\">Generator</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.tokens</span> <span class=\"kn\">import</span> <span class=\"n\">Tokenizer</span><span class=\"p\">,</span> <span class=\"n\">TokenType</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Custom</span><span class=\"p\">(</span><span class=\"n\">Dialect</span><span class=\"p\">):</span>\n <span class=\"k\">class</span> <span class=\"nc\">Tokenizer</span><span class=\"p\">(</span><span class=\"n\">Tokenizer</span><span class=\"p\">):</span>\n <span class=\"n\">QUOTES</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"s2\">"'"</span><span class=\"p\">,</span> <span class=\"s1\">'"'</span><span class=\"p\">]</span>\n <span class=\"n\">IDENTIFIERS</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"s2\">"`"</span><span class=\"p\">]</span>\n\n <span class=\"n\">KEYWORDS</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n <span class=\"o\">**</span><span class=\"n\">Tokenizer</span><span class=\"o\">.</span><span class=\"n\">KEYWORDS</span><span class=\"p\">,</span>\n <span class=\"s2\">"INT64"</span><span class=\"p\">:</span> <span class=\"n\">TokenType</span><span class=\"o\">.</span><span class=\"n\">BIGINT</span><span class=\"p\">,</span>\n <span class=\"s2\">"FLOAT64"</span><span class=\"p\">:</span> <span class=\"n\">TokenType</span><span class=\"o\">.</span><span class=\"n\">DOUBLE</span><span class=\"p\">,</span>\n <span class=\"p\">}</span>\n\n <span class=\"k\">class</span> <span class=\"nc\">Generator</span><span class=\"p\">(</span><span class=\"n\">Generator</span><span class=\"p\">):</span>\n <span class=\"n\">TRANSFORMS</span> <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Array</span><span class=\"p\">:</span> <span class=\"k\">lambda</span> <span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"n\">e</span><span class=\"p\">:</span> <span class=\"sa\">f</span><span class=\"s2\">"[</span><span class=\"si\">{</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">)</span><span class=\"si\">}</span><span class=\"s2\">]"</span><span class=\"p\">}</span>\n\n <span class=\"n\">TYPE_MAPPING</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">TINYINT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">SMALLINT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">INT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">BIGINT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">DECIMAL</span><span class=\"p\">:</span> <span class=\"s2\">"NUMERIC"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">FLOAT</span><span class=\"p\">:</span> <span class=\"s2\">"FLOAT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">DOUBLE</span><span class=\"p\">:</span> <span class=\"s2\">"FLOAT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">BOOLEAN</span><span class=\"p\">:</span> <span class=\"s2\">"BOOL"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">TEXT</span><span class=\"p\">:</span> <span class=\"s2\">"STRING"</span><span class=\"p\">,</span>\n <span class=\"p\">}</span>\n\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">Dialect</span><span class=\"p\">[</span><span class=\"s2\">"custom"</span><span class=\"p\">])</span>\n</code></pre>\n</div>\n\n<pre><code><class '__main__.Custom'>\n</code></pre>\n\n<h3 id=\"sql-execution\">SQL Execution</h3>\n\n<p>One can even interpret SQL queries using SQLGlot, where the tables are represented as Python dictionaries. Although the engine is not very fast (it's not supposed to be) and is in a relatively early stage of development, it can be useful for unit testing and running SQL natively across Python objects. Additionally, the foundation can be easily integrated with fast compute kernels (arrow, pandas). Below is an example showcasing the execution of a SELECT expression that involves aggregations and JOINs:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot.executor</span> <span class=\"kn\">import</span> <span class=\"n\">execute</span>\n\n<span class=\"n\">tables</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n <span class=\"s2\">"sushi"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n <span class=\"p\">{</span><span class=\"s2\">"id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"price"</span><span class=\"p\">:</span> <span class=\"mf\">1.0</span><span class=\"p\">},</span>\n <span class=\"p\">{</span><span class=\"s2\">"id"</span><span class=\"p\">:</span> <span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"s2\">"price"</span><span class=\"p\">:</span> <span class=\"mf\">2.0</span><span class=\"p\">},</span>\n <span class=\"p\">{</span><span class=\"s2\">"id"</span><span class=\"p\">:</span> <span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"s2\">"price"</span><span class=\"p\">:</span> <span class=\"mf\">3.0</span><span class=\"p\">},</span>\n <span class=\"p\">],</span>\n <span class=\"s2\">"order_items"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n <span class=\"p\">{</span><span class=\"s2\">"sushi_id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"order_id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">},</span>\n <span class=\"p\">{</span><span class=\"s2\">"sushi_id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"order_id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">},</span>\n <span class=\"p\">{</span><span class=\"s2\">"sushi_id"</span><span class=\"p\">:</span> <span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"s2\">"order_id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">},</span>\n <span class=\"p\">{</span><span class=\"s2\">"sushi_id"</span><span class=\"p\">:</span> <span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"s2\">"order_id"</span><span class=\"p\">:</span> <span class=\"mi\">2</span><span class=\"p\">},</span>\n <span class=\"p\">],</span>\n <span class=\"s2\">"orders"</span><span class=\"p\">:</span> <span class=\"p\">[</span>\n <span class=\"p\">{</span><span class=\"s2\">"id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"user_id"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">},</span>\n <span class=\"p\">{</span><span class=\"s2\">"id"</span><span class=\"p\">:</span> <span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"s2\">"user_id"</span><span class=\"p\">:</span> <span class=\"mi\">2</span><span class=\"p\">},</span>\n <span class=\"p\">],</span>\n<span class=\"p\">}</span>\n\n<span class=\"n\">execute</span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"sd\">"""</span>\n<span class=\"sd\"> SELECT</span>\n<span class=\"sd\"> o.user_id,</span>\n<span class=\"sd\"> SUM(s.price) AS price</span>\n<span class=\"sd\"> FROM orders o</span>\n<span class=\"sd\"> JOIN order_items i</span>\n<span class=\"sd\"> ON o.id = i.order_id</span>\n<span class=\"sd\"> JOIN sushi s</span>\n<span class=\"sd\"> ON i.sushi_id = s.id</span>\n<span class=\"sd\"> GROUP BY o.user_id</span>\n<span class=\"sd\"> """</span><span class=\"p\">,</span>\n <span class=\"n\">tables</span><span class=\"o\">=</span><span class=\"n\">tables</span>\n<span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">user_id</span> <span class=\"n\">price</span>\n <span class=\"mi\">1</span> <span class=\"mf\">4.0</span>\n <span class=\"mi\">2</span> <span class=\"mf\">3.0</span>\n</code></pre>\n</div>\n\n<p>See also: <a href=\"https://github.com/tobymao/sqlglot/blob/main/posts/python_sql_engine.md\">Writing a Python SQL engine from scratch</a>.</p>\n\n<h2 id=\"used-by\">Used By</h2>\n\n<ul>\n<li><a href=\"https://github.com/fugue-project/fugue\">Fugue</a></li>\n<li><a href=\"https://github.com/ibis-project/ibis\">ibis</a></li>\n<li><a href=\"https://github.com/kelsin/mysql-mimic\">mysql-mimic</a></li>\n<li><a href=\"https://github.com/pinterest/querybook\">Querybook</a></li>\n<li><a href=\"https://github.com/marsupialtail/quokka\">Quokka</a></li>\n<li><a href=\"https://github.com/moj-analytical-services/splink\">Splink</a></li>\n</ul>\n\n<h2 id=\"documentation\">Documentation</h2>\n\n<p>SQLGlot uses <a href=\"https://pdoc.dev/\">pdoc</a> to serve its API documentation:</p>\n\n<pre><code>make docs-serve\n</code></pre>\n\n<h2 id=\"run-tests-and-lint\">Run Tests and Lint</h2>\n\n<pre><code>make check # Set SKIP_INTEGRATION=1 to skip integration tests\n</code></pre>\n\n<h2 id=\"benchmarks\">Benchmarks</h2>\n\n<p><a href=\"https://github.com/tobymao/sqlglot/blob/main/benchmarks/bench.py\">Benchmarks</a> run on Python 3.10.5 in seconds.</p>\n\n<table>\n<thead>\n<tr>\n <th>Query</th>\n <th>sqlglot</th>\n <th>sqlfluff</th>\n <th>sqltree</th>\n <th>sqlparse</th>\n <th>moz_sql_parser</th>\n <th>sqloxide</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n <td>tpch</td>\n <td>0.01308 (1.0)</td>\n <td>1.60626 (122.7)</td>\n <td>0.01168 (0.893)</td>\n <td>0.04958 (3.791)</td>\n <td>0.08543 (6.531)</td>\n <td>0.00136 (0.104)</td>\n</tr>\n<tr>\n <td>short</td>\n <td>0.00109 (1.0)</td>\n <td>0.14134 (129.2)</td>\n <td>0.00099 (0.906)</td>\n <td>0.00342 (3.131)</td>\n <td>0.00652 (5.970)</td>\n <td>8.76E-5 (0.080)</td>\n</tr>\n<tr>\n <td>long</td>\n <td>0.01399 (1.0)</td>\n <td>2.12632 (151.9)</td>\n <td>0.01126 (0.805)</td>\n <td>0.04410 (3.151)</td>\n <td>0.06671 (4.767)</td>\n <td>0.00107 (0.076)</td>\n</tr>\n<tr>\n <td>crazy</td>\n <td>0.03969 (1.0)</td>\n <td>24.3777 (614.1)</td>\n <td>0.03917 (0.987)</td>\n <td>11.7043 (294.8)</td>\n <td>1.03280 (26.02)</td>\n <td>0.00625 (0.157)</td>\n</tr>\n</tbody>\n</table>\n\n<h2 id=\"optional-dependencies\">Optional Dependencies</h2>\n\n<p>SQLGlot uses <a href=\"https://github.com/dateutil/dateutil\">dateutil</a> to simplify literal timedelta expressions. The optimizer will not simplify expressions like the following if the module cannot be found:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"o\">+</span><span class=\"w\"> </span><span class=\"nb\">interval</span><span class=\"w\"> </span><span class=\"s1\">'1'</span><span class=\"w\"> </span><span class=\"k\">month</span>\n</code></pre>\n</div>\n\n<hr />\n"}, "sqlglot.pretty": {"fullname": "sqlglot.pretty", "modulename": "sqlglot", "qualname": "pretty", "kind": "variable", "doc": "<p>Whether to format generated SQL by default.</p>\n", "default_value": " = False"}, "sqlglot.schema": {"fullname": "sqlglot.schema", "modulename": "sqlglot.schema", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.parse": {"fullname": "sqlglot.parse", "modulename": "sqlglot", "qualname": "parse", "kind": "function", "doc": "<p>Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql:</strong> the SQL code string to parse.</li>\n<li><strong>read:</strong> the SQL dialect to apply during parsing (eg. \"spark\", \"hive\", \"presto\", \"mysql\").</li>\n<li><strong>**opts:</strong> other <code>sqlglot.parser.Parser</code> options.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The resulting syntax tree collection.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">read</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.parse_one": {"fullname": "sqlglot.parse_one", "modulename": "sqlglot", "qualname": "parse_one", "kind": "function", "doc": "<p>Parses the given SQL string and returns a syntax tree for the first parsed SQL statement.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql:</strong> the SQL code string to parse.</li>\n<li><strong>read:</strong> the SQL dialect to apply during parsing (eg. \"spark\", \"hive\", \"presto\", \"mysql\").</li>\n<li><strong>into:</strong> the SQLGlot Expression to parse into.</li>\n<li><strong>**opts:</strong> other <code>sqlglot.parser.Parser</code> options.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The syntax tree for the first parsed statement.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">read</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">into</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"n\">Collection</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.transpile": {"fullname": "sqlglot.transpile", "modulename": "sqlglot", "qualname": "transpile", "kind": "function", "doc": "<p>Parses the given SQL string in accordance with the source dialect and returns a list of SQL strings transformed\nto conform to the target dialect. Each string in the returned list represents a single transformed SQL statement.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql:</strong> the SQL code string to transpile.</li>\n<li><strong>read:</strong> the source dialect used to parse the input string (eg. \"spark\", \"hive\", \"presto\", \"mysql\").</li>\n<li><strong>write:</strong> the target dialect into which the input should be transformed (eg. \"spark\", \"hive\", \"presto\", \"mysql\").</li>\n<li><strong>identity:</strong> if set to <code>True</code> and if the target dialect is not specified the source dialect will be used as both:\nthe source and the target dialect.</li>\n<li><strong>error_level:</strong> the desired error level of the parser.</li>\n<li><strong>**opts:</strong> other <code>sqlglot.generator.Generator</code> options.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The list of transpiled SQL statements.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">read</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">write</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">identity</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">error_level</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">errors</span><span class=\"o\">.</span><span class=\"n\">ErrorLevel</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe": {"fullname": "sqlglot.dataframe", "modulename": "sqlglot.dataframe", "kind": "module", "doc": "<h1 id=\"pyspark-dataframe-sql-generator\">PySpark DataFrame SQL Generator</h1>\n\n<p>This is a drop-in replacement for the PySpark DataFrame API that will generate SQL instead of executing DataFrame operations directly. This, when combined with the transpiling support in SQLGlot, allows one to write PySpark DataFrame code and execute it on other engines 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>. </p>\n\n<p>Currently many of the common operations are covered and more functionality will be added over time. Please <a href=\"https://github.com/tobymao/sqlglot/issues\">open an issue</a> or <a href=\"https://github.com/tobymao/sqlglot/pulls\">PR</a> with your feedback or contribution to help influence what should be prioritized next and make sure your use case is properly supported.</p>\n\n<h1 id=\"how-to-use\">How to use</h1>\n\n<h2 id=\"instructions\">Instructions</h2>\n\n<ul>\n<li><a href=\"https://github.com/tobymao/sqlglot/blob/main/README.md#install\">Install SQLGlot</a> and that is all that is required to just generate SQL. <a href=\"#examples\">The examples</a> show generating SQL and then executing that SQL on a specific engine and that will require that engine's client library.</li>\n<li>Find/replace all <code>from pyspark.sql</code> with <code>from sqlglot.dataframe</code>.</li>\n<li>Prior to any <code>spark.read.table</code> or <code>spark.table</code> run <code>sqlglot.schema.add_table('<table_name>', <column_structure>)</code>.\n<ul>\n<li>The column structure can be defined the following ways:\n<ul>\n<li>Dictionary where the keys are column names and values are string of the Spark SQL type name.\n<ul>\n<li>Ex: <code>{'cola': 'string', 'colb': 'int'}</code></li>\n</ul></li>\n<li>PySpark DataFrame <code>StructType</code> similar to when using <code>createDataFrame</code>.\n<ul>\n<li>Ex: <code>StructType([StructField('cola', StringType()), StructField('colb', IntegerType())])</code></li>\n</ul></li>\n<li>A string of names and types similar to what is supported in <code>createDataFrame</code>.\n<ul>\n<li>Ex: <code>cola: STRING, colb: INT</code></li>\n</ul></li>\n<li>[Not Recommended] A list of string column names without type.\n<ul>\n<li>Ex: <code>['cola', 'colb']</code></li>\n<li>The lack of types may limit functionality in future releases.</li>\n</ul></li>\n</ul></li>\n<li>See <a href=\"#registering-custom-schema-class\">Registering Custom Schema</a> for information on how to skip this step if the information is stored externally.</li>\n</ul></li>\n<li>Add <code>.sql(pretty=True)</code> to your final DataFrame command to return a list of sql statements to run that command.\n<ul>\n<li>In most cases a single SQL statement is returned. Currently the only exception is when caching DataFrames which isn't supported in other dialects. </li>\n<li>Spark is the default output dialect. See <a href=\"https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects\">dialects</a> for a full list of dialects.</li>\n<li>Ex: <code>.sql(pretty=True, dialect='bigquery')</code></li>\n</ul></li>\n</ul>\n\n<h2 id=\"examples\">Examples</h2>\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=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql.session</span> <span class=\"kn\">import</span> <span class=\"n\">SparkSession</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql</span> <span class=\"kn\">import</span> <span class=\"n\">functions</span> <span class=\"k\">as</span> <span class=\"n\">F</span>\n\n<span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">add_table</span><span class=\"p\">(</span><span class=\"s1\">'employee'</span><span class=\"p\">,</span> <span class=\"p\">{</span>\n <span class=\"s1\">'employee_id'</span><span class=\"p\">:</span> <span class=\"s1\">'INT'</span><span class=\"p\">,</span>\n <span class=\"s1\">'fname'</span><span class=\"p\">:</span> <span class=\"s1\">'STRING'</span><span class=\"p\">,</span>\n <span class=\"s1\">'lname'</span><span class=\"p\">:</span> <span class=\"s1\">'STRING'</span><span class=\"p\">,</span>\n <span class=\"s1\">'age'</span><span class=\"p\">:</span> <span class=\"s1\">'INT'</span><span class=\"p\">,</span>\n<span class=\"p\">})</span> <span class=\"c1\"># Register the table structure prior to reading from the table</span>\n\n<span class=\"n\">spark</span> <span class=\"o\">=</span> <span class=\"n\">SparkSession</span><span class=\"p\">()</span>\n\n<span class=\"n\">df</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"n\">spark</span>\n <span class=\"o\">.</span><span class=\"n\">table</span><span class=\"p\">(</span><span class=\"s1\">'employee'</span><span class=\"p\">)</span>\n <span class=\"o\">.</span><span class=\"n\">groupBy</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"age"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">agg</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">countDistinct</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"employee_id"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">alias</span><span class=\"p\">(</span><span class=\"s2\">"num_employees"</span><span class=\"p\">))</span> \n<span class=\"p\">)</span>\n\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">df</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">pretty</span><span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">))</span> <span class=\"c1\"># Spark will be the dialect used by default</span>\n</code></pre>\n</div>\n\n<pre><code>SELECT\n `employee`.`age` AS `age`,\n COUNT(DISTINCT `employee`.`employee_id`) AS `num_employees`\nFROM `employee` AS `employee`\nGROUP BY\n `employee`.`age`\n</code></pre>\n\n<h2 id=\"registering-custom-schema-class\">Registering Custom Schema Class</h2>\n\n<p>The step of adding <code>sqlglot.schema.add_table</code> can be skipped if you have the column structure stored externally like in a file or from an external metadata table. This can be done by writing a class that implements the <code>sqlglot.schema.Schema</code> abstract class and then assigning that class to <code>sqlglot.schema</code>. </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=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql.session</span> <span class=\"kn\">import</span> <span class=\"n\">SparkSession</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql</span> <span class=\"kn\">import</span> <span class=\"n\">functions</span> <span class=\"k\">as</span> <span class=\"n\">F</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.schema</span> <span class=\"kn\">import</span> <span class=\"n\">Schema</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">ExternalSchema</span><span class=\"p\">(</span><span class=\"n\">Schema</span><span class=\"p\">):</span>\n <span class=\"o\">...</span>\n\n<span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span> <span class=\"o\">=</span> <span class=\"n\">ExternalSchema</span><span class=\"p\">()</span>\n\n<span class=\"n\">spark</span> <span class=\"o\">=</span> <span class=\"n\">SparkSession</span><span class=\"p\">()</span>\n\n<span class=\"n\">df</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"n\">spark</span>\n <span class=\"o\">.</span><span class=\"n\">table</span><span class=\"p\">(</span><span class=\"s1\">'employee'</span><span class=\"p\">)</span>\n <span class=\"o\">.</span><span class=\"n\">groupBy</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"age"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">agg</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">countDistinct</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"employee_id"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">alias</span><span class=\"p\">(</span><span class=\"s2\">"num_employees"</span><span class=\"p\">))</span> \n<span class=\"p\">)</span>\n\n<span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"n\">df</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">pretty</span><span class=\"o\">=</span><span class=\"kc\">True</span><span class=\"p\">))</span>\n</code></pre>\n</div>\n\n<h2 id=\"example-implementations\">Example Implementations</h2>\n\n<h3 id=\"bigquery\">Bigquery</h3>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">google.cloud</span> <span class=\"kn\">import</span> <span class=\"n\">bigquery</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql.session</span> <span class=\"kn\">import</span> <span class=\"n\">SparkSession</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql</span> <span class=\"kn\">import</span> <span class=\"n\">types</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql</span> <span class=\"kn\">import</span> <span class=\"n\">functions</span> <span class=\"k\">as</span> <span class=\"n\">F</span>\n\n<span class=\"n\">client</span> <span class=\"o\">=</span> <span class=\"n\">bigquery</span><span class=\"o\">.</span><span class=\"n\">Client</span><span class=\"p\">()</span>\n\n<span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"p\">[</span>\n <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"Jack"</span><span class=\"p\">,</span> <span class=\"s2\">"Shephard"</span><span class=\"p\">,</span> <span class=\"mi\">34</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"s2\">"John"</span><span class=\"p\">,</span> <span class=\"s2\">"Locke"</span><span class=\"p\">,</span> <span class=\"mi\">48</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"s2\">"Kate"</span><span class=\"p\">,</span> <span class=\"s2\">"Austen"</span><span class=\"p\">,</span> <span class=\"mi\">34</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">4</span><span class=\"p\">,</span> <span class=\"s2\">"Claire"</span><span class=\"p\">,</span> <span class=\"s2\">"Littleton"</span><span class=\"p\">,</span> <span class=\"mi\">22</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">5</span><span class=\"p\">,</span> <span class=\"s2\">"Hugo"</span><span class=\"p\">,</span> <span class=\"s2\">"Reyes"</span><span class=\"p\">,</span> <span class=\"mi\">26</span><span class=\"p\">),</span>\n<span class=\"p\">]</span>\n<span class=\"n\">schema</span> <span class=\"o\">=</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructType</span><span class=\"p\">([</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'employee_id'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">IntegerType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'fname'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StringType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'lname'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StringType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'age'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">IntegerType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n<span class=\"p\">])</span>\n\n<span class=\"n\">sql_statements</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"n\">SparkSession</span><span class=\"p\">()</span>\n <span class=\"o\">.</span><span class=\"n\">createDataFrame</span><span class=\"p\">(</span><span class=\"n\">data</span><span class=\"p\">,</span> <span class=\"n\">schema</span><span class=\"p\">)</span>\n <span class=\"o\">.</span><span class=\"n\">groupBy</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"age"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">agg</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">countDistinct</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"employee_id"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">alias</span><span class=\"p\">(</span><span class=\"s2\">"num_employees"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"s2\">"bigquery"</span><span class=\"p\">)</span>\n<span class=\"p\">)</span>\n\n<span class=\"n\">result</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>\n<span class=\"k\">for</span> <span class=\"n\">sql</span> <span class=\"ow\">in</span> <span class=\"n\">sql_statements</span><span class=\"p\">:</span>\n <span class=\"n\">result</span> <span class=\"o\">=</span> <span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">query</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n\n<span class=\"k\">assert</span> <span class=\"n\">result</span> <span class=\"ow\">is</span> <span class=\"ow\">not</span> <span class=\"kc\">None</span>\n<span class=\"k\">for</span> <span class=\"n\">row</span> <span class=\"ow\">in</span> <span class=\"n\">client</span><span class=\"o\">.</span><span class=\"n\">query</span><span class=\"p\">(</span><span class=\"n\">result</span><span class=\"p\">):</span>\n <span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"sa\">f</span><span class=\"s2\">"Age: </span><span class=\"si\">{</span><span class=\"n\">row</span><span class=\"p\">[</span><span class=\"s1\">'age'</span><span class=\"p\">]</span><span class=\"si\">}</span><span class=\"s2\">, Num Employees: </span><span class=\"si\">{</span><span class=\"n\">row</span><span class=\"p\">[</span><span class=\"s1\">'num_employees'</span><span class=\"p\">]</span><span class=\"si\">}</span><span class=\"s2\">"</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<h3 id=\"snowflake\">Snowflake</h3>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">import</span> <span class=\"nn\">os</span>\n\n<span class=\"kn\">import</span> <span class=\"nn\">snowflake.connector</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.session</span> <span class=\"kn\">import</span> <span class=\"n\">SparkSession</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe</span> <span class=\"kn\">import</span> <span class=\"n\">types</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe</span> <span class=\"kn\">import</span> <span class=\"n\">functions</span> <span class=\"k\">as</span> <span class=\"n\">F</span>\n\n<span class=\"n\">ctx</span> <span class=\"o\">=</span> <span class=\"n\">snowflake</span><span class=\"o\">.</span><span class=\"n\">connector</span><span class=\"o\">.</span><span class=\"n\">connect</span><span class=\"p\">(</span>\n <span class=\"n\">user</span><span class=\"o\">=</span><span class=\"n\">os</span><span class=\"o\">.</span><span class=\"n\">environ</span><span class=\"p\">[</span><span class=\"s2\">"SNOWFLAKE_USER"</span><span class=\"p\">],</span>\n <span class=\"n\">password</span><span class=\"o\">=</span><span class=\"n\">os</span><span class=\"o\">.</span><span class=\"n\">environ</span><span class=\"p\">[</span><span class=\"s2\">"SNOWFLAKE_PASS"</span><span class=\"p\">],</span>\n <span class=\"n\">account</span><span class=\"o\">=</span><span class=\"n\">os</span><span class=\"o\">.</span><span class=\"n\">environ</span><span class=\"p\">[</span><span class=\"s2\">"SNOWFLAKE_ACCOUNT"</span><span class=\"p\">]</span>\n<span class=\"p\">)</span>\n<span class=\"n\">cs</span> <span class=\"o\">=</span> <span class=\"n\">ctx</span><span class=\"o\">.</span><span class=\"n\">cursor</span><span class=\"p\">()</span>\n\n<span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"p\">[</span>\n <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"Jack"</span><span class=\"p\">,</span> <span class=\"s2\">"Shephard"</span><span class=\"p\">,</span> <span class=\"mi\">34</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"s2\">"John"</span><span class=\"p\">,</span> <span class=\"s2\">"Locke"</span><span class=\"p\">,</span> <span class=\"mi\">48</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"s2\">"Kate"</span><span class=\"p\">,</span> <span class=\"s2\">"Austen"</span><span class=\"p\">,</span> <span class=\"mi\">34</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">4</span><span class=\"p\">,</span> <span class=\"s2\">"Claire"</span><span class=\"p\">,</span> <span class=\"s2\">"Littleton"</span><span class=\"p\">,</span> <span class=\"mi\">22</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">5</span><span class=\"p\">,</span> <span class=\"s2\">"Hugo"</span><span class=\"p\">,</span> <span class=\"s2\">"Reyes"</span><span class=\"p\">,</span> <span class=\"mi\">26</span><span class=\"p\">),</span>\n<span class=\"p\">]</span>\n<span class=\"n\">schema</span> <span class=\"o\">=</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructType</span><span class=\"p\">([</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'employee_id'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">IntegerType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'fname'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StringType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'lname'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StringType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'age'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">IntegerType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n<span class=\"p\">])</span>\n\n<span class=\"n\">sql_statements</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"n\">SparkSession</span><span class=\"p\">()</span>\n <span class=\"o\">.</span><span class=\"n\">createDataFrame</span><span class=\"p\">(</span><span class=\"n\">data</span><span class=\"p\">,</span> <span class=\"n\">schema</span><span class=\"p\">)</span>\n <span class=\"o\">.</span><span class=\"n\">groupBy</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"age"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">agg</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">countDistinct</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"lname"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">alias</span><span class=\"p\">(</span><span class=\"s2\">"num_employees"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"s2\">"snowflake"</span><span class=\"p\">)</span>\n<span class=\"p\">)</span>\n\n<span class=\"k\">try</span><span class=\"p\">:</span>\n <span class=\"k\">for</span> <span class=\"n\">sql</span> <span class=\"ow\">in</span> <span class=\"n\">sql_statements</span><span class=\"p\">:</span>\n <span class=\"n\">cs</span><span class=\"o\">.</span><span class=\"n\">execute</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n <span class=\"n\">results</span> <span class=\"o\">=</span> <span class=\"n\">cs</span><span class=\"o\">.</span><span class=\"n\">fetchall</span><span class=\"p\">()</span>\n <span class=\"k\">for</span> <span class=\"n\">row</span> <span class=\"ow\">in</span> <span class=\"n\">results</span><span class=\"p\">:</span>\n <span class=\"nb\">print</span><span class=\"p\">(</span><span class=\"sa\">f</span><span class=\"s2\">"Age: </span><span class=\"si\">{</span><span class=\"n\">row</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"si\">}</span><span class=\"s2\">, Num Employees: </span><span class=\"si\">{</span><span class=\"n\">row</span><span class=\"p\">[</span><span class=\"mi\">1</span><span class=\"p\">]</span><span class=\"si\">}</span><span class=\"s2\">"</span><span class=\"p\">)</span>\n<span class=\"k\">finally</span><span class=\"p\">:</span>\n <span class=\"n\">cs</span><span class=\"o\">.</span><span class=\"n\">close</span><span class=\"p\">()</span>\n<span class=\"n\">ctx</span><span class=\"o\">.</span><span class=\"n\">close</span><span class=\"p\">()</span>\n</code></pre>\n</div>\n\n<h3 id=\"spark\">Spark</h3>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">pyspark.sql.session</span> <span class=\"kn\">import</span> <span class=\"n\">SparkSession</span> <span class=\"k\">as</span> <span class=\"n\">PySparkSession</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql.session</span> <span class=\"kn\">import</span> <span class=\"n\">SparkSession</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql</span> <span class=\"kn\">import</span> <span class=\"n\">types</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dataframe.sql</span> <span class=\"kn\">import</span> <span class=\"n\">functions</span> <span class=\"k\">as</span> <span class=\"n\">F</span>\n\n<span class=\"n\">data</span> <span class=\"o\">=</span> <span class=\"p\">[</span>\n <span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"Jack"</span><span class=\"p\">,</span> <span class=\"s2\">"Shephard"</span><span class=\"p\">,</span> <span class=\"mi\">34</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"s2\">"John"</span><span class=\"p\">,</span> <span class=\"s2\">"Locke"</span><span class=\"p\">,</span> <span class=\"mi\">48</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"s2\">"Kate"</span><span class=\"p\">,</span> <span class=\"s2\">"Austen"</span><span class=\"p\">,</span> <span class=\"mi\">34</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">4</span><span class=\"p\">,</span> <span class=\"s2\">"Claire"</span><span class=\"p\">,</span> <span class=\"s2\">"Littleton"</span><span class=\"p\">,</span> <span class=\"mi\">22</span><span class=\"p\">),</span>\n <span class=\"p\">(</span><span class=\"mi\">5</span><span class=\"p\">,</span> <span class=\"s2\">"Hugo"</span><span class=\"p\">,</span> <span class=\"s2\">"Reyes"</span><span class=\"p\">,</span> <span class=\"mi\">26</span><span class=\"p\">),</span>\n<span class=\"p\">]</span>\n<span class=\"n\">schema</span> <span class=\"o\">=</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructType</span><span class=\"p\">([</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'employee_id'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">IntegerType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'fname'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StringType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'lname'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StringType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructField</span><span class=\"p\">(</span><span class=\"s1\">'age'</span><span class=\"p\">,</span> <span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">IntegerType</span><span class=\"p\">(),</span> <span class=\"kc\">False</span><span class=\"p\">),</span>\n<span class=\"p\">])</span>\n\n<span class=\"n\">sql_statements</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"n\">SparkSession</span><span class=\"p\">()</span>\n <span class=\"o\">.</span><span class=\"n\">createDataFrame</span><span class=\"p\">(</span><span class=\"n\">data</span><span class=\"p\">,</span> <span class=\"n\">schema</span><span class=\"p\">)</span>\n <span class=\"o\">.</span><span class=\"n\">groupBy</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"age"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">agg</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">countDistinct</span><span class=\"p\">(</span><span class=\"n\">F</span><span class=\"o\">.</span><span class=\"n\">col</span><span class=\"p\">(</span><span class=\"s2\">"employee_id"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">alias</span><span class=\"p\">(</span><span class=\"s2\">"num_employees"</span><span class=\"p\">))</span>\n <span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"s2\">"spark"</span><span class=\"p\">)</span>\n<span class=\"p\">)</span>\n\n<span class=\"n\">pyspark</span> <span class=\"o\">=</span> <span class=\"n\">PySparkSession</span><span class=\"o\">.</span><span class=\"n\">builder</span><span class=\"o\">.</span><span class=\"n\">master</span><span class=\"p\">(</span><span class=\"s2\">"local[*]"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">getOrCreate</span><span class=\"p\">()</span>\n\n<span class=\"n\">df</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>\n<span class=\"k\">for</span> <span class=\"n\">sql</span> <span class=\"ow\">in</span> <span class=\"n\">sql_statements</span><span class=\"p\">:</span>\n <span class=\"n\">df</span> <span class=\"o\">=</span> <span class=\"n\">pyspark</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n\n<span class=\"k\">assert</span> <span class=\"n\">df</span> <span class=\"ow\">is</span> <span class=\"ow\">not</span> <span class=\"kc\">None</span>\n<span class=\"n\">df</span><span class=\"o\">.</span><span class=\"n\">show</span><span class=\"p\">()</span>\n</code></pre>\n</div>\n\n<h1 id=\"unsupportable-operations\">Unsupportable Operations</h1>\n\n<p>Any operation that lacks a way to represent it in SQL cannot be supported by this tool. An example of this would be rdd operations. Since the DataFrame API though is mostly modeled around SQL concepts most operations can be supported.</p>\n"}, "sqlglot.dataframe.sql": {"fullname": "sqlglot.dataframe.sql", "modulename": "sqlglot.dataframe.sql", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.SparkSession": {"fullname": "sqlglot.dataframe.sql.SparkSession", "modulename": "sqlglot.dataframe.sql", "qualname": "SparkSession", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.SparkSession.__init__": {"fullname": "sqlglot.dataframe.sql.SparkSession.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "SparkSession.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dataframe.sql.SparkSession.table": {"fullname": "sqlglot.dataframe.sql.SparkSession.table", "modulename": "sqlglot.dataframe.sql", "qualname": "SparkSession.table", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">tableName</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"fullname": "sqlglot.dataframe.sql.SparkSession.createDataFrame", "modulename": "sqlglot.dataframe.sql", "qualname": "SparkSession.createDataFrame", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">data</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700333898336'</span><span class=\"o\">></span><span class=\"p\">],</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700333898336'</span><span class=\"o\">></span><span class=\"p\">],</span> <span class=\"n\">Tuple</span><span class=\"p\">]]</span>,</span><span class=\"param\">\t<span class=\"n\">schema</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700333867312'</span><span class=\"o\">></span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">samplingRatio</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">float</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">verifySchema</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.SparkSession.sql": {"fullname": "sqlglot.dataframe.sql.SparkSession.sql", "modulename": "sqlglot.dataframe.sql", "qualname": "SparkSession.sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sqlQuery</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame": {"fullname": "sqlglot.dataframe.sql.DataFrame", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.DataFrame.__init__": {"fullname": "sqlglot.dataframe.sql.DataFrame.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">spark</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700332957056'</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>,</span><span class=\"param\">\t<span class=\"n\">branch_id</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">sequence_id</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">last_op</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">operations</span><span class=\"o\">.</span><span class=\"n\">Operation</span> <span class=\"o\">=</span> <span class=\"o\"><</span><span class=\"n\">Operation</span><span class=\"o\">.</span><span class=\"n\">INIT</span><span class=\"p\">:</span> <span class=\"o\">-</span><span class=\"mi\">1</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"n\">pending_hints</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">output_expression_container</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700332981504'</span><span class=\"o\">></span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span>)</span>"}, "sqlglot.dataframe.sql.DataFrame.sql": {"fullname": "sqlglot.dataframe.sql.DataFrame.sql", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"s1\">'spark'</span>, </span><span class=\"param\"><span class=\"n\">optimize</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.copy": {"fullname": "sqlglot.dataframe.sql.DataFrame.copy", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.copy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.select": {"fullname": "sqlglot.dataframe.sql.DataFrame.select", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.select", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.alias": {"fullname": "sqlglot.dataframe.sql.DataFrame.alias", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.alias", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.where": {"fullname": "sqlglot.dataframe.sql.DataFrame.where", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.where", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.filter": {"fullname": "sqlglot.dataframe.sql.DataFrame.filter", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.filter", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"fullname": "sqlglot.dataframe.sql.DataFrame.groupBy", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.groupBy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">group</span><span class=\"o\">.</span><span class=\"n\">GroupedData</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.agg": {"fullname": "sqlglot.dataframe.sql.DataFrame.agg", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.agg", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">exprs</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.join": {"fullname": "sqlglot.dataframe.sql.DataFrame.join", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.join", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other_df</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>,</span><span class=\"param\">\t<span class=\"n\">on</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]]</span>,</span><span class=\"param\">\t<span class=\"n\">how</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">'inner'</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"fullname": "sqlglot.dataframe.sql.DataFrame.orderBy", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.orderBy", "kind": "function", "doc": "<p>This implementation lets any ordered columns take priority over whatever is provided in <code>ascending</code>. Spark\nhas irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this\nis unlikely to come up.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">ascending</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.sort": {"fullname": "sqlglot.dataframe.sql.DataFrame.sort", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.sort", "kind": "function", "doc": "<p>This implementation lets any ordered columns take priority over whatever is provided in <code>ascending</code>. Spark\nhas irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this\nis unlikely to come up.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">ascending</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.union": {"fullname": "sqlglot.dataframe.sql.DataFrame.union", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.union", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"fullname": "sqlglot.dataframe.sql.DataFrame.unionAll", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.unionAll", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"fullname": "sqlglot.dataframe.sql.DataFrame.unionByName", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.unionByName", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>,</span><span class=\"param\">\t<span class=\"n\">allowMissingColumns</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.intersect": {"fullname": "sqlglot.dataframe.sql.DataFrame.intersect", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.intersect", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"fullname": "sqlglot.dataframe.sql.DataFrame.intersectAll", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.intersectAll", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"fullname": "sqlglot.dataframe.sql.DataFrame.exceptAll", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.exceptAll", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.distinct": {"fullname": "sqlglot.dataframe.sql.DataFrame.distinct", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.distinct", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"fullname": "sqlglot.dataframe.sql.DataFrame.dropDuplicates", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.dropDuplicates", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.dropna": {"fullname": "sqlglot.dataframe.sql.DataFrame.dropna", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.dropna", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">how</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">'any'</span>,</span><span class=\"param\">\t<span class=\"n\">thresh</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">],</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.fillna": {"fullname": "sqlglot.dataframe.sql.DataFrame.fillna", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.fillna", "kind": "function", "doc": "<p>Functionality Difference: If you provide a value to replace a null and that type conflicts\nwith the type of the column then PySpark will just ignore your replacement.\nThis will try to cast them to be the same in some cases. So they won't always match.\nBest to not mix types so make sure replacement is the same type as the column</p>\n\n<p>Possibility for improvement: Use <code>typeof</code> function to get the type of the column\nand check if it matches the type of the value provided. If not then make it null.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331804992'</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">],</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.replace": {"fullname": "sqlglot.dataframe.sql.DataFrame.replace", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.replace", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">to_replace</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">Dict</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Collection</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331990208'</span><span class=\"o\">></span><span class=\"p\">],</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331990208'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"fullname": "sqlglot.dataframe.sql.DataFrame.withColumn", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.withColumn", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">colName</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">col</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"fullname": "sqlglot.dataframe.sql.DataFrame.withColumnRenamed", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.withColumnRenamed", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">existing</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"n\">new</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.drop": {"fullname": "sqlglot.dataframe.sql.DataFrame.drop", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.drop", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.limit": {"fullname": "sqlglot.dataframe.sql.DataFrame.limit", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.limit", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">num</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.hint": {"fullname": "sqlglot.dataframe.sql.DataFrame.hint", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.hint", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">parameters</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.repartition": {"fullname": "sqlglot.dataframe.sql.DataFrame.repartition", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.repartition", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">numPartitions</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700332136032'</span><span class=\"o\">></span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700332245248'</span><span class=\"o\">></span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"fullname": "sqlglot.dataframe.sql.DataFrame.coalesce", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.coalesce", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">numPartitions</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.cache": {"fullname": "sqlglot.dataframe.sql.DataFrame.cache", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.cache", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrame.persist": {"fullname": "sqlglot.dataframe.sql.DataFrame.persist", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrame.persist", "kind": "function", "doc": "<p>Storage Level Options: <a href=\"https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-aux-cache-cache-table.html\">https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-aux-cache-cache-table.html</a></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">storageLevel</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">'MEMORY_AND_DISK_SER'</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData": {"fullname": "sqlglot.dataframe.sql.GroupedData", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.GroupedData.__init__": {"fullname": "sqlglot.dataframe.sql.GroupedData.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">df</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>,</span><span class=\"param\">\t<span class=\"n\">group_by_cols</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">last_op</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">operations</span><span class=\"o\">.</span><span class=\"n\">Operation</span></span>)</span>"}, "sqlglot.dataframe.sql.GroupedData.agg": {"fullname": "sqlglot.dataframe.sql.GroupedData.agg", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.agg", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">exprs</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">,</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.count": {"fullname": "sqlglot.dataframe.sql.GroupedData.count", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.count", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.mean": {"fullname": "sqlglot.dataframe.sql.GroupedData.mean", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.mean", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.avg": {"fullname": "sqlglot.dataframe.sql.GroupedData.avg", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.avg", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.max": {"fullname": "sqlglot.dataframe.sql.GroupedData.max", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.max", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.min": {"fullname": "sqlglot.dataframe.sql.GroupedData.min", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.min", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.sum": {"fullname": "sqlglot.dataframe.sql.GroupedData.sum", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.sum", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.GroupedData.pivot": {"fullname": "sqlglot.dataframe.sql.GroupedData.pivot", "modulename": "sqlglot.dataframe.sql", "qualname": "GroupedData.pivot", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column": {"fullname": "sqlglot.dataframe.sql.Column", "modulename": "sqlglot.dataframe.sql", "qualname": "Column", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.Column.__init__": {"fullname": "sqlglot.dataframe.sql.Column.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700332259696'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span>)</span>"}, "sqlglot.dataframe.sql.Column.ensure_col": {"fullname": "sqlglot.dataframe.sql.Column.ensure_col", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.ensure_col", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700330611696'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.ensure_cols": {"fullname": "sqlglot.dataframe.sql.Column.ensure_cols", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.ensure_cols", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700330840736'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"fullname": "sqlglot.dataframe.sql.Column.invoke_anonymous_function", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.invoke_anonymous_function", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700330924096'</span><span class=\"o\">></span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">func_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700330964112'</span><span class=\"o\">></span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"fullname": "sqlglot.dataframe.sql.Column.invoke_expression_over_column", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.invoke_expression_over_column", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331029648'</span><span class=\"o\">></span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">callable_expression</span><span class=\"p\">:</span> <span class=\"n\">Callable</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.binary_op": {"fullname": "sqlglot.dataframe.sql.Column.binary_op", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.binary_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">klass</span><span class=\"p\">:</span> <span class=\"n\">Callable</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331083136'</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"fullname": "sqlglot.dataframe.sql.Column.inverse_binary_op", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.inverse_binary_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">klass</span><span class=\"p\">:</span> <span class=\"n\">Callable</span>,</span><span class=\"param\">\t<span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331093216'</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.unary_op": {"fullname": "sqlglot.dataframe.sql.Column.unary_op", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.unary_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">klass</span><span class=\"p\">:</span> <span class=\"n\">Callable</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.ensure_literal": {"fullname": "sqlglot.dataframe.sql.Column.ensure_literal", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.ensure_literal", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">value</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.copy": {"fullname": "sqlglot.dataframe.sql.Column.copy", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.copy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.set_table_name": {"fullname": "sqlglot.dataframe.sql.Column.set_table_name", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.set_table_name", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">table_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.sql": {"fullname": "sqlglot.dataframe.sql.Column.sql", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.alias": {"fullname": "sqlglot.dataframe.sql.Column.alias", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.alias", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.asc": {"fullname": "sqlglot.dataframe.sql.Column.asc", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.asc", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.desc": {"fullname": "sqlglot.dataframe.sql.Column.desc", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.desc", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"fullname": "sqlglot.dataframe.sql.Column.asc_nulls_first", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.asc_nulls_first", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"fullname": "sqlglot.dataframe.sql.Column.asc_nulls_last", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.asc_nulls_last", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"fullname": "sqlglot.dataframe.sql.Column.desc_nulls_first", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.desc_nulls_first", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"fullname": "sqlglot.dataframe.sql.Column.desc_nulls_last", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.desc_nulls_last", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.when": {"fullname": "sqlglot.dataframe.sql.Column.when", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.when", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">condition</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Any</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.otherwise": {"fullname": "sqlglot.dataframe.sql.Column.otherwise", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.otherwise", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Any</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.isNull": {"fullname": "sqlglot.dataframe.sql.Column.isNull", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.isNull", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.isNotNull": {"fullname": "sqlglot.dataframe.sql.Column.isNotNull", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.isNotNull", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.cast": {"fullname": "sqlglot.dataframe.sql.Column.cast", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.cast", "kind": "function", "doc": "<p>Functionality Difference: PySpark cast accepts a datatype instance of the datatype class\nSqlglot doesn't currently replicate this class so it only accepts a string</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">dataType</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.startswith": {"fullname": "sqlglot.dataframe.sql.Column.startswith", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.startswith", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.endswith": {"fullname": "sqlglot.dataframe.sql.Column.endswith", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.endswith", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.rlike": {"fullname": "sqlglot.dataframe.sql.Column.rlike", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.rlike", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">regexp</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.like": {"fullname": "sqlglot.dataframe.sql.Column.like", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.like", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.ilike": {"fullname": "sqlglot.dataframe.sql.Column.ilike", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.ilike", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">other</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.substr": {"fullname": "sqlglot.dataframe.sql.Column.substr", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.substr", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">startPos</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">length</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.isin": {"fullname": "sqlglot.dataframe.sql.Column.isin", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.isin", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331213104'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331213104'</span><span class=\"o\">></span><span class=\"p\">]]</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.between": {"fullname": "sqlglot.dataframe.sql.Column.between", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.between", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">lowerBound</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700331299440'</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"n\">upperBound</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329240384'</span><span class=\"o\">></span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Column.over": {"fullname": "sqlglot.dataframe.sql.Column.over", "modulename": "sqlglot.dataframe.sql", "qualname": "Column.over", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">window</span><span class=\"p\">:</span> <span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329314480'</span><span class=\"o\">></span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">column</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameNaFunctions": {"fullname": "sqlglot.dataframe.sql.DataFrameNaFunctions", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameNaFunctions", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"fullname": "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameNaFunctions.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">df</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span></span>)</span>"}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"fullname": "sqlglot.dataframe.sql.DataFrameNaFunctions.drop", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameNaFunctions.drop", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">how</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">'any'</span>,</span><span class=\"param\">\t<span class=\"n\">thresh</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">],</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"fullname": "sqlglot.dataframe.sql.DataFrameNaFunctions.fill", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameNaFunctions.fill", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Any</span><span class=\"p\">]]</span>,</span><span class=\"param\">\t<span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">],</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"fullname": "sqlglot.dataframe.sql.DataFrameNaFunctions.replace", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameNaFunctions.replace", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">to_replace</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">Dict</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">subset</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Window": {"fullname": "sqlglot.dataframe.sql.Window", "modulename": "sqlglot.dataframe.sql", "qualname": "Window", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.Window.__init__": {"fullname": "sqlglot.dataframe.sql.Window.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "Window.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dataframe.sql.Window.partitionBy": {"fullname": "sqlglot.dataframe.sql.Window.partitionBy", "modulename": "sqlglot.dataframe.sql", "qualname": "Window.partitionBy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329626592'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329626592'</span><span class=\"o\">></span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Window.orderBy": {"fullname": "sqlglot.dataframe.sql.Window.orderBy", "modulename": "sqlglot.dataframe.sql", "qualname": "Window.orderBy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329828768'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329828768'</span><span class=\"o\">></span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Window.rowsBetween": {"fullname": "sqlglot.dataframe.sql.Window.rowsBetween", "modulename": "sqlglot.dataframe.sql", "qualname": "Window.rowsBetween", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">start</span><span class=\"p\">:</span> <span class=\"nb\">int</span>, </span><span class=\"param\"><span class=\"n\">end</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.Window.rangeBetween": {"fullname": "sqlglot.dataframe.sql.Window.rangeBetween", "modulename": "sqlglot.dataframe.sql", "qualname": "Window.rangeBetween", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">start</span><span class=\"p\">:</span> <span class=\"nb\">int</span>, </span><span class=\"param\"><span class=\"n\">end</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.WindowSpec": {"fullname": "sqlglot.dataframe.sql.WindowSpec", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"fullname": "sqlglot.dataframe.sql.WindowSpec.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span> <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"n\">WINDOW</span> <span class=\"p\">)</span></span>)</span>"}, "sqlglot.dataframe.sql.WindowSpec.copy": {"fullname": "sqlglot.dataframe.sql.WindowSpec.copy", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.copy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.WindowSpec.sql": {"fullname": "sqlglot.dataframe.sql.WindowSpec.sql", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"fullname": "sqlglot.dataframe.sql.WindowSpec.partitionBy", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.partitionBy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329685440'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329685440'</span><span class=\"o\">></span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"fullname": "sqlglot.dataframe.sql.WindowSpec.orderBy", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.orderBy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">cols</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329654400'</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\"><</span><span class=\"n\">MagicMock</span> <span class=\"nb\">id</span><span class=\"o\">=</span><span class=\"s1\">'140700329654400'</span><span class=\"o\">></span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"fullname": "sqlglot.dataframe.sql.WindowSpec.rowsBetween", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.rowsBetween", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">start</span><span class=\"p\">:</span> <span class=\"nb\">int</span>, </span><span class=\"param\"><span class=\"n\">end</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"fullname": "sqlglot.dataframe.sql.WindowSpec.rangeBetween", "modulename": "sqlglot.dataframe.sql", "qualname": "WindowSpec.rangeBetween", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">start</span><span class=\"p\">:</span> <span class=\"nb\">int</span>, </span><span class=\"param\"><span class=\"n\">end</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">window</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameReader": {"fullname": "sqlglot.dataframe.sql.DataFrameReader", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameReader", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"fullname": "sqlglot.dataframe.sql.DataFrameReader.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameReader.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">spark</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">session</span><span class=\"o\">.</span><span class=\"n\">SparkSession</span></span>)</span>"}, "sqlglot.dataframe.sql.DataFrameReader.table": {"fullname": "sqlglot.dataframe.sql.DataFrameReader.table", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameReader.table", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">tableName</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameWriter": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter.__init__", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">df</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">DataFrame</span>,</span><span class=\"param\">\t<span class=\"n\">spark</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">session</span><span class=\"o\">.</span><span class=\"n\">SparkSession</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">mode</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">by_name</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span>)</span>"}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter.copy", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter.copy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">readwriter</span><span class=\"o\">.</span><span class=\"n\">DataFrameWriter</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter.sql", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter.sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter.mode", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter.mode", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">saveMode</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">readwriter</span><span class=\"o\">.</span><span class=\"n\">DataFrameWriter</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter.insertInto", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter.insertInto", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">tableName</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">overwrite</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">readwriter</span><span class=\"o\">.</span><span class=\"n\">DataFrameWriter</span>:</span></span>", "funcdef": "def"}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"fullname": "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable", "modulename": "sqlglot.dataframe.sql", "qualname": "DataFrameWriter.saveAsTable", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"nb\">format</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">mode</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects": {"fullname": "sqlglot.dialects", "modulename": "sqlglot.dialects", "kind": "module", "doc": "<h2 id=\"dialects\">Dialects</h2>\n\n<p>While there is a SQL standard, most SQL engines support a variation of that standard. This makes it difficult\nto write portable SQL code. SQLGlot bridges all the different variations, called \"dialects\", with an extensible\nSQL transpilation framework. </p>\n\n<p>The base <code>sqlglot.dialects.dialect.Dialect</code> class implements a generic dialect that aims to be as universal as possible.</p>\n\n<p>Each SQL variation has its own <code>Dialect</code> subclass, extending the corresponding <code>Tokenizer</code>, <code>Parser</code> and <code>Generator</code>\nclasses as needed.</p>\n\n<h3 id=\"implementing-a-custom-dialect\">Implementing a custom Dialect</h3>\n\n<p>Consider the following example:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">exp</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.dialects.dialect</span> <span class=\"kn\">import</span> <span class=\"n\">Dialect</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.generator</span> <span class=\"kn\">import</span> <span class=\"n\">Generator</span>\n<span class=\"kn\">from</span> <span class=\"nn\">sqlglot.tokens</span> <span class=\"kn\">import</span> <span class=\"n\">Tokenizer</span><span class=\"p\">,</span> <span class=\"n\">TokenType</span>\n\n\n<span class=\"k\">class</span> <span class=\"nc\">Custom</span><span class=\"p\">(</span><span class=\"n\">Dialect</span><span class=\"p\">):</span>\n <span class=\"k\">class</span> <span class=\"nc\">Tokenizer</span><span class=\"p\">(</span><span class=\"n\">Tokenizer</span><span class=\"p\">):</span>\n <span class=\"n\">QUOTES</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"s2\">"'"</span><span class=\"p\">,</span> <span class=\"s1\">'"'</span><span class=\"p\">]</span>\n <span class=\"n\">IDENTIFIERS</span> <span class=\"o\">=</span> <span class=\"p\">[</span><span class=\"s2\">"`"</span><span class=\"p\">]</span>\n\n <span class=\"n\">KEYWORDS</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n <span class=\"o\">**</span><span class=\"n\">Tokenizer</span><span class=\"o\">.</span><span class=\"n\">KEYWORDS</span><span class=\"p\">,</span>\n <span class=\"s2\">"INT64"</span><span class=\"p\">:</span> <span class=\"n\">TokenType</span><span class=\"o\">.</span><span class=\"n\">BIGINT</span><span class=\"p\">,</span>\n <span class=\"s2\">"FLOAT64"</span><span class=\"p\">:</span> <span class=\"n\">TokenType</span><span class=\"o\">.</span><span class=\"n\">DOUBLE</span><span class=\"p\">,</span>\n <span class=\"p\">}</span>\n\n <span class=\"k\">class</span> <span class=\"nc\">Generator</span><span class=\"p\">(</span><span class=\"n\">Generator</span><span class=\"p\">):</span>\n <span class=\"n\">TRANSFORMS</span> <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Array</span><span class=\"p\">:</span> <span class=\"k\">lambda</span> <span class=\"bp\">self</span><span class=\"p\">,</span> <span class=\"n\">e</span><span class=\"p\">:</span> <span class=\"sa\">f</span><span class=\"s2\">"[</span><span class=\"si\">{</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">)</span><span class=\"si\">}</span><span class=\"s2\">]"</span><span class=\"p\">}</span>\n\n <span class=\"n\">TYPE_MAPPING</span> <span class=\"o\">=</span> <span class=\"p\">{</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">TINYINT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">SMALLINT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">INT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">BIGINT</span><span class=\"p\">:</span> <span class=\"s2\">"INT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">DECIMAL</span><span class=\"p\">:</span> <span class=\"s2\">"NUMERIC"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">FLOAT</span><span class=\"p\">:</span> <span class=\"s2\">"FLOAT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">DOUBLE</span><span class=\"p\">:</span> <span class=\"s2\">"FLOAT64"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">BOOLEAN</span><span class=\"p\">:</span> <span class=\"s2\">"BOOL"</span><span class=\"p\">,</span>\n <span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"o\">.</span><span class=\"n\">TEXT</span><span class=\"p\">:</span> <span class=\"s2\">"STRING"</span><span class=\"p\">,</span>\n <span class=\"p\">}</span>\n</code></pre>\n</div>\n\n<p>This is a typical example of adding a new dialect implementation in SQLGlot: we specify its identifier and string\ndelimiters, as well as what tokens it uses for its types and how they're associated with SQLGlot types. Since\nthe <code>Expression</code> classes are common for each dialect supported in SQLGlot, we may also need to override the generation\nlogic for some expressions; this is usually done by adding new entries to the <code>TRANSFORMS</code> mapping.</p>\n\n<hr />\n"}, "sqlglot.dialects.bigquery": {"fullname": "sqlglot.dialects.bigquery", "modulename": "sqlglot.dialects.bigquery", "kind": "module", "doc": "<p>Supports BigQuery Standard SQL.</p>\n"}, "sqlglot.dialects.bigquery.BigQuery": {"fullname": "sqlglot.dialects.bigquery.BigQuery", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"fullname": "sqlglot.dialects.bigquery.BigQuery.__init__", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Tokenizer", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Parser", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.array_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Array</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.transaction_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.commit_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.rollback_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.in_unnest_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Unnest</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.except_op", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.except_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Except</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"fullname": "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op", "modulename": "sqlglot.dialects.bigquery", "qualname": "BigQuery.Generator.intersect_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Intersect</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.clickhouse": {"fullname": "sqlglot.dialects.clickhouse", "modulename": "sqlglot.dialects.clickhouse", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.clickhouse.ClickHouse": {"fullname": "sqlglot.dialects.clickhouse.ClickHouse", "modulename": "sqlglot.dialects.clickhouse", "qualname": "ClickHouse", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"fullname": "sqlglot.dialects.clickhouse.ClickHouse.__init__", "modulename": "sqlglot.dialects.clickhouse", "qualname": "ClickHouse.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"fullname": "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer", "modulename": "sqlglot.dialects.clickhouse", "qualname": "ClickHouse.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"fullname": "sqlglot.dialects.clickhouse.ClickHouse.Parser", "modulename": "sqlglot.dialects.clickhouse", "qualname": "ClickHouse.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"fullname": "sqlglot.dialects.clickhouse.ClickHouse.Generator", "modulename": "sqlglot.dialects.clickhouse", "qualname": "ClickHouse.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"fullname": "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql", "modulename": "sqlglot.dialects.clickhouse", "qualname": "ClickHouse.Generator.cte_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CTE</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.databricks": {"fullname": "sqlglot.dialects.databricks", "modulename": "sqlglot.dialects.databricks", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.databricks.Databricks": {"fullname": "sqlglot.dialects.databricks.Databricks", "modulename": "sqlglot.dialects.databricks", "qualname": "Databricks", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.spark.Spark"}, "sqlglot.dialects.databricks.Databricks.__init__": {"fullname": "sqlglot.dialects.databricks.Databricks.__init__", "modulename": "sqlglot.dialects.databricks", "qualname": "Databricks.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.databricks.Databricks.Parser": {"fullname": "sqlglot.dialects.databricks.Databricks.Parser", "modulename": "sqlglot.dialects.databricks", "qualname": "Databricks.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.dialects.spark.Spark.Parser"}, "sqlglot.dialects.databricks.Databricks.Generator": {"fullname": "sqlglot.dialects.databricks.Databricks.Generator", "modulename": "sqlglot.dialects.databricks", "qualname": "Databricks.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.dialects.spark.Spark.Generator"}, "sqlglot.dialects.dialect": {"fullname": "sqlglot.dialects.dialect", "modulename": "sqlglot.dialects.dialect", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.dialect.Dialects": {"fullname": "sqlglot.dialects.dialect.Dialects", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects", "kind": "class", "doc": "<p>An enumeration.</p>\n", "bases": "builtins.str, enum.Enum"}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"fullname": "sqlglot.dialects.dialect.Dialects.DIALECT", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.DIALECT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.DIALECT: ''>"}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"fullname": "sqlglot.dialects.dialect.Dialects.BIGQUERY", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.BIGQUERY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.BIGQUERY: 'bigquery'>"}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"fullname": "sqlglot.dialects.dialect.Dialects.CLICKHOUSE", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.CLICKHOUSE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.CLICKHOUSE: 'clickhouse'>"}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"fullname": "sqlglot.dialects.dialect.Dialects.DUCKDB", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.DUCKDB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.DUCKDB: 'duckdb'>"}, "sqlglot.dialects.dialect.Dialects.HIVE": {"fullname": "sqlglot.dialects.dialect.Dialects.HIVE", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.HIVE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.HIVE: 'hive'>"}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"fullname": "sqlglot.dialects.dialect.Dialects.MYSQL", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.MYSQL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.MYSQL: 'mysql'>"}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"fullname": "sqlglot.dialects.dialect.Dialects.ORACLE", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.ORACLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.ORACLE: 'oracle'>"}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"fullname": "sqlglot.dialects.dialect.Dialects.POSTGRES", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.POSTGRES", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.POSTGRES: 'postgres'>"}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"fullname": "sqlglot.dialects.dialect.Dialects.PRESTO", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.PRESTO", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.PRESTO: 'presto'>"}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"fullname": "sqlglot.dialects.dialect.Dialects.REDSHIFT", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.REDSHIFT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.REDSHIFT: 'redshift'>"}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"fullname": "sqlglot.dialects.dialect.Dialects.SNOWFLAKE", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.SNOWFLAKE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.SNOWFLAKE: 'snowflake'>"}, "sqlglot.dialects.dialect.Dialects.SPARK": {"fullname": "sqlglot.dialects.dialect.Dialects.SPARK", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.SPARK", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.SPARK: 'spark'>"}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"fullname": "sqlglot.dialects.dialect.Dialects.SQLITE", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.SQLITE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.SQLITE: 'sqlite'>"}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"fullname": "sqlglot.dialects.dialect.Dialects.STARROCKS", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.STARROCKS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.STARROCKS: 'starrocks'>"}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"fullname": "sqlglot.dialects.dialect.Dialects.TABLEAU", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.TABLEAU", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.TABLEAU: 'tableau'>"}, "sqlglot.dialects.dialect.Dialects.TRINO": {"fullname": "sqlglot.dialects.dialect.Dialects.TRINO", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.TRINO", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.TRINO: 'trino'>"}, "sqlglot.dialects.dialect.Dialects.TSQL": {"fullname": "sqlglot.dialects.dialect.Dialects.TSQL", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.TSQL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.TSQL: 'tsql'>"}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"fullname": "sqlglot.dialects.dialect.Dialects.DATABRICKS", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.DATABRICKS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.DATABRICKS: 'databricks'>"}, "sqlglot.dialects.dialect.Dialects.DRILL": {"fullname": "sqlglot.dialects.dialect.Dialects.DRILL", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.DRILL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.DRILL: 'drill'>"}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"fullname": "sqlglot.dialects.dialect.Dialects.TERADATA", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialects.TERADATA", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Dialects.TERADATA: 'teradata'>"}, "sqlglot.dialects.dialect.Dialect": {"fullname": "sqlglot.dialects.dialect.Dialect", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.dialects.dialect.Dialect.__init__": {"fullname": "sqlglot.dialects.dialect.Dialect.__init__", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"fullname": "sqlglot.dialects.dialect.Dialect.get_or_raise", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.get_or_raise", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.format_time": {"fullname": "sqlglot.dialects.dialect.Dialect.format_time", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.format_time", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.parse": {"fullname": "sqlglot.dialects.dialect.Dialect.parse", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.parse", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.parse_into": {"fullname": "sqlglot.dialects.dialect.Dialect.parse_into", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.parse_into", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression_type</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"n\">Collection</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]]]</span>,</span><span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.generate": {"fullname": "sqlglot.dialects.dialect.Dialect.generate", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.generate", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.transpile": {"fullname": "sqlglot.dialects.dialect.Dialect.transpile", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.transpile", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.parser": {"fullname": "sqlglot.dialects.dialect.Dialect.parser", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.parser", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parser</span><span class=\"o\">.</span><span class=\"n\">Parser</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.Dialect.generator": {"fullname": "sqlglot.dialects.dialect.Dialect.generator", "modulename": "sqlglot.dialects.dialect", "qualname": "Dialect.generator", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.rename_func": {"fullname": "sqlglot.dialects.dialect.rename_func", "modulename": "sqlglot.dialects.dialect", "qualname": "rename_func", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"fullname": "sqlglot.dialects.dialect.approx_count_distinct_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "approx_count_distinct_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ApproxDistinct</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.if_sql": {"fullname": "sqlglot.dialects.dialect.if_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "if_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">If</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"fullname": "sqlglot.dialects.dialect.arrow_json_extract_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "arrow_json_extract_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">JSONExtract</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">JSONBExtract</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"fullname": "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "arrow_json_extract_scalar_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">JSONExtractScalar</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">JSONBExtractScalar</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.inline_array_sql": {"fullname": "sqlglot.dialects.dialect.inline_array_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "inline_array_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Array</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_ilike_sql": {"fullname": "sqlglot.dialects.dialect.no_ilike_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_ilike_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ILike</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"fullname": "sqlglot.dialects.dialect.no_paren_current_date_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_paren_current_date_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CurrentDate</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"fullname": "sqlglot.dialects.dialect.no_recursive_cte_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_recursive_cte_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">With</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"fullname": "sqlglot.dialects.dialect.no_safe_divide_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_safe_divide_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">SafeDivide</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_tablesample_sql": {"fullname": "sqlglot.dialects.dialect.no_tablesample_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_tablesample_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">TableSample</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_pivot_sql": {"fullname": "sqlglot.dialects.dialect.no_pivot_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_pivot_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Pivot</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_trycast_sql": {"fullname": "sqlglot.dialects.dialect.no_trycast_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_trycast_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">TryCast</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.no_properties_sql": {"fullname": "sqlglot.dialects.dialect.no_properties_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "no_properties_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.str_position_sql": {"fullname": "sqlglot.dialects.dialect.str_position_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "str_position_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">StrPosition</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.struct_extract_sql": {"fullname": "sqlglot.dialects.dialect.struct_extract_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "struct_extract_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">StructExtract</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.var_map_sql": {"fullname": "sqlglot.dialects.dialect.var_map_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "var_map_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Map</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">VarMap</span>,</span><span class=\"param\">\t<span class=\"n\">map_func_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">'MAP'</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.format_time_lambda": {"fullname": "sqlglot.dialects.dialect.format_time_lambda", "modulename": "sqlglot.dialects.dialect", "qualname": "format_time_lambda", "kind": "function", "doc": "<p>Helper used for time expressions.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>exp_class:</strong> the expression class to instantiate.</li>\n<li><strong>dialect:</strong> target sql dialect.</li>\n<li><strong>default:</strong> the default format, True being time.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A callable that can be used to return the appropriately formatted time expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">exp_class</span><span class=\"p\">:</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">default</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">Sequence</span><span class=\"p\">],</span> <span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"fullname": "sqlglot.dialects.dialect.create_with_partitions_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "create_with_partitions_sql", "kind": "function", "doc": "<p>In Hive and Spark, the PARTITIONED BY property acts as an extension of a table's schema. When the\nPARTITIONED BY value is an array of column names, they are transformed into a schema. The corresponding\ncolumns are removed from the create statement.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Create</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.parse_date_delta": {"fullname": "sqlglot.dialects.dialect.parse_date_delta", "modulename": "sqlglot.dialects.dialect", "qualname": "parse_date_delta", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">exp_class</span><span class=\"p\">:</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">unit_mapping</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">Sequence</span><span class=\"p\">],</span> <span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.locate_to_strposition": {"fullname": "sqlglot.dialects.dialect.locate_to_strposition", "modulename": "sqlglot.dialects.dialect", "qualname": "locate_to_strposition", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"fullname": "sqlglot.dialects.dialect.strposition_to_locate_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "strposition_to_locate_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">StrPosition</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.timestrtotime_sql": {"fullname": "sqlglot.dialects.dialect.timestrtotime_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "timestrtotime_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">TimeStrToTime</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.datestrtodate_sql": {"fullname": "sqlglot.dialects.dialect.datestrtodate_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "datestrtodate_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DateStrToDate</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.dialect.trim_sql": {"fullname": "sqlglot.dialects.dialect.trim_sql", "modulename": "sqlglot.dialects.dialect", "qualname": "trim_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Trim</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.drill": {"fullname": "sqlglot.dialects.drill", "modulename": "sqlglot.dialects.drill", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.drill.if_sql": {"fullname": "sqlglot.dialects.drill.if_sql", "modulename": "sqlglot.dialects.drill", "qualname": "if_sql", "kind": "function", "doc": "<p>Drill requires backticks around certain SQL reserved words, IF being one of them, This function\nadds the backticks around the keyword IF.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>self:</strong> The Drill dialect</li>\n<li><strong>expression:</strong> The input IF expression</li>\n</ul>\n\n<p>Returns: The expression with IF in backticks.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">If</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.drill.Drill": {"fullname": "sqlglot.dialects.drill.Drill", "modulename": "sqlglot.dialects.drill", "qualname": "Drill", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.drill.Drill.__init__": {"fullname": "sqlglot.dialects.drill.Drill.__init__", "modulename": "sqlglot.dialects.drill", "qualname": "Drill.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.drill.Drill.Tokenizer": {"fullname": "sqlglot.dialects.drill.Drill.Tokenizer", "modulename": "sqlglot.dialects.drill", "qualname": "Drill.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.drill.Drill.Parser": {"fullname": "sqlglot.dialects.drill.Drill.Parser", "modulename": "sqlglot.dialects.drill", "qualname": "Drill.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.drill.Drill.Generator": {"fullname": "sqlglot.dialects.drill.Drill.Generator", "modulename": "sqlglot.dialects.drill", "qualname": "Drill.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"fullname": "sqlglot.dialects.drill.Drill.Generator.normalize_func", "modulename": "sqlglot.dialects.drill", "qualname": "Drill.Generator.normalize_func", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.duckdb": {"fullname": "sqlglot.dialects.duckdb", "modulename": "sqlglot.dialects.duckdb", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.duckdb.DuckDB": {"fullname": "sqlglot.dialects.duckdb.DuckDB", "modulename": "sqlglot.dialects.duckdb", "qualname": "DuckDB", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"fullname": "sqlglot.dialects.duckdb.DuckDB.__init__", "modulename": "sqlglot.dialects.duckdb", "qualname": "DuckDB.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"fullname": "sqlglot.dialects.duckdb.DuckDB.Tokenizer", "modulename": "sqlglot.dialects.duckdb", "qualname": "DuckDB.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"fullname": "sqlglot.dialects.duckdb.DuckDB.Parser", "modulename": "sqlglot.dialects.duckdb", "qualname": "DuckDB.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"fullname": "sqlglot.dialects.duckdb.DuckDB.Generator", "modulename": "sqlglot.dialects.duckdb", "qualname": "DuckDB.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.hive": {"fullname": "sqlglot.dialects.hive", "modulename": "sqlglot.dialects.hive", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.hive.Hive": {"fullname": "sqlglot.dialects.hive.Hive", "modulename": "sqlglot.dialects.hive", "qualname": "Hive", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.hive.Hive.__init__": {"fullname": "sqlglot.dialects.hive.Hive.__init__", "modulename": "sqlglot.dialects.hive", "qualname": "Hive.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.hive.Hive.Tokenizer": {"fullname": "sqlglot.dialects.hive.Hive.Tokenizer", "modulename": "sqlglot.dialects.hive", "qualname": "Hive.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.hive.Hive.Parser": {"fullname": "sqlglot.dialects.hive.Hive.Parser", "modulename": "sqlglot.dialects.hive", "qualname": "Hive.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.hive.Hive.Generator": {"fullname": "sqlglot.dialects.hive.Hive.Generator", "modulename": "sqlglot.dialects.hive", "qualname": "Hive.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"fullname": "sqlglot.dialects.hive.Hive.Generator.with_properties", "modulename": "sqlglot.dialects.hive", "qualname": "Hive.Generator.with_properties", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">properties</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"fullname": "sqlglot.dialects.hive.Hive.Generator.datatype_sql", "modulename": "sqlglot.dialects.hive", "qualname": "Hive.Generator.datatype_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.mysql": {"fullname": "sqlglot.dialects.mysql", "modulename": "sqlglot.dialects.mysql", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.mysql.MySQL": {"fullname": "sqlglot.dialects.mysql.MySQL", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.mysql.MySQL.__init__": {"fullname": "sqlglot.dialects.mysql.MySQL.__init__", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"fullname": "sqlglot.dialects.mysql.MySQL.Tokenizer", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.mysql.MySQL.Parser": {"fullname": "sqlglot.dialects.mysql.MySQL.Parser", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.mysql.MySQL.Generator": {"fullname": "sqlglot.dialects.mysql.MySQL.Generator", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"fullname": "sqlglot.dialects.mysql.MySQL.Generator.show_sql", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.Generator.show_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"fullname": "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.Generator.setitem_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"fullname": "sqlglot.dialects.mysql.MySQL.Generator.set_sql", "modulename": "sqlglot.dialects.mysql", "qualname": "MySQL.Generator.set_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.oracle": {"fullname": "sqlglot.dialects.oracle", "modulename": "sqlglot.dialects.oracle", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.oracle.Oracle": {"fullname": "sqlglot.dialects.oracle.Oracle", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.oracle.Oracle.__init__": {"fullname": "sqlglot.dialects.oracle.Oracle.__init__", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.oracle.Oracle.Parser": {"fullname": "sqlglot.dialects.oracle.Oracle.Parser", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.oracle.Oracle.Generator": {"fullname": "sqlglot.dialects.oracle.Oracle.Generator", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"fullname": "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.Generator.query_modifiers", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">sqls</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"fullname": "sqlglot.dialects.oracle.Oracle.Generator.offset_sql", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.Generator.offset_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"fullname": "sqlglot.dialects.oracle.Oracle.Generator.table_sql", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.Generator.table_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"fullname": "sqlglot.dialects.oracle.Oracle.Tokenizer", "modulename": "sqlglot.dialects.oracle", "qualname": "Oracle.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.postgres": {"fullname": "sqlglot.dialects.postgres", "modulename": "sqlglot.dialects.postgres", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.postgres.Postgres": {"fullname": "sqlglot.dialects.postgres.Postgres", "modulename": "sqlglot.dialects.postgres", "qualname": "Postgres", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.postgres.Postgres.__init__": {"fullname": "sqlglot.dialects.postgres.Postgres.__init__", "modulename": "sqlglot.dialects.postgres", "qualname": "Postgres.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"fullname": "sqlglot.dialects.postgres.Postgres.Tokenizer", "modulename": "sqlglot.dialects.postgres", "qualname": "Postgres.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.postgres.Postgres.Parser": {"fullname": "sqlglot.dialects.postgres.Postgres.Parser", "modulename": "sqlglot.dialects.postgres", "qualname": "Postgres.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.postgres.Postgres.Generator": {"fullname": "sqlglot.dialects.postgres.Postgres.Generator", "modulename": "sqlglot.dialects.postgres", "qualname": "Postgres.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.presto": {"fullname": "sqlglot.dialects.presto", "modulename": "sqlglot.dialects.presto", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.presto.Presto": {"fullname": "sqlglot.dialects.presto.Presto", "modulename": "sqlglot.dialects.presto", "qualname": "Presto", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.presto.Presto.__init__": {"fullname": "sqlglot.dialects.presto.Presto.__init__", "modulename": "sqlglot.dialects.presto", "qualname": "Presto.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.presto.Presto.Tokenizer": {"fullname": "sqlglot.dialects.presto.Presto.Tokenizer", "modulename": "sqlglot.dialects.presto", "qualname": "Presto.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.presto.Presto.Parser": {"fullname": "sqlglot.dialects.presto.Presto.Parser", "modulename": "sqlglot.dialects.presto", "qualname": "Presto.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.presto.Presto.Generator": {"fullname": "sqlglot.dialects.presto.Presto.Generator", "modulename": "sqlglot.dialects.presto", "qualname": "Presto.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"fullname": "sqlglot.dialects.presto.Presto.Generator.transaction_sql", "modulename": "sqlglot.dialects.presto", "qualname": "Presto.Generator.transaction_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.redshift": {"fullname": "sqlglot.dialects.redshift", "modulename": "sqlglot.dialects.redshift", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.redshift.Redshift": {"fullname": "sqlglot.dialects.redshift.Redshift", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.postgres.Postgres"}, "sqlglot.dialects.redshift.Redshift.__init__": {"fullname": "sqlglot.dialects.redshift.Redshift.__init__", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.redshift.Redshift.Parser": {"fullname": "sqlglot.dialects.redshift.Redshift.Parser", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.dialects.postgres.Postgres.Parser"}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"fullname": "sqlglot.dialects.redshift.Redshift.Tokenizer", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.postgres.Postgres.Tokenizer"}, "sqlglot.dialects.redshift.Redshift.Generator": {"fullname": "sqlglot.dialects.redshift.Redshift.Generator", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.dialects.postgres.Postgres.Generator"}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"fullname": "sqlglot.dialects.redshift.Redshift.Generator.values_sql", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Generator.values_sql", "kind": "function", "doc": "<p>Converts <code>VALUES...</code> expression into a series of unions.</p>\n\n<p>Note: If you have a lot of unions then this will result in a large number of recursive statements to\nevaluate the expression. You may need to increase <code>sys.setrecursionlimit</code> to run and it can also be\nvery slow.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Values</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"fullname": "sqlglot.dialects.redshift.Redshift.Generator.with_properties", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Generator.with_properties", "kind": "function", "doc": "<p>Redshift doesn't have <code>WITH</code> as part of their with_properties so we remove it</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">properties</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"fullname": "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Generator.renametable_sql", "kind": "function", "doc": "<p>Redshift only supports defining the table name itself (not the db) when renaming tables</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">RenameTable</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"fullname": "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql", "modulename": "sqlglot.dialects.redshift", "qualname": "Redshift.Generator.datatype_sql", "kind": "function", "doc": "<p>Redshift converts the <code>TEXT</code> data type to <code>VARCHAR(255)</code> by default when people more generally mean\nVARCHAR of max length which is <code>VARCHAR(max)</code> in Redshift. Therefore if we get a <code>TEXT</code> data type\nwithout precision we convert it to <code>VARCHAR(max)</code> and if it does have precision then we just convert\n<code>TEXT</code> to <code>VARCHAR</code>.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.snowflake": {"fullname": "sqlglot.dialects.snowflake", "modulename": "sqlglot.dialects.snowflake", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.snowflake.Snowflake": {"fullname": "sqlglot.dialects.snowflake.Snowflake", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"fullname": "sqlglot.dialects.snowflake.Snowflake.__init__", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Parser", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Tokenizer", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator.except_op", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator.except_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator.intersect_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator.values_sql", "kind": "function", "doc": "<p>Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted.</p>\n\n<p>We also want to make sure that after we find matches where we need to unquote a column that we prevent users\nfrom adding quotes to the column by using the <code>identify</code> argument when generating the SQL.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Values</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator.select_sql", "kind": "function", "doc": "<p>Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted and also\nthat all columns in a SELECT are unquoted. We also want to make sure that after we find matches where we need\nto unquote a column that we prevent users from adding quotes to the column by using the <code>identify</code> argument when\ngenerating the SQL.</p>\n\n<p>Note: We make an assumption that any columns referenced in a VALUES expression should be unquoted throughout the\nexpression. This might not be true in a case where the same column name can be sourced from another table that can\nproperly quote but should be true in most cases.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator.describe_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Describe</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"fullname": "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql", "modulename": "sqlglot.dialects.snowflake", "qualname": "Snowflake.Generator.generatedasidentitycolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">GeneratedAsIdentityColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.spark": {"fullname": "sqlglot.dialects.spark", "modulename": "sqlglot.dialects.spark", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.spark.Spark": {"fullname": "sqlglot.dialects.spark.Spark", "modulename": "sqlglot.dialects.spark", "qualname": "Spark", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.hive.Hive"}, "sqlglot.dialects.spark.Spark.__init__": {"fullname": "sqlglot.dialects.spark.Spark.__init__", "modulename": "sqlglot.dialects.spark", "qualname": "Spark.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.spark.Spark.Parser": {"fullname": "sqlglot.dialects.spark.Spark.Parser", "modulename": "sqlglot.dialects.spark", "qualname": "Spark.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.dialects.hive.Hive.Parser"}, "sqlglot.dialects.spark.Spark.Generator": {"fullname": "sqlglot.dialects.spark.Spark.Generator", "modulename": "sqlglot.dialects.spark", "qualname": "Spark.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.dialects.hive.Hive.Generator"}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"fullname": "sqlglot.dialects.spark.Spark.Generator.cast_sql", "modulename": "sqlglot.dialects.spark", "qualname": "Spark.Generator.cast_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Cast</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.spark.Spark.Tokenizer": {"fullname": "sqlglot.dialects.spark.Spark.Tokenizer", "modulename": "sqlglot.dialects.spark", "qualname": "Spark.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.hive.Hive.Tokenizer"}, "sqlglot.dialects.sqlite": {"fullname": "sqlglot.dialects.sqlite", "modulename": "sqlglot.dialects.sqlite", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.sqlite.SQLite": {"fullname": "sqlglot.dialects.sqlite.SQLite", "modulename": "sqlglot.dialects.sqlite", "qualname": "SQLite", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.sqlite.SQLite.__init__": {"fullname": "sqlglot.dialects.sqlite.SQLite.__init__", "modulename": "sqlglot.dialects.sqlite", "qualname": "SQLite.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"fullname": "sqlglot.dialects.sqlite.SQLite.Tokenizer", "modulename": "sqlglot.dialects.sqlite", "qualname": "SQLite.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.sqlite.SQLite.Parser": {"fullname": "sqlglot.dialects.sqlite.SQLite.Parser", "modulename": "sqlglot.dialects.sqlite", "qualname": "SQLite.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.sqlite.SQLite.Generator": {"fullname": "sqlglot.dialects.sqlite.SQLite.Generator", "modulename": "sqlglot.dialects.sqlite", "qualname": "SQLite.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"fullname": "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql", "modulename": "sqlglot.dialects.sqlite", "qualname": "SQLite.Generator.transaction_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.starrocks": {"fullname": "sqlglot.dialects.starrocks", "modulename": "sqlglot.dialects.starrocks", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.starrocks.StarRocks": {"fullname": "sqlglot.dialects.starrocks.StarRocks", "modulename": "sqlglot.dialects.starrocks", "qualname": "StarRocks", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.mysql.MySQL"}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"fullname": "sqlglot.dialects.starrocks.StarRocks.__init__", "modulename": "sqlglot.dialects.starrocks", "qualname": "StarRocks.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"fullname": "sqlglot.dialects.starrocks.StarRocks.Generator", "modulename": "sqlglot.dialects.starrocks", "qualname": "StarRocks.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.dialects.mysql.MySQL.Generator"}, "sqlglot.dialects.tableau": {"fullname": "sqlglot.dialects.tableau", "modulename": "sqlglot.dialects.tableau", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.tableau.Tableau": {"fullname": "sqlglot.dialects.tableau.Tableau", "modulename": "sqlglot.dialects.tableau", "qualname": "Tableau", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.tableau.Tableau.__init__": {"fullname": "sqlglot.dialects.tableau.Tableau.__init__", "modulename": "sqlglot.dialects.tableau", "qualname": "Tableau.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.tableau.Tableau.Generator": {"fullname": "sqlglot.dialects.tableau.Tableau.Generator", "modulename": "sqlglot.dialects.tableau", "qualname": "Tableau.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.tableau.Tableau.Parser": {"fullname": "sqlglot.dialects.tableau.Tableau.Parser", "modulename": "sqlglot.dialects.tableau", "qualname": "Tableau.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.teradata": {"fullname": "sqlglot.dialects.teradata", "modulename": "sqlglot.dialects.teradata", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.teradata.Teradata": {"fullname": "sqlglot.dialects.teradata.Teradata", "modulename": "sqlglot.dialects.teradata", "qualname": "Teradata", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.teradata.Teradata.__init__": {"fullname": "sqlglot.dialects.teradata.Teradata.__init__", "modulename": "sqlglot.dialects.teradata", "qualname": "Teradata.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.teradata.Teradata.Parser": {"fullname": "sqlglot.dialects.teradata.Teradata.Parser", "modulename": "sqlglot.dialects.teradata", "qualname": "Teradata.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.teradata.Teradata.Generator": {"fullname": "sqlglot.dialects.teradata.Teradata.Generator", "modulename": "sqlglot.dialects.teradata", "qualname": "Teradata.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"fullname": "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql", "modulename": "sqlglot.dialects.teradata", "qualname": "Teradata.Generator.partitionedbyproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">PartitionedByProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"fullname": "sqlglot.dialects.teradata.Teradata.Generator.update_sql", "modulename": "sqlglot.dialects.teradata", "qualname": "Teradata.Generator.update_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Update</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.trino": {"fullname": "sqlglot.dialects.trino", "modulename": "sqlglot.dialects.trino", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.trino.Trino": {"fullname": "sqlglot.dialects.trino.Trino", "modulename": "sqlglot.dialects.trino", "qualname": "Trino", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.presto.Presto"}, "sqlglot.dialects.trino.Trino.__init__": {"fullname": "sqlglot.dialects.trino.Trino.__init__", "modulename": "sqlglot.dialects.trino", "qualname": "Trino.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.trino.Trino.Generator": {"fullname": "sqlglot.dialects.trino.Trino.Generator", "modulename": "sqlglot.dialects.trino", "qualname": "Trino.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.dialects.presto.Presto.Generator"}, "sqlglot.dialects.trino.Trino.Tokenizer": {"fullname": "sqlglot.dialects.trino.Trino.Tokenizer", "modulename": "sqlglot.dialects.trino", "qualname": "Trino.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.presto.Presto.Tokenizer"}, "sqlglot.dialects.tsql": {"fullname": "sqlglot.dialects.tsql", "modulename": "sqlglot.dialects.tsql", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"fullname": "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql", "modulename": "sqlglot.dialects.tsql", "qualname": "generate_date_delta_with_unit_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">e</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.dialects.tsql.TSQL": {"fullname": "sqlglot.dialects.tsql.TSQL", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.dialects.tsql.TSQL.__init__": {"fullname": "sqlglot.dialects.tsql.TSQL.__init__", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"fullname": "sqlglot.dialects.tsql.TSQL.Tokenizer", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.dialects.tsql.TSQL.Parser": {"fullname": "sqlglot.dialects.tsql.TSQL.Parser", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL.Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n", "bases": "sqlglot.parser.Parser"}, "sqlglot.dialects.tsql.TSQL.Generator": {"fullname": "sqlglot.dialects.tsql.TSQL.Generator", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"fullname": "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL.Generator.systemtime_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">SystemTime</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"fullname": "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql", "modulename": "sqlglot.dialects.tsql", "qualname": "TSQL.Generator.returnsproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ReturnsProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.diff": {"fullname": "sqlglot.diff", "modulename": "sqlglot.diff", "kind": "module", "doc": "<h1 id=\"semantic-diff-for-sql\">Semantic Diff for SQL</h1>\n\n<p><em>by <a href=\"https://github.com/izeigerman\">Iaroslav Zeigerman</a></em></p>\n\n<h2 id=\"motivation\">Motivation</h2>\n\n<p>Software is constantly changing and evolving, and identifying what has changed and reviewing those changes is an integral part of the development process. SQL code is no exception to this.</p>\n\n<p>Text-based diff tools such as <code>git diff</code>, when applied to a code base, have certain limitations. First, they can only detect insertions and deletions, not movements or updates of individual pieces of code. Second, such tools can only detect changes between lines of text, which is too coarse for something as granular and detailed as source code. Additionally, the outcome of such a diff is dependent on the underlying code formatting, and yields different results if the formatting should change.</p>\n\n<p>Consider the following diff generated by Git:</p>\n\n<p><img src=\"sql_diff_images/git_diff_output.png\" alt=\"Git diff output\" /></p>\n\n<p>Semantically the query hasn\u2019t changed. The two arguments <code>b</code> and <code>c</code> have been swapped (moved), posing no impact on the output of the query. Yet Git replaced the whole affected expression alongside a bulk of unrelated elements.</p>\n\n<p>The alternative to text-based diffing is to compare Abstract Syntax Trees (AST) instead. The main advantage of ASTs are that they are a direct product of code parsing, which represents the underlying code structure at any desired level of granularity. Comparing ASTs may yield extremely precise diffs; changes such as code movements and updates can also be detected. Even more importantly, this approach facilitates additional use cases beyond eyeballing two versions of source code side by side.</p>\n\n<p>The use cases I had in mind for SQL when I decided to embark on this journey of semantic diffing were the following:</p>\n\n<ul>\n<li><strong>Query similarity score.</strong> Identifying which parts the two queries have in common to automatically suggest opportunities for consolidation, creation of intermediate/staging tables, and so on.</li>\n<li><strong>Differentiating between cosmetic / structural changes and functional ones.</strong> For example when a nested query is refactored into a common table expression (CTE), this kind of change doesn\u2019t have any functional impact on either a query or its outcome.</li>\n<li><strong>Automatic suggestions about the need to retroactively backfill data.</strong> This is especially important for pipelines that populate very large tables for which restatement is a runtime-intensive procedure. The ability to discern between simple code movements and actual modifications can help assess the impact of a change and make suggestions accordingly.</li>\n</ul>\n\n<p>The implementation discussed in this post is now a part of the <a href=\"https://github.com/tobymao/sqlglot/\">SQLGlot</a> library. You can find a complete source code in the <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/diff.py\">diff.py</a> module. The choice of SQLglot was an obvious one due to its simple but powerful API, lack of external dependencies and, more importantly, extensive list of supported SQL dialects.</p>\n\n<h2 id=\"the-search-for-a-solution\">The Search for a Solution</h2>\n\n<p>When it comes to any diffing tool (not just a semantic one), the primary challenge is to match as many elements of compared entities as possible. Once such a set of matching elements is available, deriving a sequence of changes becomes an easy task.</p>\n\n<p>If our elements have unique identifiers associated with them (for example, an element\u2019s ID in DOM), the matching problem is trivial. However, the SQL syntax trees that we are comparing have neither unique keys nor object identifiers that can be used for the purposes of matching. So, how do we suppose to find pairs of nodes that are related?</p>\n\n<p>To better illustrate the problem, consider comparing the following SQL expressions: <code>SELECT a + b + c, d, e</code> and <code>SELECT a - b + c, e, f</code>. Matching individual nodes from respective syntax trees can be visualized as follows:</p>\n\n<p><img src=\"sql_diff_images/figure_1.png\" alt=\"Figure 1: Example of node matching for two SQL expression trees\" />\n<em>Figure 1: Example of node matching for two SQL expression trees.</em></p>\n\n<p>By looking at the figure of node matching for two SQL expression trees above, we conclude that the following changes should be captured by our solution:</p>\n\n<ul>\n<li>Inserted nodes: <code>Sub</code> and <code>f</code>. These are the nodes from the target AST which do not have a matching node in the source AST.</li>\n<li>Removed nodes: <code>Add</code> and <code>d</code>. These are the nodes from the source AST which do not have a counterpart in the target AST.</li>\n<li>Remaining nodes must be identified as unchanged.</li>\n</ul>\n\n<p>It should be clear at this point that if we manage to match nodes in the source tree with their counterparts in the target tree, then computing the diff becomes a trivial matter.</p>\n\n<h3 id=\"naive-brute-force\">Na\u00efve Brute-Force</h3>\n\n<p>The na\u00efve solution would be to try all different permutations of node pair combinations, and see which set of pairs performs the best based on some type of heuristics. The runtime cost of such a solution quickly reaches the escape velocity; if both trees had only 10 nodes each, the number of such sets would approximately be 10! ^ 2 = 3.6M ^ 2 ~= 13 * 10^12. This is a very bad case of factorial complexity (to be precise, it\u2019s actually much worse - O(n! ^ 2) - but I couldn\u2019t come up with a name for it), so there is little need to explore this approach any further.</p>\n\n<h3 id=\"myers-algorithm\">Myers Algorithm</h3>\n\n<p>After the na\u00efve approach was proven to be infeasible, the next question I asked myself was \u201chow does git diff work?\u201d. This question led me to discover the Myers diff algorithm [1]. This algorithm has been designed to compare sequences of strings. At its core, it\u2019s looking for the shortest path on a graph of possible edits that transform the first sequence into the second one, while heavily rewarding those paths that lead to longest subsequences of unchanged elements. There\u2019s a lot of material out there describing this algorithm in greater detail. I found James Coglan\u2019s series of <a href=\"https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/\">blog posts</a> to be the most comprehensive.</p>\n\n<p>Therefore, I had this \u201cbrilliant\u201d (actually not) idea to transform trees into sequences by traversing them in topological order, and then applying the Myers algorithm on resulting sequences while using a custom heuristics when checking the equality of two nodes. Unsurprisingly, comparing sequences of strings is quite different from comparing hierarchical tree structures, and by flattening trees into sequences, we lose a lot of relevant context. This resulted in a terrible performance of this algorithm on ASTs. It often matched completely unrelated nodes, even when the two trees were mostly the same, and produced extremely inaccurate lists of changes overall. After playing around with it a little and tweaking my equality heuristics to improve accuracy, I ultimately scrapped the whole implementation and went back to the drawing board.</p>\n\n<h2 id=\"change-distiller\">Change Distiller</h2>\n\n<p>The algorithm I settled on at the end was Change Distiller, created by Fluri et al. [2], which in turn is an improvement over the core idea described by Chawathe et al. [3].</p>\n\n<p>The algorithm consists of two high-level steps:</p>\n\n<ol>\n<li><strong>Finding appropriate matchings between pairs of nodes that are part of compared ASTs.</strong> Identifying what is meant by \u201cappropriate\u201d matching is also a part of this step.</li>\n<li><strong>Generating the so-called \u201cedit script\u201d from the matching set built in the 1st step.</strong> The edit script is a sequence of edit operations (for example, insert, remove, update, etc.) on individual tree nodes, such that when applied as transformations on the source AST, it eventually becomes the target AST. In general, the shorter the sequence, the better. The length of the edit script can be used to compare the performance of different algorithms, though this is not the only metric that matters.</li>\n</ol>\n\n<p>The rest of this section is dedicated to the Python implementation of the steps above using the AST implementation provided by the SQLGlot library.</p>\n\n<h3 id=\"building-the-matching-set\">Building the Matching Set</h3>\n\n<h4 id=\"matching-leaves\">Matching Leaves</h4>\n\n<p>We begin composing the matching set by matching the leaf nodes. Leaf nodes are the nodes that do not have any children nodes (such as literals, identifiers, etc.). In order to match them, we gather all the leaf nodes from the source tree and generate a cartesian product with all the leaves from the target tree, while comparing pairs created this way and assigning them a similarity score. During this stage, we also exclude pairs that don\u2019t pass basic matching criteria. Then, we pick pairs that scored the highest while making sure that each node is matched no more than once.</p>\n\n<p>Using the example provided at the beginning of the post, the process of building an initial set of candidate matchings can be seen on Figure 2.</p>\n\n<p><img src=\"sql_diff_images/figure_2.gif\" alt=\"Figure 2: Building a set of candidate matchings between leaf nodes. The third item in each triplet represents a similarity score between two nodes.\" />\n<em>Figure 2: Building a set of candidate matchings between leaf nodes. The third item in each triplet represents a similarity score between two nodes.</em></p>\n\n<p>First, let\u2019s analyze the similarity score. Then, we\u2019ll discuss matching criteria.</p>\n\n<p>The similarity score proposed by Fluri et al. [2] is a <a href=\"https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient\">dice coefficient </a>applied to <a href=\"https://en.wikipedia.org/wiki/Bigram\">bigrams</a> of respective node values. A bigram is a sequence of two adjacent elements from a string computed in a sliding window fashion:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">def</span> <span class=\"nf\">bigram</span><span class=\"p\">(</span><span class=\"n\">string</span><span class=\"p\">):</span>\n <span class=\"n\">count</span> <span class=\"o\">=</span> <span class=\"nb\">max</span><span class=\"p\">(</span><span class=\"mi\">0</span><span class=\"p\">,</span> <span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">string</span><span class=\"p\">)</span> <span class=\"o\">-</span> <span class=\"mi\">1</span><span class=\"p\">)</span>\n <span class=\"k\">return</span> <span class=\"p\">[</span><span class=\"n\">string</span><span class=\"p\">[</span><span class=\"n\">i</span> <span class=\"p\">:</span> <span class=\"n\">i</span> <span class=\"o\">+</span> <span class=\"mi\">2</span><span class=\"p\">]</span> <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">count</span><span class=\"p\">)]</span>\n</code></pre>\n</div>\n\n<p>For reasons that will become clear shortly, we actually need to compute bigram histograms rather than just sequences:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">collections</span> <span class=\"kn\">import</span> <span class=\"n\">defaultdict</span>\n\n<span class=\"k\">def</span> <span class=\"nf\">bigram_histo</span><span class=\"p\">(</span><span class=\"n\">string</span><span class=\"p\">):</span>\n <span class=\"n\">count</span> <span class=\"o\">=</span> <span class=\"nb\">max</span><span class=\"p\">(</span><span class=\"mi\">0</span><span class=\"p\">,</span> <span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">string</span><span class=\"p\">)</span> <span class=\"o\">-</span> <span class=\"mi\">1</span><span class=\"p\">)</span>\n <span class=\"n\">bigram_histo</span> <span class=\"o\">=</span> <span class=\"n\">defaultdict</span><span class=\"p\">(</span><span class=\"nb\">int</span><span class=\"p\">)</span>\n <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">count</span><span class=\"p\">):</span>\n <span class=\"n\">bigram_histo</span><span class=\"p\">[</span><span class=\"n\">string</span><span class=\"p\">[</span><span class=\"n\">i</span> <span class=\"p\">:</span> <span class=\"n\">i</span> <span class=\"o\">+</span> <span class=\"mi\">2</span><span class=\"p\">]]</span> <span class=\"o\">+=</span> <span class=\"mi\">1</span>\n <span class=\"k\">return</span> <span class=\"n\">bigram_histo</span>\n</code></pre>\n</div>\n\n<p>The dice coefficient formula looks like following:</p>\n\n<p><img src=\"sql_diff_images/dice_coef.png\" alt=\"Dice Coefficient\" /></p>\n\n<p>Where X is a bigram of the source node and Y is a bigram of the second one. What this essentially does is count the number of bigram elements the two nodes have in common, multiply it by 2, and then divide by the total number of elements in both bigrams. This is where bigram histograms come in handy:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">def</span> <span class=\"nf\">dice_coefficient</span><span class=\"p\">(</span><span class=\"n\">source</span><span class=\"p\">,</span> <span class=\"n\">target</span><span class=\"p\">):</span>\n <span class=\"n\">source_histo</span> <span class=\"o\">=</span> <span class=\"n\">bigram_histo</span><span class=\"p\">(</span><span class=\"n\">source</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">())</span>\n <span class=\"n\">target_histo</span> <span class=\"o\">=</span> <span class=\"n\">bigram_histo</span><span class=\"p\">(</span><span class=\"n\">target</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">())</span>\n\n <span class=\"n\">total_grams</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"nb\">sum</span><span class=\"p\">(</span><span class=\"n\">source_histo</span><span class=\"o\">.</span><span class=\"n\">values</span><span class=\"p\">())</span> <span class=\"o\">+</span> <span class=\"nb\">sum</span><span class=\"p\">(</span><span class=\"n\">target_histo</span><span class=\"o\">.</span><span class=\"n\">values</span><span class=\"p\">())</span>\n <span class=\"p\">)</span>\n <span class=\"k\">if</span> <span class=\"ow\">not</span> <span class=\"n\">total_grams</span><span class=\"p\">:</span>\n <span class=\"k\">return</span> <span class=\"mf\">1.0</span> <span class=\"k\">if</span> <span class=\"n\">source</span> <span class=\"o\">==</span> <span class=\"n\">target</span> <span class=\"k\">else</span> <span class=\"mf\">0.0</span>\n\n <span class=\"n\">overlap_len</span> <span class=\"o\">=</span> <span class=\"mi\">0</span>\n <span class=\"n\">overlapping_grams</span> <span class=\"o\">=</span> <span class=\"nb\">set</span><span class=\"p\">(</span><span class=\"n\">source_histo</span><span class=\"p\">)</span> <span class=\"o\">&</span> <span class=\"nb\">set</span><span class=\"p\">(</span><span class=\"n\">target_histo</span><span class=\"p\">)</span>\n <span class=\"k\">for</span> <span class=\"n\">g</span> <span class=\"ow\">in</span> <span class=\"n\">overlapping_grams</span><span class=\"p\">:</span>\n <span class=\"n\">overlap_len</span> <span class=\"o\">+=</span> <span class=\"nb\">min</span><span class=\"p\">(</span><span class=\"n\">source_histo</span><span class=\"p\">[</span><span class=\"n\">g</span><span class=\"p\">],</span> <span class=\"n\">target_histo</span><span class=\"p\">[</span><span class=\"n\">g</span><span class=\"p\">])</span>\n\n <span class=\"k\">return</span> <span class=\"mi\">2</span> <span class=\"o\">*</span> <span class=\"n\">overlap_len</span> <span class=\"o\">/</span> <span class=\"n\">total_grams</span>\n</code></pre>\n</div>\n\n<p>To compute a bigram given a tree node, we first transform the node into its canonical SQL representation,so that the <code>Literal(123)</code> node becomes just \u201c123\u201d and the <code>Identifier(\u201ca\u201d)</code> node becomes just \u201ca\u201d. We also handle a scenario when strings are too short to derive bigrams. In this case, we fallback to checking the two nodes for equality.</p>\n\n<p>Now when we know how to compute the similarity score, we can take care of the matching criteria for leaf nodes. In the original paper [2], the matching criteria is formalized as follows:</p>\n\n<p><img src=\"sql_diff_images/matching_criteria_1.png\" alt=\"Matching criteria for leaf nodes\" /></p>\n\n<p>The two nodes are matched if two conditions are met:</p>\n\n<ol>\n<li>The node labels match (in our case labels are just node types).</li>\n<li>The similarity score for node values is greater than or equal to some threshold \u201cf\u201d. The authors of the paper recommend setting the value of \u201cf\u201d to 0.6.</li>\n</ol>\n\n<p>With building blocks in place, we can now build a matching set for leaf nodes. First, we generate a list of candidates for matching:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"kn\">from</span> <span class=\"nn\">heapq</span> <span class=\"kn\">import</span> <span class=\"n\">heappush</span><span class=\"p\">,</span> <span class=\"n\">heappop</span>\n\n<span class=\"n\">candidate_matchings</span> <span class=\"o\">=</span> <span class=\"p\">[]</span>\n<span class=\"n\">source_leaves</span> <span class=\"o\">=</span> <span class=\"n\">_get_leaves</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">_source</span><span class=\"p\">)</span>\n<span class=\"n\">target_leaves</span> <span class=\"o\">=</span> <span class=\"n\">_get_leaves</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span><span class=\"n\">_target</span><span class=\"p\">)</span>\n<span class=\"k\">for</span> <span class=\"n\">source_leaf</span> <span class=\"ow\">in</span> <span class=\"n\">source_leaves</span><span class=\"p\">:</span>\n <span class=\"k\">for</span> <span class=\"n\">target_leaf</span> <span class=\"ow\">in</span> <span class=\"n\">target_leaves</span><span class=\"p\">:</span>\n <span class=\"k\">if</span> <span class=\"n\">_is_same_type</span><span class=\"p\">(</span><span class=\"n\">source_leaf</span><span class=\"p\">,</span> <span class=\"n\">target_leaf</span><span class=\"p\">):</span>\n <span class=\"n\">similarity_score</span> <span class=\"o\">=</span> <span class=\"n\">dice_coefficient</span><span class=\"p\">(</span>\n <span class=\"n\">source_leaf</span><span class=\"p\">,</span> <span class=\"n\">target_leaf</span>\n <span class=\"p\">)</span>\n <span class=\"k\">if</span> <span class=\"n\">similarity_score</span> <span class=\"o\">>=</span> <span class=\"mf\">0.6</span><span class=\"p\">:</span>\n <span class=\"n\">heappush</span><span class=\"p\">(</span>\n <span class=\"n\">candidate_matchings</span><span class=\"p\">,</span>\n <span class=\"p\">(</span>\n <span class=\"o\">-</span><span class=\"n\">similarity_score</span><span class=\"p\">,</span>\n <span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">candidate_matchings</span><span class=\"p\">),</span>\n <span class=\"n\">source_leaf</span><span class=\"p\">,</span>\n <span class=\"n\">target_leaf</span><span class=\"p\">,</span>\n <span class=\"p\">),</span>\n <span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<p>In the implementation above, we push each matching pair onto the heap to automatically maintain the correct order based on the assigned similarity score.</p>\n\n<p>Finally, we build the initial matching set by picking leaf pairs with the highest score:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">matching_set</span> <span class=\"o\">=</span> <span class=\"nb\">set</span><span class=\"p\">()</span>\n<span class=\"k\">while</span> <span class=\"n\">candidate_matchings</span><span class=\"p\">:</span>\n <span class=\"n\">_</span><span class=\"p\">,</span> <span class=\"n\">_</span><span class=\"p\">,</span> <span class=\"n\">source_leaf</span><span class=\"p\">,</span> <span class=\"n\">target_leaf</span> <span class=\"o\">=</span> <span class=\"n\">heappop</span><span class=\"p\">(</span><span class=\"n\">candidate_matchings</span><span class=\"p\">)</span>\n <span class=\"k\">if</span> <span class=\"p\">(</span>\n <span class=\"n\">source_leaf</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_source_nodes</span>\n <span class=\"ow\">and</span> <span class=\"n\">target_leaf</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_target_nodes</span>\n <span class=\"p\">):</span>\n <span class=\"n\">matching_set</span><span class=\"o\">.</span><span class=\"n\">add</span><span class=\"p\">((</span><span class=\"n\">source_leaf</span><span class=\"p\">,</span> <span class=\"n\">target_leaf</span><span class=\"p\">))</span>\n <span class=\"n\">unmatched_source_nodes</span><span class=\"o\">.</span><span class=\"n\">remove</span><span class=\"p\">(</span><span class=\"n\">source_leaf</span><span class=\"p\">)</span>\n <span class=\"n\">unmatched_target_nodes</span><span class=\"o\">.</span><span class=\"n\">remove</span><span class=\"p\">(</span><span class=\"n\">target_leaf</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<p>To finalize the matching set, we should now proceed with matching inner nodes.</p>\n\n<h4 id=\"matching-inner-nodes\">Matching Inner Nodes</h4>\n\n<p>Matching inner nodes is quite similar to matching leaf nodes, with the following two distinctions:</p>\n\n<ul>\n<li>Rather than ranking a set of possible candidates, we pick the first node pair that passes the matching criteria.</li>\n<li>The matching criteria itself has been extended to account for the number of leaf nodes the pair of inner nodes have in common.</li>\n</ul>\n\n<p><img src=\"sql_diff_images/figure_3.gif\" alt=\"Figure 3: Matching inner nodes based on their type as well as how many of their leaf nodes have been previously matched.\" />\n<em>Figure 3: Matching inner nodes based on their type as well as how many of their leaf nodes have been previously matched.</em></p>\n\n<p>Let\u2019s start with the matching criteria. The criteria is formalized as follows:</p>\n\n<p><img src=\"sql_diff_images/matching_criteria_2.png\" alt=\"Matching criteria for inner nodes\" /></p>\n\n<p>Alongside already familiar similarity score and node type criteria, there is a new one in the middle: the ratio of leaf nodes that the two nodes have in common must exceed some threshold \u201ct\u201d. The recommended value for \u201ct\u201d is also 0.6. Counting the number of common leaf nodes is pretty straightforward, since we already have the complete matching set for leaves. All we need to do is count how many matching pairs do leaf nodes from the two compared inner nodes form.</p>\n\n<p>There are two additional heuristics associated with this matching criteria:</p>\n\n<ul>\n<li>Inner node similarity weighting: if the similarity score between the node values doesn\u2019t pass the threshold \u201cf\u201d but the ratio of common leaf nodes (\u201ct\u201d) is greater than or equal to 0.8, then the matching is considered successful.</li>\n<li>The threshold \u201ct\u201d is reduced to 0.4 for inner nodes with the number of leaf nodes equal to 4 or less, in order to decrease the false negative rate for small subtrees.</li>\n</ul>\n\n<p>We now only have to iterate through the remaining unmatched nodes and form matching pairs based on the outlined criteria:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">leaves_matching_set</span> <span class=\"o\">=</span> <span class=\"n\">matching_set</span><span class=\"o\">.</span><span class=\"n\">copy</span><span class=\"p\">()</span>\n\n<span class=\"k\">for</span> <span class=\"n\">source_node</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_source_nodes</span><span class=\"o\">.</span><span class=\"n\">copy</span><span class=\"p\">():</span>\n <span class=\"k\">for</span> <span class=\"n\">target_node</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_target_nodes</span><span class=\"p\">:</span>\n <span class=\"k\">if</span> <span class=\"n\">_is_same_type</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span><span class=\"p\">):</span>\n <span class=\"n\">source_leaves</span> <span class=\"o\">=</span> <span class=\"nb\">set</span><span class=\"p\">(</span><span class=\"n\">_get_leaves</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">))</span>\n <span class=\"n\">target_leaves</span> <span class=\"o\">=</span> <span class=\"nb\">set</span><span class=\"p\">(</span><span class=\"n\">_get_leaves</span><span class=\"p\">(</span><span class=\"n\">target_node</span><span class=\"p\">))</span>\n\n <span class=\"n\">max_leaves_num</span> <span class=\"o\">=</span> <span class=\"nb\">max</span><span class=\"p\">(</span><span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">source_leaves</span><span class=\"p\">),</span> <span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">target_leaves</span><span class=\"p\">))</span>\n <span class=\"k\">if</span> <span class=\"n\">max_leaves_num</span><span class=\"p\">:</span>\n <span class=\"n\">common_leaves_num</span> <span class=\"o\">=</span> <span class=\"nb\">sum</span><span class=\"p\">(</span>\n <span class=\"mi\">1</span> <span class=\"k\">if</span> <span class=\"n\">s</span> <span class=\"ow\">in</span> <span class=\"n\">source_leaves</span> <span class=\"ow\">and</span> <span class=\"n\">t</span> <span class=\"ow\">in</span> <span class=\"n\">target_leaves</span> <span class=\"k\">else</span> <span class=\"mi\">0</span>\n <span class=\"k\">for</span> <span class=\"n\">s</span><span class=\"p\">,</span> <span class=\"n\">t</span> <span class=\"ow\">in</span> <span class=\"n\">leaves_matching_set</span>\n <span class=\"p\">)</span>\n <span class=\"n\">leaf_similarity_score</span> <span class=\"o\">=</span> <span class=\"n\">common_leaves_num</span> <span class=\"o\">/</span> <span class=\"n\">max_leaves_num</span>\n <span class=\"k\">else</span><span class=\"p\">:</span>\n <span class=\"n\">leaf_similarity_score</span> <span class=\"o\">=</span> <span class=\"mf\">0.0</span>\n\n <span class=\"n\">adjusted_t</span> <span class=\"o\">=</span> <span class=\"p\">(</span>\n <span class=\"mf\">0.6</span>\n <span class=\"k\">if</span> <span class=\"nb\">min</span><span class=\"p\">(</span><span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">source_leaves</span><span class=\"p\">),</span> <span class=\"nb\">len</span><span class=\"p\">(</span><span class=\"n\">target_leaves</span><span class=\"p\">))</span> <span class=\"o\">></span> <span class=\"mi\">4</span>\n <span class=\"k\">else</span> <span class=\"mf\">0.4</span>\n <span class=\"p\">)</span>\n\n <span class=\"k\">if</span> <span class=\"n\">leaf_similarity_score</span> <span class=\"o\">>=</span> <span class=\"mf\">0.8</span> <span class=\"ow\">or</span> <span class=\"p\">(</span>\n <span class=\"n\">leaf_similarity_score</span> <span class=\"o\">>=</span> <span class=\"n\">adjusted_t</span>\n <span class=\"ow\">and</span> <span class=\"n\">dice_coefficient</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span><span class=\"p\">)</span> <span class=\"o\">>=</span> <span class=\"mf\">0.6</span>\n <span class=\"p\">):</span>\n <span class=\"n\">matching_set</span><span class=\"o\">.</span><span class=\"n\">add</span><span class=\"p\">((</span><span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span><span class=\"p\">))</span>\n <span class=\"n\">unmatched_source_nodes</span><span class=\"o\">.</span><span class=\"n\">remove</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">)</span>\n <span class=\"n\">unmatched_target_nodes</span><span class=\"o\">.</span><span class=\"n\">remove</span><span class=\"p\">(</span><span class=\"n\">target_node</span><span class=\"p\">)</span>\n <span class=\"k\">break</span>\n</code></pre>\n</div>\n\n<p>After the matching set is formed, we can proceed with generation of the edit script, which will be the algorithm\u2019s output.</p>\n\n<h3 id=\"generating-the-edit-script\">Generating the Edit Script</h3>\n\n<p>At this point, we should have the following 3 sets at our disposal:</p>\n\n<ul>\n<li>The set of matched node pairs.</li>\n<li>The set of remaining unmatched nodes from the source tree.</li>\n<li>The set of remaining unmatched nodes from the target tree.</li>\n</ul>\n\n<p>We can derive 3 kinds of edits from the matching set: either the node\u2019s value was updated (<strong>Update</strong>), the node was moved to a different position within the tree (<strong>Move</strong>), or the node remained unchanged (<strong>Keep</strong>). Note that the <strong>Move</strong> case is not mutually exclusive with the other two. The node could have been updated or could have remained the same while at the same time its position within its parent node or the parent node itself could have changed. All unmatched nodes from the source tree are the ones that were removed (<strong>Remove</strong>), while unmatched nodes from the target tree are the ones that were inserted (<strong>Insert</strong>).</p>\n\n<p>The latter two cases are pretty straightforward to implement:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"n\">edit_script</span> <span class=\"o\">=</span> <span class=\"p\">[]</span>\n\n<span class=\"k\">for</span> <span class=\"n\">removed_node</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_source_nodes</span><span class=\"p\">:</span>\n <span class=\"n\">edit_script</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"n\">Remove</span><span class=\"p\">(</span><span class=\"n\">removed_node</span><span class=\"p\">))</span>\n<span class=\"k\">for</span> <span class=\"n\">inserted_node</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_target_nodes</span><span class=\"p\">:</span>\n <span class=\"n\">edit_script</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"n\">Insert</span><span class=\"p\">(</span><span class=\"n\">inserted_node</span><span class=\"p\">))</span>\n</code></pre>\n</div>\n\n<p>Traversing the matching set requires a little more thought:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">for</span> <span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span> <span class=\"ow\">in</span> <span class=\"n\">matching_set</span><span class=\"p\">:</span>\n <span class=\"k\">if</span> <span class=\"p\">(</span>\n <span class=\"ow\">not</span> <span class=\"nb\">isinstance</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">LEAF_EXPRESSION_TYPES</span><span class=\"p\">)</span>\n <span class=\"ow\">or</span> <span class=\"n\">source_node</span> <span class=\"o\">==</span> <span class=\"n\">target_node</span>\n <span class=\"p\">):</span>\n <span class=\"n\">move_edits</span> <span class=\"o\">=</span> <span class=\"n\">generate_move_edits</span><span class=\"p\">(</span>\n <span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span><span class=\"p\">,</span> <span class=\"n\">matching_set</span>\n <span class=\"p\">)</span>\n <span class=\"n\">edit_script</span><span class=\"o\">.</span><span class=\"n\">extend</span><span class=\"p\">(</span><span class=\"n\">move_edits</span><span class=\"p\">)</span>\n <span class=\"n\">edit_script</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span><span class=\"p\">))</span>\n <span class=\"k\">else</span><span class=\"p\">:</span>\n <span class=\"n\">edit_script</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"n\">Update</span><span class=\"p\">(</span><span class=\"n\">source_node</span><span class=\"p\">,</span> <span class=\"n\">target_node</span><span class=\"p\">))</span>\n</code></pre>\n</div>\n\n<p>If a matching pair represents a pair of leaf nodes, we check if they are the same to decide whether an update took place. For inner node pairs, we also need to compare the positions of their respective children to detect node movements. Chawathe et al. [3] suggest applying the <a href=\"https://en.wikipedia.org/wiki/Longest_common_subsequence_problem\">longest common subsequence </a>(LCS) algorithm which, no surprise here, was described by Myers himself [1]. There is a small catch, however: instead of checking the equality of two children nodes, we need to check whether the two nodes form a pair that is a part of our matching set.</p>\n\n<p>Now with this knowledge, the implementation becomes straightforward:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">def</span> <span class=\"nf\">generate_move_edits</span><span class=\"p\">(</span><span class=\"n\">source</span><span class=\"p\">,</span> <span class=\"n\">target</span><span class=\"p\">,</span> <span class=\"n\">matching_set</span><span class=\"p\">):</span>\n <span class=\"n\">source_children</span> <span class=\"o\">=</span> <span class=\"n\">_get_child_nodes</span><span class=\"p\">(</span><span class=\"n\">source</span><span class=\"p\">)</span>\n <span class=\"n\">target_children</span> <span class=\"o\">=</span> <span class=\"n\">_get_child_nodes</span><span class=\"p\">(</span><span class=\"n\">target</span><span class=\"p\">)</span>\n\n <span class=\"n\">lcs</span> <span class=\"o\">=</span> <span class=\"nb\">set</span><span class=\"p\">(</span>\n <span class=\"n\">_longest_common_subsequence</span><span class=\"p\">(</span>\n <span class=\"n\">source_children</span><span class=\"p\">,</span>\n <span class=\"n\">target_children</span><span class=\"p\">,</span>\n <span class=\"k\">lambda</span> <span class=\"n\">l</span><span class=\"p\">,</span> <span class=\"n\">r</span><span class=\"p\">:</span> <span class=\"p\">(</span><span class=\"n\">l</span><span class=\"p\">,</span> <span class=\"n\">r</span><span class=\"p\">)</span> <span class=\"ow\">in</span> <span class=\"n\">matching_set</span>\n <span class=\"p\">)</span>\n <span class=\"p\">)</span>\n\n <span class=\"n\">move_edits</span> <span class=\"o\">=</span> <span class=\"p\">[]</span>\n <span class=\"k\">for</span> <span class=\"n\">node</span> <span class=\"ow\">in</span> <span class=\"n\">source_children</span><span class=\"p\">:</span>\n <span class=\"k\">if</span> <span class=\"n\">node</span> <span class=\"ow\">not</span> <span class=\"ow\">in</span> <span class=\"n\">lcs</span> <span class=\"ow\">and</span> <span class=\"n\">node</span> <span class=\"ow\">not</span> <span class=\"ow\">in</span> <span class=\"n\">unmatched_source_nodes</span><span class=\"p\">:</span>\n <span class=\"n\">move_edits</span><span class=\"o\">.</span><span class=\"n\">append</span><span class=\"p\">(</span><span class=\"n\">Move</span><span class=\"p\">(</span><span class=\"n\">node</span><span class=\"p\">))</span>\n\n <span class=\"k\">return</span> <span class=\"n\">move_edits</span>\n</code></pre>\n</div>\n\n<p>I left out the implementation of the LCS algorithm itself here, but there are plenty of implementation choices out there that can be easily looked up.</p>\n\n<h3 id=\"output\">Output</h3>\n\n<p>The implemented algorithm produces the output that resembles the following:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"o\">>>></span> <span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span><span class=\"p\">,</span> <span class=\"n\">diff</span>\n<span class=\"o\">>>></span> <span class=\"n\">diff</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a + b + c, d, e"</span><span class=\"p\">),</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a - b + c, e, f"</span><span class=\"p\">))</span>\n\n<span class=\"n\">Remove</span><span class=\"p\">(</span><span class=\"n\">Add</span><span class=\"p\">)</span>\n<span class=\"n\">Remove</span><span class=\"p\">(</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">d</span><span class=\"p\">))</span>\n<span class=\"n\">Remove</span><span class=\"p\">(</span><span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">d</span><span class=\"p\">))</span>\n<span class=\"n\">Insert</span><span class=\"p\">(</span><span class=\"n\">Sub</span><span class=\"p\">)</span>\n<span class=\"n\">Insert</span><span class=\"p\">(</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">f</span><span class=\"p\">))</span>\n<span class=\"n\">Insert</span><span class=\"p\">(</span><span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">f</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Select</span><span class=\"p\">,</span> <span class=\"n\">Select</span><span class=\"p\">)</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Add</span><span class=\"p\">,</span> <span class=\"n\">Add</span><span class=\"p\">)</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">a</span><span class=\"p\">),</span> <span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">a</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">a</span><span class=\"p\">),</span> <span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">a</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">b</span><span class=\"p\">),</span> <span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">b</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">b</span><span class=\"p\">),</span> <span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">b</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">c</span><span class=\"p\">),</span> <span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">c</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">c</span><span class=\"p\">),</span> <span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">c</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">),</span> <span class=\"n\">Column</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">))</span>\n<span class=\"n\">Keep</span><span class=\"p\">(</span><span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">),</span> <span class=\"n\">Identifier</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">))</span>\n</code></pre>\n</div>\n\n<p>Note that the output above is abbreviated. The string representation of actual AST nodes is significantly more verbose.</p>\n\n<p>The implementation works especially well when coupled with the SQLGlot\u2019s query optimizer which can be used to produce canonical representations of compared queries:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"o\">>>></span> <span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s2\">"t"</span><span class=\"p\">:</span> <span class=\"p\">{</span><span class=\"s2\">"a"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"b"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"c"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">,</span> <span class=\"s2\">"d"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">}}</span>\n<span class=\"o\">>>></span> <span class=\"n\">source</span> <span class=\"o\">=</span> <span class=\"s2\">"""</span>\n<span class=\"s2\">... SELECT 1 + 1 + a</span>\n<span class=\"s2\">... FROM t</span>\n<span class=\"s2\">... WHERE b = 1 OR (c = 2 AND d = 3)</span>\n<span class=\"s2\">... """</span>\n<span class=\"o\">>>></span> <span class=\"n\">target</span> <span class=\"o\">=</span> <span class=\"s2\">"""</span>\n<span class=\"s2\">... SELECT 2 + a</span>\n<span class=\"s2\">... FROM t</span>\n<span class=\"s2\">... WHERE (b = 1 OR c = 2) AND (b = 1 OR d = 3)</span>\n<span class=\"s2\">... """</span>\n<span class=\"o\">>>></span> <span class=\"n\">optimized_source</span> <span class=\"o\">=</span> <span class=\"n\">optimize</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">source</span><span class=\"p\">),</span> <span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"n\">schema</span><span class=\"p\">)</span>\n<span class=\"o\">>>></span> <span class=\"n\">optimized_target</span> <span class=\"o\">=</span> <span class=\"n\">optimize</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">target</span><span class=\"p\">),</span> <span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"n\">schema</span><span class=\"p\">)</span>\n<span class=\"o\">>>></span> <span class=\"n\">edit_script</span> <span class=\"o\">=</span> <span class=\"n\">diff</span><span class=\"p\">(</span><span class=\"n\">optimized_source</span><span class=\"p\">,</span> <span class=\"n\">optimized_target</span><span class=\"p\">)</span>\n<span class=\"o\">>>></span> <span class=\"nb\">sum</span><span class=\"p\">(</span><span class=\"mi\">0</span> <span class=\"k\">if</span> <span class=\"nb\">isinstance</span><span class=\"p\">(</span><span class=\"n\">e</span><span class=\"p\">,</span> <span class=\"n\">Keep</span><span class=\"p\">)</span> <span class=\"k\">else</span> <span class=\"mi\">1</span> <span class=\"k\">for</span> <span class=\"n\">e</span> <span class=\"ow\">in</span> <span class=\"n\">edit_script</span><span class=\"p\">)</span>\n<span class=\"mi\">0</span>\n</code></pre>\n</div>\n\n<h3 id=\"optimizations\">Optimizations</h3>\n\n<p>The worst case runtime complexity of this algorithm is not exactly stellar: O(n^2 * log n^2). This is because of the leaf matching process, which involves ranking a cartesian product between all leaf nodes of compared trees. Unsurprisingly, the algorithm takes a considerable time to finish for bigger queries.</p>\n\n<p>There are still a few basic things we can do in our implementation to help improve performance:</p>\n\n<ul>\n<li>Refer to individual node objects using their identifiers (Python\u2019s <a href=\"https://docs.python.org/3/library/functions.html#id\">id()</a>) instead of direct references in sets. This helps avoid costly recursive hash calculations and equality checks.</li>\n<li>Cache bigram histograms to avoid computing them more than once for the same node.</li>\n<li>Compute the canonical SQL string representation for each tree once while caching string representations of all inner nodes. This prevents redundant tree traversals when bigrams are computed.</li>\n</ul>\n\n<p>At the time of writing only the first two optimizations have been implemented, so there is an opportunity to contribute for anyone who\u2019s interested.</p>\n\n<h2 id=\"alternative-solutions\">Alternative Solutions</h2>\n\n<p>This section is dedicated to solutions that I\u2019ve investigated, but haven\u2019t tried.</p>\n\n<p>First, this section wouldn\u2019t be complete without Tristan Hume\u2019s <a href=\"https://thume.ca/2017/06/17/tree-diffing/\">blog post</a>. Tristan\u2019s solution has a lot in common with the Myers algorithm plus heuristics that is much more clever than what I came up with. The implementation relies on a combination of <a href=\"https://en.wikipedia.org/wiki/Dynamic_programming\">dynamic programming</a> and <a href=\"https://en.wikipedia.org/wiki/A*_search_algorithm\">A* search algorithm</a> to explore the space of possible matchings and pick the best ones. It seemed to have worked well for Tistan\u2019s specific use case, but after my negative experience with the Myers algorithm, I decided to try something different.</p>\n\n<p>Another notable approach is the Gumtree algorithm by Falleri et al. [4]. I discovered this paper after I\u2019d already implemented the algorithm that is the main focus of this post. In sections 5.2 and 5.3 of their paper, the authors compare the two algorithms side by side and claim that Gumtree is significantly better in terms of both runtime performance and accuracy when evaluated on 12 792 pairs of Java source files. This doesn\u2019t surprise me, as the algorithm takes the height of subtrees into account. In my tests, I definitely saw scenarios in which this context would have helped. On top of that, the authors promise O(n^2) runtime complexity in the worst case which, given the Change Distiller's O(n^2 * log n^2), looks particularly tempting. I hope to try this algorithm out at some point, and there is a good chance you see me writing about it in my future posts.</p>\n\n<h2 id=\"conclusion\">Conclusion</h2>\n\n<p>The Change Distiller algorithm yielded quite satisfactory results in most of my tests. The scenarios in which it fell short mostly concerned identical (or very similar) subtrees located in different parts of the AST. In those cases, node mismatches were frequent and, as a result, edit scripts were somewhat suboptimal.</p>\n\n<p>Additionally, the runtime performance of the algorithm leaves a lot to be desired. On trees with 1000 leaf nodes each, the algorithm takes a little under 2 seconds to complete. My implementation still has room for improvement, but this should give you a rough idea of what to expect. It appears that the Gumtree algorithm [4] can help address both of these points. I hope to find bandwidth to work on it soon and then compare the two algorithms side-by-side to find out which one performs better on SQL specifically. In the meantime, Change Distiller definitely gets the job done, and I can now proceed with applying it to some of the use cases I mentioned at the beginning of this post.</p>\n\n<p>I\u2019m also curious to learn whether other folks in the industry faced a similar problem, and how they approached it. If you did something similar, I\u2019m interested to hear about your experience.</p>\n\n<h2 id=\"references\">References</h2>\n\n<p>[1] Eugene W. Myers. <a href=\"http://www.xmailserver.org/diff2.pdf\">An O(ND) Difference Algorithm and Its Variations</a>. Algorithmica 1(2): 251-266 (1986)</p>\n\n<p>[2] B. Fluri, M. Wursch, M. Pinzger, and H. Gall. <a href=\"https://www.researchgate.net/publication/3189787_Change_DistillingTree_Differencing_for_Fine-Grained_Source_Code_Change_Extraction\">Change Distilling: Tree differencing for fine-grained source code change extraction</a>. IEEE Trans. Software Eng., 33(11):725\u2013743, 2007.</p>\n\n<p>[3] S.S. Chawathe, A. Rajaraman, H. Garcia-Molina, and J. Widom. <a href=\"http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf\">Change Detection in Hierarchically Structured Information</a>. Proc. ACM Sigmod Int\u2019l Conf. Management of Data, pp. 493-504, June 1996</p>\n\n<p>[4] Jean-R\u00e9my Falleri, Flor\u00e9al Morandat, Xavier Blanc, Matias Martinez, Martin Monperrus. <a href=\"https://hal.archives-ouvertes.fr/hal-01054552/document\">Fine-grained and Accurate Source Code Differencing</a>. Proceedings of the International Conference on Automated Software Engineering, 2014, V\u00e4steras, Sweden. pp.313-324, 10.1145/2642937.2642982. hal-01054552</p>\n\n<hr />\n"}, "sqlglot.diff.Insert": {"fullname": "sqlglot.diff.Insert", "modulename": "sqlglot.diff", "qualname": "Insert", "kind": "class", "doc": "<p>Indicates that a new node has been inserted</p>\n"}, "sqlglot.diff.Insert.__init__": {"fullname": "sqlglot.diff.Insert.__init__", "modulename": "sqlglot.diff", "qualname": "Insert.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span>)</span>"}, "sqlglot.diff.Remove": {"fullname": "sqlglot.diff.Remove", "modulename": "sqlglot.diff", "qualname": "Remove", "kind": "class", "doc": "<p>Indicates that an existing node has been removed</p>\n"}, "sqlglot.diff.Remove.__init__": {"fullname": "sqlglot.diff.Remove.__init__", "modulename": "sqlglot.diff", "qualname": "Remove.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span>)</span>"}, "sqlglot.diff.Move": {"fullname": "sqlglot.diff.Move", "modulename": "sqlglot.diff", "qualname": "Move", "kind": "class", "doc": "<p>Indicates that an existing node's position within the tree has changed</p>\n"}, "sqlglot.diff.Move.__init__": {"fullname": "sqlglot.diff.Move.__init__", "modulename": "sqlglot.diff", "qualname": "Move.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span>)</span>"}, "sqlglot.diff.Update": {"fullname": "sqlglot.diff.Update", "modulename": "sqlglot.diff", "qualname": "Update", "kind": "class", "doc": "<p>Indicates that an existing node has been updated</p>\n"}, "sqlglot.diff.Update.__init__": {"fullname": "sqlglot.diff.Update.__init__", "modulename": "sqlglot.diff", "qualname": "Update.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">source</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">target</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span>)</span>"}, "sqlglot.diff.Keep": {"fullname": "sqlglot.diff.Keep", "modulename": "sqlglot.diff", "qualname": "Keep", "kind": "class", "doc": "<p>Indicates that an existing node hasn't been changed</p>\n"}, "sqlglot.diff.Keep.__init__": {"fullname": "sqlglot.diff.Keep.__init__", "modulename": "sqlglot.diff", "qualname": "Keep.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">source</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">target</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span>)</span>"}, "sqlglot.diff.diff": {"fullname": "sqlglot.diff.diff", "modulename": "sqlglot.diff", "qualname": "diff", "kind": "function", "doc": "<p>Returns the list of changes between the source and the target expressions.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">diff</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"a + b"</span><span class=\"p\">),</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"a + c"</span><span class=\"p\">))</span>\n<span class=\"go\">[</span>\n<span class=\"go\"> Remove(expression=(COLUMN this: (IDENTIFIER this: b, quoted: False))),</span>\n<span class=\"go\"> Insert(expression=(COLUMN this: (IDENTIFIER this: c, quoted: False))),</span>\n<span class=\"go\"> Keep(</span>\n<span class=\"go\"> source=(ADD this: ...),</span>\n<span class=\"go\"> target=(ADD this: ...)</span>\n<span class=\"go\"> ),</span>\n<span class=\"go\"> Keep(</span>\n<span class=\"go\"> source=(COLUMN this: (IDENTIFIER this: a, quoted: False)),</span>\n<span class=\"go\"> target=(COLUMN this: (IDENTIFIER this: a, quoted: False))</span>\n<span class=\"go\"> ),</span>\n<span class=\"go\">]</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>source:</strong> the source expression.</li>\n<li><strong>target:</strong> the target expression against which the diff should be calculated.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the\n target expression trees. This list represents a sequence of steps needed to transform the source\n expression tree into the target one.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">source</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">target</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Insert</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Remove</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Move</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Update</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Keep</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.diff.ChangeDistiller": {"fullname": "sqlglot.diff.ChangeDistiller", "modulename": "sqlglot.diff", "qualname": "ChangeDistiller", "kind": "class", "doc": "<p>The implementation of the Change Distiller algorithm described by Beat Fluri and Martin Pinzger in\ntheir paper <a href=\"https://ieeexplore.ieee.org/document/4339230\">https://ieeexplore.ieee.org/document/4339230</a>, which in turn is based on the algorithm by\nChawathe et al. described in <a href=\"http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf\">http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf</a>.</p>\n"}, "sqlglot.diff.ChangeDistiller.__init__": {"fullname": "sqlglot.diff.ChangeDistiller.__init__", "modulename": "sqlglot.diff", "qualname": "ChangeDistiller.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">f</span><span class=\"p\">:</span> <span class=\"nb\">float</span> <span class=\"o\">=</span> <span class=\"mf\">0.6</span>, </span><span class=\"param\"><span class=\"n\">t</span><span class=\"p\">:</span> <span class=\"nb\">float</span> <span class=\"o\">=</span> <span class=\"mf\">0.6</span></span>)</span>"}, "sqlglot.diff.ChangeDistiller.diff": {"fullname": "sqlglot.diff.ChangeDistiller.diff", "modulename": "sqlglot.diff", "qualname": "ChangeDistiller.diff", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">source</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">target</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Insert</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Remove</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Move</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Update</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">diff</span><span class=\"o\">.</span><span class=\"n\">Keep</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.errors": {"fullname": "sqlglot.errors", "modulename": "sqlglot.errors", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.errors.ErrorLevel": {"fullname": "sqlglot.errors.ErrorLevel", "modulename": "sqlglot.errors", "qualname": "ErrorLevel", "kind": "class", "doc": "<p>An enumeration.</p>\n", "bases": "sqlglot.helper.AutoName"}, "sqlglot.errors.ErrorLevel.IGNORE": {"fullname": "sqlglot.errors.ErrorLevel.IGNORE", "modulename": "sqlglot.errors", "qualname": "ErrorLevel.IGNORE", "kind": "variable", "doc": "<p>Ignore all errors.</p>\n", "default_value": " = <ErrorLevel.IGNORE: 'IGNORE'>"}, "sqlglot.errors.ErrorLevel.WARN": {"fullname": "sqlglot.errors.ErrorLevel.WARN", "modulename": "sqlglot.errors", "qualname": "ErrorLevel.WARN", "kind": "variable", "doc": "<p>Log all errors.</p>\n", "default_value": " = <ErrorLevel.WARN: 'WARN'>"}, "sqlglot.errors.ErrorLevel.RAISE": {"fullname": "sqlglot.errors.ErrorLevel.RAISE", "modulename": "sqlglot.errors", "qualname": "ErrorLevel.RAISE", "kind": "variable", "doc": "<p>Collect all errors and raise a single exception.</p>\n", "default_value": " = <ErrorLevel.RAISE: 'RAISE'>"}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"fullname": "sqlglot.errors.ErrorLevel.IMMEDIATE", "modulename": "sqlglot.errors", "qualname": "ErrorLevel.IMMEDIATE", "kind": "variable", "doc": "<p>Immediately raise an exception on the first error found.</p>\n", "default_value": " = <ErrorLevel.IMMEDIATE: 'IMMEDIATE'>"}, "sqlglot.errors.SqlglotError": {"fullname": "sqlglot.errors.SqlglotError", "modulename": "sqlglot.errors", "qualname": "SqlglotError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "builtins.Exception"}, "sqlglot.errors.UnsupportedError": {"fullname": "sqlglot.errors.UnsupportedError", "modulename": "sqlglot.errors", "qualname": "UnsupportedError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "SqlglotError"}, "sqlglot.errors.ParseError": {"fullname": "sqlglot.errors.ParseError", "modulename": "sqlglot.errors", "qualname": "ParseError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "SqlglotError"}, "sqlglot.errors.ParseError.__init__": {"fullname": "sqlglot.errors.ParseError.__init__", "modulename": "sqlglot.errors", "qualname": "ParseError.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">message</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"n\">errors</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Any</span><span class=\"p\">]]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span>)</span>"}, "sqlglot.errors.ParseError.new": {"fullname": "sqlglot.errors.ParseError.new", "modulename": "sqlglot.errors", "qualname": "ParseError.new", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">message</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">description</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">line</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">col</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">start_context</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">highlight</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">end_context</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">into_expression</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">errors</span><span class=\"o\">.</span><span class=\"n\">ParseError</span>:</span></span>", "funcdef": "def"}, "sqlglot.errors.TokenError": {"fullname": "sqlglot.errors.TokenError", "modulename": "sqlglot.errors", "qualname": "TokenError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "SqlglotError"}, "sqlglot.errors.OptimizeError": {"fullname": "sqlglot.errors.OptimizeError", "modulename": "sqlglot.errors", "qualname": "OptimizeError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "SqlglotError"}, "sqlglot.errors.SchemaError": {"fullname": "sqlglot.errors.SchemaError", "modulename": "sqlglot.errors", "qualname": "SchemaError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "SqlglotError"}, "sqlglot.errors.ExecuteError": {"fullname": "sqlglot.errors.ExecuteError", "modulename": "sqlglot.errors", "qualname": "ExecuteError", "kind": "class", "doc": "<p>Common base class for all non-exit exceptions.</p>\n", "bases": "SqlglotError"}, "sqlglot.errors.concat_messages": {"fullname": "sqlglot.errors.concat_messages", "modulename": "sqlglot.errors", "qualname": "concat_messages", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">errors</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">]</span>, </span><span class=\"param\"><span class=\"n\">maximum</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.errors.merge_errors": {"fullname": "sqlglot.errors.merge_errors", "modulename": "sqlglot.errors", "qualname": "merge_errors", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">errors</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">errors</span><span class=\"o\">.</span><span class=\"n\">ParseError</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Any</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor": {"fullname": "sqlglot.executor", "modulename": "sqlglot.executor", "kind": "module", "doc": "<h1 id=\"writing-a-python-sql-engine-from-scratch\">Writing a Python SQL engine from scratch</h1>\n\n<p><a href=\"https://www.linkedin.com/in/toby-mao/\">Toby Mao</a></p>\n\n<h2 id=\"introduction\">Introduction</h2>\n\n<p>When I first started writing SQLGlot in early 2021, my goal was just to translate SQL queries from SparkSQL to Presto and vice versa. However, over the last year and a half, I've ended up with a full-fledged SQL engine. SQLGlot can now parse and transpile between <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/dialects/__init__.py\">18 SQL dialects</a> and can execute all 24 <a href=\"https://www.tpc.org/tpch/\">TPC-H</a> SQL queries. The parser and engine are all written from scratch using Python.</p>\n\n<p>This post will cover <a href=\"#why\">why</a> I went through the effort of creating a Python SQL engine and <a href=\"#how\">how</a> a simple query goes from a string to actually transforming data. The following steps are briefly summarized:</p>\n\n<ul>\n<li><a href=\"#tokenizing\">Tokenizing</a></li>\n<li><a href=\"#parsing\">Parsing</a></li>\n<li><a href=\"#optimizing\">Optimizing</a></li>\n<li><a href=\"#planning\">Planning</a></li>\n<li><a href=\"#executing\">Executing</a></li>\n</ul>\n\n<h2 id=\"why\">Why?</h2>\n\n<p>I started working on SQLGlot because of my work on the <a href=\"https://netflixtechblog.com/reimagining-experimentation-analysis-at-netflix-71356393af21\">experimentation and metrics platform</a> at Netflix, where I built tools that allowed data scientists to define and compute SQL-based metrics. Netflix relied on multiple engines to query data (Spark, Presto, and Druid), so my team built the metrics platform around <a href=\"https://github.com/kayak/pypika\">PyPika</a>, a Python SQL query builder. This way, definitions could be reused across multiple engines. However, it became quickly apparent that writing python code to programmatically generate SQL was challenging for data scientists, especially those with academic backgrounds, since they were mostly familiar with R and SQL. At the time, the only Python SQL parser was <a href=\"[https://github.com/andialbrecht/sqlparse\">sqlparse</a>, which is not actually a parser but a tokenizer, so having users write raw SQL into the platform wasn't really an option. Some time later, I randomly stumbled across <a href=\"https://craftinginterpreters.com/\">Crafting Interpreters</a> and realized that I could use it as a guide towards creating my own SQL parser/transpiler.</p>\n\n<p>Why did I do this? Isn't a Python SQL engine going to be extremely slow?</p>\n\n<p>The main reason why I ended up building a SQL engine was...just for <strong>entertainment</strong>. It's been fun learning about all the things required to actually run a SQL query, and seeing it actually work is extremely rewarding. Before SQLGlot, I had zero experience with lexers, parsers, or compilers.</p>\n\n<p>In terms of practical use cases, I planned to use the Python SQL engine for unit testing SQL pipelines. Big data pipelines are tough to test because many of the engines are not open source and cannot be run locally. With SQLGlot, you can take a SQL query targeting a warehouse such as <a href=\"https://www.snowflake.com/en/\">Snowflake</a> and seamlessly run it in CI on mock Python data. It's easy to mock data and create arbitrary <a href=\"https://en.wikipedia.org/wiki/User-defined_function\">UDFs</a> because everything is just Python. Although the implementation is slow and unsuitable for large amounts of data (> 1 million rows), there's very little overhead/startup and you can run queries on test data in a couple of milliseconds.</p>\n\n<p>Finally, the components that have been built to support execution can be used as a <strong>foundation</strong> for a faster engine. I'm inspired by what <a href=\"https://github.com/apache/calcite\">Apache Calcite</a> has done for the JVM world. Even though Python is commonly used for data, there hasn't been a Calcite for Python. So, you could say that SQLGlot aims to be that framework. For example, it wouldn't take much work to replace the Python execution engine with numpy/pandas/arrow to become a respectably-performing query engine. The implementation would be able to leverage the parser, optimizer, and logical planner, only needing to implement physical execution. There is a lot of work in the Python ecosystem around high performance vectorized computation, which I think could benefit from a pure Python-based <a href=\"https://en.wikipedia.org/wiki/Abstract_syntax_tree\">AST</a>/<a href=\"https://en.wikipedia.org/wiki/Query_plan\">plan</a>. Parsing and planning doesn't have to be fast when the bottleneck of running queries is processing terabytes of data. So, having a Python-based ecosystem around SQL is beneficial given the ease of development in Python, despite not having bare metal performance.</p>\n\n<p>Parts of SQLGlot's toolkit are being used today by the following:</p>\n\n<ul>\n<li><a href=\"https://github.com/ibis-project/ibis\">Ibis</a>: A Python library that provides a lightweight, universal interface for data wrangling.\n<ul>\n<li>Uses the Python SQL expression builder and leverages the optimizer/planner to convert SQL into dataframe operations.</li>\n</ul></li>\n<li><a href=\"https://github.com/kelsin/mysql-mimic\">mysql-mimic</a>: Pure-Python implementation of the MySQL server wire protocol\n<ul>\n<li>Parses / transforms SQL and executes INFORMATION_SCHEMA queries.</li>\n</ul></li>\n<li><a href=\"https://github.com/marsupialtail/quokka\">Quokka</a>: Push-based vectorized query engine\n<ul>\n<li>Parse and optimizes SQL.</li>\n</ul></li>\n<li><a href=\"https://github.com/moj-analytical-services/splink\">Splink</a>: Fast, accurate and scalable probabilistic data linkage using your choice of SQL backend.\n<ul>\n<li>Transpiles queries.</li>\n</ul></li>\n</ul>\n\n<h2 id=\"how\">How?</h2>\n\n<p>There are many steps involved with actually running a simple query like:</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">SELECT</span>\n<span class=\"w\"> </span><span class=\"n\">bar</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"p\">,</span>\n<span class=\"w\"> </span><span class=\"n\">b</span><span class=\"w\"> </span><span class=\"o\">+</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">b</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">bar</span>\n<span class=\"k\">JOIN</span><span class=\"w\"> </span><span class=\"n\">baz</span>\n<span class=\"w\"> </span><span class=\"k\">ON</span><span class=\"w\"> </span><span class=\"n\">bar</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">baz</span><span class=\"p\">.</span><span class=\"n\">a</span>\n<span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"n\">bar</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">></span><span class=\"w\"> </span><span class=\"mi\">1</span>\n</code></pre>\n</div>\n\n<p>In this post, I'll walk through all the steps SQLGlot takes to run this query over Python objects.</p>\n\n<h2 id=\"tokenizing\">Tokenizing</h2>\n\n<p>The first step is to convert the sql string into a list of tokens. SQLGlot's tokenizer is quite simple and can be found <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/tokens.py\">here</a>. In a while loop, it checks each character and either appends the character to the current token, or makes a new token.</p>\n\n<p>Running the SQLGlot tokenizer shows the output.</p>\n\n<p><img src=\"python_sql_engine_images/tokenizer.png\" alt=\"Tokenizer Output\" /></p>\n\n<p>Each keyword has been converted to a SQLGlot Token object. Each token has some metadata associated with it, like line/column information for error messages. Comments are also a part of the token, so that comments can be preserved.</p>\n\n<h2 id=\"parsing\">Parsing</h2>\n\n<p>Once a SQL statement is tokenized, we don't need to worry about white space and other formatting, so it's easier to work with. We can now convert the list of tokens into an AST. The SQLGlot <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/parser.py\">parser</a> is a handwritten <a href=\"https://en.wikipedia.org/wiki/Recursive_descent_parser\">recursive descent</a> parser.</p>\n\n<p>Similar to the tokenizer, it consumes the tokens sequentially, but it instead uses a recursive algorithm. The tokens are converted into a single AST node that presents the SQL query. The SQLGlot parser was designed to support various dialects, so it contains many options for overriding parsing functionality.</p>\n\n<p><img src=\"python_sql_engine_images/parser.png\" alt=\"Parser Output\" /></p>\n\n<p>The AST is a generic representation of a given SQL query. Each dialect can override or implement its own generator, which can convert an AST object into syntatically-correct SQL.</p>\n\n<h2 id=\"optimizing\">Optimizing</h2>\n\n<p>Once we have our AST, we can transform it into an equivalent query that produces the same results more efficiently. When optimizing queries, most engines first convert the AST into a logical plan and then optimize the plan. However, I chose to <strong>optimize the AST directly</strong> for the following reasons:</p>\n\n<ol>\n<li><p>It's easier to debug and <a href=\"https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/optimizer\">validate</a> the optimizations when the input and output are both SQL.</p></li>\n<li><p>Rules can be applied a la carte to transform SQL into a more desirable form.</p></li>\n<li><p>I wanted a way to generate 'canonical sql'. Having a canonical representation of SQL is useful for understanding if two queries are semantically equivalent (e.g. <code>SELECT 1 + 1</code> and <code>SELECT 2</code>).</p></li>\n</ol>\n\n<p>I've yet to find another engine that takes this approach, but I'm quite happy with this decision. The optimizer currently does not perform any \"physical optimizations\" such as join reordering. Those are left to the execution layer, as additional statistics and information could become relevant.</p>\n\n<p><img src=\"python_sql_engine_images/optimizer.png\" alt=\"Optimizer Output\" /></p>\n\n<p>The optimizer currently has <a href=\"https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer\">17 rules</a>. Each of these rules is applied, transforming the AST in place. The combination of these rules creates \"canonical\" sql that can then be more easily converted into a logical plan and executed.</p>\n\n<p>Some example rules are:</p>\n\n<h3 id=\"qualify_tables-and-qualify_columns\">qualify_tables and qualify_columns</h3>\n\n<ul>\n<li>Adds all db/catalog qualifiers to tables and forces an alias.</li>\n<li>Ensure each column is unambiguous and expand stars.</li>\n</ul>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span><span class=\"w\"> </span><span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"p\">;</span>\n\n<span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"ss\">"db"</span><span class=\"p\">.</span><span class=\"ss\">"x"</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"ss\">"x"</span><span class=\"p\">;</span>\n</code></pre>\n</div>\n\n<h3 id=\"simplify\">simplify</h3>\n\n<p>Boolean and math simplification. Check out all the <a href=\"https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/optimizer/simplify.sql\">test cases</a>.</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"p\">((</span><span class=\"k\">NOT</span><span class=\"w\"> </span><span class=\"k\">FALSE</span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"p\">(</span><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"p\">))</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"p\">(</span><span class=\"k\">TRUE</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"w\"> </span><span class=\"o\"><></span><span class=\"w\"> </span><span class=\"mi\">3</span><span class=\"p\">);</span>\n<span class=\"n\">x</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"p\">;</span>\n\n<span class=\"mi\">1</span><span class=\"w\"> </span><span class=\"o\">+</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"p\">;</span>\n<span class=\"mi\">2</span><span class=\"p\">;</span>\n</code></pre>\n</div>\n\n<h3 id=\"normalize\">normalize</h3>\n\n<p>Attempts to convert all predicates into <a href=\"https://en.wikipedia.org/wiki/Conjunctive_normal_form\">conjunctive normal form</a>.</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"c1\">-- DNF</span>\n<span class=\"p\">(</span><span class=\"n\">A</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"n\">B</span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"p\">(</span><span class=\"n\">B</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"k\">C</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"n\">D</span><span class=\"p\">);</span>\n\n<span class=\"c1\">-- CNF</span>\n<span class=\"p\">(</span><span class=\"n\">A</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"k\">C</span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"p\">(</span><span class=\"n\">A</span><span class=\"w\"> </span><span class=\"k\">OR</span><span class=\"w\"> </span><span class=\"n\">D</span><span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"n\">B</span><span class=\"p\">;</span>\n</code></pre>\n</div>\n\n<h3 id=\"unnest_subqueries\">unnest_subqueries</h3>\n\n<p>Converts subqueries in predicates into joins.</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"c1\">-- The subquery can be converted into a left join</span>\n<span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">x</span>\n<span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">a</span>\n<span class=\"w\"> </span><span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">y</span>\n<span class=\"w\"> </span><span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"p\">.</span><span class=\"n\">a</span>\n<span class=\"p\">)</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"p\">;</span>\n\n<span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">x</span>\n<span class=\"k\">LEFT</span><span class=\"w\"> </span><span class=\"k\">JOIN</span><span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">a</span>\n<span class=\"w\"> </span><span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">y</span>\n<span class=\"w\"> </span><span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"k\">TRUE</span>\n<span class=\"w\"> </span><span class=\"k\">GROUP</span><span class=\"w\"> </span><span class=\"k\">BY</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"p\">.</span><span class=\"n\">a</span>\n<span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"ss\">"_u_0"</span>\n<span class=\"w\"> </span><span class=\"k\">ON</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"ss\">"_u_0"</span><span class=\"p\">.</span><span class=\"n\">a</span>\n<span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"p\">(</span><span class=\"ss\">"_u_0"</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"w\"> </span><span class=\"k\">AND</span><span class=\"w\"> </span><span class=\"k\">NOT</span><span class=\"w\"> </span><span class=\"ss\">"_u_0"</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"k\">IS</span><span class=\"w\"> </span><span class=\"k\">NULL</span><span class=\"p\">)</span>\n</code></pre>\n</div>\n\n<h3 id=\"pushdown_predicates\">pushdown_predicates</h3>\n\n<p>Push down filters into the innermost query.</p>\n\n<div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span>\n<span class=\"w\"> </span><span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">x</span>\n<span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">y</span>\n<span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"mi\">1</span><span class=\"p\">;</span>\n\n<span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span>\n<span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"p\">(</span>\n<span class=\"w\"> </span><span class=\"k\">SELECT</span><span class=\"w\"> </span><span class=\"o\">*</span>\n<span class=\"w\"> </span><span class=\"k\">FROM</span><span class=\"w\"> </span><span class=\"n\">x</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">x</span>\n<span class=\"w\"> </span><span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"p\">.</span><span class=\"n\">a</span><span class=\"w\"> </span><span class=\"o\">=</span><span class=\"w\"> </span><span class=\"mi\">1</span>\n<span class=\"p\">)</span><span class=\"w\"> </span><span class=\"k\">AS</span><span class=\"w\"> </span><span class=\"n\">y</span><span class=\"w\"> </span><span class=\"k\">WHERE</span><span class=\"w\"> </span><span class=\"k\">TRUE</span>\n</code></pre>\n</div>\n\n<h3 id=\"annotate_types\">annotate_types</h3>\n\n<p>Infer all types throughout the AST given schema information and function type definitions.</p>\n\n<h2 id=\"planning\">Planning</h2>\n\n<p>After the SQL AST has been \"optimized\", it's much easier to <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/planner.py\">convert into a logical plan</a>. The AST is traversed and converted into a <a href=\"https://en.wikipedia.org/wiki/Directed_acyclic_graph\">DAG</a> consisting of one of five steps. The different steps are:</p>\n\n<h3 id=\"scan\">Scan</h3>\n\n<p>Selects columns from a table, applies projections, and finally filters the table.</p>\n\n<h3 id=\"sort\">Sort</h3>\n\n<p>Sorts a table for order by expressions.</p>\n\n<h3 id=\"set\">Set</h3>\n\n<p>Applies the operators union/union all/except/intersect.</p>\n\n<h3 id=\"aggregate\">Aggregate</h3>\n\n<p>Applies an aggregation/group by.</p>\n\n<h3 id=\"join\">Join</h3>\n\n<p>Joins multiple tables together.</p>\n\n<p><img src=\"python_sql_engine_images/planner.png\" alt=\"Planner Output\" /></p>\n\n<p>The logical plan is quite simple and contains the information required to convert it into a physical plan (execution).</p>\n\n<h2 id=\"executing\">Executing</h2>\n\n<p>Finally, we can actually execute the SQL query. The <a href=\"https://github.com/tobymao/sqlglot/blob/main/sqlglot/executor/python.py\">Python engine</a> is not fast, but it's very small (~400 LOC)! It iterates the DAG with a queue and runs each step, passing each intermediary table to the next step.</p>\n\n<p>In order to keep things simple, it evaluates expressions with <code>eval</code>. Because SQLGlot was built primarily to be a transpiler, it was simple to create a \"Python SQL\" dialect. So a SQL expression <code>x + 1</code> can just be converted into <code>scope['x'] + 1</code>.</p>\n\n<p><img src=\"python_sql_engine_images/executor.png\" alt=\"Executor Output\" /></p>\n\n<h2 id=\"whats-next\">What's next</h2>\n\n<p>SQLGlot's main focus will always be on parsing/transpiling, but I plan to continue development on the execution engine. I'd like to pass <a href=\"https://www.tpc.org/tpcds/\">TPC-DS</a>. If someone doesn't beat me to it, I may even take a stab at writing a Pandas/Arrow execution engine.</p>\n\n<p>I'm hoping that over time, SQLGlot will spark the Python SQL ecosystem just like Calcite has for Java.</p>\n\n<h2 id=\"special-thanks\">Special thanks</h2>\n\n<p>SQLGlot would not be what it is without it's core contributors. In particular, the execution engine would not exist without <a href=\"https://github.com/barakalon\">Barak Alon</a> and <a href=\"https://github.com/GeorgeSittas\">George Sittas</a>.</p>\n\n<h2 id=\"get-in-touch\">Get in touch</h2>\n\n<p>If you'd like to chat more about SQLGlot, please join my <a href=\"https://join.slack.com/t/tobiko-data/shared_invite/zt-1ma66d79v-a4dbf4DUpLAQJ8ptQrJygg\">Slack Channel</a>!</p>\n\n<hr />\n"}, "sqlglot.executor.execute": {"fullname": "sqlglot.executor.execute", "modulename": "sqlglot.executor", "qualname": "execute", "kind": "function", "doc": "<p>Run a sql query against data.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql:</strong> a sql statement.</li>\n<li><strong>schema:</strong> database schema.\nThis can either be an instance of <code>Schema</code> or a mapping in one of the following forms:\n<ol>\n<li>{table: {col: type}}</li>\n<li>{db: {table: {col: type}}}</li>\n<li>{catalog: {db: {table: {col: type}}}}</li>\n</ol></li>\n<li><strong>read:</strong> the SQL dialect to apply during parsing (eg. \"spark\", \"hive\", \"presto\", \"mysql\").</li>\n<li><strong>tables:</strong> additional tables to register.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Simple columnar data structure.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">schema</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">Schema</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">read</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">tables</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">executor</span><span class=\"o\">.</span><span class=\"n\">table</span><span class=\"o\">.</span><span class=\"n\">Table</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context": {"fullname": "sqlglot.executor.context", "modulename": "sqlglot.executor.context", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.executor.context.Context": {"fullname": "sqlglot.executor.context.Context", "modulename": "sqlglot.executor.context", "qualname": "Context", "kind": "class", "doc": "<p>Execution context for sql expressions.</p>\n\n<p>Context is used to hold relevant data tables which can then be queried on with eval.</p>\n\n<p>References to columns can either be scalar or vectors. When set_row is used, column references\nevaluate to scalars while set_range evaluates to vectors. This allows convenient and efficient\nevaluation of aggregation functions.</p>\n"}, "sqlglot.executor.context.Context.__init__": {"fullname": "sqlglot.executor.context.Context.__init__", "modulename": "sqlglot.executor.context", "qualname": "Context.__init__", "kind": "function", "doc": "<p>Args\n tables: representing the scope of the current execution context.\n env: dictionary of functions within the execution context.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">tables</span><span class=\"p\">:</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">executor</span><span class=\"o\">.</span><span class=\"n\">table</span><span class=\"o\">.</span><span class=\"n\">Table</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">env</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span>)</span>"}, "sqlglot.executor.context.Context.eval": {"fullname": "sqlglot.executor.context.Context.eval", "modulename": "sqlglot.executor.context", "qualname": "Context.eval", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">code</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.eval_tuple": {"fullname": "sqlglot.executor.context.Context.eval_tuple", "modulename": "sqlglot.executor.context", "qualname": "Context.eval_tuple", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">codes</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.add_columns": {"fullname": "sqlglot.executor.context.Context.add_columns", "modulename": "sqlglot.executor.context", "qualname": "Context.add_columns", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">columns</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.table_iter": {"fullname": "sqlglot.executor.context.Context.table_iter", "modulename": "sqlglot.executor.context", "qualname": "Context.table_iter", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Iterator</span><span class=\"p\">[</span><span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">executor</span><span class=\"o\">.</span><span class=\"n\">table</span><span class=\"o\">.</span><span class=\"n\">TableIter</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">executor</span><span class=\"o\">.</span><span class=\"n\">context</span><span class=\"o\">.</span><span class=\"n\">Context</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.filter": {"fullname": "sqlglot.executor.context.Context.filter", "modulename": "sqlglot.executor.context", "qualname": "Context.filter", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">condition</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.sort": {"fullname": "sqlglot.executor.context.Context.sort", "modulename": "sqlglot.executor.context", "qualname": "Context.sort", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">key</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.set_row": {"fullname": "sqlglot.executor.context.Context.set_row", "modulename": "sqlglot.executor.context", "qualname": "Context.set_row", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">row</span><span class=\"p\">:</span> <span class=\"n\">Tuple</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.set_index": {"fullname": "sqlglot.executor.context.Context.set_index", "modulename": "sqlglot.executor.context", "qualname": "Context.set_index", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">index</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.context.Context.set_range": {"fullname": "sqlglot.executor.context.Context.set_range", "modulename": "sqlglot.executor.context", "qualname": "Context.set_range", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">start</span><span class=\"p\">:</span> <span class=\"nb\">int</span>, </span><span class=\"param\"><span class=\"n\">end</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.env": {"fullname": "sqlglot.executor.env", "modulename": "sqlglot.executor.env", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.executor.env.reverse_key": {"fullname": "sqlglot.executor.env.reverse_key", "modulename": "sqlglot.executor.env", "qualname": "reverse_key", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.executor.env.reverse_key.__init__": {"fullname": "sqlglot.executor.env.reverse_key.__init__", "modulename": "sqlglot.executor.env", "qualname": "reverse_key.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">obj</span></span>)</span>"}, "sqlglot.executor.env.filter_nulls": {"fullname": "sqlglot.executor.env.filter_nulls", "modulename": "sqlglot.executor.env", "qualname": "filter_nulls", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">func</span>, </span><span class=\"param\"><span class=\"n\">empty_null</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.env.null_if_any": {"fullname": "sqlglot.executor.env.null_if_any", "modulename": "sqlglot.executor.env", "qualname": "null_if_any", "kind": "function", "doc": "<p>Decorator that makes a function return <code>None</code> if any of the <code>required</code> arguments are <code>None</code>.</p>\n\n<p>This also supports decoration with no arguments, e.g.:</p>\n\n<pre><code>@null_if_any\ndef foo(a, b): ...\n</code></pre>\n\n<p>In which case all arguments are required.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">*</span><span class=\"n\">required</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.env.str_position": {"fullname": "sqlglot.executor.env.str_position", "modulename": "sqlglot.executor.env", "qualname": "str_position", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">substr</span>, </span><span class=\"param\"><span class=\"n\">this</span>, </span><span class=\"param\"><span class=\"n\">position</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.env.substring": {"fullname": "sqlglot.executor.env.substring", "modulename": "sqlglot.executor.env", "qualname": "substring", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">this</span>, </span><span class=\"param\"><span class=\"n\">start</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">length</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.env.cast": {"fullname": "sqlglot.executor.env.cast", "modulename": "sqlglot.executor.env", "qualname": "cast", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">this</span>, </span><span class=\"param\"><span class=\"n\">to</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.env.ordered": {"fullname": "sqlglot.executor.env.ordered", "modulename": "sqlglot.executor.env", "qualname": "ordered", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">this</span>, </span><span class=\"param\"><span class=\"n\">desc</span>, </span><span class=\"param\"><span class=\"n\">nulls_first</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.env.interval": {"fullname": "sqlglot.executor.env.interval", "modulename": "sqlglot.executor.env", "qualname": "interval", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">this</span>, </span><span class=\"param\"><span class=\"n\">unit</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python": {"fullname": "sqlglot.executor.python", "modulename": "sqlglot.executor.python", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.executor.python.PythonExecutor": {"fullname": "sqlglot.executor.python.PythonExecutor", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.executor.python.PythonExecutor.__init__": {"fullname": "sqlglot.executor.python.PythonExecutor.__init__", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">env</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">tables</span><span class=\"o\">=</span><span class=\"kc\">None</span></span>)</span>"}, "sqlglot.executor.python.PythonExecutor.execute": {"fullname": "sqlglot.executor.python.PythonExecutor.execute", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.execute", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">plan</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.generate": {"fullname": "sqlglot.executor.python.PythonExecutor.generate", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.generate", "kind": "function", "doc": "<p>Convert a SQL expression into literal Python code and compile it into bytecode.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"fullname": "sqlglot.executor.python.PythonExecutor.generate_tuple", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.generate_tuple", "kind": "function", "doc": "<p>Convert an array of SQL expressions into tuple of Python byte code.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expressions</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.context": {"fullname": "sqlglot.executor.python.PythonExecutor.context", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.context", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">tables</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.table": {"fullname": "sqlglot.executor.python.PythonExecutor.table", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.table", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expressions</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.scan": {"fullname": "sqlglot.executor.python.PythonExecutor.scan", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.scan", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span>, </span><span class=\"param\"><span class=\"n\">context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.static": {"fullname": "sqlglot.executor.python.PythonExecutor.static", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.static", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.scan_table": {"fullname": "sqlglot.executor.python.PythonExecutor.scan_table", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.scan_table", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"fullname": "sqlglot.executor.python.PythonExecutor.scan_csv", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.scan_csv", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.join": {"fullname": "sqlglot.executor.python.PythonExecutor.join", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.join", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span>, </span><span class=\"param\"><span class=\"n\">context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"fullname": "sqlglot.executor.python.PythonExecutor.nested_loop_join", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.nested_loop_join", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">_join</span>, </span><span class=\"param\"><span class=\"n\">source_context</span>, </span><span class=\"param\"><span class=\"n\">join_context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.hash_join": {"fullname": "sqlglot.executor.python.PythonExecutor.hash_join", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.hash_join", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">join</span>, </span><span class=\"param\"><span class=\"n\">source_context</span>, </span><span class=\"param\"><span class=\"n\">join_context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.aggregate": {"fullname": "sqlglot.executor.python.PythonExecutor.aggregate", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.aggregate", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span>, </span><span class=\"param\"><span class=\"n\">context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.sort": {"fullname": "sqlglot.executor.python.PythonExecutor.sort", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.sort", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span>, </span><span class=\"param\"><span class=\"n\">context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.PythonExecutor.set_operation": {"fullname": "sqlglot.executor.python.PythonExecutor.set_operation", "modulename": "sqlglot.executor.python", "qualname": "PythonExecutor.set_operation", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">step</span>, </span><span class=\"param\"><span class=\"n\">context</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.python.Python": {"fullname": "sqlglot.executor.python.Python", "modulename": "sqlglot.executor.python", "qualname": "Python", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.dialects.dialect.Dialect"}, "sqlglot.executor.python.Python.__init__": {"fullname": "sqlglot.executor.python.Python.__init__", "modulename": "sqlglot.executor.python", "qualname": "Python.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.executor.python.Python.Tokenizer": {"fullname": "sqlglot.executor.python.Python.Tokenizer", "modulename": "sqlglot.executor.python", "qualname": "Python.Tokenizer", "kind": "class", "doc": "<p></p>\n", "bases": "sqlglot.tokens.Tokenizer"}, "sqlglot.executor.python.Python.Generator": {"fullname": "sqlglot.executor.python.Python.Generator", "modulename": "sqlglot.executor.python", "qualname": "Python.Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n", "bases": "sqlglot.generator.Generator"}, "sqlglot.executor.table": {"fullname": "sqlglot.executor.table", "modulename": "sqlglot.executor.table", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.executor.table.Table": {"fullname": "sqlglot.executor.table.Table", "modulename": "sqlglot.executor.table", "qualname": "Table", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.executor.table.Table.__init__": {"fullname": "sqlglot.executor.table.Table.__init__", "modulename": "sqlglot.executor.table", "qualname": "Table.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">columns</span>, </span><span class=\"param\"><span class=\"n\">rows</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">column_range</span><span class=\"o\">=</span><span class=\"kc\">None</span></span>)</span>"}, "sqlglot.executor.table.Table.add_columns": {"fullname": "sqlglot.executor.table.Table.add_columns", "modulename": "sqlglot.executor.table", "qualname": "Table.add_columns", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">columns</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.executor.table.Table.append": {"fullname": "sqlglot.executor.table.Table.append", "modulename": "sqlglot.executor.table", "qualname": "Table.append", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">row</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.table.Table.pop": {"fullname": "sqlglot.executor.table.Table.pop", "modulename": "sqlglot.executor.table", "qualname": "Table.pop", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.executor.table.TableIter": {"fullname": "sqlglot.executor.table.TableIter", "modulename": "sqlglot.executor.table", "qualname": "TableIter", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.executor.table.TableIter.__init__": {"fullname": "sqlglot.executor.table.TableIter.__init__", "modulename": "sqlglot.executor.table", "qualname": "TableIter.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">table</span></span>)</span>"}, "sqlglot.executor.table.RangeReader": {"fullname": "sqlglot.executor.table.RangeReader", "modulename": "sqlglot.executor.table", "qualname": "RangeReader", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.executor.table.RangeReader.__init__": {"fullname": "sqlglot.executor.table.RangeReader.__init__", "modulename": "sqlglot.executor.table", "qualname": "RangeReader.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">table</span></span>)</span>"}, "sqlglot.executor.table.RowReader": {"fullname": "sqlglot.executor.table.RowReader", "modulename": "sqlglot.executor.table", "qualname": "RowReader", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.executor.table.RowReader.__init__": {"fullname": "sqlglot.executor.table.RowReader.__init__", "modulename": "sqlglot.executor.table", "qualname": "RowReader.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">columns</span>, </span><span class=\"param\"><span class=\"n\">column_range</span><span class=\"o\">=</span><span class=\"kc\">None</span></span>)</span>"}, "sqlglot.executor.table.Tables": {"fullname": "sqlglot.executor.table.Tables", "modulename": "sqlglot.executor.table", "qualname": "Tables", "kind": "class", "doc": "<p>Abstract base class for generic types.</p>\n\n<p>A generic type is typically declared by inheriting from\nthis class parameterized with one or more type variables.\nFor example, a generic mapping type might be defined as::</p>\n\n<p>class Mapping(Generic[KT, VT]):\n def __getitem__(self, key: KT) -> VT:\n ...\n # Etc.</p>\n\n<p>This class can then be used as follows::</p>\n\n<p>def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:\n try:\n return mapping[key]\n except KeyError:\n return default</p>\n", "bases": "sqlglot.schema.AbstractMappingSchema[sqlglot.executor.table.Table]"}, "sqlglot.executor.table.ensure_tables": {"fullname": "sqlglot.executor.table.ensure_tables", "modulename": "sqlglot.executor.table", "qualname": "ensure_tables", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">d</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">executor</span><span class=\"o\">.</span><span class=\"n\">table</span><span class=\"o\">.</span><span class=\"n\">Tables</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions": {"fullname": "sqlglot.expressions", "modulename": "sqlglot.expressions", "kind": "module", "doc": "<h2 id=\"expressions\">Expressions</h2>\n\n<p>Every AST node in SQLGlot is represented by a subclass of <code>Expression</code>.</p>\n\n<p>This module contains the implementation of all supported <code>Expression</code> types. Additionally,\nit exposes a number of helper functions, which are mainly used to programmatically build\nSQL expressions, such as <code>sqlglot.expressions.select</code>.</p>\n\n<hr />\n"}, "sqlglot.expressions.Expression": {"fullname": "sqlglot.expressions.Expression", "modulename": "sqlglot.expressions", "qualname": "Expression", "kind": "class", "doc": "<p>The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary\ncontext, such as its child expressions, their names (arg keys), and whether a given child expression\nis optional or not.</p>\n\n<h6 id=\"attributes\">Attributes:</h6>\n\n<ul>\n<li><strong>key:</strong> a unique key for each class in the Expression hierarchy. This is useful for hashing\nand representing expressions as strings.</li>\n<li><strong>arg_types:</strong> determines what arguments (child nodes) are supported by an expression. It\nmaps arg keys to booleans that indicate whether the corresponding args are optional.</li>\n</ul>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"k\">class</span> <span class=\"nc\">Foo</span><span class=\"p\">(</span><span class=\"n\">Expression</span><span class=\"p\">):</span>\n<span class=\"gp\">... </span> <span class=\"n\">arg_types</span> <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"s2\">"this"</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">,</span> <span class=\"s2\">"expression"</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">}</span>\n</code></pre>\n </div>\n \n <p>The above definition informs us that Foo is an Expression that requires an argument called\n \"this\" and may also optionally receive an argument called \"expression\".</p>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>args:</strong> a mapping used for retrieving the arguments of an expression, given their arg keys.</li>\n<li><strong>parent:</strong> a reference to the parent expression (or None, in case of root expressions).</li>\n<li><strong>arg_key:</strong> the arg key an expression is associated with, i.e. the name its parent expression\nuses to refer to it.</li>\n<li><strong>comments:</strong> a list of comments that are associated with a given expression. This is used in\norder to preserve comments when transpiling SQL code.</li>\n<li><strong>_type:</strong> the <code>sqlglot.expressions.DataType</code> type of an expression. This is inferred by the\noptimizer, in order to enable some transformations that require type information.</li>\n</ul>\n"}, "sqlglot.expressions.Expression.__init__": {"fullname": "sqlglot.expressions.Expression.__init__", "modulename": "sqlglot.expressions", "qualname": "Expression.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">**</span><span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Any</span></span>)</span>"}, "sqlglot.expressions.Expression.this": {"fullname": "sqlglot.expressions.Expression.this", "modulename": "sqlglot.expressions", "qualname": "Expression.this", "kind": "variable", "doc": "<p>Retrieves the argument with key \"this\".</p>\n"}, "sqlglot.expressions.Expression.expression": {"fullname": "sqlglot.expressions.Expression.expression", "modulename": "sqlglot.expressions", "qualname": "Expression.expression", "kind": "variable", "doc": "<p>Retrieves the argument with key \"expression\".</p>\n"}, "sqlglot.expressions.Expression.expressions": {"fullname": "sqlglot.expressions.Expression.expressions", "modulename": "sqlglot.expressions", "qualname": "Expression.expressions", "kind": "variable", "doc": "<p>Retrieves the argument with key \"expressions\".</p>\n"}, "sqlglot.expressions.Expression.text": {"fullname": "sqlglot.expressions.Expression.text", "modulename": "sqlglot.expressions", "qualname": "Expression.text", "kind": "function", "doc": "<p>Returns a textual representation of the argument corresponding to \"key\". This can only be used\nfor args that are strings or leaf Expression instances, such as identifiers and literals.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">key</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.is_string": {"fullname": "sqlglot.expressions.Expression.is_string", "modulename": "sqlglot.expressions", "qualname": "Expression.is_string", "kind": "variable", "doc": "<p>Checks whether a Literal expression is a string.</p>\n"}, "sqlglot.expressions.Expression.is_number": {"fullname": "sqlglot.expressions.Expression.is_number", "modulename": "sqlglot.expressions", "qualname": "Expression.is_number", "kind": "variable", "doc": "<p>Checks whether a Literal expression is a number.</p>\n"}, "sqlglot.expressions.Expression.is_int": {"fullname": "sqlglot.expressions.Expression.is_int", "modulename": "sqlglot.expressions", "qualname": "Expression.is_int", "kind": "variable", "doc": "<p>Checks whether a Literal expression is an integer.</p>\n"}, "sqlglot.expressions.Expression.alias": {"fullname": "sqlglot.expressions.Expression.alias", "modulename": "sqlglot.expressions", "qualname": "Expression.alias", "kind": "variable", "doc": "<p>Returns the alias of the expression, or an empty string if it's not aliased.</p>\n"}, "sqlglot.expressions.Expression.output_name": {"fullname": "sqlglot.expressions.Expression.output_name", "modulename": "sqlglot.expressions", "qualname": "Expression.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.Expression.copy": {"fullname": "sqlglot.expressions.Expression.copy", "modulename": "sqlglot.expressions", "qualname": "Expression.copy", "kind": "function", "doc": "<p>Returns a deep copy of the expression.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.append": {"fullname": "sqlglot.expressions.Expression.append", "modulename": "sqlglot.expressions", "qualname": "Expression.append", "kind": "function", "doc": "<p>Appends value to arg_key if it's a list or sets it as a new list.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>arg_key (str):</strong> name of the list expression arg</li>\n<li><strong>value (Any):</strong> value to append to the list</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">arg_key</span>, </span><span class=\"param\"><span class=\"n\">value</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.set": {"fullname": "sqlglot.expressions.Expression.set", "modulename": "sqlglot.expressions", "qualname": "Expression.set", "kind": "function", "doc": "<p>Sets <code>arg_key</code> to <code>value</code>.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>arg_key (str):</strong> name of the expression arg.</li>\n<li><strong>value:</strong> value to set the arg to.</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">arg_key</span>, </span><span class=\"param\"><span class=\"n\">value</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.depth": {"fullname": "sqlglot.expressions.Expression.depth", "modulename": "sqlglot.expressions", "qualname": "Expression.depth", "kind": "variable", "doc": "<p>Returns the depth of this tree.</p>\n"}, "sqlglot.expressions.Expression.find": {"fullname": "sqlglot.expressions.Expression.find", "modulename": "sqlglot.expressions", "qualname": "Expression.find", "kind": "function", "doc": "<p>Returns the first node in this tree which matches at least one of\nthe specified types.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression_types (type):</strong> the expression type(s) to match.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The node which matches the criteria or None if no such node was found.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expression_types</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.find_all": {"fullname": "sqlglot.expressions.Expression.find_all", "modulename": "sqlglot.expressions", "qualname": "Expression.find_all", "kind": "function", "doc": "<p>Returns a generator object which visits all nodes in this tree and only\nyields those that match at least one of the specified expression types.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression_types (type):</strong> the expression type(s) to match.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The generator object.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expression_types</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.find_ancestor": {"fullname": "sqlglot.expressions.Expression.find_ancestor", "modulename": "sqlglot.expressions", "qualname": "Expression.find_ancestor", "kind": "function", "doc": "<p>Returns a nearest parent matching expression_types.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression_types (type):</strong> the expression type(s) to match.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The parent node.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expression_types</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.parent_select": {"fullname": "sqlglot.expressions.Expression.parent_select", "modulename": "sqlglot.expressions", "qualname": "Expression.parent_select", "kind": "variable", "doc": "<p>Returns the parent select statement.</p>\n"}, "sqlglot.expressions.Expression.walk": {"fullname": "sqlglot.expressions.Expression.walk", "modulename": "sqlglot.expressions", "qualname": "Expression.walk", "kind": "function", "doc": "<p>Returns a generator object which visits all nodes in this tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>bfs (bool):</strong> if set to True the BFS traversal order will be applied,\notherwise the DFS traversal will be used instead.</li>\n<li><strong>prune ((node, parent, arg_key) -> bool):</strong> callable that returns True if\nthe generator should stop traversing this branch of the tree.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>the generator object.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">prune</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.dfs": {"fullname": "sqlglot.expressions.Expression.dfs", "modulename": "sqlglot.expressions", "qualname": "Expression.dfs", "kind": "function", "doc": "<p>Returns a generator object which visits all nodes in this tree in\nthe DFS (Depth-first) order.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The generator object.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">parent</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">key</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">prune</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.bfs": {"fullname": "sqlglot.expressions.Expression.bfs", "modulename": "sqlglot.expressions", "qualname": "Expression.bfs", "kind": "function", "doc": "<p>Returns a generator object which visits all nodes in this tree in\nthe BFS (Breadth-first) order.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The generator object.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">prune</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.unnest": {"fullname": "sqlglot.expressions.Expression.unnest", "modulename": "sqlglot.expressions", "qualname": "Expression.unnest", "kind": "function", "doc": "<p>Returns the first non parenthesis child or self.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.unalias": {"fullname": "sqlglot.expressions.Expression.unalias", "modulename": "sqlglot.expressions", "qualname": "Expression.unalias", "kind": "function", "doc": "<p>Returns the inner expression if this is an Alias.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.unnest_operands": {"fullname": "sqlglot.expressions.Expression.unnest_operands", "modulename": "sqlglot.expressions", "qualname": "Expression.unnest_operands", "kind": "function", "doc": "<p>Returns unnested operands as a tuple.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.flatten": {"fullname": "sqlglot.expressions.Expression.flatten", "modulename": "sqlglot.expressions", "qualname": "Expression.flatten", "kind": "function", "doc": "<p>Returns a generator which yields child nodes who's parents are the same class.</p>\n\n<p>A AND B AND C -> [A, B, C]</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">unnest</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.sql": {"fullname": "sqlglot.expressions.Expression.sql", "modulename": "sqlglot.expressions", "qualname": "Expression.sql", "kind": "function", "doc": "<p>Returns SQL string representation of this tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>dialect:</strong> the dialect of the output SQL string (eg. \"spark\", \"hive\", \"presto\", \"mysql\").</li>\n<li><strong>opts:</strong> other <code>sqlglot.generator.Generator</code> options.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The SQL string.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.transform": {"fullname": "sqlglot.expressions.Expression.transform", "modulename": "sqlglot.expressions", "qualname": "Expression.transform", "kind": "function", "doc": "<p>Recursively visits all tree nodes (excluding already transformed ones)\nand applies the given transformation function to each node.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>fun (function):</strong> a function which takes a node as an argument and returns a\nnew transformed node or the same node without modifications. If the function\nreturns None, then the corresponding node will be removed from the syntax tree.</li>\n<li><strong>copy (bool):</strong> if set to True a new tree instance is constructed, otherwise the tree is\nmodified in place.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The transformed tree.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">fun</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">args</span>, </span><span class=\"param\"><span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.replace": {"fullname": "sqlglot.expressions.Expression.replace", "modulename": "sqlglot.expressions", "qualname": "Expression.replace", "kind": "function", "doc": "<p>Swap out this expression with a new expression.</p>\n\n<p>For example::</p>\n\n<pre><code>>>> tree = Select().select(\"x\").from_(\"tbl\")\n>>> tree.find(Column).replace(Column(this=\"y\"))\n(COLUMN this: y)\n>>> tree.sql()\n'SELECT y FROM tbl'\n</code></pre>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (Expression|None):</strong> new node</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The new expression or expressions.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.pop": {"fullname": "sqlglot.expressions.Expression.pop", "modulename": "sqlglot.expressions", "qualname": "Expression.pop", "kind": "function", "doc": "<p>Remove this expression from its AST.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.assert_is": {"fullname": "sqlglot.expressions.Expression.assert_is", "modulename": "sqlglot.expressions", "qualname": "Expression.assert_is", "kind": "function", "doc": "<p>Assert that this <code>Expression</code> is an instance of <code>type_</code>.</p>\n\n<p>If it is NOT an instance of <code>type_</code>, this raises an assertion error.\nOtherwise, this returns this expression.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <p>This is useful for type security in chained expressions:</p>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT x from y"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">assert_is</span><span class=\"p\">(</span><span class=\"n\">Select</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"z"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x, z FROM y'</span>\n</code></pre>\n </div>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">type_</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.error_messages": {"fullname": "sqlglot.expressions.Expression.error_messages", "modulename": "sqlglot.expressions", "qualname": "Expression.error_messages", "kind": "function", "doc": "<p>Checks if this expression is valid (e.g. all mandatory args are set).</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>args:</strong> a sequence of values that were used to instantiate a Func expression. This is used\nto check that the provided arguments don't exceed the function argument limit.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A list of error messages for all possible errors that were found.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Sequence</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.dump": {"fullname": "sqlglot.expressions.Expression.dump", "modulename": "sqlglot.expressions", "qualname": "Expression.dump", "kind": "function", "doc": "<p>Dump this Expression to a JSON-serializable dict.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Expression.load": {"fullname": "sqlglot.expressions.Expression.load", "modulename": "sqlglot.expressions", "qualname": "Expression.load", "kind": "function", "doc": "<p>Load a dict (as returned by <code>Expression.dump</code>) into an Expression instance.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">obj</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Condition": {"fullname": "sqlglot.expressions.Condition", "modulename": "sqlglot.expressions", "qualname": "Condition", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Condition.and_": {"fullname": "sqlglot.expressions.Condition.and_", "modulename": "sqlglot.expressions", "qualname": "Condition.and_", "kind": "function", "doc": "<p>AND this condition with one or multiple expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">condition</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">and_</span><span class=\"p\">(</span><span class=\"s2\">"y=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'x = 1 AND y = 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>And: the new condition.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Condition.or_": {"fullname": "sqlglot.expressions.Condition.or_", "modulename": "sqlglot.expressions", "qualname": "Condition.or_", "kind": "function", "doc": "<p>OR this condition with one or multiple expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">condition</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">or_</span><span class=\"p\">(</span><span class=\"s2\">"y=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'x = 1 OR y = 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Or: the new condition.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Condition.not_": {"fullname": "sqlglot.expressions.Condition.not_", "modulename": "sqlglot.expressions", "qualname": "Condition.not_", "kind": "function", "doc": "<p>Wrap this condition with NOT.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">condition</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">not_</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'NOT x = 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Not: the new condition.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Predicate": {"fullname": "sqlglot.expressions.Predicate", "modulename": "sqlglot.expressions", "qualname": "Predicate", "kind": "class", "doc": "<p>Relationships like x = y, x > 1, x >= y.</p>\n", "bases": "Condition"}, "sqlglot.expressions.DerivedTable": {"fullname": "sqlglot.expressions.DerivedTable", "modulename": "sqlglot.expressions", "qualname": "DerivedTable", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Unionable": {"fullname": "sqlglot.expressions.Unionable", "modulename": "sqlglot.expressions", "qualname": "Unionable", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Unionable.union": {"fullname": "sqlglot.expressions.Unionable.union", "modulename": "sqlglot.expressions", "qualname": "Unionable.union", "kind": "function", "doc": "<p>Builds a UNION expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM foo"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">union</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo UNION SELECT * FROM bla'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | Expression):</strong> the SQL code string.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Union: the Union expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Unionable.intersect": {"fullname": "sqlglot.expressions.Unionable.intersect", "modulename": "sqlglot.expressions", "qualname": "Unionable.intersect", "kind": "function", "doc": "<p>Builds an INTERSECT expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM foo"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">intersect</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | Expression):</strong> the SQL code string.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Intersect: the Intersect expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Unionable.except_": {"fullname": "sqlglot.expressions.Unionable.except_", "modulename": "sqlglot.expressions", "qualname": "Unionable.except_", "kind": "function", "doc": "<p>Builds an EXCEPT expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM foo"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">except_</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | Expression):</strong> the SQL code string.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Except: the Except expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.UDTF": {"fullname": "sqlglot.expressions.UDTF", "modulename": "sqlglot.expressions", "qualname": "UDTF", "kind": "class", "doc": "<p></p>\n", "bases": "DerivedTable, Unionable"}, "sqlglot.expressions.Cache": {"fullname": "sqlglot.expressions.Cache", "modulename": "sqlglot.expressions", "qualname": "Cache", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Uncache": {"fullname": "sqlglot.expressions.Uncache", "modulename": "sqlglot.expressions", "qualname": "Uncache", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Create": {"fullname": "sqlglot.expressions.Create", "modulename": "sqlglot.expressions", "qualname": "Create", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Describe": {"fullname": "sqlglot.expressions.Describe", "modulename": "sqlglot.expressions", "qualname": "Describe", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Set": {"fullname": "sqlglot.expressions.Set", "modulename": "sqlglot.expressions", "qualname": "Set", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.SetItem": {"fullname": "sqlglot.expressions.SetItem", "modulename": "sqlglot.expressions", "qualname": "SetItem", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Show": {"fullname": "sqlglot.expressions.Show", "modulename": "sqlglot.expressions", "qualname": "Show", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.UserDefinedFunction": {"fullname": "sqlglot.expressions.UserDefinedFunction", "modulename": "sqlglot.expressions", "qualname": "UserDefinedFunction", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.UserDefinedFunctionKwarg": {"fullname": "sqlglot.expressions.UserDefinedFunctionKwarg", "modulename": "sqlglot.expressions", "qualname": "UserDefinedFunctionKwarg", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.CharacterSet": {"fullname": "sqlglot.expressions.CharacterSet", "modulename": "sqlglot.expressions", "qualname": "CharacterSet", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.With": {"fullname": "sqlglot.expressions.With", "modulename": "sqlglot.expressions", "qualname": "With", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.WithinGroup": {"fullname": "sqlglot.expressions.WithinGroup", "modulename": "sqlglot.expressions", "qualname": "WithinGroup", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.CTE": {"fullname": "sqlglot.expressions.CTE", "modulename": "sqlglot.expressions", "qualname": "CTE", "kind": "class", "doc": "<p></p>\n", "bases": "DerivedTable"}, "sqlglot.expressions.TableAlias": {"fullname": "sqlglot.expressions.TableAlias", "modulename": "sqlglot.expressions", "qualname": "TableAlias", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.BitString": {"fullname": "sqlglot.expressions.BitString", "modulename": "sqlglot.expressions", "qualname": "BitString", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.HexString": {"fullname": "sqlglot.expressions.HexString", "modulename": "sqlglot.expressions", "qualname": "HexString", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.ByteString": {"fullname": "sqlglot.expressions.ByteString", "modulename": "sqlglot.expressions", "qualname": "ByteString", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.Column": {"fullname": "sqlglot.expressions.Column", "modulename": "sqlglot.expressions", "qualname": "Column", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.Column.output_name": {"fullname": "sqlglot.expressions.Column.output_name", "modulename": "sqlglot.expressions", "qualname": "Column.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.ColumnDef": {"fullname": "sqlglot.expressions.ColumnDef", "modulename": "sqlglot.expressions", "qualname": "ColumnDef", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.AlterColumn": {"fullname": "sqlglot.expressions.AlterColumn", "modulename": "sqlglot.expressions", "qualname": "AlterColumn", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.RenameTable": {"fullname": "sqlglot.expressions.RenameTable", "modulename": "sqlglot.expressions", "qualname": "RenameTable", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.ColumnConstraint": {"fullname": "sqlglot.expressions.ColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "ColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.ColumnConstraintKind": {"fullname": "sqlglot.expressions.ColumnConstraintKind", "modulename": "sqlglot.expressions", "qualname": "ColumnConstraintKind", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.AutoIncrementColumnConstraint": {"fullname": "sqlglot.expressions.AutoIncrementColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "AutoIncrementColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.CheckColumnConstraint": {"fullname": "sqlglot.expressions.CheckColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "CheckColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.CollateColumnConstraint": {"fullname": "sqlglot.expressions.CollateColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "CollateColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.CommentColumnConstraint": {"fullname": "sqlglot.expressions.CommentColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "CommentColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.DefaultColumnConstraint": {"fullname": "sqlglot.expressions.DefaultColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "DefaultColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.EncodeColumnConstraint": {"fullname": "sqlglot.expressions.EncodeColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "EncodeColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"fullname": "sqlglot.expressions.GeneratedAsIdentityColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "GeneratedAsIdentityColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.NotNullColumnConstraint": {"fullname": "sqlglot.expressions.NotNullColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "NotNullColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.PrimaryKeyColumnConstraint": {"fullname": "sqlglot.expressions.PrimaryKeyColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "PrimaryKeyColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.UniqueColumnConstraint": {"fullname": "sqlglot.expressions.UniqueColumnConstraint", "modulename": "sqlglot.expressions", "qualname": "UniqueColumnConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "ColumnConstraintKind"}, "sqlglot.expressions.Constraint": {"fullname": "sqlglot.expressions.Constraint", "modulename": "sqlglot.expressions", "qualname": "Constraint", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Delete": {"fullname": "sqlglot.expressions.Delete", "modulename": "sqlglot.expressions", "qualname": "Delete", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Drop": {"fullname": "sqlglot.expressions.Drop", "modulename": "sqlglot.expressions", "qualname": "Drop", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Filter": {"fullname": "sqlglot.expressions.Filter", "modulename": "sqlglot.expressions", "qualname": "Filter", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Check": {"fullname": "sqlglot.expressions.Check", "modulename": "sqlglot.expressions", "qualname": "Check", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Directory": {"fullname": "sqlglot.expressions.Directory", "modulename": "sqlglot.expressions", "qualname": "Directory", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.ForeignKey": {"fullname": "sqlglot.expressions.ForeignKey", "modulename": "sqlglot.expressions", "qualname": "ForeignKey", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.PrimaryKey": {"fullname": "sqlglot.expressions.PrimaryKey", "modulename": "sqlglot.expressions", "qualname": "PrimaryKey", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Unique": {"fullname": "sqlglot.expressions.Unique", "modulename": "sqlglot.expressions", "qualname": "Unique", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Into": {"fullname": "sqlglot.expressions.Into", "modulename": "sqlglot.expressions", "qualname": "Into", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.From": {"fullname": "sqlglot.expressions.From", "modulename": "sqlglot.expressions", "qualname": "From", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Having": {"fullname": "sqlglot.expressions.Having", "modulename": "sqlglot.expressions", "qualname": "Having", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Hint": {"fullname": "sqlglot.expressions.Hint", "modulename": "sqlglot.expressions", "qualname": "Hint", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.JoinHint": {"fullname": "sqlglot.expressions.JoinHint", "modulename": "sqlglot.expressions", "qualname": "JoinHint", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Identifier": {"fullname": "sqlglot.expressions.Identifier", "modulename": "sqlglot.expressions", "qualname": "Identifier", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Identifier.output_name": {"fullname": "sqlglot.expressions.Identifier.output_name", "modulename": "sqlglot.expressions", "qualname": "Identifier.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.Index": {"fullname": "sqlglot.expressions.Index", "modulename": "sqlglot.expressions", "qualname": "Index", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Insert": {"fullname": "sqlglot.expressions.Insert", "modulename": "sqlglot.expressions", "qualname": "Insert", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Introducer": {"fullname": "sqlglot.expressions.Introducer", "modulename": "sqlglot.expressions", "qualname": "Introducer", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.National": {"fullname": "sqlglot.expressions.National", "modulename": "sqlglot.expressions", "qualname": "National", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.LoadData": {"fullname": "sqlglot.expressions.LoadData", "modulename": "sqlglot.expressions", "qualname": "LoadData", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Partition": {"fullname": "sqlglot.expressions.Partition", "modulename": "sqlglot.expressions", "qualname": "Partition", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Fetch": {"fullname": "sqlglot.expressions.Fetch", "modulename": "sqlglot.expressions", "qualname": "Fetch", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Group": {"fullname": "sqlglot.expressions.Group", "modulename": "sqlglot.expressions", "qualname": "Group", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Lambda": {"fullname": "sqlglot.expressions.Lambda", "modulename": "sqlglot.expressions", "qualname": "Lambda", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Limit": {"fullname": "sqlglot.expressions.Limit", "modulename": "sqlglot.expressions", "qualname": "Limit", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Literal": {"fullname": "sqlglot.expressions.Literal", "modulename": "sqlglot.expressions", "qualname": "Literal", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.Literal.number": {"fullname": "sqlglot.expressions.Literal.number", "modulename": "sqlglot.expressions", "qualname": "Literal.number", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">number</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Literal</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Literal.string": {"fullname": "sqlglot.expressions.Literal.string", "modulename": "sqlglot.expressions", "qualname": "Literal.string", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">string</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Literal</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Literal.output_name": {"fullname": "sqlglot.expressions.Literal.output_name", "modulename": "sqlglot.expressions", "qualname": "Literal.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.Join": {"fullname": "sqlglot.expressions.Join", "modulename": "sqlglot.expressions", "qualname": "Join", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Join.on": {"fullname": "sqlglot.expressions.Join.on", "modulename": "sqlglot.expressions", "qualname": "Join.on", "kind": "function", "doc": "<p>Append to or set the ON expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"JOIN x"</span><span class=\"p\">,</span> <span class=\"n\">into</span><span class=\"o\">=</span><span class=\"n\">Join</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">on</span><span class=\"p\">(</span><span class=\"s2\">"y = 1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'JOIN x ON y = 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.\nMultiple expressions are combined with an AND operator.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, AND the new expressions to any existing expression.\nOtherwise, this resets the expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Join: the modified join expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Join.using": {"fullname": "sqlglot.expressions.Join.using", "modulename": "sqlglot.expressions", "qualname": "Join.using", "kind": "function", "doc": "<p>Append to or set the USING expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"JOIN x"</span><span class=\"p\">,</span> <span class=\"n\">into</span><span class=\"o\">=</span><span class=\"n\">Join</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">using</span><span class=\"p\">(</span><span class=\"s2\">"foo"</span><span class=\"p\">,</span> <span class=\"s2\">"bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'JOIN x USING (foo, bla)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, concatenate the new expressions to the existing \"using\" list.\nOtherwise, this resets the expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Join: the modified join expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Lateral": {"fullname": "sqlglot.expressions.Lateral", "modulename": "sqlglot.expressions", "qualname": "Lateral", "kind": "class", "doc": "<p></p>\n", "bases": "UDTF"}, "sqlglot.expressions.MatchRecognize": {"fullname": "sqlglot.expressions.MatchRecognize", "modulename": "sqlglot.expressions", "qualname": "MatchRecognize", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Final": {"fullname": "sqlglot.expressions.Final", "modulename": "sqlglot.expressions", "qualname": "Final", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Offset": {"fullname": "sqlglot.expressions.Offset", "modulename": "sqlglot.expressions", "qualname": "Offset", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Order": {"fullname": "sqlglot.expressions.Order", "modulename": "sqlglot.expressions", "qualname": "Order", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Cluster": {"fullname": "sqlglot.expressions.Cluster", "modulename": "sqlglot.expressions", "qualname": "Cluster", "kind": "class", "doc": "<p></p>\n", "bases": "Order"}, "sqlglot.expressions.Distribute": {"fullname": "sqlglot.expressions.Distribute", "modulename": "sqlglot.expressions", "qualname": "Distribute", "kind": "class", "doc": "<p></p>\n", "bases": "Order"}, "sqlglot.expressions.Sort": {"fullname": "sqlglot.expressions.Sort", "modulename": "sqlglot.expressions", "qualname": "Sort", "kind": "class", "doc": "<p></p>\n", "bases": "Order"}, "sqlglot.expressions.Ordered": {"fullname": "sqlglot.expressions.Ordered", "modulename": "sqlglot.expressions", "qualname": "Ordered", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Property": {"fullname": "sqlglot.expressions.Property", "modulename": "sqlglot.expressions", "qualname": "Property", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.AlgorithmProperty": {"fullname": "sqlglot.expressions.AlgorithmProperty", "modulename": "sqlglot.expressions", "qualname": "AlgorithmProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.DefinerProperty": {"fullname": "sqlglot.expressions.DefinerProperty", "modulename": "sqlglot.expressions", "qualname": "DefinerProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.SqlSecurityProperty": {"fullname": "sqlglot.expressions.SqlSecurityProperty", "modulename": "sqlglot.expressions", "qualname": "SqlSecurityProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.TableFormatProperty": {"fullname": "sqlglot.expressions.TableFormatProperty", "modulename": "sqlglot.expressions", "qualname": "TableFormatProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.PartitionedByProperty": {"fullname": "sqlglot.expressions.PartitionedByProperty", "modulename": "sqlglot.expressions", "qualname": "PartitionedByProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.FileFormatProperty": {"fullname": "sqlglot.expressions.FileFormatProperty", "modulename": "sqlglot.expressions", "qualname": "FileFormatProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.DistKeyProperty": {"fullname": "sqlglot.expressions.DistKeyProperty", "modulename": "sqlglot.expressions", "qualname": "DistKeyProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.SortKeyProperty": {"fullname": "sqlglot.expressions.SortKeyProperty", "modulename": "sqlglot.expressions", "qualname": "SortKeyProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.DistStyleProperty": {"fullname": "sqlglot.expressions.DistStyleProperty", "modulename": "sqlglot.expressions", "qualname": "DistStyleProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.LikeProperty": {"fullname": "sqlglot.expressions.LikeProperty", "modulename": "sqlglot.expressions", "qualname": "LikeProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.LocationProperty": {"fullname": "sqlglot.expressions.LocationProperty", "modulename": "sqlglot.expressions", "qualname": "LocationProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.EngineProperty": {"fullname": "sqlglot.expressions.EngineProperty", "modulename": "sqlglot.expressions", "qualname": "EngineProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.AutoIncrementProperty": {"fullname": "sqlglot.expressions.AutoIncrementProperty", "modulename": "sqlglot.expressions", "qualname": "AutoIncrementProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.CharacterSetProperty": {"fullname": "sqlglot.expressions.CharacterSetProperty", "modulename": "sqlglot.expressions", "qualname": "CharacterSetProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.CollateProperty": {"fullname": "sqlglot.expressions.CollateProperty", "modulename": "sqlglot.expressions", "qualname": "CollateProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.SchemaCommentProperty": {"fullname": "sqlglot.expressions.SchemaCommentProperty", "modulename": "sqlglot.expressions", "qualname": "SchemaCommentProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.ReturnsProperty": {"fullname": "sqlglot.expressions.ReturnsProperty", "modulename": "sqlglot.expressions", "qualname": "ReturnsProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.LanguageProperty": {"fullname": "sqlglot.expressions.LanguageProperty", "modulename": "sqlglot.expressions", "qualname": "LanguageProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.ExecuteAsProperty": {"fullname": "sqlglot.expressions.ExecuteAsProperty", "modulename": "sqlglot.expressions", "qualname": "ExecuteAsProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.VolatilityProperty": {"fullname": "sqlglot.expressions.VolatilityProperty", "modulename": "sqlglot.expressions", "qualname": "VolatilityProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.RowFormatDelimitedProperty": {"fullname": "sqlglot.expressions.RowFormatDelimitedProperty", "modulename": "sqlglot.expressions", "qualname": "RowFormatDelimitedProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.RowFormatSerdeProperty": {"fullname": "sqlglot.expressions.RowFormatSerdeProperty", "modulename": "sqlglot.expressions", "qualname": "RowFormatSerdeProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.SerdeProperties": {"fullname": "sqlglot.expressions.SerdeProperties", "modulename": "sqlglot.expressions", "qualname": "SerdeProperties", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.FallbackProperty": {"fullname": "sqlglot.expressions.FallbackProperty", "modulename": "sqlglot.expressions", "qualname": "FallbackProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.WithJournalTableProperty": {"fullname": "sqlglot.expressions.WithJournalTableProperty", "modulename": "sqlglot.expressions", "qualname": "WithJournalTableProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.LogProperty": {"fullname": "sqlglot.expressions.LogProperty", "modulename": "sqlglot.expressions", "qualname": "LogProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.JournalProperty": {"fullname": "sqlglot.expressions.JournalProperty", "modulename": "sqlglot.expressions", "qualname": "JournalProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.AfterJournalProperty": {"fullname": "sqlglot.expressions.AfterJournalProperty", "modulename": "sqlglot.expressions", "qualname": "AfterJournalProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.ChecksumProperty": {"fullname": "sqlglot.expressions.ChecksumProperty", "modulename": "sqlglot.expressions", "qualname": "ChecksumProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.FreespaceProperty": {"fullname": "sqlglot.expressions.FreespaceProperty", "modulename": "sqlglot.expressions", "qualname": "FreespaceProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.MergeBlockRatioProperty": {"fullname": "sqlglot.expressions.MergeBlockRatioProperty", "modulename": "sqlglot.expressions", "qualname": "MergeBlockRatioProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.DataBlocksizeProperty": {"fullname": "sqlglot.expressions.DataBlocksizeProperty", "modulename": "sqlglot.expressions", "qualname": "DataBlocksizeProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.BlockCompressionProperty": {"fullname": "sqlglot.expressions.BlockCompressionProperty", "modulename": "sqlglot.expressions", "qualname": "BlockCompressionProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.IsolatedLoadingProperty": {"fullname": "sqlglot.expressions.IsolatedLoadingProperty", "modulename": "sqlglot.expressions", "qualname": "IsolatedLoadingProperty", "kind": "class", "doc": "<p></p>\n", "bases": "Property"}, "sqlglot.expressions.Properties": {"fullname": "sqlglot.expressions.Properties", "modulename": "sqlglot.expressions", "qualname": "Properties", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Properties.Location": {"fullname": "sqlglot.expressions.Properties.Location", "modulename": "sqlglot.expressions", "qualname": "Properties.Location", "kind": "class", "doc": "<p>An enumeration.</p>\n", "bases": "sqlglot.helper.AutoName"}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"fullname": "sqlglot.expressions.Properties.Location.POST_CREATE", "modulename": "sqlglot.expressions", "qualname": "Properties.Location.POST_CREATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Location.POST_CREATE: 'POST_CREATE'>"}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"fullname": "sqlglot.expressions.Properties.Location.PRE_SCHEMA", "modulename": "sqlglot.expressions", "qualname": "Properties.Location.PRE_SCHEMA", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Location.PRE_SCHEMA: 'PRE_SCHEMA'>"}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"fullname": "sqlglot.expressions.Properties.Location.POST_INDEX", "modulename": "sqlglot.expressions", "qualname": "Properties.Location.POST_INDEX", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Location.POST_INDEX: 'POST_INDEX'>"}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"fullname": "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT", "modulename": "sqlglot.expressions", "qualname": "Properties.Location.POST_SCHEMA_ROOT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Location.POST_SCHEMA_ROOT: 'POST_SCHEMA_ROOT'>"}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"fullname": "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH", "modulename": "sqlglot.expressions", "qualname": "Properties.Location.POST_SCHEMA_WITH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Location.POST_SCHEMA_WITH: 'POST_SCHEMA_WITH'>"}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"fullname": "sqlglot.expressions.Properties.Location.UNSUPPORTED", "modulename": "sqlglot.expressions", "qualname": "Properties.Location.UNSUPPORTED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Location.UNSUPPORTED: 'UNSUPPORTED'>"}, "sqlglot.expressions.Properties.from_dict": {"fullname": "sqlglot.expressions.Properties.from_dict", "modulename": "sqlglot.expressions", "qualname": "Properties.from_dict", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">properties_dict</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Qualify": {"fullname": "sqlglot.expressions.Qualify", "modulename": "sqlglot.expressions", "qualname": "Qualify", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Return": {"fullname": "sqlglot.expressions.Return", "modulename": "sqlglot.expressions", "qualname": "Return", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Reference": {"fullname": "sqlglot.expressions.Reference", "modulename": "sqlglot.expressions", "qualname": "Reference", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Tuple": {"fullname": "sqlglot.expressions.Tuple", "modulename": "sqlglot.expressions", "qualname": "Tuple", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Subqueryable": {"fullname": "sqlglot.expressions.Subqueryable", "modulename": "sqlglot.expressions", "qualname": "Subqueryable", "kind": "class", "doc": "<p></p>\n", "bases": "Unionable"}, "sqlglot.expressions.Subqueryable.subquery": {"fullname": "sqlglot.expressions.Subqueryable.subquery", "modulename": "sqlglot.expressions", "qualname": "Subqueryable.subquery", "kind": "function", "doc": "<p>Convert this expression to an aliased expression that can be used as a Subquery.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">subquery</span> <span class=\"o\">=</span> <span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">subquery</span><span class=\"p\">()</span>\n<span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"n\">subquery</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM (SELECT x FROM tbl)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>alias (str | Identifier):</strong> an optional alias for the subquery</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Alias: the subquery</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">alias</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Subquery</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Subqueryable.limit": {"fullname": "sqlglot.expressions.Subqueryable.limit", "modulename": "sqlglot.expressions", "qualname": "Subqueryable.limit", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Subqueryable.with_": {"fullname": "sqlglot.expressions.Subqueryable.with_", "modulename": "sqlglot.expressions", "qualname": "Subqueryable.with_", "kind": "function", "doc": "<p>Append to or set the common table expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">with_</span><span class=\"p\">(</span><span class=\"s2\">"tbl2"</span><span class=\"p\">,</span> <span class=\"n\">as_</span><span class=\"o\">=</span><span class=\"s2\">"SELECT * FROM tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>alias (str | Expression):</strong> the SQL code string to parse as the table name.\nIf an <code>Expression</code> instance is passed, this is used as-is.</li>\n<li><strong>as_ (str | Expression):</strong> the SQL code string to parse as the table expression.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>recursive (bool):</strong> set the RECURSIVE part of the expression. Defaults to <code>False</code>.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this resets the expressions.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">alias</span>,</span><span class=\"param\">\t<span class=\"n\">as_</span>,</span><span class=\"param\">\t<span class=\"n\">recursive</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Table": {"fullname": "sqlglot.expressions.Table", "modulename": "sqlglot.expressions", "qualname": "Table", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.SystemTime": {"fullname": "sqlglot.expressions.SystemTime", "modulename": "sqlglot.expressions", "qualname": "SystemTime", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Union": {"fullname": "sqlglot.expressions.Union", "modulename": "sqlglot.expressions", "qualname": "Union", "kind": "class", "doc": "<p></p>\n", "bases": "Subqueryable"}, "sqlglot.expressions.Union.limit": {"fullname": "sqlglot.expressions.Union.limit", "modulename": "sqlglot.expressions", "qualname": "Union.limit", "kind": "function", "doc": "<p>Set the LIMIT expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">union</span><span class=\"p\">(</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"1"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">limit</span><span class=\"p\">(</span><span class=\"mi\">1</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM (SELECT 1 UNION SELECT 1) AS _l_0 LIMIT 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | int | Expression):</strong> the SQL code string to parse.\nThis can also be an integer.\nIf a <code>Limit</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>Limit</code>.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: The limited subqueryable.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Except": {"fullname": "sqlglot.expressions.Except", "modulename": "sqlglot.expressions", "qualname": "Except", "kind": "class", "doc": "<p></p>\n", "bases": "Union"}, "sqlglot.expressions.Intersect": {"fullname": "sqlglot.expressions.Intersect", "modulename": "sqlglot.expressions", "qualname": "Intersect", "kind": "class", "doc": "<p></p>\n", "bases": "Union"}, "sqlglot.expressions.Unnest": {"fullname": "sqlglot.expressions.Unnest", "modulename": "sqlglot.expressions", "qualname": "Unnest", "kind": "class", "doc": "<p></p>\n", "bases": "UDTF"}, "sqlglot.expressions.Update": {"fullname": "sqlglot.expressions.Update", "modulename": "sqlglot.expressions", "qualname": "Update", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Values": {"fullname": "sqlglot.expressions.Values", "modulename": "sqlglot.expressions", "qualname": "Values", "kind": "class", "doc": "<p></p>\n", "bases": "UDTF"}, "sqlglot.expressions.Var": {"fullname": "sqlglot.expressions.Var", "modulename": "sqlglot.expressions", "qualname": "Var", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Schema": {"fullname": "sqlglot.expressions.Schema", "modulename": "sqlglot.expressions", "qualname": "Schema", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Lock": {"fullname": "sqlglot.expressions.Lock", "modulename": "sqlglot.expressions", "qualname": "Lock", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Select": {"fullname": "sqlglot.expressions.Select", "modulename": "sqlglot.expressions", "qualname": "Select", "kind": "class", "doc": "<p></p>\n", "bases": "Subqueryable"}, "sqlglot.expressions.Select.from_": {"fullname": "sqlglot.expressions.Select.from_", "modulename": "sqlglot.expressions", "qualname": "Select.from_", "kind": "function", "doc": "<p>Set the FROM expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf a <code>From</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>From</code>.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this flattens all the <code>From</code> expression into a single expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.group_by": {"fullname": "sqlglot.expressions.Select.group_by", "modulename": "sqlglot.expressions", "qualname": "Select.group_by", "kind": "function", "doc": "<p>Set the GROUP BY expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">,</span> <span class=\"s2\">"COUNT(1)"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">group_by</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x, COUNT(1) FROM tbl GROUP BY x'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf a <code>Group</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>Group</code>.\nIf nothing is passed in then a group by is not applied to the expression</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this flattens all the <code>Group</code> expression into a single expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.order_by": {"fullname": "sqlglot.expressions.Select.order_by", "modulename": "sqlglot.expressions", "qualname": "Select.order_by", "kind": "function", "doc": "<p>Set the ORDER BY expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">order_by</span><span class=\"p\">(</span><span class=\"s2\">"x DESC"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl ORDER BY x DESC'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf a <code>Group</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>Order</code>.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this flattens all the <code>Order</code> expression into a single expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.sort_by": {"fullname": "sqlglot.expressions.Select.sort_by", "modulename": "sqlglot.expressions", "qualname": "Select.sort_by", "kind": "function", "doc": "<p>Set the SORT BY expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sort_by</span><span class=\"p\">(</span><span class=\"s2\">"x DESC"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl SORT BY x DESC'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf a <code>Group</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>SORT</code>.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this flattens all the <code>Order</code> expression into a single expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.cluster_by": {"fullname": "sqlglot.expressions.Select.cluster_by", "modulename": "sqlglot.expressions", "qualname": "Select.cluster_by", "kind": "function", "doc": "<p>Set the CLUSTER BY expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">cluster_by</span><span class=\"p\">(</span><span class=\"s2\">"x DESC"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl CLUSTER BY x DESC'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf a <code>Group</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>Cluster</code>.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this flattens all the <code>Order</code> expression into a single expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.limit": {"fullname": "sqlglot.expressions.Select.limit", "modulename": "sqlglot.expressions", "qualname": "Select.limit", "kind": "function", "doc": "<p>Set the LIMIT expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">limit</span><span class=\"p\">(</span><span class=\"mi\">10</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl LIMIT 10'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | int | Expression):</strong> the SQL code string to parse.\nThis can also be an integer.\nIf a <code>Limit</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>Limit</code>.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.offset": {"fullname": "sqlglot.expressions.Select.offset", "modulename": "sqlglot.expressions", "qualname": "Select.offset", "kind": "function", "doc": "<p>Set the OFFSET expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">offset</span><span class=\"p\">(</span><span class=\"mi\">10</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl OFFSET 10'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | int | Expression):</strong> the SQL code string to parse.\nThis can also be an integer.\nIf a <code>Offset</code> instance is passed, this is used as-is.\nIf another <code>Expression</code> instance is passed, it will be wrapped in a <code>Offset</code>.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.select": {"fullname": "sqlglot.expressions.Select.select", "modulename": "sqlglot.expressions", "qualname": "Select.select", "kind": "function", "doc": "<p>Append to or set the SELECT expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">,</span> <span class=\"s2\">"y"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x, y'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this resets the expressions.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.lateral": {"fullname": "sqlglot.expressions.Select.lateral", "modulename": "sqlglot.expressions", "qualname": "Select.lateral", "kind": "function", "doc": "<p>Append to or set the LATERAL expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">lateral</span><span class=\"p\">(</span><span class=\"s2\">"OUTER explode(y) tbl2 AS z"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this resets the expressions.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.join": {"fullname": "sqlglot.expressions.Select.join", "modulename": "sqlglot.expressions", "qualname": "Select.join", "kind": "function", "doc": "<p>Append to or set the JOIN expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"*"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">join</span><span class=\"p\">(</span><span class=\"s2\">"tbl2"</span><span class=\"p\">,</span> <span class=\"n\">on</span><span class=\"o\">=</span><span class=\"s2\">"tbl1.y = tbl2.y"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y'</span>\n</code></pre>\n </div>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">join</span><span class=\"p\">(</span><span class=\"s2\">"b"</span><span class=\"p\">,</span> <span class=\"n\">using</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s2\">"x"</span><span class=\"p\">,</span> <span class=\"s2\">"y"</span><span class=\"p\">,</span> <span class=\"s2\">"z"</span><span class=\"p\">])</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT 1 FROM a JOIN b USING (x, y, z)'</span>\n</code></pre>\n </div>\n \n <p>Use <code>join_type</code> to change the type of join:</p>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"*"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">join</span><span class=\"p\">(</span><span class=\"s2\">"tbl2"</span><span class=\"p\">,</span> <span class=\"n\">on</span><span class=\"o\">=</span><span class=\"s2\">"tbl1.y = tbl2.y"</span><span class=\"p\">,</span> <span class=\"n\">join_type</span><span class=\"o\">=</span><span class=\"s2\">"left outer"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | Expression):</strong> the SQL code string to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>on (str | Expression):</strong> optionally specify the join \"on\" criteria as a SQL string.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>using (str | Expression):</strong> optionally specify the join \"using\" criteria as a SQL string.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions.\nOtherwise, this resets the expressions.</li>\n<li><strong>join_type (str):</strong> If set, alter the parsed join type</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">on</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">using</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">join_type</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">join_alias</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.where": {"fullname": "sqlglot.expressions.Select.where", "modulename": "sqlglot.expressions", "qualname": "Select.where", "kind": "function", "doc": "<p>Append to or set the WHERE expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">where</span><span class=\"p\">(</span><span class=\"s2\">"x = 'a' OR x < 'b'"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">"SELECT x FROM tbl WHERE x = 'a' OR x < 'b'"</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.\nMultiple expressions are combined with an AND operator.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, AND the new expressions to any existing expression.\nOtherwise, this resets the expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.having": {"fullname": "sqlglot.expressions.Select.having", "modulename": "sqlglot.expressions", "qualname": "Select.having", "kind": "function", "doc": "<p>Append to or set the HAVING expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">,</span> <span class=\"s2\">"COUNT(y)"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">group_by</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">having</span><span class=\"p\">(</span><span class=\"s2\">"COUNT(y) > 3"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an <code>Expression</code> instance is passed, it will be used as-is.\nMultiple expressions are combined with an AND operator.</li>\n<li><strong>append (bool):</strong> if <code>True</code>, AND the new expressions to any existing expression.\nOtherwise, this resets the expression.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.window": {"fullname": "sqlglot.expressions.Select.window", "modulename": "sqlglot.expressions", "qualname": "Select.window", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">expressions</span>,</span><span class=\"param\">\t<span class=\"n\">append</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.distinct": {"fullname": "sqlglot.expressions.Select.distinct", "modulename": "sqlglot.expressions", "qualname": "Select.distinct", "kind": "function", "doc": "<p>Set the OFFSET expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">distinct</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT DISTINCT x FROM tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>distinct (bool):</strong> whether the Select should be distinct</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.ctas": {"fullname": "sqlglot.expressions.Select.ctas", "modulename": "sqlglot.expressions", "qualname": "Select.ctas", "kind": "function", "doc": "<p>Convert this expression to a CREATE TABLE AS statement.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"*"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">ctas</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'CREATE TABLE x AS SELECT * FROM tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table (str | Expression):</strong> the SQL code string to parse as the table name.\nIf another <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>properties (dict):</strong> an optional mapping of table properties</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input table.</li>\n<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input table.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Create: the CREATE TABLE AS expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span>,</span><span class=\"param\">\t<span class=\"n\">properties</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Create</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Select.lock": {"fullname": "sqlglot.expressions.Select.lock", "modulename": "sqlglot.expressions", "qualname": "Select.lock", "kind": "function", "doc": "<p>Set the locking read mode for this expression.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">where</span><span class=\"p\">(</span><span class=\"s2\">"x = 'a'"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">lock</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"s2\">"mysql"</span><span class=\"p\">)</span>\n<span class=\"go\">"SELECT x FROM tbl WHERE x = 'a' FOR UPDATE"</span>\n</code></pre>\n </div>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">where</span><span class=\"p\">(</span><span class=\"s2\">"x = 'a'"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">lock</span><span class=\"p\">(</span><span class=\"n\">update</span><span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(</span><span class=\"s2\">"mysql"</span><span class=\"p\">)</span>\n<span class=\"go\">"SELECT x FROM tbl WHERE x = 'a' FOR SHARE"</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>update:</strong> if <code>True</code>, the locking type will be <code>FOR UPDATE</code>, else it will be <code>FOR SHARE</code>.</li>\n<li><strong>copy:</strong> if <code>False</code>, modify this expression instance in-place.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The modified expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">update</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Subquery": {"fullname": "sqlglot.expressions.Subquery", "modulename": "sqlglot.expressions", "qualname": "Subquery", "kind": "class", "doc": "<p></p>\n", "bases": "DerivedTable, Unionable"}, "sqlglot.expressions.Subquery.unnest": {"fullname": "sqlglot.expressions.Subquery.unnest", "modulename": "sqlglot.expressions", "qualname": "Subquery.unnest", "kind": "function", "doc": "<p>Returns the first non subquery.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Subquery.output_name": {"fullname": "sqlglot.expressions.Subquery.output_name", "modulename": "sqlglot.expressions", "qualname": "Subquery.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.TableSample": {"fullname": "sqlglot.expressions.TableSample", "modulename": "sqlglot.expressions", "qualname": "TableSample", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Tag": {"fullname": "sqlglot.expressions.Tag", "modulename": "sqlglot.expressions", "qualname": "Tag", "kind": "class", "doc": "<p>Tags are used for generating arbitrary sql like SELECT <span>x</span>.</p>\n", "bases": "Expression"}, "sqlglot.expressions.Pivot": {"fullname": "sqlglot.expressions.Pivot", "modulename": "sqlglot.expressions", "qualname": "Pivot", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Window": {"fullname": "sqlglot.expressions.Window", "modulename": "sqlglot.expressions", "qualname": "Window", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.WindowSpec": {"fullname": "sqlglot.expressions.WindowSpec", "modulename": "sqlglot.expressions", "qualname": "WindowSpec", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Where": {"fullname": "sqlglot.expressions.Where", "modulename": "sqlglot.expressions", "qualname": "Where", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Star": {"fullname": "sqlglot.expressions.Star", "modulename": "sqlglot.expressions", "qualname": "Star", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Star.output_name": {"fullname": "sqlglot.expressions.Star.output_name", "modulename": "sqlglot.expressions", "qualname": "Star.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.Parameter": {"fullname": "sqlglot.expressions.Parameter", "modulename": "sqlglot.expressions", "qualname": "Parameter", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.SessionParameter": {"fullname": "sqlglot.expressions.SessionParameter", "modulename": "sqlglot.expressions", "qualname": "SessionParameter", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Placeholder": {"fullname": "sqlglot.expressions.Placeholder", "modulename": "sqlglot.expressions", "qualname": "Placeholder", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Null": {"fullname": "sqlglot.expressions.Null", "modulename": "sqlglot.expressions", "qualname": "Null", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.Boolean": {"fullname": "sqlglot.expressions.Boolean", "modulename": "sqlglot.expressions", "qualname": "Boolean", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.DataType": {"fullname": "sqlglot.expressions.DataType", "modulename": "sqlglot.expressions", "qualname": "DataType", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.DataType.Type": {"fullname": "sqlglot.expressions.DataType.Type", "modulename": "sqlglot.expressions", "qualname": "DataType.Type", "kind": "class", "doc": "<p>An enumeration.</p>\n", "bases": "sqlglot.helper.AutoName"}, "sqlglot.expressions.DataType.Type.CHAR": {"fullname": "sqlglot.expressions.DataType.Type.CHAR", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.CHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.CHAR: 'CHAR'>"}, "sqlglot.expressions.DataType.Type.NCHAR": {"fullname": "sqlglot.expressions.DataType.Type.NCHAR", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.NCHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.NCHAR: 'NCHAR'>"}, "sqlglot.expressions.DataType.Type.VARCHAR": {"fullname": "sqlglot.expressions.DataType.Type.VARCHAR", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.VARCHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.VARCHAR: 'VARCHAR'>"}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"fullname": "sqlglot.expressions.DataType.Type.NVARCHAR", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.NVARCHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.NVARCHAR: 'NVARCHAR'>"}, "sqlglot.expressions.DataType.Type.TEXT": {"fullname": "sqlglot.expressions.DataType.Type.TEXT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.TEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.TEXT: 'TEXT'>"}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"fullname": "sqlglot.expressions.DataType.Type.MEDIUMTEXT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.MEDIUMTEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.MEDIUMTEXT: 'MEDIUMTEXT'>"}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"fullname": "sqlglot.expressions.DataType.Type.LONGTEXT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.LONGTEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.LONGTEXT: 'LONGTEXT'>"}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"fullname": "sqlglot.expressions.DataType.Type.MEDIUMBLOB", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.MEDIUMBLOB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.MEDIUMBLOB: 'MEDIUMBLOB'>"}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"fullname": "sqlglot.expressions.DataType.Type.LONGBLOB", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.LONGBLOB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.LONGBLOB: 'LONGBLOB'>"}, "sqlglot.expressions.DataType.Type.BINARY": {"fullname": "sqlglot.expressions.DataType.Type.BINARY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.BINARY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.BINARY: 'BINARY'>"}, "sqlglot.expressions.DataType.Type.VARBINARY": {"fullname": "sqlglot.expressions.DataType.Type.VARBINARY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.VARBINARY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.VARBINARY: 'VARBINARY'>"}, "sqlglot.expressions.DataType.Type.INT": {"fullname": "sqlglot.expressions.DataType.Type.INT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.INT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.INT: 'INT'>"}, "sqlglot.expressions.DataType.Type.TINYINT": {"fullname": "sqlglot.expressions.DataType.Type.TINYINT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.TINYINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.TINYINT: 'TINYINT'>"}, "sqlglot.expressions.DataType.Type.SMALLINT": {"fullname": "sqlglot.expressions.DataType.Type.SMALLINT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.SMALLINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.SMALLINT: 'SMALLINT'>"}, "sqlglot.expressions.DataType.Type.BIGINT": {"fullname": "sqlglot.expressions.DataType.Type.BIGINT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.BIGINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.BIGINT: 'BIGINT'>"}, "sqlglot.expressions.DataType.Type.FLOAT": {"fullname": "sqlglot.expressions.DataType.Type.FLOAT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.FLOAT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.FLOAT: 'FLOAT'>"}, "sqlglot.expressions.DataType.Type.DOUBLE": {"fullname": "sqlglot.expressions.DataType.Type.DOUBLE", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.DOUBLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.DOUBLE: 'DOUBLE'>"}, "sqlglot.expressions.DataType.Type.DECIMAL": {"fullname": "sqlglot.expressions.DataType.Type.DECIMAL", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.DECIMAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.DECIMAL: 'DECIMAL'>"}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"fullname": "sqlglot.expressions.DataType.Type.BOOLEAN", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.BOOLEAN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.BOOLEAN: 'BOOLEAN'>"}, "sqlglot.expressions.DataType.Type.JSON": {"fullname": "sqlglot.expressions.DataType.Type.JSON", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.JSON", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.JSON: 'JSON'>"}, "sqlglot.expressions.DataType.Type.JSONB": {"fullname": "sqlglot.expressions.DataType.Type.JSONB", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.JSONB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.JSONB: 'JSONB'>"}, "sqlglot.expressions.DataType.Type.INTERVAL": {"fullname": "sqlglot.expressions.DataType.Type.INTERVAL", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.INTERVAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.INTERVAL: 'INTERVAL'>"}, "sqlglot.expressions.DataType.Type.TIME": {"fullname": "sqlglot.expressions.DataType.Type.TIME", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.TIME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.TIME: 'TIME'>"}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"fullname": "sqlglot.expressions.DataType.Type.TIMESTAMP", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.TIMESTAMP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.TIMESTAMP: 'TIMESTAMP'>"}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"fullname": "sqlglot.expressions.DataType.Type.TIMESTAMPTZ", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.TIMESTAMPTZ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'>"}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"fullname": "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.TIMESTAMPLTZ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>"}, "sqlglot.expressions.DataType.Type.DATE": {"fullname": "sqlglot.expressions.DataType.Type.DATE", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.DATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.DATE: 'DATE'>"}, "sqlglot.expressions.DataType.Type.DATETIME": {"fullname": "sqlglot.expressions.DataType.Type.DATETIME", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.DATETIME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.DATETIME: 'DATETIME'>"}, "sqlglot.expressions.DataType.Type.ARRAY": {"fullname": "sqlglot.expressions.DataType.Type.ARRAY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.ARRAY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.ARRAY: 'ARRAY'>"}, "sqlglot.expressions.DataType.Type.MAP": {"fullname": "sqlglot.expressions.DataType.Type.MAP", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.MAP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.MAP: 'MAP'>"}, "sqlglot.expressions.DataType.Type.UUID": {"fullname": "sqlglot.expressions.DataType.Type.UUID", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.UUID", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.UUID: 'UUID'>"}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"fullname": "sqlglot.expressions.DataType.Type.GEOGRAPHY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.GEOGRAPHY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.GEOGRAPHY: 'GEOGRAPHY'>"}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"fullname": "sqlglot.expressions.DataType.Type.GEOMETRY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.GEOMETRY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.GEOMETRY: 'GEOMETRY'>"}, "sqlglot.expressions.DataType.Type.STRUCT": {"fullname": "sqlglot.expressions.DataType.Type.STRUCT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.STRUCT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.STRUCT: 'STRUCT'>"}, "sqlglot.expressions.DataType.Type.NULLABLE": {"fullname": "sqlglot.expressions.DataType.Type.NULLABLE", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.NULLABLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.NULLABLE: 'NULLABLE'>"}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"fullname": "sqlglot.expressions.DataType.Type.HLLSKETCH", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.HLLSKETCH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.HLLSKETCH: 'HLLSKETCH'>"}, "sqlglot.expressions.DataType.Type.HSTORE": {"fullname": "sqlglot.expressions.DataType.Type.HSTORE", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.HSTORE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.HSTORE: 'HSTORE'>"}, "sqlglot.expressions.DataType.Type.SUPER": {"fullname": "sqlglot.expressions.DataType.Type.SUPER", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.SUPER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.SUPER: 'SUPER'>"}, "sqlglot.expressions.DataType.Type.SERIAL": {"fullname": "sqlglot.expressions.DataType.Type.SERIAL", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.SERIAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.SERIAL: 'SERIAL'>"}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"fullname": "sqlglot.expressions.DataType.Type.SMALLSERIAL", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.SMALLSERIAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.SMALLSERIAL: 'SMALLSERIAL'>"}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"fullname": "sqlglot.expressions.DataType.Type.BIGSERIAL", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.BIGSERIAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.BIGSERIAL: 'BIGSERIAL'>"}, "sqlglot.expressions.DataType.Type.XML": {"fullname": "sqlglot.expressions.DataType.Type.XML", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.XML", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.XML: 'XML'>"}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"fullname": "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.UNIQUEIDENTIFIER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>"}, "sqlglot.expressions.DataType.Type.MONEY": {"fullname": "sqlglot.expressions.DataType.Type.MONEY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.MONEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.MONEY: 'MONEY'>"}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"fullname": "sqlglot.expressions.DataType.Type.SMALLMONEY", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.SMALLMONEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.SMALLMONEY: 'SMALLMONEY'>"}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"fullname": "sqlglot.expressions.DataType.Type.ROWVERSION", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.ROWVERSION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.ROWVERSION: 'ROWVERSION'>"}, "sqlglot.expressions.DataType.Type.IMAGE": {"fullname": "sqlglot.expressions.DataType.Type.IMAGE", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.IMAGE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.IMAGE: 'IMAGE'>"}, "sqlglot.expressions.DataType.Type.VARIANT": {"fullname": "sqlglot.expressions.DataType.Type.VARIANT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.VARIANT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.VARIANT: 'VARIANT'>"}, "sqlglot.expressions.DataType.Type.OBJECT": {"fullname": "sqlglot.expressions.DataType.Type.OBJECT", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.OBJECT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.OBJECT: 'OBJECT'>"}, "sqlglot.expressions.DataType.Type.NULL": {"fullname": "sqlglot.expressions.DataType.Type.NULL", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.NULL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.NULL: 'NULL'>"}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"fullname": "sqlglot.expressions.DataType.Type.UNKNOWN", "modulename": "sqlglot.expressions", "qualname": "DataType.Type.UNKNOWN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <Type.UNKNOWN: 'UNKNOWN'>"}, "sqlglot.expressions.DataType.build": {"fullname": "sqlglot.expressions.DataType.build", "modulename": "sqlglot.expressions", "qualname": "DataType.build", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">dtype</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.DataType.is_type": {"fullname": "sqlglot.expressions.DataType.is_type", "modulename": "sqlglot.expressions", "qualname": "DataType.is_type", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">dtype</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">bool</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.PseudoType": {"fullname": "sqlglot.expressions.PseudoType", "modulename": "sqlglot.expressions", "qualname": "PseudoType", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.StructKwarg": {"fullname": "sqlglot.expressions.StructKwarg", "modulename": "sqlglot.expressions", "qualname": "StructKwarg", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.SubqueryPredicate": {"fullname": "sqlglot.expressions.SubqueryPredicate", "modulename": "sqlglot.expressions", "qualname": "SubqueryPredicate", "kind": "class", "doc": "<p></p>\n", "bases": "Predicate"}, "sqlglot.expressions.All": {"fullname": "sqlglot.expressions.All", "modulename": "sqlglot.expressions", "qualname": "All", "kind": "class", "doc": "<p></p>\n", "bases": "SubqueryPredicate"}, "sqlglot.expressions.Any": {"fullname": "sqlglot.expressions.Any", "modulename": "sqlglot.expressions", "qualname": "Any", "kind": "class", "doc": "<p></p>\n", "bases": "SubqueryPredicate"}, "sqlglot.expressions.Exists": {"fullname": "sqlglot.expressions.Exists", "modulename": "sqlglot.expressions", "qualname": "Exists", "kind": "class", "doc": "<p></p>\n", "bases": "SubqueryPredicate"}, "sqlglot.expressions.Command": {"fullname": "sqlglot.expressions.Command", "modulename": "sqlglot.expressions", "qualname": "Command", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Transaction": {"fullname": "sqlglot.expressions.Transaction", "modulename": "sqlglot.expressions", "qualname": "Transaction", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Commit": {"fullname": "sqlglot.expressions.Commit", "modulename": "sqlglot.expressions", "qualname": "Commit", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Rollback": {"fullname": "sqlglot.expressions.Rollback", "modulename": "sqlglot.expressions", "qualname": "Rollback", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.AlterTable": {"fullname": "sqlglot.expressions.AlterTable", "modulename": "sqlglot.expressions", "qualname": "AlterTable", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.AddConstraint": {"fullname": "sqlglot.expressions.AddConstraint", "modulename": "sqlglot.expressions", "qualname": "AddConstraint", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.DropPartition": {"fullname": "sqlglot.expressions.DropPartition", "modulename": "sqlglot.expressions", "qualname": "DropPartition", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Binary": {"fullname": "sqlglot.expressions.Binary", "modulename": "sqlglot.expressions", "qualname": "Binary", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Add": {"fullname": "sqlglot.expressions.Add", "modulename": "sqlglot.expressions", "qualname": "Add", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Connector": {"fullname": "sqlglot.expressions.Connector", "modulename": "sqlglot.expressions", "qualname": "Connector", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Condition"}, "sqlglot.expressions.And": {"fullname": "sqlglot.expressions.And", "modulename": "sqlglot.expressions", "qualname": "And", "kind": "class", "doc": "<p></p>\n", "bases": "Connector"}, "sqlglot.expressions.Or": {"fullname": "sqlglot.expressions.Or", "modulename": "sqlglot.expressions", "qualname": "Or", "kind": "class", "doc": "<p></p>\n", "bases": "Connector"}, "sqlglot.expressions.BitwiseAnd": {"fullname": "sqlglot.expressions.BitwiseAnd", "modulename": "sqlglot.expressions", "qualname": "BitwiseAnd", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.BitwiseLeftShift": {"fullname": "sqlglot.expressions.BitwiseLeftShift", "modulename": "sqlglot.expressions", "qualname": "BitwiseLeftShift", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.BitwiseOr": {"fullname": "sqlglot.expressions.BitwiseOr", "modulename": "sqlglot.expressions", "qualname": "BitwiseOr", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.BitwiseRightShift": {"fullname": "sqlglot.expressions.BitwiseRightShift", "modulename": "sqlglot.expressions", "qualname": "BitwiseRightShift", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.BitwiseXor": {"fullname": "sqlglot.expressions.BitwiseXor", "modulename": "sqlglot.expressions", "qualname": "BitwiseXor", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Div": {"fullname": "sqlglot.expressions.Div", "modulename": "sqlglot.expressions", "qualname": "Div", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Dot": {"fullname": "sqlglot.expressions.Dot", "modulename": "sqlglot.expressions", "qualname": "Dot", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.DPipe": {"fullname": "sqlglot.expressions.DPipe", "modulename": "sqlglot.expressions", "qualname": "DPipe", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.EQ": {"fullname": "sqlglot.expressions.EQ", "modulename": "sqlglot.expressions", "qualname": "EQ", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.NullSafeEQ": {"fullname": "sqlglot.expressions.NullSafeEQ", "modulename": "sqlglot.expressions", "qualname": "NullSafeEQ", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.NullSafeNEQ": {"fullname": "sqlglot.expressions.NullSafeNEQ", "modulename": "sqlglot.expressions", "qualname": "NullSafeNEQ", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.Distance": {"fullname": "sqlglot.expressions.Distance", "modulename": "sqlglot.expressions", "qualname": "Distance", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Escape": {"fullname": "sqlglot.expressions.Escape", "modulename": "sqlglot.expressions", "qualname": "Escape", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Glob": {"fullname": "sqlglot.expressions.Glob", "modulename": "sqlglot.expressions", "qualname": "Glob", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.GT": {"fullname": "sqlglot.expressions.GT", "modulename": "sqlglot.expressions", "qualname": "GT", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.GTE": {"fullname": "sqlglot.expressions.GTE", "modulename": "sqlglot.expressions", "qualname": "GTE", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.ILike": {"fullname": "sqlglot.expressions.ILike", "modulename": "sqlglot.expressions", "qualname": "ILike", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.IntDiv": {"fullname": "sqlglot.expressions.IntDiv", "modulename": "sqlglot.expressions", "qualname": "IntDiv", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Is": {"fullname": "sqlglot.expressions.Is", "modulename": "sqlglot.expressions", "qualname": "Is", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.Kwarg": {"fullname": "sqlglot.expressions.Kwarg", "modulename": "sqlglot.expressions", "qualname": "Kwarg", "kind": "class", "doc": "<p>Kwarg in special functions like func(kwarg => y).</p>\n", "bases": "Binary"}, "sqlglot.expressions.Like": {"fullname": "sqlglot.expressions.Like", "modulename": "sqlglot.expressions", "qualname": "Like", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.LT": {"fullname": "sqlglot.expressions.LT", "modulename": "sqlglot.expressions", "qualname": "LT", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.LTE": {"fullname": "sqlglot.expressions.LTE", "modulename": "sqlglot.expressions", "qualname": "LTE", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.Mod": {"fullname": "sqlglot.expressions.Mod", "modulename": "sqlglot.expressions", "qualname": "Mod", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Mul": {"fullname": "sqlglot.expressions.Mul", "modulename": "sqlglot.expressions", "qualname": "Mul", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.NEQ": {"fullname": "sqlglot.expressions.NEQ", "modulename": "sqlglot.expressions", "qualname": "NEQ", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.SimilarTo": {"fullname": "sqlglot.expressions.SimilarTo", "modulename": "sqlglot.expressions", "qualname": "SimilarTo", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Predicate"}, "sqlglot.expressions.Slice": {"fullname": "sqlglot.expressions.Slice", "modulename": "sqlglot.expressions", "qualname": "Slice", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Sub": {"fullname": "sqlglot.expressions.Sub", "modulename": "sqlglot.expressions", "qualname": "Sub", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.Unary": {"fullname": "sqlglot.expressions.Unary", "modulename": "sqlglot.expressions", "qualname": "Unary", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.BitwiseNot": {"fullname": "sqlglot.expressions.BitwiseNot", "modulename": "sqlglot.expressions", "qualname": "BitwiseNot", "kind": "class", "doc": "<p></p>\n", "bases": "Unary"}, "sqlglot.expressions.Not": {"fullname": "sqlglot.expressions.Not", "modulename": "sqlglot.expressions", "qualname": "Not", "kind": "class", "doc": "<p></p>\n", "bases": "Unary, Condition"}, "sqlglot.expressions.Paren": {"fullname": "sqlglot.expressions.Paren", "modulename": "sqlglot.expressions", "qualname": "Paren", "kind": "class", "doc": "<p></p>\n", "bases": "Unary, Condition"}, "sqlglot.expressions.Neg": {"fullname": "sqlglot.expressions.Neg", "modulename": "sqlglot.expressions", "qualname": "Neg", "kind": "class", "doc": "<p></p>\n", "bases": "Unary"}, "sqlglot.expressions.Alias": {"fullname": "sqlglot.expressions.Alias", "modulename": "sqlglot.expressions", "qualname": "Alias", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Alias.output_name": {"fullname": "sqlglot.expressions.Alias.output_name", "modulename": "sqlglot.expressions", "qualname": "Alias.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.Aliases": {"fullname": "sqlglot.expressions.Aliases", "modulename": "sqlglot.expressions", "qualname": "Aliases", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.AtTimeZone": {"fullname": "sqlglot.expressions.AtTimeZone", "modulename": "sqlglot.expressions", "qualname": "AtTimeZone", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Between": {"fullname": "sqlglot.expressions.Between", "modulename": "sqlglot.expressions", "qualname": "Between", "kind": "class", "doc": "<p></p>\n", "bases": "Predicate"}, "sqlglot.expressions.Bracket": {"fullname": "sqlglot.expressions.Bracket", "modulename": "sqlglot.expressions", "qualname": "Bracket", "kind": "class", "doc": "<p></p>\n", "bases": "Condition"}, "sqlglot.expressions.Distinct": {"fullname": "sqlglot.expressions.Distinct", "modulename": "sqlglot.expressions", "qualname": "Distinct", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.In": {"fullname": "sqlglot.expressions.In", "modulename": "sqlglot.expressions", "qualname": "In", "kind": "class", "doc": "<p></p>\n", "bases": "Predicate"}, "sqlglot.expressions.TimeUnit": {"fullname": "sqlglot.expressions.TimeUnit", "modulename": "sqlglot.expressions", "qualname": "TimeUnit", "kind": "class", "doc": "<p>Automatically converts unit arg into a var.</p>\n", "bases": "Expression"}, "sqlglot.expressions.TimeUnit.__init__": {"fullname": "sqlglot.expressions.TimeUnit.__init__", "modulename": "sqlglot.expressions", "qualname": "TimeUnit.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">**</span><span class=\"n\">args</span></span>)</span>"}, "sqlglot.expressions.Interval": {"fullname": "sqlglot.expressions.Interval", "modulename": "sqlglot.expressions", "qualname": "Interval", "kind": "class", "doc": "<p></p>\n", "bases": "TimeUnit"}, "sqlglot.expressions.IgnoreNulls": {"fullname": "sqlglot.expressions.IgnoreNulls", "modulename": "sqlglot.expressions", "qualname": "IgnoreNulls", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.RespectNulls": {"fullname": "sqlglot.expressions.RespectNulls", "modulename": "sqlglot.expressions", "qualname": "RespectNulls", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Func": {"fullname": "sqlglot.expressions.Func", "modulename": "sqlglot.expressions", "qualname": "Func", "kind": "class", "doc": "<p>The base class for all function expressions.</p>\n\n<h6 id=\"attributes\">Attributes:</h6>\n\n<ul>\n<li><strong>is_var_len_args (bool):</strong> if set to True the last argument defined in arg_types will be\ntreated as a variable length argument and the argument's value will be stored as a list.</li>\n<li><strong>_sql_names (list):</strong> determines the SQL name (1st item in the list) and aliases (subsequent items)\nfor this function expression. These values are used to map this node to a name during parsing\nas well as to provide the function's name during SQL string generation. By default the SQL\nname is set to the expression's class name transformed to snake case.</li>\n</ul>\n", "bases": "Condition"}, "sqlglot.expressions.Func.from_arg_list": {"fullname": "sqlglot.expressions.Func.from_arg_list", "modulename": "sqlglot.expressions", "qualname": "Func.from_arg_list", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">args</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Func.sql_names": {"fullname": "sqlglot.expressions.Func.sql_names", "modulename": "sqlglot.expressions", "qualname": "Func.sql_names", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Func.sql_name": {"fullname": "sqlglot.expressions.Func.sql_name", "modulename": "sqlglot.expressions", "qualname": "Func.sql_name", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.Func.default_parser_mappings": {"fullname": "sqlglot.expressions.Func.default_parser_mappings", "modulename": "sqlglot.expressions", "qualname": "Func.default_parser_mappings", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.AggFunc": {"fullname": "sqlglot.expressions.AggFunc", "modulename": "sqlglot.expressions", "qualname": "AggFunc", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Abs": {"fullname": "sqlglot.expressions.Abs", "modulename": "sqlglot.expressions", "qualname": "Abs", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Anonymous": {"fullname": "sqlglot.expressions.Anonymous", "modulename": "sqlglot.expressions", "qualname": "Anonymous", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ApproxDistinct": {"fullname": "sqlglot.expressions.ApproxDistinct", "modulename": "sqlglot.expressions", "qualname": "ApproxDistinct", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Array": {"fullname": "sqlglot.expressions.Array", "modulename": "sqlglot.expressions", "qualname": "Array", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.GenerateSeries": {"fullname": "sqlglot.expressions.GenerateSeries", "modulename": "sqlglot.expressions", "qualname": "GenerateSeries", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArrayAgg": {"fullname": "sqlglot.expressions.ArrayAgg", "modulename": "sqlglot.expressions", "qualname": "ArrayAgg", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.ArrayAll": {"fullname": "sqlglot.expressions.ArrayAll", "modulename": "sqlglot.expressions", "qualname": "ArrayAll", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArrayAny": {"fullname": "sqlglot.expressions.ArrayAny", "modulename": "sqlglot.expressions", "qualname": "ArrayAny", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArrayConcat": {"fullname": "sqlglot.expressions.ArrayConcat", "modulename": "sqlglot.expressions", "qualname": "ArrayConcat", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArrayContains": {"fullname": "sqlglot.expressions.ArrayContains", "modulename": "sqlglot.expressions", "qualname": "ArrayContains", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArrayFilter": {"fullname": "sqlglot.expressions.ArrayFilter", "modulename": "sqlglot.expressions", "qualname": "ArrayFilter", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArraySize": {"fullname": "sqlglot.expressions.ArraySize", "modulename": "sqlglot.expressions", "qualname": "ArraySize", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArraySort": {"fullname": "sqlglot.expressions.ArraySort", "modulename": "sqlglot.expressions", "qualname": "ArraySort", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArraySum": {"fullname": "sqlglot.expressions.ArraySum", "modulename": "sqlglot.expressions", "qualname": "ArraySum", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ArrayUnionAgg": {"fullname": "sqlglot.expressions.ArrayUnionAgg", "modulename": "sqlglot.expressions", "qualname": "ArrayUnionAgg", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Avg": {"fullname": "sqlglot.expressions.Avg", "modulename": "sqlglot.expressions", "qualname": "Avg", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.AnyValue": {"fullname": "sqlglot.expressions.AnyValue", "modulename": "sqlglot.expressions", "qualname": "AnyValue", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Case": {"fullname": "sqlglot.expressions.Case", "modulename": "sqlglot.expressions", "qualname": "Case", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Cast": {"fullname": "sqlglot.expressions.Cast", "modulename": "sqlglot.expressions", "qualname": "Cast", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Cast.output_name": {"fullname": "sqlglot.expressions.Cast.output_name", "modulename": "sqlglot.expressions", "qualname": "Cast.output_name", "kind": "variable", "doc": "<p>Name of the output column if this expression is a selection.</p>\n\n<p>If the Expression has no output name, an empty string is returned.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'a'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT b AS c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">'c'</span>\n<span class=\"gp\">>>> </span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 + 2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">output_name</span>\n<span class=\"go\">''</span>\n</code></pre>\n </div>\n</blockquote>\n"}, "sqlglot.expressions.Cast.is_type": {"fullname": "sqlglot.expressions.Cast.is_type", "modulename": "sqlglot.expressions", "qualname": "Cast.is_type", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">dtype</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">bool</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.Collate": {"fullname": "sqlglot.expressions.Collate", "modulename": "sqlglot.expressions", "qualname": "Collate", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.TryCast": {"fullname": "sqlglot.expressions.TryCast", "modulename": "sqlglot.expressions", "qualname": "TryCast", "kind": "class", "doc": "<p></p>\n", "bases": "Cast"}, "sqlglot.expressions.Ceil": {"fullname": "sqlglot.expressions.Ceil", "modulename": "sqlglot.expressions", "qualname": "Ceil", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Coalesce": {"fullname": "sqlglot.expressions.Coalesce", "modulename": "sqlglot.expressions", "qualname": "Coalesce", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Concat": {"fullname": "sqlglot.expressions.Concat", "modulename": "sqlglot.expressions", "qualname": "Concat", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.ConcatWs": {"fullname": "sqlglot.expressions.ConcatWs", "modulename": "sqlglot.expressions", "qualname": "ConcatWs", "kind": "class", "doc": "<p></p>\n", "bases": "Concat"}, "sqlglot.expressions.Count": {"fullname": "sqlglot.expressions.Count", "modulename": "sqlglot.expressions", "qualname": "Count", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.CurrentDate": {"fullname": "sqlglot.expressions.CurrentDate", "modulename": "sqlglot.expressions", "qualname": "CurrentDate", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.CurrentDatetime": {"fullname": "sqlglot.expressions.CurrentDatetime", "modulename": "sqlglot.expressions", "qualname": "CurrentDatetime", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.CurrentTime": {"fullname": "sqlglot.expressions.CurrentTime", "modulename": "sqlglot.expressions", "qualname": "CurrentTime", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.CurrentTimestamp": {"fullname": "sqlglot.expressions.CurrentTimestamp", "modulename": "sqlglot.expressions", "qualname": "CurrentTimestamp", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DateAdd": {"fullname": "sqlglot.expressions.DateAdd", "modulename": "sqlglot.expressions", "qualname": "DateAdd", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DateSub": {"fullname": "sqlglot.expressions.DateSub", "modulename": "sqlglot.expressions", "qualname": "DateSub", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DateDiff": {"fullname": "sqlglot.expressions.DateDiff", "modulename": "sqlglot.expressions", "qualname": "DateDiff", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DateTrunc": {"fullname": "sqlglot.expressions.DateTrunc", "modulename": "sqlglot.expressions", "qualname": "DateTrunc", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DatetimeAdd": {"fullname": "sqlglot.expressions.DatetimeAdd", "modulename": "sqlglot.expressions", "qualname": "DatetimeAdd", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DatetimeSub": {"fullname": "sqlglot.expressions.DatetimeSub", "modulename": "sqlglot.expressions", "qualname": "DatetimeSub", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DatetimeDiff": {"fullname": "sqlglot.expressions.DatetimeDiff", "modulename": "sqlglot.expressions", "qualname": "DatetimeDiff", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DatetimeTrunc": {"fullname": "sqlglot.expressions.DatetimeTrunc", "modulename": "sqlglot.expressions", "qualname": "DatetimeTrunc", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DayOfWeek": {"fullname": "sqlglot.expressions.DayOfWeek", "modulename": "sqlglot.expressions", "qualname": "DayOfWeek", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DayOfMonth": {"fullname": "sqlglot.expressions.DayOfMonth", "modulename": "sqlglot.expressions", "qualname": "DayOfMonth", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DayOfYear": {"fullname": "sqlglot.expressions.DayOfYear", "modulename": "sqlglot.expressions", "qualname": "DayOfYear", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.WeekOfYear": {"fullname": "sqlglot.expressions.WeekOfYear", "modulename": "sqlglot.expressions", "qualname": "WeekOfYear", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.LastDateOfMonth": {"fullname": "sqlglot.expressions.LastDateOfMonth", "modulename": "sqlglot.expressions", "qualname": "LastDateOfMonth", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Extract": {"fullname": "sqlglot.expressions.Extract", "modulename": "sqlglot.expressions", "qualname": "Extract", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TimestampAdd": {"fullname": "sqlglot.expressions.TimestampAdd", "modulename": "sqlglot.expressions", "qualname": "TimestampAdd", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimestampSub": {"fullname": "sqlglot.expressions.TimestampSub", "modulename": "sqlglot.expressions", "qualname": "TimestampSub", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimestampDiff": {"fullname": "sqlglot.expressions.TimestampDiff", "modulename": "sqlglot.expressions", "qualname": "TimestampDiff", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimestampTrunc": {"fullname": "sqlglot.expressions.TimestampTrunc", "modulename": "sqlglot.expressions", "qualname": "TimestampTrunc", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimeAdd": {"fullname": "sqlglot.expressions.TimeAdd", "modulename": "sqlglot.expressions", "qualname": "TimeAdd", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimeSub": {"fullname": "sqlglot.expressions.TimeSub", "modulename": "sqlglot.expressions", "qualname": "TimeSub", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimeDiff": {"fullname": "sqlglot.expressions.TimeDiff", "modulename": "sqlglot.expressions", "qualname": "TimeDiff", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TimeTrunc": {"fullname": "sqlglot.expressions.TimeTrunc", "modulename": "sqlglot.expressions", "qualname": "TimeTrunc", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.DateFromParts": {"fullname": "sqlglot.expressions.DateFromParts", "modulename": "sqlglot.expressions", "qualname": "DateFromParts", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DateStrToDate": {"fullname": "sqlglot.expressions.DateStrToDate", "modulename": "sqlglot.expressions", "qualname": "DateStrToDate", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DateToDateStr": {"fullname": "sqlglot.expressions.DateToDateStr", "modulename": "sqlglot.expressions", "qualname": "DateToDateStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DateToDi": {"fullname": "sqlglot.expressions.DateToDi", "modulename": "sqlglot.expressions", "qualname": "DateToDi", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Day": {"fullname": "sqlglot.expressions.Day", "modulename": "sqlglot.expressions", "qualname": "Day", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Decode": {"fullname": "sqlglot.expressions.Decode", "modulename": "sqlglot.expressions", "qualname": "Decode", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.DiToDate": {"fullname": "sqlglot.expressions.DiToDate", "modulename": "sqlglot.expressions", "qualname": "DiToDate", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Encode": {"fullname": "sqlglot.expressions.Encode", "modulename": "sqlglot.expressions", "qualname": "Encode", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Exp": {"fullname": "sqlglot.expressions.Exp", "modulename": "sqlglot.expressions", "qualname": "Exp", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Explode": {"fullname": "sqlglot.expressions.Explode", "modulename": "sqlglot.expressions", "qualname": "Explode", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Floor": {"fullname": "sqlglot.expressions.Floor", "modulename": "sqlglot.expressions", "qualname": "Floor", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Greatest": {"fullname": "sqlglot.expressions.Greatest", "modulename": "sqlglot.expressions", "qualname": "Greatest", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.GroupConcat": {"fullname": "sqlglot.expressions.GroupConcat", "modulename": "sqlglot.expressions", "qualname": "GroupConcat", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Hex": {"fullname": "sqlglot.expressions.Hex", "modulename": "sqlglot.expressions", "qualname": "Hex", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.If": {"fullname": "sqlglot.expressions.If", "modulename": "sqlglot.expressions", "qualname": "If", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.IfNull": {"fullname": "sqlglot.expressions.IfNull", "modulename": "sqlglot.expressions", "qualname": "IfNull", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Initcap": {"fullname": "sqlglot.expressions.Initcap", "modulename": "sqlglot.expressions", "qualname": "Initcap", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.JSONBContains": {"fullname": "sqlglot.expressions.JSONBContains", "modulename": "sqlglot.expressions", "qualname": "JSONBContains", "kind": "class", "doc": "<p></p>\n", "bases": "Binary"}, "sqlglot.expressions.JSONExtract": {"fullname": "sqlglot.expressions.JSONExtract", "modulename": "sqlglot.expressions", "qualname": "JSONExtract", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Func"}, "sqlglot.expressions.JSONExtractScalar": {"fullname": "sqlglot.expressions.JSONExtractScalar", "modulename": "sqlglot.expressions", "qualname": "JSONExtractScalar", "kind": "class", "doc": "<p></p>\n", "bases": "JSONExtract"}, "sqlglot.expressions.JSONBExtract": {"fullname": "sqlglot.expressions.JSONBExtract", "modulename": "sqlglot.expressions", "qualname": "JSONBExtract", "kind": "class", "doc": "<p></p>\n", "bases": "JSONExtract"}, "sqlglot.expressions.JSONBExtractScalar": {"fullname": "sqlglot.expressions.JSONBExtractScalar", "modulename": "sqlglot.expressions", "qualname": "JSONBExtractScalar", "kind": "class", "doc": "<p></p>\n", "bases": "JSONExtract"}, "sqlglot.expressions.Least": {"fullname": "sqlglot.expressions.Least", "modulename": "sqlglot.expressions", "qualname": "Least", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Length": {"fullname": "sqlglot.expressions.Length", "modulename": "sqlglot.expressions", "qualname": "Length", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Levenshtein": {"fullname": "sqlglot.expressions.Levenshtein", "modulename": "sqlglot.expressions", "qualname": "Levenshtein", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Ln": {"fullname": "sqlglot.expressions.Ln", "modulename": "sqlglot.expressions", "qualname": "Ln", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Log": {"fullname": "sqlglot.expressions.Log", "modulename": "sqlglot.expressions", "qualname": "Log", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Log2": {"fullname": "sqlglot.expressions.Log2", "modulename": "sqlglot.expressions", "qualname": "Log2", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Log10": {"fullname": "sqlglot.expressions.Log10", "modulename": "sqlglot.expressions", "qualname": "Log10", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.LogicalOr": {"fullname": "sqlglot.expressions.LogicalOr", "modulename": "sqlglot.expressions", "qualname": "LogicalOr", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Lower": {"fullname": "sqlglot.expressions.Lower", "modulename": "sqlglot.expressions", "qualname": "Lower", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Map": {"fullname": "sqlglot.expressions.Map", "modulename": "sqlglot.expressions", "qualname": "Map", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.VarMap": {"fullname": "sqlglot.expressions.VarMap", "modulename": "sqlglot.expressions", "qualname": "VarMap", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Matches": {"fullname": "sqlglot.expressions.Matches", "modulename": "sqlglot.expressions", "qualname": "Matches", "kind": "class", "doc": "<p>Oracle/Snowflake decode.\n<a href=\"https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm\">https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm</a>\nPattern matching MATCHES(value, search1, result1, ...searchN, resultN, else)</p>\n", "bases": "Func"}, "sqlglot.expressions.Max": {"fullname": "sqlglot.expressions.Max", "modulename": "sqlglot.expressions", "qualname": "Max", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Min": {"fullname": "sqlglot.expressions.Min", "modulename": "sqlglot.expressions", "qualname": "Min", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Month": {"fullname": "sqlglot.expressions.Month", "modulename": "sqlglot.expressions", "qualname": "Month", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Nvl2": {"fullname": "sqlglot.expressions.Nvl2", "modulename": "sqlglot.expressions", "qualname": "Nvl2", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Posexplode": {"fullname": "sqlglot.expressions.Posexplode", "modulename": "sqlglot.expressions", "qualname": "Posexplode", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Pow": {"fullname": "sqlglot.expressions.Pow", "modulename": "sqlglot.expressions", "qualname": "Pow", "kind": "class", "doc": "<p></p>\n", "bases": "Binary, Func"}, "sqlglot.expressions.PercentileCont": {"fullname": "sqlglot.expressions.PercentileCont", "modulename": "sqlglot.expressions", "qualname": "PercentileCont", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.PercentileDisc": {"fullname": "sqlglot.expressions.PercentileDisc", "modulename": "sqlglot.expressions", "qualname": "PercentileDisc", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Quantile": {"fullname": "sqlglot.expressions.Quantile", "modulename": "sqlglot.expressions", "qualname": "Quantile", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Quantiles": {"fullname": "sqlglot.expressions.Quantiles", "modulename": "sqlglot.expressions", "qualname": "Quantiles", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.QuantileIf": {"fullname": "sqlglot.expressions.QuantileIf", "modulename": "sqlglot.expressions", "qualname": "QuantileIf", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.ApproxQuantile": {"fullname": "sqlglot.expressions.ApproxQuantile", "modulename": "sqlglot.expressions", "qualname": "ApproxQuantile", "kind": "class", "doc": "<p></p>\n", "bases": "Quantile"}, "sqlglot.expressions.ReadCSV": {"fullname": "sqlglot.expressions.ReadCSV", "modulename": "sqlglot.expressions", "qualname": "ReadCSV", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Reduce": {"fullname": "sqlglot.expressions.Reduce", "modulename": "sqlglot.expressions", "qualname": "Reduce", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.RegexpLike": {"fullname": "sqlglot.expressions.RegexpLike", "modulename": "sqlglot.expressions", "qualname": "RegexpLike", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.RegexpILike": {"fullname": "sqlglot.expressions.RegexpILike", "modulename": "sqlglot.expressions", "qualname": "RegexpILike", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.RegexpSplit": {"fullname": "sqlglot.expressions.RegexpSplit", "modulename": "sqlglot.expressions", "qualname": "RegexpSplit", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Repeat": {"fullname": "sqlglot.expressions.Repeat", "modulename": "sqlglot.expressions", "qualname": "Repeat", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Round": {"fullname": "sqlglot.expressions.Round", "modulename": "sqlglot.expressions", "qualname": "Round", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.RowNumber": {"fullname": "sqlglot.expressions.RowNumber", "modulename": "sqlglot.expressions", "qualname": "RowNumber", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.SafeDivide": {"fullname": "sqlglot.expressions.SafeDivide", "modulename": "sqlglot.expressions", "qualname": "SafeDivide", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.SetAgg": {"fullname": "sqlglot.expressions.SetAgg", "modulename": "sqlglot.expressions", "qualname": "SetAgg", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.SortArray": {"fullname": "sqlglot.expressions.SortArray", "modulename": "sqlglot.expressions", "qualname": "SortArray", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Split": {"fullname": "sqlglot.expressions.Split", "modulename": "sqlglot.expressions", "qualname": "Split", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Substring": {"fullname": "sqlglot.expressions.Substring", "modulename": "sqlglot.expressions", "qualname": "Substring", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.StrPosition": {"fullname": "sqlglot.expressions.StrPosition", "modulename": "sqlglot.expressions", "qualname": "StrPosition", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.StrToDate": {"fullname": "sqlglot.expressions.StrToDate", "modulename": "sqlglot.expressions", "qualname": "StrToDate", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.StrToTime": {"fullname": "sqlglot.expressions.StrToTime", "modulename": "sqlglot.expressions", "qualname": "StrToTime", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.StrToUnix": {"fullname": "sqlglot.expressions.StrToUnix", "modulename": "sqlglot.expressions", "qualname": "StrToUnix", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.NumberToStr": {"fullname": "sqlglot.expressions.NumberToStr", "modulename": "sqlglot.expressions", "qualname": "NumberToStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Struct": {"fullname": "sqlglot.expressions.Struct", "modulename": "sqlglot.expressions", "qualname": "Struct", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.StructExtract": {"fullname": "sqlglot.expressions.StructExtract", "modulename": "sqlglot.expressions", "qualname": "StructExtract", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Sum": {"fullname": "sqlglot.expressions.Sum", "modulename": "sqlglot.expressions", "qualname": "Sum", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Sqrt": {"fullname": "sqlglot.expressions.Sqrt", "modulename": "sqlglot.expressions", "qualname": "Sqrt", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Stddev": {"fullname": "sqlglot.expressions.Stddev", "modulename": "sqlglot.expressions", "qualname": "Stddev", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.StddevPop": {"fullname": "sqlglot.expressions.StddevPop", "modulename": "sqlglot.expressions", "qualname": "StddevPop", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.StddevSamp": {"fullname": "sqlglot.expressions.StddevSamp", "modulename": "sqlglot.expressions", "qualname": "StddevSamp", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.TimeToStr": {"fullname": "sqlglot.expressions.TimeToStr", "modulename": "sqlglot.expressions", "qualname": "TimeToStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TimeToTimeStr": {"fullname": "sqlglot.expressions.TimeToTimeStr", "modulename": "sqlglot.expressions", "qualname": "TimeToTimeStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TimeToUnix": {"fullname": "sqlglot.expressions.TimeToUnix", "modulename": "sqlglot.expressions", "qualname": "TimeToUnix", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TimeStrToDate": {"fullname": "sqlglot.expressions.TimeStrToDate", "modulename": "sqlglot.expressions", "qualname": "TimeStrToDate", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TimeStrToTime": {"fullname": "sqlglot.expressions.TimeStrToTime", "modulename": "sqlglot.expressions", "qualname": "TimeStrToTime", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TimeStrToUnix": {"fullname": "sqlglot.expressions.TimeStrToUnix", "modulename": "sqlglot.expressions", "qualname": "TimeStrToUnix", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Trim": {"fullname": "sqlglot.expressions.Trim", "modulename": "sqlglot.expressions", "qualname": "Trim", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TsOrDsAdd": {"fullname": "sqlglot.expressions.TsOrDsAdd", "modulename": "sqlglot.expressions", "qualname": "TsOrDsAdd", "kind": "class", "doc": "<p></p>\n", "bases": "Func, TimeUnit"}, "sqlglot.expressions.TsOrDsToDateStr": {"fullname": "sqlglot.expressions.TsOrDsToDateStr", "modulename": "sqlglot.expressions", "qualname": "TsOrDsToDateStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TsOrDsToDate": {"fullname": "sqlglot.expressions.TsOrDsToDate", "modulename": "sqlglot.expressions", "qualname": "TsOrDsToDate", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.TsOrDiToDi": {"fullname": "sqlglot.expressions.TsOrDiToDi", "modulename": "sqlglot.expressions", "qualname": "TsOrDiToDi", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Unhex": {"fullname": "sqlglot.expressions.Unhex", "modulename": "sqlglot.expressions", "qualname": "Unhex", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.UnixToStr": {"fullname": "sqlglot.expressions.UnixToStr", "modulename": "sqlglot.expressions", "qualname": "UnixToStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.UnixToTime": {"fullname": "sqlglot.expressions.UnixToTime", "modulename": "sqlglot.expressions", "qualname": "UnixToTime", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.UnixToTimeStr": {"fullname": "sqlglot.expressions.UnixToTimeStr", "modulename": "sqlglot.expressions", "qualname": "UnixToTimeStr", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Upper": {"fullname": "sqlglot.expressions.Upper", "modulename": "sqlglot.expressions", "qualname": "Upper", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Variance": {"fullname": "sqlglot.expressions.Variance", "modulename": "sqlglot.expressions", "qualname": "Variance", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.VariancePop": {"fullname": "sqlglot.expressions.VariancePop", "modulename": "sqlglot.expressions", "qualname": "VariancePop", "kind": "class", "doc": "<p></p>\n", "bases": "AggFunc"}, "sqlglot.expressions.Week": {"fullname": "sqlglot.expressions.Week", "modulename": "sqlglot.expressions", "qualname": "Week", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Year": {"fullname": "sqlglot.expressions.Year", "modulename": "sqlglot.expressions", "qualname": "Year", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.Use": {"fullname": "sqlglot.expressions.Use", "modulename": "sqlglot.expressions", "qualname": "Use", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.Merge": {"fullname": "sqlglot.expressions.Merge", "modulename": "sqlglot.expressions", "qualname": "Merge", "kind": "class", "doc": "<p></p>\n", "bases": "Expression"}, "sqlglot.expressions.When": {"fullname": "sqlglot.expressions.When", "modulename": "sqlglot.expressions", "qualname": "When", "kind": "class", "doc": "<p></p>\n", "bases": "Func"}, "sqlglot.expressions.maybe_parse": {"fullname": "sqlglot.expressions.maybe_parse", "modulename": "sqlglot.expressions", "qualname": "maybe_parse", "kind": "function", "doc": "<p>Gracefully handle a possible string or expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">maybe_parse</span><span class=\"p\">(</span><span class=\"s2\">"1"</span><span class=\"p\">)</span>\n<span class=\"go\">(LITERAL this: 1, is_string: False)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">maybe_parse</span><span class=\"p\">(</span><span class=\"n\">to_identifier</span><span class=\"p\">(</span><span class=\"s2\">"x"</span><span class=\"p\">))</span>\n<span class=\"go\">(IDENTIFIER this: x, quoted: False)</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql_or_expression:</strong> the SQL code string or an expression</li>\n<li><strong>into:</strong> the SQLGlot Expression to parse into</li>\n<li><strong>dialect:</strong> the dialect used to parse the input expressions (in the case that an\ninput expression is a SQL string).</li>\n<li><strong>prefix:</strong> a string to prefix the sql with before it gets parsed\n(automatically includes a space)</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case\nthat an input expression is a SQL string).</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Expression: the parsed or given expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql_or_expression</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"o\">*</span>,</span><span class=\"param\">\t<span class=\"n\">into</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"n\">Collection</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">prefix</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.union": {"fullname": "sqlglot.expressions.union", "modulename": "sqlglot.expressions", "qualname": "union", "kind": "function", "doc": "<p>Initializes a syntax tree from one UNION expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">union</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM foo"</span><span class=\"p\">,</span> <span class=\"s2\">"SELECT * FROM bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo UNION SELECT * FROM bla'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>left (str | Expression):</strong> the SQL code string corresponding to the left-hand side.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>right (str | Expression):</strong> the SQL code string corresponding to the right-hand side.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Union: the syntax tree for the UNION expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">left</span>, </span><span class=\"param\"><span class=\"n\">right</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.intersect": {"fullname": "sqlglot.expressions.intersect", "modulename": "sqlglot.expressions", "qualname": "intersect", "kind": "function", "doc": "<p>Initializes a syntax tree from one INTERSECT expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">intersect</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM foo"</span><span class=\"p\">,</span> <span class=\"s2\">"SELECT * FROM bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>left (str | Expression):</strong> the SQL code string corresponding to the left-hand side.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>right (str | Expression):</strong> the SQL code string corresponding to the right-hand side.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Intersect: the syntax tree for the INTERSECT expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">left</span>, </span><span class=\"param\"><span class=\"n\">right</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.except_": {"fullname": "sqlglot.expressions.except_", "modulename": "sqlglot.expressions", "qualname": "except_", "kind": "function", "doc": "<p>Initializes a syntax tree from one EXCEPT expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">except_</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM foo"</span><span class=\"p\">,</span> <span class=\"s2\">"SELECT * FROM bla"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>left (str | Expression):</strong> the SQL code string corresponding to the left-hand side.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>right (str | Expression):</strong> the SQL code string corresponding to the right-hand side.\nIf an <code>Expression</code> instance is passed, it will be used as-is.</li>\n<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Except: the syntax tree for the EXCEPT statement.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">left</span>, </span><span class=\"param\"><span class=\"n\">right</span>, </span><span class=\"param\"><span class=\"n\">distinct</span><span class=\"o\">=</span><span class=\"kc\">True</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.select": {"fullname": "sqlglot.expressions.select", "modulename": "sqlglot.expressions", "qualname": "select", "kind": "function", "doc": "<p>Initializes a syntax tree from one or multiple SELECT expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"col1"</span><span class=\"p\">,</span> <span class=\"s2\">"col2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT col1, col2 FROM tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code string to parse as the expressions of a\nSELECT statement. If an Expression instance is passed, this is used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions (in the case that an\ninput expression is a SQL string).</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case\nthat an input expression is a SQL string).</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the syntax tree for the SELECT statement.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.from_": {"fullname": "sqlglot.expressions.from_", "modulename": "sqlglot.expressions", "qualname": "from_", "kind": "function", "doc": "<p>Initializes a syntax tree from a FROM expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"col1"</span><span class=\"p\">,</span> <span class=\"s2\">"col2"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT col1, col2 FROM tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code string to parse as the FROM expressions of a\nSELECT statement. If an Expression instance is passed, this is used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression (in the case that the\ninput expression is a SQL string).</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case\nthat the input expression is a SQL string).</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: the syntax tree for the SELECT statement.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.update": {"fullname": "sqlglot.expressions.update", "modulename": "sqlglot.expressions", "qualname": "update", "kind": "function", "doc": "<p>Creates an update statement.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">update</span><span class=\"p\">(</span><span class=\"s2\">"my_table"</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">"x"</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s2\">"y"</span><span class=\"p\">:</span> <span class=\"s2\">"2"</span><span class=\"p\">,</span> <span class=\"s2\">"z"</span><span class=\"p\">:</span> <span class=\"kc\">None</span><span class=\"p\">},</span> <span class=\"n\">from_</span><span class=\"o\">=</span><span class=\"s2\">"baz"</span><span class=\"p\">,</span> <span class=\"n\">where</span><span class=\"o\">=</span><span class=\"s2\">"id > 1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">"UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz WHERE id > 1"</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*properties (Dict[str, Any]):</strong> dictionary of properties to set which are\nauto converted to sql objects eg None -> NULL</li>\n<li><strong>where (str):</strong> sql conditional parsed into a WHERE statement</li>\n<li><strong>from_ (str):</strong> sql statement parsed into a FROM statement</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Update: the syntax tree for the UPDATE statement.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">table</span>,</span><span class=\"param\">\t<span class=\"n\">properties</span>,</span><span class=\"param\">\t<span class=\"n\">where</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">from_</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Update</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.delete": {"fullname": "sqlglot.expressions.delete", "modulename": "sqlglot.expressions", "qualname": "delete", "kind": "function", "doc": "<p>Builds a delete statement.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">delete</span><span class=\"p\">(</span><span class=\"s2\">"my_table"</span><span class=\"p\">,</span> <span class=\"n\">where</span><span class=\"o\">=</span><span class=\"s2\">"id > 1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'DELETE FROM my_table WHERE id > 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>where (str|Condition):</strong> sql conditional parsed into a WHERE statement</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Delete: the syntax tree for the DELETE statement.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">table</span>, </span><span class=\"param\"><span class=\"n\">where</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Delete</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.condition": {"fullname": "sqlglot.expressions.condition", "modulename": "sqlglot.expressions", "qualname": "condition", "kind": "function", "doc": "<p>Initialize a logical condition expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">condition</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'x = 1'</span>\n</code></pre>\n </div>\n \n <p>This is helpful for composing larger logical syntax trees:</p>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">where</span> <span class=\"o\">=</span> <span class=\"n\">condition</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">where</span> <span class=\"o\">=</span> <span class=\"n\">where</span><span class=\"o\">.</span><span class=\"n\">and_</span><span class=\"p\">(</span><span class=\"s2\">"y=1"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">Select</span><span class=\"p\">()</span><span class=\"o\">.</span><span class=\"n\">from_</span><span class=\"p\">(</span><span class=\"s2\">"tbl"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s2\">"*"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">where</span><span class=\"p\">(</span><span class=\"n\">where</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM tbl WHERE x = 1 AND y = 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expression (str | Expression):</strong> the SQL code string to parse.\nIf an Expression instance is passed, this is used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression (in the case that the\ninput expression is a SQL string).</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case\nthat the input expression is a SQL string).</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Condition: the expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Condition</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.and_": {"fullname": "sqlglot.expressions.and_", "modulename": "sqlglot.expressions", "qualname": "and_", "kind": "function", "doc": "<p>Combine multiple conditions with an AND logical operator.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">and_</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">,</span> <span class=\"n\">and_</span><span class=\"p\">(</span><span class=\"s2\">"y=1"</span><span class=\"p\">,</span> <span class=\"s2\">"z=1"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'x = 1 AND (y = 1 AND z = 1)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an Expression instance is passed, this is used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>And: the new condition</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">And</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.or_": {"fullname": "sqlglot.expressions.or_", "modulename": "sqlglot.expressions", "qualname": "or_", "kind": "function", "doc": "<p>Combine multiple conditions with an OR logical operator.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">or_</span><span class=\"p\">(</span><span class=\"s2\">"x=1"</span><span class=\"p\">,</span> <span class=\"n\">or_</span><span class=\"p\">(</span><span class=\"s2\">"y=1"</span><span class=\"p\">,</span> <span class=\"s2\">"z=1"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'x = 1 OR (y = 1 OR z = 1)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse.\nIf an Expression instance is passed, this is used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Or: the new condition</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expressions</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Or</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.not_": {"fullname": "sqlglot.expressions.not_", "modulename": "sqlglot.expressions", "qualname": "not_", "kind": "function", "doc": "<p>Wrap a condition with a NOT operator.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">not_</span><span class=\"p\">(</span><span class=\"s2\">"this_suit='black'"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">"NOT this_suit = 'black'"</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | Expression):</strong> the SQL code strings to parse.\nIf an Expression instance is passed, this is used as-is.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Not: the new condition</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Not</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.paren": {"fullname": "sqlglot.expressions.paren", "modulename": "sqlglot.expressions", "qualname": "paren", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Paren</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.to_identifier": {"fullname": "sqlglot.expressions.to_identifier", "modulename": "sqlglot.expressions", "qualname": "to_identifier", "kind": "function", "doc": "<p>Builds an identifier.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>name:</strong> The name to turn into an identifier.</li>\n<li><strong>quoted:</strong> Whether or not force quote the identifier.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The identifier ast node.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">name</span>, </span><span class=\"param\"><span class=\"n\">quoted</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.to_interval": {"fullname": "sqlglot.expressions.to_interval", "modulename": "sqlglot.expressions", "qualname": "to_interval", "kind": "function", "doc": "<p>Builds an interval expression from a string like '1 day' or '5 months'.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">interval</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Literal</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Interval</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.to_table": {"fullname": "sqlglot.expressions.to_table", "modulename": "sqlglot.expressions", "qualname": "to_table", "kind": "function", "doc": "<p>Create a table expression from a <code>[catalog].[schema].[table]</code> sql path. Catalog and schema are optional.\nIf a table is passed in then that table is returned.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql_path:</strong> a <code>[catalog].[schema].[table]</code> string.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A table expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql_path</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.to_column": {"fullname": "sqlglot.expressions.to_column", "modulename": "sqlglot.expressions", "qualname": "to_column", "kind": "function", "doc": "<p>Create a column from a <code>[table].[column]</code> sql path. Schema is optional.</p>\n\n<p>If a column is passed in then that column is returned.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>sql_path:</strong> <code>[table].[column]</code> string</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Table: A column expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">sql_path</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.alias_": {"fullname": "sqlglot.expressions.alias_", "modulename": "sqlglot.expressions", "qualname": "alias_", "kind": "function", "doc": "<p>Create an Alias expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">alias_</span><span class=\"p\">(</span><span class=\"s1\">'foo'</span><span class=\"p\">,</span> <span class=\"s1\">'bar'</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'foo AS bar'</span>\n</code></pre>\n </div>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">alias_</span><span class=\"p\">(</span><span class=\"s1\">'(select 1, 2)'</span><span class=\"p\">,</span> <span class=\"s1\">'bar'</span><span class=\"p\">,</span> <span class=\"n\">table</span><span class=\"o\">=</span><span class=\"p\">[</span><span class=\"s1\">'a'</span><span class=\"p\">,</span> <span class=\"s1\">'b'</span><span class=\"p\">])</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'(SELECT 1, 2) AS bar(a, b)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the SQL code strings to parse.\nIf an Expression instance is passed, this is used as-is.</li>\n<li><strong>alias:</strong> the alias name to use. If the name has\nspecial characters it is quoted.</li>\n<li><strong>table:</strong> Whether or not to create a table alias, can also be a list of columns.</li>\n<li><strong>quoted:</strong> whether or not to quote the alias</li>\n<li><strong>dialect:</strong> the dialect used to parse the input expression.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Alias: the aliased expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">alias</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Identifier</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">,</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Identifier</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">quoted</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">bool</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.subquery": {"fullname": "sqlglot.expressions.subquery", "modulename": "sqlglot.expressions", "qualname": "subquery", "kind": "function", "doc": "<p>Build a subquery expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">subquery</span><span class=\"p\">(</span><span class=\"s1\">'select x from tbl'</span><span class=\"p\">,</span> <span class=\"s1\">'bar'</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">select</span><span class=\"p\">(</span><span class=\"s1\">'x'</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x FROM (SELECT x FROM tbl) AS bar'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (str | Expression):</strong> the SQL code strings to parse.\nIf an Expression instance is passed, this is used as-is.</li>\n<li><strong>alias (str | Expression):</strong> the alias name to use.</li>\n<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li>\n<li><strong>**opts:</strong> other options to use to parse the input expressions.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Select: a new select with the subquery expression included</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">alias</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">dialect</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.column": {"fullname": "sqlglot.expressions.column", "modulename": "sqlglot.expressions", "qualname": "column", "kind": "function", "doc": "<p>Build a Column.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>col (str | Expression):</strong> column name</li>\n<li><strong>table (str | Expression):</strong> table name</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Column: column instance</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">col</span>, </span><span class=\"param\"><span class=\"n\">table</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">quoted</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.cast": {"fullname": "sqlglot.expressions.cast", "modulename": "sqlglot.expressions", "qualname": "cast", "kind": "function", "doc": "<p>Cast an expression to a data type.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">cast</span><span class=\"p\">(</span><span class=\"s1\">'x + 1'</span><span class=\"p\">,</span> <span class=\"s1\">'int'</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'CAST(x + 1 AS INT)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> The expression to cast.</li>\n<li><strong>to:</strong> The datatype to cast to.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A cast node.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">to</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Cast</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.table_": {"fullname": "sqlglot.expressions.table_", "modulename": "sqlglot.expressions", "qualname": "table_", "kind": "function", "doc": "<p>Build a Table.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table (str | Expression):</strong> column name</li>\n<li><strong>db (str | Expression):</strong> db name</li>\n<li><strong>catalog (str | Expression):</strong> catalog name</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Table: table instance</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">table</span>,</span><span class=\"param\">\t<span class=\"n\">db</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">catalog</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">quoted</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">alias</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.values": {"fullname": "sqlglot.expressions.values", "modulename": "sqlglot.expressions", "qualname": "values", "kind": "function", "doc": "<p>Build VALUES statement.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">values</span><span class=\"p\">([(</span><span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"s1\">'2'</span><span class=\"p\">)])</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">"VALUES (1, '2')"</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>values:</strong> values statements that will be converted to SQL</li>\n<li><strong>alias:</strong> optional alias</li>\n<li><strong>columns:</strong> Optional list of ordered column names or ordered dictionary of column names to types.\nIf either are provided then an alias is also required.\nIf a dictionary is provided then the first column of the values will be casted to the expected type\nin order to help with type inference.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Values: the Values expression object</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">values</span><span class=\"p\">:</span> <span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">]]</span>,</span><span class=\"param\">\t<span class=\"n\">alias</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">columns</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">],</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Values</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.rename_table": {"fullname": "sqlglot.expressions.rename_table", "modulename": "sqlglot.expressions", "qualname": "rename_table", "kind": "function", "doc": "<p>Build ALTER TABLE... RENAME... expression</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>old_name:</strong> The old name of the table</li>\n<li><strong>new_name:</strong> The new name of the table</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Alter table expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">old_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span>,</span><span class=\"param\">\t<span class=\"n\">new_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">AlterTable</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.convert": {"fullname": "sqlglot.expressions.convert", "modulename": "sqlglot.expressions", "qualname": "convert", "kind": "function", "doc": "<p>Convert a python value into an expression object.</p>\n\n<p>Raises an error if a conversion is not possible.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>value (Any):</strong> a python object</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Expression: the equivalent expression object</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">value</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.replace_children": {"fullname": "sqlglot.expressions.replace_children", "modulename": "sqlglot.expressions", "qualname": "replace_children", "kind": "function", "doc": "<p>Replace children of an expression with the result of a lambda fun(child) -> exp.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">fun</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.column_table_names": {"fullname": "sqlglot.expressions.column_table_names", "modulename": "sqlglot.expressions", "qualname": "column_table_names", "kind": "function", "doc": "<p>Return all table names referenced through columns in an expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">column_table_names</span><span class=\"p\">(</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"a.b AND c.d AND c.e"</span><span class=\"p\">))</span>\n<span class=\"go\">['c', 'a']</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to find table names</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list: A list of unique names</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.table_name": {"fullname": "sqlglot.expressions.table_name", "modulename": "sqlglot.expressions", "qualname": "table_name", "kind": "function", "doc": "<p>Get the full name of a table as a string.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table (exp.Table | str):</strong> table expression node or string.</li>\n</ul>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">exp</span><span class=\"p\">,</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">table_name</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"select * from a.b.c"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">find</span><span class=\"p\">(</span><span class=\"n\">exp</span><span class=\"o\">.</span><span class=\"n\">Table</span><span class=\"p\">))</span>\n<span class=\"go\">'a.b.c'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The table name.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">table</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.replace_tables": {"fullname": "sqlglot.expressions.replace_tables", "modulename": "sqlglot.expressions", "qualname": "replace_tables", "kind": "function", "doc": "<p>Replace all tables in expression according to the mapping.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression node to be transformed and replaced.</li>\n<li><strong>mapping (Dict[str, str]):</strong> mapping of table names.</li>\n</ul>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">exp</span><span class=\"p\">,</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">replace_tables</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"select * from a.b"</span><span class=\"p\">),</span> <span class=\"p\">{</span><span class=\"s2\">"a.b"</span><span class=\"p\">:</span> <span class=\"s2\">"c"</span><span class=\"p\">})</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM c'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The mapped expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">mapping</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.replace_placeholders": {"fullname": "sqlglot.expressions.replace_placeholders", "modulename": "sqlglot.expressions", "qualname": "replace_placeholders", "kind": "function", "doc": "<p>Replace placeholders in an expression.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression node to be transformed and replaced.</li>\n<li><strong>args:</strong> positional names that will substitute unnamed placeholders in the given order.</li>\n<li><strong>kwargs:</strong> keyword arguments that will substitute named placeholders.</li>\n</ul>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">exp</span><span class=\"p\">,</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">replace_placeholders</span><span class=\"p\">(</span>\n<span class=\"gp\">... </span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"select * from :tbl where ? = ?"</span><span class=\"p\">),</span> <span class=\"s2\">"a"</span><span class=\"p\">,</span> <span class=\"s2\">"b"</span><span class=\"p\">,</span> <span class=\"n\">tbl</span><span class=\"o\">=</span><span class=\"s2\">"foo"</span>\n<span class=\"gp\">... </span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM foo WHERE a = b'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The mapped expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">args</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.expand": {"fullname": "sqlglot.expressions.expand", "modulename": "sqlglot.expressions", "qualname": "expand", "kind": "function", "doc": "<p>Transforms an expression by expanding all referenced sources into subqueries.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expand</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"select * from x AS z"</span><span class=\"p\">),</span> <span class=\"p\">{</span><span class=\"s2\">"x"</span><span class=\"p\">:</span> <span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"select * from y"</span><span class=\"p\">)})</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM (SELECT * FROM y) AS z /* source: x */'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> The expression to expand.</li>\n<li><strong>sources:</strong> A dictionary of name to Subqueryables.</li>\n<li><strong>copy:</strong> Whether or not to copy the expression during transformation. Defaults to True.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The transformed expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">sources</span><span class=\"p\">:</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Subqueryable</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">copy</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.func": {"fullname": "sqlglot.expressions.func", "modulename": "sqlglot.expressions", "qualname": "func", "kind": "function", "doc": "<p>Returns a Func expression.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">func</span><span class=\"p\">(</span><span class=\"s2\">"abs"</span><span class=\"p\">,</span> <span class=\"mi\">5</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'ABS(5)'</span>\n</code></pre>\n </div>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">func</span><span class=\"p\">(</span><span class=\"s2\">"cast"</span><span class=\"p\">,</span> <span class=\"n\">this</span><span class=\"o\">=</span><span class=\"mi\">5</span><span class=\"p\">,</span> <span class=\"n\">to</span><span class=\"o\">=</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">build</span><span class=\"p\">(</span><span class=\"s2\">"DOUBLE"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'CAST(5 AS DOUBLE)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>name:</strong> the name of the function to build.</li>\n<li><strong>args:</strong> the args used to instantiate the function of interest.</li>\n<li><strong>dialect:</strong> the source dialect.</li>\n<li><strong>kwargs:</strong> the kwargs used to instantiate the function of interest.</li>\n</ul>\n\n<h6 id=\"note\">Note:</h6>\n\n<blockquote>\n <p>The arguments <code>args</code> and <code>kwargs</code> are mutually exclusive.</p>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>An instance of the function of interest, or an anonymous function, if <code>name</code> doesn't\n correspond to an existing <code>sqlglot.expressions.Func</code> class.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"o\">*</span><span class=\"n\">args</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Func</span>:</span></span>", "funcdef": "def"}, "sqlglot.expressions.true": {"fullname": "sqlglot.expressions.true", "modulename": "sqlglot.expressions", "qualname": "true", "kind": "function", "doc": "<p>Returns a true Boolean expression.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.false": {"fullname": "sqlglot.expressions.false", "modulename": "sqlglot.expressions", "qualname": "false", "kind": "function", "doc": "<p>Returns a false Boolean expression.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.expressions.null": {"fullname": "sqlglot.expressions.null", "modulename": "sqlglot.expressions", "qualname": "null", "kind": "function", "doc": "<p>Returns a Null expression.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.generator": {"fullname": "sqlglot.generator", "modulename": "sqlglot.generator", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.generator.Generator": {"fullname": "sqlglot.generator.Generator", "modulename": "sqlglot.generator", "qualname": "Generator", "kind": "class", "doc": "<p>Generator interprets the given syntax tree and produces a SQL string as an output.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key\nrepresents a python time format and the output the target time format</li>\n<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li>\n<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li>\n<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li>\n<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li>\n<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: \".</li>\n<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: \".</li>\n<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding\ncharacter.</li>\n<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li>\n<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li>\n<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: \".</li>\n<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li>\n<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li>\n<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li>\n<li><strong>normalize_functions (str):</strong> normalize function names, \"upper\", \"lower\", or None\nDefault: \"upper\"</li>\n<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample\nDefault: False</li>\n<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters\nunsupported expressions. Default ErrorLevel.WARN.</li>\n<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError.\nThis is only relevant if unsupported_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements\nDefault: False</li>\n<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode.\nThe default is on the smaller end because the length only represents a segment and not the true\nline length.\nDefault: 80</li>\n<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code.\nDefault: True</li>\n</ul>\n"}, "sqlglot.generator.Generator.__init__": {"fullname": "sqlglot.generator.Generator.__init__", "modulename": "sqlglot.generator", "qualname": "Generator.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">time_mapping</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">time_trie</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">pretty</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">quote_start</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">quote_end</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">identifier_start</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">identifier_end</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">identify</span><span class=\"o\">=</span><span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">normalize</span><span class=\"o\">=</span><span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">string_escape</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">identifier_escape</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">pad</span><span class=\"o\">=</span><span class=\"mi\">2</span>,</span><span class=\"param\">\t<span class=\"n\">indent</span><span class=\"o\">=</span><span class=\"mi\">2</span>,</span><span class=\"param\">\t<span class=\"n\">index_offset</span><span class=\"o\">=</span><span class=\"mi\">0</span>,</span><span class=\"param\">\t<span class=\"n\">unnest_column_only</span><span class=\"o\">=</span><span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">alias_post_tablesample</span><span class=\"o\">=</span><span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">normalize_functions</span><span class=\"o\">=</span><span class=\"s1\">'upper'</span>,</span><span class=\"param\">\t<span class=\"n\">unsupported_level</span><span class=\"o\">=<</span><span class=\"n\">ErrorLevel</span><span class=\"o\">.</span><span class=\"n\">WARN</span><span class=\"p\">:</span> <span class=\"s1\">'WARN'</span><span class=\"o\">></span>,</span><span class=\"param\">\t<span class=\"n\">null_ordering</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">max_unsupported</span><span class=\"o\">=</span><span class=\"mi\">3</span>,</span><span class=\"param\">\t<span class=\"n\">leading_comma</span><span class=\"o\">=</span><span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">max_text_width</span><span class=\"o\">=</span><span class=\"mi\">80</span>,</span><span class=\"param\">\t<span class=\"n\">comments</span><span class=\"o\">=</span><span class=\"kc\">True</span></span>)</span>"}, "sqlglot.generator.Generator.generate": {"fullname": "sqlglot.generator.Generator.generate", "modulename": "sqlglot.generator", "qualname": "Generator.generate", "kind": "function", "doc": "<p>Generates a SQL string by interpreting the given syntax tree.</p>\n\n<p>Args\n expression: the syntax tree.</p>\n\n<p>Returns\n the SQL string.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.unsupported": {"fullname": "sqlglot.generator.Generator.unsupported", "modulename": "sqlglot.generator", "qualname": "Generator.unsupported", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">message</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.sep": {"fullname": "sqlglot.generator.Generator.sep", "modulename": "sqlglot.generator", "qualname": "Generator.sep", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">' '</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.seg": {"fullname": "sqlglot.generator.Generator.seg", "modulename": "sqlglot.generator", "qualname": "Generator.seg", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">' '</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.pad_comment": {"fullname": "sqlglot.generator.Generator.pad_comment", "modulename": "sqlglot.generator", "qualname": "Generator.pad_comment", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">comment</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.maybe_comment": {"fullname": "sqlglot.generator.Generator.maybe_comment", "modulename": "sqlglot.generator", "qualname": "Generator.maybe_comment", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.wrap": {"fullname": "sqlglot.generator.Generator.wrap", "modulename": "sqlglot.generator", "qualname": "Generator.wrap", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span> <span class=\"o\">|</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.no_identify": {"fullname": "sqlglot.generator.Generator.no_identify", "modulename": "sqlglot.generator", "qualname": "Generator.no_identify", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">func</span><span class=\"p\">:</span> <span class=\"n\">Callable</span><span class=\"p\">[</span><span class=\"o\">...</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">]</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">args</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.normalize_func": {"fullname": "sqlglot.generator.Generator.normalize_func", "modulename": "sqlglot.generator", "qualname": "Generator.normalize_func", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.indent": {"fullname": "sqlglot.generator.Generator.indent", "modulename": "sqlglot.generator", "qualname": "Generator.indent", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">level</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">0</span>,</span><span class=\"param\">\t<span class=\"n\">pad</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">skip_first</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">skip_last</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.sql": {"fullname": "sqlglot.generator.Generator.sql", "modulename": "sqlglot.generator", "qualname": "Generator.sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">key</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">comment</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.uncache_sql": {"fullname": "sqlglot.generator.Generator.uncache_sql", "modulename": "sqlglot.generator", "qualname": "Generator.uncache_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Uncache</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.cache_sql": {"fullname": "sqlglot.generator.Generator.cache_sql", "modulename": "sqlglot.generator", "qualname": "Generator.cache_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Cache</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.characterset_sql": {"fullname": "sqlglot.generator.Generator.characterset_sql", "modulename": "sqlglot.generator", "qualname": "Generator.characterset_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CharacterSet</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.column_sql": {"fullname": "sqlglot.generator.Generator.column_sql", "modulename": "sqlglot.generator", "qualname": "Generator.column_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.columndef_sql": {"fullname": "sqlglot.generator.Generator.columndef_sql", "modulename": "sqlglot.generator", "qualname": "Generator.columndef_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ColumnDef</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.columnconstraint_sql": {"fullname": "sqlglot.generator.Generator.columnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.columnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.autoincrementcolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.checkcolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.checkcolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CheckColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.commentcolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.commentcolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CommentColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.collatecolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.collatecolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CollateColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.encodecolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.encodecolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">EncodeColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.defaultcolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.defaultcolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DefaultColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.generatedasidentitycolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">GeneratedAsIdentityColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.notnullcolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.notnullcolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">NotNullColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.primarykeycolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.primarykeycolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">PrimaryKeyColumnConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"fullname": "sqlglot.generator.Generator.uniquecolumnconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.uniquecolumnconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.create_sql": {"fullname": "sqlglot.generator.Generator.create_sql", "modulename": "sqlglot.generator", "qualname": "Generator.create_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Create</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.describe_sql": {"fullname": "sqlglot.generator.Generator.describe_sql", "modulename": "sqlglot.generator", "qualname": "Generator.describe_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Describe</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.prepend_ctes": {"fullname": "sqlglot.generator.Generator.prepend_ctes", "modulename": "sqlglot.generator", "qualname": "Generator.prepend_ctes", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>, </span><span class=\"param\"><span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.with_sql": {"fullname": "sqlglot.generator.Generator.with_sql", "modulename": "sqlglot.generator", "qualname": "Generator.with_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">With</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.cte_sql": {"fullname": "sqlglot.generator.Generator.cte_sql", "modulename": "sqlglot.generator", "qualname": "Generator.cte_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CTE</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.tablealias_sql": {"fullname": "sqlglot.generator.Generator.tablealias_sql", "modulename": "sqlglot.generator", "qualname": "Generator.tablealias_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">TableAlias</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitstring_sql": {"fullname": "sqlglot.generator.Generator.bitstring_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitstring_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitString</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.hexstring_sql": {"fullname": "sqlglot.generator.Generator.hexstring_sql", "modulename": "sqlglot.generator", "qualname": "Generator.hexstring_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">HexString</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.datatype_sql": {"fullname": "sqlglot.generator.Generator.datatype_sql", "modulename": "sqlglot.generator", "qualname": "Generator.datatype_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.directory_sql": {"fullname": "sqlglot.generator.Generator.directory_sql", "modulename": "sqlglot.generator", "qualname": "Generator.directory_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Directory</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.delete_sql": {"fullname": "sqlglot.generator.Generator.delete_sql", "modulename": "sqlglot.generator", "qualname": "Generator.delete_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Delete</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.drop_sql": {"fullname": "sqlglot.generator.Generator.drop_sql", "modulename": "sqlglot.generator", "qualname": "Generator.drop_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Drop</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.except_sql": {"fullname": "sqlglot.generator.Generator.except_sql", "modulename": "sqlglot.generator", "qualname": "Generator.except_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Except</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.except_op": {"fullname": "sqlglot.generator.Generator.except_op", "modulename": "sqlglot.generator", "qualname": "Generator.except_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Except</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.fetch_sql": {"fullname": "sqlglot.generator.Generator.fetch_sql", "modulename": "sqlglot.generator", "qualname": "Generator.fetch_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Fetch</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.filter_sql": {"fullname": "sqlglot.generator.Generator.filter_sql", "modulename": "sqlglot.generator", "qualname": "Generator.filter_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Filter</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.hint_sql": {"fullname": "sqlglot.generator.Generator.hint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.hint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Hint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.index_sql": {"fullname": "sqlglot.generator.Generator.index_sql", "modulename": "sqlglot.generator", "qualname": "Generator.index_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Index</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.identifier_sql": {"fullname": "sqlglot.generator.Generator.identifier_sql", "modulename": "sqlglot.generator", "qualname": "Generator.identifier_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Identifier</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.national_sql": {"fullname": "sqlglot.generator.Generator.national_sql", "modulename": "sqlglot.generator", "qualname": "Generator.national_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">National</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.partition_sql": {"fullname": "sqlglot.generator.Generator.partition_sql", "modulename": "sqlglot.generator", "qualname": "Generator.partition_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Partition</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.properties_sql": {"fullname": "sqlglot.generator.Generator.properties_sql", "modulename": "sqlglot.generator", "qualname": "Generator.properties_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.root_properties": {"fullname": "sqlglot.generator.Generator.root_properties", "modulename": "sqlglot.generator", "qualname": "Generator.root_properties", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">properties</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.properties": {"fullname": "sqlglot.generator.Generator.properties", "modulename": "sqlglot.generator", "qualname": "Generator.properties", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">properties</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span>,</span><span class=\"param\">\t<span class=\"n\">prefix</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">''</span>,</span><span class=\"param\">\t<span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">', '</span>,</span><span class=\"param\">\t<span class=\"n\">suffix</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">''</span>,</span><span class=\"param\">\t<span class=\"n\">wrapped</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.with_properties": {"fullname": "sqlglot.generator.Generator.with_properties", "modulename": "sqlglot.generator", "qualname": "Generator.with_properties", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">properties</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.locate_properties": {"fullname": "sqlglot.generator.Generator.locate_properties", "modulename": "sqlglot.generator", "qualname": "Generator.locate_properties", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">properties</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Properties</span><span class=\"o\">.</span><span class=\"n\">Location</span><span class=\"p\">,</span> <span class=\"nb\">list</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Property</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.property_sql": {"fullname": "sqlglot.generator.Generator.property_sql", "modulename": "sqlglot.generator", "qualname": "Generator.property_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Property</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.likeproperty_sql": {"fullname": "sqlglot.generator.Generator.likeproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.likeproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">LikeProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.fallbackproperty_sql": {"fullname": "sqlglot.generator.Generator.fallbackproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.fallbackproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">FallbackProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.journalproperty_sql": {"fullname": "sqlglot.generator.Generator.journalproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.journalproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">JournalProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.freespaceproperty_sql": {"fullname": "sqlglot.generator.Generator.freespaceproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.freespaceproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">FreespaceProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"fullname": "sqlglot.generator.Generator.afterjournalproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.afterjournalproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">AfterJournalProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.checksumproperty_sql": {"fullname": "sqlglot.generator.Generator.checksumproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.checksumproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ChecksumProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"fullname": "sqlglot.generator.Generator.mergeblockratioproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.mergeblockratioproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">MergeBlockRatioProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"fullname": "sqlglot.generator.Generator.datablocksizeproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.datablocksizeproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataBlocksizeProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"fullname": "sqlglot.generator.Generator.blockcompressionproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.blockcompressionproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BlockCompressionProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"fullname": "sqlglot.generator.Generator.isolatedloadingproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.isolatedloadingproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">IsolatedLoadingProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.insert_sql": {"fullname": "sqlglot.generator.Generator.insert_sql", "modulename": "sqlglot.generator", "qualname": "Generator.insert_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Insert</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.intersect_sql": {"fullname": "sqlglot.generator.Generator.intersect_sql", "modulename": "sqlglot.generator", "qualname": "Generator.intersect_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Intersect</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.intersect_op": {"fullname": "sqlglot.generator.Generator.intersect_op", "modulename": "sqlglot.generator", "qualname": "Generator.intersect_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Intersect</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.introducer_sql": {"fullname": "sqlglot.generator.Generator.introducer_sql", "modulename": "sqlglot.generator", "qualname": "Generator.introducer_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Introducer</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.pseudotype_sql": {"fullname": "sqlglot.generator.Generator.pseudotype_sql", "modulename": "sqlglot.generator", "qualname": "Generator.pseudotype_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">PseudoType</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"fullname": "sqlglot.generator.Generator.rowformatdelimitedproperty_sql", "modulename": "sqlglot.generator", "qualname": "Generator.rowformatdelimitedproperty_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">RowFormatDelimitedProperty</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.table_sql": {"fullname": "sqlglot.generator.Generator.table_sql", "modulename": "sqlglot.generator", "qualname": "Generator.table_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span>, </span><span class=\"param\"><span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">' AS '</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.tablesample_sql": {"fullname": "sqlglot.generator.Generator.tablesample_sql", "modulename": "sqlglot.generator", "qualname": "Generator.tablesample_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">TableSample</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.pivot_sql": {"fullname": "sqlglot.generator.Generator.pivot_sql", "modulename": "sqlglot.generator", "qualname": "Generator.pivot_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Pivot</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.tuple_sql": {"fullname": "sqlglot.generator.Generator.tuple_sql", "modulename": "sqlglot.generator", "qualname": "Generator.tuple_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Tuple</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.update_sql": {"fullname": "sqlglot.generator.Generator.update_sql", "modulename": "sqlglot.generator", "qualname": "Generator.update_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Update</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.values_sql": {"fullname": "sqlglot.generator.Generator.values_sql", "modulename": "sqlglot.generator", "qualname": "Generator.values_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Values</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.var_sql": {"fullname": "sqlglot.generator.Generator.var_sql", "modulename": "sqlglot.generator", "qualname": "Generator.var_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Var</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.into_sql": {"fullname": "sqlglot.generator.Generator.into_sql", "modulename": "sqlglot.generator", "qualname": "Generator.into_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Into</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.from_sql": {"fullname": "sqlglot.generator.Generator.from_sql", "modulename": "sqlglot.generator", "qualname": "Generator.from_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">From</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.group_sql": {"fullname": "sqlglot.generator.Generator.group_sql", "modulename": "sqlglot.generator", "qualname": "Generator.group_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Group</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.having_sql": {"fullname": "sqlglot.generator.Generator.having_sql", "modulename": "sqlglot.generator", "qualname": "Generator.having_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Having</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.join_sql": {"fullname": "sqlglot.generator.Generator.join_sql", "modulename": "sqlglot.generator", "qualname": "Generator.join_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Join</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.lambda_sql": {"fullname": "sqlglot.generator.Generator.lambda_sql", "modulename": "sqlglot.generator", "qualname": "Generator.lambda_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Lambda</span>,</span><span class=\"param\">\t<span class=\"n\">arrow_sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">'->'</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.lateral_sql": {"fullname": "sqlglot.generator.Generator.lateral_sql", "modulename": "sqlglot.generator", "qualname": "Generator.lateral_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Lateral</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.limit_sql": {"fullname": "sqlglot.generator.Generator.limit_sql", "modulename": "sqlglot.generator", "qualname": "Generator.limit_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Limit</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.offset_sql": {"fullname": "sqlglot.generator.Generator.offset_sql", "modulename": "sqlglot.generator", "qualname": "Generator.offset_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Offset</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.lock_sql": {"fullname": "sqlglot.generator.Generator.lock_sql", "modulename": "sqlglot.generator", "qualname": "Generator.lock_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Lock</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.literal_sql": {"fullname": "sqlglot.generator.Generator.literal_sql", "modulename": "sqlglot.generator", "qualname": "Generator.literal_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Literal</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.loaddata_sql": {"fullname": "sqlglot.generator.Generator.loaddata_sql", "modulename": "sqlglot.generator", "qualname": "Generator.loaddata_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">LoadData</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.null_sql": {"fullname": "sqlglot.generator.Generator.null_sql", "modulename": "sqlglot.generator", "qualname": "Generator.null_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.boolean_sql": {"fullname": "sqlglot.generator.Generator.boolean_sql", "modulename": "sqlglot.generator", "qualname": "Generator.boolean_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Boolean</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.order_sql": {"fullname": "sqlglot.generator.Generator.order_sql", "modulename": "sqlglot.generator", "qualname": "Generator.order_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Order</span>, </span><span class=\"param\"><span class=\"n\">flat</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.cluster_sql": {"fullname": "sqlglot.generator.Generator.cluster_sql", "modulename": "sqlglot.generator", "qualname": "Generator.cluster_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Cluster</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.distribute_sql": {"fullname": "sqlglot.generator.Generator.distribute_sql", "modulename": "sqlglot.generator", "qualname": "Generator.distribute_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Distribute</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.sort_sql": {"fullname": "sqlglot.generator.Generator.sort_sql", "modulename": "sqlglot.generator", "qualname": "Generator.sort_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Sort</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.ordered_sql": {"fullname": "sqlglot.generator.Generator.ordered_sql", "modulename": "sqlglot.generator", "qualname": "Generator.ordered_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Ordered</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.matchrecognize_sql": {"fullname": "sqlglot.generator.Generator.matchrecognize_sql", "modulename": "sqlglot.generator", "qualname": "Generator.matchrecognize_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">MatchRecognize</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.query_modifiers": {"fullname": "sqlglot.generator.Generator.query_modifiers", "modulename": "sqlglot.generator", "qualname": "Generator.query_modifiers", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">sqls</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.select_sql": {"fullname": "sqlglot.generator.Generator.select_sql", "modulename": "sqlglot.generator", "qualname": "Generator.select_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Select</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.schema_sql": {"fullname": "sqlglot.generator.Generator.schema_sql", "modulename": "sqlglot.generator", "qualname": "Generator.schema_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Schema</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.star_sql": {"fullname": "sqlglot.generator.Generator.star_sql", "modulename": "sqlglot.generator", "qualname": "Generator.star_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Star</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.structkwarg_sql": {"fullname": "sqlglot.generator.Generator.structkwarg_sql", "modulename": "sqlglot.generator", "qualname": "Generator.structkwarg_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">StructKwarg</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.parameter_sql": {"fullname": "sqlglot.generator.Generator.parameter_sql", "modulename": "sqlglot.generator", "qualname": "Generator.parameter_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Parameter</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.sessionparameter_sql": {"fullname": "sqlglot.generator.Generator.sessionparameter_sql", "modulename": "sqlglot.generator", "qualname": "Generator.sessionparameter_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">SessionParameter</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.placeholder_sql": {"fullname": "sqlglot.generator.Generator.placeholder_sql", "modulename": "sqlglot.generator", "qualname": "Generator.placeholder_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Placeholder</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.subquery_sql": {"fullname": "sqlglot.generator.Generator.subquery_sql", "modulename": "sqlglot.generator", "qualname": "Generator.subquery_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Subquery</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.qualify_sql": {"fullname": "sqlglot.generator.Generator.qualify_sql", "modulename": "sqlglot.generator", "qualname": "Generator.qualify_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Qualify</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.union_sql": {"fullname": "sqlglot.generator.Generator.union_sql", "modulename": "sqlglot.generator", "qualname": "Generator.union_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Union</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.union_op": {"fullname": "sqlglot.generator.Generator.union_op", "modulename": "sqlglot.generator", "qualname": "Generator.union_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Union</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.unnest_sql": {"fullname": "sqlglot.generator.Generator.unnest_sql", "modulename": "sqlglot.generator", "qualname": "Generator.unnest_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Unnest</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.where_sql": {"fullname": "sqlglot.generator.Generator.where_sql", "modulename": "sqlglot.generator", "qualname": "Generator.where_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Where</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.window_sql": {"fullname": "sqlglot.generator.Generator.window_sql", "modulename": "sqlglot.generator", "qualname": "Generator.window_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Window</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.partition_by_sql": {"fullname": "sqlglot.generator.Generator.partition_by_sql", "modulename": "sqlglot.generator", "qualname": "Generator.partition_by_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Window</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">MatchRecognize</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.window_spec_sql": {"fullname": "sqlglot.generator.Generator.window_spec_sql", "modulename": "sqlglot.generator", "qualname": "Generator.window_spec_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">WindowSpec</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.withingroup_sql": {"fullname": "sqlglot.generator.Generator.withingroup_sql", "modulename": "sqlglot.generator", "qualname": "Generator.withingroup_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">WithinGroup</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.between_sql": {"fullname": "sqlglot.generator.Generator.between_sql", "modulename": "sqlglot.generator", "qualname": "Generator.between_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Between</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bracket_sql": {"fullname": "sqlglot.generator.Generator.bracket_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bracket_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Bracket</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.all_sql": {"fullname": "sqlglot.generator.Generator.all_sql", "modulename": "sqlglot.generator", "qualname": "Generator.all_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">All</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.any_sql": {"fullname": "sqlglot.generator.Generator.any_sql", "modulename": "sqlglot.generator", "qualname": "Generator.any_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Any</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.exists_sql": {"fullname": "sqlglot.generator.Generator.exists_sql", "modulename": "sqlglot.generator", "qualname": "Generator.exists_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Exists</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.case_sql": {"fullname": "sqlglot.generator.Generator.case_sql", "modulename": "sqlglot.generator", "qualname": "Generator.case_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Case</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.constraint_sql": {"fullname": "sqlglot.generator.Generator.constraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.constraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Constraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.extract_sql": {"fullname": "sqlglot.generator.Generator.extract_sql", "modulename": "sqlglot.generator", "qualname": "Generator.extract_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Extract</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.trim_sql": {"fullname": "sqlglot.generator.Generator.trim_sql", "modulename": "sqlglot.generator", "qualname": "Generator.trim_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Trim</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.concat_sql": {"fullname": "sqlglot.generator.Generator.concat_sql", "modulename": "sqlglot.generator", "qualname": "Generator.concat_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Concat</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.check_sql": {"fullname": "sqlglot.generator.Generator.check_sql", "modulename": "sqlglot.generator", "qualname": "Generator.check_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Check</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.foreignkey_sql": {"fullname": "sqlglot.generator.Generator.foreignkey_sql", "modulename": "sqlglot.generator", "qualname": "Generator.foreignkey_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ForeignKey</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.primarykey_sql": {"fullname": "sqlglot.generator.Generator.primarykey_sql", "modulename": "sqlglot.generator", "qualname": "Generator.primarykey_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ForeignKey</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.unique_sql": {"fullname": "sqlglot.generator.Generator.unique_sql", "modulename": "sqlglot.generator", "qualname": "Generator.unique_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Unique</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.if_sql": {"fullname": "sqlglot.generator.Generator.if_sql", "modulename": "sqlglot.generator", "qualname": "Generator.if_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">If</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.in_sql": {"fullname": "sqlglot.generator.Generator.in_sql", "modulename": "sqlglot.generator", "qualname": "Generator.in_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">In</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.in_unnest_op": {"fullname": "sqlglot.generator.Generator.in_unnest_op", "modulename": "sqlglot.generator", "qualname": "Generator.in_unnest_op", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">unnest</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Unnest</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.interval_sql": {"fullname": "sqlglot.generator.Generator.interval_sql", "modulename": "sqlglot.generator", "qualname": "Generator.interval_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Interval</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.return_sql": {"fullname": "sqlglot.generator.Generator.return_sql", "modulename": "sqlglot.generator", "qualname": "Generator.return_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Return</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.reference_sql": {"fullname": "sqlglot.generator.Generator.reference_sql", "modulename": "sqlglot.generator", "qualname": "Generator.reference_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Reference</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.anonymous_sql": {"fullname": "sqlglot.generator.Generator.anonymous_sql", "modulename": "sqlglot.generator", "qualname": "Generator.anonymous_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Anonymous</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.paren_sql": {"fullname": "sqlglot.generator.Generator.paren_sql", "modulename": "sqlglot.generator", "qualname": "Generator.paren_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Paren</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.neg_sql": {"fullname": "sqlglot.generator.Generator.neg_sql", "modulename": "sqlglot.generator", "qualname": "Generator.neg_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Neg</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.not_sql": {"fullname": "sqlglot.generator.Generator.not_sql", "modulename": "sqlglot.generator", "qualname": "Generator.not_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Not</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.alias_sql": {"fullname": "sqlglot.generator.Generator.alias_sql", "modulename": "sqlglot.generator", "qualname": "Generator.alias_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Alias</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.aliases_sql": {"fullname": "sqlglot.generator.Generator.aliases_sql", "modulename": "sqlglot.generator", "qualname": "Generator.aliases_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Aliases</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.attimezone_sql": {"fullname": "sqlglot.generator.Generator.attimezone_sql", "modulename": "sqlglot.generator", "qualname": "Generator.attimezone_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">AtTimeZone</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.add_sql": {"fullname": "sqlglot.generator.Generator.add_sql", "modulename": "sqlglot.generator", "qualname": "Generator.add_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Add</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.and_sql": {"fullname": "sqlglot.generator.Generator.and_sql", "modulename": "sqlglot.generator", "qualname": "Generator.and_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">And</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.connector_sql": {"fullname": "sqlglot.generator.Generator.connector_sql", "modulename": "sqlglot.generator", "qualname": "Generator.connector_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Connector</span>, </span><span class=\"param\"><span class=\"n\">op</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitwiseand_sql": {"fullname": "sqlglot.generator.Generator.bitwiseand_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitwiseand_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitwiseAnd</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"fullname": "sqlglot.generator.Generator.bitwiseleftshift_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitwiseleftshift_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitwiseLeftShift</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitwisenot_sql": {"fullname": "sqlglot.generator.Generator.bitwisenot_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitwisenot_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitwiseNot</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitwiseor_sql": {"fullname": "sqlglot.generator.Generator.bitwiseor_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitwiseor_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitwiseOr</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"fullname": "sqlglot.generator.Generator.bitwiserightshift_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitwiserightshift_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitwiseRightShift</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.bitwisexor_sql": {"fullname": "sqlglot.generator.Generator.bitwisexor_sql", "modulename": "sqlglot.generator", "qualname": "Generator.bitwisexor_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">BitwiseXor</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.cast_sql": {"fullname": "sqlglot.generator.Generator.cast_sql", "modulename": "sqlglot.generator", "qualname": "Generator.cast_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Cast</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.currentdate_sql": {"fullname": "sqlglot.generator.Generator.currentdate_sql", "modulename": "sqlglot.generator", "qualname": "Generator.currentdate_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">CurrentDate</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.collate_sql": {"fullname": "sqlglot.generator.Generator.collate_sql", "modulename": "sqlglot.generator", "qualname": "Generator.collate_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Collate</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.command_sql": {"fullname": "sqlglot.generator.Generator.command_sql", "modulename": "sqlglot.generator", "qualname": "Generator.command_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Command</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.transaction_sql": {"fullname": "sqlglot.generator.Generator.transaction_sql", "modulename": "sqlglot.generator", "qualname": "Generator.transaction_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">_</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.commit_sql": {"fullname": "sqlglot.generator.Generator.commit_sql", "modulename": "sqlglot.generator", "qualname": "Generator.commit_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Commit</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.rollback_sql": {"fullname": "sqlglot.generator.Generator.rollback_sql", "modulename": "sqlglot.generator", "qualname": "Generator.rollback_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Rollback</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.altercolumn_sql": {"fullname": "sqlglot.generator.Generator.altercolumn_sql", "modulename": "sqlglot.generator", "qualname": "Generator.altercolumn_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">AlterColumn</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.renametable_sql": {"fullname": "sqlglot.generator.Generator.renametable_sql", "modulename": "sqlglot.generator", "qualname": "Generator.renametable_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">RenameTable</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.altertable_sql": {"fullname": "sqlglot.generator.Generator.altertable_sql", "modulename": "sqlglot.generator", "qualname": "Generator.altertable_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">AlterTable</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.droppartition_sql": {"fullname": "sqlglot.generator.Generator.droppartition_sql", "modulename": "sqlglot.generator", "qualname": "Generator.droppartition_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DropPartition</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.addconstraint_sql": {"fullname": "sqlglot.generator.Generator.addconstraint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.addconstraint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">AddConstraint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.distinct_sql": {"fullname": "sqlglot.generator.Generator.distinct_sql", "modulename": "sqlglot.generator", "qualname": "Generator.distinct_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Distinct</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.ignorenulls_sql": {"fullname": "sqlglot.generator.Generator.ignorenulls_sql", "modulename": "sqlglot.generator", "qualname": "Generator.ignorenulls_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">IgnoreNulls</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.respectnulls_sql": {"fullname": "sqlglot.generator.Generator.respectnulls_sql", "modulename": "sqlglot.generator", "qualname": "Generator.respectnulls_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">RespectNulls</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.intdiv_sql": {"fullname": "sqlglot.generator.Generator.intdiv_sql", "modulename": "sqlglot.generator", "qualname": "Generator.intdiv_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">IntDiv</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.dpipe_sql": {"fullname": "sqlglot.generator.Generator.dpipe_sql", "modulename": "sqlglot.generator", "qualname": "Generator.dpipe_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DPipe</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.div_sql": {"fullname": "sqlglot.generator.Generator.div_sql", "modulename": "sqlglot.generator", "qualname": "Generator.div_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Div</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.distance_sql": {"fullname": "sqlglot.generator.Generator.distance_sql", "modulename": "sqlglot.generator", "qualname": "Generator.distance_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Distance</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.dot_sql": {"fullname": "sqlglot.generator.Generator.dot_sql", "modulename": "sqlglot.generator", "qualname": "Generator.dot_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Dot</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.eq_sql": {"fullname": "sqlglot.generator.Generator.eq_sql", "modulename": "sqlglot.generator", "qualname": "Generator.eq_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">EQ</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.escape_sql": {"fullname": "sqlglot.generator.Generator.escape_sql", "modulename": "sqlglot.generator", "qualname": "Generator.escape_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Escape</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.glob_sql": {"fullname": "sqlglot.generator.Generator.glob_sql", "modulename": "sqlglot.generator", "qualname": "Generator.glob_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Glob</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.gt_sql": {"fullname": "sqlglot.generator.Generator.gt_sql", "modulename": "sqlglot.generator", "qualname": "Generator.gt_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">GT</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.gte_sql": {"fullname": "sqlglot.generator.Generator.gte_sql", "modulename": "sqlglot.generator", "qualname": "Generator.gte_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">GTE</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.ilike_sql": {"fullname": "sqlglot.generator.Generator.ilike_sql", "modulename": "sqlglot.generator", "qualname": "Generator.ilike_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ILike</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.is_sql": {"fullname": "sqlglot.generator.Generator.is_sql", "modulename": "sqlglot.generator", "qualname": "Generator.is_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Is</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.like_sql": {"fullname": "sqlglot.generator.Generator.like_sql", "modulename": "sqlglot.generator", "qualname": "Generator.like_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Like</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.similarto_sql": {"fullname": "sqlglot.generator.Generator.similarto_sql", "modulename": "sqlglot.generator", "qualname": "Generator.similarto_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">SimilarTo</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.lt_sql": {"fullname": "sqlglot.generator.Generator.lt_sql", "modulename": "sqlglot.generator", "qualname": "Generator.lt_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">LT</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.lte_sql": {"fullname": "sqlglot.generator.Generator.lte_sql", "modulename": "sqlglot.generator", "qualname": "Generator.lte_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">LTE</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.mod_sql": {"fullname": "sqlglot.generator.Generator.mod_sql", "modulename": "sqlglot.generator", "qualname": "Generator.mod_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Mod</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.mul_sql": {"fullname": "sqlglot.generator.Generator.mul_sql", "modulename": "sqlglot.generator", "qualname": "Generator.mul_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Mul</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.neq_sql": {"fullname": "sqlglot.generator.Generator.neq_sql", "modulename": "sqlglot.generator", "qualname": "Generator.neq_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">NEQ</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.nullsafeeq_sql": {"fullname": "sqlglot.generator.Generator.nullsafeeq_sql", "modulename": "sqlglot.generator", "qualname": "Generator.nullsafeeq_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">NullSafeEQ</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.nullsafeneq_sql": {"fullname": "sqlglot.generator.Generator.nullsafeneq_sql", "modulename": "sqlglot.generator", "qualname": "Generator.nullsafeneq_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">NullSafeNEQ</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.or_sql": {"fullname": "sqlglot.generator.Generator.or_sql", "modulename": "sqlglot.generator", "qualname": "Generator.or_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Or</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.slice_sql": {"fullname": "sqlglot.generator.Generator.slice_sql", "modulename": "sqlglot.generator", "qualname": "Generator.slice_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Slice</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.sub_sql": {"fullname": "sqlglot.generator.Generator.sub_sql", "modulename": "sqlglot.generator", "qualname": "Generator.sub_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Sub</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.trycast_sql": {"fullname": "sqlglot.generator.Generator.trycast_sql", "modulename": "sqlglot.generator", "qualname": "Generator.trycast_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">TryCast</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.use_sql": {"fullname": "sqlglot.generator.Generator.use_sql", "modulename": "sqlglot.generator", "qualname": "Generator.use_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Use</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.binary": {"fullname": "sqlglot.generator.Generator.binary", "modulename": "sqlglot.generator", "qualname": "Generator.binary", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Binary</span>, </span><span class=\"param\"><span class=\"n\">op</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.function_fallback_sql": {"fullname": "sqlglot.generator.Generator.function_fallback_sql", "modulename": "sqlglot.generator", "qualname": "Generator.function_fallback_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Func</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.format_args": {"fullname": "sqlglot.generator.Generator.format_args", "modulename": "sqlglot.generator", "qualname": "Generator.format_args", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.text_width": {"fullname": "sqlglot.generator.Generator.text_width", "modulename": "sqlglot.generator", "qualname": "Generator.text_width", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Iterable</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">int</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.format_time": {"fullname": "sqlglot.generator.Generator.format_time", "modulename": "sqlglot.generator", "qualname": "Generator.format_time", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.expressions": {"fullname": "sqlglot.generator.Generator.expressions", "modulename": "sqlglot.generator", "qualname": "Generator.expressions", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">key</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">flat</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">indent</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">', '</span>,</span><span class=\"param\">\t<span class=\"n\">prefix</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">''</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.op_expressions": {"fullname": "sqlglot.generator.Generator.op_expressions", "modulename": "sqlglot.generator", "qualname": "Generator.op_expressions", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">op</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">flat</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.naked_property": {"fullname": "sqlglot.generator.Generator.naked_property", "modulename": "sqlglot.generator", "qualname": "Generator.naked_property", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Property</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.set_operation": {"fullname": "sqlglot.generator.Generator.set_operation", "modulename": "sqlglot.generator", "qualname": "Generator.set_operation", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>, </span><span class=\"param\"><span class=\"n\">op</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.tag_sql": {"fullname": "sqlglot.generator.Generator.tag_sql", "modulename": "sqlglot.generator", "qualname": "Generator.tag_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Tag</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.token_sql": {"fullname": "sqlglot.generator.Generator.token_sql", "modulename": "sqlglot.generator", "qualname": "Generator.token_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">token_type</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">TokenType</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"fullname": "sqlglot.generator.Generator.userdefinedfunction_sql", "modulename": "sqlglot.generator", "qualname": "Generator.userdefinedfunction_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">UserDefinedFunction</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"fullname": "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql", "modulename": "sqlglot.generator", "qualname": "Generator.userdefinedfunctionkwarg_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">UserDefinedFunctionKwarg</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.joinhint_sql": {"fullname": "sqlglot.generator.Generator.joinhint_sql", "modulename": "sqlglot.generator", "qualname": "Generator.joinhint_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">JoinHint</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.kwarg_sql": {"fullname": "sqlglot.generator.Generator.kwarg_sql", "modulename": "sqlglot.generator", "qualname": "Generator.kwarg_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Kwarg</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.when_sql": {"fullname": "sqlglot.generator.Generator.when_sql", "modulename": "sqlglot.generator", "qualname": "Generator.when_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">When</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.generator.Generator.merge_sql": {"fullname": "sqlglot.generator.Generator.merge_sql", "modulename": "sqlglot.generator", "qualname": "Generator.merge_sql", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Merge</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper": {"fullname": "sqlglot.helper", "modulename": "sqlglot.helper", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.helper.AutoName": {"fullname": "sqlglot.helper.AutoName", "modulename": "sqlglot.helper", "qualname": "AutoName", "kind": "class", "doc": "<p>This is used for creating enum classes where <code>auto()</code> is the string form of the corresponding value's name.</p>\n", "bases": "enum.Enum"}, "sqlglot.helper.seq_get": {"fullname": "sqlglot.helper.seq_get", "modulename": "sqlglot.helper", "qualname": "seq_get", "kind": "function", "doc": "<p>Returns the value in <code>seq</code> at position <code>index</code>, or <code>None</code> if <code>index</code> is out of bounds.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">seq</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">]</span>, </span><span class=\"param\"><span class=\"n\">index</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.ensure_list": {"fullname": "sqlglot.helper.ensure_list", "modulename": "sqlglot.helper", "qualname": "ensure_list", "kind": "function", "doc": "<p>Ensures that a value is a list, otherwise casts or wraps it into one.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>value:</strong> the value of interest.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The value cast as a list if it's a list or a tuple, or else the value wrapped in a list.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">value</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.helper.ensure_collection": {"fullname": "sqlglot.helper.ensure_collection", "modulename": "sqlglot.helper", "qualname": "ensure_collection", "kind": "function", "doc": "<p>Ensures that a value is a collection (excluding <code>str</code> and <code>bytes</code>), otherwise wraps it into a list.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>value:</strong> the value of interest.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The value if it's a collection, or else the value wrapped in a list.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">value</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.helper.csv": {"fullname": "sqlglot.helper.csv", "modulename": "sqlglot.helper", "qualname": "csv", "kind": "function", "doc": "<p>Formats any number of string arguments as CSV.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>args:</strong> the string arguments to format.</li>\n<li><strong>sep:</strong> the argument separator.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The arguments formatted as a CSV string.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"o\">*</span><span class=\"n\">args</span>, </span><span class=\"param\"><span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">=</span> <span class=\"s1\">', '</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.subclasses": {"fullname": "sqlglot.helper.subclasses", "modulename": "sqlglot.helper", "qualname": "subclasses", "kind": "function", "doc": "<p>Returns all subclasses for a collection of classes, possibly excluding some of them.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>module_name:</strong> the name of the module to search for subclasses in.</li>\n<li><strong>classes:</strong> class(es) we want to find the subclasses of.</li>\n<li><strong>exclude:</strong> class(es) we want to exclude from the returned list.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The target subclasses.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">module_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">classes</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Type</span><span class=\"p\">,</span> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"n\">Type</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">]]</span>,</span><span class=\"param\">\t<span class=\"n\">exclude</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Type</span><span class=\"p\">,</span> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"n\">Type</span><span class=\"p\">,</span> <span class=\"o\">...</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"p\">()</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Type</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.apply_index_offset": {"fullname": "sqlglot.helper.apply_index_offset", "modulename": "sqlglot.helper", "qualname": "apply_index_offset", "kind": "function", "doc": "<p>Applies an offset to a given integer literal expression.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expressions:</strong> the expression the offset will be applied to, wrapped in a list.</li>\n<li><strong>offset:</strong> the offset that will be applied.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The original expression with the offset applied to it, wrapped in a list. If the provided\n <code>expressions</code> argument contains more than one expressions, it's returned unaffected.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expressions</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]]</span>, </span><span class=\"param\"><span class=\"n\">offset</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.camel_to_snake_case": {"fullname": "sqlglot.helper.camel_to_snake_case", "modulename": "sqlglot.helper", "qualname": "camel_to_snake_case", "kind": "function", "doc": "<p>Converts <code>name</code> from camelCase to snake_case and returns the result.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.while_changing": {"fullname": "sqlglot.helper.while_changing", "modulename": "sqlglot.helper", "qualname": "while_changing", "kind": "function", "doc": "<p>Applies a transformation to a given expression until a fix point is reached.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression to be transformed.</li>\n<li><strong>func:</strong> the transformation to be applied.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The transformed expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">func</span><span class=\"p\">:</span> <span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]],</span> <span class=\"o\">~</span><span class=\"n\">E</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"o\">~</span><span class=\"n\">E</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.tsort": {"fullname": "sqlglot.helper.tsort", "modulename": "sqlglot.helper", "qualname": "tsort", "kind": "function", "doc": "<p>Sorts a given directed acyclic graph in topological order.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>dag:</strong> the graph to be sorted.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A list that contains all of the graph's nodes in topological order.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">dag</span><span class=\"p\">:</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.open_file": {"fullname": "sqlglot.helper.open_file", "modulename": "sqlglot.helper", "qualname": "open_file", "kind": "function", "doc": "<p>Open a file that may be compressed as gzip and return it in universal newline mode.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">file_name</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <class 'TextIO'>:</span></span>", "funcdef": "def"}, "sqlglot.helper.csv_reader": {"fullname": "sqlglot.helper.csv_reader", "modulename": "sqlglot.helper", "qualname": "csv_reader", "kind": "function", "doc": "<p>Returns a csv reader given the expression <code>READ_CSV(name, ['delimiter', '|', ...])</code>.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>read_csv:</strong> a <code>ReadCSV</code> function call</li>\n</ul>\n\n<h6 id=\"yields\">Yields:</h6>\n\n<blockquote>\n <p>A python csv reader.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">read_csv</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">ReadCSV</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Any</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.find_new_name": {"fullname": "sqlglot.helper.find_new_name", "modulename": "sqlglot.helper", "qualname": "find_new_name", "kind": "function", "doc": "<p>Searches for a new name.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>taken:</strong> a collection of taken names.</li>\n<li><strong>base:</strong> base name to alter.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The new, available name.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">taken</span><span class=\"p\">:</span> <span class=\"n\">Collection</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>, </span><span class=\"param\"><span class=\"n\">base</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.object_to_dict": {"fullname": "sqlglot.helper.object_to_dict", "modulename": "sqlglot.helper", "qualname": "object_to_dict", "kind": "function", "doc": "<p>Returns a dictionary created from an object's attributes.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">obj</span><span class=\"p\">:</span> <span class=\"n\">Any</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Dict</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.split_num_words": {"fullname": "sqlglot.helper.split_num_words", "modulename": "sqlglot.helper", "qualname": "split_num_words", "kind": "function", "doc": "<p>Perform a split on a value and return N words as a result with <code>None</code> used for words that don't exist.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>value:</strong> the value to be split.</li>\n<li><strong>sep:</strong> the value to use to split on.</li>\n<li><strong>min_num_words:</strong> the minimum number of words that are going to be in the result.</li>\n<li><strong>fill_from_start:</strong> indicates that if <code>None</code> values should be inserted at the start or end of the list.</li>\n</ul>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">split_num_words</span><span class=\"p\">(</span><span class=\"s2\">"db.table"</span><span class=\"p\">,</span> <span class=\"s2\">"."</span><span class=\"p\">,</span> <span class=\"mi\">3</span><span class=\"p\">)</span>\n<span class=\"go\">[None, 'db', 'table']</span>\n<span class=\"gp\">>>> </span><span class=\"n\">split_num_words</span><span class=\"p\">(</span><span class=\"s2\">"db.table"</span><span class=\"p\">,</span> <span class=\"s2\">"."</span><span class=\"p\">,</span> <span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"n\">fill_from_start</span><span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">)</span>\n<span class=\"go\">['db', 'table', None]</span>\n<span class=\"gp\">>>> </span><span class=\"n\">split_num_words</span><span class=\"p\">(</span><span class=\"s2\">"db.table"</span><span class=\"p\">,</span> <span class=\"s2\">"."</span><span class=\"p\">,</span> <span class=\"mi\">1</span><span class=\"p\">)</span>\n<span class=\"go\">['db', 'table']</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The list of words returned by <code>split</code>, possibly augmented by a number of <code>None</code> values.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">sep</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">min_num_words</span><span class=\"p\">:</span> <span class=\"nb\">int</span>,</span><span class=\"param\">\t<span class=\"n\">fill_from_start</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.is_iterable": {"fullname": "sqlglot.helper.is_iterable", "modulename": "sqlglot.helper", "qualname": "is_iterable", "kind": "function", "doc": "<p>Checks if the value is an iterable, excluding the types <code>str</code> and <code>bytes</code>.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">is_iterable</span><span class=\"p\">([</span><span class=\"mi\">1</span><span class=\"p\">,</span><span class=\"mi\">2</span><span class=\"p\">])</span>\n<span class=\"go\">True</span>\n<span class=\"gp\">>>> </span><span class=\"n\">is_iterable</span><span class=\"p\">(</span><span class=\"s2\">"test"</span><span class=\"p\">)</span>\n<span class=\"go\">False</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>value:</strong> the value to check if it is an iterable.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A <code>bool</code> value indicating if it is an iterable.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">value</span><span class=\"p\">:</span> <span class=\"n\">Any</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">bool</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.flatten": {"fullname": "sqlglot.helper.flatten", "modulename": "sqlglot.helper", "qualname": "flatten", "kind": "function", "doc": "<p>Flattens an iterable that can contain both iterable and non-iterable elements. Objects of\ntype <code>str</code> and <code>bytes</code> are not regarded as iterables.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"nb\">list</span><span class=\"p\">(</span><span class=\"n\">flatten</span><span class=\"p\">([[</span><span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"mi\">2</span><span class=\"p\">],</span> <span class=\"mi\">3</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"mi\">4</span><span class=\"p\">},</span> <span class=\"p\">(</span><span class=\"mi\">5</span><span class=\"p\">,</span> <span class=\"s2\">"bla"</span><span class=\"p\">)]))</span>\n<span class=\"go\">[1, 2, 3, 4, 5, 'bla']</span>\n<span class=\"gp\">>>> </span><span class=\"nb\">list</span><span class=\"p\">(</span><span class=\"n\">flatten</span><span class=\"p\">([</span><span class=\"mi\">1</span><span class=\"p\">,</span> <span class=\"mi\">2</span><span class=\"p\">,</span> <span class=\"mi\">3</span><span class=\"p\">]))</span>\n<span class=\"go\">[1, 2, 3]</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>values:</strong> the value to be flattened.</li>\n</ul>\n\n<h6 id=\"yields\">Yields:</h6>\n\n<blockquote>\n <p>Non-iterable elements in <code>values</code>.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">values</span><span class=\"p\">:</span> <span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">],</span> <span class=\"n\">Any</span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Iterator</span><span class=\"p\">[</span><span class=\"n\">Any</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.count_params": {"fullname": "sqlglot.helper.count_params", "modulename": "sqlglot.helper", "qualname": "count_params", "kind": "function", "doc": "<p>Returns the number of formal parameters expected by a function, without counting \"self\"\nand \"cls\", in case of instance and class methods, respectively.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">function</span><span class=\"p\">:</span> <span class=\"n\">Callable</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">int</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.dict_depth": {"fullname": "sqlglot.helper.dict_depth", "modulename": "sqlglot.helper", "qualname": "dict_depth", "kind": "function", "doc": "<p>Get the nesting depth of a dictionary.</p>\n\n<h6 id=\"for-example\">For example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">dict_depth</span><span class=\"p\">(</span><span class=\"kc\">None</span><span class=\"p\">)</span>\n<span class=\"go\">0</span>\n<span class=\"gp\">>>> </span><span class=\"n\">dict_depth</span><span class=\"p\">({})</span>\n<span class=\"go\">1</span>\n<span class=\"gp\">>>> </span><span class=\"n\">dict_depth</span><span class=\"p\">({</span><span class=\"s2\">"a"</span><span class=\"p\">:</span> <span class=\"s2\">"b"</span><span class=\"p\">})</span>\n<span class=\"go\">1</span>\n<span class=\"gp\">>>> </span><span class=\"n\">dict_depth</span><span class=\"p\">({</span><span class=\"s2\">"a"</span><span class=\"p\">:</span> <span class=\"p\">{}})</span>\n<span class=\"go\">2</span>\n<span class=\"gp\">>>> </span><span class=\"n\">dict_depth</span><span class=\"p\">({</span><span class=\"s2\">"a"</span><span class=\"p\">:</span> <span class=\"p\">{</span><span class=\"s2\">"b"</span><span class=\"p\">:</span> <span class=\"p\">{}}})</span>\n<span class=\"go\">3</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>d (dict):</strong> dictionary</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>int: depth</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">d</span><span class=\"p\">:</span> <span class=\"n\">Dict</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">int</span>:</span></span>", "funcdef": "def"}, "sqlglot.helper.first": {"fullname": "sqlglot.helper.first", "modulename": "sqlglot.helper", "qualname": "first", "kind": "function", "doc": "<p>Returns the first element from an iterable.</p>\n\n<p>Useful for sets.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">it</span><span class=\"p\">:</span> <span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"o\">~</span><span class=\"n\">T</span>:</span></span>", "funcdef": "def"}, "sqlglot.lineage": {"fullname": "sqlglot.lineage", "modulename": "sqlglot.lineage", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.lineage.Node": {"fullname": "sqlglot.lineage.Node", "modulename": "sqlglot.lineage", "qualname": "Node", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.lineage.Node.__init__": {"fullname": "sqlglot.lineage.Node.__init__", "modulename": "sqlglot.lineage", "qualname": "Node.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">name</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">source</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">downstream</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">lineage</span><span class=\"o\">.</span><span class=\"n\">Node</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"o\"><</span><span class=\"n\">factory</span><span class=\"o\">></span></span>)</span>"}, "sqlglot.lineage.Node.walk": {"fullname": "sqlglot.lineage.Node.walk", "modulename": "sqlglot.lineage", "qualname": "Node.walk", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Iterator</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">lineage</span><span class=\"o\">.</span><span class=\"n\">Node</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.lineage.Node.to_html": {"fullname": "sqlglot.lineage.Node.to_html", "modulename": "sqlglot.lineage", "qualname": "Node.to_html", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">opts</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">lineage</span><span class=\"o\">.</span><span class=\"n\">LineageHTML</span>:</span></span>", "funcdef": "def"}, "sqlglot.lineage.lineage": {"fullname": "sqlglot.lineage.lineage", "modulename": "sqlglot.lineage", "qualname": "lineage", "kind": "function", "doc": "<p>Build the lineage graph for a column of a SQL query.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>column:</strong> The column to build the lineage for.</li>\n<li><strong>sql:</strong> The SQL string or expression.</li>\n<li><strong>schema:</strong> The schema of tables.</li>\n<li><strong>sources:</strong> A mapping of queries which will be used to continue building lineage.</li>\n<li><strong>rules:</strong> Optimizer rules to apply, by default only qualifying tables and columns.</li>\n<li><strong>dialect:</strong> The dialect of input SQL.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A lineage node.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span>,</span><span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">schema</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">Schema</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">sources</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Subqueryable</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">rules</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"n\">Callable</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">qualify_tables</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d9240</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">qualify_columns</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d8820</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">expand_laterals</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b2b90</span><span class=\"o\">></span><span class=\"p\">)</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">lineage</span><span class=\"o\">.</span><span class=\"n\">Node</span>:</span></span>", "funcdef": "def"}, "sqlglot.lineage.LineageHTML": {"fullname": "sqlglot.lineage.LineageHTML", "modulename": "sqlglot.lineage", "qualname": "LineageHTML", "kind": "class", "doc": "<p>Node to HTML generator using vis.js.</p>\n\n<p><a href=\"https://visjs.github.io/vis-network/docs/network/\">https://visjs.github.io/vis-network/docs/network/</a></p>\n"}, "sqlglot.lineage.LineageHTML.__init__": {"fullname": "sqlglot.lineage.LineageHTML.__init__", "modulename": "sqlglot.lineage", "qualname": "LineageHTML.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">node</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">lineage</span><span class=\"o\">.</span><span class=\"n\">Node</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">imports</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">opts</span><span class=\"p\">:</span> <span class=\"n\">Any</span></span>)</span>"}, "sqlglot.optimizer": {"fullname": "sqlglot.optimizer", "modulename": "sqlglot.optimizer", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.annotate_types": {"fullname": "sqlglot.optimizer.annotate_types", "modulename": "sqlglot.optimizer.annotate_types", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.annotate_types.annotate_types": {"fullname": "sqlglot.optimizer.annotate_types.annotate_types", "modulename": "sqlglot.optimizer.annotate_types", "qualname": "annotate_types", "kind": "function", "doc": "<p>Recursively infer & annotate types in an expression syntax tree against a schema.\nAssumes that we've already executed the optimizer's qualify_columns step.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">schema</span> <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"s2\">"y"</span><span class=\"p\">:</span> <span class=\"p\">{</span><span class=\"s2\">"cola"</span><span class=\"p\">:</span> <span class=\"s2\">"SMALLINT"</span><span class=\"p\">}}</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"SELECT x.cola + 2.5 AS cola FROM (SELECT y.cola AS cola FROM y AS y) AS x"</span>\n<span class=\"gp\">>>> </span><span class=\"n\">annotated_expr</span> <span class=\"o\">=</span> <span class=\"n\">annotate_types</span><span class=\"p\">(</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">),</span> <span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"n\">schema</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">annotated_expr</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">type</span><span class=\"o\">.</span><span class=\"n\">this</span> <span class=\"c1\"># Get the type of "x.cola + 2.5 AS cola"</span>\n<span class=\"go\"><Type.DOUBLE: 'DOUBLE'></span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> Expression to annotate.</li>\n<li><strong>schema (dict|sqlglot.optimizer.Schema):</strong> Database schema.</li>\n<li><strong>annotators (dict):</strong> Maps expression type to corresponding annotation function.</li>\n<li><strong>coerces_to (dict):</strong> Maps expression type to set of types that it can be coerced into.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: expression annotated with types</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">annotators</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">coerces_to</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"fullname": "sqlglot.optimizer.annotate_types.TypeAnnotator", "modulename": "sqlglot.optimizer.annotate_types", "qualname": "TypeAnnotator", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"fullname": "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__", "modulename": "sqlglot.optimizer.annotate_types", "qualname": "TypeAnnotator.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">annotators</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">coerces_to</span><span class=\"o\">=</span><span class=\"kc\">None</span></span>)</span>"}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"fullname": "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate", "modulename": "sqlglot.optimizer.annotate_types", "qualname": "TypeAnnotator.annotate", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.canonicalize": {"fullname": "sqlglot.optimizer.canonicalize", "modulename": "sqlglot.optimizer.canonicalize", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.canonicalize.canonicalize": {"fullname": "sqlglot.optimizer.canonicalize.canonicalize", "modulename": "sqlglot.optimizer.canonicalize", "qualname": "canonicalize", "kind": "function", "doc": "<p>Converts a sql expression into a standard form.</p>\n\n<p>This method relies on annotate_types because many of the\nconversions rely on type inference.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> The expression to canonicalize.</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"fullname": "sqlglot.optimizer.canonicalize.add_text_to_concat", "modulename": "sqlglot.optimizer.canonicalize", "qualname": "add_text_to_concat", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">node</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.optimizer.canonicalize.coerce_type": {"fullname": "sqlglot.optimizer.canonicalize.coerce_type", "modulename": "sqlglot.optimizer.canonicalize", "qualname": "coerce_type", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">node</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"fullname": "sqlglot.optimizer.canonicalize.remove_redundant_casts", "modulename": "sqlglot.optimizer.canonicalize", "qualname": "remove_redundant_casts", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.optimizer.eliminate_ctes": {"fullname": "sqlglot.optimizer.eliminate_ctes", "modulename": "sqlglot.optimizer.eliminate_ctes", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"fullname": "sqlglot.optimizer.eliminate_ctes.eliminate_ctes", "modulename": "sqlglot.optimizer.eliminate_ctes", "qualname": "eliminate_ctes", "kind": "function", "doc": "<p>Remove unused CTEs from an expression.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"WITH y AS (SELECT a FROM x) SELECT a FROM z"</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">eliminate_ctes</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT a FROM z'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.eliminate_joins": {"fullname": "sqlglot.optimizer.eliminate_joins", "modulename": "sqlglot.optimizer.eliminate_joins", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"fullname": "sqlglot.optimizer.eliminate_joins.eliminate_joins", "modulename": "sqlglot.optimizer.eliminate_joins", "qualname": "eliminate_joins", "kind": "function", "doc": "<p>Remove unused joins from an expression.</p>\n\n<p>This only removes joins when we know that the join condition doesn't produce duplicate rows.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"SELECT x.a FROM x LEFT JOIN (SELECT DISTINCT y.b FROM y) AS y ON x.b = y.b"</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">eliminate_joins</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x.a FROM x'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.eliminate_joins.join_condition": {"fullname": "sqlglot.optimizer.eliminate_joins.join_condition", "modulename": "sqlglot.optimizer.eliminate_joins", "qualname": "join_condition", "kind": "function", "doc": "<p>Extract the join condition from a join expression.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li>join (exp.Join)</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>tuple[list[str], list[str], exp.Expression]:\n Tuple of (source key, join key, remaining predicate)</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">join</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.eliminate_subqueries": {"fullname": "sqlglot.optimizer.eliminate_subqueries", "modulename": "sqlglot.optimizer.eliminate_subqueries", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"fullname": "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries", "modulename": "sqlglot.optimizer.eliminate_subqueries", "qualname": "eliminate_subqueries", "kind": "function", "doc": "<p>Rewrite derived tables as CTES, deduplicating if possible.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a FROM (SELECT * FROM x) AS y"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">eliminate_subqueries</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"this-also-deduplicates-common-subqueries\">This also deduplicates common subqueries:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a FROM (SELECT * FROM x) AS y JOIN (SELECT * FROM x) AS z"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">eliminate_subqueries</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y JOIN y AS z'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.expand_laterals": {"fullname": "sqlglot.optimizer.expand_laterals", "modulename": "sqlglot.optimizer.expand_laterals", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"fullname": "sqlglot.optimizer.expand_laterals.expand_laterals", "modulename": "sqlglot.optimizer.expand_laterals", "qualname": "expand_laterals", "kind": "function", "doc": "<p>Expand lateral column alias references.</p>\n\n<p>This assumes <code>qualify_columns</code> as already run.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"SELECT x.a + 1 AS b, b + 1 AS c FROM x"</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expand_laterals</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x.a + 1 AS b, x.a + 1 + 1 AS c FROM x'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> expression to optimize</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.optimizer.expand_multi_table_selects": {"fullname": "sqlglot.optimizer.expand_multi_table_selects", "modulename": "sqlglot.optimizer.expand_multi_table_selects", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"fullname": "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects", "modulename": "sqlglot.optimizer.expand_multi_table_selects", "qualname": "expand_multi_table_selects", "kind": "function", "doc": "<p>Replace multiple FROM expressions with JOINs.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expand_multi_table_selects</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM x, y"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM x CROSS JOIN y'</span>\n</code></pre>\n </div>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.isolate_table_selects": {"fullname": "sqlglot.optimizer.isolate_table_selects", "modulename": "sqlglot.optimizer.isolate_table_selects", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"fullname": "sqlglot.optimizer.isolate_table_selects.isolate_table_selects", "modulename": "sqlglot.optimizer.isolate_table_selects", "qualname": "isolate_table_selects", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.lower_identities": {"fullname": "sqlglot.optimizer.lower_identities", "modulename": "sqlglot.optimizer.lower_identities", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.lower_identities.lower_identities": {"fullname": "sqlglot.optimizer.lower_identities.lower_identities", "modulename": "sqlglot.optimizer.lower_identities", "qualname": "lower_identities", "kind": "function", "doc": "<p>Convert all unquoted identifiers to lower case.</p>\n\n<p>Assuming the schema is all lower case, this essentially makes identifiers case-insensitive.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s1\">'SELECT Bar.A AS A FROM "Foo".Bar'</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">lower_identities</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT bar.a AS A FROM "Foo".bar'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to quote</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: quoted expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.merge_subqueries": {"fullname": "sqlglot.optimizer.merge_subqueries", "modulename": "sqlglot.optimizer.merge_subqueries", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"fullname": "sqlglot.optimizer.merge_subqueries.merge_subqueries", "modulename": "sqlglot.optimizer.merge_subqueries", "qualname": "merge_subqueries", "kind": "function", "doc": "<p>Rewrite sqlglot AST to merge derived tables into the outer query.</p>\n\n<p>This also merges CTEs if they are selected from only once.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a FROM (SELECT x.a FROM x) JOIN y"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">merge_subqueries</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT x.a FROM x JOIN y'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<p>If <code>leave_tables_isolated</code> is True, this will not merge inner queries into outer\nqueries if it would result in multiple table selects in a single query:</p>\n\n<blockquote>\n <blockquote>\n <blockquote>\n <p>expression = sqlglot.parse_one(\"SELECT a FROM (SELECT x.a FROM x) JOIN y\")\n merge_subqueries(expression, leave_tables_isolated=True).sql()\n 'SELECT a FROM (SELECT x.a FROM x) JOIN y'</p>\n </blockquote>\n </blockquote>\n</blockquote>\n\n<p>Inspired by <a href=\"https://dev.mysql.com/doc/refman/8.0/en/derived-table-optimization.html\">https://dev.mysql.com/doc/refman/8.0/en/derived-table-optimization.html</a></p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li>\n<li><strong>leave_tables_isolated (bool):</strong> </li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">leave_tables_isolated</span><span class=\"o\">=</span><span class=\"kc\">False</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"fullname": "sqlglot.optimizer.merge_subqueries.merge_ctes", "modulename": "sqlglot.optimizer.merge_subqueries", "qualname": "merge_ctes", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">leave_tables_isolated</span><span class=\"o\">=</span><span class=\"kc\">False</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"fullname": "sqlglot.optimizer.merge_subqueries.merge_derived_tables", "modulename": "sqlglot.optimizer.merge_subqueries", "qualname": "merge_derived_tables", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">leave_tables_isolated</span><span class=\"o\">=</span><span class=\"kc\">False</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.normalize": {"fullname": "sqlglot.optimizer.normalize", "modulename": "sqlglot.optimizer.normalize", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.normalize.normalize": {"fullname": "sqlglot.optimizer.normalize.normalize", "modulename": "sqlglot.optimizer.normalize", "qualname": "normalize", "kind": "function", "doc": "<p>Rewrite sqlglot AST into conjunctive normal form.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"(x AND y) OR z"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">normalize</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'(x OR z) AND (y OR z)'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to normalize</li>\n<li><strong>dnf (bool):</strong> rewrite in disjunctive normal form instead</li>\n<li><strong>max_distance (int):</strong> the maximal estimated distance from cnf to attempt conversion</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: normalized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">dnf</span><span class=\"o\">=</span><span class=\"kc\">False</span>, </span><span class=\"param\"><span class=\"n\">max_distance</span><span class=\"o\">=</span><span class=\"mi\">128</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.normalize.normalized": {"fullname": "sqlglot.optimizer.normalize.normalized", "modulename": "sqlglot.optimizer.normalize", "qualname": "normalized", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">dnf</span><span class=\"o\">=</span><span class=\"kc\">False</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.normalize.normalization_distance": {"fullname": "sqlglot.optimizer.normalize.normalization_distance", "modulename": "sqlglot.optimizer.normalize", "qualname": "normalization_distance", "kind": "function", "doc": "<p>The difference in the number of predicates between the current expression and the normalized form.</p>\n\n<p>This is used as an estimate of the cost of the conversion which is exponential in complexity.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"(a AND b) OR (c AND d)"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">normalization_distance</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span>\n<span class=\"go\">4</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to compute distance</li>\n<li><strong>dnf (bool):</strong> compute to dnf distance instead</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>int: difference</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">dnf</span><span class=\"o\">=</span><span class=\"kc\">False</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.normalize.distributive_law": {"fullname": "sqlglot.optimizer.normalize.distributive_law", "modulename": "sqlglot.optimizer.normalize", "qualname": "distributive_law", "kind": "function", "doc": "<p>x OR (y AND z) -> (x OR y) AND (x OR z)\n(x AND y) OR (y AND z) -> (x OR y) AND (x OR z) AND (y OR y) AND (y OR z)</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">dnf</span>, </span><span class=\"param\"><span class=\"n\">max_distance</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.optimize_joins": {"fullname": "sqlglot.optimizer.optimize_joins", "modulename": "sqlglot.optimizer.optimize_joins", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"fullname": "sqlglot.optimizer.optimize_joins.optimize_joins", "modulename": "sqlglot.optimizer.optimize_joins", "qualname": "optimize_joins", "kind": "function", "doc": "<p>Removes cross joins if possible and reorder joins based on predicate dependencies.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">from</span> <span class=\"nn\">sqlglot</span> <span class=\"kn\">import</span> <span class=\"n\">parse_one</span>\n<span class=\"gp\">>>> </span><span class=\"n\">optimize_joins</span><span class=\"p\">(</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM x CROSS JOIN y JOIN z ON x.a = z.a AND y.a = z.a"</span><span class=\"p\">))</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = z.a'</span>\n</code></pre>\n </div>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"fullname": "sqlglot.optimizer.optimize_joins.reorder_joins", "modulename": "sqlglot.optimizer.optimize_joins", "qualname": "reorder_joins", "kind": "function", "doc": "<p>Reorder joins by topological sort order based on predicate references.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.optimize_joins.normalize": {"fullname": "sqlglot.optimizer.optimize_joins.normalize", "modulename": "sqlglot.optimizer.optimize_joins", "qualname": "normalize", "kind": "function", "doc": "<p>Remove INNER and OUTER from joins as they are optional.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.optimize_joins.other_table_names": {"fullname": "sqlglot.optimizer.optimize_joins.other_table_names", "modulename": "sqlglot.optimizer.optimize_joins", "qualname": "other_table_names", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">join</span>, </span><span class=\"param\"><span class=\"n\">exclude</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.optimizer": {"fullname": "sqlglot.optimizer.optimizer", "modulename": "sqlglot.optimizer.optimizer", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.optimizer.optimize": {"fullname": "sqlglot.optimizer.optimizer.optimize", "modulename": "sqlglot.optimizer.optimizer", "qualname": "optimize", "kind": "function", "doc": "<p>Rewrite a sqlglot AST into an optimized form.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li>\n<li><strong>schema (dict|sqlglot.optimizer.Schema):</strong> database schema.\nThis can either be an instance of <code>sqlglot.optimizer.Schema</code> or a mapping in one of\nthe following forms:\n 1. {table: {col: type}}\n 2. {db: {table: {col: type}}}\n 3. {catalog: {db: {table: {col: type}}}}\nIf no schema is provided then the default schema defined at <code>sqlgot.schema</code> will be used</li>\n<li><strong>db (str):</strong> specify the default database, as might be set by a <code>USE DATABASE db</code> statement</li>\n<li><strong>catalog (str):</strong> specify the default catalog, as might be set by a <code>USE CATALOG c</code> statement</li>\n<li><strong>rules (sequence):</strong> sequence of optimizer rules to use.\nMany of the rules require tables and columns to be qualified.\nDo not remove qualify_tables or qualify_columns from the sequence of rules unless you know\nwhat you're doing!</li>\n<li><strong><em>*kwargs:</strong> If a rule has a keyword argument with a same name in *</em>kwargs, it will be passed in.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">db</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">catalog</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">rules</span><span class=\"o\">=</span><span class=\"p\">(</span><span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">lower_identities</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b2f80</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">qualify_tables</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d9240</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">isolate_table_selects</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b2e60</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">qualify_columns</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d8820</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">expand_laterals</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b2b90</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">validate_qualify_columns</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d8c10</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">pushdown_projections</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d85e0</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">normalize</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b0820</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">unnest_subqueries</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d9900</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">expand_multi_table_selects</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b2dd0</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">pushdown_predicates</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9d81f0</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">optimize_joins</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b3d00</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">eliminate_subqueries</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b2830</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">merge_subqueries</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b35b0</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">eliminate_joins</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b0700</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">eliminate_ctes</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b05e0</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">annotate_types</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a989480</span><span class=\"o\">></span><span class=\"p\">,</span> <span class=\"o\"><</span><span class=\"n\">function</span> <span class=\"n\">canonicalize</span> <span class=\"n\">at</span> <span class=\"mh\">0x7ff75a9b0160</span><span class=\"o\">></span><span class=\"p\">)</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_predicates": {"fullname": "sqlglot.optimizer.pushdown_predicates", "modulename": "sqlglot.optimizer.pushdown_predicates", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"fullname": "sqlglot.optimizer.pushdown_predicates.pushdown_predicates", "modulename": "sqlglot.optimizer.pushdown_predicates", "qualname": "pushdown_predicates", "kind": "function", "doc": "<p>Rewrite sqlglot AST to pushdown predicates in FROMS and JOINS</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"SELECT * FROM (SELECT * FROM x AS x) AS y WHERE y.a = 1"</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">pushdown_predicates</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM (SELECT * FROM x AS x WHERE y.a = 1) AS y WHERE TRUE'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"fullname": "sqlglot.optimizer.pushdown_predicates.pushdown", "modulename": "sqlglot.optimizer.pushdown_predicates", "qualname": "pushdown", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">condition</span>, </span><span class=\"param\"><span class=\"n\">sources</span>, </span><span class=\"param\"><span class=\"n\">scope_ref_count</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"fullname": "sqlglot.optimizer.pushdown_predicates.pushdown_cnf", "modulename": "sqlglot.optimizer.pushdown_predicates", "qualname": "pushdown_cnf", "kind": "function", "doc": "<p>If the predicates are in CNF like form, we can simply replace each block in the parent.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">predicates</span>, </span><span class=\"param\"><span class=\"n\">scope</span>, </span><span class=\"param\"><span class=\"n\">scope_ref_count</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"fullname": "sqlglot.optimizer.pushdown_predicates.pushdown_dnf", "modulename": "sqlglot.optimizer.pushdown_predicates", "qualname": "pushdown_dnf", "kind": "function", "doc": "<p>If the predicates are in DNF form, we can only push down conditions that are in all blocks.\nAdditionally, we can't remove predicates from their original form.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">predicates</span>, </span><span class=\"param\"><span class=\"n\">scope</span>, </span><span class=\"param\"><span class=\"n\">scope_ref_count</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"fullname": "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate", "modulename": "sqlglot.optimizer.pushdown_predicates", "qualname": "nodes_for_predicate", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">predicate</span>, </span><span class=\"param\"><span class=\"n\">sources</span>, </span><span class=\"param\"><span class=\"n\">scope_ref_count</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"fullname": "sqlglot.optimizer.pushdown_predicates.replace_aliases", "modulename": "sqlglot.optimizer.pushdown_predicates", "qualname": "replace_aliases", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">source</span>, </span><span class=\"param\"><span class=\"n\">predicate</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_projections": {"fullname": "sqlglot.optimizer.pushdown_projections", "modulename": "sqlglot.optimizer.pushdown_projections", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"fullname": "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION", "modulename": "sqlglot.optimizer.pushdown_projections", "qualname": "DEFAULT_SELECTION", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"fullname": "sqlglot.optimizer.pushdown_projections.pushdown_projections", "modulename": "sqlglot.optimizer.pushdown_projections", "qualname": "pushdown_projections", "kind": "function", "doc": "<p>Rewrite sqlglot AST to remove unused columns projections.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sql</span> <span class=\"o\">=</span> <span class=\"s2\">"SELECT y.a AS a FROM (SELECT x.a AS a, x.b AS b FROM x) AS y"</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"n\">sql</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">pushdown_projections</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT y.a AS a FROM (SELECT x.a AS a FROM x) AS y'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: optimized expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.qualify_columns": {"fullname": "sqlglot.optimizer.qualify_columns", "modulename": "sqlglot.optimizer.qualify_columns", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"fullname": "sqlglot.optimizer.qualify_columns.qualify_columns", "modulename": "sqlglot.optimizer.qualify_columns", "qualname": "qualify_columns", "kind": "function", "doc": "<p>Rewrite sqlglot AST to have fully qualified columns.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">schema</span> <span class=\"o\">=</span> <span class=\"p\">{</span><span class=\"s2\">"tbl"</span><span class=\"p\">:</span> <span class=\"p\">{</span><span class=\"s2\">"col"</span><span class=\"p\">:</span> <span class=\"s2\">"INT"</span><span class=\"p\">}}</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT col FROM tbl"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">qualify_columns</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">,</span> <span class=\"n\">schema</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT tbl.col AS col FROM tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to qualify</li>\n<li><strong>schema (dict|sqlglot.optimizer.Schema):</strong> Database schema</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: qualified expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">schema</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"fullname": "sqlglot.optimizer.qualify_columns.validate_qualify_columns", "modulename": "sqlglot.optimizer.qualify_columns", "qualname": "validate_qualify_columns", "kind": "function", "doc": "<p>Raise an <code>OptimizeError</code> if any columns aren't qualified</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.qualify_tables": {"fullname": "sqlglot.optimizer.qualify_tables", "modulename": "sqlglot.optimizer.qualify_tables", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"fullname": "sqlglot.optimizer.qualify_tables.qualify_tables", "modulename": "sqlglot.optimizer.qualify_tables", "qualname": "qualify_tables", "kind": "function", "doc": "<p>Rewrite sqlglot AST to have fully qualified tables.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT 1 FROM tbl"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">qualify_tables</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">,</span> <span class=\"n\">db</span><span class=\"o\">=</span><span class=\"s2\">"db"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT 1 FROM db.tbl AS tbl'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to qualify</li>\n<li><strong>db (str):</strong> Database name</li>\n<li><strong>catalog (str):</strong> Catalog name</li>\n<li><strong>schema:</strong> A schema to populate</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: qualified expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">db</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">catalog</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"n\">schema</span><span class=\"o\">=</span><span class=\"kc\">None</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope": {"fullname": "sqlglot.optimizer.scope", "modulename": "sqlglot.optimizer.scope", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.scope.ScopeType": {"fullname": "sqlglot.optimizer.scope.ScopeType", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType", "kind": "class", "doc": "<p>An enumeration.</p>\n", "bases": "enum.Enum"}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"fullname": "sqlglot.optimizer.scope.ScopeType.ROOT", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType.ROOT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <ScopeType.ROOT: 1>"}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"fullname": "sqlglot.optimizer.scope.ScopeType.SUBQUERY", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType.SUBQUERY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <ScopeType.SUBQUERY: 2>"}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"fullname": "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType.DERIVED_TABLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <ScopeType.DERIVED_TABLE: 3>"}, "sqlglot.optimizer.scope.ScopeType.CTE": {"fullname": "sqlglot.optimizer.scope.ScopeType.CTE", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType.CTE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <ScopeType.CTE: 4>"}, "sqlglot.optimizer.scope.ScopeType.UNION": {"fullname": "sqlglot.optimizer.scope.ScopeType.UNION", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType.UNION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <ScopeType.UNION: 5>"}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"fullname": "sqlglot.optimizer.scope.ScopeType.UDTF", "modulename": "sqlglot.optimizer.scope", "qualname": "ScopeType.UDTF", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <ScopeType.UDTF: 6>"}, "sqlglot.optimizer.scope.Scope": {"fullname": "sqlglot.optimizer.scope.Scope", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope", "kind": "class", "doc": "<p>Selection scope.</p>\n\n<h6 id=\"attributes\">Attributes:</h6>\n\n<ul>\n<li><strong>expression (exp.Select|exp.Union):</strong> Root expression of this scope</li>\n<li><strong>sources (dict[str, exp.Table|Scope]):</strong> Mapping of source name to either\na Table expression or another Scope instance. For example:\n SELECT * FROM x {\"x\": Table(this=\"x\")}\n SELECT * FROM x AS y {\"y\": Table(this=\"x\")}\n SELECT * FROM (SELECT ...) AS y {\"y\": Scope(...)}</li>\n<li><strong>outer_column_list (list[str]):</strong> If this is a derived table or CTE, and the outer query\ndefines a column list of it's alias of this scope, this is that list of columns.\nFor example:\n SELECT * FROM (SELECT ...) AS y(col1, col2)\nThe inner query would have <code>[\"col1\", \"col2\"]</code> for its <code>outer_column_list</code></li>\n<li><strong>parent (Scope):</strong> Parent scope</li>\n<li><strong>scope_type (ScopeType):</strong> Type of this scope, relative to it's parent</li>\n<li><strong>subquery_scopes (list[Scope]):</strong> List of all child scopes for subqueries</li>\n<li>cte_scopes = (list[Scope]) List of all child scopes for CTEs</li>\n<li>derived_table_scopes = (list[Scope]) List of all child scopes for derived_tables</li>\n<li><strong>union_scopes (list[Scope, Scope]):</strong> If this Scope is for a Union expression, this will be\na list of the left and right child scopes.</li>\n</ul>\n"}, "sqlglot.optimizer.scope.Scope.__init__": {"fullname": "sqlglot.optimizer.scope.Scope.__init__", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span>,</span><span class=\"param\">\t<span class=\"n\">sources</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">outer_column_list</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">parent</span><span class=\"o\">=</span><span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">scope_type</span><span class=\"o\">=<</span><span class=\"n\">ScopeType</span><span class=\"o\">.</span><span class=\"n\">ROOT</span><span class=\"p\">:</span> <span class=\"mi\">1</span><span class=\"o\">></span></span>)</span>"}, "sqlglot.optimizer.scope.Scope.clear_cache": {"fullname": "sqlglot.optimizer.scope.Scope.clear_cache", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.clear_cache", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.branch": {"fullname": "sqlglot.optimizer.scope.Scope.branch", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.branch", "kind": "function", "doc": "<p>Branch from the current scope to a new, inner scope</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">scope_type</span>, </span><span class=\"param\"><span class=\"n\">chain_sources</span><span class=\"o\">=</span><span class=\"kc\">None</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.walk": {"fullname": "sqlglot.optimizer.scope.Scope.walk", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.walk", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.find": {"fullname": "sqlglot.optimizer.scope.Scope.find", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.find", "kind": "function", "doc": "<p>Returns the first node in this scope which matches at least one of the specified types.</p>\n\n<p>This does NOT traverse into subscopes.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression_types (type):</strong> the expression type(s) to match.</li>\n<li><strong>bfs (bool):</strong> True to use breadth-first search, False to use depth-first.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>exp.Expression: the node which matches the criteria or None if no node matching\n the criteria was found.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expression_types</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.find_all": {"fullname": "sqlglot.optimizer.scope.Scope.find_all", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.find_all", "kind": "function", "doc": "<p>Returns a generator object which visits all nodes in this scope and only yields those that\nmatch at least one of the specified expression types.</p>\n\n<p>This does NOT traverse into subscopes.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression_types (type):</strong> the expression type(s) to match.</li>\n<li><strong>bfs (bool):</strong> True to use breadth-first search, False to use depth-first.</li>\n</ul>\n\n<h6 id=\"yields\">Yields:</h6>\n\n<blockquote>\n <p>exp.Expression: nodes</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">*</span><span class=\"n\">expression_types</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.replace": {"fullname": "sqlglot.optimizer.scope.Scope.replace", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.replace", "kind": "function", "doc": "<p>Replace <code>old</code> with <code>new</code>.</p>\n\n<p>This can be used instead of <code>exp.Expression.replace</code> to ensure the <code>Scope</code> is kept up-to-date.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>old (exp.Expression):</strong> old node</li>\n<li><strong>new (exp.Expression):</strong> new node</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">old</span>, </span><span class=\"param\"><span class=\"n\">new</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.tables": {"fullname": "sqlglot.optimizer.scope.Scope.tables", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.tables", "kind": "variable", "doc": "<p>List of tables in this scope.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Table]: tables</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.ctes": {"fullname": "sqlglot.optimizer.scope.Scope.ctes", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.ctes", "kind": "variable", "doc": "<p>List of CTEs in this scope.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.CTE]: ctes</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.derived_tables": {"fullname": "sqlglot.optimizer.scope.Scope.derived_tables", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.derived_tables", "kind": "variable", "doc": "<p>List of derived tables in this scope.</p>\n\n<h6 id=\"for-example\">For example:</h6>\n\n<blockquote>\n <p>SELECT * FROM (SELECT ...) <- that's a derived table</p>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Subquery]: derived tables</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.subqueries": {"fullname": "sqlglot.optimizer.scope.Scope.subqueries", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.subqueries", "kind": "variable", "doc": "<p>List of subqueries in this scope.</p>\n\n<h6 id=\"for-example\">For example:</h6>\n\n<blockquote>\n <p>SELECT * FROM x WHERE a IN (SELECT ...) <- that's a subquery</p>\n</blockquote>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Subqueryable]: subqueries</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.columns": {"fullname": "sqlglot.optimizer.scope.Scope.columns", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.columns", "kind": "variable", "doc": "<p>List of columns in this scope.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Column]: Column instances in this scope, plus any\n Columns that reference this scope from correlated subqueries.</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.selected_sources": {"fullname": "sqlglot.optimizer.scope.Scope.selected_sources", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.selected_sources", "kind": "variable", "doc": "<p>Mapping of nodes and sources that are actually selected from in this scope.</p>\n\n<p>That is, all tables in a schema are selectable at any point. But a\ntable only becomes a selected source if it's included in a FROM or JOIN clause.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>dict[str, (exp.Table|exp.Select, exp.Table|Scope)]: selected sources and nodes</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.cte_sources": {"fullname": "sqlglot.optimizer.scope.Scope.cte_sources", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.cte_sources", "kind": "variable", "doc": "<p>Sources that are CTEs.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>dict[str, Scope]: Mapping of source alias to Scope</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.selects": {"fullname": "sqlglot.optimizer.scope.Scope.selects", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.selects", "kind": "variable", "doc": "<p>Select expressions of this scope.</p>\n\n<p>For example, for the following expression:\n SELECT 1 as a, 2 as b FROM x</p>\n\n<p>The outputs are the \"1 as a\" and \"2 as b\" expressions.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Expression]: expressions</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.external_columns": {"fullname": "sqlglot.optimizer.scope.Scope.external_columns", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.external_columns", "kind": "variable", "doc": "<p>Columns that appear to reference sources in outer scopes.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Column]: Column instances that don't reference\n sources in the current scope.</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"fullname": "sqlglot.optimizer.scope.Scope.unqualified_columns", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.unqualified_columns", "kind": "variable", "doc": "<p>Unqualified columns in the current scope.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Column]: Unqualified columns</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.join_hints": {"fullname": "sqlglot.optimizer.scope.Scope.join_hints", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.join_hints", "kind": "variable", "doc": "<p>Hints that exist in the scope that reference tables</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.JoinHint]: Join hints that are referenced within the scope</p>\n</blockquote>\n"}, "sqlglot.optimizer.scope.Scope.source_columns": {"fullname": "sqlglot.optimizer.scope.Scope.source_columns", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.source_columns", "kind": "function", "doc": "<p>Get all columns in the current scope for a particular source.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>source_name (str):</strong> Name of the source</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[exp.Column]: Column instances that reference <code>source_name</code></p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">source_name</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.is_subquery": {"fullname": "sqlglot.optimizer.scope.Scope.is_subquery", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_subquery", "kind": "variable", "doc": "<p>Determine if this scope is a subquery</p>\n"}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"fullname": "sqlglot.optimizer.scope.Scope.is_derived_table", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_derived_table", "kind": "variable", "doc": "<p>Determine if this scope is a derived table</p>\n"}, "sqlglot.optimizer.scope.Scope.is_union": {"fullname": "sqlglot.optimizer.scope.Scope.is_union", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_union", "kind": "variable", "doc": "<p>Determine if this scope is a union</p>\n"}, "sqlglot.optimizer.scope.Scope.is_cte": {"fullname": "sqlglot.optimizer.scope.Scope.is_cte", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_cte", "kind": "variable", "doc": "<p>Determine if this scope is a common table expression</p>\n"}, "sqlglot.optimizer.scope.Scope.is_root": {"fullname": "sqlglot.optimizer.scope.Scope.is_root", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_root", "kind": "variable", "doc": "<p>Determine if this is the root scope</p>\n"}, "sqlglot.optimizer.scope.Scope.is_udtf": {"fullname": "sqlglot.optimizer.scope.Scope.is_udtf", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_udtf", "kind": "variable", "doc": "<p>Determine if this scope is a UDTF (User Defined Table Function)</p>\n"}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"fullname": "sqlglot.optimizer.scope.Scope.is_correlated_subquery", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.is_correlated_subquery", "kind": "variable", "doc": "<p>Determine if this scope is a correlated subquery</p>\n"}, "sqlglot.optimizer.scope.Scope.rename_source": {"fullname": "sqlglot.optimizer.scope.Scope.rename_source", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.rename_source", "kind": "function", "doc": "<p>Rename a source in this scope</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">old_name</span>, </span><span class=\"param\"><span class=\"n\">new_name</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.add_source": {"fullname": "sqlglot.optimizer.scope.Scope.add_source", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.add_source", "kind": "function", "doc": "<p>Add a source to this scope</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">name</span>, </span><span class=\"param\"><span class=\"n\">source</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.remove_source": {"fullname": "sqlglot.optimizer.scope.Scope.remove_source", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.remove_source", "kind": "function", "doc": "<p>Remove a source from this scope</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">name</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.traverse": {"fullname": "sqlglot.optimizer.scope.Scope.traverse", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.traverse", "kind": "function", "doc": "<p>Traverse the scope tree from this node.</p>\n\n<h6 id=\"yields\">Yields:</h6>\n\n<blockquote>\n <p>Scope: scope instances in depth-first-search post-order</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.Scope.ref_count": {"fullname": "sqlglot.optimizer.scope.Scope.ref_count", "modulename": "sqlglot.optimizer.scope", "qualname": "Scope.ref_count", "kind": "function", "doc": "<p>Count the number of times each scope in this tree is referenced.</p>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>dict[int, int]: Mapping of Scope instance ID to reference count</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.traverse_scope": {"fullname": "sqlglot.optimizer.scope.traverse_scope", "modulename": "sqlglot.optimizer.scope", "qualname": "traverse_scope", "kind": "function", "doc": "<p>Traverse an expression by it's \"scopes\".</p>\n\n<p>\"Scope\" represents the current context of a Select statement.</p>\n\n<p>This is helpful for optimizing queries, where we need more information than\nthe expression tree itself. For example, we might care about the source\nnames within a subquery. Returns a list because a generator could result in\nincomplete properties which is confusing.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a FROM (SELECT a FROM x) AS y"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">scopes</span> <span class=\"o\">=</span> <span class=\"n\">traverse_scope</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">scopes</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">expression</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(),</span> <span class=\"nb\">list</span><span class=\"p\">(</span><span class=\"n\">scopes</span><span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">sources</span><span class=\"p\">)</span>\n<span class=\"go\">('SELECT a FROM x', ['x'])</span>\n<span class=\"gp\">>>> </span><span class=\"n\">scopes</span><span class=\"p\">[</span><span class=\"mi\">1</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">expression</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">(),</span> <span class=\"nb\">list</span><span class=\"p\">(</span><span class=\"n\">scopes</span><span class=\"p\">[</span><span class=\"mi\">1</span><span class=\"p\">]</span><span class=\"o\">.</span><span class=\"n\">sources</span><span class=\"p\">)</span>\n<span class=\"go\">('SELECT a FROM (SELECT a FROM x) AS y', ['y'])</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (exp.Expression):</strong> expression to traverse</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>list[Scope]: scope instances</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.build_scope": {"fullname": "sqlglot.optimizer.scope.build_scope", "modulename": "sqlglot.optimizer.scope", "qualname": "build_scope", "kind": "function", "doc": "<p>Build a scope tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (exp.Expression):</strong> expression to build the scope tree for</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Scope: root scope</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.scope.walk_in_scope": {"fullname": "sqlglot.optimizer.scope.walk_in_scope", "modulename": "sqlglot.optimizer.scope", "qualname": "walk_in_scope", "kind": "function", "doc": "<p>Returns a generator object which visits all nodes in the syntrax tree, stopping at\nnodes that start child scopes.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (exp.Expression):</strong> </li>\n<li><strong>bfs (bool):</strong> if set to True the BFS traversal order will be applied,\notherwise the DFS traversal will be used instead.</li>\n</ul>\n\n<h6 id=\"yields\">Yields:</h6>\n\n<blockquote>\n <p>tuple[exp.Expression, Optional[exp.Expression], str]: node, parent, arg key</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">bfs</span><span class=\"o\">=</span><span class=\"kc\">True</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify": {"fullname": "sqlglot.optimizer.simplify", "modulename": "sqlglot.optimizer.simplify", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.simplify.simplify": {"fullname": "sqlglot.optimizer.simplify.simplify", "modulename": "sqlglot.optimizer.simplify", "qualname": "simplify", "kind": "function", "doc": "<p>Rewrite sqlglot AST to simplify expressions.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"TRUE AND TRUE"</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">simplify</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'TRUE'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to simplify</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: simplified expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.rewrite_between": {"fullname": "sqlglot.optimizer.simplify.rewrite_between", "modulename": "sqlglot.optimizer.simplify", "qualname": "rewrite_between", "kind": "function", "doc": "<p>Rewrite x between y and z to x >= y AND x <= z.</p>\n\n<p>This is done because comparison simplification is only done on lt/lte/gt/gte.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.simplify_not": {"fullname": "sqlglot.optimizer.simplify.simplify_not", "modulename": "sqlglot.optimizer.simplify", "qualname": "simplify_not", "kind": "function", "doc": "<p>Demorgan's Law\nNOT (x OR y) -> NOT x AND NOT y\nNOT (x AND y) -> NOT x OR NOT y</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.flatten": {"fullname": "sqlglot.optimizer.simplify.flatten", "modulename": "sqlglot.optimizer.simplify", "qualname": "flatten", "kind": "function", "doc": "<p>A AND (B AND C) -> A AND B AND C\nA OR (B OR C) -> A OR B OR C</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.simplify_connectors": {"fullname": "sqlglot.optimizer.simplify.simplify_connectors", "modulename": "sqlglot.optimizer.simplify", "qualname": "simplify_connectors", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.remove_compliments": {"fullname": "sqlglot.optimizer.simplify.remove_compliments", "modulename": "sqlglot.optimizer.simplify", "qualname": "remove_compliments", "kind": "function", "doc": "<p>Removing compliments.</p>\n\n<p>A AND NOT A -> FALSE\nA OR NOT A -> TRUE</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.uniq_sort": {"fullname": "sqlglot.optimizer.simplify.uniq_sort", "modulename": "sqlglot.optimizer.simplify", "qualname": "uniq_sort", "kind": "function", "doc": "<p>Uniq and sort a connector.</p>\n\n<p>C AND A AND B AND B -> A AND B AND C</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"fullname": "sqlglot.optimizer.simplify.absorb_and_eliminate", "modulename": "sqlglot.optimizer.simplify", "qualname": "absorb_and_eliminate", "kind": "function", "doc": "<p>absorption:\n A AND (A OR B) -> A\n A OR (A AND B) -> A\n A AND (NOT A OR B) -> A AND B\n A OR (NOT A AND B) -> A OR B\nelimination:\n (A AND B) OR (A AND NOT B) -> A\n (A OR B) AND (A OR NOT B) -> A</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.simplify_literals": {"fullname": "sqlglot.optimizer.simplify.simplify_literals", "modulename": "sqlglot.optimizer.simplify", "qualname": "simplify_literals", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.simplify_parens": {"fullname": "sqlglot.optimizer.simplify.simplify_parens", "modulename": "sqlglot.optimizer.simplify", "qualname": "simplify_parens", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.remove_where_true": {"fullname": "sqlglot.optimizer.simplify.remove_where_true", "modulename": "sqlglot.optimizer.simplify", "qualname": "remove_where_true", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.always_true": {"fullname": "sqlglot.optimizer.simplify.always_true", "modulename": "sqlglot.optimizer.simplify", "qualname": "always_true", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.is_complement": {"fullname": "sqlglot.optimizer.simplify.is_complement", "modulename": "sqlglot.optimizer.simplify", "qualname": "is_complement", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">a</span>, </span><span class=\"param\"><span class=\"n\">b</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.eval_boolean": {"fullname": "sqlglot.optimizer.simplify.eval_boolean", "modulename": "sqlglot.optimizer.simplify", "qualname": "eval_boolean", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span>, </span><span class=\"param\"><span class=\"n\">a</span>, </span><span class=\"param\"><span class=\"n\">b</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.extract_date": {"fullname": "sqlglot.optimizer.simplify.extract_date", "modulename": "sqlglot.optimizer.simplify", "qualname": "extract_date", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">cast</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.extract_interval": {"fullname": "sqlglot.optimizer.simplify.extract_interval", "modulename": "sqlglot.optimizer.simplify", "qualname": "extract_interval", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">interval</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.date_literal": {"fullname": "sqlglot.optimizer.simplify.date_literal", "modulename": "sqlglot.optimizer.simplify", "qualname": "date_literal", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">date</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.simplify.boolean_literal": {"fullname": "sqlglot.optimizer.simplify.boolean_literal", "modulename": "sqlglot.optimizer.simplify", "qualname": "boolean_literal", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">condition</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.unnest_subqueries": {"fullname": "sqlglot.optimizer.unnest_subqueries", "modulename": "sqlglot.optimizer.unnest_subqueries", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"fullname": "sqlglot.optimizer.unnest_subqueries.unnest_subqueries", "modulename": "sqlglot.optimizer.unnest_subqueries", "qualname": "unnest_subqueries", "kind": "function", "doc": "<p>Rewrite sqlglot AST to convert some predicates with subqueries into joins.</p>\n\n<p>Convert scalar subqueries into cross joins.\nConvert correlated or vectorized subqueries into a group by so it is not a many to many left join.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">expression</span> <span class=\"o\">=</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT * FROM x AS x WHERE (SELECT y.a AS a FROM y AS y WHERE x.a = y.a) = 1 "</span><span class=\"p\">)</span>\n<span class=\"gp\">>>> </span><span class=\"n\">unnest_subqueries</span><span class=\"p\">(</span><span class=\"n\">expression</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT * FROM x AS x LEFT JOIN (SELECT y.a AS a FROM y AS y WHERE TRUE GROUP BY y.a) AS _u_0 ON x.a = _u_0.a WHERE _u_0.a = 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression (sqlglot.Expression):</strong> expression to unnest</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>sqlglot.Expression: unnested expression</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.unnest_subqueries.unnest": {"fullname": "sqlglot.optimizer.unnest_subqueries.unnest", "modulename": "sqlglot.optimizer.unnest_subqueries", "qualname": "unnest", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">select</span>, </span><span class=\"param\"><span class=\"n\">parent_select</span>, </span><span class=\"param\"><span class=\"n\">sequence</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"fullname": "sqlglot.optimizer.unnest_subqueries.decorrelate", "modulename": "sqlglot.optimizer.unnest_subqueries", "qualname": "decorrelate", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">select</span>, </span><span class=\"param\"><span class=\"n\">parent_select</span>, </span><span class=\"param\"><span class=\"n\">external_columns</span>, </span><span class=\"param\"><span class=\"n\">sequence</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.parser": {"fullname": "sqlglot.parser", "modulename": "sqlglot.parser", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.parser.parse_var_map": {"fullname": "sqlglot.parser.parse_var_map", "modulename": "sqlglot.parser", "qualname": "parse_var_map", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">args</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser": {"fullname": "sqlglot.parser.Parser", "modulename": "sqlglot.parser", "qualname": "Parser", "kind": "class", "doc": "<p>Parser consumes a list of tokens produced by the <code>sqlglot.tokens.Tokenizer</code> and produces\na parsed syntax tree.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>error_level:</strong> the desired error level.\nDefault: ErrorLevel.RAISE</li>\n<li><strong>error_message_context:</strong> determines the amount of context to capture from a\nquery string when displaying the error message (in number of characters).\nDefault: 50.</li>\n<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.\nDefault: 0</li>\n<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample.\nDefault: False</li>\n<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError.\nThis is only relevant if error_level is ErrorLevel.RAISE.\nDefault: 3</li>\n<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set.\nOptions are \"nulls_are_small\", \"nulls_are_large\", \"nulls_are_last\".\nDefault: \"nulls_are_small\"</li>\n</ul>\n"}, "sqlglot.parser.Parser.__init__": {"fullname": "sqlglot.parser.Parser.__init__", "modulename": "sqlglot.parser", "qualname": "Parser.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">error_level</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">errors</span><span class=\"o\">.</span><span class=\"n\">ErrorLevel</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">error_message_context</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">100</span>,</span><span class=\"param\">\t<span class=\"n\">index_offset</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">0</span>,</span><span class=\"param\">\t<span class=\"n\">unnest_column_only</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">alias_post_tablesample</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span>,</span><span class=\"param\">\t<span class=\"n\">max_errors</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">3</span>,</span><span class=\"param\">\t<span class=\"n\">null_ordering</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span>)</span>"}, "sqlglot.parser.Parser.reset": {"fullname": "sqlglot.parser.Parser.reset", "modulename": "sqlglot.parser", "qualname": "Parser.reset", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser.parse": {"fullname": "sqlglot.parser.Parser.parse", "modulename": "sqlglot.parser", "qualname": "Parser.parse", "kind": "function", "doc": "<p>Parses a list of tokens and returns a list of syntax trees, one tree\nper parsed SQL statement.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>raw_tokens:</strong> the list of tokens.</li>\n<li><strong>sql:</strong> the original SQL string, used to produce helpful debug messages.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The list of syntax trees.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">raw_tokens</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser.parse_into": {"fullname": "sqlglot.parser.Parser.parse_into", "modulename": "sqlglot.parser", "qualname": "Parser.parse_into", "kind": "function", "doc": "<p>Parses a list of tokens into a given Expression type. If a collection of Expression\ntypes is given instead, this method will try to parse the token list into each one\nof them, stopping at the first for which the parsing succeeds.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression_types:</strong> the expression type(s) to try and parse the token list into.</li>\n<li><strong>raw_tokens:</strong> the list of tokens.</li>\n<li><strong>sql:</strong> the original SQL string, used to produce helpful debug messages.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The target Expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression_types</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"n\">Collection</span><span class=\"p\">[</span><span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]]]</span>,</span><span class=\"param\">\t<span class=\"n\">raw_tokens</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser.check_errors": {"fullname": "sqlglot.parser.Parser.check_errors", "modulename": "sqlglot.parser", "qualname": "Parser.check_errors", "kind": "function", "doc": "<p>Logs or raises any found errors, depending on the chosen error level setting.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser.raise_error": {"fullname": "sqlglot.parser.Parser.raise_error", "modulename": "sqlglot.parser", "qualname": "Parser.raise_error", "kind": "function", "doc": "<p>Appends an error in the list of recorded errors or raises it, depending on the chosen\nerror level setting.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">message</span><span class=\"p\">:</span> <span class=\"nb\">str</span>, </span><span class=\"param\"><span class=\"n\">token</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser.expression": {"fullname": "sqlglot.parser.Parser.expression", "modulename": "sqlglot.parser", "qualname": "Parser.expression", "kind": "function", "doc": "<p>Creates a new, validated Expression.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>exp_class:</strong> the expression class to instantiate.</li>\n<li><strong>comments:</strong> an optional list of comments to attach to the expression.</li>\n<li><strong>kwargs:</strong> the arguments to set for the expression along with their respective values.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The target expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">exp_class</span><span class=\"p\">:</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">comments</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.parser.Parser.validate_expression": {"fullname": "sqlglot.parser.Parser.validate_expression", "modulename": "sqlglot.parser", "qualname": "Parser.validate_expression", "kind": "function", "doc": "<p>Validates an already instantiated expression, making sure that all its mandatory arguments\nare set.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression to validate.</li>\n<li><strong>args:</strong> an optional list of items that was used to instantiate the expression, if it's a Func.</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">args</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.planner": {"fullname": "sqlglot.planner", "modulename": "sqlglot.planner", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.planner.Plan": {"fullname": "sqlglot.planner.Plan", "modulename": "sqlglot.planner", "qualname": "Plan", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.planner.Plan.__init__": {"fullname": "sqlglot.planner.Plan.__init__", "modulename": "sqlglot.planner", "qualname": "Plan.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span>)</span>"}, "sqlglot.planner.Step": {"fullname": "sqlglot.planner.Step", "modulename": "sqlglot.planner", "qualname": "Step", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.planner.Step.__init__": {"fullname": "sqlglot.planner.Step.__init__", "modulename": "sqlglot.planner", "qualname": "Step.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.planner.Step.from_expression": {"fullname": "sqlglot.planner.Step.from_expression", "modulename": "sqlglot.planner", "qualname": "Step.from_expression", "kind": "function", "doc": "<p>Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.\nNote: the expression's tables and subqueries must be aliased for this method to work. For\nexample, given the following expression:</p>\n\n<p>SELECT\n x.a,\n SUM(x.b)\nFROM x AS x\nJOIN y AS y\n ON x.a = y.a\nGROUP BY x.a</p>\n\n<p>the following DAG is produced (the expression IDs might differ per execution):</p>\n\n<ul>\n<li>Aggregate: x (4347984624)\nContext:\n Aggregations:\n - SUM(x.b)\n Group:\n - x.a\nProjections:\n<ul>\n<li>x.a</li>\n<li>\"x\".\"\"\nDependencies:\n<ul>\n<li>Join: x (4347985296)\nContext:\ny:\nOn: x.a = y.a\nProjections:\nDependencies:</li>\n</ul></li>\n<li>Scan: x (4347983136)\nContext:\n Source: x AS x\nProjections:</li>\n<li>Scan: y (4343416624)\nContext:\n Source: y AS y\nProjections:</li>\n</ul></li>\n</ul>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression to build the DAG from.</li>\n<li><strong>ctes:</strong> a dictionary that maps CTEs to their corresponding Step DAG by name.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A Step DAG corresponding to <code>expression</code>.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">ctes</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span>:</span></span>", "funcdef": "def"}, "sqlglot.planner.Step.add_dependency": {"fullname": "sqlglot.planner.Step.add_dependency", "modulename": "sqlglot.planner", "qualname": "Step.add_dependency", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">dependency</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.planner.Step.to_s": {"fullname": "sqlglot.planner.Step.to_s", "modulename": "sqlglot.planner", "qualname": "Step.to_s", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">level</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">0</span></span><span class=\"return-annotation\">) -> <span class=\"nb\">str</span>:</span></span>", "funcdef": "def"}, "sqlglot.planner.Scan": {"fullname": "sqlglot.planner.Scan", "modulename": "sqlglot.planner", "qualname": "Scan", "kind": "class", "doc": "<p></p>\n", "bases": "Step"}, "sqlglot.planner.Scan.__init__": {"fullname": "sqlglot.planner.Scan.__init__", "modulename": "sqlglot.planner", "qualname": "Scan.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.planner.Scan.from_expression": {"fullname": "sqlglot.planner.Scan.from_expression", "modulename": "sqlglot.planner", "qualname": "Scan.from_expression", "kind": "function", "doc": "<p>Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.\nNote: the expression's tables and subqueries must be aliased for this method to work. For\nexample, given the following expression:</p>\n\n<p>SELECT\n x.a,\n SUM(x.b)\nFROM x AS x\nJOIN y AS y\n ON x.a = y.a\nGROUP BY x.a</p>\n\n<p>the following DAG is produced (the expression IDs might differ per execution):</p>\n\n<ul>\n<li>Aggregate: x (4347984624)\nContext:\n Aggregations:\n - SUM(x.b)\n Group:\n - x.a\nProjections:\n<ul>\n<li>x.a</li>\n<li>\"x\".\"\"\nDependencies:\n<ul>\n<li>Join: x (4347985296)\nContext:\ny:\nOn: x.a = y.a\nProjections:\nDependencies:</li>\n</ul></li>\n<li>Scan: x (4347983136)\nContext:\n Source: x AS x\nProjections:</li>\n<li>Scan: y (4343416624)\nContext:\n Source: y AS y\nProjections:</li>\n</ul></li>\n</ul>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression to build the DAG from.</li>\n<li><strong>ctes:</strong> a dictionary that maps CTEs to their corresponding Step DAG by name.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A Step DAG corresponding to <code>expression</code>.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">ctes</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span>:</span></span>", "funcdef": "def"}, "sqlglot.planner.Join": {"fullname": "sqlglot.planner.Join", "modulename": "sqlglot.planner", "qualname": "Join", "kind": "class", "doc": "<p></p>\n", "bases": "Step"}, "sqlglot.planner.Join.__init__": {"fullname": "sqlglot.planner.Join.__init__", "modulename": "sqlglot.planner", "qualname": "Join.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.planner.Join.from_joins": {"fullname": "sqlglot.planner.Join.from_joins", "modulename": "sqlglot.planner", "qualname": "Join.from_joins", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">joins</span><span class=\"p\">:</span> <span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Join</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">ctes</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span>:</span></span>", "funcdef": "def"}, "sqlglot.planner.Aggregate": {"fullname": "sqlglot.planner.Aggregate", "modulename": "sqlglot.planner", "qualname": "Aggregate", "kind": "class", "doc": "<p></p>\n", "bases": "Step"}, "sqlglot.planner.Aggregate.__init__": {"fullname": "sqlglot.planner.Aggregate.__init__", "modulename": "sqlglot.planner", "qualname": "Aggregate.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.planner.Sort": {"fullname": "sqlglot.planner.Sort", "modulename": "sqlglot.planner", "qualname": "Sort", "kind": "class", "doc": "<p></p>\n", "bases": "Step"}, "sqlglot.planner.Sort.__init__": {"fullname": "sqlglot.planner.Sort.__init__", "modulename": "sqlglot.planner", "qualname": "Sort.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.planner.SetOperation": {"fullname": "sqlglot.planner.SetOperation", "modulename": "sqlglot.planner", "qualname": "SetOperation", "kind": "class", "doc": "<p></p>\n", "bases": "Step"}, "sqlglot.planner.SetOperation.__init__": {"fullname": "sqlglot.planner.SetOperation.__init__", "modulename": "sqlglot.planner", "qualname": "SetOperation.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">op</span><span class=\"p\">:</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">left</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">right</span><span class=\"p\">:</span> <span class=\"nb\">str</span> <span class=\"o\">|</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">distinct</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span>)</span>"}, "sqlglot.planner.SetOperation.from_expression": {"fullname": "sqlglot.planner.SetOperation.from_expression", "modulename": "sqlglot.planner", "qualname": "SetOperation.from_expression", "kind": "function", "doc": "<p>Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.\nNote: the expression's tables and subqueries must be aliased for this method to work. For\nexample, given the following expression:</p>\n\n<p>SELECT\n x.a,\n SUM(x.b)\nFROM x AS x\nJOIN y AS y\n ON x.a = y.a\nGROUP BY x.a</p>\n\n<p>the following DAG is produced (the expression IDs might differ per execution):</p>\n\n<ul>\n<li>Aggregate: x (4347984624)\nContext:\n Aggregations:\n - SUM(x.b)\n Group:\n - x.a\nProjections:\n<ul>\n<li>x.a</li>\n<li>\"x\".\"\"\nDependencies:\n<ul>\n<li>Join: x (4347985296)\nContext:\ny:\nOn: x.a = y.a\nProjections:\nDependencies:</li>\n</ul></li>\n<li>Scan: x (4347983136)\nContext:\n Source: x AS x\nProjections:</li>\n<li>Scan: y (4343416624)\nContext:\n Source: y AS y\nProjections:</li>\n</ul></li>\n</ul>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression to build the DAG from.</li>\n<li><strong>ctes:</strong> a dictionary that maps CTEs to their corresponding Step DAG by name.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A Step DAG corresponding to <code>expression</code>.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>,</span><span class=\"param\">\t<span class=\"n\">ctes</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">planner</span><span class=\"o\">.</span><span class=\"n\">Step</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.Schema": {"fullname": "sqlglot.schema.Schema", "modulename": "sqlglot.schema", "qualname": "Schema", "kind": "class", "doc": "<p>Abstract base class for database schemas</p>\n", "bases": "abc.ABC"}, "sqlglot.schema.Schema.add_table": {"fullname": "sqlglot.schema.Schema.add_table", "modulename": "sqlglot.schema", "qualname": "Schema.add_table", "kind": "function", "doc": "<p>Register or update a table. Some implementing classes may require column information to also be provided.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table:</strong> table expression instance or string representing the table.</li>\n<li><strong>column_mapping:</strong> a column mapping that describes the structure of the table.</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span> <span class=\"o\">|</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">column_mapping</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructType</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.Schema.column_names": {"fullname": "sqlglot.schema.Schema.column_names", "modulename": "sqlglot.schema", "qualname": "Schema.column_names", "kind": "function", "doc": "<p>Get the column names for a table.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table:</strong> the <code>Table</code> expression instance.</li>\n<li><strong>only_visible:</strong> whether to include invisible columns.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The list of column names.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span> <span class=\"o\">|</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">only_visible</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.Schema.get_column_type": {"fullname": "sqlglot.schema.Schema.get_column_type", "modulename": "sqlglot.schema", "qualname": "Schema.get_column_type", "kind": "function", "doc": "<p>Get the <code>sqlglot.exp.DataType</code> type of a column in the schema.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table:</strong> the source table.</li>\n<li><strong>column:</strong> the target column.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The resulting column type.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span> <span class=\"o\">|</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.Schema.supported_table_args": {"fullname": "sqlglot.schema.Schema.supported_table_args", "modulename": "sqlglot.schema", "qualname": "Schema.supported_table_args", "kind": "variable", "doc": "<p>Table arguments this schema support, e.g. <code>(\"this\", \"db\", \"catalog\")</code></p>\n", "annotation": ": Tuple[str, ...]"}, "sqlglot.schema.AbstractMappingSchema": {"fullname": "sqlglot.schema.AbstractMappingSchema", "modulename": "sqlglot.schema", "qualname": "AbstractMappingSchema", "kind": "class", "doc": "<p>Abstract base class for generic types.</p>\n\n<p>A generic type is typically declared by inheriting from\nthis class parameterized with one or more type variables.\nFor example, a generic mapping type might be defined as::</p>\n\n<p>class Mapping(Generic[KT, VT]):\n def __getitem__(self, key: KT) -> VT:\n ...\n # Etc.</p>\n\n<p>This class can then be used as follows::</p>\n\n<p>def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:\n try:\n return mapping[key]\n except KeyError:\n return default</p>\n", "bases": "typing.Generic[~T]"}, "sqlglot.schema.AbstractMappingSchema.__init__": {"fullname": "sqlglot.schema.AbstractMappingSchema.__init__", "modulename": "sqlglot.schema", "qualname": "AbstractMappingSchema.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">mapping</span><span class=\"p\">:</span> <span class=\"nb\">dict</span> <span class=\"o\">|</span> <span class=\"kc\">None</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span>)</span>"}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"fullname": "sqlglot.schema.AbstractMappingSchema.table_parts", "modulename": "sqlglot.schema", "qualname": "AbstractMappingSchema.table_parts", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.AbstractMappingSchema.find": {"fullname": "sqlglot.schema.AbstractMappingSchema.find", "modulename": "sqlglot.schema", "qualname": "AbstractMappingSchema.find", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span>,</span><span class=\"param\">\t<span class=\"n\">trie</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">raise_on_missing</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">True</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"o\">~</span><span class=\"n\">T</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.MappingSchema": {"fullname": "sqlglot.schema.MappingSchema", "modulename": "sqlglot.schema", "qualname": "MappingSchema", "kind": "class", "doc": "<p>Schema based on a nested mapping.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>schema (dict):</strong> Mapping in one of the following forms:\n<ol>\n<li>{table: {col: type}}</li>\n<li>{db: {table: {col: type}}}</li>\n<li>{catalog: {db: {table: {col: type}}}}</li>\n<li>None - Tables will be added later</li>\n</ol></li>\n<li><strong>visible (dict):</strong> Optional mapping of which columns in the schema are visible. If not provided, all columns\nare assumed to be visible. The nesting should mirror that of the schema:\n<ol>\n<li>{table: set(<em>cols)}}</li>\n<li>{db: {table: set(</em>cols)}}}</li>\n<li>{catalog: {db: {table: set(*cols)}}}}</li>\n</ol></li>\n<li><strong>dialect (str):</strong> The dialect to be used for custom type mappings.</li>\n</ul>\n", "bases": "sqlglot.schema.AbstractMappingSchema[typing.Dict[str, str]], Schema"}, "sqlglot.schema.MappingSchema.__init__": {"fullname": "sqlglot.schema.MappingSchema.__init__", "modulename": "sqlglot.schema", "qualname": "MappingSchema.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">schema</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">visible</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span>,</span><span class=\"param\">\t<span class=\"n\">dialect</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">,</span> <span class=\"n\">Type</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dialects</span><span class=\"o\">.</span><span class=\"n\">dialect</span><span class=\"o\">.</span><span class=\"n\">Dialect</span><span class=\"p\">],</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span>)</span>"}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"fullname": "sqlglot.schema.MappingSchema.from_mapping_schema", "modulename": "sqlglot.schema", "qualname": "MappingSchema.from_mapping_schema", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">cls</span>,</span><span class=\"param\">\t<span class=\"n\">mapping_schema</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">MappingSchema</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">MappingSchema</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.MappingSchema.copy": {"fullname": "sqlglot.schema.MappingSchema.copy", "modulename": "sqlglot.schema", "qualname": "MappingSchema.copy", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"o\">**</span><span class=\"n\">kwargs</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">MappingSchema</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.MappingSchema.add_table": {"fullname": "sqlglot.schema.MappingSchema.add_table", "modulename": "sqlglot.schema", "qualname": "MappingSchema.add_table", "kind": "function", "doc": "<p>Register or update a table. Updates are only performed if a new column mapping is provided.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table:</strong> the <code>Table</code> expression instance or string representing the table.</li>\n<li><strong>column_mapping:</strong> a column mapping that describes the structure of the table.</li>\n</ul>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span> <span class=\"o\">|</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">column_mapping</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructType</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.MappingSchema.column_names": {"fullname": "sqlglot.schema.MappingSchema.column_names", "modulename": "sqlglot.schema", "qualname": "MappingSchema.column_names", "kind": "function", "doc": "<p>Get the column names for a table.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table:</strong> the <code>Table</code> expression instance.</li>\n<li><strong>only_visible:</strong> whether to include invisible columns.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The list of column names.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span> <span class=\"o\">|</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">only_visible</span><span class=\"p\">:</span> <span class=\"nb\">bool</span> <span class=\"o\">=</span> <span class=\"kc\">False</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.MappingSchema.get_column_type": {"fullname": "sqlglot.schema.MappingSchema.get_column_type", "modulename": "sqlglot.schema", "qualname": "MappingSchema.get_column_type", "kind": "function", "doc": "<p>Get the <code>sqlglot.exp.DataType</code> type of a column in the schema.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>table:</strong> the source table.</li>\n<li><strong>column:</strong> the target column.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The resulting column type.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"bp\">self</span>,</span><span class=\"param\">\t<span class=\"n\">table</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Table</span> <span class=\"o\">|</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">column</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Column</span> <span class=\"o\">|</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.ensure_schema": {"fullname": "sqlglot.schema.ensure_schema", "modulename": "sqlglot.schema", "qualname": "ensure_schema", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">schema</span><span class=\"p\">:</span> <span class=\"n\">Any</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">schema</span><span class=\"o\">.</span><span class=\"n\">Schema</span>:</span></span>", "funcdef": "def"}, "sqlglot.schema.ensure_column_mapping": {"fullname": "sqlglot.schema.ensure_column_mapping", "modulename": "sqlglot.schema", "qualname": "ensure_column_mapping", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">mapping</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">dataframe</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"o\">.</span><span class=\"n\">types</span><span class=\"o\">.</span><span class=\"n\">StructType</span><span class=\"p\">,</span> <span class=\"n\">List</span><span class=\"p\">,</span> <span class=\"n\">NoneType</span><span class=\"p\">]</span></span><span class=\"return-annotation\">):</span></span>", "funcdef": "def"}, "sqlglot.schema.flatten_schema": {"fullname": "sqlglot.schema.flatten_schema", "modulename": "sqlglot.schema", "qualname": "flatten_schema", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">schema</span><span class=\"p\">:</span> <span class=\"n\">Dict</span>,</span><span class=\"param\">\t<span class=\"n\">depth</span><span class=\"p\">:</span> <span class=\"nb\">int</span>,</span><span class=\"param\">\t<span class=\"n\">keys</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]]</span>:</span></span>", "funcdef": "def"}, "sqlglot.serde": {"fullname": "sqlglot.serde", "modulename": "sqlglot.serde", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.serde.dump": {"fullname": "sqlglot.serde.dump", "modulename": "sqlglot.serde", "qualname": "dump", "kind": "function", "doc": "<p>Recursively dump an AST into a JSON-serializable dict.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">node</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">ForwardRef</span><span class=\"p\">(</span><span class=\"s1\">'Node'</span><span class=\"p\">)],</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"nb\">dict</span><span class=\"p\">,</span> <span class=\"nb\">list</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">dict</span><span class=\"p\">,</span> <span class=\"nb\">list</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.serde.load": {"fullname": "sqlglot.serde.load", "modulename": "sqlglot.serde", "qualname": "load", "kind": "function", "doc": "<p>Recursively load a dict (as returned by <code>dump</code>) into an AST.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">obj</span><span class=\"p\">:</span> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"nb\">dict</span><span class=\"p\">,</span> <span class=\"nb\">list</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Union</span><span class=\"p\">[</span><span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">ForwardRef</span><span class=\"p\">(</span><span class=\"s1\">'Node'</span><span class=\"p\">)],</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">DataType</span><span class=\"o\">.</span><span class=\"n\">Type</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">,</span> <span class=\"nb\">dict</span><span class=\"p\">,</span> <span class=\"nb\">list</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">float</span><span class=\"p\">,</span> <span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"nb\">bool</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.time": {"fullname": "sqlglot.time", "modulename": "sqlglot.time", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.time.format_time": {"fullname": "sqlglot.time.format_time", "modulename": "sqlglot.time", "qualname": "format_time", "kind": "function", "doc": "<p>Converts a time string given a mapping.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">format_time</span><span class=\"p\">(</span><span class=\"s2\">"%Y"</span><span class=\"p\">,</span> <span class=\"p\">{</span><span class=\"s2\">"%Y"</span><span class=\"p\">:</span> <span class=\"s2\">"YYYY"</span><span class=\"p\">})</span>\n<span class=\"go\">'YYYY'</span>\n</code></pre>\n </div>\n \n <p>Args:\n mapping: dictionary of time format to target time format.\n trie: optional trie, can be passed in for performance.</p>\n \n <p>Returns:\n The converted time string.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">string</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">mapping</span><span class=\"p\">:</span> <span class=\"n\">Dict</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">,</span> <span class=\"nb\">str</span><span class=\"p\">]</span>,</span><span class=\"param\">\t<span class=\"n\">trie</span><span class=\"p\">:</span> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"n\">Dict</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"kc\">None</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Optional</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.tokens": {"fullname": "sqlglot.tokens", "modulename": "sqlglot.tokens", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.tokens.TokenType": {"fullname": "sqlglot.tokens.TokenType", "modulename": "sqlglot.tokens", "qualname": "TokenType", "kind": "class", "doc": "<p>An enumeration.</p>\n", "bases": "sqlglot.helper.AutoName"}, "sqlglot.tokens.TokenType.L_PAREN": {"fullname": "sqlglot.tokens.TokenType.L_PAREN", "modulename": "sqlglot.tokens", "qualname": "TokenType.L_PAREN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.L_PAREN: 'L_PAREN'>"}, "sqlglot.tokens.TokenType.R_PAREN": {"fullname": "sqlglot.tokens.TokenType.R_PAREN", "modulename": "sqlglot.tokens", "qualname": "TokenType.R_PAREN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.R_PAREN: 'R_PAREN'>"}, "sqlglot.tokens.TokenType.L_BRACKET": {"fullname": "sqlglot.tokens.TokenType.L_BRACKET", "modulename": "sqlglot.tokens", "qualname": "TokenType.L_BRACKET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.L_BRACKET: 'L_BRACKET'>"}, "sqlglot.tokens.TokenType.R_BRACKET": {"fullname": "sqlglot.tokens.TokenType.R_BRACKET", "modulename": "sqlglot.tokens", "qualname": "TokenType.R_BRACKET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.R_BRACKET: 'R_BRACKET'>"}, "sqlglot.tokens.TokenType.L_BRACE": {"fullname": "sqlglot.tokens.TokenType.L_BRACE", "modulename": "sqlglot.tokens", "qualname": "TokenType.L_BRACE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.L_BRACE: 'L_BRACE'>"}, "sqlglot.tokens.TokenType.R_BRACE": {"fullname": "sqlglot.tokens.TokenType.R_BRACE", "modulename": "sqlglot.tokens", "qualname": "TokenType.R_BRACE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.R_BRACE: 'R_BRACE'>"}, "sqlglot.tokens.TokenType.COMMA": {"fullname": "sqlglot.tokens.TokenType.COMMA", "modulename": "sqlglot.tokens", "qualname": "TokenType.COMMA", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COMMA: 'COMMA'>"}, "sqlglot.tokens.TokenType.DOT": {"fullname": "sqlglot.tokens.TokenType.DOT", "modulename": "sqlglot.tokens", "qualname": "TokenType.DOT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DOT: 'DOT'>"}, "sqlglot.tokens.TokenType.DASH": {"fullname": "sqlglot.tokens.TokenType.DASH", "modulename": "sqlglot.tokens", "qualname": "TokenType.DASH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DASH: 'DASH'>"}, "sqlglot.tokens.TokenType.PLUS": {"fullname": "sqlglot.tokens.TokenType.PLUS", "modulename": "sqlglot.tokens", "qualname": "TokenType.PLUS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PLUS: 'PLUS'>"}, "sqlglot.tokens.TokenType.COLON": {"fullname": "sqlglot.tokens.TokenType.COLON", "modulename": "sqlglot.tokens", "qualname": "TokenType.COLON", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COLON: 'COLON'>"}, "sqlglot.tokens.TokenType.DCOLON": {"fullname": "sqlglot.tokens.TokenType.DCOLON", "modulename": "sqlglot.tokens", "qualname": "TokenType.DCOLON", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DCOLON: 'DCOLON'>"}, "sqlglot.tokens.TokenType.SEMICOLON": {"fullname": "sqlglot.tokens.TokenType.SEMICOLON", "modulename": "sqlglot.tokens", "qualname": "TokenType.SEMICOLON", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SEMICOLON: 'SEMICOLON'>"}, "sqlglot.tokens.TokenType.STAR": {"fullname": "sqlglot.tokens.TokenType.STAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.STAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.STAR: 'STAR'>"}, "sqlglot.tokens.TokenType.BACKSLASH": {"fullname": "sqlglot.tokens.TokenType.BACKSLASH", "modulename": "sqlglot.tokens", "qualname": "TokenType.BACKSLASH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BACKSLASH: 'BACKSLASH'>"}, "sqlglot.tokens.TokenType.SLASH": {"fullname": "sqlglot.tokens.TokenType.SLASH", "modulename": "sqlglot.tokens", "qualname": "TokenType.SLASH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SLASH: 'SLASH'>"}, "sqlglot.tokens.TokenType.LT": {"fullname": "sqlglot.tokens.TokenType.LT", "modulename": "sqlglot.tokens", "qualname": "TokenType.LT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LT: 'LT'>"}, "sqlglot.tokens.TokenType.LTE": {"fullname": "sqlglot.tokens.TokenType.LTE", "modulename": "sqlglot.tokens", "qualname": "TokenType.LTE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LTE: 'LTE'>"}, "sqlglot.tokens.TokenType.GT": {"fullname": "sqlglot.tokens.TokenType.GT", "modulename": "sqlglot.tokens", "qualname": "TokenType.GT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GT: 'GT'>"}, "sqlglot.tokens.TokenType.GTE": {"fullname": "sqlglot.tokens.TokenType.GTE", "modulename": "sqlglot.tokens", "qualname": "TokenType.GTE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GTE: 'GTE'>"}, "sqlglot.tokens.TokenType.NOT": {"fullname": "sqlglot.tokens.TokenType.NOT", "modulename": "sqlglot.tokens", "qualname": "TokenType.NOT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NOT: 'NOT'>"}, "sqlglot.tokens.TokenType.EQ": {"fullname": "sqlglot.tokens.TokenType.EQ", "modulename": "sqlglot.tokens", "qualname": "TokenType.EQ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.EQ: 'EQ'>"}, "sqlglot.tokens.TokenType.NEQ": {"fullname": "sqlglot.tokens.TokenType.NEQ", "modulename": "sqlglot.tokens", "qualname": "TokenType.NEQ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NEQ: 'NEQ'>"}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"fullname": "sqlglot.tokens.TokenType.NULLSAFE_EQ", "modulename": "sqlglot.tokens", "qualname": "TokenType.NULLSAFE_EQ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NULLSAFE_EQ: 'NULLSAFE_EQ'>"}, "sqlglot.tokens.TokenType.AND": {"fullname": "sqlglot.tokens.TokenType.AND", "modulename": "sqlglot.tokens", "qualname": "TokenType.AND", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.AND: 'AND'>"}, "sqlglot.tokens.TokenType.OR": {"fullname": "sqlglot.tokens.TokenType.OR", "modulename": "sqlglot.tokens", "qualname": "TokenType.OR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OR: 'OR'>"}, "sqlglot.tokens.TokenType.AMP": {"fullname": "sqlglot.tokens.TokenType.AMP", "modulename": "sqlglot.tokens", "qualname": "TokenType.AMP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.AMP: 'AMP'>"}, "sqlglot.tokens.TokenType.DPIPE": {"fullname": "sqlglot.tokens.TokenType.DPIPE", "modulename": "sqlglot.tokens", "qualname": "TokenType.DPIPE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DPIPE: 'DPIPE'>"}, "sqlglot.tokens.TokenType.PIPE": {"fullname": "sqlglot.tokens.TokenType.PIPE", "modulename": "sqlglot.tokens", "qualname": "TokenType.PIPE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PIPE: 'PIPE'>"}, "sqlglot.tokens.TokenType.CARET": {"fullname": "sqlglot.tokens.TokenType.CARET", "modulename": "sqlglot.tokens", "qualname": "TokenType.CARET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CARET: 'CARET'>"}, "sqlglot.tokens.TokenType.TILDA": {"fullname": "sqlglot.tokens.TokenType.TILDA", "modulename": "sqlglot.tokens", "qualname": "TokenType.TILDA", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TILDA: 'TILDA'>"}, "sqlglot.tokens.TokenType.ARROW": {"fullname": "sqlglot.tokens.TokenType.ARROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.ARROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ARROW: 'ARROW'>"}, "sqlglot.tokens.TokenType.DARROW": {"fullname": "sqlglot.tokens.TokenType.DARROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.DARROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DARROW: 'DARROW'>"}, "sqlglot.tokens.TokenType.FARROW": {"fullname": "sqlglot.tokens.TokenType.FARROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.FARROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FARROW: 'FARROW'>"}, "sqlglot.tokens.TokenType.HASH": {"fullname": "sqlglot.tokens.TokenType.HASH", "modulename": "sqlglot.tokens", "qualname": "TokenType.HASH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HASH: 'HASH'>"}, "sqlglot.tokens.TokenType.HASH_ARROW": {"fullname": "sqlglot.tokens.TokenType.HASH_ARROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.HASH_ARROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HASH_ARROW: 'HASH_ARROW'>"}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"fullname": "sqlglot.tokens.TokenType.DHASH_ARROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.DHASH_ARROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DHASH_ARROW: 'DHASH_ARROW'>"}, "sqlglot.tokens.TokenType.LR_ARROW": {"fullname": "sqlglot.tokens.TokenType.LR_ARROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.LR_ARROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LR_ARROW: 'LR_ARROW'>"}, "sqlglot.tokens.TokenType.DOLLAR": {"fullname": "sqlglot.tokens.TokenType.DOLLAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.DOLLAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DOLLAR: 'DOLLAR'>"}, "sqlglot.tokens.TokenType.PARAMETER": {"fullname": "sqlglot.tokens.TokenType.PARAMETER", "modulename": "sqlglot.tokens", "qualname": "TokenType.PARAMETER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PARAMETER: 'PARAMETER'>"}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"fullname": "sqlglot.tokens.TokenType.SESSION_PARAMETER", "modulename": "sqlglot.tokens", "qualname": "TokenType.SESSION_PARAMETER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SESSION_PARAMETER: 'SESSION_PARAMETER'>"}, "sqlglot.tokens.TokenType.NATIONAL": {"fullname": "sqlglot.tokens.TokenType.NATIONAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.NATIONAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NATIONAL: 'NATIONAL'>"}, "sqlglot.tokens.TokenType.BLOCK_START": {"fullname": "sqlglot.tokens.TokenType.BLOCK_START", "modulename": "sqlglot.tokens", "qualname": "TokenType.BLOCK_START", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BLOCK_START: 'BLOCK_START'>"}, "sqlglot.tokens.TokenType.BLOCK_END": {"fullname": "sqlglot.tokens.TokenType.BLOCK_END", "modulename": "sqlglot.tokens", "qualname": "TokenType.BLOCK_END", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BLOCK_END: 'BLOCK_END'>"}, "sqlglot.tokens.TokenType.SPACE": {"fullname": "sqlglot.tokens.TokenType.SPACE", "modulename": "sqlglot.tokens", "qualname": "TokenType.SPACE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SPACE: 'SPACE'>"}, "sqlglot.tokens.TokenType.BREAK": {"fullname": "sqlglot.tokens.TokenType.BREAK", "modulename": "sqlglot.tokens", "qualname": "TokenType.BREAK", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BREAK: 'BREAK'>"}, "sqlglot.tokens.TokenType.STRING": {"fullname": "sqlglot.tokens.TokenType.STRING", "modulename": "sqlglot.tokens", "qualname": "TokenType.STRING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.STRING: 'STRING'>"}, "sqlglot.tokens.TokenType.NUMBER": {"fullname": "sqlglot.tokens.TokenType.NUMBER", "modulename": "sqlglot.tokens", "qualname": "TokenType.NUMBER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NUMBER: 'NUMBER'>"}, "sqlglot.tokens.TokenType.IDENTIFIER": {"fullname": "sqlglot.tokens.TokenType.IDENTIFIER", "modulename": "sqlglot.tokens", "qualname": "TokenType.IDENTIFIER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IDENTIFIER: 'IDENTIFIER'>"}, "sqlglot.tokens.TokenType.COLUMN": {"fullname": "sqlglot.tokens.TokenType.COLUMN", "modulename": "sqlglot.tokens", "qualname": "TokenType.COLUMN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COLUMN: 'COLUMN'>"}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"fullname": "sqlglot.tokens.TokenType.COLUMN_DEF", "modulename": "sqlglot.tokens", "qualname": "TokenType.COLUMN_DEF", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COLUMN_DEF: 'COLUMN_DEF'>"}, "sqlglot.tokens.TokenType.SCHEMA": {"fullname": "sqlglot.tokens.TokenType.SCHEMA", "modulename": "sqlglot.tokens", "qualname": "TokenType.SCHEMA", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SCHEMA: 'SCHEMA'>"}, "sqlglot.tokens.TokenType.TABLE": {"fullname": "sqlglot.tokens.TokenType.TABLE", "modulename": "sqlglot.tokens", "qualname": "TokenType.TABLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TABLE: 'TABLE'>"}, "sqlglot.tokens.TokenType.VAR": {"fullname": "sqlglot.tokens.TokenType.VAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.VAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VAR: 'VAR'>"}, "sqlglot.tokens.TokenType.BIT_STRING": {"fullname": "sqlglot.tokens.TokenType.BIT_STRING", "modulename": "sqlglot.tokens", "qualname": "TokenType.BIT_STRING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BIT_STRING: 'BIT_STRING'>"}, "sqlglot.tokens.TokenType.HEX_STRING": {"fullname": "sqlglot.tokens.TokenType.HEX_STRING", "modulename": "sqlglot.tokens", "qualname": "TokenType.HEX_STRING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HEX_STRING: 'HEX_STRING'>"}, "sqlglot.tokens.TokenType.BYTE_STRING": {"fullname": "sqlglot.tokens.TokenType.BYTE_STRING", "modulename": "sqlglot.tokens", "qualname": "TokenType.BYTE_STRING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BYTE_STRING: 'BYTE_STRING'>"}, "sqlglot.tokens.TokenType.BOOLEAN": {"fullname": "sqlglot.tokens.TokenType.BOOLEAN", "modulename": "sqlglot.tokens", "qualname": "TokenType.BOOLEAN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BOOLEAN: 'BOOLEAN'>"}, "sqlglot.tokens.TokenType.TINYINT": {"fullname": "sqlglot.tokens.TokenType.TINYINT", "modulename": "sqlglot.tokens", "qualname": "TokenType.TINYINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TINYINT: 'TINYINT'>"}, "sqlglot.tokens.TokenType.SMALLINT": {"fullname": "sqlglot.tokens.TokenType.SMALLINT", "modulename": "sqlglot.tokens", "qualname": "TokenType.SMALLINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SMALLINT: 'SMALLINT'>"}, "sqlglot.tokens.TokenType.INT": {"fullname": "sqlglot.tokens.TokenType.INT", "modulename": "sqlglot.tokens", "qualname": "TokenType.INT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INT: 'INT'>"}, "sqlglot.tokens.TokenType.BIGINT": {"fullname": "sqlglot.tokens.TokenType.BIGINT", "modulename": "sqlglot.tokens", "qualname": "TokenType.BIGINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BIGINT: 'BIGINT'>"}, "sqlglot.tokens.TokenType.FLOAT": {"fullname": "sqlglot.tokens.TokenType.FLOAT", "modulename": "sqlglot.tokens", "qualname": "TokenType.FLOAT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FLOAT: 'FLOAT'>"}, "sqlglot.tokens.TokenType.DOUBLE": {"fullname": "sqlglot.tokens.TokenType.DOUBLE", "modulename": "sqlglot.tokens", "qualname": "TokenType.DOUBLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DOUBLE: 'DOUBLE'>"}, "sqlglot.tokens.TokenType.DECIMAL": {"fullname": "sqlglot.tokens.TokenType.DECIMAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.DECIMAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DECIMAL: 'DECIMAL'>"}, "sqlglot.tokens.TokenType.CHAR": {"fullname": "sqlglot.tokens.TokenType.CHAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.CHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CHAR: 'CHAR'>"}, "sqlglot.tokens.TokenType.NCHAR": {"fullname": "sqlglot.tokens.TokenType.NCHAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.NCHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NCHAR: 'NCHAR'>"}, "sqlglot.tokens.TokenType.VARCHAR": {"fullname": "sqlglot.tokens.TokenType.VARCHAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.VARCHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VARCHAR: 'VARCHAR'>"}, "sqlglot.tokens.TokenType.NVARCHAR": {"fullname": "sqlglot.tokens.TokenType.NVARCHAR", "modulename": "sqlglot.tokens", "qualname": "TokenType.NVARCHAR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NVARCHAR: 'NVARCHAR'>"}, "sqlglot.tokens.TokenType.TEXT": {"fullname": "sqlglot.tokens.TokenType.TEXT", "modulename": "sqlglot.tokens", "qualname": "TokenType.TEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TEXT: 'TEXT'>"}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"fullname": "sqlglot.tokens.TokenType.MEDIUMTEXT", "modulename": "sqlglot.tokens", "qualname": "TokenType.MEDIUMTEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MEDIUMTEXT: 'MEDIUMTEXT'>"}, "sqlglot.tokens.TokenType.LONGTEXT": {"fullname": "sqlglot.tokens.TokenType.LONGTEXT", "modulename": "sqlglot.tokens", "qualname": "TokenType.LONGTEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LONGTEXT: 'LONGTEXT'>"}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"fullname": "sqlglot.tokens.TokenType.MEDIUMBLOB", "modulename": "sqlglot.tokens", "qualname": "TokenType.MEDIUMBLOB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MEDIUMBLOB: 'MEDIUMBLOB'>"}, "sqlglot.tokens.TokenType.LONGBLOB": {"fullname": "sqlglot.tokens.TokenType.LONGBLOB", "modulename": "sqlglot.tokens", "qualname": "TokenType.LONGBLOB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LONGBLOB: 'LONGBLOB'>"}, "sqlglot.tokens.TokenType.BINARY": {"fullname": "sqlglot.tokens.TokenType.BINARY", "modulename": "sqlglot.tokens", "qualname": "TokenType.BINARY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BINARY: 'BINARY'>"}, "sqlglot.tokens.TokenType.VARBINARY": {"fullname": "sqlglot.tokens.TokenType.VARBINARY", "modulename": "sqlglot.tokens", "qualname": "TokenType.VARBINARY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VARBINARY: 'VARBINARY'>"}, "sqlglot.tokens.TokenType.JSON": {"fullname": "sqlglot.tokens.TokenType.JSON", "modulename": "sqlglot.tokens", "qualname": "TokenType.JSON", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.JSON: 'JSON'>"}, "sqlglot.tokens.TokenType.JSONB": {"fullname": "sqlglot.tokens.TokenType.JSONB", "modulename": "sqlglot.tokens", "qualname": "TokenType.JSONB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.JSONB: 'JSONB'>"}, "sqlglot.tokens.TokenType.TIME": {"fullname": "sqlglot.tokens.TokenType.TIME", "modulename": "sqlglot.tokens", "qualname": "TokenType.TIME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TIME: 'TIME'>"}, "sqlglot.tokens.TokenType.TIMESTAMP": {"fullname": "sqlglot.tokens.TokenType.TIMESTAMP", "modulename": "sqlglot.tokens", "qualname": "TokenType.TIMESTAMP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TIMESTAMP: 'TIMESTAMP'>"}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"fullname": "sqlglot.tokens.TokenType.TIMESTAMPTZ", "modulename": "sqlglot.tokens", "qualname": "TokenType.TIMESTAMPTZ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TIMESTAMPTZ: 'TIMESTAMPTZ'>"}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"fullname": "sqlglot.tokens.TokenType.TIMESTAMPLTZ", "modulename": "sqlglot.tokens", "qualname": "TokenType.TIMESTAMPLTZ", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TIMESTAMPLTZ: 'TIMESTAMPLTZ'>"}, "sqlglot.tokens.TokenType.DATETIME": {"fullname": "sqlglot.tokens.TokenType.DATETIME", "modulename": "sqlglot.tokens", "qualname": "TokenType.DATETIME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DATETIME: 'DATETIME'>"}, "sqlglot.tokens.TokenType.DATE": {"fullname": "sqlglot.tokens.TokenType.DATE", "modulename": "sqlglot.tokens", "qualname": "TokenType.DATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DATE: 'DATE'>"}, "sqlglot.tokens.TokenType.UUID": {"fullname": "sqlglot.tokens.TokenType.UUID", "modulename": "sqlglot.tokens", "qualname": "TokenType.UUID", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UUID: 'UUID'>"}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"fullname": "sqlglot.tokens.TokenType.GEOGRAPHY", "modulename": "sqlglot.tokens", "qualname": "TokenType.GEOGRAPHY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GEOGRAPHY: 'GEOGRAPHY'>"}, "sqlglot.tokens.TokenType.NULLABLE": {"fullname": "sqlglot.tokens.TokenType.NULLABLE", "modulename": "sqlglot.tokens", "qualname": "TokenType.NULLABLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NULLABLE: 'NULLABLE'>"}, "sqlglot.tokens.TokenType.GEOMETRY": {"fullname": "sqlglot.tokens.TokenType.GEOMETRY", "modulename": "sqlglot.tokens", "qualname": "TokenType.GEOMETRY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GEOMETRY: 'GEOMETRY'>"}, "sqlglot.tokens.TokenType.HLLSKETCH": {"fullname": "sqlglot.tokens.TokenType.HLLSKETCH", "modulename": "sqlglot.tokens", "qualname": "TokenType.HLLSKETCH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HLLSKETCH: 'HLLSKETCH'>"}, "sqlglot.tokens.TokenType.HSTORE": {"fullname": "sqlglot.tokens.TokenType.HSTORE", "modulename": "sqlglot.tokens", "qualname": "TokenType.HSTORE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HSTORE: 'HSTORE'>"}, "sqlglot.tokens.TokenType.SUPER": {"fullname": "sqlglot.tokens.TokenType.SUPER", "modulename": "sqlglot.tokens", "qualname": "TokenType.SUPER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SUPER: 'SUPER'>"}, "sqlglot.tokens.TokenType.SERIAL": {"fullname": "sqlglot.tokens.TokenType.SERIAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.SERIAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SERIAL: 'SERIAL'>"}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"fullname": "sqlglot.tokens.TokenType.SMALLSERIAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.SMALLSERIAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SMALLSERIAL: 'SMALLSERIAL'>"}, "sqlglot.tokens.TokenType.BIGSERIAL": {"fullname": "sqlglot.tokens.TokenType.BIGSERIAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.BIGSERIAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BIGSERIAL: 'BIGSERIAL'>"}, "sqlglot.tokens.TokenType.XML": {"fullname": "sqlglot.tokens.TokenType.XML", "modulename": "sqlglot.tokens", "qualname": "TokenType.XML", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.XML: 'XML'>"}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"fullname": "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNIQUEIDENTIFIER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'>"}, "sqlglot.tokens.TokenType.MONEY": {"fullname": "sqlglot.tokens.TokenType.MONEY", "modulename": "sqlglot.tokens", "qualname": "TokenType.MONEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MONEY: 'MONEY'>"}, "sqlglot.tokens.TokenType.SMALLMONEY": {"fullname": "sqlglot.tokens.TokenType.SMALLMONEY", "modulename": "sqlglot.tokens", "qualname": "TokenType.SMALLMONEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SMALLMONEY: 'SMALLMONEY'>"}, "sqlglot.tokens.TokenType.ROWVERSION": {"fullname": "sqlglot.tokens.TokenType.ROWVERSION", "modulename": "sqlglot.tokens", "qualname": "TokenType.ROWVERSION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ROWVERSION: 'ROWVERSION'>"}, "sqlglot.tokens.TokenType.IMAGE": {"fullname": "sqlglot.tokens.TokenType.IMAGE", "modulename": "sqlglot.tokens", "qualname": "TokenType.IMAGE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IMAGE: 'IMAGE'>"}, "sqlglot.tokens.TokenType.VARIANT": {"fullname": "sqlglot.tokens.TokenType.VARIANT", "modulename": "sqlglot.tokens", "qualname": "TokenType.VARIANT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VARIANT: 'VARIANT'>"}, "sqlglot.tokens.TokenType.OBJECT": {"fullname": "sqlglot.tokens.TokenType.OBJECT", "modulename": "sqlglot.tokens", "qualname": "TokenType.OBJECT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OBJECT: 'OBJECT'>"}, "sqlglot.tokens.TokenType.ALIAS": {"fullname": "sqlglot.tokens.TokenType.ALIAS", "modulename": "sqlglot.tokens", "qualname": "TokenType.ALIAS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ALIAS: 'ALIAS'>"}, "sqlglot.tokens.TokenType.ALTER": {"fullname": "sqlglot.tokens.TokenType.ALTER", "modulename": "sqlglot.tokens", "qualname": "TokenType.ALTER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ALTER: 'ALTER'>"}, "sqlglot.tokens.TokenType.ALWAYS": {"fullname": "sqlglot.tokens.TokenType.ALWAYS", "modulename": "sqlglot.tokens", "qualname": "TokenType.ALWAYS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ALWAYS: 'ALWAYS'>"}, "sqlglot.tokens.TokenType.ALL": {"fullname": "sqlglot.tokens.TokenType.ALL", "modulename": "sqlglot.tokens", "qualname": "TokenType.ALL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ALL: 'ALL'>"}, "sqlglot.tokens.TokenType.ANTI": {"fullname": "sqlglot.tokens.TokenType.ANTI", "modulename": "sqlglot.tokens", "qualname": "TokenType.ANTI", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ANTI: 'ANTI'>"}, "sqlglot.tokens.TokenType.ANY": {"fullname": "sqlglot.tokens.TokenType.ANY", "modulename": "sqlglot.tokens", "qualname": "TokenType.ANY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ANY: 'ANY'>"}, "sqlglot.tokens.TokenType.APPLY": {"fullname": "sqlglot.tokens.TokenType.APPLY", "modulename": "sqlglot.tokens", "qualname": "TokenType.APPLY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.APPLY: 'APPLY'>"}, "sqlglot.tokens.TokenType.ARRAY": {"fullname": "sqlglot.tokens.TokenType.ARRAY", "modulename": "sqlglot.tokens", "qualname": "TokenType.ARRAY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ARRAY: 'ARRAY'>"}, "sqlglot.tokens.TokenType.ASC": {"fullname": "sqlglot.tokens.TokenType.ASC", "modulename": "sqlglot.tokens", "qualname": "TokenType.ASC", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ASC: 'ASC'>"}, "sqlglot.tokens.TokenType.ASOF": {"fullname": "sqlglot.tokens.TokenType.ASOF", "modulename": "sqlglot.tokens", "qualname": "TokenType.ASOF", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ASOF: 'ASOF'>"}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"fullname": "sqlglot.tokens.TokenType.AT_TIME_ZONE", "modulename": "sqlglot.tokens", "qualname": "TokenType.AT_TIME_ZONE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.AT_TIME_ZONE: 'AT_TIME_ZONE'>"}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"fullname": "sqlglot.tokens.TokenType.AUTO_INCREMENT", "modulename": "sqlglot.tokens", "qualname": "TokenType.AUTO_INCREMENT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.AUTO_INCREMENT: 'AUTO_INCREMENT'>"}, "sqlglot.tokens.TokenType.BEGIN": {"fullname": "sqlglot.tokens.TokenType.BEGIN", "modulename": "sqlglot.tokens", "qualname": "TokenType.BEGIN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BEGIN: 'BEGIN'>"}, "sqlglot.tokens.TokenType.BETWEEN": {"fullname": "sqlglot.tokens.TokenType.BETWEEN", "modulename": "sqlglot.tokens", "qualname": "TokenType.BETWEEN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BETWEEN: 'BETWEEN'>"}, "sqlglot.tokens.TokenType.BOTH": {"fullname": "sqlglot.tokens.TokenType.BOTH", "modulename": "sqlglot.tokens", "qualname": "TokenType.BOTH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BOTH: 'BOTH'>"}, "sqlglot.tokens.TokenType.BUCKET": {"fullname": "sqlglot.tokens.TokenType.BUCKET", "modulename": "sqlglot.tokens", "qualname": "TokenType.BUCKET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BUCKET: 'BUCKET'>"}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"fullname": "sqlglot.tokens.TokenType.BY_DEFAULT", "modulename": "sqlglot.tokens", "qualname": "TokenType.BY_DEFAULT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.BY_DEFAULT: 'BY_DEFAULT'>"}, "sqlglot.tokens.TokenType.CACHE": {"fullname": "sqlglot.tokens.TokenType.CACHE", "modulename": "sqlglot.tokens", "qualname": "TokenType.CACHE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CACHE: 'CACHE'>"}, "sqlglot.tokens.TokenType.CASCADE": {"fullname": "sqlglot.tokens.TokenType.CASCADE", "modulename": "sqlglot.tokens", "qualname": "TokenType.CASCADE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CASCADE: 'CASCADE'>"}, "sqlglot.tokens.TokenType.CASE": {"fullname": "sqlglot.tokens.TokenType.CASE", "modulename": "sqlglot.tokens", "qualname": "TokenType.CASE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CASE: 'CASE'>"}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"fullname": "sqlglot.tokens.TokenType.CHARACTER_SET", "modulename": "sqlglot.tokens", "qualname": "TokenType.CHARACTER_SET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CHARACTER_SET: 'CHARACTER_SET'>"}, "sqlglot.tokens.TokenType.CHECK": {"fullname": "sqlglot.tokens.TokenType.CHECK", "modulename": "sqlglot.tokens", "qualname": "TokenType.CHECK", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CHECK: 'CHECK'>"}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"fullname": "sqlglot.tokens.TokenType.CLUSTER_BY", "modulename": "sqlglot.tokens", "qualname": "TokenType.CLUSTER_BY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CLUSTER_BY: 'CLUSTER_BY'>"}, "sqlglot.tokens.TokenType.COLLATE": {"fullname": "sqlglot.tokens.TokenType.COLLATE", "modulename": "sqlglot.tokens", "qualname": "TokenType.COLLATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COLLATE: 'COLLATE'>"}, "sqlglot.tokens.TokenType.COMMAND": {"fullname": "sqlglot.tokens.TokenType.COMMAND", "modulename": "sqlglot.tokens", "qualname": "TokenType.COMMAND", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COMMAND: 'COMMAND'>"}, "sqlglot.tokens.TokenType.COMMENT": {"fullname": "sqlglot.tokens.TokenType.COMMENT", "modulename": "sqlglot.tokens", "qualname": "TokenType.COMMENT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COMMENT: 'COMMENT'>"}, "sqlglot.tokens.TokenType.COMMIT": {"fullname": "sqlglot.tokens.TokenType.COMMIT", "modulename": "sqlglot.tokens", "qualname": "TokenType.COMMIT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COMMIT: 'COMMIT'>"}, "sqlglot.tokens.TokenType.COMPOUND": {"fullname": "sqlglot.tokens.TokenType.COMPOUND", "modulename": "sqlglot.tokens", "qualname": "TokenType.COMPOUND", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.COMPOUND: 'COMPOUND'>"}, "sqlglot.tokens.TokenType.CONSTRAINT": {"fullname": "sqlglot.tokens.TokenType.CONSTRAINT", "modulename": "sqlglot.tokens", "qualname": "TokenType.CONSTRAINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CONSTRAINT: 'CONSTRAINT'>"}, "sqlglot.tokens.TokenType.CREATE": {"fullname": "sqlglot.tokens.TokenType.CREATE", "modulename": "sqlglot.tokens", "qualname": "TokenType.CREATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CREATE: 'CREATE'>"}, "sqlglot.tokens.TokenType.CROSS": {"fullname": "sqlglot.tokens.TokenType.CROSS", "modulename": "sqlglot.tokens", "qualname": "TokenType.CROSS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CROSS: 'CROSS'>"}, "sqlglot.tokens.TokenType.CUBE": {"fullname": "sqlglot.tokens.TokenType.CUBE", "modulename": "sqlglot.tokens", "qualname": "TokenType.CUBE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CUBE: 'CUBE'>"}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"fullname": "sqlglot.tokens.TokenType.CURRENT_DATE", "modulename": "sqlglot.tokens", "qualname": "TokenType.CURRENT_DATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CURRENT_DATE: 'CURRENT_DATE'>"}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"fullname": "sqlglot.tokens.TokenType.CURRENT_DATETIME", "modulename": "sqlglot.tokens", "qualname": "TokenType.CURRENT_DATETIME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CURRENT_DATETIME: 'CURRENT_DATETIME'>"}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"fullname": "sqlglot.tokens.TokenType.CURRENT_ROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.CURRENT_ROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CURRENT_ROW: 'CURRENT_ROW'>"}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"fullname": "sqlglot.tokens.TokenType.CURRENT_TIME", "modulename": "sqlglot.tokens", "qualname": "TokenType.CURRENT_TIME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CURRENT_TIME: 'CURRENT_TIME'>"}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"fullname": "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP", "modulename": "sqlglot.tokens", "qualname": "TokenType.CURRENT_TIMESTAMP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'>"}, "sqlglot.tokens.TokenType.DEFAULT": {"fullname": "sqlglot.tokens.TokenType.DEFAULT", "modulename": "sqlglot.tokens", "qualname": "TokenType.DEFAULT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DEFAULT: 'DEFAULT'>"}, "sqlglot.tokens.TokenType.DELETE": {"fullname": "sqlglot.tokens.TokenType.DELETE", "modulename": "sqlglot.tokens", "qualname": "TokenType.DELETE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DELETE: 'DELETE'>"}, "sqlglot.tokens.TokenType.DESC": {"fullname": "sqlglot.tokens.TokenType.DESC", "modulename": "sqlglot.tokens", "qualname": "TokenType.DESC", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DESC: 'DESC'>"}, "sqlglot.tokens.TokenType.DESCRIBE": {"fullname": "sqlglot.tokens.TokenType.DESCRIBE", "modulename": "sqlglot.tokens", "qualname": "TokenType.DESCRIBE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DESCRIBE: 'DESCRIBE'>"}, "sqlglot.tokens.TokenType.DISTINCT": {"fullname": "sqlglot.tokens.TokenType.DISTINCT", "modulename": "sqlglot.tokens", "qualname": "TokenType.DISTINCT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DISTINCT: 'DISTINCT'>"}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"fullname": "sqlglot.tokens.TokenType.DISTINCT_FROM", "modulename": "sqlglot.tokens", "qualname": "TokenType.DISTINCT_FROM", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DISTINCT_FROM: 'DISTINCT_FROM'>"}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"fullname": "sqlglot.tokens.TokenType.DISTRIBUTE_BY", "modulename": "sqlglot.tokens", "qualname": "TokenType.DISTRIBUTE_BY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DISTRIBUTE_BY: 'DISTRIBUTE_BY'>"}, "sqlglot.tokens.TokenType.DIV": {"fullname": "sqlglot.tokens.TokenType.DIV", "modulename": "sqlglot.tokens", "qualname": "TokenType.DIV", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DIV: 'DIV'>"}, "sqlglot.tokens.TokenType.DROP": {"fullname": "sqlglot.tokens.TokenType.DROP", "modulename": "sqlglot.tokens", "qualname": "TokenType.DROP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.DROP: 'DROP'>"}, "sqlglot.tokens.TokenType.ELSE": {"fullname": "sqlglot.tokens.TokenType.ELSE", "modulename": "sqlglot.tokens", "qualname": "TokenType.ELSE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ELSE: 'ELSE'>"}, "sqlglot.tokens.TokenType.ENCODE": {"fullname": "sqlglot.tokens.TokenType.ENCODE", "modulename": "sqlglot.tokens", "qualname": "TokenType.ENCODE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ENCODE: 'ENCODE'>"}, "sqlglot.tokens.TokenType.END": {"fullname": "sqlglot.tokens.TokenType.END", "modulename": "sqlglot.tokens", "qualname": "TokenType.END", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.END: 'END'>"}, "sqlglot.tokens.TokenType.ESCAPE": {"fullname": "sqlglot.tokens.TokenType.ESCAPE", "modulename": "sqlglot.tokens", "qualname": "TokenType.ESCAPE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ESCAPE: 'ESCAPE'>"}, "sqlglot.tokens.TokenType.EXCEPT": {"fullname": "sqlglot.tokens.TokenType.EXCEPT", "modulename": "sqlglot.tokens", "qualname": "TokenType.EXCEPT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.EXCEPT: 'EXCEPT'>"}, "sqlglot.tokens.TokenType.EXECUTE": {"fullname": "sqlglot.tokens.TokenType.EXECUTE", "modulename": "sqlglot.tokens", "qualname": "TokenType.EXECUTE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.EXECUTE: 'EXECUTE'>"}, "sqlglot.tokens.TokenType.EXISTS": {"fullname": "sqlglot.tokens.TokenType.EXISTS", "modulename": "sqlglot.tokens", "qualname": "TokenType.EXISTS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.EXISTS: 'EXISTS'>"}, "sqlglot.tokens.TokenType.FALSE": {"fullname": "sqlglot.tokens.TokenType.FALSE", "modulename": "sqlglot.tokens", "qualname": "TokenType.FALSE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FALSE: 'FALSE'>"}, "sqlglot.tokens.TokenType.FETCH": {"fullname": "sqlglot.tokens.TokenType.FETCH", "modulename": "sqlglot.tokens", "qualname": "TokenType.FETCH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FETCH: 'FETCH'>"}, "sqlglot.tokens.TokenType.FILTER": {"fullname": "sqlglot.tokens.TokenType.FILTER", "modulename": "sqlglot.tokens", "qualname": "TokenType.FILTER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FILTER: 'FILTER'>"}, "sqlglot.tokens.TokenType.FINAL": {"fullname": "sqlglot.tokens.TokenType.FINAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.FINAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FINAL: 'FINAL'>"}, "sqlglot.tokens.TokenType.FIRST": {"fullname": "sqlglot.tokens.TokenType.FIRST", "modulename": "sqlglot.tokens", "qualname": "TokenType.FIRST", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FIRST: 'FIRST'>"}, "sqlglot.tokens.TokenType.FOLLOWING": {"fullname": "sqlglot.tokens.TokenType.FOLLOWING", "modulename": "sqlglot.tokens", "qualname": "TokenType.FOLLOWING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FOLLOWING: 'FOLLOWING'>"}, "sqlglot.tokens.TokenType.FOR": {"fullname": "sqlglot.tokens.TokenType.FOR", "modulename": "sqlglot.tokens", "qualname": "TokenType.FOR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FOR: 'FOR'>"}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"fullname": "sqlglot.tokens.TokenType.FOREIGN_KEY", "modulename": "sqlglot.tokens", "qualname": "TokenType.FOREIGN_KEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FOREIGN_KEY: 'FOREIGN_KEY'>"}, "sqlglot.tokens.TokenType.FORMAT": {"fullname": "sqlglot.tokens.TokenType.FORMAT", "modulename": "sqlglot.tokens", "qualname": "TokenType.FORMAT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FORMAT: 'FORMAT'>"}, "sqlglot.tokens.TokenType.FROM": {"fullname": "sqlglot.tokens.TokenType.FROM", "modulename": "sqlglot.tokens", "qualname": "TokenType.FROM", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FROM: 'FROM'>"}, "sqlglot.tokens.TokenType.FULL": {"fullname": "sqlglot.tokens.TokenType.FULL", "modulename": "sqlglot.tokens", "qualname": "TokenType.FULL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FULL: 'FULL'>"}, "sqlglot.tokens.TokenType.FUNCTION": {"fullname": "sqlglot.tokens.TokenType.FUNCTION", "modulename": "sqlglot.tokens", "qualname": "TokenType.FUNCTION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.FUNCTION: 'FUNCTION'>"}, "sqlglot.tokens.TokenType.GENERATED": {"fullname": "sqlglot.tokens.TokenType.GENERATED", "modulename": "sqlglot.tokens", "qualname": "TokenType.GENERATED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GENERATED: 'GENERATED'>"}, "sqlglot.tokens.TokenType.GLOB": {"fullname": "sqlglot.tokens.TokenType.GLOB", "modulename": "sqlglot.tokens", "qualname": "TokenType.GLOB", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GLOB: 'GLOB'>"}, "sqlglot.tokens.TokenType.GLOBAL": {"fullname": "sqlglot.tokens.TokenType.GLOBAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.GLOBAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GLOBAL: 'GLOBAL'>"}, "sqlglot.tokens.TokenType.GROUP_BY": {"fullname": "sqlglot.tokens.TokenType.GROUP_BY", "modulename": "sqlglot.tokens", "qualname": "TokenType.GROUP_BY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GROUP_BY: 'GROUP_BY'>"}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"fullname": "sqlglot.tokens.TokenType.GROUPING_SETS", "modulename": "sqlglot.tokens", "qualname": "TokenType.GROUPING_SETS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.GROUPING_SETS: 'GROUPING_SETS'>"}, "sqlglot.tokens.TokenType.HAVING": {"fullname": "sqlglot.tokens.TokenType.HAVING", "modulename": "sqlglot.tokens", "qualname": "TokenType.HAVING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HAVING: 'HAVING'>"}, "sqlglot.tokens.TokenType.HINT": {"fullname": "sqlglot.tokens.TokenType.HINT", "modulename": "sqlglot.tokens", "qualname": "TokenType.HINT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.HINT: 'HINT'>"}, "sqlglot.tokens.TokenType.IDENTITY": {"fullname": "sqlglot.tokens.TokenType.IDENTITY", "modulename": "sqlglot.tokens", "qualname": "TokenType.IDENTITY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IDENTITY: 'IDENTITY'>"}, "sqlglot.tokens.TokenType.IF": {"fullname": "sqlglot.tokens.TokenType.IF", "modulename": "sqlglot.tokens", "qualname": "TokenType.IF", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IF: 'IF'>"}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"fullname": "sqlglot.tokens.TokenType.IGNORE_NULLS", "modulename": "sqlglot.tokens", "qualname": "TokenType.IGNORE_NULLS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IGNORE_NULLS: 'IGNORE_NULLS'>"}, "sqlglot.tokens.TokenType.ILIKE": {"fullname": "sqlglot.tokens.TokenType.ILIKE", "modulename": "sqlglot.tokens", "qualname": "TokenType.ILIKE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ILIKE: 'ILIKE'>"}, "sqlglot.tokens.TokenType.IN": {"fullname": "sqlglot.tokens.TokenType.IN", "modulename": "sqlglot.tokens", "qualname": "TokenType.IN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IN: 'IN'>"}, "sqlglot.tokens.TokenType.INDEX": {"fullname": "sqlglot.tokens.TokenType.INDEX", "modulename": "sqlglot.tokens", "qualname": "TokenType.INDEX", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INDEX: 'INDEX'>"}, "sqlglot.tokens.TokenType.INNER": {"fullname": "sqlglot.tokens.TokenType.INNER", "modulename": "sqlglot.tokens", "qualname": "TokenType.INNER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INNER: 'INNER'>"}, "sqlglot.tokens.TokenType.INSERT": {"fullname": "sqlglot.tokens.TokenType.INSERT", "modulename": "sqlglot.tokens", "qualname": "TokenType.INSERT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INSERT: 'INSERT'>"}, "sqlglot.tokens.TokenType.INTERSECT": {"fullname": "sqlglot.tokens.TokenType.INTERSECT", "modulename": "sqlglot.tokens", "qualname": "TokenType.INTERSECT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INTERSECT: 'INTERSECT'>"}, "sqlglot.tokens.TokenType.INTERVAL": {"fullname": "sqlglot.tokens.TokenType.INTERVAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.INTERVAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INTERVAL: 'INTERVAL'>"}, "sqlglot.tokens.TokenType.INTO": {"fullname": "sqlglot.tokens.TokenType.INTO", "modulename": "sqlglot.tokens", "qualname": "TokenType.INTO", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INTO: 'INTO'>"}, "sqlglot.tokens.TokenType.INTRODUCER": {"fullname": "sqlglot.tokens.TokenType.INTRODUCER", "modulename": "sqlglot.tokens", "qualname": "TokenType.INTRODUCER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.INTRODUCER: 'INTRODUCER'>"}, "sqlglot.tokens.TokenType.IRLIKE": {"fullname": "sqlglot.tokens.TokenType.IRLIKE", "modulename": "sqlglot.tokens", "qualname": "TokenType.IRLIKE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IRLIKE: 'IRLIKE'>"}, "sqlglot.tokens.TokenType.IS": {"fullname": "sqlglot.tokens.TokenType.IS", "modulename": "sqlglot.tokens", "qualname": "TokenType.IS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.IS: 'IS'>"}, "sqlglot.tokens.TokenType.ISNULL": {"fullname": "sqlglot.tokens.TokenType.ISNULL", "modulename": "sqlglot.tokens", "qualname": "TokenType.ISNULL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ISNULL: 'ISNULL'>"}, "sqlglot.tokens.TokenType.JOIN": {"fullname": "sqlglot.tokens.TokenType.JOIN", "modulename": "sqlglot.tokens", "qualname": "TokenType.JOIN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.JOIN: 'JOIN'>"}, "sqlglot.tokens.TokenType.LANGUAGE": {"fullname": "sqlglot.tokens.TokenType.LANGUAGE", "modulename": "sqlglot.tokens", "qualname": "TokenType.LANGUAGE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LANGUAGE: 'LANGUAGE'>"}, "sqlglot.tokens.TokenType.LATERAL": {"fullname": "sqlglot.tokens.TokenType.LATERAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.LATERAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LATERAL: 'LATERAL'>"}, "sqlglot.tokens.TokenType.LAZY": {"fullname": "sqlglot.tokens.TokenType.LAZY", "modulename": "sqlglot.tokens", "qualname": "TokenType.LAZY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LAZY: 'LAZY'>"}, "sqlglot.tokens.TokenType.LEADING": {"fullname": "sqlglot.tokens.TokenType.LEADING", "modulename": "sqlglot.tokens", "qualname": "TokenType.LEADING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LEADING: 'LEADING'>"}, "sqlglot.tokens.TokenType.LEFT": {"fullname": "sqlglot.tokens.TokenType.LEFT", "modulename": "sqlglot.tokens", "qualname": "TokenType.LEFT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LEFT: 'LEFT'>"}, "sqlglot.tokens.TokenType.LIKE": {"fullname": "sqlglot.tokens.TokenType.LIKE", "modulename": "sqlglot.tokens", "qualname": "TokenType.LIKE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LIKE: 'LIKE'>"}, "sqlglot.tokens.TokenType.LIMIT": {"fullname": "sqlglot.tokens.TokenType.LIMIT", "modulename": "sqlglot.tokens", "qualname": "TokenType.LIMIT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LIMIT: 'LIMIT'>"}, "sqlglot.tokens.TokenType.LOAD_DATA": {"fullname": "sqlglot.tokens.TokenType.LOAD_DATA", "modulename": "sqlglot.tokens", "qualname": "TokenType.LOAD_DATA", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LOAD_DATA: 'LOAD_DATA'>"}, "sqlglot.tokens.TokenType.LOCAL": {"fullname": "sqlglot.tokens.TokenType.LOCAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.LOCAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.LOCAL: 'LOCAL'>"}, "sqlglot.tokens.TokenType.MAP": {"fullname": "sqlglot.tokens.TokenType.MAP", "modulename": "sqlglot.tokens", "qualname": "TokenType.MAP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MAP: 'MAP'>"}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"fullname": "sqlglot.tokens.TokenType.MATCH_RECOGNIZE", "modulename": "sqlglot.tokens", "qualname": "TokenType.MATCH_RECOGNIZE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MATCH_RECOGNIZE: 'MATCH_RECOGNIZE'>"}, "sqlglot.tokens.TokenType.MATERIALIZED": {"fullname": "sqlglot.tokens.TokenType.MATERIALIZED", "modulename": "sqlglot.tokens", "qualname": "TokenType.MATERIALIZED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MATERIALIZED: 'MATERIALIZED'>"}, "sqlglot.tokens.TokenType.MERGE": {"fullname": "sqlglot.tokens.TokenType.MERGE", "modulename": "sqlglot.tokens", "qualname": "TokenType.MERGE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MERGE: 'MERGE'>"}, "sqlglot.tokens.TokenType.MOD": {"fullname": "sqlglot.tokens.TokenType.MOD", "modulename": "sqlglot.tokens", "qualname": "TokenType.MOD", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.MOD: 'MOD'>"}, "sqlglot.tokens.TokenType.NATURAL": {"fullname": "sqlglot.tokens.TokenType.NATURAL", "modulename": "sqlglot.tokens", "qualname": "TokenType.NATURAL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NATURAL: 'NATURAL'>"}, "sqlglot.tokens.TokenType.NEXT": {"fullname": "sqlglot.tokens.TokenType.NEXT", "modulename": "sqlglot.tokens", "qualname": "TokenType.NEXT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NEXT: 'NEXT'>"}, "sqlglot.tokens.TokenType.NO_ACTION": {"fullname": "sqlglot.tokens.TokenType.NO_ACTION", "modulename": "sqlglot.tokens", "qualname": "TokenType.NO_ACTION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NO_ACTION: 'NO_ACTION'>"}, "sqlglot.tokens.TokenType.NOTNULL": {"fullname": "sqlglot.tokens.TokenType.NOTNULL", "modulename": "sqlglot.tokens", "qualname": "TokenType.NOTNULL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NOTNULL: 'NOTNULL'>"}, "sqlglot.tokens.TokenType.NULL": {"fullname": "sqlglot.tokens.TokenType.NULL", "modulename": "sqlglot.tokens", "qualname": "TokenType.NULL", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NULL: 'NULL'>"}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"fullname": "sqlglot.tokens.TokenType.NULLS_FIRST", "modulename": "sqlglot.tokens", "qualname": "TokenType.NULLS_FIRST", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NULLS_FIRST: 'NULLS_FIRST'>"}, "sqlglot.tokens.TokenType.NULLS_LAST": {"fullname": "sqlglot.tokens.TokenType.NULLS_LAST", "modulename": "sqlglot.tokens", "qualname": "TokenType.NULLS_LAST", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.NULLS_LAST: 'NULLS_LAST'>"}, "sqlglot.tokens.TokenType.OFFSET": {"fullname": "sqlglot.tokens.TokenType.OFFSET", "modulename": "sqlglot.tokens", "qualname": "TokenType.OFFSET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OFFSET: 'OFFSET'>"}, "sqlglot.tokens.TokenType.ON": {"fullname": "sqlglot.tokens.TokenType.ON", "modulename": "sqlglot.tokens", "qualname": "TokenType.ON", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ON: 'ON'>"}, "sqlglot.tokens.TokenType.ONLY": {"fullname": "sqlglot.tokens.TokenType.ONLY", "modulename": "sqlglot.tokens", "qualname": "TokenType.ONLY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ONLY: 'ONLY'>"}, "sqlglot.tokens.TokenType.OPTIONS": {"fullname": "sqlglot.tokens.TokenType.OPTIONS", "modulename": "sqlglot.tokens", "qualname": "TokenType.OPTIONS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OPTIONS: 'OPTIONS'>"}, "sqlglot.tokens.TokenType.ORDER_BY": {"fullname": "sqlglot.tokens.TokenType.ORDER_BY", "modulename": "sqlglot.tokens", "qualname": "TokenType.ORDER_BY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ORDER_BY: 'ORDER_BY'>"}, "sqlglot.tokens.TokenType.ORDERED": {"fullname": "sqlglot.tokens.TokenType.ORDERED", "modulename": "sqlglot.tokens", "qualname": "TokenType.ORDERED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ORDERED: 'ORDERED'>"}, "sqlglot.tokens.TokenType.ORDINALITY": {"fullname": "sqlglot.tokens.TokenType.ORDINALITY", "modulename": "sqlglot.tokens", "qualname": "TokenType.ORDINALITY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ORDINALITY: 'ORDINALITY'>"}, "sqlglot.tokens.TokenType.OUTER": {"fullname": "sqlglot.tokens.TokenType.OUTER", "modulename": "sqlglot.tokens", "qualname": "TokenType.OUTER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OUTER: 'OUTER'>"}, "sqlglot.tokens.TokenType.OUT_OF": {"fullname": "sqlglot.tokens.TokenType.OUT_OF", "modulename": "sqlglot.tokens", "qualname": "TokenType.OUT_OF", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OUT_OF: 'OUT_OF'>"}, "sqlglot.tokens.TokenType.OVER": {"fullname": "sqlglot.tokens.TokenType.OVER", "modulename": "sqlglot.tokens", "qualname": "TokenType.OVER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OVER: 'OVER'>"}, "sqlglot.tokens.TokenType.OVERWRITE": {"fullname": "sqlglot.tokens.TokenType.OVERWRITE", "modulename": "sqlglot.tokens", "qualname": "TokenType.OVERWRITE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.OVERWRITE: 'OVERWRITE'>"}, "sqlglot.tokens.TokenType.PARTITION": {"fullname": "sqlglot.tokens.TokenType.PARTITION", "modulename": "sqlglot.tokens", "qualname": "TokenType.PARTITION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PARTITION: 'PARTITION'>"}, "sqlglot.tokens.TokenType.PARTITION_BY": {"fullname": "sqlglot.tokens.TokenType.PARTITION_BY", "modulename": "sqlglot.tokens", "qualname": "TokenType.PARTITION_BY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PARTITION_BY: 'PARTITION_BY'>"}, "sqlglot.tokens.TokenType.PERCENT": {"fullname": "sqlglot.tokens.TokenType.PERCENT", "modulename": "sqlglot.tokens", "qualname": "TokenType.PERCENT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PERCENT: 'PERCENT'>"}, "sqlglot.tokens.TokenType.PIVOT": {"fullname": "sqlglot.tokens.TokenType.PIVOT", "modulename": "sqlglot.tokens", "qualname": "TokenType.PIVOT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PIVOT: 'PIVOT'>"}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"fullname": "sqlglot.tokens.TokenType.PLACEHOLDER", "modulename": "sqlglot.tokens", "qualname": "TokenType.PLACEHOLDER", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PLACEHOLDER: 'PLACEHOLDER'>"}, "sqlglot.tokens.TokenType.PRECEDING": {"fullname": "sqlglot.tokens.TokenType.PRECEDING", "modulename": "sqlglot.tokens", "qualname": "TokenType.PRECEDING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PRECEDING: 'PRECEDING'>"}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"fullname": "sqlglot.tokens.TokenType.PRIMARY_KEY", "modulename": "sqlglot.tokens", "qualname": "TokenType.PRIMARY_KEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PRIMARY_KEY: 'PRIMARY_KEY'>"}, "sqlglot.tokens.TokenType.PROCEDURE": {"fullname": "sqlglot.tokens.TokenType.PROCEDURE", "modulename": "sqlglot.tokens", "qualname": "TokenType.PROCEDURE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PROCEDURE: 'PROCEDURE'>"}, "sqlglot.tokens.TokenType.PROPERTIES": {"fullname": "sqlglot.tokens.TokenType.PROPERTIES", "modulename": "sqlglot.tokens", "qualname": "TokenType.PROPERTIES", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PROPERTIES: 'PROPERTIES'>"}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"fullname": "sqlglot.tokens.TokenType.PSEUDO_TYPE", "modulename": "sqlglot.tokens", "qualname": "TokenType.PSEUDO_TYPE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.PSEUDO_TYPE: 'PSEUDO_TYPE'>"}, "sqlglot.tokens.TokenType.QUALIFY": {"fullname": "sqlglot.tokens.TokenType.QUALIFY", "modulename": "sqlglot.tokens", "qualname": "TokenType.QUALIFY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.QUALIFY: 'QUALIFY'>"}, "sqlglot.tokens.TokenType.QUOTE": {"fullname": "sqlglot.tokens.TokenType.QUOTE", "modulename": "sqlglot.tokens", "qualname": "TokenType.QUOTE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.QUOTE: 'QUOTE'>"}, "sqlglot.tokens.TokenType.RANGE": {"fullname": "sqlglot.tokens.TokenType.RANGE", "modulename": "sqlglot.tokens", "qualname": "TokenType.RANGE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.RANGE: 'RANGE'>"}, "sqlglot.tokens.TokenType.RECURSIVE": {"fullname": "sqlglot.tokens.TokenType.RECURSIVE", "modulename": "sqlglot.tokens", "qualname": "TokenType.RECURSIVE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.RECURSIVE: 'RECURSIVE'>"}, "sqlglot.tokens.TokenType.REPLACE": {"fullname": "sqlglot.tokens.TokenType.REPLACE", "modulename": "sqlglot.tokens", "qualname": "TokenType.REPLACE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.REPLACE: 'REPLACE'>"}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"fullname": "sqlglot.tokens.TokenType.RESPECT_NULLS", "modulename": "sqlglot.tokens", "qualname": "TokenType.RESPECT_NULLS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.RESPECT_NULLS: 'RESPECT_NULLS'>"}, "sqlglot.tokens.TokenType.REFERENCES": {"fullname": "sqlglot.tokens.TokenType.REFERENCES", "modulename": "sqlglot.tokens", "qualname": "TokenType.REFERENCES", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.REFERENCES: 'REFERENCES'>"}, "sqlglot.tokens.TokenType.RIGHT": {"fullname": "sqlglot.tokens.TokenType.RIGHT", "modulename": "sqlglot.tokens", "qualname": "TokenType.RIGHT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.RIGHT: 'RIGHT'>"}, "sqlglot.tokens.TokenType.RLIKE": {"fullname": "sqlglot.tokens.TokenType.RLIKE", "modulename": "sqlglot.tokens", "qualname": "TokenType.RLIKE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.RLIKE: 'RLIKE'>"}, "sqlglot.tokens.TokenType.ROLLBACK": {"fullname": "sqlglot.tokens.TokenType.ROLLBACK", "modulename": "sqlglot.tokens", "qualname": "TokenType.ROLLBACK", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ROLLBACK: 'ROLLBACK'>"}, "sqlglot.tokens.TokenType.ROLLUP": {"fullname": "sqlglot.tokens.TokenType.ROLLUP", "modulename": "sqlglot.tokens", "qualname": "TokenType.ROLLUP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ROLLUP: 'ROLLUP'>"}, "sqlglot.tokens.TokenType.ROW": {"fullname": "sqlglot.tokens.TokenType.ROW", "modulename": "sqlglot.tokens", "qualname": "TokenType.ROW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ROW: 'ROW'>"}, "sqlglot.tokens.TokenType.ROWS": {"fullname": "sqlglot.tokens.TokenType.ROWS", "modulename": "sqlglot.tokens", "qualname": "TokenType.ROWS", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.ROWS: 'ROWS'>"}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"fullname": "sqlglot.tokens.TokenType.SCHEMA_COMMENT", "modulename": "sqlglot.tokens", "qualname": "TokenType.SCHEMA_COMMENT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SCHEMA_COMMENT: 'SCHEMA_COMMENT'>"}, "sqlglot.tokens.TokenType.SEED": {"fullname": "sqlglot.tokens.TokenType.SEED", "modulename": "sqlglot.tokens", "qualname": "TokenType.SEED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SEED: 'SEED'>"}, "sqlglot.tokens.TokenType.SELECT": {"fullname": "sqlglot.tokens.TokenType.SELECT", "modulename": "sqlglot.tokens", "qualname": "TokenType.SELECT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SELECT: 'SELECT'>"}, "sqlglot.tokens.TokenType.SEMI": {"fullname": "sqlglot.tokens.TokenType.SEMI", "modulename": "sqlglot.tokens", "qualname": "TokenType.SEMI", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SEMI: 'SEMI'>"}, "sqlglot.tokens.TokenType.SEPARATOR": {"fullname": "sqlglot.tokens.TokenType.SEPARATOR", "modulename": "sqlglot.tokens", "qualname": "TokenType.SEPARATOR", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SEPARATOR: 'SEPARATOR'>"}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"fullname": "sqlglot.tokens.TokenType.SERDE_PROPERTIES", "modulename": "sqlglot.tokens", "qualname": "TokenType.SERDE_PROPERTIES", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SERDE_PROPERTIES: 'SERDE_PROPERTIES'>"}, "sqlglot.tokens.TokenType.SET": {"fullname": "sqlglot.tokens.TokenType.SET", "modulename": "sqlglot.tokens", "qualname": "TokenType.SET", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SET: 'SET'>"}, "sqlglot.tokens.TokenType.SHOW": {"fullname": "sqlglot.tokens.TokenType.SHOW", "modulename": "sqlglot.tokens", "qualname": "TokenType.SHOW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SHOW: 'SHOW'>"}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"fullname": "sqlglot.tokens.TokenType.SIMILAR_TO", "modulename": "sqlglot.tokens", "qualname": "TokenType.SIMILAR_TO", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SIMILAR_TO: 'SIMILAR_TO'>"}, "sqlglot.tokens.TokenType.SOME": {"fullname": "sqlglot.tokens.TokenType.SOME", "modulename": "sqlglot.tokens", "qualname": "TokenType.SOME", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SOME: 'SOME'>"}, "sqlglot.tokens.TokenType.SORTKEY": {"fullname": "sqlglot.tokens.TokenType.SORTKEY", "modulename": "sqlglot.tokens", "qualname": "TokenType.SORTKEY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SORTKEY: 'SORTKEY'>"}, "sqlglot.tokens.TokenType.SORT_BY": {"fullname": "sqlglot.tokens.TokenType.SORT_BY", "modulename": "sqlglot.tokens", "qualname": "TokenType.SORT_BY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.SORT_BY: 'SORT_BY'>"}, "sqlglot.tokens.TokenType.STRUCT": {"fullname": "sqlglot.tokens.TokenType.STRUCT", "modulename": "sqlglot.tokens", "qualname": "TokenType.STRUCT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.STRUCT: 'STRUCT'>"}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"fullname": "sqlglot.tokens.TokenType.TABLE_SAMPLE", "modulename": "sqlglot.tokens", "qualname": "TokenType.TABLE_SAMPLE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TABLE_SAMPLE: 'TABLE_SAMPLE'>"}, "sqlglot.tokens.TokenType.TEMPORARY": {"fullname": "sqlglot.tokens.TokenType.TEMPORARY", "modulename": "sqlglot.tokens", "qualname": "TokenType.TEMPORARY", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TEMPORARY: 'TEMPORARY'>"}, "sqlglot.tokens.TokenType.TOP": {"fullname": "sqlglot.tokens.TokenType.TOP", "modulename": "sqlglot.tokens", "qualname": "TokenType.TOP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TOP: 'TOP'>"}, "sqlglot.tokens.TokenType.THEN": {"fullname": "sqlglot.tokens.TokenType.THEN", "modulename": "sqlglot.tokens", "qualname": "TokenType.THEN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.THEN: 'THEN'>"}, "sqlglot.tokens.TokenType.TRAILING": {"fullname": "sqlglot.tokens.TokenType.TRAILING", "modulename": "sqlglot.tokens", "qualname": "TokenType.TRAILING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TRAILING: 'TRAILING'>"}, "sqlglot.tokens.TokenType.TRUE": {"fullname": "sqlglot.tokens.TokenType.TRUE", "modulename": "sqlglot.tokens", "qualname": "TokenType.TRUE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.TRUE: 'TRUE'>"}, "sqlglot.tokens.TokenType.UNBOUNDED": {"fullname": "sqlglot.tokens.TokenType.UNBOUNDED", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNBOUNDED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNBOUNDED: 'UNBOUNDED'>"}, "sqlglot.tokens.TokenType.UNCACHE": {"fullname": "sqlglot.tokens.TokenType.UNCACHE", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNCACHE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNCACHE: 'UNCACHE'>"}, "sqlglot.tokens.TokenType.UNION": {"fullname": "sqlglot.tokens.TokenType.UNION", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNION", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNION: 'UNION'>"}, "sqlglot.tokens.TokenType.UNLOGGED": {"fullname": "sqlglot.tokens.TokenType.UNLOGGED", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNLOGGED", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNLOGGED: 'UNLOGGED'>"}, "sqlglot.tokens.TokenType.UNNEST": {"fullname": "sqlglot.tokens.TokenType.UNNEST", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNNEST", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNNEST: 'UNNEST'>"}, "sqlglot.tokens.TokenType.UNPIVOT": {"fullname": "sqlglot.tokens.TokenType.UNPIVOT", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNPIVOT", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNPIVOT: 'UNPIVOT'>"}, "sqlglot.tokens.TokenType.UPDATE": {"fullname": "sqlglot.tokens.TokenType.UPDATE", "modulename": "sqlglot.tokens", "qualname": "TokenType.UPDATE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UPDATE: 'UPDATE'>"}, "sqlglot.tokens.TokenType.USE": {"fullname": "sqlglot.tokens.TokenType.USE", "modulename": "sqlglot.tokens", "qualname": "TokenType.USE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.USE: 'USE'>"}, "sqlglot.tokens.TokenType.USING": {"fullname": "sqlglot.tokens.TokenType.USING", "modulename": "sqlglot.tokens", "qualname": "TokenType.USING", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.USING: 'USING'>"}, "sqlglot.tokens.TokenType.VALUES": {"fullname": "sqlglot.tokens.TokenType.VALUES", "modulename": "sqlglot.tokens", "qualname": "TokenType.VALUES", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VALUES: 'VALUES'>"}, "sqlglot.tokens.TokenType.VIEW": {"fullname": "sqlglot.tokens.TokenType.VIEW", "modulename": "sqlglot.tokens", "qualname": "TokenType.VIEW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VIEW: 'VIEW'>"}, "sqlglot.tokens.TokenType.VOLATILE": {"fullname": "sqlglot.tokens.TokenType.VOLATILE", "modulename": "sqlglot.tokens", "qualname": "TokenType.VOLATILE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.VOLATILE: 'VOLATILE'>"}, "sqlglot.tokens.TokenType.WHEN": {"fullname": "sqlglot.tokens.TokenType.WHEN", "modulename": "sqlglot.tokens", "qualname": "TokenType.WHEN", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WHEN: 'WHEN'>"}, "sqlglot.tokens.TokenType.WHERE": {"fullname": "sqlglot.tokens.TokenType.WHERE", "modulename": "sqlglot.tokens", "qualname": "TokenType.WHERE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WHERE: 'WHERE'>"}, "sqlglot.tokens.TokenType.WINDOW": {"fullname": "sqlglot.tokens.TokenType.WINDOW", "modulename": "sqlglot.tokens", "qualname": "TokenType.WINDOW", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WINDOW: 'WINDOW'>"}, "sqlglot.tokens.TokenType.WITH": {"fullname": "sqlglot.tokens.TokenType.WITH", "modulename": "sqlglot.tokens", "qualname": "TokenType.WITH", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WITH: 'WITH'>"}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"fullname": "sqlglot.tokens.TokenType.WITH_TIME_ZONE", "modulename": "sqlglot.tokens", "qualname": "TokenType.WITH_TIME_ZONE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WITH_TIME_ZONE: 'WITH_TIME_ZONE'>"}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"fullname": "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE", "modulename": "sqlglot.tokens", "qualname": "TokenType.WITH_LOCAL_TIME_ZONE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WITH_LOCAL_TIME_ZONE: 'WITH_LOCAL_TIME_ZONE'>"}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"fullname": "sqlglot.tokens.TokenType.WITHIN_GROUP", "modulename": "sqlglot.tokens", "qualname": "TokenType.WITHIN_GROUP", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WITHIN_GROUP: 'WITHIN_GROUP'>"}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"fullname": "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE", "modulename": "sqlglot.tokens", "qualname": "TokenType.WITHOUT_TIME_ZONE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.WITHOUT_TIME_ZONE: 'WITHOUT_TIME_ZONE'>"}, "sqlglot.tokens.TokenType.UNIQUE": {"fullname": "sqlglot.tokens.TokenType.UNIQUE", "modulename": "sqlglot.tokens", "qualname": "TokenType.UNIQUE", "kind": "variable", "doc": "<p></p>\n", "default_value": " = <TokenType.UNIQUE: 'UNIQUE'>"}, "sqlglot.tokens.Token": {"fullname": "sqlglot.tokens.Token", "modulename": "sqlglot.tokens", "qualname": "Token", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.tokens.Token.__init__": {"fullname": "sqlglot.tokens.Token.__init__", "modulename": "sqlglot.tokens", "qualname": "Token.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">token_type</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">TokenType</span>,</span><span class=\"param\">\t<span class=\"n\">text</span><span class=\"p\">:</span> <span class=\"nb\">str</span>,</span><span class=\"param\">\t<span class=\"n\">line</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">1</span>,</span><span class=\"param\">\t<span class=\"n\">col</span><span class=\"p\">:</span> <span class=\"nb\">int</span> <span class=\"o\">=</span> <span class=\"mi\">1</span>,</span><span class=\"param\">\t<span class=\"n\">comments</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"nb\">str</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"p\">[]</span></span>)</span>"}, "sqlglot.tokens.Token.number": {"fullname": "sqlglot.tokens.Token.number", "modulename": "sqlglot.tokens", "qualname": "Token.number", "kind": "function", "doc": "<p>Returns a NUMBER token with <code>number</code> as its text.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">number</span><span class=\"p\">:</span> <span class=\"nb\">int</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span>:</span></span>", "funcdef": "def"}, "sqlglot.tokens.Token.string": {"fullname": "sqlglot.tokens.Token.string", "modulename": "sqlglot.tokens", "qualname": "Token.string", "kind": "function", "doc": "<p>Returns a STRING token with <code>string</code> as its text.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">string</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span>:</span></span>", "funcdef": "def"}, "sqlglot.tokens.Token.identifier": {"fullname": "sqlglot.tokens.Token.identifier", "modulename": "sqlglot.tokens", "qualname": "Token.identifier", "kind": "function", "doc": "<p>Returns an IDENTIFIER token with <code>identifier</code> as its text.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">identifier</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span>:</span></span>", "funcdef": "def"}, "sqlglot.tokens.Token.var": {"fullname": "sqlglot.tokens.Token.var", "modulename": "sqlglot.tokens", "qualname": "Token.var", "kind": "function", "doc": "<p>Returns an VAR token with <code>var</code> as its text.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">cls</span>, </span><span class=\"param\"><span class=\"n\">var</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span>:</span></span>", "funcdef": "def"}, "sqlglot.tokens.Tokenizer": {"fullname": "sqlglot.tokens.Tokenizer", "modulename": "sqlglot.tokens", "qualname": "Tokenizer", "kind": "class", "doc": "<p></p>\n"}, "sqlglot.tokens.Tokenizer.__init__": {"fullname": "sqlglot.tokens.Tokenizer.__init__", "modulename": "sqlglot.tokens", "qualname": "Tokenizer.__init__", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">()</span>"}, "sqlglot.tokens.Tokenizer.reset": {"fullname": "sqlglot.tokens.Tokenizer.reset", "modulename": "sqlglot.tokens", "qualname": "Tokenizer.reset", "kind": "function", "doc": "<p></p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span></span><span class=\"return-annotation\">) -> <span class=\"kc\">None</span>:</span></span>", "funcdef": "def"}, "sqlglot.tokens.Tokenizer.tokenize": {"fullname": "sqlglot.tokens.Tokenizer.tokenize", "modulename": "sqlglot.tokens", "qualname": "Tokenizer.tokenize", "kind": "function", "doc": "<p>Returns a list of tokens corresponding to the SQL string <code>sql</code>.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"bp\">self</span>, </span><span class=\"param\"><span class=\"n\">sql</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">tokens</span><span class=\"o\">.</span><span class=\"n\">Token</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.transforms": {"fullname": "sqlglot.transforms", "modulename": "sqlglot.transforms", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.transforms.unalias_group": {"fullname": "sqlglot.transforms.unalias_group", "modulename": "sqlglot.transforms", "qualname": "unalias_group", "kind": "function", "doc": "<p>Replace references to select aliases in GROUP BY clauses.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"kn\">import</span> <span class=\"nn\">sqlglot</span>\n<span class=\"gp\">>>> </span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">parse_one</span><span class=\"p\">(</span><span class=\"s2\">"SELECT a AS b FROM x GROUP BY b"</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">transform</span><span class=\"p\">(</span><span class=\"n\">unalias_group</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">sql</span><span class=\"p\">()</span>\n<span class=\"go\">'SELECT a AS b FROM x GROUP BY 1'</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression that will be transformed.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The transformed expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.transforms.eliminate_distinct_on": {"fullname": "sqlglot.transforms.eliminate_distinct_on", "modulename": "sqlglot.transforms", "qualname": "eliminate_distinct_on", "kind": "function", "doc": "<p>Convert SELECT DISTINCT ON statements to a subquery with a window function.</p>\n\n<p>This is useful for dialects that don't support SELECT DISTINCT ON but support window functions.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>expression:</strong> the expression that will be transformed.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The transformed expression.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.transforms.remove_precision_parameterized_types": {"fullname": "sqlglot.transforms.remove_precision_parameterized_types", "modulename": "sqlglot.transforms", "qualname": "remove_precision_parameterized_types", "kind": "function", "doc": "<p>Some dialects only allow the precision for parameterized types to be defined in the DDL and not in other expressions.\nThis transforms removes the precision from parameterized types in expressions.</p>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">expression</span><span class=\"p\">:</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span></span><span class=\"return-annotation\">) -> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span>:</span></span>", "funcdef": "def"}, "sqlglot.transforms.preprocess": {"fullname": "sqlglot.transforms.preprocess", "modulename": "sqlglot.transforms", "qualname": "preprocess", "kind": "function", "doc": "<p>Creates a new transform by chaining a sequence of transformations and converts the resulting\nexpression to SQL, using an appropriate <code>Generator.TRANSFORMS</code> function.</p>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>transforms:</strong> sequence of transform functions. These will be called in order.</li>\n<li><strong>to_sql:</strong> final transform that converts the resulting expression to a SQL string.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>Function that can be used as a generator transform.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code multiline\">(<span class=\"param\">\t<span class=\"n\">transforms</span><span class=\"p\">:</span> <span class=\"n\">List</span><span class=\"p\">[</span><span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">]]</span>,</span><span class=\"param\">\t<span class=\"n\">to_sql</span><span class=\"p\">:</span> <span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"nb\">str</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Callable</span><span class=\"p\">[[</span><span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">generator</span><span class=\"o\">.</span><span class=\"n\">Generator</span><span class=\"p\">,</span> <span class=\"n\">sqlglot</span><span class=\"o\">.</span><span class=\"n\">expressions</span><span class=\"o\">.</span><span class=\"n\">Expression</span><span class=\"p\">],</span> <span class=\"nb\">str</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}, "sqlglot.transforms.delegate": {"fullname": "sqlglot.transforms.delegate", "modulename": "sqlglot.transforms", "qualname": "delegate", "kind": "function", "doc": "<p>Create a new method that delegates to <code>attr</code>. This is useful for creating <code>Generator.TRANSFORMS</code>\nfunctions that delegate to existing generator methods.</p>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">attr</span><span class=\"p\">:</span> <span class=\"nb\">str</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Callable</span>:</span></span>", "funcdef": "def"}, "sqlglot.trie": {"fullname": "sqlglot.trie", "modulename": "sqlglot.trie", "kind": "module", "doc": "<p></p>\n"}, "sqlglot.trie.new_trie": {"fullname": "sqlglot.trie.new_trie", "modulename": "sqlglot.trie", "qualname": "new_trie", "kind": "function", "doc": "<p>Creates a new trie out of a collection of keywords.</p>\n\n<p>The trie is represented as a sequence of nested dictionaries keyed by either single character\nstrings, or by 0, which is used to designate that a keyword is in the trie.</p>\n\n<h6 id=\"example\">Example:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">new_trie</span><span class=\"p\">([</span><span class=\"s2\">"bla"</span><span class=\"p\">,</span> <span class=\"s2\">"foo"</span><span class=\"p\">,</span> <span class=\"s2\">"blab"</span><span class=\"p\">])</span>\n<span class=\"go\">{'b': {'l': {'a': {0: True, 'b': {0: True}}}}, 'f': {'o': {'o': {0: True}}}}</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>keywords:</strong> the keywords to create the trie from.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>The trie corresponding to <code>keywords</code>.</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">keywords</span><span class=\"p\">:</span> <span class=\"n\">Iterable</span><span class=\"p\">[</span><span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"n\">Hashable</span><span class=\"p\">]]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Dict</span>:</span></span>", "funcdef": "def"}, "sqlglot.trie.in_trie": {"fullname": "sqlglot.trie.in_trie", "modulename": "sqlglot.trie", "qualname": "in_trie", "kind": "function", "doc": "<p>Checks whether a key is in a trie.</p>\n\n<h6 id=\"examples\">Examples:</h6>\n\n<blockquote>\n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">in_trie</span><span class=\"p\">(</span><span class=\"n\">new_trie</span><span class=\"p\">([</span><span class=\"s2\">"cat"</span><span class=\"p\">]),</span> <span class=\"s2\">"bob"</span><span class=\"p\">)</span>\n<span class=\"go\">(0, {'c': {'a': {'t': {0: True}}}})</span>\n</code></pre>\n </div>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">in_trie</span><span class=\"p\">(</span><span class=\"n\">new_trie</span><span class=\"p\">([</span><span class=\"s2\">"cat"</span><span class=\"p\">]),</span> <span class=\"s2\">"ca"</span><span class=\"p\">)</span>\n<span class=\"go\">(1, {'t': {0: True}})</span>\n</code></pre>\n </div>\n \n <div class=\"pdoc-code codehilite\">\n<pre><span></span><code><span class=\"gp\">>>> </span><span class=\"n\">in_trie</span><span class=\"p\">(</span><span class=\"n\">new_trie</span><span class=\"p\">([</span><span class=\"s2\">"cat"</span><span class=\"p\">]),</span> <span class=\"s2\">"cat"</span><span class=\"p\">)</span>\n<span class=\"go\">(2, {0: True})</span>\n</code></pre>\n </div>\n</blockquote>\n\n<h6 id=\"arguments\">Arguments:</h6>\n\n<ul>\n<li><strong>trie:</strong> the trie to be searched.</li>\n<li><strong>key:</strong> the target key.</li>\n</ul>\n\n<h6 id=\"returns\">Returns:</h6>\n\n<blockquote>\n <p>A pair <code>(value, subtrie)</code>, where <code>subtrie</code> is the sub-trie we get at the point where the search stops, and <code>value</code>\n is either 0 (search was unsuccessful), 1 (<code>value</code> is a prefix of a keyword in <code>trie</code>) or 2 (<code>key is in</code>trie`).</p>\n</blockquote>\n", "signature": "<span class=\"signature pdoc-code condensed\">(<span class=\"param\"><span class=\"n\">trie</span><span class=\"p\">:</span> <span class=\"n\">Dict</span>, </span><span class=\"param\"><span class=\"n\">key</span><span class=\"p\">:</span> <span class=\"n\">Sequence</span><span class=\"p\">[</span><span class=\"n\">Hashable</span><span class=\"p\">]</span></span><span class=\"return-annotation\">) -> <span class=\"n\">Tuple</span><span class=\"p\">[</span><span class=\"nb\">int</span><span class=\"p\">,</span> <span class=\"n\">Dict</span><span class=\"p\">]</span>:</span></span>", "funcdef": "def"}}, "docInfo": {"sqlglot": {"qualname": 0, "fullname": 1, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 5685}, "sqlglot.pretty": {"qualname": 1, "fullname": 2, "annotation": 0, "default_value": 2, "signature": 0, "bases": 0, "doc": 10}, "sqlglot.schema": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.parse": {"qualname": 1, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 124, "bases": 0, "doc": 84}, "sqlglot.parse_one": {"qualname": 2, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 198, "bases": 0, "doc": 99}, "sqlglot.transpile": {"qualname": 1, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 239, "bases": 0, "doc": 177}, "sqlglot.dataframe": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3543}, "sqlglot.dataframe.sql": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.SparkSession": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.SparkSession.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.SparkSession.table": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 208, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.SparkSession.sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 259, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.copy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 41, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.select": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 48, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.alias": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.where": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 86, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.filter": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 86, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 48, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.agg": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 48, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.join": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 180, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 120, "bases": 0, "doc": 44}, "sqlglot.dataframe.sql.DataFrame.sort": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 120, "bases": 0, "doc": 44}, "sqlglot.dataframe.sql.DataFrame.union": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 61, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.intersect": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.distinct": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 38, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.dropna": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 138, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.fillna": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 123, "bases": 0, "doc": 100}, "sqlglot.dataframe.sql.DataFrame.replace": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 217, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 77, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.drop": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 80, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.limit": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.hint": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 77, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.repartition": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 111, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.cache": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrame.persist": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 60, "bases": 0, "doc": 20}, "sqlglot.dataframe.sql.GroupedData": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 106, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.agg": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 90, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.count": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.mean": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.avg": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.max": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.min": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.sum": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.GroupedData.pivot": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 63, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.ensure_col": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 71, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.ensure_cols": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 98, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 123, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"qualname": 5, "fullname": 8, "annotation": 0, "default_value": 0, "signature": 92, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.binary_op": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 85, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 85, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.unary_op": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.ensure_literal": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 39, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.copy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.set_table_name": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 55, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.alias": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.asc": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.desc": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.when": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 77, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.otherwise": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.isNull": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.isNotNull": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.cast": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 53, "bases": 0, "doc": 27}, "sqlglot.dataframe.sql.Column.startswith": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 78, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.endswith": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 78, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.rlike": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.like": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.ilike": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.substr": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 121, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.isin": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 81, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.between": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 97, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Column.over": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameNaFunctions": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 138, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 143, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 177, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Window": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Window.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Window.partitionBy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 104, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Window.orderBy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 104, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Window.rowsBetween": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 54, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.Window.rangeBetween": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 54, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 38, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.copy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 104, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 104, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 54, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 54, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameReader": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameReader.table": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 122, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 41, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 27, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 52, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 70, "bases": 0, "doc": 3}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 71, "bases": 0, "doc": 3}, "sqlglot.dialects": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 764}, "sqlglot.dialects.bigquery": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 7}, "sqlglot.dialects.bigquery.BigQuery": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"qualname": 5, "fullname": 8, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.clickhouse": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.clickhouse.ClickHouse": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.databricks": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.databricks.Databricks": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.databricks.Databricks.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.databricks.Databricks.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 174}, "sqlglot.dialects.databricks.Databricks.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 495}, "sqlglot.dialects.dialect": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 5}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 8, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.HIVE": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.SPARK": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.TRINO": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.TSQL": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.DRILL": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 105, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.format_time": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 70, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.parse": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.parse_into": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 126, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.generate": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 50, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.transpile": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 37, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.Dialect.generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.rename_func": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 58, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.if_sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 67, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"qualname": 5, "fullname": 8, "annotation": 0, "default_value": 0, "signature": 67, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.inline_array_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_ilike_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"qualname": 5, "fullname": 8, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_tablesample_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_pivot_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_trycast_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.no_properties_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.str_position_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.struct_extract_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.var_map_sql": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 91, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.format_time_lambda": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 90, "bases": 0, "doc": 71}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 46}, "sqlglot.dialects.dialect.parse_date_delta": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 78, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.locate_to_strposition": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.timestrtotime_sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.datestrtodate_sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.dialect.trim_sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.dialects.drill": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.drill.if_sql": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 59}, "sqlglot.dialects.drill.Drill": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.drill.Drill.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.drill.Drill.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.drill.Drill.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.drill.Drill.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.dialects.duckdb": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.duckdb.DuckDB": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.hive": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.hive.Hive": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.hive.Hive.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.hive.Hive.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.hive.Hive.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.hive.Hive.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.mysql": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.mysql.MySQL": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.mysql.MySQL.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.mysql.MySQL.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.mysql.MySQL.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.oracle": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.oracle.Oracle": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.oracle.Oracle.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.oracle.Oracle.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.oracle.Oracle.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 3}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.postgres": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.postgres.Postgres": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.postgres.Postgres.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.postgres.Postgres.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.postgres.Postgres.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.presto": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.presto.Presto": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.presto.Presto.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.presto.Presto.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.presto.Presto.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.presto.Presto.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.redshift": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.redshift.Redshift": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.redshift.Redshift.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.redshift.Redshift.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 174}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 3}, "sqlglot.dialects.redshift.Redshift.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 495}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 58}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 19}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 16}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 75}, "sqlglot.dialects.snowflake": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 66}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 125}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 36, "bases": 0, "doc": 3}, "sqlglot.dialects.spark": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.spark.Spark": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.spark.Spark.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.spark.Spark.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 174}, "sqlglot.dialects.spark.Spark.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 495}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.spark.Spark.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 3}, "sqlglot.dialects.sqlite": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.sqlite.SQLite": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.sqlite.SQLite.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.sqlite.SQLite.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.sqlite.SQLite.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.starrocks": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.starrocks.StarRocks": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 495}, "sqlglot.dialects.tableau": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.tableau.Tableau": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.tableau.Tableau.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.tableau.Tableau.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.tableau.Tableau.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.teradata": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.teradata.Teradata": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.teradata.Teradata.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.teradata.Teradata.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.teradata.Teradata.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.trino": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.trino.Trino": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.trino.Trino.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.trino.Trino.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 495}, "sqlglot.dialects.trino.Trino.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 5, "doc": 3}, "sqlglot.dialects.tsql": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"qualname": 6, "fullname": 9, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.dialects.tsql.TSQL": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.dialects.tsql.TSQL.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.dialects.tsql.TSQL.Parser": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 174}, "sqlglot.dialects.tsql.TSQL.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.diff": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 6444}, "sqlglot.diff.Insert": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 10}, "sqlglot.diff.Insert.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.diff.Remove": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 10}, "sqlglot.diff.Remove.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.diff.Move": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 14}, "sqlglot.diff.Move.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.diff.Update": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 10}, "sqlglot.diff.Update.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.diff.Keep": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 11}, "sqlglot.diff.Keep.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.diff.diff": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 135, "bases": 0, "doc": 249}, "sqlglot.diff.ChangeDistiller": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 46}, "sqlglot.diff.ChangeDistiller.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 3}, "sqlglot.diff.ChangeDistiller.diff": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 141, "bases": 0, "doc": 3}, "sqlglot.errors": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.errors.ErrorLevel": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 5}, "sqlglot.errors.ErrorLevel.IGNORE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 6}, "sqlglot.errors.ErrorLevel.WARN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 6}, "sqlglot.errors.ErrorLevel.RAISE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 11}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 12}, "sqlglot.errors.SqlglotError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 11}, "sqlglot.errors.UnsupportedError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 11}, "sqlglot.errors.ParseError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 11}, "sqlglot.errors.ParseError.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.errors.ParseError.new": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 207, "bases": 0, "doc": 3}, "sqlglot.errors.TokenError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 11}, "sqlglot.errors.OptimizeError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 11}, "sqlglot.errors.SchemaError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 11}, "sqlglot.errors.ExecuteError": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 11}, "sqlglot.errors.concat_messages": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 35, "bases": 0, "doc": 3}, "sqlglot.errors.merge_errors": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.executor": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 2950}, "sqlglot.executor.execute": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 197, "bases": 0, "doc": 115}, "sqlglot.executor.context": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 64}, "sqlglot.executor.context.Context.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 66, "bases": 0, "doc": 21}, "sqlglot.executor.context.Context.eval": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.eval_tuple": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.add_columns": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 26, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.table_iter": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 72, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.filter": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.sort": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.set_row": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.set_index": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.executor.context.Context.set_range": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.executor.env": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.env.reverse_key": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.env.reverse_key.__init__": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 9, "bases": 0, "doc": 3}, "sqlglot.executor.env.filter_nulls": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.executor.env.null_if_any": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 13, "bases": 0, "doc": 59}, "sqlglot.executor.env.str_position": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 26, "bases": 0, "doc": 3}, "sqlglot.executor.env.substring": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.executor.env.cast": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.env.ordered": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.executor.env.interval": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.python": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.execute": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.generate": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 16}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 15}, "sqlglot.executor.python.PythonExecutor.context": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.table": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.scan": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.static": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.scan_table": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.join": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.hash_join": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 28, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.aggregate": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.sort": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.executor.python.PythonExecutor.set_operation": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.executor.python.Python": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 4, "doc": 3}, "sqlglot.executor.python.Python.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.executor.python.Python.Tokenizer": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 3}, "sqlglot.executor.python.Python.Generator": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 495}, "sqlglot.executor.table": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.table.Table": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.table.Table.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 30, "bases": 0, "doc": 3}, "sqlglot.executor.table.Table.add_columns": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 26, "bases": 0, "doc": 3}, "sqlglot.executor.table.Table.append": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.executor.table.Table.pop": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.executor.table.TableIter": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.table.TableIter.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 9, "bases": 0, "doc": 3}, "sqlglot.executor.table.RangeReader": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.table.RangeReader.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 9, "bases": 0, "doc": 3}, "sqlglot.executor.table.RowReader": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.executor.table.RowReader.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 20, "bases": 0, "doc": 3}, "sqlglot.executor.table.Tables": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 6, "doc": 87}, "sqlglot.executor.table.ensure_tables": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 3}, "sqlglot.expressions": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 61}, "sqlglot.expressions.Expression": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 346}, "sqlglot.expressions.Expression.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.expressions.Expression.this": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.expressions.Expression.expression": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.expressions.Expression.expressions": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.expressions.Expression.text": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 32}, "sqlglot.expressions.Expression.is_string": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 11}, "sqlglot.expressions.Expression.is_number": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 11}, "sqlglot.expressions.Expression.is_int": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 11}, "sqlglot.expressions.Expression.alias": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 18}, "sqlglot.expressions.Expression.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.Expression.copy": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 10}, "sqlglot.expressions.Expression.append": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 54}, "sqlglot.expressions.Expression.set": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 45}, "sqlglot.expressions.Expression.depth": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.expressions.Expression.find": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 65}, "sqlglot.expressions.Expression.find_all": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 63}, "sqlglot.expressions.Expression.find_ancestor": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 45}, "sqlglot.expressions.Expression.parent_select": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 8}, "sqlglot.expressions.Expression.walk": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 89}, "sqlglot.expressions.Expression.dfs": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 41, "bases": 0, "doc": 33}, "sqlglot.expressions.Expression.bfs": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 33}, "sqlglot.expressions.Expression.unnest": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 11}, "sqlglot.expressions.Expression.unalias": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 12}, "sqlglot.expressions.Expression.unnest_operands": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 9}, "sqlglot.expressions.Expression.flatten": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 28}, "sqlglot.expressions.Expression.sql": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 99, "bases": 0, "doc": 61}, "sqlglot.expressions.Expression.transform": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 111}, "sqlglot.expressions.Expression.replace": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 83}, "sqlglot.expressions.Expression.pop": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 9}, "sqlglot.expressions.Expression.assert_is": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 17, "bases": 0, "doc": 162}, "sqlglot.expressions.Expression.error_messages": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 79}, "sqlglot.expressions.Expression.dump": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 11}, "sqlglot.expressions.Expression.load": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 17}, "sqlglot.expressions.Condition": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Condition.and_": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 35, "bases": 0, "doc": 173}, "sqlglot.expressions.Condition.or_": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 35, "bases": 0, "doc": 173}, "sqlglot.expressions.Condition.not_": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 88}, "sqlglot.expressions.Predicate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 13}, "sqlglot.expressions.DerivedTable": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Unionable": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Unionable.union": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 211}, "sqlglot.expressions.Unionable.intersect": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 210}, "sqlglot.expressions.Unionable.except_": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 211}, "sqlglot.expressions.UDTF": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Cache": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Uncache": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Create": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Describe": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Set": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SetItem": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Show": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.UserDefinedFunction": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.UserDefinedFunctionKwarg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CharacterSet": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.With": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.WithinGroup": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CTE": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TableAlias": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitString": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.HexString": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ByteString": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Column": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Column.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.ColumnDef": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AlterColumn": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RenameTable": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ColumnConstraintKind": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AutoIncrementColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CheckColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CollateColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CommentColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DefaultColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.EncodeColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.NotNullColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.PrimaryKeyColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.UniqueColumnConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Constraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Delete": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Drop": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Filter": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Check": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Directory": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ForeignKey": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.PrimaryKey": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Unique": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Into": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.From": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Having": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Hint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.JoinHint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Identifier": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Identifier.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.Index": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Insert": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Introducer": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.National": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LoadData": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Partition": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Fetch": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Group": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Lambda": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Limit": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Literal": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Literal.number": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 3}, "sqlglot.expressions.Literal.string": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 3}, "sqlglot.expressions.Literal.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.Join": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Join.on": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 55, "bases": 0, "doc": 252}, "sqlglot.expressions.Join.using": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 55, "bases": 0, "doc": 254}, "sqlglot.expressions.Lateral": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.MatchRecognize": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Final": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Offset": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Order": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Cluster": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Distribute": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Sort": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Ordered": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Property": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AlgorithmProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DefinerProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SqlSecurityProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TableFormatProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.PartitionedByProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.FileFormatProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DistKeyProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SortKeyProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DistStyleProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LikeProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LocationProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.EngineProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AutoIncrementProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CharacterSetProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CollateProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SchemaCommentProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ReturnsProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LanguageProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ExecuteAsProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.VolatilityProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RowFormatDelimitedProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RowFormatSerdeProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SerdeProperties": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.FallbackProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.WithJournalTableProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LogProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.JournalProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AfterJournalProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ChecksumProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.FreespaceProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.MergeBlockRatioProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DataBlocksizeProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BlockCompressionProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.IsolatedLoadingProperty": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Properties": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Properties.Location": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 5}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"qualname": 5, "fullname": 7, "annotation": 0, "default_value": 13, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"qualname": 5, "fullname": 7, "annotation": 0, "default_value": 13, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.Properties.from_dict": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 30, "bases": 0, "doc": 3}, "sqlglot.expressions.Qualify": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Return": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Reference": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Tuple": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Subqueryable": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Subqueryable.subquery": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 213}, "sqlglot.expressions.Subqueryable.limit": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 61, "bases": 0, "doc": 3}, "sqlglot.expressions.Subqueryable.with_": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 77, "bases": 0, "doc": 319}, "sqlglot.expressions.Table": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SystemTime": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Union": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Union.limit": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 61, "bases": 0, "doc": 234}, "sqlglot.expressions.Except": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Intersect": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Unnest": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Update": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Values": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Var": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Schema": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Lock": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Select": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Select.from_": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 238}, "sqlglot.expressions.Select.group_by": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 287}, "sqlglot.expressions.Select.order_by": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 262}, "sqlglot.expressions.Select.sort_by": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 262}, "sqlglot.expressions.Select.cluster_by": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 262}, "sqlglot.expressions.Select.limit": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 61, "bases": 0, "doc": 231}, "sqlglot.expressions.Select.offset": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 61, "bases": 0, "doc": 231}, "sqlglot.expressions.Select.select": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 208}, "sqlglot.expressions.Select.lateral": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 247}, "sqlglot.expressions.Select.join": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 118, "bases": 0, "doc": 628}, "sqlglot.expressions.Select.where": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 265}, "sqlglot.expressions.Select.having": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 287}, "sqlglot.expressions.Select.window": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 3}, "sqlglot.expressions.Select.distinct": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 151}, "sqlglot.expressions.Select.ctas": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 72, "bases": 0, "doc": 236}, "sqlglot.expressions.Select.lock": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 61, "bases": 0, "doc": 331}, "sqlglot.expressions.Subquery": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Subquery.unnest": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 8}, "sqlglot.expressions.Subquery.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.TableSample": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Tag": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 15}, "sqlglot.expressions.Pivot": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Window": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.WindowSpec": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Where": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Star": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Star.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.Parameter": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SessionParameter": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Placeholder": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Null": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Boolean": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DataType": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DataType.Type": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 5}, "sqlglot.expressions.DataType.Type.CHAR": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.NCHAR": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.VARCHAR": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.TEXT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.BINARY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.VARBINARY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.INT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.TINYINT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.SMALLINT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.BIGINT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.FLOAT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.DOUBLE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.DECIMAL": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.JSON": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.JSONB": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.INTERVAL": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.TIME": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.DATE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.DATETIME": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.ARRAY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.MAP": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.UUID": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.STRUCT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.NULLABLE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.HSTORE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.SUPER": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.SERIAL": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.XML": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.MONEY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.IMAGE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.VARIANT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.OBJECT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.NULL": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.build": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 157, "bases": 0, "doc": 3}, "sqlglot.expressions.DataType.is_type": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 39, "bases": 0, "doc": 3}, "sqlglot.expressions.PseudoType": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StructKwarg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SubqueryPredicate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.All": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Any": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Exists": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Command": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Transaction": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Commit": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Rollback": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AlterTable": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AddConstraint": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DropPartition": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Binary": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Add": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Connector": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.And": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Or": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitwiseAnd": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitwiseLeftShift": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitwiseOr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitwiseRightShift": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitwiseXor": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Div": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Dot": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DPipe": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.EQ": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.NullSafeEQ": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.NullSafeNEQ": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Distance": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Escape": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Glob": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.GT": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.GTE": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.ILike": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.IntDiv": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Is": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Kwarg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 12}, "sqlglot.expressions.Like": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.LT": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.LTE": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Mod": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Mul": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.NEQ": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.SimilarTo": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Slice": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Sub": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Unary": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.BitwiseNot": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Not": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Paren": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.Neg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Alias": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Alias.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.Aliases": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AtTimeZone": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Between": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Bracket": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Distinct": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.In": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeUnit": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 10}, "sqlglot.expressions.TimeUnit.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.expressions.Interval": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.IgnoreNulls": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RespectNulls": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Func": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 128}, "sqlglot.expressions.Func.from_arg_list": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.expressions.Func.sql_names": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.expressions.Func.sql_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.expressions.Func.default_parser_mappings": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.expressions.AggFunc": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Abs": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Anonymous": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ApproxDistinct": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Array": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.GenerateSeries": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayAgg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayAll": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayAny": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayConcat": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayContains": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayFilter": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArraySize": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArraySort": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArraySum": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ArrayUnionAgg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Avg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.AnyValue": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Case": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Cast": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Cast.output_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 210}, "sqlglot.expressions.Cast.is_type": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 39, "bases": 0, "doc": 3}, "sqlglot.expressions.Collate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TryCast": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Ceil": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Coalesce": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Concat": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ConcatWs": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Count": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CurrentDate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CurrentDatetime": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CurrentTime": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.CurrentTimestamp": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DateAdd": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DateSub": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DateDiff": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DateTrunc": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DatetimeAdd": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DatetimeSub": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DatetimeDiff": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DatetimeTrunc": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DayOfWeek": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DayOfMonth": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DayOfYear": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.WeekOfYear": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LastDateOfMonth": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Extract": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimestampAdd": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimestampSub": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimestampDiff": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimestampTrunc": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimeAdd": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimeSub": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimeDiff": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TimeTrunc": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.DateFromParts": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DateStrToDate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DateToDateStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DateToDi": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Day": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Decode": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.DiToDate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Encode": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Exp": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Explode": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Floor": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Greatest": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.GroupConcat": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Hex": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.If": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.IfNull": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Initcap": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.JSONBContains": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.JSONExtract": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.JSONExtractScalar": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.JSONBExtract": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.JSONBExtractScalar": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Least": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Length": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Levenshtein": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Ln": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Log": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Log2": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Log10": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.LogicalOr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Lower": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Map": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.VarMap": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Matches": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 22}, "sqlglot.expressions.Max": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Min": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Month": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Nvl2": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Posexplode": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Pow": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.PercentileCont": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.PercentileDisc": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Quantile": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Quantiles": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.QuantileIf": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ApproxQuantile": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.ReadCSV": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Reduce": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RegexpLike": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RegexpILike": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RegexpSplit": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Repeat": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Round": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.RowNumber": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SafeDivide": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SetAgg": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.SortArray": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Split": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Substring": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StrPosition": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StrToDate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StrToTime": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StrToUnix": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.NumberToStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Struct": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StructExtract": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Sum": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Sqrt": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Stddev": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StddevPop": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.StddevSamp": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeToStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeToTimeStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeToUnix": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeStrToDate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeStrToTime": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TimeStrToUnix": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Trim": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TsOrDsAdd": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 3}, "sqlglot.expressions.TsOrDsToDateStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TsOrDsToDate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.TsOrDiToDi": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Unhex": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.UnixToStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.UnixToTime": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.UnixToTimeStr": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Upper": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Variance": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.VariancePop": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Week": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Year": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Use": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.Merge": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.When": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.expressions.maybe_parse": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 246, "bases": 0, "doc": 218}, "sqlglot.expressions.union": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 234}, "sqlglot.expressions.intersect": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 234}, "sqlglot.expressions.except_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 235}, "sqlglot.expressions.select": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 212}, "sqlglot.expressions.from_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 211}, "sqlglot.expressions.update": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 73, "bases": 0, "doc": 271}, "sqlglot.expressions.delete": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 156}, "sqlglot.expressions.condition": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 41, "bases": 0, "doc": 334}, "sqlglot.expressions.and_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 180}, "sqlglot.expressions.or_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 43, "bases": 0, "doc": 180}, "sqlglot.expressions.not_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 41, "bases": 0, "doc": 152}, "sqlglot.expressions.paren": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.expressions.to_identifier": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 53}, "sqlglot.expressions.to_interval": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 16}, "sqlglot.expressions.to_table": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 73, "bases": 0, "doc": 66}, "sqlglot.expressions.to_column": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 55, "bases": 0, "doc": 62}, "sqlglot.expressions.alias_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 218, "bases": 0, "doc": 292}, "sqlglot.expressions.subquery": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 38, "bases": 0, "doc": 197}, "sqlglot.expressions.column": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 47}, "sqlglot.expressions.cast": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 102, "bases": 0, "doc": 122}, "sqlglot.expressions.table_": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 69, "bases": 0, "doc": 58}, "sqlglot.expressions.values": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 131, "bases": 0, "doc": 169}, "sqlglot.expressions.rename_table": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 75, "bases": 0, "doc": 50}, "sqlglot.expressions.convert": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 54}, "sqlglot.expressions.replace_children": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 18}, "sqlglot.expressions.column_table_names": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 129}, "sqlglot.expressions.table_name": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 14, "bases": 0, "doc": 152}, "sqlglot.expressions.replace_tables": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 176}, "sqlglot.expressions.replace_placeholders": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 25, "bases": 0, "doc": 216}, "sqlglot.expressions.expand": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 84, "bases": 0, "doc": 200}, "sqlglot.expressions.func": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 122, "bases": 0, "doc": 272}, "sqlglot.expressions.true": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 7, "bases": 0, "doc": 8}, "sqlglot.expressions.false": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 7, "bases": 0, "doc": 8}, "sqlglot.expressions.null": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 7, "bases": 0, "doc": 7}, "sqlglot.generator": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.generator.Generator": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 495}, "sqlglot.generator.Generator.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 300, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.generate": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 28}, "sqlglot.generator.Generator.unsupported": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.sep": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.seg": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.pad_comment": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.maybe_comment": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.wrap": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.no_identify": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.normalize_func": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.indent": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 106, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.sql": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 96, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.uncache_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.cache_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.characterset_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.column_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.columndef_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.columnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 20, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 36, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 20, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.create_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.describe_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.prepend_ctes": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.with_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.cte_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.tablealias_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitstring_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.hexstring_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.datatype_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.directory_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.delete_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.drop_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.except_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.except_op": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.fetch_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.filter_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.hint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.index_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.identifier_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.national_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.partition_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.properties_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.root_properties": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.properties": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 117, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.with_properties": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.locate_properties": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 77, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.property_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.likeproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.fallbackproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.journalproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.freespaceproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.checksumproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.insert_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.intersect_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.intersect_op": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.introducer_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.pseudotype_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.table_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 55, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.tablesample_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.pivot_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.tuple_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.update_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.values_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.var_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.into_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.from_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.group_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.having_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.join_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.lambda_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 59, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.lateral_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.limit_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.offset_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.lock_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.literal_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.loaddata_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.null_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.boolean_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.order_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 51, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.cluster_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.distribute_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.sort_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.ordered_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.matchrecognize_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.query_modifiers": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 46, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.select_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.schema_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.star_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.structkwarg_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.parameter_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.sessionparameter_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.placeholder_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.subquery_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.qualify_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.union_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.union_op": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.unnest_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.where_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.window_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.partition_by_sql": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 52, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.window_spec_sql": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.withingroup_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.between_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bracket_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.all_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.any_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.exists_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.case_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.constraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.extract_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.trim_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.concat_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.check_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.foreignkey_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.primarykey_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.unique_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.if_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.in_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.in_unnest_op": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.interval_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.return_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.reference_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.anonymous_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.paren_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.neg_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.not_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.alias_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.aliases_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.attimezone_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.add_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.and_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.connector_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitwiseand_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitwisenot_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitwiseor_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.bitwisexor_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.cast_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.currentdate_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.collate_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.command_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.transaction_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.commit_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.rollback_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.altercolumn_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.renametable_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.altertable_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.droppartition_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.addconstraint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.distinct_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.ignorenulls_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.respectnulls_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.intdiv_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.dpipe_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.div_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.distance_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.dot_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.eq_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.escape_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.glob_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.gt_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.gte_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.ilike_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.is_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.like_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.similarto_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.lt_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.lte_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.mod_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.mul_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.neq_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.nullsafeeq_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.nullsafeneq_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.or_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.slice_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.sub_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.trycast_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.use_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.binary": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.function_fallback_sql": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.format_args": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 54, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.text_width": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.format_time": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.expressions": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 138, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.op_expressions": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 65, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.naked_property": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.set_operation": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 44, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.tag_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.token_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 35, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.joinhint_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.kwarg_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.when_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.generator.Generator.merge_sql": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.helper": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.helper.AutoName": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 25}, "sqlglot.helper.seq_get": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 45, "bases": 0, "doc": 27}, "sqlglot.helper.ensure_list": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 66}, "sqlglot.helper.ensure_collection": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 66}, "sqlglot.helper.csv": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 36, "bases": 0, "doc": 55}, "sqlglot.helper.subclasses": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 103, "bases": 0, "doc": 84}, "sqlglot.helper.apply_index_offset": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 53, "bases": 0, "doc": 88}, "sqlglot.helper.camel_to_snake_case": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 16}, "sqlglot.helper.while_changing": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 77, "bases": 0, "doc": 58}, "sqlglot.helper.tsort": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 47, "bases": 0, "doc": 53}, "sqlglot.helper.open_file": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 19}, "sqlglot.helper.csv_reader": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 30, "bases": 0, "doc": 53}, "sqlglot.helper.find_new_name": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 35, "bases": 0, "doc": 50}, "sqlglot.helper.object_to_dict": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 26, "bases": 0, "doc": 12}, "sqlglot.helper.split_num_words": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 74, "bases": 0, "doc": 312}, "sqlglot.helper.is_iterable": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 132}, "sqlglot.helper.flatten": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 45, "bases": 0, "doc": 195}, "sqlglot.helper.count_params": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 26}, "sqlglot.helper.dict_depth": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 194}, "sqlglot.helper.first": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 16}, "sqlglot.lineage": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.lineage.Node": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.lineage.Node.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 99, "bases": 0, "doc": 3}, "sqlglot.lineage.Node.walk": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 30, "bases": 0, "doc": 3}, "sqlglot.lineage.Node.to_html": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.lineage.lineage": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 341, "bases": 0, "doc": 114}, "sqlglot.lineage.LineageHTML": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 18}, "sqlglot.lineage.LineageHTML.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 132, "bases": 0, "doc": 3}, "sqlglot.optimizer": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.annotate_types": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.annotate_types.annotate_types": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 42, "bases": 0, "doc": 331}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"qualname": 1, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"qualname": 3, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 35, "bases": 0, "doc": 3}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.optimizer.canonicalize": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.canonicalize.canonicalize": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 46}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 39, "bases": 0, "doc": 3}, "sqlglot.optimizer.canonicalize.coerce_type": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 39, "bases": 0, "doc": 3}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 3}, "sqlglot.optimizer.eliminate_ctes": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 166}, "sqlglot.optimizer.eliminate_joins": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 195}, "sqlglot.optimizer.eliminate_joins.join_condition": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 46}, "sqlglot.optimizer.eliminate_subqueries": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 276}, "sqlglot.optimizer.expand_laterals": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 188}, "sqlglot.optimizer.expand_multi_table_selects": {"qualname": 0, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"qualname": 4, "fullname": 10, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 101}, "sqlglot.optimizer.isolate_table_selects": {"qualname": 0, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"qualname": 3, "fullname": 8, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.optimizer.lower_identities": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.lower_identities.lower_identities": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 172}, "sqlglot.optimizer.merge_subqueries": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 272}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 3}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"qualname": 3, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 3}, "sqlglot.optimizer.normalize": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.normalize.normalize": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 32, "bases": 0, "doc": 177}, "sqlglot.optimizer.normalize.normalized": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.optimizer.normalize.normalization_distance": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 171}, "sqlglot.optimizer.normalize.distributive_law": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 39}, "sqlglot.optimizer.optimize_joins": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 132}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 13}, "sqlglot.optimizer.optimize_joins.normalize": {"qualname": 1, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 13}, "sqlglot.optimizer.optimize_joins.other_table_names": {"qualname": 3, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.optimizer.optimizer": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.optimizer.optimize": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 498, "bases": 0, "doc": 223}, "sqlglot.optimizer.pushdown_predicates": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 186}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"qualname": 1, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 3}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 20}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 31}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"qualname": 3, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 3}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.optimizer.pushdown_projections": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 7, "bases": 0, "doc": 3}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 187}, "sqlglot.optimizer.qualify_columns": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 209}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"qualname": 3, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 13}, "sqlglot.optimizer.qualify_tables": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 41, "bases": 0, "doc": 190}, "sqlglot.optimizer.scope": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.ScopeType": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 5}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 7, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 7, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 8, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.ScopeType.CTE": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 7, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.ScopeType.UNION": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 7, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 7, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.Scope": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 248}, "sqlglot.optimizer.scope.Scope.__init__": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 72, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.Scope.clear_cache": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.Scope.branch": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 12}, "sqlglot.optimizer.scope.Scope.walk": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.optimizer.scope.Scope.find": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 97}, "sqlglot.optimizer.scope.Scope.find_all": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 90}, "sqlglot.optimizer.scope.Scope.replace": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 63}, "sqlglot.optimizer.scope.Scope.tables": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 21}, "sqlglot.optimizer.scope.Scope.ctes": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 21}, "sqlglot.optimizer.scope.Scope.derived_tables": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 43}, "sqlglot.optimizer.scope.Scope.subqueries": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 44}, "sqlglot.optimizer.scope.Scope.columns": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 36}, "sqlglot.optimizer.scope.Scope.selected_sources": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 69}, "sqlglot.optimizer.scope.Scope.cte_sources": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 24}, "sqlglot.optimizer.scope.Scope.selects": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 52}, "sqlglot.optimizer.scope.Scope.external_columns": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 35}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 22}, "sqlglot.optimizer.scope.Scope.join_hints": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 30}, "sqlglot.optimizer.scope.Scope.source_columns": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 17, "bases": 0, "doc": 52}, "sqlglot.optimizer.scope.Scope.is_subquery": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 10}, "sqlglot.optimizer.scope.Scope.is_union": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.optimizer.scope.Scope.is_cte": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 11}, "sqlglot.optimizer.scope.Scope.is_root": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 9}, "sqlglot.optimizer.scope.Scope.is_udtf": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 14}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"qualname": 4, "fullname": 7, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 10}, "sqlglot.optimizer.scope.Scope.rename_source": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 23, "bases": 0, "doc": 8}, "sqlglot.optimizer.scope.Scope.add_source": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 8}, "sqlglot.optimizer.scope.Scope.remove_source": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 8}, "sqlglot.optimizer.scope.Scope.traverse": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 28}, "sqlglot.optimizer.scope.Scope.ref_count": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 34}, "sqlglot.optimizer.scope.traverse_scope": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 330}, "sqlglot.optimizer.scope.build_scope": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 41}, "sqlglot.optimizer.scope.walk_in_scope": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 83}, "sqlglot.optimizer.simplify": {"qualname": 0, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.simplify": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 138}, "sqlglot.optimizer.simplify.rewrite_between": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 31}, "sqlglot.optimizer.simplify.simplify_not": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 25}, "sqlglot.optimizer.simplify.flatten": {"qualname": 1, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 24}, "sqlglot.optimizer.simplify.simplify_connectors": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.remove_compliments": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 19}, "sqlglot.optimizer.simplify.uniq_sort": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 23}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 58}, "sqlglot.optimizer.simplify.simplify_literals": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.simplify_parens": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.remove_where_true": {"qualname": 3, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.always_true": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.is_complement": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 16, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.eval_boolean": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 21, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.extract_date": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.extract_interval": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.date_literal": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.simplify.boolean_literal": {"qualname": 2, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.optimizer.unnest_subqueries": {"qualname": 0, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"qualname": 2, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 227}, "sqlglot.optimizer.unnest_subqueries.unnest": {"qualname": 1, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 22, "bases": 0, "doc": 3}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"qualname": 1, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 28, "bases": 0, "doc": 3}, "sqlglot.parser": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.parser.parse_var_map": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.parser.Parser": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 174}, "sqlglot.parser.Parser.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 162, "bases": 0, "doc": 3}, "sqlglot.parser.Parser.reset": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 11, "bases": 0, "doc": 3}, "sqlglot.parser.Parser.parse": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 87, "bases": 0, "doc": 70}, "sqlglot.parser.Parser.parse_into": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 159, "bases": 0, "doc": 111}, "sqlglot.parser.Parser.check_errors": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 14, "bases": 0, "doc": 16}, "sqlglot.parser.Parser.raise_error": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 57, "bases": 0, "doc": 22}, "sqlglot.parser.Parser.expression": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 89, "bases": 0, "doc": 74}, "sqlglot.parser.Parser.validate_expression": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 60, "bases": 0, "doc": 57}, "sqlglot.planner": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.planner.Plan": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.planner.Plan.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 24, "bases": 0, "doc": 3}, "sqlglot.planner.Step": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.planner.Step.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.planner.Step.from_expression": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 90, "bases": 0, "doc": 209}, "sqlglot.planner.Step.add_dependency": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 3}, "sqlglot.planner.Step.to_s": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.planner.Scan": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.planner.Scan.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.planner.Scan.from_expression": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 90, "bases": 0, "doc": 209}, "sqlglot.planner.Join": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.planner.Join.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.planner.Join.from_joins": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 96, "bases": 0, "doc": 3}, "sqlglot.planner.Aggregate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.planner.Aggregate.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.planner.Sort": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.planner.Sort.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.planner.SetOperation": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 1, "doc": 3}, "sqlglot.planner.SetOperation.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 83, "bases": 0, "doc": 3}, "sqlglot.planner.SetOperation.from_expression": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 90, "bases": 0, "doc": 209}, "sqlglot.schema.Schema": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 8}, "sqlglot.schema.Schema.add_table": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 111, "bases": 0, "doc": 57}, "sqlglot.schema.Schema.column_names": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 67, "bases": 0, "doc": 56}, "sqlglot.schema.Schema.get_column_type": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 73, "bases": 0, "doc": 56}, "sqlglot.schema.Schema.supported_table_args": {"qualname": 4, "fullname": 6, "annotation": 3, "default_value": 0, "signature": 0, "bases": 0, "doc": 16}, "sqlglot.schema.AbstractMappingSchema": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 2, "doc": 87}, "sqlglot.schema.AbstractMappingSchema.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 27, "bases": 0, "doc": 3}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 3}, "sqlglot.schema.AbstractMappingSchema.find": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 88, "bases": 0, "doc": 3}, "sqlglot.schema.MappingSchema": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 6, "doc": 139}, "sqlglot.schema.MappingSchema.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 128, "bases": 0, "doc": 3}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 47, "bases": 0, "doc": 3}, "sqlglot.schema.MappingSchema.copy": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 31, "bases": 0, "doc": 3}, "sqlglot.schema.MappingSchema.add_table": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 111, "bases": 0, "doc": 60}, "sqlglot.schema.MappingSchema.column_names": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 67, "bases": 0, "doc": 56}, "sqlglot.schema.MappingSchema.get_column_type": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 79, "bases": 0, "doc": 56}, "sqlglot.schema.ensure_schema": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 3}, "sqlglot.schema.ensure_column_mapping": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 67, "bases": 0, "doc": 3}, "sqlglot.schema.flatten_schema": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 69, "bases": 0, "doc": 3}, "sqlglot.serde": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.serde.dump": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 149, "bases": 0, "doc": 12}, "sqlglot.serde.load": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 149, "bases": 0, "doc": 16}, "sqlglot.time": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.time.format_time": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 73, "bases": 0, "doc": 108}, "sqlglot.tokens": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 3, "doc": 5}, "sqlglot.tokens.TokenType.L_PAREN": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.R_PAREN": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.L_BRACKET": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.R_BRACKET": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.L_BRACE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.R_BRACE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COMMA": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DOT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DASH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PLUS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COLON": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DCOLON": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SEMICOLON": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.STAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BACKSLASH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SLASH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LTE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GTE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NOT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.EQ": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NEQ": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.AND": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.AMP": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DPIPE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PIPE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CARET": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TILDA": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ARROW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DARROW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FARROW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HASH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HASH_ARROW": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LR_ARROW": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DOLLAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PARAMETER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NATIONAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BLOCK_START": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BLOCK_END": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SPACE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BREAK": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.STRING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NUMBER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IDENTIFIER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COLUMN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SCHEMA": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TABLE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BIT_STRING": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HEX_STRING": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BYTE_STRING": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BOOLEAN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TINYINT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SMALLINT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BIGINT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FLOAT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DOUBLE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DECIMAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CHAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NCHAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VARCHAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NVARCHAR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TEXT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LONGTEXT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LONGBLOB": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BINARY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VARBINARY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.JSON": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.JSONB": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TIME": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TIMESTAMP": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DATETIME": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DATE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UUID": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NULLABLE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GEOMETRY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HLLSKETCH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HSTORE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SUPER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SERIAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BIGSERIAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.XML": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MONEY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SMALLMONEY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ROWVERSION": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IMAGE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VARIANT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OBJECT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ALIAS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ALTER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ALWAYS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ALL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ANTI": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ANY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.APPLY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ARRAY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ASC": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ASOF": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 13, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BEGIN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BETWEEN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BOTH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BUCKET": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CACHE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CASCADE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CASE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CHECK": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COLLATE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COMMAND": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COMMENT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COMMIT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.COMPOUND": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CONSTRAINT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CREATE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CROSS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CUBE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DEFAULT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DELETE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DESC": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DESCRIBE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DISTINCT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DIV": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.DROP": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ELSE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ENCODE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.END": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ESCAPE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.EXCEPT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.EXECUTE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.EXISTS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FALSE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FETCH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FILTER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FINAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FIRST": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FOLLOWING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FOR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FORMAT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FROM": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FULL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.FUNCTION": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GENERATED": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GLOB": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GLOBAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GROUP_BY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HAVING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.HINT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IDENTITY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IF": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ILIKE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INDEX": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INNER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INSERT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INTERSECT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INTERVAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INTO": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.INTRODUCER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IRLIKE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.IS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ISNULL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.JOIN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LANGUAGE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LATERAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LAZY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LEADING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LEFT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LIKE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LIMIT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LOAD_DATA": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.LOCAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MAP": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MATERIALIZED": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MERGE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.MOD": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NATURAL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NEXT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NO_ACTION": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NOTNULL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NULL": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.NULLS_LAST": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OFFSET": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ON": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ONLY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OPTIONS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ORDER_BY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ORDERED": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ORDINALITY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OUTER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OUT_OF": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OVER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.OVERWRITE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PARTITION": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PARTITION_BY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PERCENT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PIVOT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PRECEDING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PROCEDURE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PROPERTIES": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.QUALIFY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.QUOTE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.RANGE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.RECURSIVE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.REPLACE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.REFERENCES": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.RIGHT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.RLIKE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ROLLBACK": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ROLLUP": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ROW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.ROWS": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SEED": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SELECT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SEMI": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SEPARATOR": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SET": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SHOW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SOME": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SORTKEY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.SORT_BY": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.STRUCT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TEMPORARY": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TOP": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.THEN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TRAILING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.TRUE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNBOUNDED": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNCACHE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNION": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNLOGGED": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNNEST": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNPIVOT": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UPDATE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.USE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.USING": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VALUES": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VIEW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.VOLATILE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WHEN": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WHERE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WINDOW": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WITH": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 13, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"qualname": 5, "fullname": 7, "annotation": 0, "default_value": 15, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 11, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 13, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.TokenType.UNIQUE": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 9, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.Token": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.Token.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 97, "bases": 0, "doc": 3}, "sqlglot.tokens.Token.number": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 14}, "sqlglot.tokens.Token.string": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 14}, "sqlglot.tokens.Token.identifier": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 14}, "sqlglot.tokens.Token.var": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 34, "bases": 0, "doc": 14}, "sqlglot.tokens.Tokenizer": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.tokens.Tokenizer.__init__": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 4, "bases": 0, "doc": 3}, "sqlglot.tokens.Tokenizer.reset": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 14, "bases": 0, "doc": 3}, "sqlglot.tokens.Tokenizer.tokenize": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 16}, "sqlglot.transforms": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.transforms.unalias_group": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 146}, "sqlglot.transforms.eliminate_distinct_on": {"qualname": 3, "fullname": 5, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 66}, "sqlglot.transforms.remove_precision_parameterized_types": {"qualname": 4, "fullname": 6, "annotation": 0, "default_value": 0, "signature": 40, "bases": 0, "doc": 33}, "sqlglot.transforms.preprocess": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 144, "bases": 0, "doc": 88}, "sqlglot.transforms.delegate": {"qualname": 1, "fullname": 3, "annotation": 0, "default_value": 0, "signature": 19, "bases": 0, "doc": 29}, "sqlglot.trie": {"qualname": 0, "fullname": 2, "annotation": 0, "default_value": 0, "signature": 0, "bases": 0, "doc": 3}, "sqlglot.trie.new_trie": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 29, "bases": 0, "doc": 185}, "sqlglot.trie.in_trie": {"qualname": 2, "fullname": 4, "annotation": 0, "default_value": 0, "signature": 47, "bases": 0, "doc": 299}}, "length": 1667, "save": true}, "index": {"qualname": {"root": {"docs": {"sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}}, "df": 76, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.pretty": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.presto.Presto": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}}, "df": 7}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}}, "df": 1}}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.prepend_ctes": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.transforms.preprocess": {"tf": 1}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.expressions.Properties": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}}, "df": 19}}}, "y": {"docs": {"sqlglot.expressions.Property": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}}, "df": 3}}}}}, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}}, "df": 1}}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}}, "df": 1, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.PrimaryKey": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.PrimaryKeyColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 9, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.parser.Parser.reset": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 28}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}}, "df": 3}}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Partition": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}}, "df": 5, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}}, "df": 2}}, "s": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}}, "df": 1}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.expressions.PartitionedByProperty": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.expressions.Paren": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}}, "df": 6, "t": {"docs": {"sqlglot.expressions.Expression.parent_select": {"tf": 1}}, "df": 1}, "s": {"docs": {"sqlglot.optimizer.simplify.simplify_parens": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Parameter": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {"sqlglot.helper.count_params": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {"sqlglot.generator.Generator.pad_comment": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.PERCENT": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.PercentileCont": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.PercentileDisc": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.expressions.Pivot": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}}, "df": 5}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.PIPE": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}}, "df": 4, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.postgres.Postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}}, "df": 6}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Posexplode": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {"sqlglot.executor.table.Table.pop": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}}, "df": 2}, "w": {"docs": {"sqlglot.expressions.Pow": {"tf": 1}}, "df": 1}}, "y": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.python.Python": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}}, "df": 4, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.python.PythonExecutor": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}}, "df": 17}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Placeholder": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {"sqlglot.planner.Plan": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}}, "df": 2}}, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.PLUS": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.PseudoType": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}}, "df": 5}}}}}}}}, "s": {"docs": {"sqlglot.planner.Step.to_s": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Schema": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.schema.Schema": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}}, "df": 16, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.SchemaError": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SchemaCommentProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}}, "df": 1}}}, "n": {"docs": {"sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.planner.Scan": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}}, "df": 6}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 35, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}}, "df": 7}}}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.spark.Spark": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}}, "df": 7, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.SparkSession": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}}, "df": 5}}}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SPACE": {"tf": 1}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Split": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.generator.Generator.window_spec_sql": {"tf": 1}}, "df": 1}}}, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}}, "df": 237, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}}, "df": 7}}}, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.SqlglotError": {"tf": 1}}, "df": 1}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SqlSecurityProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Sqrt": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Select": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}}, "df": 23, "s": {"docs": {"sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}}, "df": 3}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {"sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Set": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}}, "df": 11, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.expressions.SetItem": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.SetAgg": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.planner.SetOperation": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}}}}}}}}}, "s": {"docs": {"sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.SerdeProperties": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.SessionParameter": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}, "p": {"docs": {"sqlglot.generator.Generator.sep": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}}, "df": 1}}}}}}}, "g": {"docs": {"sqlglot.generator.Generator.seg": {"tf": 1}}, "df": 1}, "q": {"docs": {"sqlglot.helper.seq_get": {"tf": 1}}, "df": 1}, "m": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.tokens.TokenType.SEMI": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.SEED": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.expressions.Sort": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}, "sqlglot.planner.Sort": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}}, "df": 10, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SortKeyProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SortArray": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}}, "df": 2}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SOME": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.expressions.Sum": {"tf": 1}}, "df": 2}, "b": {"docs": {"sqlglot.expressions.Sub": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.Column.substr": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.expressions.Substring": {"tf": 1}}, "df": 2}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subquery": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}}, "df": 9, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Subqueryable": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}}, "df": 4}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.SubqueryPredicate": {"tf": 1}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 4}}}}}}}, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.subclasses": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}}, "df": 2}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Star": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}}, "df": 4, "t": {"docs": {"sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.Column.startswith": {"tf": 1}}, "df": 1}}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}}, "df": 4}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor.python.PythonExecutor.static": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {"sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}}, "df": 2, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.Struct": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}}, "df": 4, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.StructKwarg": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.StructExtract": {"tf": 1}}, "df": 1}}}}}}}}}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.expressions.StrPosition": {"tf": 1}}, "df": 3}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}}, "df": 7}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.StrToDate": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.StrToTime": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.StrToUnix": {"tf": 1}}, "df": 1}}}}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.expressions.Stddev": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.StddevPop": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.StddevSamp": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.planner.Step": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}}, "df": 5}}}, "a": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 1}}}}}}}}}, "f": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}}, "df": 1, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.SafeDivide": {"tf": 1}}, "df": 1}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}}, "df": 12}}}}}}}, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.camel_to_snake_case": {"tf": 1}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.expressions.Show": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}}, "df": 3}}}, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.expressions.SystemTime": {"tf": 1}}, "df": 2}}}}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}}, "df": 2}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}}, "df": 2}}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.expressions.SimilarTo": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}}, "df": 2}}}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 1}}, "df": 5}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Slice": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.SLASH": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.parse_one": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.ONLY": {"tf": 1}}, "df": 1}}}, "r": {"docs": {"sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Or": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}}, "df": 6, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Order": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}}, "df": 4, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.expressions.Ordered": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}}, "df": 4}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.oracle.Oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}}, "df": 9}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}}, "df": 3, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {"sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}}, "df": 13, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.OptimizeError": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}}, "df": 2}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.unnest_operands": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}}, "df": 1, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}}, "df": 1}}}}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.expressions.Offset": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}}, "df": 6}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}}, "df": 8}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.OUTER": {"tf": 1}}, "df": 1}}}}, "b": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}}, "df": 3}}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.expressions.Transaction": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}}, "df": 5}}}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.TRAILING": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.trino.Trino": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}}, "df": 5}}, "m": {"docs": {"sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.expressions.Trim": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}}, "df": 3}, "e": {"docs": {"sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 2}}, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.expressions.TryCast": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}}, "df": 3}}}}}, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.true": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}}, "df": 4}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.table.Table": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.append": {"tf": 1}, "sqlglot.executor.table.Table.pop": {"tf": 1}, "sqlglot.expressions.Table": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}}, "df": 30, "a": {"docs": {}, "df": 0, "u": {"docs": {"sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.tableau.Tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}}, "df": 5}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.TableAlias": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}}, "df": 2}}}}}, "s": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}}, "df": 7, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.expressions.TableSample": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}}, "df": 3}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.TableIter": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}}, "df": 2}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.TableFormatProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "g": {"docs": {"sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}}, "df": 2}}, "o": {"docs": {"sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}}, "df": 12, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.tokens.Token": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 7, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 1, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}, "sqlglot.tokens.Tokenizer": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 20}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.TokenError": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 286}}}}}}}, "p": {"docs": {"sqlglot.tokens.TokenType.TOP": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.tsql.TSQL": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}}, "df": 8}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.TsOrDsAdd": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.TsOrDsToDate": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TsOrDsToDateStr": {"tf": 1}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.expressions.TsOrDiToDi": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {"sqlglot.helper.tsort": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}, "sqlglot.dialects.teradata.Teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}}, "df": 7}}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}}, "df": 5}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}}, "df": 11, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.expressions.TimeStrToTime": {"tf": 1}}, "df": 2}}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.TimeStrToDate": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.TimeStrToUnix": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}}, "df": 3, "t": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}}, "df": 2}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.TimestampTrunc": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.TimestampAdd": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.TimestampSub": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.TimestampDiff": {"tf": 1}}, "df": 1}}}}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.TimeSub": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.TimeAdd": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.TimeDiff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.TimeTrunc": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TimeToStr": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TimeToTimeStr": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.TimeToUnix": {"tf": 1}}, "df": 1}}}}}}}}, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}}, "df": 2}}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.TILDA": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.expressions.Tuple": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}}, "df": 4}}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.this": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.THEN": {"tf": 1}}, "df": 1}}}, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}}, "df": 58, "s": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 2}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}}, "df": 3}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.expressions.In": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 7, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}}, "df": 63, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Initcap": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Intersect": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}}, "df": 9, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}}, "df": 1}}}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.env.interval": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.Interval": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}}, "df": 7}}}}}, "o": {"docs": {"sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.expressions.Into": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}}, "df": 5}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Introducer": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}}, "df": 3}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.expressions.IntDiv": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.expressions.Insert": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}}, "df": 5, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.expressions.Index": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}}, "df": 6}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.indent": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.INNER": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {"sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Is": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}}, "df": 18, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}}, "df": 2}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.isin": {"tf": 1}}, "df": 1}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}}, "df": 1, "d": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.IsolatedLoadingProperty": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.expressions.ILike": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}}, "df": 5}}}}, "f": {"docs": {"sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.If": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}}, "df": 6, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.IfNull": {"tf": 1}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}}, "df": 2, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.IgnoreNulls": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}}, "df": 2}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.context.Context.table_iter": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.is_iterable": {"tf": 1}}, "df": 1}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Identifier": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}}, "df": 6}}}, "y": {"docs": {"sqlglot.generator.Generator.no_identify": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.expressions.Create": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}}, "df": 5, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.CROSS": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}}, "df": 6}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.expressions.Coalesce": {"tf": 1}}, "df": 2}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.expressions.Count": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 5}}}, "l": {"docs": {"sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.expressions.Column": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}}, "df": 47, "s": {"docs": {"sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}}, "df": 8}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.ColumnDef": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}}, "df": 2}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}}, "df": 2, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.ColumnConstraintKind": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Collate": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}}, "df": 3, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CollateColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.CollateProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.ensure_collection": {"tf": 1}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.COLON": {"tf": 1}}, "df": 1}}}, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.expressions.Commit": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}}, "df": 4}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.pad_comment": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CommentColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}, "a": {"docs": {"sqlglot.tokens.TokenType.COMMA": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Command": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}}, "df": 3}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.simplify.is_complement": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.expressions.Concat": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}}, "df": 4, "w": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.ConcatWs": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.eval": {"tf": 1}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}}, "df": 12}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Condition": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 6}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Constraint": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}}, "df": 3}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Connector": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1}}, "df": 1}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.convert": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}}, "df": 1}}}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.expressions.Cache": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}}, "df": 5}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.expressions.Cast": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}}, "df": 8, "s": {"docs": {"sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}}, "df": 1}}, "e": {"docs": {"sqlglot.expressions.Case": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}}, "df": 4}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CASCADE": {"tf": 1}}, "df": 1}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.helper.camel_to_snake_case": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 1}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.CARET": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}}, "df": 7}}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Cluster": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}}, "df": 4}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.expressions.CTE": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}}, "df": 7, "s": {"docs": {"sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}}, "df": 4}}, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Select.ctas": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}}, "df": 6, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.CurrentDate": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}}, "df": 2, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.CurrentDatetime": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.CurrentTime": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.CurrentTimestamp": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CUBE": {"tf": 1}}, "df": 1}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 3}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {"sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CharacterSet": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.CharacterSetProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.Check": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CheckColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ChecksumProperty": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.replace_children": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Ceil": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 33, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrameNaFunctions": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}}, "df": 5}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrameReader": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}}, "df": 3}}}}}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 7}}}}}}}}}}}, "b": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.databricks.Databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}}, "df": 5}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataBlocksizeProperty": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.expressions.DataType": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}}, "df": 58}}}}}, "e": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}}, "df": 8, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.expressions.DateStrToDate": {"tf": 1}}, "df": 2}}}}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DateSub": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}}, "df": 3, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DatetimeAdd": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DatetimeSub": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.DatetimeDiff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.DatetimeTrunc": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.DateTrunc": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DateToDateStr": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {"sqlglot.expressions.DateToDi": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DateAdd": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.DateDiff": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.DateFromParts": {"tf": 1}}, "df": 1}}}}}}}}}}}, "y": {"docs": {"sqlglot.expressions.Day": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.DayOfWeek": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.DayOfMonth": {"tf": 1}}, "df": 1}}}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DayOfYear": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.DASH": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.DARROW": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Distinct": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 8}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Distribute": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}}, "df": 3}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.normalize.distributive_law": {"tf": 1}}, "df": 1}}}}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DistKeyProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DistStyleProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Distance": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 3}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}, "sqlglot.dialects.dialect.Dialect": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}}, "df": 11, "s": {"docs": {"sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}}, "df": 21}}}}}}, "v": {"docs": {"sqlglot.expressions.Div": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 2}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Directory": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}}, "df": 2}}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}}, "df": 3}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DiToDate": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.expressions.Drop": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}}, "df": 5, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}}, "df": 1}}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}}, "df": 1}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DropPartition": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.drill.Drill": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}}, "df": 7}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}}, "df": 4, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.expressions.Describe": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}}, "df": 4}}}}}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}}, "df": 2}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Delete": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}}, "df": 4}}, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transforms.delegate": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}}, "df": 2}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.planner.Step.add_dependency": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}}, "df": 4, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DerivedTable": {"tf": 1}}, "df": 1}}}}}}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DefaultColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DefinerProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Decode": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 1}}}}}}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}}, "df": 6}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}}, "df": 2}}}, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.dfs": {"tf": 1}}, "df": 1}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}}, "df": 2}}}}, "t": {"docs": {"sqlglot.expressions.Dot": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}}, "df": 3}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DPipe": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}}, "df": 3}}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 1}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.DCOLON": {"tf": 1}}, "df": 1}}}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Alias": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}}, "df": 8, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Aliases": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}}, "df": 3}}}}}, "l": {"docs": {"sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.All": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}}, "df": 5}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.ALTER": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.AlterColumn": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}}, "df": 2}}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.AlterTable": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}}, "df": 2}}}}}}}}, "g": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AlgorithmProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}}, "df": 2}}}}}, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}}, "df": 2, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.planner.Aggregate": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}}, "df": 3}}}}}}, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.AggFunc": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.expressions.Avg": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.expressions.Anonymous": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}}, "df": 3}}}}}}}, "y": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Any": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}}, "df": 4, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.AnyValue": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.find_ancestor": {"tf": 1}}, "df": 1}}}}}}, "d": {"docs": {"sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.And": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}}, "df": 6}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}}, "df": 2}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.tokens.TokenType.ANTI": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}}, "df": 4}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.assert_is": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.tokens.TokenType.ASOF": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.Array": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}}, "df": 5, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.ArrayAgg": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.ArrayAll": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ArrayAny": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ArrayConcat": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.ArrayContains": {"tf": 1}}, "df": 1}}}}}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.ArrayFilter": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.ArraySize": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ArraySort": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.ArraySum": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.ArrayUnionAgg": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}}, "df": 6}}}, "g": {"docs": {"sqlglot.expressions.Func.from_arg_list": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 2}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}}, "df": 1, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ApproxDistinct": {"tf": 1}}, "df": 1}}}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.ApproxQuantile": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.table.Table.append": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}}, "df": 2}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.expressions.Add": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 9, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.AddConstraint": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.AutoIncrementColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AutoIncrementProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.AutoName": {"tf": 1}}, "df": 1}}}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AfterJournalProperty": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.AtTimeZone": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "b": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Abs": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 4}}}}}}}}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.AMP": {"tf": 1}}, "df": 1}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}}, "df": 1}}}}}}, "w": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Where": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}}, "df": 6}}, "n": {"docs": {"sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.expressions.When": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}}, "df": 4}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.expressions.With": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}}, "df": 12, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}}, "df": 1, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.WithinGroup": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}}, "df": 2}}}}}}}, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.WithJournalTableProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dataframe.sql.Window": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Window": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}}, "df": 11, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.WindowSpec": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.expressions.WindowSpec": {"tf": 1}}, "df": 9}}}}}}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.generator.Generator.text_width": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.errors.ErrorLevel.WARN": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 4}}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.Week": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.WeekOfYear": {"tf": 1}}, "df": 1}}}}}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.generator.Generator.wrap": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.expressions.Filter": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}}, "df": 6}}}, "l": {"docs": {"sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.FileFormatProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}}, "df": 5}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 7}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Final": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}}, "df": 2}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}}, "df": 9, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}}, "df": 3}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.FULL": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}}, "df": 2, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}}, "df": 6}}}, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}}, "df": 1, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ForeignKey": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}}, "df": 2}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1}}, "df": 4}}}}}, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Floor": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.From": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}}, "df": 13}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.FreespaceProperty": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Fetch": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}}, "df": 3}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.FallbackProperty": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.false": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}}, "df": 2}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.FARROW": {"tf": 1}}, "df": 1}}}}}}, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Group": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 6, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.GroupedData": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}}, "df": 10}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.GroupConcat": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Greatest": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}, "sqlglot.generator.Generator.sep": {"tf": 1}, "sqlglot.generator.Generator.seg": {"tf": 1}, "sqlglot.generator.Generator.pad_comment": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.generator.Generator.wrap": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}}, "df": 266}}, "e": {"docs": {"sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}}, "df": 5, "d": {"docs": {"sqlglot.tokens.TokenType.GENERATED": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}}, "df": 3}}}}}}}}}}}}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.GenerateSeries": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "t": {"docs": {"sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 4}, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}}, "df": 2}}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}}, "df": 2}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.Glob": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}}, "df": 3, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.expressions.GT": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.expressions.GTE": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}}, "df": 3}}}, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.expressions.Join": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.planner.Join": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}}, "df": 15, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JoinHint": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {"sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}}, "df": 4}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.JournalProperty": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}}, "df": 4, "b": {"docs": {"sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.JSONBContains": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JSONBExtract": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.JSONBExtractScalar": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JSONExtract": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.JSONExtractScalar": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Union": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}}, "df": 10, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}}, "df": 1}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Unionable": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}}, "df": 4}}}}, "b": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {"sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}}, "df": 1}, "q": {"docs": {"sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Unique": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 3, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.UniqueColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.UnixToStr": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.UnixToTime": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.UnixToTimeStr": {"tf": 1}}, "df": 1}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.expressions.Unary": {"tf": 1}}, "df": 2}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 2}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Unnest": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}}, "df": 10}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}}, "df": 2, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.UnsupportedError": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Uncache": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}}, "df": 3}}}}}, "k": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}}, "df": 1}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.Unhex": {"tf": 1}}, "df": 1}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}}, "df": 1}}}}}}}}}, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.expressions.Update": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}}, "df": 7}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Upper": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}}, "df": 3}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Use": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}}, "df": 3, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.UserDefinedFunction": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}}, "df": 2, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.UserDefinedFunctionKwarg": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}}, "df": 2}}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}}, "df": 2}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Except": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}}, "df": 8, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}}, "df": 1}}}}}}}, "p": {"docs": {"sqlglot.expressions.Exp": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 40, "s": {"docs": {"sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}}, "df": 3}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Explode": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.expand": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}}, "df": 3}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.expressions.Extract": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}}, "df": 7}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.ExecuteError": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ExecuteAsProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Exists": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}}, "df": 3}}}}}, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 8}}}}, "d": {"docs": {"sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.Column.endswith": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Encode": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.EncodeColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.EngineProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 5}}}}}, "s": {"docs": {"sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}}, "df": 2}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.context.Context.eval": {"tf": 1}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}}, "df": 3}}}, "q": {"docs": {"sqlglot.expressions.EQ": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}}, "df": 4}, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Escape": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}}, "df": 3}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 5}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.ELSE": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {"sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}}, "df": 9}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Repeat": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.redshift.Redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}}, "df": 10}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Reduce": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}}, "df": 3, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.expressions.RenameTable": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}}, "df": 3}}}}}}}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}}, "df": 2}}}}}}, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Return": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.expressions.ReturnsProperty": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 7}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}}, "df": 2}}}}}, "f": {"docs": {"sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Reference": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.RespectNulls": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parser.Parser.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.expressions.ReadCSV": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.RegexpLike": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.RegexpILike": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.RegexpSplit": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}}, "df": 1}}}}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.tokens.TokenType.ROWS": {"tf": 1}}, "df": 1, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}}, "df": 2}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.RowReader": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}}, "df": 2}}}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.RowFormatDelimitedProperty": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.RowFormatSerdeProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}}, "df": 2}}}}}}}, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.RowNumber": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.expressions.Rollback": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}}, "df": 4}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}}, "df": 4}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Round": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}}, "df": 2, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}}, "df": 2}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.RangeReader": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}}, "df": 2}}}}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 3}}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.RIGHT": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.expressions.Limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}}, "df": 7}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.expressions.Literal": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}}, "df": 8, "s": {"docs": {"sqlglot.optimizer.simplify.simplify_literals": {"tf": 1}}, "df": 1}}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.expressions.Like": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}}, "df": 4, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LikeProperty": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}}, "df": 1, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}}, "df": 2}}}}}}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}}, "df": 3, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.LastDateOfMonth": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.Lambda": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}}, "df": 3}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Lateral": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LanguageProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "w": {"docs": {"sqlglot.optimizer.normalize.distributive_law": {"tf": 1}}, "df": 1}, "z": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.LAZY": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}}, "df": 3}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}}, "df": 7, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LocationProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}}, "df": 2}}, "k": {"docs": {"sqlglot.expressions.Lock": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}}, "df": 3}}, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}}, "df": 3, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.expressions.LoadData": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}}, "df": 2}}}}}}, "g": {"1": {"0": {"docs": {"sqlglot.expressions.Log10": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "2": {"docs": {"sqlglot.expressions.Log2": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.expressions.Log": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LogProperty": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.LogicalOr": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}}, "df": 2}}}}}}, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Lower": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 2}}}}, "t": {"docs": {"sqlglot.expressions.LT": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.expressions.LTE": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Least": {"tf": 1}}, "df": 1}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.LEADING": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Length": {"tf": 1}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Levenshtein": {"tf": 1}}, "df": 1}}}}}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.LEFT": {"tf": 1}}, "df": 1}}}, "n": {"docs": {"sqlglot.expressions.Ln": {"tf": 1}}, "df": 1}, "r": {"docs": {"sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}}, "df": 1}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.expressions.Hint": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}}, "df": 1}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.hive.Hive": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}}, "df": 8}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}}, "df": 3}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Having": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}}, "df": 4}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.Hex": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.HexString": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}}, "df": 2}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}}, "df": 2}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}}, "df": 2}}}}}, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.lineage.Node.to_html": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}}, "df": 2}}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.expressions.Merge": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}}, "df": 7, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.MergeBlockRatioProperty": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}}, "df": 2}}}}}}}}}, "a": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.expressions.Max": {"tf": 1}}, "df": 2}, "p": {"docs": {"sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.Map": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}}, "df": 5, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 7}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.MatchRecognize": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}}, "df": 1}}}}}}}}}}, "y": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}}, "df": 2}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.expressions.Min": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Mod": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}}, "df": 2}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}}, "df": 2}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Month": {"tf": 1}}, "df": 1}}}}, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.mysql.MySQL": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}}, "df": 9}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Mul": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}}, "df": 2, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}}, "df": 1}}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.Binary": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}}, "df": 6}}}}, "g": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.bigquery.BigQuery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}}, "df": 13}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}}, "df": 2}}}}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.BitString": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}}, "df": 2}}}}}}, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.BitwiseAnd": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.BitwiseLeftShift": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.BitwiseOr": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}}, "df": 2}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.BitwiseRightShift": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "x": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.BitwiseXor": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}}, "df": 2}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.BitwiseNot": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.expressions.Between": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}}, "df": 5}}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.BEGIN": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.bfs": {"tf": 1}}, "df": 1}}, "y": {"docs": {"sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}}, "df": 12, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.ByteString": {"tf": 1}}, "df": 1}}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.BlockCompressionProperty": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Boolean": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}}, "df": 6}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.BOTH": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}}, "df": 2}}}, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.BUCKET": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Bracket": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}}, "df": 4}}}, "e": {"docs": {"sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.BREAK": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}}, "df": 12, "s": {"docs": {"sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 5}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.National": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}}, "df": 3}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NATURAL": {"tf": 1}}, "df": 1}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.naked_property": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Null": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}}, "df": 9, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.expressions.NullSafeEQ": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.expressions.NullSafeNEQ": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}}, "df": 2}}}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}}, "df": 2}}}}}}, "m": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}}, "df": 4, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.NumberToStr": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {"sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}}, "df": 10, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}}, "df": 4, "d": {"docs": {"sqlglot.optimizer.normalize.normalized": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 1}}}}}}}}}}}, "t": {"docs": {"sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Not": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}}, "df": 6, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.NotNullColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage.Node": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 3}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {"sqlglot.expressions.NEQ": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}}, "df": 3}, "g": {"docs": {"sqlglot.expressions.Neg": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}}, "df": 2}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.NEXT": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}}, "df": 2}}}}}}, "l": {"2": {"docs": {"sqlglot.expressions.Nvl2": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.expressions.Var": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 6, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}}, "df": 2}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}}, "df": 2}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Variance": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.VariancePop": {"tf": 1}}, "df": 1}}}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.VarMap": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.expressions.Values": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}}, "df": 6}}}, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 2}}}}}}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.VolatilityProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {"sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.VIEW": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Qualify": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}}, "df": 6}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Quantile": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.expressions.Quantiles": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.QuantileIf": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.QUOTE": {"tf": 1}}, "df": 1}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.diff.Keep": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}}, "df": 2}}, "y": {"docs": {"sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}}, "df": 4}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}}, "df": 2}}}}}, "x": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}}, "df": 2}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Year": {"tf": 1}}, "df": 1}}}}, "z": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}}, "df": 4}}}}}}, "fullname": {"root": {"docs": {"sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}}, "df": 76, "s": {"docs": {"sqlglot.planner.Step.to_s": {"tf": 1}}, "df": 1, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dataframe.sql.Window": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}}, "df": 344, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.pretty": {"tf": 1}, "sqlglot.schema": {"tf": 1}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dataframe.sql.Window": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect": {"tf": 1}, "sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}, "sqlglot.dialects.dialect.Dialect": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.dialects.duckdb": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive": {"tf": 1}, "sqlglot.dialects.hive.Hive": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto": {"tf": 1}, "sqlglot.dialects.presto.Presto": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark": {"tf": 1}, "sqlglot.dialects.spark.Spark": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.starrocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.trino": {"tf": 1}, "sqlglot.dialects.trino.Trino": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.errors": {"tf": 1}, "sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.eval": {"tf": 1}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.env": {"tf": 1}, "sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.executor.env.interval": {"tf": 1}, "sqlglot.executor.python": {"tf": 1}, "sqlglot.executor.python.PythonExecutor": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.executor.python.Python": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.executor.table": {"tf": 1}, "sqlglot.executor.table.Table": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.append": {"tf": 1}, "sqlglot.executor.table.Table.pop": {"tf": 1}, "sqlglot.executor.table.TableIter": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Condition": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.expressions.DerivedTable": {"tf": 1}, "sqlglot.expressions.Unionable": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.UDTF": {"tf": 1}, "sqlglot.expressions.Cache": {"tf": 1}, "sqlglot.expressions.Uncache": {"tf": 1}, "sqlglot.expressions.Create": {"tf": 1}, "sqlglot.expressions.Describe": {"tf": 1}, "sqlglot.expressions.Set": {"tf": 1}, "sqlglot.expressions.SetItem": {"tf": 1}, "sqlglot.expressions.Show": {"tf": 1}, "sqlglot.expressions.UserDefinedFunction": {"tf": 1}, "sqlglot.expressions.UserDefinedFunctionKwarg": {"tf": 1}, "sqlglot.expressions.CharacterSet": {"tf": 1}, "sqlglot.expressions.With": {"tf": 1}, "sqlglot.expressions.WithinGroup": {"tf": 1}, "sqlglot.expressions.CTE": {"tf": 1}, "sqlglot.expressions.TableAlias": {"tf": 1}, "sqlglot.expressions.BitString": {"tf": 1}, "sqlglot.expressions.HexString": {"tf": 1}, "sqlglot.expressions.ByteString": {"tf": 1}, "sqlglot.expressions.Column": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.ColumnDef": {"tf": 1}, "sqlglot.expressions.AlterColumn": {"tf": 1}, "sqlglot.expressions.RenameTable": {"tf": 1}, "sqlglot.expressions.ColumnConstraint": {"tf": 1}, "sqlglot.expressions.ColumnConstraintKind": {"tf": 1}, "sqlglot.expressions.AutoIncrementColumnConstraint": {"tf": 1}, "sqlglot.expressions.CheckColumnConstraint": {"tf": 1}, "sqlglot.expressions.CollateColumnConstraint": {"tf": 1}, "sqlglot.expressions.CommentColumnConstraint": {"tf": 1}, "sqlglot.expressions.DefaultColumnConstraint": {"tf": 1}, "sqlglot.expressions.EncodeColumnConstraint": {"tf": 1}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"tf": 1}, "sqlglot.expressions.NotNullColumnConstraint": {"tf": 1}, "sqlglot.expressions.PrimaryKeyColumnConstraint": {"tf": 1}, "sqlglot.expressions.UniqueColumnConstraint": {"tf": 1}, "sqlglot.expressions.Constraint": {"tf": 1}, "sqlglot.expressions.Delete": {"tf": 1}, "sqlglot.expressions.Drop": {"tf": 1}, "sqlglot.expressions.Filter": {"tf": 1}, "sqlglot.expressions.Check": {"tf": 1}, "sqlglot.expressions.Directory": {"tf": 1}, "sqlglot.expressions.ForeignKey": {"tf": 1}, "sqlglot.expressions.PrimaryKey": {"tf": 1}, "sqlglot.expressions.Unique": {"tf": 1}, "sqlglot.expressions.Into": {"tf": 1}, "sqlglot.expressions.From": {"tf": 1}, "sqlglot.expressions.Having": {"tf": 1}, "sqlglot.expressions.Hint": {"tf": 1}, "sqlglot.expressions.JoinHint": {"tf": 1}, "sqlglot.expressions.Identifier": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Index": {"tf": 1}, "sqlglot.expressions.Insert": {"tf": 1}, "sqlglot.expressions.Introducer": {"tf": 1}, "sqlglot.expressions.National": {"tf": 1}, "sqlglot.expressions.LoadData": {"tf": 1}, "sqlglot.expressions.Partition": {"tf": 1}, "sqlglot.expressions.Fetch": {"tf": 1}, "sqlglot.expressions.Group": {"tf": 1}, "sqlglot.expressions.Lambda": {"tf": 1}, "sqlglot.expressions.Limit": {"tf": 1}, "sqlglot.expressions.Literal": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Lateral": {"tf": 1}, "sqlglot.expressions.MatchRecognize": {"tf": 1}, "sqlglot.expressions.Final": {"tf": 1}, "sqlglot.expressions.Offset": {"tf": 1}, "sqlglot.expressions.Order": {"tf": 1}, "sqlglot.expressions.Cluster": {"tf": 1}, "sqlglot.expressions.Distribute": {"tf": 1}, "sqlglot.expressions.Sort": {"tf": 1}, "sqlglot.expressions.Ordered": {"tf": 1}, "sqlglot.expressions.Property": {"tf": 1}, "sqlglot.expressions.AlgorithmProperty": {"tf": 1}, "sqlglot.expressions.DefinerProperty": {"tf": 1}, "sqlglot.expressions.SqlSecurityProperty": {"tf": 1}, "sqlglot.expressions.TableFormatProperty": {"tf": 1}, "sqlglot.expressions.PartitionedByProperty": {"tf": 1}, "sqlglot.expressions.FileFormatProperty": {"tf": 1}, "sqlglot.expressions.DistKeyProperty": {"tf": 1}, "sqlglot.expressions.SortKeyProperty": {"tf": 1}, "sqlglot.expressions.DistStyleProperty": {"tf": 1}, "sqlglot.expressions.LikeProperty": {"tf": 1}, "sqlglot.expressions.LocationProperty": {"tf": 1}, "sqlglot.expressions.EngineProperty": {"tf": 1}, "sqlglot.expressions.AutoIncrementProperty": {"tf": 1}, "sqlglot.expressions.CharacterSetProperty": {"tf": 1}, "sqlglot.expressions.CollateProperty": {"tf": 1}, "sqlglot.expressions.SchemaCommentProperty": {"tf": 1}, "sqlglot.expressions.ReturnsProperty": {"tf": 1}, "sqlglot.expressions.LanguageProperty": {"tf": 1}, "sqlglot.expressions.ExecuteAsProperty": {"tf": 1}, "sqlglot.expressions.VolatilityProperty": {"tf": 1}, "sqlglot.expressions.RowFormatDelimitedProperty": {"tf": 1}, "sqlglot.expressions.RowFormatSerdeProperty": {"tf": 1}, "sqlglot.expressions.SerdeProperties": {"tf": 1}, "sqlglot.expressions.FallbackProperty": {"tf": 1}, "sqlglot.expressions.WithJournalTableProperty": {"tf": 1}, "sqlglot.expressions.LogProperty": {"tf": 1}, "sqlglot.expressions.JournalProperty": {"tf": 1}, "sqlglot.expressions.AfterJournalProperty": {"tf": 1}, "sqlglot.expressions.ChecksumProperty": {"tf": 1}, "sqlglot.expressions.FreespaceProperty": {"tf": 1}, "sqlglot.expressions.MergeBlockRatioProperty": {"tf": 1}, "sqlglot.expressions.DataBlocksizeProperty": {"tf": 1}, "sqlglot.expressions.BlockCompressionProperty": {"tf": 1}, "sqlglot.expressions.IsolatedLoadingProperty": {"tf": 1}, "sqlglot.expressions.Properties": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.Qualify": {"tf": 1}, "sqlglot.expressions.Return": {"tf": 1}, "sqlglot.expressions.Reference": {"tf": 1}, "sqlglot.expressions.Tuple": {"tf": 1}, "sqlglot.expressions.Subqueryable": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Table": {"tf": 1}, "sqlglot.expressions.SystemTime": {"tf": 1}, "sqlglot.expressions.Union": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Except": {"tf": 1}, "sqlglot.expressions.Intersect": {"tf": 1}, "sqlglot.expressions.Unnest": {"tf": 1}, "sqlglot.expressions.Update": {"tf": 1}, "sqlglot.expressions.Values": {"tf": 1}, "sqlglot.expressions.Var": {"tf": 1}, "sqlglot.expressions.Schema": {"tf": 1}, "sqlglot.expressions.Lock": {"tf": 1}, "sqlglot.expressions.Select": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Subquery": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.TableSample": {"tf": 1}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Pivot": {"tf": 1}, "sqlglot.expressions.Window": {"tf": 1}, "sqlglot.expressions.WindowSpec": {"tf": 1}, "sqlglot.expressions.Where": {"tf": 1}, "sqlglot.expressions.Star": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Parameter": {"tf": 1}, "sqlglot.expressions.SessionParameter": {"tf": 1}, "sqlglot.expressions.Placeholder": {"tf": 1}, "sqlglot.expressions.Null": {"tf": 1}, "sqlglot.expressions.Boolean": {"tf": 1}, "sqlglot.expressions.DataType": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.PseudoType": {"tf": 1}, "sqlglot.expressions.StructKwarg": {"tf": 1}, "sqlglot.expressions.SubqueryPredicate": {"tf": 1}, "sqlglot.expressions.All": {"tf": 1}, "sqlglot.expressions.Any": {"tf": 1}, "sqlglot.expressions.Exists": {"tf": 1}, "sqlglot.expressions.Command": {"tf": 1}, "sqlglot.expressions.Transaction": {"tf": 1}, "sqlglot.expressions.Commit": {"tf": 1}, "sqlglot.expressions.Rollback": {"tf": 1}, "sqlglot.expressions.AlterTable": {"tf": 1}, "sqlglot.expressions.AddConstraint": {"tf": 1}, "sqlglot.expressions.DropPartition": {"tf": 1}, "sqlglot.expressions.Binary": {"tf": 1}, "sqlglot.expressions.Add": {"tf": 1}, "sqlglot.expressions.Connector": {"tf": 1}, "sqlglot.expressions.And": {"tf": 1}, "sqlglot.expressions.Or": {"tf": 1}, "sqlglot.expressions.BitwiseAnd": {"tf": 1}, "sqlglot.expressions.BitwiseLeftShift": {"tf": 1}, "sqlglot.expressions.BitwiseOr": {"tf": 1}, "sqlglot.expressions.BitwiseRightShift": {"tf": 1}, "sqlglot.expressions.BitwiseXor": {"tf": 1}, "sqlglot.expressions.Div": {"tf": 1}, "sqlglot.expressions.Dot": {"tf": 1}, "sqlglot.expressions.DPipe": {"tf": 1}, "sqlglot.expressions.EQ": {"tf": 1}, "sqlglot.expressions.NullSafeEQ": {"tf": 1}, "sqlglot.expressions.NullSafeNEQ": {"tf": 1}, "sqlglot.expressions.Distance": {"tf": 1}, "sqlglot.expressions.Escape": {"tf": 1}, "sqlglot.expressions.Glob": {"tf": 1}, "sqlglot.expressions.GT": {"tf": 1}, "sqlglot.expressions.GTE": {"tf": 1}, "sqlglot.expressions.ILike": {"tf": 1}, "sqlglot.expressions.IntDiv": {"tf": 1}, "sqlglot.expressions.Is": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.Like": {"tf": 1}, "sqlglot.expressions.LT": {"tf": 1}, "sqlglot.expressions.LTE": {"tf": 1}, "sqlglot.expressions.Mod": {"tf": 1}, "sqlglot.expressions.Mul": {"tf": 1}, "sqlglot.expressions.NEQ": {"tf": 1}, "sqlglot.expressions.SimilarTo": {"tf": 1}, "sqlglot.expressions.Slice": {"tf": 1}, "sqlglot.expressions.Sub": {"tf": 1}, "sqlglot.expressions.Unary": {"tf": 1}, "sqlglot.expressions.BitwiseNot": {"tf": 1}, "sqlglot.expressions.Not": {"tf": 1}, "sqlglot.expressions.Paren": {"tf": 1}, "sqlglot.expressions.Neg": {"tf": 1}, "sqlglot.expressions.Alias": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Aliases": {"tf": 1}, "sqlglot.expressions.AtTimeZone": {"tf": 1}, "sqlglot.expressions.Between": {"tf": 1}, "sqlglot.expressions.Bracket": {"tf": 1}, "sqlglot.expressions.Distinct": {"tf": 1}, "sqlglot.expressions.In": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.expressions.Interval": {"tf": 1}, "sqlglot.expressions.IgnoreNulls": {"tf": 1}, "sqlglot.expressions.RespectNulls": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.expressions.AggFunc": {"tf": 1}, "sqlglot.expressions.Abs": {"tf": 1}, "sqlglot.expressions.Anonymous": {"tf": 1}, "sqlglot.expressions.ApproxDistinct": {"tf": 1}, "sqlglot.expressions.Array": {"tf": 1}, "sqlglot.expressions.GenerateSeries": {"tf": 1}, "sqlglot.expressions.ArrayAgg": {"tf": 1}, "sqlglot.expressions.ArrayAll": {"tf": 1}, "sqlglot.expressions.ArrayAny": {"tf": 1}, "sqlglot.expressions.ArrayConcat": {"tf": 1}, "sqlglot.expressions.ArrayContains": {"tf": 1}, "sqlglot.expressions.ArrayFilter": {"tf": 1}, "sqlglot.expressions.ArraySize": {"tf": 1}, "sqlglot.expressions.ArraySort": {"tf": 1}, "sqlglot.expressions.ArraySum": {"tf": 1}, "sqlglot.expressions.ArrayUnionAgg": {"tf": 1}, "sqlglot.expressions.Avg": {"tf": 1}, "sqlglot.expressions.AnyValue": {"tf": 1}, "sqlglot.expressions.Case": {"tf": 1}, "sqlglot.expressions.Cast": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.Collate": {"tf": 1}, "sqlglot.expressions.TryCast": {"tf": 1}, "sqlglot.expressions.Ceil": {"tf": 1}, "sqlglot.expressions.Coalesce": {"tf": 1}, "sqlglot.expressions.Concat": {"tf": 1}, "sqlglot.expressions.ConcatWs": {"tf": 1}, "sqlglot.expressions.Count": {"tf": 1}, "sqlglot.expressions.CurrentDate": {"tf": 1}, "sqlglot.expressions.CurrentDatetime": {"tf": 1}, "sqlglot.expressions.CurrentTime": {"tf": 1}, "sqlglot.expressions.CurrentTimestamp": {"tf": 1}, "sqlglot.expressions.DateAdd": {"tf": 1}, "sqlglot.expressions.DateSub": {"tf": 1}, "sqlglot.expressions.DateDiff": {"tf": 1}, "sqlglot.expressions.DateTrunc": {"tf": 1}, "sqlglot.expressions.DatetimeAdd": {"tf": 1}, "sqlglot.expressions.DatetimeSub": {"tf": 1}, "sqlglot.expressions.DatetimeDiff": {"tf": 1}, "sqlglot.expressions.DatetimeTrunc": {"tf": 1}, "sqlglot.expressions.DayOfWeek": {"tf": 1}, "sqlglot.expressions.DayOfMonth": {"tf": 1}, "sqlglot.expressions.DayOfYear": {"tf": 1}, "sqlglot.expressions.WeekOfYear": {"tf": 1}, "sqlglot.expressions.LastDateOfMonth": {"tf": 1}, "sqlglot.expressions.Extract": {"tf": 1}, "sqlglot.expressions.TimestampAdd": {"tf": 1}, "sqlglot.expressions.TimestampSub": {"tf": 1}, "sqlglot.expressions.TimestampDiff": {"tf": 1}, "sqlglot.expressions.TimestampTrunc": {"tf": 1}, "sqlglot.expressions.TimeAdd": {"tf": 1}, "sqlglot.expressions.TimeSub": {"tf": 1}, "sqlglot.expressions.TimeDiff": {"tf": 1}, "sqlglot.expressions.TimeTrunc": {"tf": 1}, "sqlglot.expressions.DateFromParts": {"tf": 1}, "sqlglot.expressions.DateStrToDate": {"tf": 1}, "sqlglot.expressions.DateToDateStr": {"tf": 1}, "sqlglot.expressions.DateToDi": {"tf": 1}, "sqlglot.expressions.Day": {"tf": 1}, "sqlglot.expressions.Decode": {"tf": 1}, "sqlglot.expressions.DiToDate": {"tf": 1}, "sqlglot.expressions.Encode": {"tf": 1}, "sqlglot.expressions.Exp": {"tf": 1}, "sqlglot.expressions.Explode": {"tf": 1}, "sqlglot.expressions.Floor": {"tf": 1}, "sqlglot.expressions.Greatest": {"tf": 1}, "sqlglot.expressions.GroupConcat": {"tf": 1}, "sqlglot.expressions.Hex": {"tf": 1}, "sqlglot.expressions.If": {"tf": 1}, "sqlglot.expressions.IfNull": {"tf": 1}, "sqlglot.expressions.Initcap": {"tf": 1}, "sqlglot.expressions.JSONBContains": {"tf": 1}, "sqlglot.expressions.JSONExtract": {"tf": 1}, "sqlglot.expressions.JSONExtractScalar": {"tf": 1}, "sqlglot.expressions.JSONBExtract": {"tf": 1}, "sqlglot.expressions.JSONBExtractScalar": {"tf": 1}, "sqlglot.expressions.Least": {"tf": 1}, "sqlglot.expressions.Length": {"tf": 1}, "sqlglot.expressions.Levenshtein": {"tf": 1}, "sqlglot.expressions.Ln": {"tf": 1}, "sqlglot.expressions.Log": {"tf": 1}, "sqlglot.expressions.Log2": {"tf": 1}, "sqlglot.expressions.Log10": {"tf": 1}, "sqlglot.expressions.LogicalOr": {"tf": 1}, "sqlglot.expressions.Lower": {"tf": 1}, "sqlglot.expressions.Map": {"tf": 1}, "sqlglot.expressions.VarMap": {"tf": 1}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.expressions.Max": {"tf": 1}, "sqlglot.expressions.Min": {"tf": 1}, "sqlglot.expressions.Month": {"tf": 1}, "sqlglot.expressions.Nvl2": {"tf": 1}, "sqlglot.expressions.Posexplode": {"tf": 1}, "sqlglot.expressions.Pow": {"tf": 1}, "sqlglot.expressions.PercentileCont": {"tf": 1}, "sqlglot.expressions.PercentileDisc": {"tf": 1}, "sqlglot.expressions.Quantile": {"tf": 1}, "sqlglot.expressions.Quantiles": {"tf": 1}, "sqlglot.expressions.QuantileIf": {"tf": 1}, "sqlglot.expressions.ApproxQuantile": {"tf": 1}, "sqlglot.expressions.ReadCSV": {"tf": 1}, "sqlglot.expressions.Reduce": {"tf": 1}, "sqlglot.expressions.RegexpLike": {"tf": 1}, "sqlglot.expressions.RegexpILike": {"tf": 1}, "sqlglot.expressions.RegexpSplit": {"tf": 1}, "sqlglot.expressions.Repeat": {"tf": 1}, "sqlglot.expressions.Round": {"tf": 1}, "sqlglot.expressions.RowNumber": {"tf": 1}, "sqlglot.expressions.SafeDivide": {"tf": 1}, "sqlglot.expressions.SetAgg": {"tf": 1}, "sqlglot.expressions.SortArray": {"tf": 1}, "sqlglot.expressions.Split": {"tf": 1}, "sqlglot.expressions.Substring": {"tf": 1}, "sqlglot.expressions.StrPosition": {"tf": 1}, "sqlglot.expressions.StrToDate": {"tf": 1}, "sqlglot.expressions.StrToTime": {"tf": 1}, "sqlglot.expressions.StrToUnix": {"tf": 1}, "sqlglot.expressions.NumberToStr": {"tf": 1}, "sqlglot.expressions.Struct": {"tf": 1}, "sqlglot.expressions.StructExtract": {"tf": 1}, "sqlglot.expressions.Sum": {"tf": 1}, "sqlglot.expressions.Sqrt": {"tf": 1}, "sqlglot.expressions.Stddev": {"tf": 1}, "sqlglot.expressions.StddevPop": {"tf": 1}, "sqlglot.expressions.StddevSamp": {"tf": 1}, "sqlglot.expressions.TimeToStr": {"tf": 1}, "sqlglot.expressions.TimeToTimeStr": {"tf": 1}, "sqlglot.expressions.TimeToUnix": {"tf": 1}, "sqlglot.expressions.TimeStrToDate": {"tf": 1}, "sqlglot.expressions.TimeStrToTime": {"tf": 1}, "sqlglot.expressions.TimeStrToUnix": {"tf": 1}, "sqlglot.expressions.Trim": {"tf": 1}, "sqlglot.expressions.TsOrDsAdd": {"tf": 1}, "sqlglot.expressions.TsOrDsToDateStr": {"tf": 1}, "sqlglot.expressions.TsOrDsToDate": {"tf": 1}, "sqlglot.expressions.TsOrDiToDi": {"tf": 1}, "sqlglot.expressions.Unhex": {"tf": 1}, "sqlglot.expressions.UnixToStr": {"tf": 1}, "sqlglot.expressions.UnixToTime": {"tf": 1}, "sqlglot.expressions.UnixToTimeStr": {"tf": 1}, "sqlglot.expressions.Upper": {"tf": 1}, "sqlglot.expressions.Variance": {"tf": 1}, "sqlglot.expressions.VariancePop": {"tf": 1}, "sqlglot.expressions.Week": {"tf": 1}, "sqlglot.expressions.Year": {"tf": 1}, "sqlglot.expressions.Use": {"tf": 1}, "sqlglot.expressions.Merge": {"tf": 1}, "sqlglot.expressions.When": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.expressions.false": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}, "sqlglot.generator.Generator.sep": {"tf": 1}, "sqlglot.generator.Generator.seg": {"tf": 1}, "sqlglot.generator.Generator.pad_comment": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.generator.Generator.wrap": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.helper": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.lineage": {"tf": 1}, "sqlglot.lineage.Node": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer": {"tf": 1}, "sqlglot.optimizer.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}, "sqlglot.optimizer.canonicalize": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalized": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}, "sqlglot.optimizer.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.optimizer.optimizer": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}, "sqlglot.optimizer.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}, "sqlglot.parser": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.parser.Parser.reset": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner": {"tf": 1}, "sqlglot.planner.Plan": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.planner.Scan": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.Aggregate": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}, "sqlglot.planner.Sort": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.planner.SetOperation": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1}, "sqlglot.serde": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.time": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}, "sqlglot.tokens.Token": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}, "sqlglot.trie": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 1667, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.SqlglotError": {"tf": 1}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.sqlite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1.4142135623730951}}, "df": 8}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SqlSecurityProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Sqrt": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Schema": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.schema.Schema": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1.4142135623730951}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}}, "df": 27, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.SchemaError": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SchemaCommentProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}}, "df": 1}}}, "n": {"docs": {"sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.planner.Scan": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}}, "df": 6}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.build_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.4142135623730951}}, "df": 43, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}}, "df": 7}}}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.spark": {"tf": 1}, "sqlglot.dialects.spark.Spark": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1.4142135623730951}}, "df": 8, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.SparkSession": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}}, "df": 5}}}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SPACE": {"tf": 1}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Split": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.generator.Generator.window_spec_sql": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Select": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}}, "df": 23, "s": {"docs": {"sqlglot.optimizer.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}}, "df": 5}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {"sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Set": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}}, "df": 11, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.expressions.SetItem": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.SetAgg": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.planner.SetOperation": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}}}}}}}}}, "s": {"docs": {"sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.serde": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}}, "df": 4, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.SerdeProperties": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.SessionParameter": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}, "p": {"docs": {"sqlglot.generator.Generator.sep": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}}, "df": 1}}}}}}}, "g": {"docs": {"sqlglot.generator.Generator.seg": {"tf": 1}}, "df": 1}, "q": {"docs": {"sqlglot.helper.seq_get": {"tf": 1}}, "df": 1}, "m": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.tokens.TokenType.SEMI": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.SEED": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.expressions.Sort": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}, "sqlglot.planner.Sort": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}}, "df": 10, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SortKeyProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.SortArray": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}}, "df": 2}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SOME": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.expressions.Sum": {"tf": 1}}, "df": 2}, "b": {"docs": {"sqlglot.expressions.Sub": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.Column.substr": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.expressions.Substring": {"tf": 1}}, "df": 2}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subquery": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}}, "df": 9, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Subqueryable": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}}, "df": 4}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.SubqueryPredicate": {"tf": 1}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 11}}}}}}}, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.subclasses": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}}, "df": 2}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Star": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}}, "df": 4, "t": {"docs": {"sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.Column.startswith": {"tf": 1}}, "df": 1}}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.starrocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}}, "df": 5}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor.python.PythonExecutor.static": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {"sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}}, "df": 2, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.Struct": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}}, "df": 4, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.StructKwarg": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.StructExtract": {"tf": 1}}, "df": 1}}}}}}}}}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.expressions.StrPosition": {"tf": 1}}, "df": 3}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}}, "df": 7}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.StrToDate": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.StrToTime": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.StrToUnix": {"tf": 1}}, "df": 1}}}}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.expressions.Stddev": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.StddevPop": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.StddevSamp": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.planner.Step": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}}, "df": 5}}}, "a": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 1}}}}}}}}}, "f": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}}, "df": 1, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.SafeDivide": {"tf": 1}}, "df": 1}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1.4142135623730951}}, "df": 13}}}}}}}, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.camel_to_snake_case": {"tf": 1}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.expressions.Show": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}}, "df": 3}}}, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.expressions.SystemTime": {"tf": 1}}, "df": 2}}}}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}}, "df": 2}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}}, "df": 2}}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.expressions.SimilarTo": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}}, "df": 2}}}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.optimizer.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.flatten": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}}, "df": 19}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Slice": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.SLASH": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.pretty": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.presto": {"tf": 1}, "sqlglot.dialects.presto.Presto": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1.4142135623730951}}, "df": 8}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}}, "df": 7}}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.prepend_ctes": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.transforms.preprocess": {"tf": 1}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.expressions.Properties": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}}, "df": 19}}}, "y": {"docs": {"sqlglot.expressions.Property": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}}, "df": 3}}}}}, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}}, "df": 3}}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}}, "df": 1, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.PrimaryKey": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.PrimaryKeyColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 9, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.parser": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.reset": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.check_errors": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.raise_error": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}}, "df": 30}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}}, "df": 3}}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Partition": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}}, "df": 5, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}}, "df": 2}}, "s": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}}, "df": 1}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.expressions.PartitionedByProperty": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.expressions.Paren": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}}, "df": 6, "t": {"docs": {"sqlglot.expressions.Expression.parent_select": {"tf": 1}}, "df": 1}, "s": {"docs": {"sqlglot.optimizer.simplify.simplify_parens": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Parameter": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {"sqlglot.helper.count_params": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {"sqlglot.generator.Generator.pad_comment": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.PERCENT": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.PercentileCont": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.PercentileDisc": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.expressions.Pivot": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}}, "df": 5}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.PIPE": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}}, "df": 4, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}}, "df": 7}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Posexplode": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {"sqlglot.executor.table.Table.pop": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}}, "df": 2}, "w": {"docs": {"sqlglot.expressions.Pow": {"tf": 1}}, "df": 1}}, "y": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.python": {"tf": 1}, "sqlglot.executor.python.PythonExecutor": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.executor.python.Python": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}}, "df": 22, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.python.PythonExecutor": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}}, "df": 17}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Placeholder": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {"sqlglot.planner.Plan": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}}, "df": 2, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.planner": {"tf": 1}, "sqlglot.planner.Plan": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.planner.Scan": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.Aggregate": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}, "sqlglot.planner.Sort": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.planner.SetOperation": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 21}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.PLUS": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.PseudoType": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}, "sqlglot.optimizer.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}}, "df": 10}}}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.parse_one": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.ONLY": {"tf": 1}}, "df": 1}}}, "r": {"docs": {"sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Or": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}}, "df": 6, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Order": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}}, "df": 4, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.expressions.Ordered": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}}, "df": 4}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1.4142135623730951}}, "df": 10}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}}, "df": 3, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {"sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}}, "df": 13, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 6, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.OptimizeError": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {"sqlglot.optimizer": {"tf": 1}, "sqlglot.optimizer.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}, "sqlglot.optimizer.canonicalize": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalized": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}, "sqlglot.optimizer.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.optimizer.optimizer": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}, "sqlglot.optimizer.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 123}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}}, "df": 2}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.unnest_operands": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}}, "df": 1, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}}, "df": 1}}}}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.expressions.Offset": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}}, "df": 6}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}}, "df": 8}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.OUTER": {"tf": 1}}, "df": 1}}}}, "b": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}}, "df": 3}}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.expressions.Transaction": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}}, "df": 5}}}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.transforms": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 6}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.TRAILING": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.trino": {"tf": 1}, "sqlglot.dialects.trino.Trino": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1.4142135623730951}}, "df": 6}}, "m": {"docs": {"sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.expressions.Trim": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}}, "df": 3}, "e": {"docs": {"sqlglot.trie": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 3}}, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.expressions.TryCast": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}}, "df": 3}}}}}, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.true": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}}, "df": 4}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.table": {"tf": 1}, "sqlglot.executor.table.Table": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.add_columns": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.append": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.pop": {"tf": 1.4142135623730951}, "sqlglot.executor.table.TableIter": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.Table": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}}, "df": 41, "a": {"docs": {}, "df": 0, "u": {"docs": {"sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}}, "df": 6}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.TableAlias": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}}, "df": 2}}}}}, "s": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.qualify_tables": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}}, "df": 8, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.expressions.TableSample": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}}, "df": 3}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.TableIter": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}}, "df": 2}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.TableFormatProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "g": {"docs": {"sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}}, "df": 2}}, "o": {"docs": {"sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}}, "df": 12, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.tokens.Token": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 7, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 1, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}, "sqlglot.tokens.Tokenizer": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 20}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.TokenError": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.tokens": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}, "sqlglot.tokens.Token": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 297}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 286}}}}}}}, "p": {"docs": {"sqlglot.tokens.TokenType.TOP": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.tsql": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1.4142135623730951}}, "df": 10}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.TsOrDsAdd": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.TsOrDsToDate": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TsOrDsToDateStr": {"tf": 1}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.expressions.TsOrDiToDi": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {"sqlglot.helper.tsort": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}, "sqlglot.dialects.teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1.4142135623730951}}, "df": 8}}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}}, "df": 5}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.time": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}}, "df": 12, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.expressions.TimeStrToTime": {"tf": 1}}, "df": 2}}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.TimeStrToDate": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.TimeStrToUnix": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}}, "df": 3, "t": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}}, "df": 2}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.TimestampTrunc": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.TimestampAdd": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.TimestampSub": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.TimestampDiff": {"tf": 1}}, "df": 1}}}}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.TimeSub": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.TimeAdd": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.TimeDiff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.TimeTrunc": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TimeToStr": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TimeToTimeStr": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.TimeToUnix": {"tf": 1}}, "df": 1}}}}}}}}, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}}, "df": 2}}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.TILDA": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.expressions.Tuple": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}}, "df": 4}}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.this": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.THEN": {"tf": 1}}, "df": 1}}}, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}}, "df": 58, "s": {"docs": {"sqlglot.optimizer.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 6}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}}, "df": 3}}}}}}}}}}}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dataframe.sql.Window": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 113, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrameNaFunctions": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}}, "df": 5}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrameReader": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}}, "df": 3}}}}}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 7}}}}}}}}}}}, "b": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}}, "df": 6}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataBlocksizeProperty": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.expressions.DataType": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}}, "df": 58}}}}}, "e": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}}, "df": 8, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.expressions.DateStrToDate": {"tf": 1}}, "df": 2}}}}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DateSub": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}}, "df": 3, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DatetimeAdd": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DatetimeSub": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.DatetimeDiff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.DatetimeTrunc": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.DateTrunc": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DateToDateStr": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {"sqlglot.expressions.DateToDi": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DateAdd": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.DateDiff": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.DateFromParts": {"tf": 1}}, "df": 1}}}}}}}}}}}, "y": {"docs": {"sqlglot.expressions.Day": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.DayOfWeek": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.DayOfMonth": {"tf": 1}}, "df": 1}}}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DayOfYear": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.DASH": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.DARROW": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Distinct": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 8}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Distribute": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}}, "df": 3}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.normalize.distributive_law": {"tf": 1}}, "df": 1}}}}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DistKeyProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DistStyleProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Distance": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 3}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect": {"tf": 1}, "sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}, "sqlglot.dialects.dialect.Dialect": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}}, "df": 57, "s": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect": {"tf": 1}, "sqlglot.dialects.dialect.Dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.dialects.duckdb": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive": {"tf": 1}, "sqlglot.dialects.hive.Hive": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto": {"tf": 1}, "sqlglot.dialects.presto.Presto": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark": {"tf": 1}, "sqlglot.dialects.spark.Spark": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.starrocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.trino": {"tf": 1}, "sqlglot.dialects.trino.Trino": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}}, "df": 202}}}}}}, "v": {"docs": {"sqlglot.expressions.Div": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1.4142135623730951}}, "df": 15}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Directory": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}}, "df": 2}}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}}, "df": 3}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DiToDate": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.expressions.Drop": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}}, "df": 5, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}}, "df": 1}}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}}, "df": 1}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DropPartition": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.drill": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1.4142135623730951}}, "df": 9}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}}, "df": 4, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.expressions.Describe": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}}, "df": 4}}}}}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}}, "df": 2}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Delete": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}}, "df": 4}}, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transforms.delegate": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}}, "df": 2}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.planner.Step.add_dependency": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}}, "df": 4, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DerivedTable": {"tf": 1}}, "df": 1}}}}}}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DefaultColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DefinerProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Decode": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 1}}}}}}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.duckdb": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}}, "df": 7}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}}, "df": 2}}}, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.dfs": {"tf": 1}}, "df": 1}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}}, "df": 2}}}}, "t": {"docs": {"sqlglot.expressions.Dot": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}}, "df": 3}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DPipe": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}}, "df": 3}}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 1}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.DCOLON": {"tf": 1}}, "df": 1}}}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.expressions.In": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 7, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step.__init__": {"tf": 1}, "sqlglot.planner.Scan.__init__": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}, "sqlglot.planner.Sort.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1}}, "df": 63, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Initcap": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Intersect": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}}, "df": 9, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}}, "df": 1}}}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.env.interval": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.Interval": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}}, "df": 7}}}}}, "o": {"docs": {"sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.expressions.Into": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}}, "df": 5}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Introducer": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}}, "df": 3}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.expressions.IntDiv": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.expressions.Insert": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}}, "df": 5, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.expressions.Index": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}}, "df": 6}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.indent": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.INNER": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {"sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Is": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}}, "df": 18, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}}, "df": 2}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.isin": {"tf": 1}}, "df": 1}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1.4142135623730951}}, "df": 2, "d": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.IsolatedLoadingProperty": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.expressions.ILike": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}}, "df": 5}}}}, "f": {"docs": {"sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.If": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}}, "df": 6, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.IfNull": {"tf": 1}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}}, "df": 2, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.IgnoreNulls": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}}, "df": 2}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.context.Context.table_iter": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.is_iterable": {"tf": 1}}, "df": 1}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Identifier": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}}, "df": 6}}}, "y": {"docs": {"sqlglot.generator.Generator.no_identify": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.lower_identities": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}}, "df": 2}}}, "y": {"docs": {"sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.expressions.Create": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}}, "df": 5, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.CROSS": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}}, "df": 6}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.expressions.Coalesce": {"tf": 1}}, "df": 2}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.expressions.Count": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 5}}}, "l": {"docs": {"sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.expressions.Column": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}}, "df": 47, "s": {"docs": {"sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}}, "df": 9}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.ColumnDef": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}}, "df": 2}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}}, "df": 2, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.ColumnConstraintKind": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Collate": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}}, "df": 3, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CollateColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.CollateProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.ensure_collection": {"tf": 1}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.COLON": {"tf": 1}}, "df": 1}}}, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.expressions.Commit": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}}, "df": 4}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.pad_comment": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CommentColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}, "a": {"docs": {"sqlglot.tokens.TokenType.COMMA": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Command": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}}, "df": 3}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.simplify.is_complement": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.expressions.Concat": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}}, "df": 4, "w": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.ConcatWs": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.context": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.eval": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.add_columns": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.table_iter": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.filter": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.sort": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.set_row": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.set_index": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.set_range": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}}, "df": 13}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Condition": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 6}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Constraint": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}}, "df": 3}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Connector": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1}}, "df": 1}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.convert": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}}, "df": 1}}}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.expressions.Cache": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}}, "df": 5}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.expressions.Cast": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}}, "df": 8, "s": {"docs": {"sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}}, "df": 1}}, "e": {"docs": {"sqlglot.expressions.Case": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}}, "df": 4}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CASCADE": {"tf": 1}}, "df": 1}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.helper.camel_to_snake_case": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.canonicalize": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}}, "df": 5}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.CARET": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.clickhouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}}, "df": 8}}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Cluster": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}}, "df": 4}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.expressions.CTE": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}}, "df": 7, "s": {"docs": {"sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}}, "df": 5}}, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Select.ctas": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}}, "df": 6, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.CurrentDate": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}}, "df": 2, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.CurrentDatetime": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.CurrentTime": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.CurrentTimestamp": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CUBE": {"tf": 1}}, "df": 1}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 3}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {"sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CharacterSet": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.CharacterSetProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.Check": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.CheckColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ChecksumProperty": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.replace_children": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Ceil": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Alias": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}}, "df": 8, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Aliases": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}}, "df": 3}}}}}, "l": {"docs": {"sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.All": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}}, "df": 5}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.ALTER": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.AlterColumn": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}}, "df": 2}}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.AlterTable": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}}, "df": 2}}}}}}}}, "g": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AlgorithmProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}}, "df": 2}}}}}, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}}, "df": 2, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.planner.Aggregate": {"tf": 1}, "sqlglot.planner.Aggregate.__init__": {"tf": 1}}, "df": 3}}}}}}, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.AggFunc": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.expressions.Avg": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.expressions.Anonymous": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}}, "df": 3}}}}}}}, "y": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Any": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}}, "df": 4, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.AnyValue": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.find_ancestor": {"tf": 1}}, "df": 1}}}}}}, "d": {"docs": {"sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.And": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}}, "df": 6}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1.4142135623730951}}, "df": 5}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.tokens.TokenType.ANTI": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}}, "df": 4}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.assert_is": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.tokens.TokenType.ASOF": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.Array": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}}, "df": 5, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.ArrayAgg": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.ArrayAll": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ArrayAny": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ArrayConcat": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.ArrayContains": {"tf": 1}}, "df": 1}}}}}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.ArrayFilter": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.ArraySize": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ArraySort": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.ArraySum": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.ArrayUnionAgg": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}}, "df": 6}}}, "g": {"docs": {"sqlglot.expressions.Func.from_arg_list": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 2}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}}, "df": 1, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ApproxDistinct": {"tf": 1}}, "df": 1}}}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.ApproxQuantile": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.table.Table.append": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}}, "df": 2}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.expressions.Add": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 9, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.AddConstraint": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.AutoIncrementColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AutoIncrementProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.AutoName": {"tf": 1}}, "df": 1}}}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AfterJournalProperty": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.AtTimeZone": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "b": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Abs": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 4}}}}}}}}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.AMP": {"tf": 1}}, "df": 1}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}}, "df": 1}}}}}}, "w": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Where": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}}, "df": 6}}, "n": {"docs": {"sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.expressions.When": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}}, "df": 4}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.expressions.With": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}}, "df": 12, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}}, "df": 1, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.WithinGroup": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}}, "df": 2}}}}}}}, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.WithJournalTableProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dataframe.sql.Window": {"tf": 1}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Window": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}}, "df": 11, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.WindowSpec": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.expressions.WindowSpec": {"tf": 1}}, "df": 9}}}}}}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.generator.Generator.text_width": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.errors.ErrorLevel.WARN": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 4}}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.Week": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.WeekOfYear": {"tf": 1}}, "df": 1}}}}}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.generator.Generator.wrap": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.expressions.Filter": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}}, "df": 6}}}, "l": {"docs": {"sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.FileFormatProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}}, "df": 5}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 7}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Final": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}}, "df": 2}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}}, "df": 9, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}}, "df": 3}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.FULL": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}}, "df": 2, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}}, "df": 6}}}, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}}, "df": 1, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ForeignKey": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}}, "df": 2}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1}}, "df": 4}}}}}, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Floor": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.From": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}}, "df": 13}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.FreespaceProperty": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Fetch": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}}, "df": 3}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.FallbackProperty": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.false": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}}, "df": 2}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.FARROW": {"tf": 1}}, "df": 1}}}}}}, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Group": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 6, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.GroupedData": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}}, "df": 10}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.GroupConcat": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Greatest": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.generate": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.unsupported": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sep": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.seg": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.pad_comment": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.wrap": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.no_identify": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.normalize_func": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.indent": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.cache_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.column_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.create_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.describe_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.with_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.cte_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.directory_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.delete_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.drop_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.except_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.except_op": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.filter_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.hint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.index_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.national_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.partition_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.properties_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.root_properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.with_properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.locate_properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.property_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.insert_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.intersect_op": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.table_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.update_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.var_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.into_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.from_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.group_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.having_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.join_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.limit_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.offset_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lock_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.literal_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.null_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.order_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sort_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.schema_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.star_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.union_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.union_op": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.where_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.window_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.between_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.all_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.any_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.exists_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.case_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.extract_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.trim_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.concat_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.check_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.unique_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.if_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.in_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.interval_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.return_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.reference_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.paren_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.neg_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.not_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.alias_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.add_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.and_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.connector_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.cast_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.collate_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.command_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.commit_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.div_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.distance_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.dot_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.eq_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.escape_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.glob_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.gt_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.gte_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.is_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.like_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lt_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lte_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.mod_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.mul_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.neq_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.or_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.slice_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sub_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.use_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.binary": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.format_args": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.text_width": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.format_time": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.expressions": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.op_expressions": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.naked_property": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.set_operation": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tag_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.token_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.when_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.merge_sql": {"tf": 1.4142135623730951}}, "df": 267}}, "e": {"docs": {"sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}}, "df": 5, "d": {"docs": {"sqlglot.tokens.TokenType.GENERATED": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}}, "df": 3}}}}}}}}}}}}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.GenerateSeries": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "t": {"docs": {"sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 4}, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}}, "df": 2}}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}}, "df": 2}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.Glob": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}}, "df": 3, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.expressions.GT": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.expressions.GTE": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}}, "df": 3}}}, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.expressions.Join": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.planner.Join": {"tf": 1}, "sqlglot.planner.Join.__init__": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}}, "df": 15, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JoinHint": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {"sqlglot.optimizer.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}}, "df": 9}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.JournalProperty": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}}, "df": 4, "b": {"docs": {"sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.JSONBContains": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JSONBExtract": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.JSONBExtractScalar": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JSONExtract": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.JSONExtractScalar": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Union": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}}, "df": 10, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}}, "df": 1}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Unionable": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}}, "df": 4}}}}, "b": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {"sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}}, "df": 1}, "q": {"docs": {"sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Unique": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 3, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.UniqueColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.UnixToStr": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.UnixToTime": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.UnixToTimeStr": {"tf": 1}}, "df": 1}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.expressions.Unary": {"tf": 1}}, "df": 2}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 2}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Unnest": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}}, "df": 12}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}}, "df": 2, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.UnsupportedError": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Uncache": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}}, "df": 3}}}}}, "k": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}}, "df": 1}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.Unhex": {"tf": 1}}, "df": 1}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}}, "df": 1}}}}}}}}}, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.expressions.Update": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}}, "df": 7}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Upper": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}}, "df": 3}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Use": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}}, "df": 3, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.UserDefinedFunction": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}}, "df": 2, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.UserDefinedFunctionKwarg": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}}, "df": 2}}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}}, "df": 2}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Except": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}}, "df": 8, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}}, "df": 1}}}}}}}, "p": {"docs": {"sqlglot.expressions.Exp": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 40, "s": {"docs": {"sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Condition": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.expressions.DerivedTable": {"tf": 1}, "sqlglot.expressions.Unionable": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.UDTF": {"tf": 1}, "sqlglot.expressions.Cache": {"tf": 1}, "sqlglot.expressions.Uncache": {"tf": 1}, "sqlglot.expressions.Create": {"tf": 1}, "sqlglot.expressions.Describe": {"tf": 1}, "sqlglot.expressions.Set": {"tf": 1}, "sqlglot.expressions.SetItem": {"tf": 1}, "sqlglot.expressions.Show": {"tf": 1}, "sqlglot.expressions.UserDefinedFunction": {"tf": 1}, "sqlglot.expressions.UserDefinedFunctionKwarg": {"tf": 1}, "sqlglot.expressions.CharacterSet": {"tf": 1}, "sqlglot.expressions.With": {"tf": 1}, "sqlglot.expressions.WithinGroup": {"tf": 1}, "sqlglot.expressions.CTE": {"tf": 1}, "sqlglot.expressions.TableAlias": {"tf": 1}, "sqlglot.expressions.BitString": {"tf": 1}, "sqlglot.expressions.HexString": {"tf": 1}, "sqlglot.expressions.ByteString": {"tf": 1}, "sqlglot.expressions.Column": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.ColumnDef": {"tf": 1}, "sqlglot.expressions.AlterColumn": {"tf": 1}, "sqlglot.expressions.RenameTable": {"tf": 1}, "sqlglot.expressions.ColumnConstraint": {"tf": 1}, "sqlglot.expressions.ColumnConstraintKind": {"tf": 1}, "sqlglot.expressions.AutoIncrementColumnConstraint": {"tf": 1}, "sqlglot.expressions.CheckColumnConstraint": {"tf": 1}, "sqlglot.expressions.CollateColumnConstraint": {"tf": 1}, "sqlglot.expressions.CommentColumnConstraint": {"tf": 1}, "sqlglot.expressions.DefaultColumnConstraint": {"tf": 1}, "sqlglot.expressions.EncodeColumnConstraint": {"tf": 1}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"tf": 1}, "sqlglot.expressions.NotNullColumnConstraint": {"tf": 1}, "sqlglot.expressions.PrimaryKeyColumnConstraint": {"tf": 1}, "sqlglot.expressions.UniqueColumnConstraint": {"tf": 1}, "sqlglot.expressions.Constraint": {"tf": 1}, "sqlglot.expressions.Delete": {"tf": 1}, "sqlglot.expressions.Drop": {"tf": 1}, "sqlglot.expressions.Filter": {"tf": 1}, "sqlglot.expressions.Check": {"tf": 1}, "sqlglot.expressions.Directory": {"tf": 1}, "sqlglot.expressions.ForeignKey": {"tf": 1}, "sqlglot.expressions.PrimaryKey": {"tf": 1}, "sqlglot.expressions.Unique": {"tf": 1}, "sqlglot.expressions.Into": {"tf": 1}, "sqlglot.expressions.From": {"tf": 1}, "sqlglot.expressions.Having": {"tf": 1}, "sqlglot.expressions.Hint": {"tf": 1}, "sqlglot.expressions.JoinHint": {"tf": 1}, "sqlglot.expressions.Identifier": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Index": {"tf": 1}, "sqlglot.expressions.Insert": {"tf": 1}, "sqlglot.expressions.Introducer": {"tf": 1}, "sqlglot.expressions.National": {"tf": 1}, "sqlglot.expressions.LoadData": {"tf": 1}, "sqlglot.expressions.Partition": {"tf": 1}, "sqlglot.expressions.Fetch": {"tf": 1}, "sqlglot.expressions.Group": {"tf": 1}, "sqlglot.expressions.Lambda": {"tf": 1}, "sqlglot.expressions.Limit": {"tf": 1}, "sqlglot.expressions.Literal": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Lateral": {"tf": 1}, "sqlglot.expressions.MatchRecognize": {"tf": 1}, "sqlglot.expressions.Final": {"tf": 1}, "sqlglot.expressions.Offset": {"tf": 1}, "sqlglot.expressions.Order": {"tf": 1}, "sqlglot.expressions.Cluster": {"tf": 1}, "sqlglot.expressions.Distribute": {"tf": 1}, "sqlglot.expressions.Sort": {"tf": 1}, "sqlglot.expressions.Ordered": {"tf": 1}, "sqlglot.expressions.Property": {"tf": 1}, "sqlglot.expressions.AlgorithmProperty": {"tf": 1}, "sqlglot.expressions.DefinerProperty": {"tf": 1}, "sqlglot.expressions.SqlSecurityProperty": {"tf": 1}, "sqlglot.expressions.TableFormatProperty": {"tf": 1}, "sqlglot.expressions.PartitionedByProperty": {"tf": 1}, "sqlglot.expressions.FileFormatProperty": {"tf": 1}, "sqlglot.expressions.DistKeyProperty": {"tf": 1}, "sqlglot.expressions.SortKeyProperty": {"tf": 1}, "sqlglot.expressions.DistStyleProperty": {"tf": 1}, "sqlglot.expressions.LikeProperty": {"tf": 1}, "sqlglot.expressions.LocationProperty": {"tf": 1}, "sqlglot.expressions.EngineProperty": {"tf": 1}, "sqlglot.expressions.AutoIncrementProperty": {"tf": 1}, "sqlglot.expressions.CharacterSetProperty": {"tf": 1}, "sqlglot.expressions.CollateProperty": {"tf": 1}, "sqlglot.expressions.SchemaCommentProperty": {"tf": 1}, "sqlglot.expressions.ReturnsProperty": {"tf": 1}, "sqlglot.expressions.LanguageProperty": {"tf": 1}, "sqlglot.expressions.ExecuteAsProperty": {"tf": 1}, "sqlglot.expressions.VolatilityProperty": {"tf": 1}, "sqlglot.expressions.RowFormatDelimitedProperty": {"tf": 1}, "sqlglot.expressions.RowFormatSerdeProperty": {"tf": 1}, "sqlglot.expressions.SerdeProperties": {"tf": 1}, "sqlglot.expressions.FallbackProperty": {"tf": 1}, "sqlglot.expressions.WithJournalTableProperty": {"tf": 1}, "sqlglot.expressions.LogProperty": {"tf": 1}, "sqlglot.expressions.JournalProperty": {"tf": 1}, "sqlglot.expressions.AfterJournalProperty": {"tf": 1}, "sqlglot.expressions.ChecksumProperty": {"tf": 1}, "sqlglot.expressions.FreespaceProperty": {"tf": 1}, "sqlglot.expressions.MergeBlockRatioProperty": {"tf": 1}, "sqlglot.expressions.DataBlocksizeProperty": {"tf": 1}, "sqlglot.expressions.BlockCompressionProperty": {"tf": 1}, "sqlglot.expressions.IsolatedLoadingProperty": {"tf": 1}, "sqlglot.expressions.Properties": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.Qualify": {"tf": 1}, "sqlglot.expressions.Return": {"tf": 1}, "sqlglot.expressions.Reference": {"tf": 1}, "sqlglot.expressions.Tuple": {"tf": 1}, "sqlglot.expressions.Subqueryable": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Table": {"tf": 1}, "sqlglot.expressions.SystemTime": {"tf": 1}, "sqlglot.expressions.Union": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Except": {"tf": 1}, "sqlglot.expressions.Intersect": {"tf": 1}, "sqlglot.expressions.Unnest": {"tf": 1}, "sqlglot.expressions.Update": {"tf": 1}, "sqlglot.expressions.Values": {"tf": 1}, "sqlglot.expressions.Var": {"tf": 1}, "sqlglot.expressions.Schema": {"tf": 1}, "sqlglot.expressions.Lock": {"tf": 1}, "sqlglot.expressions.Select": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Subquery": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.TableSample": {"tf": 1}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Pivot": {"tf": 1}, "sqlglot.expressions.Window": {"tf": 1}, "sqlglot.expressions.WindowSpec": {"tf": 1}, "sqlglot.expressions.Where": {"tf": 1}, "sqlglot.expressions.Star": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Parameter": {"tf": 1}, "sqlglot.expressions.SessionParameter": {"tf": 1}, "sqlglot.expressions.Placeholder": {"tf": 1}, "sqlglot.expressions.Null": {"tf": 1}, "sqlglot.expressions.Boolean": {"tf": 1}, "sqlglot.expressions.DataType": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.PseudoType": {"tf": 1}, "sqlglot.expressions.StructKwarg": {"tf": 1}, "sqlglot.expressions.SubqueryPredicate": {"tf": 1}, "sqlglot.expressions.All": {"tf": 1}, "sqlglot.expressions.Any": {"tf": 1}, "sqlglot.expressions.Exists": {"tf": 1}, "sqlglot.expressions.Command": {"tf": 1}, "sqlglot.expressions.Transaction": {"tf": 1}, "sqlglot.expressions.Commit": {"tf": 1}, "sqlglot.expressions.Rollback": {"tf": 1}, "sqlglot.expressions.AlterTable": {"tf": 1}, "sqlglot.expressions.AddConstraint": {"tf": 1}, "sqlglot.expressions.DropPartition": {"tf": 1}, "sqlglot.expressions.Binary": {"tf": 1}, "sqlglot.expressions.Add": {"tf": 1}, "sqlglot.expressions.Connector": {"tf": 1}, "sqlglot.expressions.And": {"tf": 1}, "sqlglot.expressions.Or": {"tf": 1}, "sqlglot.expressions.BitwiseAnd": {"tf": 1}, "sqlglot.expressions.BitwiseLeftShift": {"tf": 1}, "sqlglot.expressions.BitwiseOr": {"tf": 1}, "sqlglot.expressions.BitwiseRightShift": {"tf": 1}, "sqlglot.expressions.BitwiseXor": {"tf": 1}, "sqlglot.expressions.Div": {"tf": 1}, "sqlglot.expressions.Dot": {"tf": 1}, "sqlglot.expressions.DPipe": {"tf": 1}, "sqlglot.expressions.EQ": {"tf": 1}, "sqlglot.expressions.NullSafeEQ": {"tf": 1}, "sqlglot.expressions.NullSafeNEQ": {"tf": 1}, "sqlglot.expressions.Distance": {"tf": 1}, "sqlglot.expressions.Escape": {"tf": 1}, "sqlglot.expressions.Glob": {"tf": 1}, "sqlglot.expressions.GT": {"tf": 1}, "sqlglot.expressions.GTE": {"tf": 1}, "sqlglot.expressions.ILike": {"tf": 1}, "sqlglot.expressions.IntDiv": {"tf": 1}, "sqlglot.expressions.Is": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.Like": {"tf": 1}, "sqlglot.expressions.LT": {"tf": 1}, "sqlglot.expressions.LTE": {"tf": 1}, "sqlglot.expressions.Mod": {"tf": 1}, "sqlglot.expressions.Mul": {"tf": 1}, "sqlglot.expressions.NEQ": {"tf": 1}, "sqlglot.expressions.SimilarTo": {"tf": 1}, "sqlglot.expressions.Slice": {"tf": 1}, "sqlglot.expressions.Sub": {"tf": 1}, "sqlglot.expressions.Unary": {"tf": 1}, "sqlglot.expressions.BitwiseNot": {"tf": 1}, "sqlglot.expressions.Not": {"tf": 1}, "sqlglot.expressions.Paren": {"tf": 1}, "sqlglot.expressions.Neg": {"tf": 1}, "sqlglot.expressions.Alias": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Aliases": {"tf": 1}, "sqlglot.expressions.AtTimeZone": {"tf": 1}, "sqlglot.expressions.Between": {"tf": 1}, "sqlglot.expressions.Bracket": {"tf": 1}, "sqlglot.expressions.Distinct": {"tf": 1}, "sqlglot.expressions.In": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.expressions.Interval": {"tf": 1}, "sqlglot.expressions.IgnoreNulls": {"tf": 1}, "sqlglot.expressions.RespectNulls": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.expressions.AggFunc": {"tf": 1}, "sqlglot.expressions.Abs": {"tf": 1}, "sqlglot.expressions.Anonymous": {"tf": 1}, "sqlglot.expressions.ApproxDistinct": {"tf": 1}, "sqlglot.expressions.Array": {"tf": 1}, "sqlglot.expressions.GenerateSeries": {"tf": 1}, "sqlglot.expressions.ArrayAgg": {"tf": 1}, "sqlglot.expressions.ArrayAll": {"tf": 1}, "sqlglot.expressions.ArrayAny": {"tf": 1}, "sqlglot.expressions.ArrayConcat": {"tf": 1}, "sqlglot.expressions.ArrayContains": {"tf": 1}, "sqlglot.expressions.ArrayFilter": {"tf": 1}, "sqlglot.expressions.ArraySize": {"tf": 1}, "sqlglot.expressions.ArraySort": {"tf": 1}, "sqlglot.expressions.ArraySum": {"tf": 1}, "sqlglot.expressions.ArrayUnionAgg": {"tf": 1}, "sqlglot.expressions.Avg": {"tf": 1}, "sqlglot.expressions.AnyValue": {"tf": 1}, "sqlglot.expressions.Case": {"tf": 1}, "sqlglot.expressions.Cast": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.Collate": {"tf": 1}, "sqlglot.expressions.TryCast": {"tf": 1}, "sqlglot.expressions.Ceil": {"tf": 1}, "sqlglot.expressions.Coalesce": {"tf": 1}, "sqlglot.expressions.Concat": {"tf": 1}, "sqlglot.expressions.ConcatWs": {"tf": 1}, "sqlglot.expressions.Count": {"tf": 1}, "sqlglot.expressions.CurrentDate": {"tf": 1}, "sqlglot.expressions.CurrentDatetime": {"tf": 1}, "sqlglot.expressions.CurrentTime": {"tf": 1}, "sqlglot.expressions.CurrentTimestamp": {"tf": 1}, "sqlglot.expressions.DateAdd": {"tf": 1}, "sqlglot.expressions.DateSub": {"tf": 1}, "sqlglot.expressions.DateDiff": {"tf": 1}, "sqlglot.expressions.DateTrunc": {"tf": 1}, "sqlglot.expressions.DatetimeAdd": {"tf": 1}, "sqlglot.expressions.DatetimeSub": {"tf": 1}, "sqlglot.expressions.DatetimeDiff": {"tf": 1}, "sqlglot.expressions.DatetimeTrunc": {"tf": 1}, "sqlglot.expressions.DayOfWeek": {"tf": 1}, "sqlglot.expressions.DayOfMonth": {"tf": 1}, "sqlglot.expressions.DayOfYear": {"tf": 1}, "sqlglot.expressions.WeekOfYear": {"tf": 1}, "sqlglot.expressions.LastDateOfMonth": {"tf": 1}, "sqlglot.expressions.Extract": {"tf": 1}, "sqlglot.expressions.TimestampAdd": {"tf": 1}, "sqlglot.expressions.TimestampSub": {"tf": 1}, "sqlglot.expressions.TimestampDiff": {"tf": 1}, "sqlglot.expressions.TimestampTrunc": {"tf": 1}, "sqlglot.expressions.TimeAdd": {"tf": 1}, "sqlglot.expressions.TimeSub": {"tf": 1}, "sqlglot.expressions.TimeDiff": {"tf": 1}, "sqlglot.expressions.TimeTrunc": {"tf": 1}, "sqlglot.expressions.DateFromParts": {"tf": 1}, "sqlglot.expressions.DateStrToDate": {"tf": 1}, "sqlglot.expressions.DateToDateStr": {"tf": 1}, "sqlglot.expressions.DateToDi": {"tf": 1}, "sqlglot.expressions.Day": {"tf": 1}, "sqlglot.expressions.Decode": {"tf": 1}, "sqlglot.expressions.DiToDate": {"tf": 1}, "sqlglot.expressions.Encode": {"tf": 1}, "sqlglot.expressions.Exp": {"tf": 1}, "sqlglot.expressions.Explode": {"tf": 1}, "sqlglot.expressions.Floor": {"tf": 1}, "sqlglot.expressions.Greatest": {"tf": 1}, "sqlglot.expressions.GroupConcat": {"tf": 1}, "sqlglot.expressions.Hex": {"tf": 1}, "sqlglot.expressions.If": {"tf": 1}, "sqlglot.expressions.IfNull": {"tf": 1}, "sqlglot.expressions.Initcap": {"tf": 1}, "sqlglot.expressions.JSONBContains": {"tf": 1}, "sqlglot.expressions.JSONExtract": {"tf": 1}, "sqlglot.expressions.JSONExtractScalar": {"tf": 1}, "sqlglot.expressions.JSONBExtract": {"tf": 1}, "sqlglot.expressions.JSONBExtractScalar": {"tf": 1}, "sqlglot.expressions.Least": {"tf": 1}, "sqlglot.expressions.Length": {"tf": 1}, "sqlglot.expressions.Levenshtein": {"tf": 1}, "sqlglot.expressions.Ln": {"tf": 1}, "sqlglot.expressions.Log": {"tf": 1}, "sqlglot.expressions.Log2": {"tf": 1}, "sqlglot.expressions.Log10": {"tf": 1}, "sqlglot.expressions.LogicalOr": {"tf": 1}, "sqlglot.expressions.Lower": {"tf": 1}, "sqlglot.expressions.Map": {"tf": 1}, "sqlglot.expressions.VarMap": {"tf": 1}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.expressions.Max": {"tf": 1}, "sqlglot.expressions.Min": {"tf": 1}, "sqlglot.expressions.Month": {"tf": 1}, "sqlglot.expressions.Nvl2": {"tf": 1}, "sqlglot.expressions.Posexplode": {"tf": 1}, "sqlglot.expressions.Pow": {"tf": 1}, "sqlglot.expressions.PercentileCont": {"tf": 1}, "sqlglot.expressions.PercentileDisc": {"tf": 1}, "sqlglot.expressions.Quantile": {"tf": 1}, "sqlglot.expressions.Quantiles": {"tf": 1}, "sqlglot.expressions.QuantileIf": {"tf": 1}, "sqlglot.expressions.ApproxQuantile": {"tf": 1}, "sqlglot.expressions.ReadCSV": {"tf": 1}, "sqlglot.expressions.Reduce": {"tf": 1}, "sqlglot.expressions.RegexpLike": {"tf": 1}, "sqlglot.expressions.RegexpILike": {"tf": 1}, "sqlglot.expressions.RegexpSplit": {"tf": 1}, "sqlglot.expressions.Repeat": {"tf": 1}, "sqlglot.expressions.Round": {"tf": 1}, "sqlglot.expressions.RowNumber": {"tf": 1}, "sqlglot.expressions.SafeDivide": {"tf": 1}, "sqlglot.expressions.SetAgg": {"tf": 1}, "sqlglot.expressions.SortArray": {"tf": 1}, "sqlglot.expressions.Split": {"tf": 1}, "sqlglot.expressions.Substring": {"tf": 1}, "sqlglot.expressions.StrPosition": {"tf": 1}, "sqlglot.expressions.StrToDate": {"tf": 1}, "sqlglot.expressions.StrToTime": {"tf": 1}, "sqlglot.expressions.StrToUnix": {"tf": 1}, "sqlglot.expressions.NumberToStr": {"tf": 1}, "sqlglot.expressions.Struct": {"tf": 1}, "sqlglot.expressions.StructExtract": {"tf": 1}, "sqlglot.expressions.Sum": {"tf": 1}, "sqlglot.expressions.Sqrt": {"tf": 1}, "sqlglot.expressions.Stddev": {"tf": 1}, "sqlglot.expressions.StddevPop": {"tf": 1}, "sqlglot.expressions.StddevSamp": {"tf": 1}, "sqlglot.expressions.TimeToStr": {"tf": 1}, "sqlglot.expressions.TimeToTimeStr": {"tf": 1}, "sqlglot.expressions.TimeToUnix": {"tf": 1}, "sqlglot.expressions.TimeStrToDate": {"tf": 1}, "sqlglot.expressions.TimeStrToTime": {"tf": 1}, "sqlglot.expressions.TimeStrToUnix": {"tf": 1}, "sqlglot.expressions.Trim": {"tf": 1}, "sqlglot.expressions.TsOrDsAdd": {"tf": 1}, "sqlglot.expressions.TsOrDsToDateStr": {"tf": 1}, "sqlglot.expressions.TsOrDsToDate": {"tf": 1}, "sqlglot.expressions.TsOrDiToDi": {"tf": 1}, "sqlglot.expressions.Unhex": {"tf": 1}, "sqlglot.expressions.UnixToStr": {"tf": 1}, "sqlglot.expressions.UnixToTime": {"tf": 1}, "sqlglot.expressions.UnixToTimeStr": {"tf": 1}, "sqlglot.expressions.Upper": {"tf": 1}, "sqlglot.expressions.Variance": {"tf": 1}, "sqlglot.expressions.VariancePop": {"tf": 1}, "sqlglot.expressions.Week": {"tf": 1}, "sqlglot.expressions.Year": {"tf": 1}, "sqlglot.expressions.Use": {"tf": 1}, "sqlglot.expressions.Merge": {"tf": 1}, "sqlglot.expressions.When": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.expressions.false": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}}, "df": 530}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Explode": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.expand": {"tf": 1}, "sqlglot.optimizer.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}}, "df": 5}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.expressions.Extract": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}}, "df": 7}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.ExecuteError": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.ExecuteAsProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.eval": {"tf": 1}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.env": {"tf": 1}, "sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.executor.env.interval": {"tf": 1}, "sqlglot.executor.python": {"tf": 1}, "sqlglot.executor.python.PythonExecutor": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.executor.python.Python": {"tf": 1}, "sqlglot.executor.python.Python.__init__": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.executor.table": {"tf": 1}, "sqlglot.executor.table.Table": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.append": {"tf": 1}, "sqlglot.executor.table.Table.pop": {"tf": 1}, "sqlglot.executor.table.TableIter": {"tf": 1}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}}, "df": 60}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Exists": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}}, "df": 3}}}}}, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 8}}}}, "d": {"docs": {"sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.Column.endswith": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {"sqlglot.executor.env": {"tf": 1}, "sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.executor.env.interval": {"tf": 1}}, "df": 10}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Encode": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.EncodeColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.EngineProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.errors": {"tf": 1}, "sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.check_errors": {"tf": 1}}, "df": 18}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 5}}}}}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.context.Context.eval": {"tf": 1}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}}, "df": 3}}}, "q": {"docs": {"sqlglot.expressions.EQ": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}}, "df": 4}, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Escape": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}}, "df": 3}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 9}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.ELSE": {"tf": 1}}, "df": 1}}}}, "r": {"docs": {"sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}}, "df": 9}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Repeat": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}}, "df": 11}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Reduce": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}}, "df": 3, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.expressions.RenameTable": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}}, "df": 3}}}}}}}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}}, "df": 2}}}}}}, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Return": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.expressions.ReturnsProperty": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 7}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}}, "df": 2}}}}}, "f": {"docs": {"sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Reference": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.RespectNulls": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parser.Parser.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.expressions.ReadCSV": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.RegexpLike": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.RegexpILike": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.RegexpSplit": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}}, "df": 1}}}}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.tokens.TokenType.ROWS": {"tf": 1}}, "df": 1, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}}, "df": 2}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.RowReader": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}}, "df": 2}}}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.RowFormatDelimitedProperty": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.RowFormatSerdeProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}}, "df": 2}}}}}}}, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.RowNumber": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.expressions.Rollback": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}}, "df": 4}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}}, "df": 4}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Round": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}}, "df": 2, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}}, "df": 2}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.RangeReader": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}}, "df": 2}}}}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 3}}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.RIGHT": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.expressions.Limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}}, "df": 7}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.expressions.Literal": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}}, "df": 8, "s": {"docs": {"sqlglot.optimizer.simplify.simplify_literals": {"tf": 1}}, "df": 1}}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.expressions.Like": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}}, "df": 4, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LikeProperty": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage": {"tf": 1}, "sqlglot.lineage.Node": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}}, "df": 8, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}}, "df": 2}}}}}}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}}, "df": 3, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.LastDateOfMonth": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.Lambda": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}}, "df": 3}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Lateral": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LanguageProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "w": {"docs": {"sqlglot.optimizer.normalize.distributive_law": {"tf": 1}}, "df": 1}, "z": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.LAZY": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}}, "df": 3}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}}, "df": 7, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LocationProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}}, "df": 2}}, "k": {"docs": {"sqlglot.expressions.Lock": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}}, "df": 3}}, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}}, "df": 3, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.expressions.LoadData": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}}, "df": 2}}}}}}, "g": {"1": {"0": {"docs": {"sqlglot.expressions.Log10": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "2": {"docs": {"sqlglot.expressions.Log2": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.expressions.Log": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.LogProperty": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.LogicalOr": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}}, "df": 2}}}}}}, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Lower": {"tf": 1}, "sqlglot.optimizer.lower_identities": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}}, "df": 3}}}}, "t": {"docs": {"sqlglot.expressions.LT": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.expressions.LTE": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Least": {"tf": 1}}, "df": 1}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.LEADING": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Length": {"tf": 1}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Levenshtein": {"tf": 1}}, "df": 1}}}}}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.LEFT": {"tf": 1}}, "df": 1}}}, "n": {"docs": {"sqlglot.expressions.Ln": {"tf": 1}}, "df": 1}, "r": {"docs": {"sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}}, "df": 1}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.expressions.Hint": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}}, "df": 1}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.hive": {"tf": 1}, "sqlglot.dialects.hive.Hive": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1.4142135623730951}}, "df": 9}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}}, "df": 3}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Having": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}}, "df": 4}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.Hex": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.HexString": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}}, "df": 2}}}}}}}, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.helper": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}}, "df": 21}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}}, "df": 2}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}}, "df": 2}}}}}, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.lineage.Node.to_html": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}}, "df": 2}}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.expressions.Merge": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.optimizer.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}}, "df": 8, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.MergeBlockRatioProperty": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}}, "df": 2}}}}}}}}}, "a": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.expressions.Max": {"tf": 1}}, "df": 2}, "p": {"docs": {"sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.Map": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}}, "df": 5, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 7}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.MatchRecognize": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}}, "df": 1}}}}}}}}}}, "y": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}}, "df": 2}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.expressions.Min": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Mod": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}}, "df": 3, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}}, "df": 2}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}}, "df": 2}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Month": {"tf": 1}}, "df": 1}}}}, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.mysql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1.4142135623730951}}, "df": 10}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Mul": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}}, "df": 2, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.optimizer.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.Binary": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}}, "df": 6}}}}, "g": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.bigquery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}}, "df": 14}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}}, "df": 2}}}}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.BitString": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}}, "df": 2}}}}}}, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.BitwiseAnd": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.BitwiseLeftShift": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.BitwiseOr": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}}, "df": 2}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.BitwiseRightShift": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "x": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.BitwiseXor": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}}, "df": 2}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.BitwiseNot": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.expressions.Between": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}}, "df": 5}}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.BEGIN": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.bfs": {"tf": 1}}, "df": 1}}, "y": {"docs": {"sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}}, "df": 12, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.ByteString": {"tf": 1}}, "df": 1}}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.BlockCompressionProperty": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Boolean": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}}, "df": 6}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.BOTH": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}}, "df": 2}}}, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.BUCKET": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Bracket": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}}, "df": 4}}}, "e": {"docs": {"sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.BREAK": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}}, "df": 12, "s": {"docs": {"sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 5}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.National": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}}, "df": 3}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NATURAL": {"tf": 1}}, "df": 1}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.naked_property": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Null": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}}, "df": 9, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.expressions.NullSafeEQ": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.expressions.NullSafeNEQ": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}}, "df": 2}}}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}}, "df": 2}}}}}}, "m": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}}, "df": 4, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.NumberToStr": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {"sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}}, "df": 10, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}, "sqlglot.optimizer.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalized": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}}, "df": 8, "d": {"docs": {"sqlglot.optimizer.normalize.normalized": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 1}}}}}}}}}}}, "t": {"docs": {"sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Not": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}}, "df": 6, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.NotNullColumnConstraint": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage.Node": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 3}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {"sqlglot.expressions.NEQ": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}}, "df": 3}, "g": {"docs": {"sqlglot.expressions.Neg": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}}, "df": 2}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.NEXT": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}}, "df": 2}}}}}}, "l": {"2": {"docs": {"sqlglot.expressions.Nvl2": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.expressions.Var": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 6, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}}, "df": 2}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}}, "df": 2}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Variance": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.VariancePop": {"tf": 1}}, "df": 1}}}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.VarMap": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.expressions.Values": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}}, "df": 6}}}, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 2}}}}}}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.VolatilityProperty": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {"sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.VIEW": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Qualify": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.optimizer.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}}, "df": 8}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Quantile": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.expressions.Quantiles": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.QuantileIf": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.QUOTE": {"tf": 1}}, "df": 1}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.diff.Keep": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}}, "df": 2}}, "y": {"docs": {"sqlglot.executor.env.reverse_key": {"tf": 1}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}}, "df": 4}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}}, "df": 2}}}}}, "x": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}}, "df": 2}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Year": {"tf": 1}}, "df": 1}}}}, "z": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}}, "df": 4}}}}}}, "annotation": {"root": {"docs": {"sqlglot.schema.Schema.supported_table_args": {"tf": 1.4142135623730951}}, "df": 1, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "[": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 1}}}}}}}}}}}, "default_value": {"root": {"1": {"docs": {"sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}}, "df": 1}, "2": {"docs": {"sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}}, "df": 1}, "3": {"docs": {"sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}}, "df": 1}, "4": {"docs": {"sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}}, "df": 1}, "5": {"docs": {"sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}}, "df": 1}, "6": {"docs": {"sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.pretty": {"tf": 1}, "sqlglot.schema": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AND": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CARET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JSON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UUID": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.XML": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ANY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ASC": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CASE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DESC": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DIV": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DROP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.END": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FOR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FROM": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INNER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTO": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MAP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MOD": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OVER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SOME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TOP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.THEN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.USE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.USING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1.4142135623730951}}, "df": 374, "f": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.pretty": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1.4142135623730951}}, "df": 2}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.FARROW": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1.4142135623730951}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FROM": {"tf": 1.4142135623730951}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.FETCH": {"tf": 1.4142135623730951}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.FILTER": {"tf": 1.4142135623730951}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.FINAL": {"tf": 1.4142135623730951}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.FIRST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1.4142135623730951}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "r": {"docs": {"sqlglot.tokens.TokenType.FOR": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1.4142135623730951}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.FORMAT": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.FULL": {"tf": 1.4142135623730951}}, "df": 1}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.FUNCTION": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.L_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1.4142135623730951}}, "df": 3, "t": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 373, "e": {"docs": {"sqlglot.tokens.TokenType.LTE": {"tf": 1.4142135623730951}}, "df": 1}}, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}}, "df": 6}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.LOCAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.4142135623730951}}, "df": 2}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1.4142135623730951}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1.4142135623730951}}, "df": 1}}}, "r": {"docs": {"sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1.4142135623730951}}, "df": 1}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.LATERAL": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "z": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.LAZY": {"tf": 1.4142135623730951}}, "df": 1}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1.4142135623730951}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.LEADING": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.LEFT": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.LIKE": {"tf": 1.4142135623730951}}, "df": 1}}, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.LIMIT": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.schema": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1.4142135623730951}}, "df": 6}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}}, "df": 6}}}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1.4142135623730951}}, "df": 1}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SPACE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.STAR": {"tf": 1.4142135623730951}}, "df": 1, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1.4142135623730951}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1.4142135623730951}}, "df": 2}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1.4142135623730951}}, "df": 4}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1.4142135623730951}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.SUPER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1.4142135623730951}}, "df": 2}}}, "b": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1.4142135623730951}}, "df": 2}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1.4142135623730951}}, "df": 1}}}, "m": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.tokens.TokenType.SEMI": {"tf": 1.4142135623730951}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SET": {"tf": 1.4142135623730951}}, "df": 2, "s": {"docs": {"sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1.4142135623730951}}, "df": 1}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.SEED": {"tf": 1.4142135623730951}}, "df": 1}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.SELECT": {"tf": 1.4142135623730951}}, "df": 1}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.SLASH": {"tf": 1.4142135623730951}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.SHOW": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.SOME": {"tf": 1.4142135623730951}}, "df": 1}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.SORT_BY": {"tf": 1.4142135623730951}}, "df": 1, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.SORTKEY": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.DataType.Type.MAP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MAP": {"tf": 1.4142135623730951}}, "df": 2, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema": {"tf": 1}}, "df": 1}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1.4142135623730951}}, "df": 1}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}}, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1.4142135623730951}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1.4142135623730951}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.MERGE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.MONEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1.4142135623730951}}, "df": 2}}}, "d": {"docs": {"sqlglot.tokens.TokenType.MOD": {"tf": 1.4142135623730951}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1.4142135623730951}}, "df": 3}}}}}, "r": {"docs": {"sqlglot.tokens.TokenType.OR": {"tf": 1.4142135623730951}}, "df": 1, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.ORDERED": {"tf": 1.4142135623730951}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.OUT_OF": {"tf": 1.4142135623730951}}, "df": 1, "f": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.OFFSET": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "n": {"docs": {"sqlglot.tokens.TokenType.ON": {"tf": 1.4142135623730951}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.ONLY": {"tf": 1.4142135623730951}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.OPTIONS": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.OUT_OF": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.OUTER": {"tf": 1.4142135623730951}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.OVER": {"tf": 1.4142135623730951}}, "df": 1, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "g": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 373, "e": {"docs": {"sqlglot.tokens.TokenType.GTE": {"tf": 1.4142135623730951}}, "df": 1}}, "e": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.GENERATED": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.tokens.TokenType.GLOB": {"tf": 1.4142135623730951}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.GLOBAL": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1.4142135623730951}}, "df": 2, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1}}, "df": 20}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.DISTINCT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1.4142135623730951}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "v": {"docs": {"sqlglot.tokens.TokenType.DIV": {"tf": 1.4142135623730951}}, "df": 1}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1.4142135623730951}}, "df": 1, "b": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "e": {"docs": {"sqlglot.expressions.DataType.Type.DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1.4142135623730951}}, "df": 3, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1.4142135623730951}}, "df": 3}}}}}}, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.DASH": {"tf": 1.4142135623730951}}, "df": 1}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.DARROW": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1.4142135623730951}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.DROP": {"tf": 1.4142135623730951}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1.4142135623730951}}, "df": 2}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.DOT": {"tf": 1.4142135623730951}}, "df": 1}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.DOLLAR": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}}, "df": 1}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1.4142135623730951}}, "df": 1, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.DELETE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.tokens.TokenType.DESC": {"tf": 1.4142135623730951}}, "df": 1, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.DCOLON": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.DPIPE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "x": {"2": {"7": {"docs": {"sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AND": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CARET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JSON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UUID": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.XML": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ALL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ANY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ASC": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CASE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DESC": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DIV": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DROP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.END": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FOR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FROM": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INNER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTO": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MAP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.MOD": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OVER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SOME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TOP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.THEN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.USE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.USING": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1.4142135623730951}}, "df": 366}, "docs": {}, "df": 0}, "docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.XML": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.XML": {"tf": 1.4142135623730951}}, "df": 2}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1.4142135623730951}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.BINARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1.4142135623730951}}, "df": 2}}}}, "t": {"docs": {"sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1.4142135623730951}}, "df": 1}}, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.BOTH": {"tf": 1.4142135623730951}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1.4142135623730951}}, "df": 2}}}, "e": {"docs": {"sqlglot.tokens.TokenType.L_BRACE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1.4142135623730951}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.BREAK": {"tf": 1.4142135623730951}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1.4142135623730951}}, "df": 2}}}}, "y": {"docs": {"sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1.4142135623730951}}, "df": 7, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1.4142135623730951}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.BEGIN": {"tf": 1.4142135623730951}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.BETWEEN": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.BUCKET": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1.4142135623730951}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.CROSS": {"tf": 1.4142135623730951}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.CHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1.4142135623730951}}, "df": 2, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.CHECK": {"tf": 1.4142135623730951}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1}}, "df": 1}}, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.COMMA": {"tf": 1.4142135623730951}}, "df": 1, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.COMMAND": {"tf": 1.4142135623730951}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.COMMENT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1.4142135623730951}}, "df": 2}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.COMMIT": {"tf": 1.4142135623730951}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.COMPOUND": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.COLON": {"tf": 1.4142135623730951}}, "df": 1}}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.COLUMN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1.4142135623730951}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.COLLATE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.CARET": {"tf": 1.4142135623730951}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CACHE": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CASCADE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "e": {"docs": {"sqlglot.tokens.TokenType.CASE": {"tf": 1.4142135623730951}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.CUBE": {"tf": 1.4142135623730951}}, "df": 1}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1.4142135623730951}}, "df": 5}}}}}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1.4142135623730951}}, "df": 1}}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.HINT": {"tf": 1.4142135623730951}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.tokens.TokenType.HASH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1.4142135623730951}}, "df": 2}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.HAVING": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1.4142135623730951}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1.4142135623730951}}, "df": 4, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1.4142135623730951}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.PRECEDING": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.L_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1.4142135623730951}}, "df": 2}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.PARAMETER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.PARTITION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.PLUS": {"tf": 1.4142135623730951}}, "df": 1}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.PIPE": {"tf": 1.4142135623730951}}, "df": 1}}, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.PIVOT": {"tf": 1.4142135623730951}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.PERCENT": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "r": {"docs": {"sqlglot.tokens.TokenType.R_PAREN": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1.4142135623730951}}, "df": 3, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.REPLACE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "f": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.REFERENCES": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.RAISE": {"tf": 1.4142135623730951}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.RANGE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1}}, "df": 2}}, "w": {"docs": {"sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROW": {"tf": 1.4142135623730951}}, "df": 2, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}, "s": {"docs": {"sqlglot.tokens.TokenType.ROWS": {"tf": 1.4142135623730951}}, "df": 1}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1.4142135623730951}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.ROLLUP": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.RIGHT": {"tf": 1.4142135623730951}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.RLIKE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1.4142135623730951}}, "df": 3, "a": {"docs": {}, "df": 0, "u": {"docs": {"sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1.4142135623730951}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.TRAILING": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.TRUE": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1.4142135623730951}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.TEXT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1.4142135623730951}}, "df": 2}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.CHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1.4142135623730951}}, "df": 52}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1.4142135623730951}}, "df": 7, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1.4142135623730951}}, "df": 3, "t": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1.4142135623730951}}, "df": 2}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.tokens.TokenType.TILDA": {"tf": 1.4142135623730951}}, "df": 1}}}}, "o": {"docs": {"sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1.4142135623730951}}, "df": 1, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.L_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1}, "sqlglot.tokens.TokenType.DOT": {"tf": 1}, "sqlglot.tokens.TokenType.DASH": {"tf": 1}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1}, "sqlglot.tokens.TokenType.COLON": {"tf": 1}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1}, "sqlglot.tokens.TokenType.STAR": {"tf": 1}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1}, "sqlglot.tokens.TokenType.LT": {"tf": 1}, "sqlglot.tokens.TokenType.LTE": {"tf": 1}, "sqlglot.tokens.TokenType.GT": {"tf": 1}, "sqlglot.tokens.TokenType.GTE": {"tf": 1}, "sqlglot.tokens.TokenType.NOT": {"tf": 1}, "sqlglot.tokens.TokenType.EQ": {"tf": 1}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1}, "sqlglot.tokens.TokenType.AND": {"tf": 1}, "sqlglot.tokens.TokenType.OR": {"tf": 1}, "sqlglot.tokens.TokenType.AMP": {"tf": 1}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1}, "sqlglot.tokens.TokenType.CARET": {"tf": 1}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1}, "sqlglot.tokens.TokenType.HASH": {"tf": 1}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1}, "sqlglot.tokens.TokenType.STRING": {"tf": 1}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1}, "sqlglot.tokens.TokenType.VAR": {"tf": 1}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1}, "sqlglot.tokens.TokenType.INT": {"tf": 1}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1}, "sqlglot.tokens.TokenType.JSON": {"tf": 1}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1}, "sqlglot.tokens.TokenType.TIME": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.DATE": {"tf": 1}, "sqlglot.tokens.TokenType.UUID": {"tf": 1}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1}, "sqlglot.tokens.TokenType.XML": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1}, "sqlglot.tokens.TokenType.ALL": {"tf": 1}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1}, "sqlglot.tokens.TokenType.ANY": {"tf": 1}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1}, "sqlglot.tokens.TokenType.ASC": {"tf": 1}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1}, "sqlglot.tokens.TokenType.CASE": {"tf": 1}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1}, "sqlglot.tokens.TokenType.DESC": {"tf": 1}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1}, "sqlglot.tokens.TokenType.DIV": {"tf": 1}, "sqlglot.tokens.TokenType.DROP": {"tf": 1}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1}, "sqlglot.tokens.TokenType.END": {"tf": 1}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1}, "sqlglot.tokens.TokenType.FOR": {"tf": 1}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1}, "sqlglot.tokens.TokenType.FROM": {"tf": 1}, "sqlglot.tokens.TokenType.FULL": {"tf": 1}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1}, "sqlglot.tokens.TokenType.HINT": {"tf": 1}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1}, "sqlglot.tokens.TokenType.IF": {"tf": 1}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IN": {"tf": 1}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1}, "sqlglot.tokens.TokenType.INNER": {"tf": 1}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1}, "sqlglot.tokens.TokenType.INTO": {"tf": 1}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.IS": {"tf": 1}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1}, "sqlglot.tokens.TokenType.MAP": {"tf": 1}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1}, "sqlglot.tokens.TokenType.MOD": {"tf": 1}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULL": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1}, "sqlglot.tokens.TokenType.ON": {"tf": 1}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1}, "sqlglot.tokens.TokenType.OVER": {"tf": 1}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1}, "sqlglot.tokens.TokenType.ROW": {"tf": 1}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1}, "sqlglot.tokens.TokenType.SEED": {"tf": 1}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1}, "sqlglot.tokens.TokenType.SET": {"tf": 1}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1}, "sqlglot.tokens.TokenType.SOME": {"tf": 1}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1}, "sqlglot.tokens.TokenType.TOP": {"tf": 1}, "sqlglot.tokens.TokenType.THEN": {"tf": 1}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1}, "sqlglot.tokens.TokenType.USE": {"tf": 1}, "sqlglot.tokens.TokenType.USING": {"tf": 1}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1}, "sqlglot.tokens.TokenType.WITH": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1}}, "df": 285}}}}}}}, "p": {"docs": {"sqlglot.tokens.TokenType.TOP": {"tf": 1.4142135623730951}}, "df": 1}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.THEN": {"tf": 1.4142135623730951}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 4}}}}}}}}}, "q": {"docs": {"sqlglot.tokens.TokenType.EQ": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1.4142135623730951}}, "df": 2}, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.END": {"tf": 1.4142135623730951}}, "df": 2}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.ENCODE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.ELSE": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.ESCAPE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "x": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.EXCEPT": {"tf": 1.4142135623730951}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.EXECUTE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.EXISTS": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1.4142135623730951}}, "df": 2}}}}, "n": {"docs": {"sqlglot.tokens.TokenType.IN": {"tf": 1.4142135623730951}}, "df": 1, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1.4142135623730951}}, "df": 2}}}, "t": {"docs": {"sqlglot.expressions.DataType.Type.INT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INT": {"tf": 1.4142135623730951}}, "df": 2, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1.4142135623730951}}, "df": 2}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.INTERSECT": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "o": {"docs": {"sqlglot.tokens.TokenType.INTO": {"tf": 1.4142135623730951}}, "df": 1}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.INNER": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.INSERT": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1.4142135623730951}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.IDENTITY": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "f": {"docs": {"sqlglot.tokens.TokenType.IF": {"tf": 1.4142135623730951}}, "df": 1}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.ILIKE": {"tf": 1.4142135623730951}}, "df": 1}}}}, "r": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.IRLIKE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.tokens.TokenType.IS": {"tf": 1.4142135623730951}}, "df": 1, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.ISNULL": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.errors.ErrorLevel.WARN": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.4142135623730951}}, "df": 4, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1.4142135623730951}}, "df": 1}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.WINDOW": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.WHEN": {"tf": 1.4142135623730951}}, "df": 1}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.WHERE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.UNIQUE": {"tf": 1.4142135623730951}}, "df": 1, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1}, "sqlglot.tokens.TokenType.UNION": {"tf": 1.4142135623730951}}, "df": 2}}}, "k": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.UNCACHE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.UNNEST": {"tf": 1.4142135623730951}}, "df": 1}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.DataType.Type.UUID": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.UUID": {"tf": 1.4142135623730951}}, "df": 2}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.UPDATE": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.USE": {"tf": 1.4142135623730951}}, "df": 1}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.tokens.TokenType.USING": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1.4142135623730951}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.DataType.Type.NULL": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULL": {"tf": 1.4142135623730951}}, "df": 2, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1.4142135623730951}}, "df": 2}}}}, "s": {"docs": {"sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1.4142135623730951}}, "df": 4, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.NUMBER": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "o": {"docs": {"sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1.4142135623730951}}, "df": 1, "t": {"docs": {"sqlglot.tokens.TokenType.NOT": {"tf": 1.4142135623730951}}, "df": 1, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NOTNULL": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.tokens.TokenType.NEQ": {"tf": 1.4142135623730951}}, "df": 1}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.tokens.TokenType.NEXT": {"tf": 1.4142135623730951}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NATIONAL": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.tokens.TokenType.NATURAL": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.VAR": {"tf": 1.4142135623730951}}, "df": 1, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1.4142135623730951}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.VALUES": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.VIEW": {"tf": 1.4142135623730951}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.VOLATILE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "j": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.DataType.Type.JSON": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JSON": {"tf": 1.4142135623730951}}, "df": 2, "b": {"docs": {"sqlglot.expressions.DataType.Type.JSONB": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1.4142135623730951}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.JOIN": {"tf": 1.4142135623730951}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1.4142135623730951}}, "df": 2}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.tokens.TokenType.ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1.4142135623730951}}, "df": 4}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.tokens.TokenType.AND": {"tf": 1.4142135623730951}}, "df": 1}, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.tokens.TokenType.ANTI": {"tf": 1.4142135623730951}}, "df": 1}}, "y": {"docs": {"sqlglot.tokens.TokenType.ANY": {"tf": 1.4142135623730951}}, "df": 1}}, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.tokens.TokenType.AMP": {"tf": 1.4142135623730951}}, "df": 1}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.ALIAS": {"tf": 1.4142135623730951}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.tokens.TokenType.ALTER": {"tf": 1.4142135623730951}}, "df": 1}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.tokens.TokenType.ALWAYS": {"tf": 1.4142135623730951}}, "df": 1}}}}, "l": {"docs": {"sqlglot.tokens.TokenType.ALL": {"tf": 1.4142135623730951}}, "df": 1}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.APPLY": {"tf": 1.4142135623730951}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.tokens.TokenType.ASC": {"tf": 1.4142135623730951}}, "df": 1}, "o": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.tokens.TokenType.ASOF": {"tf": 1.4142135623730951}}, "df": 1}}}, "t": {"docs": {"sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1.4142135623730951}}, "df": 1}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1.4142135623730951}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "z": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1.4142135623730951}}, "df": 4}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1.4142135623730951}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1.4142135623730951}}, "df": 2}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.tokens.TokenType.QUALIFY": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.tokens.TokenType.QUOTE": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "signature": {"root": {"0": {"docs": {"sqlglot.diff.ChangeDistiller.__init__": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}}, "df": 5, "x": {"7": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"7": {"5": {"docs": {}, "df": 0, "a": {"9": {"8": {"9": {"4": {"8": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0, "d": {"8": {"1": {"docs": {}, "df": 0, "f": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}, "5": {"docs": {}, "df": 0, "e": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}, "8": {"2": {"0": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0, "c": {"1": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "9": {"2": {"4": {"0": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"0": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "b": {"0": {"1": {"6": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "5": {"docs": {}, "df": 0, "e": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}, "7": {"0": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"2": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "2": {"8": {"3": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0, "b": {"9": {"0": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "f": {"8": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "e": {"6": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "d": {"docs": {}, "df": 0, "d": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}}, "3": {"5": {"docs": {}, "df": 0, "b": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}, "docs": {}, "df": 0, "d": {"0": {"0": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}, "docs": {}, "df": 0}}, "1": {"0": {"0": {"docs": {"sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "2": {"8": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "4": {"0": {"7": {"0": {"0": {"3": {"2": {"9": {"2": {"4": {"0": {"3": {"8": {"4": {"docs": {"sqlglot.dataframe.sql.Column.between": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "3": {"1": {"4": {"4": {"8": {"0": {"docs": {"sqlglot.dataframe.sql.Column.over": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "6": {"2": {"6": {"5": {"9": {"2": {"docs": {"sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "5": {"4": {"4": {"0": {"0": {"docs": {"sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"5": {"4": {"4": {"0": {"docs": {"sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"2": {"8": {"7": {"6": {"8": {"docs": {"sqlglot.dataframe.sql.Window.orderBy": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "3": {"0": {"6": {"1": {"1": {"6": {"9": {"6": {"docs": {"sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"4": {"0": {"7": {"3": {"6": {"docs": {"sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"2": {"4": {"0": {"9": {"6": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "6": {"4": {"1": {"1": {"2": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "1": {"0": {"2": {"9": {"6": {"4": {"8": {"docs": {"sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"3": {"1": {"3": {"6": {"docs": {"sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"3": {"2": {"1": {"6": {"docs": {"sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "2": {"1": {"3": {"1": {"0": {"4": {"docs": {"sqlglot.dataframe.sql.Column.isin": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"9": {"4": {"4": {"0": {"docs": {"sqlglot.dataframe.sql.Column.between": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"0": {"4": {"9": {"9": {"2": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"9": {"0": {"2": {"0": {"8": {"docs": {"sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "2": {"1": {"3": {"6": {"0": {"3": {"2": {"docs": {"sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "2": {"4": {"5": {"2": {"4": {"8": {"docs": {"sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "5": {"9": {"6": {"9": {"6": {"docs": {"sqlglot.dataframe.sql.Column.__init__": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"5": {"7": {"0": {"5": {"6": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "8": {"1": {"5": {"0": {"4": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "3": {"8": {"6": {"7": {"3": {"1": {"2": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"8": {"3": {"3": {"6": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1.4142135623730951}}, "df": 3}, "2": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}}, "df": 1}, "3": {"9": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 2}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.isin": {"tf": 2}, "sqlglot.dataframe.sql.Column.between": {"tf": 2}, "sqlglot.dataframe.sql.Column.over": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 2}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 2}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 2}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 2}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.__init__": {"tf": 2}, "sqlglot.generator.Generator.sep": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.seg": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.properties": {"tf": 2.449489742783178}, "sqlglot.generator.Generator.table_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.expressions": {"tf": 2}, "sqlglot.helper.csv": {"tf": 1.4142135623730951}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}}, "df": 35}, "docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 2}, "6": {"docs": {"sqlglot.diff.ChangeDistiller.__init__": {"tf": 1.4142135623730951}}, "df": 1}, "8": {"0": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot.parse": {"tf": 10.099504938362077}, "sqlglot.parse_one": {"tf": 12.727922061357855}, "sqlglot.transpile": {"tf": 14}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 2}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 6}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 12.806248474865697}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 6}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 14.2828568570857}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 6.4031242374328485}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 5.830951894845301}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 6.324555320336759}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 6.48074069840786}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 8.426149773176359}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 8.426149773176359}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 6.324555320336759}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 6.324555320336759}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 12.041594578792296}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 9.9498743710662}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 9.9498743710662}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 7.3484692283495345}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 7.3484692283495345}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 7.14142842854285}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 7.3484692283495345}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 7.3484692283495345}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 7.3484692283495345}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 5.656854249492381}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 10.677078252031311}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 10}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 13.19090595827292}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 7.937253933193772}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 5.0990195135927845}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 8.12403840463596}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 6}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 8}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 9.327379053088816}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 6}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 6.782329983125268}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 9.16515138991168}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 8.602325267042627}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 6.164414002968976}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 6.164414002968976}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 6.164414002968976}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 6.164414002968976}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 6.164414002968976}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 6.164414002968976}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 7.0710678118654755}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 7.54983443527075}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 8.831760866327848}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 9.797958971132712}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 8.54400374531753}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 8.246211251235321}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 8.246211251235321}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 6.48074069840786}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 5.656854249492381}, "sqlglot.dataframe.sql.Column.copy": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 6.6332495807108}, "sqlglot.dataframe.sql.Column.sql": {"tf": 4.242640687119285}, "sqlglot.dataframe.sql.Column.alias": {"tf": 6}, "sqlglot.dataframe.sql.Column.asc": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.desc": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.when": {"tf": 7.937253933193772}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 6}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.Column.cast": {"tf": 6.6332495807108}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 8}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 8}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 6}, "sqlglot.dataframe.sql.Column.like": {"tf": 4.242640687119285}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 4.242640687119285}, "sqlglot.dataframe.sql.Column.substr": {"tf": 9.9498743710662}, "sqlglot.dataframe.sql.Column.isin": {"tf": 7.937253933193772}, "sqlglot.dataframe.sql.Column.between": {"tf": 8.660254037844387}, "sqlglot.dataframe.sql.Column.over": {"tf": 7.211102550927978}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 10.677078252031311}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 10.908712114635714}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 12.083045973594572}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 2}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 9}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 9}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 6.6332495807108}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 6.6332495807108}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 5.744562646538029}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 3.1622776601683795}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 4.242640687119285}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 9}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 9}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 6.6332495807108}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 6.6332495807108}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 5.291502622129181}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 6}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 10}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 5.830951894845301}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 4.795831523312719}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 6.557438524302}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 7.615773105863909}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 7.745966692414834}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 4.47213595499958}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 4.47213595499958}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 4.47213595499958}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 5.291502622129181}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 5.291502622129181}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 5.291502622129181}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 2}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 2}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 9.273618495495704}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 7.615773105863909}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 10.099504938362077}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 5.5677643628300215}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 5.0990195135927845}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 5.0990195135927845}, "sqlglot.dialects.dialect.rename_func": {"tf": 6.928203230275509}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.if_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 7.416198487095663}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 7.416198487095663}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 8.48528137423857}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 8.660254037844387}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 8}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 4.898979485566356}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.dialect.trim_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.drill.if_sql": {"tf": 6.48074069840786}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 2}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 4.47213595499958}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 2}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 2}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 3.7416573867739413}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 4.47213595499958}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 2}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 2}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 5.291502622129181}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 3.7416573867739413}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 3.7416573867739413}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 5.477225575051661}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 2}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 3.7416573867739413}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 5.291502622129181}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 5.291502622129181}, "sqlglot.diff.Insert.__init__": {"tf": 4.47213595499958}, "sqlglot.diff.Remove.__init__": {"tf": 4.47213595499958}, "sqlglot.diff.Move.__init__": {"tf": 4.47213595499958}, "sqlglot.diff.Update.__init__": {"tf": 6.164414002968976}, "sqlglot.diff.Keep.__init__": {"tf": 6.164414002968976}, "sqlglot.diff.diff": {"tf": 10.488088481701515}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 5.656854249492381}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 10.723805294763608}, "sqlglot.errors.ParseError.__init__": {"tf": 6.48074069840786}, "sqlglot.errors.ParseError.new": {"tf": 13.038404810405298}, "sqlglot.errors.concat_messages": {"tf": 5.385164807134504}, "sqlglot.errors.merge_errors": {"tf": 6.48074069840786}, "sqlglot.executor.execute": {"tf": 12.727922061357855}, "sqlglot.executor.context.Context.__init__": {"tf": 7.416198487095663}, "sqlglot.executor.context.Context.eval": {"tf": 3.7416573867739413}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 3.7416573867739413}, "sqlglot.executor.context.Context.add_columns": {"tf": 4.69041575982343}, "sqlglot.executor.context.Context.table_iter": {"tf": 7.681145747868608}, "sqlglot.executor.context.Context.filter": {"tf": 4}, "sqlglot.executor.context.Context.sort": {"tf": 4}, "sqlglot.executor.context.Context.set_row": {"tf": 4.47213595499958}, "sqlglot.executor.context.Context.set_index": {"tf": 4.47213595499958}, "sqlglot.executor.context.Context.set_range": {"tf": 5.291502622129181}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 2.8284271247461903}, "sqlglot.executor.env.filter_nulls": {"tf": 4.242640687119285}, "sqlglot.executor.env.null_if_any": {"tf": 3.4641016151377544}, "sqlglot.executor.env.str_position": {"tf": 4.69041575982343}, "sqlglot.executor.env.substring": {"tf": 5.0990195135927845}, "sqlglot.executor.env.cast": {"tf": 3.7416573867739413}, "sqlglot.executor.env.ordered": {"tf": 4.242640687119285}, "sqlglot.executor.env.interval": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 4.47213595499958}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 4.242640687119285}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 3.1622776601683795}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 3.7416573867739413}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 4.242640687119285}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 4.795831523312719}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 4.69041575982343}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 4.242640687119285}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 4.242640687119285}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 4.242640687119285}, "sqlglot.executor.python.Python.__init__": {"tf": 2}, "sqlglot.executor.table.Table.__init__": {"tf": 4.898979485566356}, "sqlglot.executor.table.Table.add_columns": {"tf": 4.69041575982343}, "sqlglot.executor.table.Table.append": {"tf": 3.7416573867739413}, "sqlglot.executor.table.Table.pop": {"tf": 3.1622776601683795}, "sqlglot.executor.table.TableIter.__init__": {"tf": 2.8284271247461903}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 2.8284271247461903}, "sqlglot.executor.table.RowReader.__init__": {"tf": 4}, "sqlglot.executor.table.ensure_tables": {"tf": 5.744562646538029}, "sqlglot.expressions.Expression.__init__": {"tf": 3.7416573867739413}, "sqlglot.expressions.Expression.text": {"tf": 3.7416573867739413}, "sqlglot.expressions.Expression.copy": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.append": {"tf": 4.242640687119285}, "sqlglot.expressions.Expression.set": {"tf": 4.242640687119285}, "sqlglot.expressions.Expression.find": {"tf": 4.898979485566356}, "sqlglot.expressions.Expression.find_all": {"tf": 4.898979485566356}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 4}, "sqlglot.expressions.Expression.walk": {"tf": 5.0990195135927845}, "sqlglot.expressions.Expression.dfs": {"tf": 5.830951894845301}, "sqlglot.expressions.Expression.bfs": {"tf": 4.242640687119285}, "sqlglot.expressions.Expression.unnest": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.unalias": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.flatten": {"tf": 4.242640687119285}, "sqlglot.expressions.Expression.sql": {"tf": 9.055385138137417}, "sqlglot.expressions.Expression.transform": {"tf": 5.830951894845301}, "sqlglot.expressions.Expression.replace": {"tf": 3.7416573867739413}, "sqlglot.expressions.Expression.pop": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.assert_is": {"tf": 3.872983346207417}, "sqlglot.expressions.Expression.error_messages": {"tf": 6}, "sqlglot.expressions.Expression.dump": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.load": {"tf": 3.7416573867739413}, "sqlglot.expressions.Condition.and_": {"tf": 5.477225575051661}, "sqlglot.expressions.Condition.or_": {"tf": 5.477225575051661}, "sqlglot.expressions.Condition.not_": {"tf": 3.1622776601683795}, "sqlglot.expressions.Unionable.union": {"tf": 6}, "sqlglot.expressions.Unionable.intersect": {"tf": 6}, "sqlglot.expressions.Unionable.except_": {"tf": 6}, "sqlglot.expressions.Literal.number": {"tf": 4.898979485566356}, "sqlglot.expressions.Literal.string": {"tf": 4.898979485566356}, "sqlglot.expressions.Join.on": {"tf": 6.782329983125268}, "sqlglot.expressions.Join.using": {"tf": 6.782329983125268}, "sqlglot.expressions.Properties.from_dict": {"tf": 4.898979485566356}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 6}, "sqlglot.expressions.Subqueryable.limit": {"tf": 7.14142842854285}, "sqlglot.expressions.Subqueryable.with_": {"tf": 8.06225774829855}, "sqlglot.expressions.Union.limit": {"tf": 7.14142842854285}, "sqlglot.expressions.Select.from_": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.group_by": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.order_by": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.sort_by": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.cluster_by": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.limit": {"tf": 7.14142842854285}, "sqlglot.expressions.Select.offset": {"tf": 7.14142842854285}, "sqlglot.expressions.Select.select": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.lateral": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.join": {"tf": 9.797958971132712}, "sqlglot.expressions.Select.where": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.having": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.window": {"tf": 7.874007874011811}, "sqlglot.expressions.Select.distinct": {"tf": 6}, "sqlglot.expressions.Select.ctas": {"tf": 7.745966692414834}, "sqlglot.expressions.Select.lock": {"tf": 7.14142842854285}, "sqlglot.expressions.Subquery.unnest": {"tf": 3.1622776601683795}, "sqlglot.expressions.DataType.build": {"tf": 11.357816691600547}, "sqlglot.expressions.DataType.is_type": {"tf": 5.656854249492381}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 3.1622776601683795}, "sqlglot.expressions.Func.from_arg_list": {"tf": 3.7416573867739413}, "sqlglot.expressions.Func.sql_names": {"tf": 3.1622776601683795}, "sqlglot.expressions.Func.sql_name": {"tf": 3.1622776601683795}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 3.1622776601683795}, "sqlglot.expressions.Cast.is_type": {"tf": 5.656854249492381}, "sqlglot.expressions.maybe_parse": {"tf": 14.177446878757825}, "sqlglot.expressions.union": {"tf": 6}, "sqlglot.expressions.intersect": {"tf": 6}, "sqlglot.expressions.except_": {"tf": 6}, "sqlglot.expressions.select": {"tf": 6}, "sqlglot.expressions.from_": {"tf": 6}, "sqlglot.expressions.update": {"tf": 7.810249675906654}, "sqlglot.expressions.delete": {"tf": 6.48074069840786}, "sqlglot.expressions.condition": {"tf": 5.830951894845301}, "sqlglot.expressions.and_": {"tf": 6}, "sqlglot.expressions.or_": {"tf": 6}, "sqlglot.expressions.not_": {"tf": 5.830951894845301}, "sqlglot.expressions.paren": {"tf": 4.47213595499958}, "sqlglot.expressions.to_identifier": {"tf": 4.242640687119285}, "sqlglot.expressions.to_interval": {"tf": 6.164414002968976}, "sqlglot.expressions.to_table": {"tf": 7.745966692414834}, "sqlglot.expressions.to_column": {"tf": 6.708203932499369}, "sqlglot.expressions.alias_": {"tf": 13.416407864998739}, "sqlglot.expressions.subquery": {"tf": 5.656854249492381}, "sqlglot.expressions.column": {"tf": 6}, "sqlglot.expressions.cast": {"tf": 9.16515138991168}, "sqlglot.expressions.table_": {"tf": 7.54983443527075}, "sqlglot.expressions.values": {"tf": 10.44030650891055}, "sqlglot.expressions.rename_table": {"tf": 7.745966692414834}, "sqlglot.expressions.convert": {"tf": 4.47213595499958}, "sqlglot.expressions.replace_children": {"tf": 3.7416573867739413}, "sqlglot.expressions.column_table_names": {"tf": 3.1622776601683795}, "sqlglot.expressions.table_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.replace_tables": {"tf": 3.7416573867739413}, "sqlglot.expressions.replace_placeholders": {"tf": 4.69041575982343}, "sqlglot.expressions.expand": {"tf": 8.306623862918075}, "sqlglot.expressions.func": {"tf": 10.04987562112089}, "sqlglot.expressions.true": {"tf": 2.6457513110645907}, "sqlglot.expressions.false": {"tf": 2.6457513110645907}, "sqlglot.expressions.null": {"tf": 2.6457513110645907}, "sqlglot.generator.Generator.__init__": {"tf": 15.033296378372908}, "sqlglot.generator.Generator.generate": {"tf": 5.744562646538029}, "sqlglot.generator.Generator.unsupported": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.sep": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.seg": {"tf": 6}, "sqlglot.generator.Generator.pad_comment": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.maybe_comment": {"tf": 6}, "sqlglot.generator.Generator.wrap": {"tf": 5.744562646538029}, "sqlglot.generator.Generator.no_identify": {"tf": 6.6332495807108}, "sqlglot.generator.Generator.normalize_func": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.indent": {"tf": 9.327379053088816}, "sqlglot.generator.Generator.sql": {"tf": 8.94427190999916}, "sqlglot.generator.Generator.uncache_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.cache_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.characterset_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.column_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.columndef_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 4.242640687119285}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 5.477225575051661}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 4.242640687119285}, "sqlglot.generator.Generator.create_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.describe_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 6}, "sqlglot.generator.Generator.with_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.cte_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.datatype_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.directory_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.delete_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.drop_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.except_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.except_op": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.fetch_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.filter_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.hint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.index_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.identifier_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.national_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.partition_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.properties_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.root_properties": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.properties": {"tf": 9.797958971132712}, "sqlglot.generator.Generator.with_properties": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.locate_properties": {"tf": 7.937253933193772}, "sqlglot.generator.Generator.property_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.insert_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.intersect_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.intersect_op": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.introducer_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.table_sql": {"tf": 6.6332495807108}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.pivot_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.tuple_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.update_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.values_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.var_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.into_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.from_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.group_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.having_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.join_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.lambda_sql": {"tf": 6.855654600401044}, "sqlglot.generator.Generator.lateral_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.limit_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.offset_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.lock_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.literal_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.null_sql": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.boolean_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.order_sql": {"tf": 6.48074069840786}, "sqlglot.generator.Generator.cluster_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.distribute_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.sort_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.ordered_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.query_modifiers": {"tf": 6.164414002968976}, "sqlglot.generator.Generator.select_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.schema_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.star_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.parameter_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.subquery_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.qualify_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.union_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.union_op": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.unnest_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.where_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.window_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 6.557438524302}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.between_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bracket_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.all_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.any_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.exists_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.case_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.constraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.extract_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.trim_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.concat_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.check_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.unique_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.if_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.in_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.interval_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.return_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.reference_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.paren_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.neg_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.not_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.alias_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.aliases_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.add_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.and_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.connector_sql": {"tf": 6}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.cast_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.collate_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.command_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.transaction_sql": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.commit_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.rollback_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.renametable_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.altertable_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.distinct_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.div_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.distance_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.dot_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.eq_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.escape_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.glob_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.gt_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.gte_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.ilike_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.is_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.like_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.similarto_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.lt_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.lte_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.mod_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.mul_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.neq_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.or_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.slice_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.sub_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.trycast_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.use_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.binary": {"tf": 6}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.format_args": {"tf": 6.708203932499369}, "sqlglot.generator.Generator.text_width": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.format_time": {"tf": 5.744562646538029}, "sqlglot.generator.Generator.expressions": {"tf": 10.677078252031311}, "sqlglot.generator.Generator.op_expressions": {"tf": 7.3484692283495345}, "sqlglot.generator.Generator.naked_property": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.set_operation": {"tf": 6}, "sqlglot.generator.Generator.tag_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.token_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.when_sql": {"tf": 5.291502622129181}, "sqlglot.generator.Generator.merge_sql": {"tf": 5.291502622129181}, "sqlglot.helper.seq_get": {"tf": 6.164414002968976}, "sqlglot.helper.ensure_list": {"tf": 3.1622776601683795}, "sqlglot.helper.ensure_collection": {"tf": 3.1622776601683795}, "sqlglot.helper.csv": {"tf": 5.477225575051661}, "sqlglot.helper.subclasses": {"tf": 9.38083151964686}, "sqlglot.helper.apply_index_offset": {"tf": 6.6332495807108}, "sqlglot.helper.camel_to_snake_case": {"tf": 4}, "sqlglot.helper.while_changing": {"tf": 8}, "sqlglot.helper.tsort": {"tf": 6.324555320336759}, "sqlglot.helper.open_file": {"tf": 3.872983346207417}, "sqlglot.helper.csv_reader": {"tf": 4.898979485566356}, "sqlglot.helper.find_new_name": {"tf": 5.385164807134504}, "sqlglot.helper.object_to_dict": {"tf": 4.69041575982343}, "sqlglot.helper.split_num_words": {"tf": 7.615773105863909}, "sqlglot.helper.is_iterable": {"tf": 4}, "sqlglot.helper.flatten": {"tf": 6.082762530298219}, "sqlglot.helper.count_params": {"tf": 4}, "sqlglot.helper.dict_depth": {"tf": 4}, "sqlglot.helper.first": {"tf": 5}, "sqlglot.lineage.Node.__init__": {"tf": 9}, "sqlglot.lineage.Node.walk": {"tf": 5}, "sqlglot.lineage.Node.to_html": {"tf": 5.0990195135927845}, "sqlglot.lineage.lineage": {"tf": 16.522711641858304}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 10.44030650891055}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 5.830951894845301}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 5.291502622129181}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 3.7416573867739413}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 5.744562646538029}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 5.656854249492381}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 5.656854249492381}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 5.744562646538029}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 3.1622776601683795}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 3.1622776601683795}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 3.1622776601683795}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3.1622776601683795}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 5.744562646538029}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 3.1622776601683795}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 4.242640687119285}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 3.1622776601683795}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 4.242640687119285}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 4.242640687119285}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 4.242640687119285}, "sqlglot.optimizer.normalize.normalize": {"tf": 5.0990195135927845}, "sqlglot.optimizer.normalize.normalized": {"tf": 4.242640687119285}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 4.242640687119285}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 4.242640687119285}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 3.1622776601683795}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 3.1622776601683795}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 3.1622776601683795}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 3.7416573867739413}, "sqlglot.optimizer.optimizer.optimize": {"tf": 19}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 3.1622776601683795}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 4.242640687119285}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 4.242640687119285}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 4.242640687119285}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 4.242640687119285}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 3.7416573867739413}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 2.6457513110645907}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 3.1622776601683795}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 3.7416573867739413}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 3.1622776601683795}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 5.830951894845301}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 7.483314773547883}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 5.656854249492381}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 4.242640687119285}, "sqlglot.optimizer.scope.Scope.find": {"tf": 4.898979485566356}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 4.898979485566356}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 4.242640687119285}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 3.7416573867739413}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 4.242640687119285}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 4.242640687119285}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 3.7416573867739413}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.build_scope": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 4.242640687119285}, "sqlglot.optimizer.simplify.simplify": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 5.744562646538029}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.flatten": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.always_true": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.is_complement": {"tf": 3.7416573867739413}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 4.242640687119285}, "sqlglot.optimizer.simplify.extract_date": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.date_literal": {"tf": 3.1622776601683795}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 3.1622776601683795}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 3.1622776601683795}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 4.242640687119285}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 4.69041575982343}, "sqlglot.parser.parse_var_map": {"tf": 3.1622776601683795}, "sqlglot.parser.Parser.__init__": {"tf": 11.269427669584644}, "sqlglot.parser.Parser.reset": {"tf": 3.1622776601683795}, "sqlglot.parser.Parser.parse": {"tf": 8.426149773176359}, "sqlglot.parser.Parser.parse_into": {"tf": 11.313708498984761}, "sqlglot.parser.Parser.check_errors": {"tf": 3.4641016151377544}, "sqlglot.parser.Parser.raise_error": {"tf": 6.855654600401044}, "sqlglot.parser.Parser.expression": {"tf": 8.54400374531753}, "sqlglot.parser.Parser.validate_expression": {"tf": 7.0710678118654755}, "sqlglot.planner.Plan.__init__": {"tf": 4.47213595499958}, "sqlglot.planner.Step.__init__": {"tf": 2}, "sqlglot.planner.Step.from_expression": {"tf": 8.602325267042627}, "sqlglot.planner.Step.add_dependency": {"tf": 5.291502622129181}, "sqlglot.planner.Step.to_s": {"tf": 5.0990195135927845}, "sqlglot.planner.Scan.__init__": {"tf": 2}, "sqlglot.planner.Scan.from_expression": {"tf": 8.602325267042627}, "sqlglot.planner.Join.__init__": {"tf": 2}, "sqlglot.planner.Join.from_joins": {"tf": 8.888194417315589}, "sqlglot.planner.Aggregate.__init__": {"tf": 2}, "sqlglot.planner.Sort.__init__": {"tf": 2}, "sqlglot.planner.SetOperation.__init__": {"tf": 8.306623862918075}, "sqlglot.planner.SetOperation.from_expression": {"tf": 8.602325267042627}, "sqlglot.schema.Schema.add_table": {"tf": 9.539392014169456}, "sqlglot.schema.Schema.column_names": {"tf": 7.416198487095663}, "sqlglot.schema.Schema.get_column_type": {"tf": 7.745966692414834}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 4.795831523312719}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 5.744562646538029}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 8.48528137423857}, "sqlglot.schema.MappingSchema.__init__": {"tf": 10.295630140987}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 6.164414002968976}, "sqlglot.schema.MappingSchema.copy": {"tf": 5.0990195135927845}, "sqlglot.schema.MappingSchema.add_table": {"tf": 9.539392014169456}, "sqlglot.schema.MappingSchema.column_names": {"tf": 7.416198487095663}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 8.06225774829855}, "sqlglot.schema.ensure_schema": {"tf": 4.898979485566356}, "sqlglot.schema.ensure_column_mapping": {"tf": 7.483314773547883}, "sqlglot.schema.flatten_schema": {"tf": 7.54983443527075}, "sqlglot.serde.dump": {"tf": 11.045361017187261}, "sqlglot.serde.load": {"tf": 11.045361017187261}, "sqlglot.time.format_time": {"tf": 7.810249675906654}, "sqlglot.tokens.Token.__init__": {"tf": 9}, "sqlglot.tokens.Token.number": {"tf": 5.291502622129181}, "sqlglot.tokens.Token.string": {"tf": 5.291502622129181}, "sqlglot.tokens.Token.identifier": {"tf": 5.291502622129181}, "sqlglot.tokens.Token.var": {"tf": 5.291502622129181}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 2}, "sqlglot.tokens.Tokenizer.reset": {"tf": 3.4641016151377544}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 5.744562646538029}, "sqlglot.transforms.unalias_group": {"tf": 5.744562646538029}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 5.744562646538029}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 5.744562646538029}, "sqlglot.transforms.preprocess": {"tf": 10.816653826391969}, "sqlglot.transforms.delegate": {"tf": 4}, "sqlglot.trie.new_trie": {"tf": 4.898979485566356}, "sqlglot.trie.in_trie": {"tf": 6.244997998398398}}, "df": 712, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.generator.Generator.seg": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 108, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parse": {"tf": 1.7320508075688772}, "sqlglot.parse_one": {"tf": 2.23606797749979}, "sqlglot.transpile": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.dialects.dialect.rename_func": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.if_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.Keep.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.diff": {"tf": 2.6457513110645907}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 2.6457513110645907}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.executor.execute": {"tf": 2.23606797749979}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1.4142135623730951}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 2.23606797749979}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 2.449489742783178}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_column": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 2.23606797749979}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 2}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.rename_table": {"tf": 1.7320508075688772}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.expressions.func": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.generator.Generator.wrap": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 2.6457513110645907}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 2}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1.7320508075688772}, "sqlglot.planner.Join.from_joins": {"tf": 1.7320508075688772}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.7320508075688772}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.7320508075688772}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.7320508075688772}, "sqlglot.schema.ensure_schema": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 2.449489742783178}}, "df": 450}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}}, "df": 2}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.parse_one": {"tf": 2}, "sqlglot.transpile": {"tf": 2}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 2}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 2}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.rename_func": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1.4142135623730951}, "sqlglot.errors.ParseError.new": {"tf": 2.449489742783178}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 2.23606797749979}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 2}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1.7320508075688772}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}, "sqlglot.generator.Generator.sep": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.seg": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.pad_comment": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.wrap": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.no_identify": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.normalize_func": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.indent": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 2}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 2}, "sqlglot.generator.Generator.op_expressions": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1.4142135623730951}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1.4142135623730951}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1.7320508075688772}, "sqlglot.helper.split_num_words": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 2.23606797749979}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.4142135623730951}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1.4142135623730951}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}, "sqlglot.time.format_time": {"tf": 2}, "sqlglot.tokens.Token.__init__": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 371, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}}, "df": 2}}}}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}}, "df": 1}}}}}}}, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 3}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}}, "df": 4}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.star_sql": {"tf": 1}}, "df": 1, "t": {"docs": {"sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 9, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.Column.substr": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Join.from_joins": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 12}}}, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.executor.context.Context.eval": {"tf": 1}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1}, "sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.append": {"tf": 1}, "sqlglot.executor.table.Table.pop": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}, "sqlglot.generator.Generator.sep": {"tf": 1}, "sqlglot.generator.Generator.seg": {"tf": 1}, "sqlglot.generator.Generator.pad_comment": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.generator.Generator.wrap": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.null_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.parser.Parser.reset": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 471}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1.4142135623730951}}, "df": 24, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "q": {"docs": {"sqlglot.helper.seq_get": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 15}}}}}}, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "p": {"docs": {"sqlglot.generator.Generator.sep": {"tf": 1}, "sqlglot.generator.Generator.seg": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 8}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1.7320508075688772}, "sqlglot.schema.flatten_schema": {"tf": 1}}, "df": 15}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 6, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}}, "df": 1}}}}}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}}, "df": 1}}}}}}, "f": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}}, "df": 1}}}}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}}, "df": 4, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}}, "df": 2}}}}}}}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.generator.Generator.sub_sql": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}}, "df": 7}}, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.env.str_position": {"tf": 1}}, "df": 1}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.expand": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}, "f": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.generator.Generator.properties": {"tf": 1}}, "df": 1}}}}}, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}}, "df": 10, "s": {"docs": {"sqlglot.expressions.expand": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 6}}}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.sort_sql": {"tf": 1}}, "df": 1}}}, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.generator.Generator.indent": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.generator.Generator.similarto_sql": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.slice_sql": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}}, "df": 5, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}}, "df": 3}}}}}}, "c": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}}, "df": 2}}}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe.sql.Column.rlike": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}}, "df": 2}}}}}}}}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.return_sql": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 2}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Subqueryable.with_": {"tf": 1}}, "df": 1}}}}}}}, "f": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}}, "df": 4, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.reference_sql": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.table.Table.append": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.executor.table.Table.__init__": {"tf": 1}}, "df": 1}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.generator.Generator.rollback_sql": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}}, "df": 2}}}, "w": {"docs": {"sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 2}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}}, "df": 4}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.7320508075688772}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}}, "df": 60}}, "t": {"docs": {"sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.executor.env.interval": {"tf": 1}}, "df": 2}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.unique_sql": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 7}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.uncache_sql": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe.sql.Column.between": {"tf": 1}}, "df": 1}}}}}}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}}, "df": 6}}}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Select.join": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.generator.Generator.use_sql": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}}, "df": 1, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}}}, "d": {"docs": {"sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parse": {"tf": 2}, "sqlglot.parse_one": {"tf": 2}, "sqlglot.transpile": {"tf": 2.8284271247461903}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 2.6457513110645907}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.executor.execute": {"tf": 2}, "sqlglot.expressions.Expression.sql": {"tf": 2.23606797749979}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 2.23606797749979}, "sqlglot.expressions.maybe_parse": {"tf": 2.23606797749979}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 2.23606797749979}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.func": {"tf": 2.23606797749979}, "sqlglot.lineage.lineage": {"tf": 2.23606797749979}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 2.23606797749979}, "sqlglot.schema.MappingSchema.__init__": {"tf": 2.23606797749979}}, "df": 51, "s": {"docs": {"sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 2}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1.7320508075688772}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.build": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1.4142135623730951}}, "df": 13}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 35}}, "s": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}}, "df": 9}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.distribute_sql": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}}, "df": 3}}}}}}, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.diff.diff": {"tf": 2.23606797749979}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 2.23606797749979}}, "df": 2}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.directory_sql": {"tf": 1}}, "df": 1}}}}}}}, "v": {"docs": {"sqlglot.generator.Generator.div_sql": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}}, "df": 1, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.table": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 2.8284271247461903}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 2}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.between": {"tf": 1}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 2}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 89, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}}, "df": 3}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 12}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}, "e": {"docs": {"sqlglot.optimizer.simplify.date_literal": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}, "g": {"docs": {"sqlglot.helper.tsort": {"tf": 1}}, "df": 1}}, "f": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}}, "df": 4}, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor.env.ordered": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}}, "df": 2}}, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1}}, "df": 1}}}}}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.delete": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}}, "df": 2}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.planner.Step.add_dependency": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.schema.flatten_schema": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}}, "df": 3}}}}, "b": {"docs": {"sqlglot.expressions.table_": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}}, "df": 3}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.generator.Generator.drop_sql": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.droppartition_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.dpipe_sql": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.dot_sql": {"tf": 1}}, "df": 1}, "w": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.lineage.Node.__init__": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalized": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}}, "df": 4}}}, "t": {"docs": {"sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1.4142135623730951}, "sqlglot.helper.tsort": {"tf": 1.7320508075688772}, "sqlglot.helper.first": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 5, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.7320508075688772}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 2.23606797749979}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}}, "df": 31, "s": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 11}}}}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.window": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 48}}, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}}, "df": 2}, "e": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 4}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.transforms.preprocess": {"tf": 1}}, "df": 1}}}}}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.table_iter": {"tf": 1.4142135623730951}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1.4142135623730951}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.4142135623730951}}, "df": 26, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}}, "df": 3}}}}, "s": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 10, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 4}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.context.Context.table_iter": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.generator.Generator.tablealias_sql": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff.Update.__init__": {"tf": 1}, "sqlglot.diff.Keep.__init__": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 4}}}}, "g": {"docs": {"sqlglot.generator.Generator.tag_sql": {"tf": 1}}, "df": 1}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.find_new_name": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 11}}}}, "h": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}}, "df": 2}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor.env.str_position": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.executor.env.interval": {"tf": 1}}, "df": 5}}}, "o": {"docs": {"sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.executor.env.cast": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 7, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 10, "s": {"docs": {"sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 10}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.token_sql": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}}, "df": 2}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 2.6457513110645907}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.executor.context.Context.set_row": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.executor.env.str_position": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.7320508075688772}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1.7320508075688772}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.column": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_": {"tf": 2}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 3.1622776601683795}, "sqlglot.generator.Generator.unsupported": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1.7320508075688772}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.flatten_schema": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1}}, "df": 120, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}}, "df": 33}}}}}}, "t": {"docs": {"sqlglot.expressions.not_": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}}, "df": 2, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1}}, "df": 8}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.normalize_func": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}}, "df": 22}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.generator.Generator.national_sql": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}}, "df": 4}, "g": {"docs": {"sqlglot.generator.Generator.neg_sql": {"tf": 1}}, "df": 1}, "q": {"docs": {"sqlglot.generator.Generator.neq_sql": {"tf": 1}}, "df": 1}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}}, "df": 2}}}}}}}}}}, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}}, "df": 2}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.executor.env.ordered": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "q": {"docs": {"sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}}, "df": 7, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}}, "df": 51}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 2.6457513110645907}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.table.ensure_tables": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1.4142135623730951}, "sqlglot.schema.flatten_schema": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}}, "df": 52}}}}, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}}, "df": 2}}}}}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.like": {"tf": 1}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1}}, "df": 11}}}}, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 3, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 4}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}}, "df": 1}}}}}}}}, "b": {"docs": {}, "df": 0, "j": {"docs": {"sqlglot.executor.env.reverse_key.__init__": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 4}}, "r": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}}, "df": 3, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.order_sql": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.ordered_sql": {"tf": 1}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}}, "df": 3}}, "f": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 4}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.tsort": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1.7320508075688772}, "sqlglot.serde.dump": {"tf": 1.7320508075688772}, "sqlglot.serde.load": {"tf": 1.7320508075688772}, "sqlglot.tokens.Token.__init__": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 53}}, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}, "sqlglot.lineage.Node.to_html": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}}, "df": 5, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.lineage.Node.to_html": {"tf": 1}}, "df": 1}}}}}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}}, "df": 4}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.like_sql": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.limit_sql": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.planner.Step.to_s": {"tf": 1}}, "df": 5}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.Column.substr": {"tf": 1}, "sqlglot.executor.env.substring": {"tf": 1}}, "df": 2}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}}, "df": 4}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}}, "df": 3}}}}, "t": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.between": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 4.242640687119285}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}}, "df": 26, "e": {"docs": {"sqlglot.generator.Generator.lte_sql": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}}, "df": 3}}, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.generator.Generator.lambda_sql": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.generator.Generator.lateral_sql": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2}}}}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe.sql.Column.between": {"tf": 1}}, "df": 1}}}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.locate_properties": {"tf": 1}}, "df": 1}}}}}, "k": {"docs": {"sqlglot.generator.Generator.lock_sql": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.generator.Generator.loaddata_sql": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}}, "df": 5, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 3, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 2}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.Remove.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.Move.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.Update.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.Keep.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1.4142135623730951}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 2.23606797749979}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.generate": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.wrap": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.expressions": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.op_expressions": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node.__init__": {"tf": 1.7320508075688772}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalized": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 1}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1}, "sqlglot.optimizer.simplify.always_true": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 2}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Plan.__init__": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.7320508075688772}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.7320508075688772}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 2}}, "df": 358, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}, "sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1}, "sqlglot.diff.Insert.__init__": {"tf": 1}, "sqlglot.diff.Remove.__init__": {"tf": 1}, "sqlglot.diff.Move.__init__": {"tf": 1}, "sqlglot.diff.Update.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.Keep.__init__": {"tf": 1.4142135623730951}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.window": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 2}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.paren": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_column": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.7320508075688772}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 2}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.rename_table": {"tf": 1.7320508075688772}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1}, "sqlglot.generator.Generator.wrap": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1}, "sqlglot.generator.Generator.cache_sql": {"tf": 1}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}, "sqlglot.generator.Generator.describe_sql": {"tf": 1}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1}, "sqlglot.generator.Generator.directory_sql": {"tf": 1}, "sqlglot.generator.Generator.delete_sql": {"tf": 1}, "sqlglot.generator.Generator.drop_sql": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1}, "sqlglot.generator.Generator.filter_sql": {"tf": 1}, "sqlglot.generator.Generator.hint_sql": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.generator.Generator.national_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_sql": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.with_properties": {"tf": 1}, "sqlglot.generator.Generator.locate_properties": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1}, "sqlglot.generator.Generator.update_sql": {"tf": 1}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}, "sqlglot.generator.Generator.having_sql": {"tf": 1}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1}, "sqlglot.generator.Generator.limit_sql": {"tf": 1}, "sqlglot.generator.Generator.offset_sql": {"tf": 1}, "sqlglot.generator.Generator.lock_sql": {"tf": 1}, "sqlglot.generator.Generator.literal_sql": {"tf": 1}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1}, "sqlglot.generator.Generator.sort_sql": {"tf": 1}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1}, "sqlglot.generator.Generator.select_sql": {"tf": 1}, "sqlglot.generator.Generator.schema_sql": {"tf": 1}, "sqlglot.generator.Generator.star_sql": {"tf": 1}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.generator.Generator.union_sql": {"tf": 1}, "sqlglot.generator.Generator.union_op": {"tf": 1}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1}, "sqlglot.generator.Generator.between_sql": {"tf": 1}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1}, "sqlglot.generator.Generator.all_sql": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.generator.Generator.exists_sql": {"tf": 1}, "sqlglot.generator.Generator.case_sql": {"tf": 1}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1}, "sqlglot.generator.Generator.extract_sql": {"tf": 1}, "sqlglot.generator.Generator.trim_sql": {"tf": 1}, "sqlglot.generator.Generator.concat_sql": {"tf": 1}, "sqlglot.generator.Generator.check_sql": {"tf": 1}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}, "sqlglot.generator.Generator.unique_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}, "sqlglot.generator.Generator.in_sql": {"tf": 1}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.generator.Generator.return_sql": {"tf": 1}, "sqlglot.generator.Generator.reference_sql": {"tf": 1}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}, "sqlglot.generator.Generator.neg_sql": {"tf": 1}, "sqlglot.generator.Generator.not_sql": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1}, "sqlglot.generator.Generator.add_sql": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}, "sqlglot.generator.Generator.connector_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}, "sqlglot.generator.Generator.collate_sql": {"tf": 1}, "sqlglot.generator.Generator.command_sql": {"tf": 1}, "sqlglot.generator.Generator.commit_sql": {"tf": 1}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1}, "sqlglot.generator.Generator.div_sql": {"tf": 1}, "sqlglot.generator.Generator.distance_sql": {"tf": 1}, "sqlglot.generator.Generator.dot_sql": {"tf": 1}, "sqlglot.generator.Generator.eq_sql": {"tf": 1}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}, "sqlglot.generator.Generator.glob_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.generator.Generator.gte_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.is_sql": {"tf": 1}, "sqlglot.generator.Generator.like_sql": {"tf": 1}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1}, "sqlglot.generator.Generator.lt_sql": {"tf": 1}, "sqlglot.generator.Generator.lte_sql": {"tf": 1}, "sqlglot.generator.Generator.mod_sql": {"tf": 1}, "sqlglot.generator.Generator.mul_sql": {"tf": 1}, "sqlglot.generator.Generator.neq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1}, "sqlglot.generator.Generator.or_sql": {"tf": 1}, "sqlglot.generator.Generator.slice_sql": {"tf": 1}, "sqlglot.generator.Generator.sub_sql": {"tf": 1}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1}, "sqlglot.generator.Generator.use_sql": {"tf": 1}, "sqlglot.generator.Generator.binary": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.format_time": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}, "sqlglot.generator.Generator.set_operation": {"tf": 1}, "sqlglot.generator.Generator.tag_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1}, "sqlglot.generator.Generator.when_sql": {"tf": 1}, "sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Plan.__init__": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.7320508075688772}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.7320508075688772}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 2}}, "df": 345}}}}}}}, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1}}, "df": 2}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}}, "df": 2}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1}}, "df": 1}}}, "s": {"docs": {"sqlglot.generator.Generator.exists_sql": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1}, "sqlglot.generator.Generator.except_sql": {"tf": 1}, "sqlglot.generator.Generator.except_op": {"tf": 1}}, "df": 3}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.context.Context.table_iter": {"tf": 1.4142135623730951}, "sqlglot.executor.table.ensure_tables": {"tf": 1}}, "df": 4}}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.extract_sql": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}}, "df": 2, "s": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}}, "df": 6}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 3}}}}}}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}}, "df": 7}, "v": {"docs": {"sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1}}, "df": 2}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor.env.filter_nulls": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.escape_sql": {"tf": 1}}, "df": 2}}}}}, "q": {"docs": {"sqlglot.generator.Generator.eq_sql": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.in_sql": {"tf": 1}}, "df": 1, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1.4142135623730951}, "sqlglot.errors.ParseError.new": {"tf": 1.4142135623730951}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.executor.context.Context.set_range": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.indent": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.to_s": {"tf": 1}, "sqlglot.schema.flatten_schema": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.__init__": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 33, "o": {"docs": {"sqlglot.parse_one": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.generator.Generator.into_sql": {"tf": 1}}, "df": 4}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1}, "sqlglot.generator.Generator.intersect_op": {"tf": 1}}, "df": 3}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.to_interval": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.interval_sql": {"tf": 1}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1}}, "df": 3}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.introducer_sql": {"tf": 1}}, "df": 1}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.generator.Generator.intdiv_sql": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}, "sqlglot.generator.Generator.insert_sql": {"tf": 1}}, "df": 3}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.executor.context.Context.set_index": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.index_sql": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 5}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}}, "df": 2}}}}}, "d": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.between": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1.4142135623730951}}, "df": 19, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.transpile": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.__init__": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}}, "df": 4}}}, "y": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {"sqlglot.helper.first": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 7}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.context.Context.table_iter": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.lineage.Node.walk": {"tf": 1}}, "df": 3}}}}}}}, "f": {"docs": {"sqlglot.dialects.dialect.if_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.generator.Generator.if_sql": {"tf": 1}}, "df": 3}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {"sqlglot.generator.Generator.is_sql": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1, "d": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}}, "df": 3, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1}}, "df": 1}}}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.lineage.LineageHTML.__init__": {"tf": 1}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}}, "df": 4, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.parse_one": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 6}}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.collate_sql": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}}, "df": 18}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.where": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.when": {"tf": 2}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 2}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 2}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.substr": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.Column.between": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.over": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1.4142135623730951}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.column_sql": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.4142135623730951}}, "df": 48, "s": {"docs": {"sqlglot.executor.context.Context.add_columns": {"tf": 1}, "sqlglot.executor.table.Table.__init__": {"tf": 1}, "sqlglot.executor.table.Table.add_columns": {"tf": 1}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 8}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.generator.Generator.columndef_sql": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.table_iter": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 10}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.executor.context.Context.filter": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1}}, "df": 5}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.constraint_sql": {"tf": 1}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.concat_sql": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.connector_sql": {"tf": 1}}, "df": 1}}}}}}}, "p": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}}, "df": 25}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.context.Context.eval": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor.context.Context.eval_tuple": {"tf": 1}}, "df": 1}}}, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.command_sql": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.pad_comment": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.tokens.Token.__init__": {"tf": 1}}, "df": 3}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.commit_sql": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}}, "df": 2}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}}, "df": 4}}}}, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Literal.number": {"tf": 1}, "sqlglot.expressions.Literal.string": {"tf": 1}, "sqlglot.expressions.Properties.from_dict": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.Func.sql_names": {"tf": 1}, "sqlglot.expressions.Func.sql_name": {"tf": 1}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 30}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 4, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.subclasses": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.cluster_sql": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dialects.dialect.rename_func": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.7320508075688772}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 13}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.generator.Generator.cast_sql": {"tf": 1}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1}}, "df": 4}, "e": {"docs": {"sqlglot.generator.Generator.case_sql": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.table_": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}}, "df": 3}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.cache_sql": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1}, "sqlglot.generator.Generator.cte_sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 5}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1}}, "df": 2}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.generator.Generator.create_sql": {"tf": 1}}, "df": 3}}}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.characterset_sql": {"tf": 1}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.generator.Generator.check_sql": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1}}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transpile": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.properties": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.generator.Generator.window_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}}, "df": 12, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1}}, "df": 9}}}}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1}, "sqlglot.generator.Generator.with_sql": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.generator.Generator.withingroup_sql": {"tf": 1}}, "df": 1}}}}}}}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.generator.Generator.where_sql": {"tf": 1}}, "df": 3}}, "n": {"docs": {"sqlglot.generator.Generator.when_sql": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}}}}}, "b": {"docs": {"sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}}, "df": 2, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.DataType.is_type": {"tf": 1}, "sqlglot.expressions.Cast.is_type": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.indent": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}}, "df": 31, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.boolean_sql": {"tf": 1}}, "df": 1}}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.bracket_sql": {"tf": 1}}, "df": 1}}}}}}, "y": {"docs": {"sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}}, "df": 2}, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 7}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.bitstring_sql": {"tf": 1}}, "df": 1}}}}}}, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1}}, "df": 1}}}}}}}}}}, "x": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1}}, "df": 1}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.binary": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.between_sql": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.find_new_name": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.between": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1.4142135623730951}}, "df": 19}}}}}}}, "p": {"docs": {"sqlglot.dialects.dialect.var_map_sql": {"tf": 1.7320508075688772}}, "df": 1, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.dialect.parse_date_delta": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.ensure_column_mapping": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 9, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}}, "df": 2}}}}}}}}}}}, "x": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.errors.concat_messages": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.generator.Generator.unsupported": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 5}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.merge_sql": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.mod_sql": {"tf": 1}}, "df": 1, "e": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 2}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.subclasses": {"tf": 1}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 2}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.generator.Generator.mul_sql": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.schema.AbstractMappingSchema.find": {"tf": 1}}, "df": 1}}}}}}}, "g": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.between": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.over": {"tf": 1}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1}, "sqlglot.generator.Generator.gt_sql": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.lineage.Node.__init__": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 4.242640687119285}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}}, "df": 27, "e": {"docs": {"sqlglot.generator.Generator.gte_sql": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1}, "sqlglot.generator.Generator.group_sql": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}}, "df": 1}}}}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.Dialect.generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.rename_func": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.if_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 2}}, "df": 25}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1}}, "df": 2}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.generator.Generator.glob_sql": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {"sqlglot.diff.ChangeDistiller.__init__": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.4142135623730951}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1.4142135623730951}, "sqlglot.serde.dump": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1.4142135623730951}}, "df": 7}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}}, "df": 3}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 2.23606797749979}, "sqlglot.generator.Generator.indent": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.order_sql": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.generator.Generator.op_expressions": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalized": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.__init__": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 20}}, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.lineage.Node.__init__": {"tf": 1}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}}, "df": 2, "c": {"docs": {"sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1}, "sqlglot.executor.env.filter_nulls": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}}, "df": 7, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.count_params": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 4.242640687119285}}, "df": 3, "s": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.foreignkey_sql": {"tf": 1}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1}}, "df": 2}}}}}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 2}}}}}}}}}, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.env.ordered": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.filter_sql": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}, "l": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.expressions.update": {"tf": 1}, "sqlglot.generator.Generator.from_sql": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.generator.Generator.fetch_sql": {"tf": 1}}, "df": 1}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1}}, "df": 1}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}}, "df": 17, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.values_sql": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}}, "df": 5}}}, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}}}, "r": {"docs": {"sqlglot.generator.Generator.var_sql": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 2, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dialects.dialect.var_map_sql": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 3}}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.parameter_sql": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.Dialect.parser": {"tf": 1.4142135623730951}}, "df": 1}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}}, "df": 2}}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.partition_sql": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.paren": {"tf": 1}, "sqlglot.generator.Generator.paren_sql": {"tf": 1}}, "df": 2, "t": {"docs": {"sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1}}, "df": 4}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}}, "df": 2}}, "d": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.indent": {"tf": 1}}, "df": 2}}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.no_properties_sql": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1.4142135623730951}, "sqlglot.expressions.Properties.from_dict": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.generator.Generator.properties_sql": {"tf": 1}, "sqlglot.generator.Generator.root_properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.with_properties": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.locate_properties": {"tf": 1.7320508075688772}}, "df": 11}}}, "y": {"docs": {"sqlglot.generator.Generator.locate_properties": {"tf": 1}, "sqlglot.generator.Generator.property_sql": {"tf": 1}, "sqlglot.generator.Generator.naked_property": {"tf": 1}}, "df": 3}}}}}, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}}, "df": 3}}}, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.generator.Generator.properties": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}}, "df": 3}}}, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 3}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.env.str_position": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.python.PythonExecutor.execute": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.add_dependency": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Join.from_joins": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 5}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.generator.Generator.placeholder_sql": {"tf": 1}}, "df": 1}}}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.pseudotype_sql": {"tf": 1}}, "df": 1}}}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.hint_sql": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}}, "df": 1}}}, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.errors.ParseError.new": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.hexstring_sql": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.having_sql": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 2}}}}}}}}, "k": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.kwarg_sql": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.DataType.build": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.schema.MappingSchema.copy": {"tf": 1}}, "df": 30}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.Column.binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1}}, "df": 3}}}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1}}, "df": 2}}, "y": {"docs": {"sqlglot.executor.context.Context.sort": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.generator.Generator.sql": {"tf": 1}, "sqlglot.generator.Generator.expressions": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 8, "s": {"docs": {"sqlglot.schema.flatten_schema": {"tf": 1}}, "df": 1}, "w": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.trie.new_trie": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {"sqlglot.optimizer.simplify.is_complement": {"tf": 1}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.generator.Generator.table_sql": {"tf": 1}}, "df": 2, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}}}}}, "n": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1}, "sqlglot.dataframe.sql.Column.when": {"tf": 1}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1}, "sqlglot.errors.ParseError.__init__": {"tf": 1}, "sqlglot.errors.concat_messages": {"tf": 1}, "sqlglot.errors.merge_errors": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.any_sql": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1.7320508075688772}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1}, "sqlglot.schema.ensure_schema": {"tf": 1}}, "df": 19}, "d": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.generator.Generator.and_sql": {"tf": 1}}, "df": 3}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.generator.Generator.anonymous_sql": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1}}, "df": 2}}}, "e": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.generator.Generator.all_sql": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator.__init__": {"tf": 1}, "sqlglot.generator.Generator.alias_sql": {"tf": 1}, "sqlglot.parser.Parser.__init__": {"tf": 1}}, "df": 10, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.generator.Generator.aliases_sql": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1}}, "df": 2}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.generator.Generator.altercolumn_sql": {"tf": 1}}, "df": 1}}}}}}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1}, "sqlglot.expressions.Expression.__init__": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator.no_identify": {"tf": 1}, "sqlglot.generator.Generator.format_args": {"tf": 1}, "sqlglot.generator.Generator.text_width": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.parser.parse_var_map": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 16}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.generator.Generator.lambda_sql": {"tf": 1}}, "df": 1}}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.window": {"tf": 1}}, "df": 14}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}, "t": {"docs": {"sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 4.242640687119285}}, "df": 2, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.attimezone_sql": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {"sqlglot.transforms.delegate": {"tf": 1}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.generator.Generator.add_sql": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.addconstraint_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "j": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.join_sql": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1}, "sqlglot.planner.Join.from_joins": {"tf": 1}}, "df": 7, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.generator.Generator.joinhint_sql": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.planner.Join.from_joins": {"tf": 1}}, "df": 2}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.journalproperty_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.generator.Generator.__init__": {"tf": 1.4142135623730951}}, "df": 1, "d": {"docs": {"sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}}, "df": 4}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.generator.Generator.qualify_sql": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}}, "df": 3}}}}}}}, "x": {"2": {"7": {"docs": {"sqlglot.helper.open_file": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}, "bases": {"root": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.executor.python.Python": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}}, "df": 79, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}}, "df": 6}}}}}}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects.databricks.Databricks": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}}, "df": 3}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 2}, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.planner.Scan": {"tf": 1}, "sqlglot.planner.Join": {"tf": 1}, "sqlglot.planner.Aggregate": {"tf": 1}, "sqlglot.planner.Sort": {"tf": 1}, "sqlglot.planner.SetOperation": {"tf": 1}}, "df": 5}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Union": {"tf": 1}, "sqlglot.expressions.Select": {"tf": 1}}, "df": 2}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.All": {"tf": 1}, "sqlglot.expressions.Any": {"tf": 1}, "sqlglot.expressions.Exists": {"tf": 1}}, "df": 3}}}}}}}}}}}}}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python": {"tf": 1.4142135623730951}}, "df": 15, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1}, "sqlglot.dialects.databricks.Databricks": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1}, "sqlglot.dialects.hive.Hive": {"tf": 1}, "sqlglot.dialects.mysql.MySQL": {"tf": 1}, "sqlglot.dialects.oracle.Oracle": {"tf": 1}, "sqlglot.dialects.postgres.Postgres": {"tf": 1}, "sqlglot.dialects.presto.Presto": {"tf": 1}, "sqlglot.dialects.redshift.Redshift": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1}, "sqlglot.dialects.spark.Spark": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau": {"tf": 1}, "sqlglot.dialects.teradata.Teradata": {"tf": 1}, "sqlglot.dialects.trino.Trino": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL": {"tf": 1}, "sqlglot.executor.python.Python": {"tf": 1}}, "df": 31}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "[": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.UDTF": {"tf": 1}, "sqlglot.expressions.CTE": {"tf": 1}, "sqlglot.expressions.Subquery": {"tf": 1}}, "df": 3}}}}}}}}}}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}}, "df": 13}, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1}}, "df": 16}}}}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Interval": {"tf": 1}, "sqlglot.expressions.DateAdd": {"tf": 1}, "sqlglot.expressions.DateSub": {"tf": 1}, "sqlglot.expressions.DateDiff": {"tf": 1}, "sqlglot.expressions.DatetimeAdd": {"tf": 1}, "sqlglot.expressions.DatetimeSub": {"tf": 1}, "sqlglot.expressions.DatetimeDiff": {"tf": 1}, "sqlglot.expressions.DatetimeTrunc": {"tf": 1}, "sqlglot.expressions.TimestampAdd": {"tf": 1}, "sqlglot.expressions.TimestampSub": {"tf": 1}, "sqlglot.expressions.TimestampDiff": {"tf": 1}, "sqlglot.expressions.TimestampTrunc": {"tf": 1}, "sqlglot.expressions.TimeAdd": {"tf": 1}, "sqlglot.expressions.TimeSub": {"tf": 1}, "sqlglot.expressions.TimeDiff": {"tf": 1}, "sqlglot.expressions.TimeTrunc": {"tf": 1}, "sqlglot.expressions.TsOrDsAdd": {"tf": 1}}, "df": 17}}}}}}}, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}}, "df": 17}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.redshift.Redshift": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}}, "df": 4}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dialects.trino.Trino": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1.4142135623730951}}, "df": 3}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.SubqueryPredicate": {"tf": 1}, "sqlglot.expressions.EQ": {"tf": 1}, "sqlglot.expressions.NullSafeEQ": {"tf": 1}, "sqlglot.expressions.NullSafeNEQ": {"tf": 1}, "sqlglot.expressions.Glob": {"tf": 1}, "sqlglot.expressions.GT": {"tf": 1}, "sqlglot.expressions.GTE": {"tf": 1}, "sqlglot.expressions.ILike": {"tf": 1}, "sqlglot.expressions.Is": {"tf": 1}, "sqlglot.expressions.Like": {"tf": 1}, "sqlglot.expressions.LT": {"tf": 1}, "sqlglot.expressions.LTE": {"tf": 1}, "sqlglot.expressions.NEQ": {"tf": 1}, "sqlglot.expressions.SimilarTo": {"tf": 1}, "sqlglot.expressions.Between": {"tf": 1}, "sqlglot.expressions.In": {"tf": 1}}, "df": 16}}}}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.AlgorithmProperty": {"tf": 1}, "sqlglot.expressions.DefinerProperty": {"tf": 1}, "sqlglot.expressions.SqlSecurityProperty": {"tf": 1}, "sqlglot.expressions.TableFormatProperty": {"tf": 1}, "sqlglot.expressions.PartitionedByProperty": {"tf": 1}, "sqlglot.expressions.FileFormatProperty": {"tf": 1}, "sqlglot.expressions.DistKeyProperty": {"tf": 1}, "sqlglot.expressions.SortKeyProperty": {"tf": 1}, "sqlglot.expressions.DistStyleProperty": {"tf": 1}, "sqlglot.expressions.LikeProperty": {"tf": 1}, "sqlglot.expressions.LocationProperty": {"tf": 1}, "sqlglot.expressions.EngineProperty": {"tf": 1}, "sqlglot.expressions.AutoIncrementProperty": {"tf": 1}, "sqlglot.expressions.CharacterSetProperty": {"tf": 1}, "sqlglot.expressions.CollateProperty": {"tf": 1}, "sqlglot.expressions.SchemaCommentProperty": {"tf": 1}, "sqlglot.expressions.ReturnsProperty": {"tf": 1}, "sqlglot.expressions.LanguageProperty": {"tf": 1}, "sqlglot.expressions.ExecuteAsProperty": {"tf": 1}, "sqlglot.expressions.VolatilityProperty": {"tf": 1}, "sqlglot.expressions.RowFormatDelimitedProperty": {"tf": 1}, "sqlglot.expressions.RowFormatSerdeProperty": {"tf": 1}, "sqlglot.expressions.SerdeProperties": {"tf": 1}, "sqlglot.expressions.FallbackProperty": {"tf": 1}, "sqlglot.expressions.WithJournalTableProperty": {"tf": 1}, "sqlglot.expressions.LogProperty": {"tf": 1}, "sqlglot.expressions.JournalProperty": {"tf": 1}, "sqlglot.expressions.AfterJournalProperty": {"tf": 1}, "sqlglot.expressions.ChecksumProperty": {"tf": 1}, "sqlglot.expressions.FreespaceProperty": {"tf": 1}, "sqlglot.expressions.MergeBlockRatioProperty": {"tf": 1}, "sqlglot.expressions.DataBlocksizeProperty": {"tf": 1}, "sqlglot.expressions.BlockCompressionProperty": {"tf": 1}, "sqlglot.expressions.IsolatedLoadingProperty": {"tf": 1}}, "df": 34}}}}}}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}}, "df": 20}}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "[": {"docs": {}, "df": 0, "~": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 1}}}}}}}}}}, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.errors.SqlglotError": {"tf": 1}}, "df": 2}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Add": {"tf": 1}, "sqlglot.expressions.Connector": {"tf": 1}, "sqlglot.expressions.BitwiseAnd": {"tf": 1}, "sqlglot.expressions.BitwiseLeftShift": {"tf": 1}, "sqlglot.expressions.BitwiseOr": {"tf": 1}, "sqlglot.expressions.BitwiseRightShift": {"tf": 1}, "sqlglot.expressions.BitwiseXor": {"tf": 1}, "sqlglot.expressions.Div": {"tf": 1}, "sqlglot.expressions.Dot": {"tf": 1}, "sqlglot.expressions.DPipe": {"tf": 1}, "sqlglot.expressions.EQ": {"tf": 1}, "sqlglot.expressions.NullSafeEQ": {"tf": 1}, "sqlglot.expressions.NullSafeNEQ": {"tf": 1}, "sqlglot.expressions.Distance": {"tf": 1}, "sqlglot.expressions.Escape": {"tf": 1}, "sqlglot.expressions.Glob": {"tf": 1}, "sqlglot.expressions.GT": {"tf": 1}, "sqlglot.expressions.GTE": {"tf": 1}, "sqlglot.expressions.ILike": {"tf": 1}, "sqlglot.expressions.IntDiv": {"tf": 1}, "sqlglot.expressions.Is": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.Like": {"tf": 1}, "sqlglot.expressions.LT": {"tf": 1}, "sqlglot.expressions.LTE": {"tf": 1}, "sqlglot.expressions.Mod": {"tf": 1}, "sqlglot.expressions.Mul": {"tf": 1}, "sqlglot.expressions.NEQ": {"tf": 1}, "sqlglot.expressions.SimilarTo": {"tf": 1}, "sqlglot.expressions.Slice": {"tf": 1}, "sqlglot.expressions.Sub": {"tf": 1}, "sqlglot.expressions.Collate": {"tf": 1}, "sqlglot.expressions.JSONBContains": {"tf": 1}, "sqlglot.expressions.JSONExtract": {"tf": 1}, "sqlglot.expressions.Pow": {"tf": 1}}, "df": 35}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dialects.dialect.Dialects": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1.4142135623730951}}, "df": 3}}}, "x": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.errors.SqlglotError": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Condition": {"tf": 1}, "sqlglot.expressions.DerivedTable": {"tf": 1}, "sqlglot.expressions.Unionable": {"tf": 1}, "sqlglot.expressions.Cache": {"tf": 1}, "sqlglot.expressions.Uncache": {"tf": 1}, "sqlglot.expressions.Create": {"tf": 1}, "sqlglot.expressions.Describe": {"tf": 1}, "sqlglot.expressions.Set": {"tf": 1}, "sqlglot.expressions.SetItem": {"tf": 1}, "sqlglot.expressions.Show": {"tf": 1}, "sqlglot.expressions.UserDefinedFunction": {"tf": 1}, "sqlglot.expressions.UserDefinedFunctionKwarg": {"tf": 1}, "sqlglot.expressions.CharacterSet": {"tf": 1}, "sqlglot.expressions.With": {"tf": 1}, "sqlglot.expressions.WithinGroup": {"tf": 1}, "sqlglot.expressions.TableAlias": {"tf": 1}, "sqlglot.expressions.ColumnDef": {"tf": 1}, "sqlglot.expressions.AlterColumn": {"tf": 1}, "sqlglot.expressions.RenameTable": {"tf": 1}, "sqlglot.expressions.ColumnConstraint": {"tf": 1}, "sqlglot.expressions.ColumnConstraintKind": {"tf": 1}, "sqlglot.expressions.Constraint": {"tf": 1}, "sqlglot.expressions.Delete": {"tf": 1}, "sqlglot.expressions.Drop": {"tf": 1}, "sqlglot.expressions.Filter": {"tf": 1}, "sqlglot.expressions.Check": {"tf": 1}, "sqlglot.expressions.Directory": {"tf": 1}, "sqlglot.expressions.ForeignKey": {"tf": 1}, "sqlglot.expressions.PrimaryKey": {"tf": 1}, "sqlglot.expressions.Unique": {"tf": 1}, "sqlglot.expressions.Into": {"tf": 1}, "sqlglot.expressions.From": {"tf": 1}, "sqlglot.expressions.Having": {"tf": 1}, "sqlglot.expressions.Hint": {"tf": 1}, "sqlglot.expressions.JoinHint": {"tf": 1}, "sqlglot.expressions.Identifier": {"tf": 1}, "sqlglot.expressions.Index": {"tf": 1}, "sqlglot.expressions.Insert": {"tf": 1}, "sqlglot.expressions.Introducer": {"tf": 1}, "sqlglot.expressions.National": {"tf": 1}, "sqlglot.expressions.LoadData": {"tf": 1}, "sqlglot.expressions.Partition": {"tf": 1}, "sqlglot.expressions.Fetch": {"tf": 1}, "sqlglot.expressions.Group": {"tf": 1}, "sqlglot.expressions.Lambda": {"tf": 1}, "sqlglot.expressions.Limit": {"tf": 1}, "sqlglot.expressions.Join": {"tf": 1}, "sqlglot.expressions.MatchRecognize": {"tf": 1}, "sqlglot.expressions.Final": {"tf": 1}, "sqlglot.expressions.Offset": {"tf": 1}, "sqlglot.expressions.Order": {"tf": 1}, "sqlglot.expressions.Ordered": {"tf": 1}, "sqlglot.expressions.Property": {"tf": 1}, "sqlglot.expressions.Properties": {"tf": 1}, "sqlglot.expressions.Qualify": {"tf": 1}, "sqlglot.expressions.Return": {"tf": 1}, "sqlglot.expressions.Reference": {"tf": 1}, "sqlglot.expressions.Tuple": {"tf": 1}, "sqlglot.expressions.Table": {"tf": 1}, "sqlglot.expressions.SystemTime": {"tf": 1}, "sqlglot.expressions.Update": {"tf": 1}, "sqlglot.expressions.Var": {"tf": 1}, "sqlglot.expressions.Schema": {"tf": 1}, "sqlglot.expressions.Lock": {"tf": 1}, "sqlglot.expressions.TableSample": {"tf": 1}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Pivot": {"tf": 1}, "sqlglot.expressions.Window": {"tf": 1}, "sqlglot.expressions.WindowSpec": {"tf": 1}, "sqlglot.expressions.Where": {"tf": 1}, "sqlglot.expressions.Star": {"tf": 1}, "sqlglot.expressions.Parameter": {"tf": 1}, "sqlglot.expressions.SessionParameter": {"tf": 1}, "sqlglot.expressions.Placeholder": {"tf": 1}, "sqlglot.expressions.DataType": {"tf": 1}, "sqlglot.expressions.PseudoType": {"tf": 1}, "sqlglot.expressions.StructKwarg": {"tf": 1}, "sqlglot.expressions.Command": {"tf": 1}, "sqlglot.expressions.Transaction": {"tf": 1}, "sqlglot.expressions.Commit": {"tf": 1}, "sqlglot.expressions.Rollback": {"tf": 1}, "sqlglot.expressions.AlterTable": {"tf": 1}, "sqlglot.expressions.AddConstraint": {"tf": 1}, "sqlglot.expressions.DropPartition": {"tf": 1}, "sqlglot.expressions.Binary": {"tf": 1}, "sqlglot.expressions.Unary": {"tf": 1}, "sqlglot.expressions.Alias": {"tf": 1}, "sqlglot.expressions.Aliases": {"tf": 1}, "sqlglot.expressions.AtTimeZone": {"tf": 1}, "sqlglot.expressions.Distinct": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.IgnoreNulls": {"tf": 1}, "sqlglot.expressions.RespectNulls": {"tf": 1}, "sqlglot.expressions.Use": {"tf": 1}, "sqlglot.expressions.Merge": {"tf": 1}}, "df": 95}}}}}}}}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.spark.Spark": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1.4142135623730951}}, "df": 4}}}, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}}, "df": 4}}}}}}, "m": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.starrocks.StarRocks": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}}, "df": 4}}}}}}}, "b": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "[": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}}}}}}}}}, "c": {"docs": {"sqlglot.schema.Schema": {"tf": 1.4142135623730951}}, "df": 1}}, "g": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.ApproxDistinct": {"tf": 1}, "sqlglot.expressions.ArrayAgg": {"tf": 1}, "sqlglot.expressions.ArrayUnionAgg": {"tf": 1}, "sqlglot.expressions.Avg": {"tf": 1}, "sqlglot.expressions.AnyValue": {"tf": 1}, "sqlglot.expressions.Count": {"tf": 1}, "sqlglot.expressions.LogicalOr": {"tf": 1}, "sqlglot.expressions.Max": {"tf": 1}, "sqlglot.expressions.Min": {"tf": 1}, "sqlglot.expressions.PercentileCont": {"tf": 1}, "sqlglot.expressions.PercentileDisc": {"tf": 1}, "sqlglot.expressions.Quantile": {"tf": 1}, "sqlglot.expressions.Quantiles": {"tf": 1}, "sqlglot.expressions.QuantileIf": {"tf": 1}, "sqlglot.expressions.SetAgg": {"tf": 1}, "sqlglot.expressions.Sum": {"tf": 1}, "sqlglot.expressions.Stddev": {"tf": 1}, "sqlglot.expressions.StddevPop": {"tf": 1}, "sqlglot.expressions.StddevSamp": {"tf": 1}, "sqlglot.expressions.Variance": {"tf": 1}, "sqlglot.expressions.VariancePop": {"tf": 1}}, "df": 21}}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.expressions.BitString": {"tf": 1}, "sqlglot.expressions.HexString": {"tf": 1}, "sqlglot.expressions.ByteString": {"tf": 1}, "sqlglot.expressions.Column": {"tf": 1}, "sqlglot.expressions.Literal": {"tf": 1}, "sqlglot.expressions.Null": {"tf": 1}, "sqlglot.expressions.Boolean": {"tf": 1}, "sqlglot.expressions.Connector": {"tf": 1}, "sqlglot.expressions.Not": {"tf": 1}, "sqlglot.expressions.Paren": {"tf": 1}, "sqlglot.expressions.Bracket": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 13}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.And": {"tf": 1}, "sqlglot.expressions.Or": {"tf": 1}}, "df": 2}}}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.ConcatWs": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.AutoIncrementColumnConstraint": {"tf": 1}, "sqlglot.expressions.CheckColumnConstraint": {"tf": 1}, "sqlglot.expressions.CollateColumnConstraint": {"tf": 1}, "sqlglot.expressions.CommentColumnConstraint": {"tf": 1}, "sqlglot.expressions.DefaultColumnConstraint": {"tf": 1}, "sqlglot.expressions.EncodeColumnConstraint": {"tf": 1}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"tf": 1}, "sqlglot.expressions.NotNullColumnConstraint": {"tf": 1}, "sqlglot.expressions.PrimaryKeyColumnConstraint": {"tf": 1}, "sqlglot.expressions.UniqueColumnConstraint": {"tf": 1}}, "df": 10}}}}}}}}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.TryCast": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Except": {"tf": 1}, "sqlglot.expressions.Intersect": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.UDTF": {"tf": 1}, "sqlglot.expressions.Subqueryable": {"tf": 1}, "sqlglot.expressions.Subquery": {"tf": 1}}, "df": 3}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.BitwiseNot": {"tf": 1}, "sqlglot.expressions.Not": {"tf": 1}, "sqlglot.expressions.Paren": {"tf": 1}, "sqlglot.expressions.Neg": {"tf": 1}}, "df": 4}}}}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.expressions.Lateral": {"tf": 1}, "sqlglot.expressions.Unnest": {"tf": 1}, "sqlglot.expressions.Values": {"tf": 1}}, "df": 3}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Cluster": {"tf": 1}, "sqlglot.expressions.Distribute": {"tf": 1}, "sqlglot.expressions.Sort": {"tf": 1}}, "df": 3}}}}}, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.AggFunc": {"tf": 1}, "sqlglot.expressions.Abs": {"tf": 1}, "sqlglot.expressions.Anonymous": {"tf": 1}, "sqlglot.expressions.Array": {"tf": 1}, "sqlglot.expressions.GenerateSeries": {"tf": 1}, "sqlglot.expressions.ArrayAll": {"tf": 1}, "sqlglot.expressions.ArrayAny": {"tf": 1}, "sqlglot.expressions.ArrayConcat": {"tf": 1}, "sqlglot.expressions.ArrayContains": {"tf": 1}, "sqlglot.expressions.ArrayFilter": {"tf": 1}, "sqlglot.expressions.ArraySize": {"tf": 1}, "sqlglot.expressions.ArraySort": {"tf": 1}, "sqlglot.expressions.ArraySum": {"tf": 1}, "sqlglot.expressions.Case": {"tf": 1}, "sqlglot.expressions.Cast": {"tf": 1}, "sqlglot.expressions.Ceil": {"tf": 1}, "sqlglot.expressions.Coalesce": {"tf": 1}, "sqlglot.expressions.Concat": {"tf": 1}, "sqlglot.expressions.CurrentDate": {"tf": 1}, "sqlglot.expressions.CurrentDatetime": {"tf": 1}, "sqlglot.expressions.CurrentTime": {"tf": 1}, "sqlglot.expressions.CurrentTimestamp": {"tf": 1}, "sqlglot.expressions.DateAdd": {"tf": 1}, "sqlglot.expressions.DateSub": {"tf": 1}, "sqlglot.expressions.DateDiff": {"tf": 1}, "sqlglot.expressions.DateTrunc": {"tf": 1}, "sqlglot.expressions.DatetimeAdd": {"tf": 1}, "sqlglot.expressions.DatetimeSub": {"tf": 1}, "sqlglot.expressions.DatetimeDiff": {"tf": 1}, "sqlglot.expressions.DatetimeTrunc": {"tf": 1}, "sqlglot.expressions.DayOfWeek": {"tf": 1}, "sqlglot.expressions.DayOfMonth": {"tf": 1}, "sqlglot.expressions.DayOfYear": {"tf": 1}, "sqlglot.expressions.WeekOfYear": {"tf": 1}, "sqlglot.expressions.LastDateOfMonth": {"tf": 1}, "sqlglot.expressions.Extract": {"tf": 1}, "sqlglot.expressions.TimestampAdd": {"tf": 1}, "sqlglot.expressions.TimestampSub": {"tf": 1}, "sqlglot.expressions.TimestampDiff": {"tf": 1}, "sqlglot.expressions.TimestampTrunc": {"tf": 1}, "sqlglot.expressions.TimeAdd": {"tf": 1}, "sqlglot.expressions.TimeSub": {"tf": 1}, "sqlglot.expressions.TimeDiff": {"tf": 1}, "sqlglot.expressions.TimeTrunc": {"tf": 1}, "sqlglot.expressions.DateFromParts": {"tf": 1}, "sqlglot.expressions.DateStrToDate": {"tf": 1}, "sqlglot.expressions.DateToDateStr": {"tf": 1}, "sqlglot.expressions.DateToDi": {"tf": 1}, "sqlglot.expressions.Day": {"tf": 1}, "sqlglot.expressions.Decode": {"tf": 1}, "sqlglot.expressions.DiToDate": {"tf": 1}, "sqlglot.expressions.Encode": {"tf": 1}, "sqlglot.expressions.Exp": {"tf": 1}, "sqlglot.expressions.Explode": {"tf": 1}, "sqlglot.expressions.Floor": {"tf": 1}, "sqlglot.expressions.Greatest": {"tf": 1}, "sqlglot.expressions.GroupConcat": {"tf": 1}, "sqlglot.expressions.Hex": {"tf": 1}, "sqlglot.expressions.If": {"tf": 1}, "sqlglot.expressions.IfNull": {"tf": 1}, "sqlglot.expressions.Initcap": {"tf": 1}, "sqlglot.expressions.JSONExtract": {"tf": 1}, "sqlglot.expressions.Least": {"tf": 1}, "sqlglot.expressions.Length": {"tf": 1}, "sqlglot.expressions.Levenshtein": {"tf": 1}, "sqlglot.expressions.Ln": {"tf": 1}, "sqlglot.expressions.Log": {"tf": 1}, "sqlglot.expressions.Log2": {"tf": 1}, "sqlglot.expressions.Log10": {"tf": 1}, "sqlglot.expressions.Lower": {"tf": 1}, "sqlglot.expressions.Map": {"tf": 1}, "sqlglot.expressions.VarMap": {"tf": 1}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.expressions.Month": {"tf": 1}, "sqlglot.expressions.Nvl2": {"tf": 1}, "sqlglot.expressions.Posexplode": {"tf": 1}, "sqlglot.expressions.Pow": {"tf": 1}, "sqlglot.expressions.ReadCSV": {"tf": 1}, "sqlglot.expressions.Reduce": {"tf": 1}, "sqlglot.expressions.RegexpLike": {"tf": 1}, "sqlglot.expressions.RegexpILike": {"tf": 1}, "sqlglot.expressions.RegexpSplit": {"tf": 1}, "sqlglot.expressions.Repeat": {"tf": 1}, "sqlglot.expressions.Round": {"tf": 1}, "sqlglot.expressions.RowNumber": {"tf": 1}, "sqlglot.expressions.SafeDivide": {"tf": 1}, "sqlglot.expressions.SortArray": {"tf": 1}, "sqlglot.expressions.Split": {"tf": 1}, "sqlglot.expressions.Substring": {"tf": 1}, "sqlglot.expressions.StrPosition": {"tf": 1}, "sqlglot.expressions.StrToDate": {"tf": 1}, "sqlglot.expressions.StrToTime": {"tf": 1}, "sqlglot.expressions.StrToUnix": {"tf": 1}, "sqlglot.expressions.NumberToStr": {"tf": 1}, "sqlglot.expressions.Struct": {"tf": 1}, "sqlglot.expressions.StructExtract": {"tf": 1}, "sqlglot.expressions.Sqrt": {"tf": 1}, "sqlglot.expressions.TimeToStr": {"tf": 1}, "sqlglot.expressions.TimeToTimeStr": {"tf": 1}, "sqlglot.expressions.TimeToUnix": {"tf": 1}, "sqlglot.expressions.TimeStrToDate": {"tf": 1}, "sqlglot.expressions.TimeStrToTime": {"tf": 1}, "sqlglot.expressions.TimeStrToUnix": {"tf": 1}, "sqlglot.expressions.Trim": {"tf": 1}, "sqlglot.expressions.TsOrDsAdd": {"tf": 1}, "sqlglot.expressions.TsOrDsToDateStr": {"tf": 1}, "sqlglot.expressions.TsOrDsToDate": {"tf": 1}, "sqlglot.expressions.TsOrDiToDi": {"tf": 1}, "sqlglot.expressions.Unhex": {"tf": 1}, "sqlglot.expressions.UnixToStr": {"tf": 1}, "sqlglot.expressions.UnixToTime": {"tf": 1}, "sqlglot.expressions.UnixToTimeStr": {"tf": 1}, "sqlglot.expressions.Upper": {"tf": 1}, "sqlglot.expressions.Week": {"tf": 1}, "sqlglot.expressions.Year": {"tf": 1}, "sqlglot.expressions.When": {"tf": 1}}, "df": 116}}}}, "j": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.JSONExtractScalar": {"tf": 1}, "sqlglot.expressions.JSONBExtract": {"tf": 1}, "sqlglot.expressions.JSONBExtractScalar": {"tf": 1}}, "df": 3}}}}}}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.ApproxQuantile": {"tf": 1}}, "df": 1}}}}}}}}}}, "doc": {"root": {"0": {"0": {"0": {"9": {"9": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "1": {"0": {"7": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "9": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "3": {"6": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "3": {"4": {"2": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "6": {"2": {"5": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "5": {"2": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "1": {"0": {"5": {"4": {"5": {"5": {"2": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "1": {"2": {"6": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "6": {"8": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "3": {"0": {"8": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "9": {"9": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1.7320508075688772}}, "df": 1, "/": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}}}}}}, "2": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}, "3": {"2": {"8": {"0": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"1": {"7": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "6": {"9": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "4": {"4": {"1": {"0": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"5": {"8": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "6": {"6": {"7": {"1": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "7": {"6": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "8": {"0": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "5": {"4": {"3": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 6.48074069840786}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 4.47213595499958}, "sqlglot.executor": {"tf": 2}, "sqlglot.expressions.Expression.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Star.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Alias.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cast.output_name": {"tf": 1.7320508075688772}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 2}, "sqlglot.trie.in_trie": {"tf": 2.23606797749979}}, "df": 38, "/": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "1": {"0": {"0": {"0": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "docs": {}, "df": 0}, "2": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "b": {"1": {"4": {"2": {"0": {"0": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"0": {"4": {"0": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}}}}}}}}}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}, "4": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}}, "df": 4, "^": {"1": {"2": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "1": {"4": {"5": {"docs": {}, "df": 0, "/": {"2": {"6": {"4": {"2": {"9": {"3": {"7": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "2": {"2": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "3": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}, "6": {"3": {"2": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "3": {"1": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "4": {"1": {"3": {"4": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "5": {"1": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}, "7": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "6": {"1": {"8": {"0": {"8": {"8": {"0": {"2": {"8": {"2": {"9": {"5": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "7": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "8": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "9": {"8": {"6": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "9": {"6": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {"sqlglot": {"tf": 6}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.diff": {"tf": 4}, "sqlglot.executor": {"tf": 3.7416573867739413}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 2}, "sqlglot.expressions.Condition.or_": {"tf": 2}, "sqlglot.expressions.Condition.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 2}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 2.449489742783178}, "sqlglot.expressions.and_": {"tf": 2.449489742783178}, "sqlglot.expressions.or_": {"tf": 2.449489742783178}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 2}, "sqlglot.helper.dict_depth": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 2.23606797749979}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 43, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 2}}}, "2": {"0": {"0": {"7": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "1": {"4": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "2": {"1": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "2": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}, "4": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "5": {"1": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "5": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "6": {"4": {"2": {"9": {"8": {"2": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "6": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 2}, "9": {"4": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 3.3166247903554}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 4.358898943540674}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 2}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 43}, "3": {"1": {"3": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "2": {"4": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "3": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "4": {"docs": {"sqlglot.dataframe": {"tf": 2.449489742783178}}, "df": 1}, "7": {"7": {"7": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "9": {"docs": {"sqlglot": {"tf": 6.855654600401044}, "sqlglot.dataframe": {"tf": 7.0710678118654755}, "sqlglot.dialects": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Column.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Identifier.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Literal.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.where": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 2.8284271247461903}, "sqlglot.expressions.Subquery.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Star.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Alias.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Cast.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 2}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 2}, "sqlglot.expressions.alias_": {"tf": 4}, "sqlglot.expressions.subquery": {"tf": 2.8284271247461903}, "sqlglot.expressions.cast": {"tf": 2.449489742783178}, "sqlglot.expressions.values": {"tf": 2}, "sqlglot.expressions.column_table_names": {"tf": 2}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 2}, "sqlglot.helper.split_num_words": {"tf": 3.4641016151377544}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 2}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 2}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 2.8284271247461903}, "sqlglot.optimizer.simplify.simplify": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 3.7416573867739413}, "sqlglot.trie.in_trie": {"tf": 2.8284271247461903}}, "df": 82}, "docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 2}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 48}, "4": {"0": {"0": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "3": {"4": {"3": {"4": {"1": {"6": {"6": {"2": {"4": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "7": {"9": {"8": {"3": {"1": {"3": {"6": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "4": {"6": {"2": {"4": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "5": {"2": {"9": {"6": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "6": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}, "8": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}, "9": {"3": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 26}, "5": {"0": {"4": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}, "3": {"1": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.func": {"tf": 2}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}}, "df": 7}, "6": {"0": {"6": {"2": {"6": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "1": {"4": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 2.23606797749979}}, "df": 2, "m": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "7": {"0": {"4": {"3": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "2": {"5": {"docs": {}, "df": 0, "\u2013": {"7": {"4": {"3": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}, "6": {"7": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "9": {"1": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "2": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1}}, "df": 1}, "8": {"0": {"5": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}, "9": {"3": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}, "9": {"0": {"6": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "7": {"0": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "8": {"7": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {"sqlglot": {"tf": 61.318838867023565}, "sqlglot.pretty": {"tf": 1.7320508075688772}, "sqlglot.schema": {"tf": 1.7320508075688772}, "sqlglot.parse": {"tf": 5.916079783099616}, "sqlglot.parse_one": {"tf": 6.324555320336759}, "sqlglot.transpile": {"tf": 7.211102550927978}, "sqlglot.dataframe": {"tf": 48.86716689148246}, "sqlglot.dataframe.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.table": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.createDataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.SparkSession.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.copy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.select": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.alias": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.where": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.filter": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.groupBy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.agg": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.join": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.DataFrame.union": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.unionAll": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.unionByName": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.intersect": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.intersectAll": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.exceptAll": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.distinct": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.dropDuplicates": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.dropna": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 2.6457513110645907}, "sqlglot.dataframe.sql.DataFrame.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.withColumn": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.withColumnRenamed": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.drop": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.limit": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.hint": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.repartition": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.coalesce": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.cache": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 2}, "sqlglot.dataframe.sql.GroupedData": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.agg": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.count": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.mean": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.avg": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.max": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.min": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.sum": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.GroupedData.pivot": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.ensure_col": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.ensure_cols": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.invoke_anonymous_function": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.invoke_expression_over_column": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.binary_op": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.inverse_binary_op": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.unary_op": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.ensure_literal": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.copy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.set_table_name": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.alias": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.asc": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.desc": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.asc_nulls_first": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.asc_nulls_last": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.desc_nulls_first": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.desc_nulls_last": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.when": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.otherwise": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.isNull": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.isNotNull": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.startswith": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.endswith": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.rlike": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.like": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.ilike": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.substr": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.isin": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.between": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.over": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.drop": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.fill": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameNaFunctions.replace": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.partitionBy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.orderBy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.rowsBetween": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Window.rangeBetween": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.copy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.partitionBy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.orderBy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.rowsBetween": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.WindowSpec.rangeBetween": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameReader": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameReader.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameReader.table": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.__init__": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.copy": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.sql": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.mode": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.insertInto": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrameWriter.saveAsTable": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 21.817424229271428}, "sqlglot.dialects.bigquery": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.bigquery.BigQuery.Generator.array_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.transaction_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.commit_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.rollback_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.in_unnest_op": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.except_op": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator.intersect_op": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.clickhouse.ClickHouse.Generator.cte_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.dialect": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.DIALECT": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.BIGQUERY": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.CLICKHOUSE": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.DUCKDB": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.HIVE": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.MYSQL": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.ORACLE": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.POSTGRES": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.PRESTO": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.REDSHIFT": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.SNOWFLAKE": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.SPARK": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.SQLITE": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.STARROCKS": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.TABLEAU": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.TRINO": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.TSQL": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.DATABRICKS": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.DRILL": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialects.TERADATA": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.get_or_raise": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.format_time": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.parse": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.parse_into": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.generate": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.transpile": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.Dialect.generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.rename_func": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.approx_count_distinct_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.if_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.arrow_json_extract_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.arrow_json_extract_scalar_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.inline_array_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_ilike_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_paren_current_date_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_recursive_cte_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_safe_divide_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_tablesample_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_pivot_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_trycast_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.no_properties_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.str_position_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.struct_extract_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.var_map_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 5.744562646538029}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.parse_date_delta": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.locate_to_strposition": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.strposition_to_locate_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.timestrtotime_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.datestrtodate_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.trim_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.if_sql": {"tf": 4.47213595499958}, "sqlglot.dialects.drill.Drill": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.drill.Drill.Generator.normalize_func": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.hive": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.hive.Hive.Generator.with_properties": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator.datatype_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.mysql.MySQL.Generator.show_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator.setitem_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator.set_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.oracle.Oracle.Generator.query_modifiers": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator.offset_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator.table_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.presto": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.presto.Presto.Generator.transaction_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.redshift.Redshift.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 3.3166247903554}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 4.47213595499958}, "sqlglot.dialects.snowflake": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.snowflake.Snowflake.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.snowflake.Snowflake.Generator.except_op": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.intersect_op": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 2.8284271247461903}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.8284271247461903}, "sqlglot.dialects.snowflake.Snowflake.Generator.describe_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.spark.Spark.Generator.cast_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.sqlite.SQLite.Generator.transaction_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.tableau": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.teradata": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.teradata.Teradata.Generator.partitionedbyproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator.update_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.trino.Trino.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.generate_date_delta_with_unit_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.__init__": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 6.082762530298219}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 11.40175425099138}, "sqlglot.dialects.tsql.TSQL.Generator.systemtime_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator.returnsproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 50.556898639058154}, "sqlglot.diff.Insert": {"tf": 1.4142135623730951}, "sqlglot.diff.Insert.__init__": {"tf": 1.7320508075688772}, "sqlglot.diff.Remove": {"tf": 1.4142135623730951}, "sqlglot.diff.Remove.__init__": {"tf": 1.7320508075688772}, "sqlglot.diff.Move": {"tf": 1.4142135623730951}, "sqlglot.diff.Move.__init__": {"tf": 1.7320508075688772}, "sqlglot.diff.Update": {"tf": 1.4142135623730951}, "sqlglot.diff.Update.__init__": {"tf": 1.7320508075688772}, "sqlglot.diff.Keep": {"tf": 1.4142135623730951}, "sqlglot.diff.Keep.__init__": {"tf": 1.7320508075688772}, "sqlglot.diff.diff": {"tf": 11.045361017187261}, "sqlglot.diff.ChangeDistiller": {"tf": 2.6457513110645907}, "sqlglot.diff.ChangeDistiller.__init__": {"tf": 1.7320508075688772}, "sqlglot.diff.ChangeDistiller.diff": {"tf": 1.7320508075688772}, "sqlglot.errors": {"tf": 1.7320508075688772}, "sqlglot.errors.ErrorLevel": {"tf": 1.7320508075688772}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1.7320508075688772}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1.7320508075688772}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1.7320508075688772}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1.7320508075688772}, "sqlglot.errors.SqlglotError": {"tf": 1.7320508075688772}, "sqlglot.errors.UnsupportedError": {"tf": 1.7320508075688772}, "sqlglot.errors.ParseError": {"tf": 1.7320508075688772}, "sqlglot.errors.ParseError.__init__": {"tf": 1.7320508075688772}, "sqlglot.errors.ParseError.new": {"tf": 1.7320508075688772}, "sqlglot.errors.TokenError": {"tf": 1.7320508075688772}, "sqlglot.errors.OptimizeError": {"tf": 1.7320508075688772}, "sqlglot.errors.SchemaError": {"tf": 1.7320508075688772}, "sqlglot.errors.ExecuteError": {"tf": 1.7320508075688772}, "sqlglot.errors.concat_messages": {"tf": 1.7320508075688772}, "sqlglot.errors.merge_errors": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 35.11409973215888}, "sqlglot.executor.execute": {"tf": 7}, "sqlglot.executor.context": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context": {"tf": 3}, "sqlglot.executor.context.Context.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.eval": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.eval_tuple": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.add_columns": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.table_iter": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.filter": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.sort": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.set_row": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.set_index": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context.set_range": {"tf": 1.7320508075688772}, "sqlglot.executor.env": {"tf": 1.7320508075688772}, "sqlglot.executor.env.reverse_key": {"tf": 1.7320508075688772}, "sqlglot.executor.env.reverse_key.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.env.filter_nulls": {"tf": 1.7320508075688772}, "sqlglot.executor.env.null_if_any": {"tf": 4.58257569495584}, "sqlglot.executor.env.str_position": {"tf": 1.7320508075688772}, "sqlglot.executor.env.substring": {"tf": 1.7320508075688772}, "sqlglot.executor.env.cast": {"tf": 1.7320508075688772}, "sqlglot.executor.env.ordered": {"tf": 1.7320508075688772}, "sqlglot.executor.env.interval": {"tf": 1.7320508075688772}, "sqlglot.executor.python": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.execute": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.context": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.table": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.scan": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.static": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.scan_table": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.scan_csv": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.join": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.nested_loop_join": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.hash_join": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.aggregate": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.sort": {"tf": 1.7320508075688772}, "sqlglot.executor.python.PythonExecutor.set_operation": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 11.40175425099138}, "sqlglot.executor.table": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Table": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Table.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Table.add_columns": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Table.append": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Table.pop": {"tf": 1.7320508075688772}, "sqlglot.executor.table.TableIter": {"tf": 1.7320508075688772}, "sqlglot.executor.table.TableIter.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.table.RangeReader": {"tf": 1.7320508075688772}, "sqlglot.executor.table.RangeReader.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.table.RowReader": {"tf": 1.7320508075688772}, "sqlglot.executor.table.RowReader.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Tables": {"tf": 4}, "sqlglot.executor.table.ensure_tables": {"tf": 1.7320508075688772}, "sqlglot.expressions": {"tf": 4}, "sqlglot.expressions.Expression": {"tf": 10.954451150103322}, "sqlglot.expressions.Expression.__init__": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.this": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.expressions": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.text": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.is_string": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.is_number": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.is_int": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.alias": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.Expression.copy": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.append": {"tf": 4.358898943540674}, "sqlglot.expressions.Expression.set": {"tf": 4.898979485566356}, "sqlglot.expressions.Expression.depth": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find": {"tf": 4.898979485566356}, "sqlglot.expressions.Expression.find_all": {"tf": 4.898979485566356}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 4.898979485566356}, "sqlglot.expressions.Expression.parent_select": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.walk": {"tf": 5.5677643628300215}, "sqlglot.expressions.Expression.dfs": {"tf": 3.4641016151377544}, "sqlglot.expressions.Expression.bfs": {"tf": 3.4641016151377544}, "sqlglot.expressions.Expression.unnest": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.unalias": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.flatten": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.sql": {"tf": 5.477225575051661}, "sqlglot.expressions.Expression.transform": {"tf": 5.477225575051661}, "sqlglot.expressions.Expression.replace": {"tf": 5.5677643628300215}, "sqlglot.expressions.Expression.pop": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.assert_is": {"tf": 9.643650760992955}, "sqlglot.expressions.Expression.error_messages": {"tf": 4.795831523312719}, "sqlglot.expressions.Expression.dump": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.load": {"tf": 2.23606797749979}, "sqlglot.expressions.Condition": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.and_": {"tf": 9.746794344808963}, "sqlglot.expressions.Condition.or_": {"tf": 9.746794344808963}, "sqlglot.expressions.Condition.not_": {"tf": 7.874007874011811}, "sqlglot.expressions.Predicate": {"tf": 1.7320508075688772}, "sqlglot.expressions.DerivedTable": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.union": {"tf": 10.723805294763608}, "sqlglot.expressions.Unionable.intersect": {"tf": 10.677078252031311}, "sqlglot.expressions.Unionable.except_": {"tf": 10.723805294763608}, "sqlglot.expressions.UDTF": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cache": {"tf": 1.7320508075688772}, "sqlglot.expressions.Uncache": {"tf": 1.7320508075688772}, "sqlglot.expressions.Create": {"tf": 1.7320508075688772}, "sqlglot.expressions.Describe": {"tf": 1.7320508075688772}, "sqlglot.expressions.Set": {"tf": 1.7320508075688772}, "sqlglot.expressions.SetItem": {"tf": 1.7320508075688772}, "sqlglot.expressions.Show": {"tf": 1.7320508075688772}, "sqlglot.expressions.UserDefinedFunction": {"tf": 1.7320508075688772}, "sqlglot.expressions.UserDefinedFunctionKwarg": {"tf": 1.7320508075688772}, "sqlglot.expressions.CharacterSet": {"tf": 1.7320508075688772}, "sqlglot.expressions.With": {"tf": 1.7320508075688772}, "sqlglot.expressions.WithinGroup": {"tf": 1.7320508075688772}, "sqlglot.expressions.CTE": {"tf": 1.7320508075688772}, "sqlglot.expressions.TableAlias": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitString": {"tf": 1.7320508075688772}, "sqlglot.expressions.HexString": {"tf": 1.7320508075688772}, "sqlglot.expressions.ByteString": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.ColumnDef": {"tf": 1.7320508075688772}, "sqlglot.expressions.AlterColumn": {"tf": 1.7320508075688772}, "sqlglot.expressions.RenameTable": {"tf": 1.7320508075688772}, "sqlglot.expressions.ColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.ColumnConstraintKind": {"tf": 1.7320508075688772}, "sqlglot.expressions.AutoIncrementColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.CheckColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.CollateColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.CommentColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.DefaultColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.EncodeColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.GeneratedAsIdentityColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.NotNullColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.PrimaryKeyColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.UniqueColumnConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.Constraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.Delete": {"tf": 1.7320508075688772}, "sqlglot.expressions.Drop": {"tf": 1.7320508075688772}, "sqlglot.expressions.Filter": {"tf": 1.7320508075688772}, "sqlglot.expressions.Check": {"tf": 1.7320508075688772}, "sqlglot.expressions.Directory": {"tf": 1.7320508075688772}, "sqlglot.expressions.ForeignKey": {"tf": 1.7320508075688772}, "sqlglot.expressions.PrimaryKey": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unique": {"tf": 1.7320508075688772}, "sqlglot.expressions.Into": {"tf": 1.7320508075688772}, "sqlglot.expressions.From": {"tf": 1.7320508075688772}, "sqlglot.expressions.Having": {"tf": 1.7320508075688772}, "sqlglot.expressions.Hint": {"tf": 1.7320508075688772}, "sqlglot.expressions.JoinHint": {"tf": 1.7320508075688772}, "sqlglot.expressions.Identifier": {"tf": 1.7320508075688772}, "sqlglot.expressions.Identifier.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.Index": {"tf": 1.7320508075688772}, "sqlglot.expressions.Insert": {"tf": 1.7320508075688772}, "sqlglot.expressions.Introducer": {"tf": 1.7320508075688772}, "sqlglot.expressions.National": {"tf": 1.7320508075688772}, "sqlglot.expressions.LoadData": {"tf": 1.7320508075688772}, "sqlglot.expressions.Partition": {"tf": 1.7320508075688772}, "sqlglot.expressions.Fetch": {"tf": 1.7320508075688772}, "sqlglot.expressions.Group": {"tf": 1.7320508075688772}, "sqlglot.expressions.Lambda": {"tf": 1.7320508075688772}, "sqlglot.expressions.Limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.number": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.string": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.Join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Join.on": {"tf": 11.40175425099138}, "sqlglot.expressions.Join.using": {"tf": 11.704699910719626}, "sqlglot.expressions.Lateral": {"tf": 1.7320508075688772}, "sqlglot.expressions.MatchRecognize": {"tf": 1.7320508075688772}, "sqlglot.expressions.Final": {"tf": 1.7320508075688772}, "sqlglot.expressions.Offset": {"tf": 1.7320508075688772}, "sqlglot.expressions.Order": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cluster": {"tf": 1.7320508075688772}, "sqlglot.expressions.Distribute": {"tf": 1.7320508075688772}, "sqlglot.expressions.Sort": {"tf": 1.7320508075688772}, "sqlglot.expressions.Ordered": {"tf": 1.7320508075688772}, "sqlglot.expressions.Property": {"tf": 1.7320508075688772}, "sqlglot.expressions.AlgorithmProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.DefinerProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.SqlSecurityProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.TableFormatProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.PartitionedByProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.FileFormatProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.DistKeyProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.SortKeyProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.DistStyleProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.LikeProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.LocationProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.EngineProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.AutoIncrementProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.CharacterSetProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.CollateProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.SchemaCommentProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.ReturnsProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.LanguageProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.ExecuteAsProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.VolatilityProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.RowFormatDelimitedProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.RowFormatSerdeProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.SerdeProperties": {"tf": 1.7320508075688772}, "sqlglot.expressions.FallbackProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.WithJournalTableProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.LogProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.JournalProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.AfterJournalProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.ChecksumProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.FreespaceProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.MergeBlockRatioProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataBlocksizeProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.BlockCompressionProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.IsolatedLoadingProperty": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location.POST_CREATE": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location.PRE_SCHEMA": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location.POST_INDEX": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_ROOT": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location.POST_SCHEMA_WITH": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.Location.UNSUPPORTED": {"tf": 1.7320508075688772}, "sqlglot.expressions.Properties.from_dict": {"tf": 1.7320508075688772}, "sqlglot.expressions.Qualify": {"tf": 1.7320508075688772}, "sqlglot.expressions.Return": {"tf": 1.7320508075688772}, "sqlglot.expressions.Reference": {"tf": 1.7320508075688772}, "sqlglot.expressions.Tuple": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 11.832159566199232}, "sqlglot.expressions.Subqueryable.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.with_": {"tf": 12.767145334803704}, "sqlglot.expressions.Table": {"tf": 1.7320508075688772}, "sqlglot.expressions.SystemTime": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 11.090536506409418}, "sqlglot.expressions.Except": {"tf": 1.7320508075688772}, "sqlglot.expressions.Intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unnest": {"tf": 1.7320508075688772}, "sqlglot.expressions.Update": {"tf": 1.7320508075688772}, "sqlglot.expressions.Values": {"tf": 1.7320508075688772}, "sqlglot.expressions.Var": {"tf": 1.7320508075688772}, "sqlglot.expressions.Schema": {"tf": 1.7320508075688772}, "sqlglot.expressions.Lock": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.from_": {"tf": 11.135528725660043}, "sqlglot.expressions.Select.group_by": {"tf": 11.958260743101398}, "sqlglot.expressions.Select.order_by": {"tf": 11.704699910719626}, "sqlglot.expressions.Select.sort_by": {"tf": 11.704699910719626}, "sqlglot.expressions.Select.cluster_by": {"tf": 11.704699910719626}, "sqlglot.expressions.Select.limit": {"tf": 11.224972160321824}, "sqlglot.expressions.Select.offset": {"tf": 11.224972160321824}, "sqlglot.expressions.Select.select": {"tf": 10.535653752852738}, "sqlglot.expressions.Select.lateral": {"tf": 11.445523142259598}, "sqlglot.expressions.Select.join": {"tf": 19.026297590440446}, "sqlglot.expressions.Select.where": {"tf": 11.445523142259598}, "sqlglot.expressions.Select.having": {"tf": 12.288205727444508}, "sqlglot.expressions.Select.window": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.distinct": {"tf": 10.04987562112089}, "sqlglot.expressions.Select.ctas": {"tf": 11.357816691600547}, "sqlglot.expressions.Select.lock": {"tf": 14.696938456699069}, "sqlglot.expressions.Subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subquery.unnest": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subquery.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.TableSample": {"tf": 1.7320508075688772}, "sqlglot.expressions.Tag": {"tf": 2.23606797749979}, "sqlglot.expressions.Pivot": {"tf": 1.7320508075688772}, "sqlglot.expressions.Window": {"tf": 1.7320508075688772}, "sqlglot.expressions.WindowSpec": {"tf": 1.7320508075688772}, "sqlglot.expressions.Where": {"tf": 1.7320508075688772}, "sqlglot.expressions.Star": {"tf": 1.7320508075688772}, "sqlglot.expressions.Star.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.Parameter": {"tf": 1.7320508075688772}, "sqlglot.expressions.SessionParameter": {"tf": 1.7320508075688772}, "sqlglot.expressions.Placeholder": {"tf": 1.7320508075688772}, "sqlglot.expressions.Null": {"tf": 1.7320508075688772}, "sqlglot.expressions.Boolean": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.CHAR": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.NCHAR": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.VARCHAR": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.NVARCHAR": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.TEXT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.MEDIUMTEXT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.LONGTEXT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.MEDIUMBLOB": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.LONGBLOB": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.BINARY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.VARBINARY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.INT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.TINYINT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.SMALLINT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.BIGINT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.FLOAT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.DOUBLE": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.DECIMAL": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.BOOLEAN": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.JSON": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.JSONB": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.INTERVAL": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.TIME": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.TIMESTAMP": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.TIMESTAMPTZ": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.TIMESTAMPLTZ": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.DATE": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.DATETIME": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.ARRAY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.MAP": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.UUID": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.GEOGRAPHY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.GEOMETRY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.STRUCT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.NULLABLE": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.HLLSKETCH": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.HSTORE": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.SUPER": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.SERIAL": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.SMALLSERIAL": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.BIGSERIAL": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.XML": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.UNIQUEIDENTIFIER": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.MONEY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.SMALLMONEY": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.ROWVERSION": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.IMAGE": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.VARIANT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.OBJECT": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.NULL": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.Type.UNKNOWN": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.build": {"tf": 1.7320508075688772}, "sqlglot.expressions.DataType.is_type": {"tf": 1.7320508075688772}, "sqlglot.expressions.PseudoType": {"tf": 1.7320508075688772}, "sqlglot.expressions.StructKwarg": {"tf": 1.7320508075688772}, "sqlglot.expressions.SubqueryPredicate": {"tf": 1.7320508075688772}, "sqlglot.expressions.All": {"tf": 1.7320508075688772}, "sqlglot.expressions.Any": {"tf": 1.7320508075688772}, "sqlglot.expressions.Exists": {"tf": 1.7320508075688772}, "sqlglot.expressions.Command": {"tf": 1.7320508075688772}, "sqlglot.expressions.Transaction": {"tf": 1.7320508075688772}, "sqlglot.expressions.Commit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Rollback": {"tf": 1.7320508075688772}, "sqlglot.expressions.AlterTable": {"tf": 1.7320508075688772}, "sqlglot.expressions.AddConstraint": {"tf": 1.7320508075688772}, "sqlglot.expressions.DropPartition": {"tf": 1.7320508075688772}, "sqlglot.expressions.Binary": {"tf": 1.7320508075688772}, "sqlglot.expressions.Add": {"tf": 1.7320508075688772}, "sqlglot.expressions.Connector": {"tf": 1.7320508075688772}, "sqlglot.expressions.And": {"tf": 1.7320508075688772}, "sqlglot.expressions.Or": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitwiseAnd": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitwiseLeftShift": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitwiseOr": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitwiseRightShift": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitwiseXor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Div": {"tf": 1.7320508075688772}, "sqlglot.expressions.Dot": {"tf": 1.7320508075688772}, "sqlglot.expressions.DPipe": {"tf": 1.7320508075688772}, "sqlglot.expressions.EQ": {"tf": 1.7320508075688772}, "sqlglot.expressions.NullSafeEQ": {"tf": 1.7320508075688772}, "sqlglot.expressions.NullSafeNEQ": {"tf": 1.7320508075688772}, "sqlglot.expressions.Distance": {"tf": 1.7320508075688772}, "sqlglot.expressions.Escape": {"tf": 1.7320508075688772}, "sqlglot.expressions.Glob": {"tf": 1.7320508075688772}, "sqlglot.expressions.GT": {"tf": 1.7320508075688772}, "sqlglot.expressions.GTE": {"tf": 1.7320508075688772}, "sqlglot.expressions.ILike": {"tf": 1.7320508075688772}, "sqlglot.expressions.IntDiv": {"tf": 1.7320508075688772}, "sqlglot.expressions.Is": {"tf": 1.7320508075688772}, "sqlglot.expressions.Kwarg": {"tf": 1.7320508075688772}, "sqlglot.expressions.Like": {"tf": 1.7320508075688772}, "sqlglot.expressions.LT": {"tf": 1.7320508075688772}, "sqlglot.expressions.LTE": {"tf": 1.7320508075688772}, "sqlglot.expressions.Mod": {"tf": 1.7320508075688772}, "sqlglot.expressions.Mul": {"tf": 1.7320508075688772}, "sqlglot.expressions.NEQ": {"tf": 1.7320508075688772}, "sqlglot.expressions.SimilarTo": {"tf": 1.7320508075688772}, "sqlglot.expressions.Slice": {"tf": 1.7320508075688772}, "sqlglot.expressions.Sub": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unary": {"tf": 1.7320508075688772}, "sqlglot.expressions.BitwiseNot": {"tf": 1.7320508075688772}, "sqlglot.expressions.Not": {"tf": 1.7320508075688772}, "sqlglot.expressions.Paren": {"tf": 1.7320508075688772}, "sqlglot.expressions.Neg": {"tf": 1.7320508075688772}, "sqlglot.expressions.Alias": {"tf": 1.7320508075688772}, "sqlglot.expressions.Alias.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.Aliases": {"tf": 1.7320508075688772}, "sqlglot.expressions.AtTimeZone": {"tf": 1.7320508075688772}, "sqlglot.expressions.Between": {"tf": 1.7320508075688772}, "sqlglot.expressions.Bracket": {"tf": 1.7320508075688772}, "sqlglot.expressions.Distinct": {"tf": 1.7320508075688772}, "sqlglot.expressions.In": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeUnit": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeUnit.__init__": {"tf": 1.7320508075688772}, "sqlglot.expressions.Interval": {"tf": 1.7320508075688772}, "sqlglot.expressions.IgnoreNulls": {"tf": 1.7320508075688772}, "sqlglot.expressions.RespectNulls": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func": {"tf": 4.69041575982343}, "sqlglot.expressions.Func.from_arg_list": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func.sql_names": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func.sql_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func.default_parser_mappings": {"tf": 1.7320508075688772}, "sqlglot.expressions.AggFunc": {"tf": 1.7320508075688772}, "sqlglot.expressions.Abs": {"tf": 1.7320508075688772}, "sqlglot.expressions.Anonymous": {"tf": 1.7320508075688772}, "sqlglot.expressions.ApproxDistinct": {"tf": 1.7320508075688772}, "sqlglot.expressions.Array": {"tf": 1.7320508075688772}, "sqlglot.expressions.GenerateSeries": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayAgg": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayAll": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayAny": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayConcat": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayContains": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayFilter": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArraySize": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArraySort": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArraySum": {"tf": 1.7320508075688772}, "sqlglot.expressions.ArrayUnionAgg": {"tf": 1.7320508075688772}, "sqlglot.expressions.Avg": {"tf": 1.7320508075688772}, "sqlglot.expressions.AnyValue": {"tf": 1.7320508075688772}, "sqlglot.expressions.Case": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cast": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cast.output_name": {"tf": 11.313708498984761}, "sqlglot.expressions.Cast.is_type": {"tf": 1.7320508075688772}, "sqlglot.expressions.Collate": {"tf": 1.7320508075688772}, "sqlglot.expressions.TryCast": {"tf": 1.7320508075688772}, "sqlglot.expressions.Ceil": {"tf": 1.7320508075688772}, "sqlglot.expressions.Coalesce": {"tf": 1.7320508075688772}, "sqlglot.expressions.Concat": {"tf": 1.7320508075688772}, "sqlglot.expressions.ConcatWs": {"tf": 1.7320508075688772}, "sqlglot.expressions.Count": {"tf": 1.7320508075688772}, "sqlglot.expressions.CurrentDate": {"tf": 1.7320508075688772}, "sqlglot.expressions.CurrentDatetime": {"tf": 1.7320508075688772}, "sqlglot.expressions.CurrentTime": {"tf": 1.7320508075688772}, "sqlglot.expressions.CurrentTimestamp": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateAdd": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateSub": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateDiff": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateTrunc": {"tf": 1.7320508075688772}, "sqlglot.expressions.DatetimeAdd": {"tf": 1.7320508075688772}, "sqlglot.expressions.DatetimeSub": {"tf": 1.7320508075688772}, "sqlglot.expressions.DatetimeDiff": {"tf": 1.7320508075688772}, "sqlglot.expressions.DatetimeTrunc": {"tf": 1.7320508075688772}, "sqlglot.expressions.DayOfWeek": {"tf": 1.7320508075688772}, "sqlglot.expressions.DayOfMonth": {"tf": 1.7320508075688772}, "sqlglot.expressions.DayOfYear": {"tf": 1.7320508075688772}, "sqlglot.expressions.WeekOfYear": {"tf": 1.7320508075688772}, "sqlglot.expressions.LastDateOfMonth": {"tf": 1.7320508075688772}, "sqlglot.expressions.Extract": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimestampAdd": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimestampSub": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimestampDiff": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimestampTrunc": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeAdd": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeSub": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeDiff": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeTrunc": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateFromParts": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateStrToDate": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateToDateStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.DateToDi": {"tf": 1.7320508075688772}, "sqlglot.expressions.Day": {"tf": 1.7320508075688772}, "sqlglot.expressions.Decode": {"tf": 1.7320508075688772}, "sqlglot.expressions.DiToDate": {"tf": 1.7320508075688772}, "sqlglot.expressions.Encode": {"tf": 1.7320508075688772}, "sqlglot.expressions.Exp": {"tf": 1.7320508075688772}, "sqlglot.expressions.Explode": {"tf": 1.7320508075688772}, "sqlglot.expressions.Floor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Greatest": {"tf": 1.7320508075688772}, "sqlglot.expressions.GroupConcat": {"tf": 1.7320508075688772}, "sqlglot.expressions.Hex": {"tf": 1.7320508075688772}, "sqlglot.expressions.If": {"tf": 1.7320508075688772}, "sqlglot.expressions.IfNull": {"tf": 1.7320508075688772}, "sqlglot.expressions.Initcap": {"tf": 1.7320508075688772}, "sqlglot.expressions.JSONBContains": {"tf": 1.7320508075688772}, "sqlglot.expressions.JSONExtract": {"tf": 1.7320508075688772}, "sqlglot.expressions.JSONExtractScalar": {"tf": 1.7320508075688772}, "sqlglot.expressions.JSONBExtract": {"tf": 1.7320508075688772}, "sqlglot.expressions.JSONBExtractScalar": {"tf": 1.7320508075688772}, "sqlglot.expressions.Least": {"tf": 1.7320508075688772}, "sqlglot.expressions.Length": {"tf": 1.7320508075688772}, "sqlglot.expressions.Levenshtein": {"tf": 1.7320508075688772}, "sqlglot.expressions.Ln": {"tf": 1.7320508075688772}, "sqlglot.expressions.Log": {"tf": 1.7320508075688772}, "sqlglot.expressions.Log2": {"tf": 1.7320508075688772}, "sqlglot.expressions.Log10": {"tf": 1.7320508075688772}, "sqlglot.expressions.LogicalOr": {"tf": 1.7320508075688772}, "sqlglot.expressions.Lower": {"tf": 1.7320508075688772}, "sqlglot.expressions.Map": {"tf": 1.7320508075688772}, "sqlglot.expressions.VarMap": {"tf": 1.7320508075688772}, "sqlglot.expressions.Matches": {"tf": 2.23606797749979}, "sqlglot.expressions.Max": {"tf": 1.7320508075688772}, "sqlglot.expressions.Min": {"tf": 1.7320508075688772}, "sqlglot.expressions.Month": {"tf": 1.7320508075688772}, "sqlglot.expressions.Nvl2": {"tf": 1.7320508075688772}, "sqlglot.expressions.Posexplode": {"tf": 1.7320508075688772}, "sqlglot.expressions.Pow": {"tf": 1.7320508075688772}, "sqlglot.expressions.PercentileCont": {"tf": 1.7320508075688772}, "sqlglot.expressions.PercentileDisc": {"tf": 1.7320508075688772}, "sqlglot.expressions.Quantile": {"tf": 1.7320508075688772}, "sqlglot.expressions.Quantiles": {"tf": 1.7320508075688772}, "sqlglot.expressions.QuantileIf": {"tf": 1.7320508075688772}, "sqlglot.expressions.ApproxQuantile": {"tf": 1.7320508075688772}, "sqlglot.expressions.ReadCSV": {"tf": 1.7320508075688772}, "sqlglot.expressions.Reduce": {"tf": 1.7320508075688772}, "sqlglot.expressions.RegexpLike": {"tf": 1.7320508075688772}, "sqlglot.expressions.RegexpILike": {"tf": 1.7320508075688772}, "sqlglot.expressions.RegexpSplit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Repeat": {"tf": 1.7320508075688772}, "sqlglot.expressions.Round": {"tf": 1.7320508075688772}, "sqlglot.expressions.RowNumber": {"tf": 1.7320508075688772}, "sqlglot.expressions.SafeDivide": {"tf": 1.7320508075688772}, "sqlglot.expressions.SetAgg": {"tf": 1.7320508075688772}, "sqlglot.expressions.SortArray": {"tf": 1.7320508075688772}, "sqlglot.expressions.Split": {"tf": 1.7320508075688772}, "sqlglot.expressions.Substring": {"tf": 1.7320508075688772}, "sqlglot.expressions.StrPosition": {"tf": 1.7320508075688772}, "sqlglot.expressions.StrToDate": {"tf": 1.7320508075688772}, "sqlglot.expressions.StrToTime": {"tf": 1.7320508075688772}, "sqlglot.expressions.StrToUnix": {"tf": 1.7320508075688772}, "sqlglot.expressions.NumberToStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.Struct": {"tf": 1.7320508075688772}, "sqlglot.expressions.StructExtract": {"tf": 1.7320508075688772}, "sqlglot.expressions.Sum": {"tf": 1.7320508075688772}, "sqlglot.expressions.Sqrt": {"tf": 1.7320508075688772}, "sqlglot.expressions.Stddev": {"tf": 1.7320508075688772}, "sqlglot.expressions.StddevPop": {"tf": 1.7320508075688772}, "sqlglot.expressions.StddevSamp": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeToStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeToTimeStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeToUnix": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeStrToDate": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeStrToTime": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeStrToUnix": {"tf": 1.7320508075688772}, "sqlglot.expressions.Trim": {"tf": 1.7320508075688772}, "sqlglot.expressions.TsOrDsAdd": {"tf": 1.7320508075688772}, "sqlglot.expressions.TsOrDsToDateStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.TsOrDsToDate": {"tf": 1.7320508075688772}, "sqlglot.expressions.TsOrDiToDi": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unhex": {"tf": 1.7320508075688772}, "sqlglot.expressions.UnixToStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.UnixToTime": {"tf": 1.7320508075688772}, "sqlglot.expressions.UnixToTimeStr": {"tf": 1.7320508075688772}, "sqlglot.expressions.Upper": {"tf": 1.7320508075688772}, "sqlglot.expressions.Variance": {"tf": 1.7320508075688772}, "sqlglot.expressions.VariancePop": {"tf": 1.7320508075688772}, "sqlglot.expressions.Week": {"tf": 1.7320508075688772}, "sqlglot.expressions.Year": {"tf": 1.7320508075688772}, "sqlglot.expressions.Use": {"tf": 1.7320508075688772}, "sqlglot.expressions.Merge": {"tf": 1.7320508075688772}, "sqlglot.expressions.When": {"tf": 1.7320508075688772}, "sqlglot.expressions.maybe_parse": {"tf": 9.899494936611665}, "sqlglot.expressions.union": {"tf": 10.344080432788601}, "sqlglot.expressions.intersect": {"tf": 10.344080432788601}, "sqlglot.expressions.except_": {"tf": 10.392304845413264}, "sqlglot.expressions.select": {"tf": 9.9498743710662}, "sqlglot.expressions.from_": {"tf": 9.9498743710662}, "sqlglot.expressions.update": {"tf": 12.12435565298214}, "sqlglot.expressions.delete": {"tf": 9.327379053088816}, "sqlglot.expressions.condition": {"tf": 13.92838827718412}, "sqlglot.expressions.and_": {"tf": 9.848857801796104}, "sqlglot.expressions.or_": {"tf": 9.848857801796104}, "sqlglot.expressions.not_": {"tf": 8.831760866327848}, "sqlglot.expressions.paren": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_identifier": {"tf": 5.291502622129181}, "sqlglot.expressions.to_interval": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_table": {"tf": 5.196152422706632}, "sqlglot.expressions.to_column": {"tf": 5.291502622129181}, "sqlglot.expressions.alias_": {"tf": 12.649110640673518}, "sqlglot.expressions.subquery": {"tf": 10.198039027185569}, "sqlglot.expressions.column": {"tf": 5.385164807134504}, "sqlglot.expressions.cast": {"tf": 8.888194417315589}, "sqlglot.expressions.table_": {"tf": 5.916079783099616}, "sqlglot.expressions.values": {"tf": 8.888194417315589}, "sqlglot.expressions.rename_table": {"tf": 4.898979485566356}, "sqlglot.expressions.convert": {"tf": 5}, "sqlglot.expressions.replace_children": {"tf": 2}, "sqlglot.expressions.column_table_names": {"tf": 8.48528137423857}, "sqlglot.expressions.table_name": {"tf": 9.797958971132712}, "sqlglot.expressions.replace_tables": {"tf": 10.44030650891055}, "sqlglot.expressions.replace_placeholders": {"tf": 11.575836902790225}, "sqlglot.expressions.expand": {"tf": 10.770329614269007}, "sqlglot.expressions.func": {"tf": 12.884098726725126}, "sqlglot.expressions.true": {"tf": 1.7320508075688772}, "sqlglot.expressions.false": {"tf": 1.7320508075688772}, "sqlglot.expressions.null": {"tf": 1.7320508075688772}, "sqlglot.generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 11.40175425099138}, "sqlglot.generator.Generator.__init__": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.generate": {"tf": 3}, "sqlglot.generator.Generator.unsupported": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.sep": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.seg": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.pad_comment": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.maybe_comment": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.wrap": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.no_identify": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.normalize_func": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.indent": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.uncache_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.cache_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.characterset_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.column_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.columndef_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.columnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.autoincrementcolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.checkcolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.commentcolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.collatecolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.encodecolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.defaultcolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.generatedasidentitycolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.notnullcolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.primarykeycolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.uniquecolumnconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.create_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.describe_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.prepend_ctes": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.with_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.cte_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.tablealias_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitstring_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.hexstring_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.datatype_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.directory_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.delete_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.drop_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.except_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.except_op": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.fetch_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.filter_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.hint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.index_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.identifier_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.national_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.partition_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.properties_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.root_properties": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.properties": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.with_properties": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.locate_properties": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.property_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.likeproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.fallbackproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.journalproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.freespaceproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.afterjournalproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.checksumproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.mergeblockratioproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.datablocksizeproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.blockcompressionproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.isolatedloadingproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.insert_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.intersect_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.intersect_op": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.introducer_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.pseudotype_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.rowformatdelimitedproperty_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.table_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.tablesample_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.pivot_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.tuple_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.update_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.var_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.into_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.from_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.group_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.having_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.join_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.lambda_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.lateral_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.limit_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.offset_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.lock_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.literal_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.loaddata_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.null_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.boolean_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.order_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.cluster_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.distribute_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.sort_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.ordered_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.matchrecognize_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.query_modifiers": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.select_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.schema_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.star_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.structkwarg_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.parameter_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.sessionparameter_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.placeholder_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.subquery_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.qualify_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.union_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.union_op": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.unnest_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.where_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.window_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.partition_by_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.window_spec_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.withingroup_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.between_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bracket_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.all_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.any_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.exists_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.case_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.constraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.extract_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.trim_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.concat_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.check_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.foreignkey_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.primarykey_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.unique_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.if_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.in_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.in_unnest_op": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.interval_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.return_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.reference_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.anonymous_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.paren_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.neg_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.not_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.alias_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.aliases_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.attimezone_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.add_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.and_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.connector_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitwiseand_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitwiseleftshift_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitwisenot_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitwiseor_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitwiserightshift_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.bitwisexor_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.cast_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.currentdate_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.collate_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.command_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.transaction_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.commit_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.rollback_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.altercolumn_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.renametable_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.altertable_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.droppartition_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.addconstraint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.distinct_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.ignorenulls_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.respectnulls_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.intdiv_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.dpipe_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.div_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.distance_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.dot_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.eq_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.escape_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.glob_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.gt_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.gte_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.ilike_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.is_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.like_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.similarto_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.lt_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.lte_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.mod_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.mul_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.neq_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.nullsafeeq_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.nullsafeneq_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.or_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.slice_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.sub_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.trycast_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.use_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.binary": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.function_fallback_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.format_args": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.text_width": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.format_time": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.expressions": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.op_expressions": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.naked_property": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.set_operation": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.tag_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.token_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.userdefinedfunction_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.userdefinedfunctionkwarg_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.joinhint_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.kwarg_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.when_sql": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.merge_sql": {"tf": 1.7320508075688772}, "sqlglot.helper": {"tf": 1.7320508075688772}, "sqlglot.helper.AutoName": {"tf": 2.449489742783178}, "sqlglot.helper.seq_get": {"tf": 3.3166247903554}, "sqlglot.helper.ensure_list": {"tf": 4.795831523312719}, "sqlglot.helper.ensure_collection": {"tf": 5.196152422706632}, "sqlglot.helper.csv": {"tf": 5.291502622129181}, "sqlglot.helper.subclasses": {"tf": 5.744562646538029}, "sqlglot.helper.apply_index_offset": {"tf": 5.477225575051661}, "sqlglot.helper.camel_to_snake_case": {"tf": 2.23606797749979}, "sqlglot.helper.while_changing": {"tf": 5.291502622129181}, "sqlglot.helper.tsort": {"tf": 4.795831523312719}, "sqlglot.helper.open_file": {"tf": 1.7320508075688772}, "sqlglot.helper.csv_reader": {"tf": 5.477225575051661}, "sqlglot.helper.find_new_name": {"tf": 5.291502622129181}, "sqlglot.helper.object_to_dict": {"tf": 1.7320508075688772}, "sqlglot.helper.split_num_words": {"tf": 12.649110640673518}, "sqlglot.helper.is_iterable": {"tf": 8.94427190999916}, "sqlglot.helper.flatten": {"tf": 11.224972160321824}, "sqlglot.helper.count_params": {"tf": 1.7320508075688772}, "sqlglot.helper.dict_depth": {"tf": 11.489125293076057}, "sqlglot.helper.first": {"tf": 2.449489742783178}, "sqlglot.lineage": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node.__init__": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node.walk": {"tf": 1.7320508075688772}, "sqlglot.lineage.Node.to_html": {"tf": 1.7320508075688772}, "sqlglot.lineage.lineage": {"tf": 6.928203230275509}, "sqlglot.lineage.LineageHTML": {"tf": 2.6457513110645907}, "sqlglot.lineage.LineageHTML.__init__": {"tf": 1.7320508075688772}, "sqlglot.optimizer": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 13.2664991614216}, "sqlglot.optimizer.annotate_types.TypeAnnotator": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.TypeAnnotator.__init__": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.TypeAnnotator.annotate": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 4.123105625617661}, "sqlglot.optimizer.canonicalize.add_text_to_concat": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.coerce_type": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.remove_redundant_casts": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_ctes": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 10.198039027185569}, "sqlglot.optimizer.eliminate_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 10.344080432788601}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 4.58257569495584}, "sqlglot.optimizer.eliminate_subqueries": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 12.727922061357855}, "sqlglot.optimizer.expand_laterals": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 10.63014581273465}, "sqlglot.optimizer.expand_multi_table_selects": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 7.874007874011811}, "sqlglot.optimizer.isolate_table_selects": {"tf": 1.7320508075688772}, "sqlglot.optimizer.isolate_table_selects.isolate_table_selects": {"tf": 1.7320508075688772}, "sqlglot.optimizer.lower_identities": {"tf": 1.7320508075688772}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 9.797958971132712}, "sqlglot.optimizer.merge_subqueries": {"tf": 1.7320508075688772}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 11.180339887498949}, "sqlglot.optimizer.merge_subqueries.merge_ctes": {"tf": 1.7320508075688772}, "sqlglot.optimizer.merge_subqueries.merge_derived_tables": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalize": {"tf": 10.14889156509222}, "sqlglot.optimizer.normalize.normalized": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 9.591663046625438}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 2.23606797749979}, "sqlglot.optimizer.optimize_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 7.874007874011811}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.other_table_names": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 7.54983443527075}, "sqlglot.optimizer.pushdown_predicates": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 10.344080432788601}, "sqlglot.optimizer.pushdown_predicates.pushdown": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.nodes_for_predicate": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.replace_aliases": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_projections": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_projections.DEFAULT_SELECTION": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 10.198039027185569}, "sqlglot.optimizer.qualify_columns": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 11.575836902790225}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 2}, "sqlglot.optimizer.qualify_tables": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 10.862780491200215}, "sqlglot.optimizer.scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType.ROOT": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType.SUBQUERY": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType.DERIVED_TABLE": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType.CTE": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType.UNION": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.ScopeType.UDTF": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope": {"tf": 8.246211251235321}, "sqlglot.optimizer.scope.Scope.__init__": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.clear_cache": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.walk": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.find": {"tf": 5.744562646538029}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 5.656854249492381}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 5.477225575051661}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 4.47213595499958}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 4.47213595499958}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 3.4641016151377544}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 3.872983346207417}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 4}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 3.4641016151377544}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 4.898979485566356}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 13.601470508735444}, "sqlglot.optimizer.scope.build_scope": {"tf": 4.69041575982343}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 5.385164807134504}, "sqlglot.optimizer.simplify": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.simplify": {"tf": 9.643650760992955}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 2.449489742783178}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 2}, "sqlglot.optimizer.simplify.flatten": {"tf": 2}, "sqlglot.optimizer.simplify.simplify_connectors": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 2.6457513110645907}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 2.449489742783178}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 2.8284271247461903}, "sqlglot.optimizer.simplify.simplify_literals": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.simplify_parens": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.remove_where_true": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.always_true": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.is_complement": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.eval_boolean": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.extract_date": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.extract_interval": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.date_literal": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.boolean_literal": {"tf": 1.7320508075688772}, "sqlglot.optimizer.unnest_subqueries": {"tf": 1.7320508075688772}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 9.899494936611665}, "sqlglot.optimizer.unnest_subqueries.unnest": {"tf": 1.7320508075688772}, "sqlglot.optimizer.unnest_subqueries.decorrelate": {"tf": 1.7320508075688772}, "sqlglot.parser": {"tf": 1.7320508075688772}, "sqlglot.parser.parse_var_map": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 6.082762530298219}, "sqlglot.parser.Parser.__init__": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.reset": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse": {"tf": 5.291502622129181}, "sqlglot.parser.Parser.parse_into": {"tf": 5.744562646538029}, "sqlglot.parser.Parser.check_errors": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.raise_error": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.expression": {"tf": 5.744562646538029}, "sqlglot.parser.Parser.validate_expression": {"tf": 4.358898943540674}, "sqlglot.planner": {"tf": 1.7320508075688772}, "sqlglot.planner.Plan": {"tf": 1.7320508075688772}, "sqlglot.planner.Plan.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.Step": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.from_expression": {"tf": 7.681145747868608}, "sqlglot.planner.Step.add_dependency": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.to_s": {"tf": 1.7320508075688772}, "sqlglot.planner.Scan": {"tf": 1.7320508075688772}, "sqlglot.planner.Scan.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.Scan.from_expression": {"tf": 7.681145747868608}, "sqlglot.planner.Join": {"tf": 1.7320508075688772}, "sqlglot.planner.Join.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.Join.from_joins": {"tf": 1.7320508075688772}, "sqlglot.planner.Aggregate": {"tf": 1.7320508075688772}, "sqlglot.planner.Aggregate.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.Sort": {"tf": 1.7320508075688772}, "sqlglot.planner.Sort.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.SetOperation": {"tf": 1.7320508075688772}, "sqlglot.planner.SetOperation.__init__": {"tf": 1.7320508075688772}, "sqlglot.planner.SetOperation.from_expression": {"tf": 7.681145747868608}, "sqlglot.schema.Schema": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 4.358898943540674}, "sqlglot.schema.Schema.column_names": {"tf": 5.477225575051661}, "sqlglot.schema.Schema.get_column_type": {"tf": 5.477225575051661}, "sqlglot.schema.Schema.supported_table_args": {"tf": 2.449489742783178}, "sqlglot.schema.AbstractMappingSchema": {"tf": 4}, "sqlglot.schema.AbstractMappingSchema.__init__": {"tf": 1.7320508075688772}, "sqlglot.schema.AbstractMappingSchema.table_parts": {"tf": 1.7320508075688772}, "sqlglot.schema.AbstractMappingSchema.find": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema": {"tf": 7.211102550927978}, "sqlglot.schema.MappingSchema.__init__": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.from_mapping_schema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.copy": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.add_table": {"tf": 4.58257569495584}, "sqlglot.schema.MappingSchema.column_names": {"tf": 5.477225575051661}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 5.477225575051661}, "sqlglot.schema.ensure_schema": {"tf": 1.7320508075688772}, "sqlglot.schema.ensure_column_mapping": {"tf": 1.7320508075688772}, "sqlglot.schema.flatten_schema": {"tf": 1.7320508075688772}, "sqlglot.serde": {"tf": 1.7320508075688772}, "sqlglot.serde.dump": {"tf": 1.7320508075688772}, "sqlglot.serde.load": {"tf": 2.23606797749979}, "sqlglot.time": {"tf": 1.7320508075688772}, "sqlglot.time.format_time": {"tf": 7.681145747868608}, "sqlglot.tokens": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.L_PAREN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.R_PAREN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.L_BRACKET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.R_BRACKET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.L_BRACE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.R_BRACE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COMMA": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DOT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DASH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PLUS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COLON": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DCOLON": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SEMICOLON": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.STAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BACKSLASH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SLASH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LTE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GTE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NOT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.EQ": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NEQ": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NULLSAFE_EQ": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.AND": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.AMP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DPIPE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PIPE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CARET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TILDA": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ARROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DARROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FARROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HASH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HASH_ARROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DHASH_ARROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LR_ARROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DOLLAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PARAMETER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SESSION_PARAMETER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NATIONAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BLOCK_START": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BLOCK_END": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SPACE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BREAK": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.STRING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NUMBER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IDENTIFIER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COLUMN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COLUMN_DEF": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SCHEMA": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TABLE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BIT_STRING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HEX_STRING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BYTE_STRING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BOOLEAN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TINYINT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SMALLINT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BIGINT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FLOAT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DOUBLE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DECIMAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CHAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NCHAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VARCHAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NVARCHAR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TEXT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MEDIUMTEXT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LONGTEXT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MEDIUMBLOB": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LONGBLOB": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BINARY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VARBINARY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.JSON": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.JSONB": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TIME": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TIMESTAMP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TIMESTAMPTZ": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TIMESTAMPLTZ": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DATETIME": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DATE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UUID": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GEOGRAPHY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NULLABLE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GEOMETRY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HLLSKETCH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HSTORE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SUPER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SERIAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SMALLSERIAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BIGSERIAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.XML": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNIQUEIDENTIFIER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MONEY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SMALLMONEY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ROWVERSION": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IMAGE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VARIANT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OBJECT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ALIAS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ALTER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ALWAYS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ALL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ANTI": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ANY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.APPLY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ARRAY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ASC": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ASOF": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.AT_TIME_ZONE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.AUTO_INCREMENT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BEGIN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BETWEEN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BOTH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BUCKET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.BY_DEFAULT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CACHE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CASCADE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CASE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CHARACTER_SET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CHECK": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CLUSTER_BY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COLLATE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COMMAND": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COMMENT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COMMIT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.COMPOUND": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CONSTRAINT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CREATE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CROSS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CUBE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CURRENT_DATE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CURRENT_DATETIME": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CURRENT_ROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CURRENT_TIME": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.CURRENT_TIMESTAMP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DEFAULT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DELETE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DESC": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DESCRIBE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DISTINCT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DISTINCT_FROM": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DISTRIBUTE_BY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DIV": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.DROP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ELSE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ENCODE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.END": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ESCAPE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.EXCEPT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.EXECUTE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.EXISTS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FALSE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FETCH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FILTER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FINAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FIRST": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FOLLOWING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FOR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FOREIGN_KEY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FORMAT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FROM": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FULL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.FUNCTION": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GENERATED": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GLOB": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GLOBAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GROUP_BY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.GROUPING_SETS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HAVING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.HINT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IDENTITY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IF": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IGNORE_NULLS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ILIKE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INDEX": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INNER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INSERT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INTERSECT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INTERVAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INTO": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.INTRODUCER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IRLIKE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.IS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ISNULL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.JOIN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LANGUAGE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LATERAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LAZY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LEADING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LEFT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LIKE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LIMIT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LOAD_DATA": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.LOCAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MAP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MATCH_RECOGNIZE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MATERIALIZED": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MERGE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.MOD": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NATURAL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NEXT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NO_ACTION": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NOTNULL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NULL": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NULLS_FIRST": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.NULLS_LAST": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OFFSET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ON": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ONLY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OPTIONS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ORDER_BY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ORDERED": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ORDINALITY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OUTER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OUT_OF": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OVER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.OVERWRITE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PARTITION": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PARTITION_BY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PERCENT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PIVOT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PLACEHOLDER": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PRECEDING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PRIMARY_KEY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PROCEDURE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PROPERTIES": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.PSEUDO_TYPE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.QUALIFY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.QUOTE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.RANGE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.RECURSIVE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.REPLACE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.RESPECT_NULLS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.REFERENCES": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.RIGHT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.RLIKE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ROLLBACK": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ROLLUP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ROW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.ROWS": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SCHEMA_COMMENT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SEED": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SELECT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SEMI": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SEPARATOR": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SERDE_PROPERTIES": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SET": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SHOW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SIMILAR_TO": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SOME": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SORTKEY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.SORT_BY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.STRUCT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TABLE_SAMPLE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TEMPORARY": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TOP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.THEN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TRAILING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.TRUE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNBOUNDED": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNCACHE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNION": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNLOGGED": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNNEST": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNPIVOT": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UPDATE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.USE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.USING": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VALUES": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VIEW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.VOLATILE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WHEN": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WHERE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WINDOW": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WITH": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WITH_TIME_ZONE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WITH_LOCAL_TIME_ZONE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WITHIN_GROUP": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.WITHOUT_TIME_ZONE": {"tf": 1.7320508075688772}, "sqlglot.tokens.TokenType.UNIQUE": {"tf": 1.7320508075688772}, "sqlglot.tokens.Token": {"tf": 1.7320508075688772}, "sqlglot.tokens.Token.__init__": {"tf": 1.7320508075688772}, "sqlglot.tokens.Token.number": {"tf": 2.23606797749979}, "sqlglot.tokens.Token.string": {"tf": 2.23606797749979}, "sqlglot.tokens.Token.identifier": {"tf": 2.23606797749979}, "sqlglot.tokens.Token.var": {"tf": 2.23606797749979}, "sqlglot.tokens.Tokenizer": {"tf": 1.7320508075688772}, "sqlglot.tokens.Tokenizer.__init__": {"tf": 1.7320508075688772}, "sqlglot.tokens.Tokenizer.reset": {"tf": 1.7320508075688772}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 2.23606797749979}, "sqlglot.transforms": {"tf": 1.7320508075688772}, "sqlglot.transforms.unalias_group": {"tf": 9.327379053088816}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 5.0990195135927845}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 5.477225575051661}, "sqlglot.transforms.delegate": {"tf": 2.6457513110645907}, "sqlglot.trie": {"tf": 1.7320508075688772}, "sqlglot.trie.new_trie": {"tf": 9.327379053088816}, "sqlglot.trie.in_trie": {"tf": 13.228756555322953}}, "df": 1667, "s": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.executor": {"tf": 3.4641016151377544}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 54, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 5.5677643628300215}, "sqlglot.pretty": {"tf": 1}, "sqlglot.parse": {"tf": 2.23606797749979}, "sqlglot.parse_one": {"tf": 2.23606797749979}, "sqlglot.transpile": {"tf": 2.449489742783178}, "sqlglot.dataframe": {"tf": 6.48074069840786}, "sqlglot.dialects": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 3.605551275463989}, "sqlglot.executor": {"tf": 6.324555320336759}, "sqlglot.executor.execute": {"tf": 2}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 2}, "sqlglot.expressions.maybe_parse": {"tf": 2.23606797749979}, "sqlglot.expressions.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.select": {"tf": 2}, "sqlglot.expressions.from_": {"tf": 2}, "sqlglot.expressions.update": {"tf": 2}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 2.23606797749979}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_column": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.7320508075688772}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator.generate": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 2}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.7320508075688772}}, "df": 122, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 6.4031242374328485}, "sqlglot.schema": {"tf": 1}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 5}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects": {"tf": 3}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 4.242640687119285}, "sqlglot.expressions": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 2}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 2}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 2.23606797749979}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 2}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2.449489742783178}, "sqlglot.optimizer.normalize.normalize": {"tf": 2.23606797749979}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2.23606797749979}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2.23606797749979}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 2.23606797749979}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.simplify": {"tf": 2.23606797749979}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2.23606797749979}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}}, "df": 74, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "o": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 3.4641016151377544}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}}, "df": 11, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 3.3166247903554}}, "df": 1}}}}}}, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}}, "df": 3}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "t": {"docs": {"sqlglot.helper.split_num_words": {"tf": 2.6457513110645907}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}}, "df": 5}, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.449489742783178}, "sqlglot.executor.python.Python.Generator": {"tf": 2.449489742783178}, "sqlglot.generator.Generator": {"tf": 2.449489742783178}}, "df": 21}}, "c": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "y": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}}, "df": 3}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}}, "df": 3}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 2.8284271247461903}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 5}}}}}}}, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Func": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}}, "df": 2}}}}, "y": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}}, "x": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}}, "df": 57}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}}, "df": 1}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.not_": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}}, "df": 6, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}}, "df": 4}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 2.23606797749979}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 6}}}}}}}, "b": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 3, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.expressions": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.subclasses": {"tf": 2}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "t": {"docs": {"sqlglot.expressions.Func": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}}, "df": 2}}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.7320508075688772}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 11}}}, "y": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 2.449489742783178}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 11, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.expressions.expand": {"tf": 1}}, "df": 1}}}}}}}}}}}, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot": {"tf": 2.6457513110645907}}, "df": 1}}}, "m": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 5, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 6}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 3}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}}, "df": 6}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 1}}}}}}, "g": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 10, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}, "w": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}}, "df": 1}}}}, "o": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 2.8284271247461903}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 12, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 10, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "w": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 2}, "sqlglot.diff": {"tf": 7.937253933193772}, "sqlglot.diff.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 2}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 21, "d": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 1}, "s": {"docs": {"sqlglot.expressions.expand": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}}, "df": 7}}}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 2}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}}, "df": 2}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.tsort": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 25, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 21}}}}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 2.23606797749979}, "sqlglot.expressions.delete": {"tf": 1.7320508075688772}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}}, "df": 18, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 2.6457513110645907}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 27}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}, "b": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.8284271247461903}, "sqlglot.executor.python.Python.Generator": {"tf": 2.8284271247461903}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.7320508075688772}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.column": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2.8284271247461903}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 70, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 5, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 3.7416573867739413}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 2}, "sqlglot.dataframe": {"tf": 2.6457513110645907}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.449489742783178}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 2.449489742783178}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.condition": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 2.449489742783178}, "sqlglot.generator.Generator.generate": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1.7320508075688772}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.string": {"tf": 1.4142135623730951}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 92, "s": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 23}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2.6457513110645907}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}}}}}, "|": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.delete": {"tf": 1}}, "df": 1}}}}}}}}}}}, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 7, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 6}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 2}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}, "p": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {"sqlglot.trie.in_trie": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 6.164414002968976}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.executor": {"tf": 3.605551275463989}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.assert_is": {"tf": 2}, "sqlglot.expressions.Unionable.union": {"tf": 2}, "sqlglot.expressions.Unionable.intersect": {"tf": 2}, "sqlglot.expressions.Unionable.except_": {"tf": 2}, "sqlglot.expressions.Column.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 2.449489742783178}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2.449489742783178}, "sqlglot.expressions.Union.limit": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.from_": {"tf": 2}, "sqlglot.expressions.Select.group_by": {"tf": 2}, "sqlglot.expressions.Select.order_by": {"tf": 2}, "sqlglot.expressions.Select.sort_by": {"tf": 2}, "sqlglot.expressions.Select.cluster_by": {"tf": 2}, "sqlglot.expressions.Select.limit": {"tf": 2}, "sqlglot.expressions.Select.offset": {"tf": 2}, "sqlglot.expressions.Select.select": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.lateral": {"tf": 2}, "sqlglot.expressions.Select.join": {"tf": 3.1622776601683795}, "sqlglot.expressions.Select.where": {"tf": 2}, "sqlglot.expressions.Select.having": {"tf": 2}, "sqlglot.expressions.Select.distinct": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.ctas": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.lock": {"tf": 2.449489742783178}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Alias.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cast.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.union": {"tf": 2}, "sqlglot.expressions.intersect": {"tf": 2}, "sqlglot.expressions.except_": {"tf": 2}, "sqlglot.expressions.select": {"tf": 2.449489742783178}, "sqlglot.expressions.from_": {"tf": 2.23606797749979}, "sqlglot.expressions.condition": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 2.449489742783178}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 2}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2.6457513110645907}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 2.449489742783178}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 2.449489742783178}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.7320508075688772}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}}, "df": 97, "s": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 3}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 9}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.7320508075688772}}, "df": 2}}, "|": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 1}}}}}}}, "f": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 8}}, "e": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 3, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {"sqlglot.helper.seq_get": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 7, "s": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 2, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}}}}}}, "r": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}}, "df": 2}}}}}}}}}}, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.diff": {"tf": 5.916079783099616}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 2}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}}, "df": 80, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}}, "df": 4}, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 3}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Expression.assert_is": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 2.449489742783178}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 21}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"1": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 6, "n": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.find_new_name": {"tf": 1}}, "df": 1}, "d": {"docs": {"sqlglot.trie.in_trie": {"tf": 1}}, "df": 1}}}}}, "m": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {"sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.helper.csv": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.schema": {"tf": 1}, "sqlglot.dataframe": {"tf": 4.242640687119285}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_table": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2.6457513110645907}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2.6457513110645907}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 2.23606797749979}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 2}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 20, "s": {"docs": {"sqlglot.schema.Schema": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 3.605551275463989}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 4.242640687119285}}, "df": 1, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 3.3166247903554}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.build_scope": {"tf": 2}}, "df": 33, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 2.8284271247461903}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 2.449489742783178}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 4}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "r": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 4}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 41, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 3}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}}, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1.7320508075688772}}, "df": 3}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 2}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.simplify.simplify": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2.449489742783178}, "sqlglot.executor.execute": {"tf": 1}}, "df": 3}, "y": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 4.242640687119285}}, "df": 1}}}}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 11}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 4}}}, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}}, "df": 4}}, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 7}}, "w": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}}, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Expression.replace": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 4.795831523312719}, "sqlglot.executor": {"tf": 4.69041575982343}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 3.4641016151377544}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.diff": {"tf": 7.54983443527075}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.executor": {"tf": 4.58257569495584}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.assert_is": {"tf": 2}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Literal.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2.23606797749979}, "sqlglot.expressions.Union.limit": {"tf": 2}, "sqlglot.expressions.Select.from_": {"tf": 2}, "sqlglot.expressions.Select.group_by": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.order_by": {"tf": 2}, "sqlglot.expressions.Select.sort_by": {"tf": 2}, "sqlglot.expressions.Select.cluster_by": {"tf": 2}, "sqlglot.expressions.Select.limit": {"tf": 2}, "sqlglot.expressions.Select.offset": {"tf": 2}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Star.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Alias.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.Cast.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 1.7320508075688772}, "sqlglot.expressions.union": {"tf": 2.23606797749979}, "sqlglot.expressions.intersect": {"tf": 2.23606797749979}, "sqlglot.expressions.except_": {"tf": 2.23606797749979}, "sqlglot.expressions.select": {"tf": 2.23606797749979}, "sqlglot.expressions.from_": {"tf": 2.23606797749979}, "sqlglot.expressions.condition": {"tf": 2.449489742783178}, "sqlglot.expressions.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.not_": {"tf": 1.7320508075688772}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_column": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 2}, "sqlglot.expressions.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2}, "sqlglot.helper.AutoName": {"tf": 1.4142135623730951}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 2.23606797749979}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1.7320508075688772}, "sqlglot.trie.in_trie": {"tf": 2.23606797749979}}, "df": 143, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}, "n": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}, "t": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 3.7416573867739413}, "sqlglot.executor": {"tf": 4.898979485566356}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1.4142135623730951}, "sqlglot.helper.ensure_collection": {"tf": 1.4142135623730951}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 82, "e": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 3}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.is_iterable": {"tf": 2.23606797749979}, "sqlglot.helper.flatten": {"tf": 2}, "sqlglot.helper.first": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.helper.flatten": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 12, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 3}}}}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "n": {"docs": {"sqlglot": {"tf": 4.123105625617661}, "sqlglot.schema": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 3.605551275463989}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.8284271247461903}, "sqlglot.diff": {"tf": 8.12403840463596}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 3.605551275463989}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 2.8284271247461903}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.bfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 2.8284271247461903}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.tsort": {"tf": 1.4142135623730951}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 2.449489742783178}}, "df": 148, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 2}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 2}, "sqlglot.expressions.from_": {"tf": 2}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 2}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1}}, "df": 40, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 41, "s": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}}, "df": 1}, "d": {"docs": {"sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 2}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dataframe": {"tf": 1}}, "df": 2}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.offset": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 52, "s": {"docs": {"sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 6}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 5, "d": {"docs": {"sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 10}}}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}}, "df": 3, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 3}}}}, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 2}}}}}}, "t": {"6": {"4": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dialects": {"tf": 2.23606797749979}}, "df": 2}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 34, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 4.242640687119285}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse_into": {"tf": 1.7320508075688772}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 39}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_interval": {"tf": 1}}, "df": 2}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.generator.Generator.generate": {"tf": 1}}, "df": 1}}}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}}, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.func": {"tf": 1.7320508075688772}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "f": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Unionable.intersect": {"tf": 2.23606797749979}, "sqlglot.expressions.intersect": {"tf": 2.23606797749979}}, "df": 2}}}}}, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}}}}, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}}, "df": 5, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2.6457513110645907}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "\u2019": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "v": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 2}}}}}}}, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}}, "df": 6}}}}}, "s": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "r": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 2, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.values": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 2}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.helper.seq_get": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 19}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 45}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.helper.is_iterable": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.condition": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}}, "df": 5}}}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 6, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 4.358898943540674}, "sqlglot.dataframe": {"tf": 4.47213595499958}, "sqlglot.dialects": {"tf": 2}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 42, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}}, "df": 3}}}, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}}, "df": 2}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 3.4641016151377544}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions": {"tf": 1}}, "df": 7, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 1}}}}}}}}}}, "d": {"docs": {"sqlglot": {"tf": 4.69041575982343}, "sqlglot.dataframe": {"tf": 3}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 6, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.diff": {"tf": 3.3166247903554}, "sqlglot.diff.diff": {"tf": 2}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_identifier": {"tf": 2}, "sqlglot.generator.Generator": {"tf": 2}, "sqlglot.tokens.Token.identifier": {"tf": 1.4142135623730951}}, "df": 29, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}}, "df": 26}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 24, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.transpile": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}, "s": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3}}, "f": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.drill.if_sql": {"tf": 2}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.8284271247461903}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.8284271247461903}, "sqlglot.diff": {"tf": 4.69041575982343}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.env.null_if_any": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2.8284271247461903}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Literal.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.7320508075688772}, "sqlglot.expressions.Join.using": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2}, "sqlglot.expressions.Union.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.from_": {"tf": 2}, "sqlglot.expressions.Select.group_by": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.order_by": {"tf": 2}, "sqlglot.expressions.Select.sort_by": {"tf": 2}, "sqlglot.expressions.Select.cluster_by": {"tf": 2}, "sqlglot.expressions.Select.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.offset": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.lateral": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.where": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.having": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Star.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Alias.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 2}, "sqlglot.expressions.intersect": {"tf": 2}, "sqlglot.expressions.except_": {"tf": 2}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2.8284271247461903}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 135}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}}}}}, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "\u2019": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "m": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2}}}, "o": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {"sqlglot": {"tf": 7.615773105863909}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 3.1622776601683795}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 2.449489742783178}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 3}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 3}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 3}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 3}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 3}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 3}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 3}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 3}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 3}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 3}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 3}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 3}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 3}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 3}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 3}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 3}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 3}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 3}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 3}, "sqlglot.diff": {"tf": 8.94427190999916}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.diff": {"tf": 2.23606797749979}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.executor": {"tf": 8.660254037844387}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.executor.env.null_if_any": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 3}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 2.6457513110645907}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.is_number": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.transform": {"tf": 2}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.group_by": {"tf": 2}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 2}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Star.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Alias.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.7320508075688772}, "sqlglot.expressions.Cast.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.maybe_parse": {"tf": 2.23606797749979}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 2}, "sqlglot.expressions.from_": {"tf": 2.23606797749979}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.7320508075688772}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 2.23606797749979}, "sqlglot.expressions.to_column": {"tf": 2}, "sqlglot.expressions.alias_": {"tf": 2}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1.7320508075688772}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_name": {"tf": 2}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.expressions.false": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 3}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 2.449489742783178}, "sqlglot.helper.ensure_collection": {"tf": 2.23606797749979}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.7320508075688772}, "sqlglot.helper.while_changing": {"tf": 1.7320508075688772}, "sqlglot.helper.tsort": {"tf": 1.4142135623730951}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1.7320508075688772}, "sqlglot.helper.find_new_name": {"tf": 1.4142135623730951}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 2}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 2}, "sqlglot.lineage.lineage": {"tf": 2}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 2}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.7320508075688772}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 2}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2.8284271247461903}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2.8284271247461903}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2.6457513110645907}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2.8284271247461903}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 2}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 3}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 2}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 2}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 4.242640687119285}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 3.4641016151377544}, "sqlglot.parser.Parser": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 3.4641016151377544}, "sqlglot.planner.Scan.from_expression": {"tf": 3.4641016151377544}, "sqlglot.planner.SetOperation.from_expression": {"tf": 3.4641016151377544}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 2}, "sqlglot.transforms.delegate": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 2.23606797749979}, "sqlglot.trie.in_trie": {"tf": 2.449489742783178}}, "df": 220, "n": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 3}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor": {"tf": 2.449489742783178}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 2.6457513110645907}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.7320508075688772}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1.7320508075688772}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 120, "d": {"docs": {"sqlglot": {"tf": 5.196152422706632}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 3.1622776601683795}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 7.0710678118654755}, "sqlglot.diff.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.executor": {"tf": 7.0710678118654755}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 2}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 2.449489742783178}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.helper.count_params": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 2.6457513110645907}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.flatten": {"tf": 2}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 2.449489742783178}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 2.8284271247461903}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 115}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 14}}}}, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.func": {"tf": 1}}, "df": 1}}}}}}}, "y": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}}, "df": 28, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 3, "d": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.7320508075688772}}, "df": 1}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}, "l": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2, "s": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}}, "df": 17}}, "l": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.executor": {"tf": 2.8284271247461903}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 67, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 2}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "/": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 2.8284271247461903}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 54, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 23}, "d": {"docs": {"sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 6}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.helper.find_new_name": {"tf": 1}}, "df": 3, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "g": {"docs": {"sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "g": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.diff": {"tf": 5}, "sqlglot.diff.ChangeDistiller": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 5}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.449489742783178}, "sqlglot.diff": {"tf": 4.47213595499958}, "sqlglot.executor": {"tf": 3.605551275463989}, "sqlglot.executor.env.null_if_any": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2.449489742783178}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2.449489742783178}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 75, "n": {"docs": {"sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}}, "df": 1}}, "g": {"docs": {"sqlglot.expressions.Expression": {"tf": 2.6457513110645907}, "sqlglot.expressions.Expression.append": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.set": {"tf": 2}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 7, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.7320508075688772}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 14, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.csv": {"tf": 2}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 172}}}}}}, "s": {"docs": {"sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 11}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}, "[": {"0": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}, "1": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}, "docs": {}, "df": 0}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 4}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Tag": {"tf": 1}}, "df": 2}}}}}}}}, "s": {"docs": {"sqlglot": {"tf": 4.47213595499958}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 3}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 4}, "sqlglot.executor": {"tf": 4.242640687119285}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2.6457513110645907}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 2.23606797749979}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 2}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.7320508075688772}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1.4142135623730951}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2.23606797749979}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 2.23606797749979}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2.6457513110645907}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 2}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2.6457513110645907}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 2}, "sqlglot.planner.Scan.from_expression": {"tf": 2}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 137, "t": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.executor": {"tf": 3.4641016151377544}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 17, "s": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}}, "df": 2, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.assert_is": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}}, "df": 4}}}}}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}}, "df": 2}, "d": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1.4142135623730951}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transpile": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.replace_tables": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 2.449489742783178}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 3}}}}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}}}, "m": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "y": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.helper.tsort": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot": {"tf": 2}}, "df": 1, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}}, "df": 2, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 2}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.7320508075688772}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 7}, "s": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}}, "df": 4}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}}, "df": 15, "s": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 3}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}}, "df": 3}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}}, "df": 14, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 3}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}}, "df": 3, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 4}}}}}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 4}}}, "s": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "j": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "g": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 4}, "/": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 4}}}}}}}, "e": {"docs": {"sqlglot.dataframe": {"tf": 3.872983346207417}}, "df": 1}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}}, "df": 4, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 3}}}}}}, "b": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.func": {"tf": 1.4142135623730951}}, "df": 1, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.Schema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 5}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 3}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 2}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "b": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}}}, "x": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.expressions.update": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}}, "df": 2, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}}, "df": 3}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}}}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 2}}, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 43}}}, "f": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {"sqlglot.diff": {"tf": 3.4641016151377544}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 13, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {"sqlglot.transforms.delegate": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 4}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 1}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}}, "df": 2}}}}}}}, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "n": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2, "o": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}}, "df": 14, "t": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 3.605551275463989}, "sqlglot.executor": {"tf": 3}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 2}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 2}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 2.449489742783178}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 2}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 68, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 7, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Select.group_by": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.diff": {"tf": 7.745966692414834}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 27, "s": {"docs": {"sqlglot.diff": {"tf": 8.12403840463596}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.4142135623730951}}, "df": 12}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {"sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}}, "df": 10, "e": {"docs": {"sqlglot.dataframe": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 2.23606797749979}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 32}}, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}}, "df": 2, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}}, "df": 23, "d": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 2}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 1}}}}}}}}}}}, "w": {"docs": {"sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Identifier.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Literal.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Star.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Alias.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Func": {"tf": 2.23606797749979}, "sqlglot.expressions.Cast.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.to_identifier": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_": {"tf": 1.7320508075688772}, "sqlglot.expressions.rename_table": {"tf": 2}, "sqlglot.expressions.table_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.7320508075688772}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 42, "s": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 2}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1.4142135623730951}}, "df": 33}, "d": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}, "\u00ef": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.replace": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1.7320508075688772}}, "df": 50, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 7, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}}, "df": 3}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 3}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}}, "w": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.find_ancestor": {"tf": 1}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dataframe": {"tf": 3}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.helper.split_num_words": {"tf": 2}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}}, "df": 2}}}}, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.number": {"tf": 1.4142135623730951}}, "df": 49}}}, "p": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 44, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.generator.Generator": {"tf": 2}, "sqlglot.parser.Parser": {"tf": 2}}, "df": 39}}}}, "^": {"2": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}, "docs": {}, "df": 0}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "d": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.executor": {"tf": 2}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 6, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 6}}}}, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 3}}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 2.6457513110645907}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}}, "df": 6}}}, "v": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3}}}}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}}, "df": 7, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 41}}}}}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}}, "df": 3, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.ChangeDistiller": {"tf": 1.4142135623730951}}, "df": 2}, "s": {"docs": {"sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 20}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.trie.new_trie": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "f": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}}, "df": 5, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.pretty": {"tf": 1}, "sqlglot.schema": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 4.358898943540674}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 4.358898943540674}, "sqlglot.executor.python.Python.Generator": {"tf": 4.358898943540674}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 4.358898943540674}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 2.6457513110645907}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}}, "df": 49, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "s": {"docs": {"sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 7}, "s": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}}, "df": 2}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.env.null_if_any": {"tf": 1}}, "df": 1}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.generator.Generator": {"tf": 2}}, "df": 21, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {"sqlglot.expressions.delete": {"tf": 2.23606797749979}}, "df": 1}}, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.transforms.delegate": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.transforms.delegate": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "d": {"docs": {"sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}}, "df": 5}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}}, "df": 1}}}}}}}}}}, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 3}}}, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Expression.copy": {"tf": 1}}, "df": 1}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.simplify.simplify_not": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.diff": {"tf": 3.4641016151377544}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}}, "df": 5}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 2.6457513110645907}, "sqlglot.dataframe": {"tf": 2.449489742783178}, "sqlglot.dialects": {"tf": 3.1622776601683795}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}}, "df": 50, "s": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 2}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 7}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 2}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}}, "df": 11, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.7320508075688772}}, "df": 2}}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "j": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}}, "df": 1}}}}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 2.449489742783178}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 29, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 2}}}, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 32}}}}}}, "[": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}}, "df": 5}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 1}}}}, "|": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}}, "df": 3}}}}}}}}}, "e": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.tsort": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 1}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}}, "df": 6}}}}, "e": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 3}, "m": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 4}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 4, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}}}, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}}, "df": 6, "n": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}}, "df": 5, "\u2019": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}}, "df": 4}}}}, "n": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 5, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}}, "df": 5}, "\u2019": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "m": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 2}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}}, "df": 2, "/": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {"sqlglot.dataframe": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 3.605551275463989}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}}, "df": 7, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 3}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 8}}}}, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 4.58257569495584}, "sqlglot.executor": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.schema.Schema": {"tf": 1}}, "df": 6}}}}}}, "g": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 2.23606797749979}, "sqlglot.planner.Scan.from_expression": {"tf": 2.23606797749979}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2.23606797749979}}, "df": 5}, "y": {"docs": {"sqlglot.expressions.to_interval": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1.4142135623730951}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {"sqlglot.dataframe": {"tf": 2.8284271247461903}}, "df": 1, "s": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 3}}, "b": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 2.449489742783178}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 2}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 2}}, "df": 9, "/": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "y": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 4}}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "d": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 3.872983346207417}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.output_name": {"tf": 2}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column.output_name": {"tf": 2}, "sqlglot.expressions.Identifier.output_name": {"tf": 2}, "sqlglot.expressions.Literal.output_name": {"tf": 2}, "sqlglot.expressions.Join.on": {"tf": 2}, "sqlglot.expressions.Join.using": {"tf": 2}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2}, "sqlglot.expressions.Union.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.offset": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.lateral": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.where": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.having": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.ctas": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subquery.output_name": {"tf": 2}, "sqlglot.expressions.Star.output_name": {"tf": 2}, "sqlglot.expressions.Alias.output_name": {"tf": 2}, "sqlglot.expressions.Cast.output_name": {"tf": 2}, "sqlglot.expressions.maybe_parse": {"tf": 2.23606797749979}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.7320508075688772}, "sqlglot.expressions.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.not_": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 1.7320508075688772}, "sqlglot.expressions.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 77, "r": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.executor": {"tf": 2.6457513110645907}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 24, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "/": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 19}}}}}, "d": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}}, "df": 26}, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 6}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 7, "/": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}}, "t": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 8, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.unnest": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.expressions.Expression.flatten": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.4142135623730951}}, "df": 3}}}}, "s": {"docs": {"sqlglot.helper.count_params": {"tf": 1}}, "df": 1}}}}}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "/": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 3, "w": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "d": {"docs": {"sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 37}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}, "i": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 3.4641016151377544}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_column": {"tf": 1.4142135623730951}}, "df": 3, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2}}}}, "r": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}}, "df": 8}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 22, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 24}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.4142135623730951}}, "df": 2}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 6}}}}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "x": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 2}}}}, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions": {"tf": 1}}, "df": 3}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 2}, "sqlglot.planner.Scan.from_expression": {"tf": 2}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2}}, "df": 6}}}}}}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 3, "d": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 11}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 2}}, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 4}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 4, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 22}, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 41}}, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}, "c": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.dataframe": {"tf": 2}}, "df": 2}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2.449489742783178}}, "df": 1}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 5, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.time.format_time": {"tf": 1}}, "df": 3}}}}, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 1}}}}}}, "m": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 3, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}}, "df": 3}}}}}}}, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 4.898979485566356}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}}, "df": 28, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "k": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe": {"tf": 2.8284271247461903}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}}, "df": 3, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "p": {"3": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2}}}}}}, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "f": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}}, "df": 23, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 2}}, "df": 1}}}}}}}}}, "n": {"docs": {"sqlglot.executor": {"tf": 2.8284271247461903}}, "df": 1, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}}, "df": 2}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}}, "df": 7}, "y": {"docs": {"sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2}}}}}, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 42, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}}, "df": 2}}}}}}, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}, "h": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.diff": {"tf": 3.3166247903554}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.executor": {"tf": 2.6457513110645907}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 18, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2.8284271247461903}, "sqlglot.transpile": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3, "r": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "d": {"docs": {"sqlglot.transpile": {"tf": 1}}, "df": 1}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 3}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 2}}, "df": 6, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}, "d": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}}, "df": 11}}, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 7}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}}, "df": 3, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 3}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.7320508075688772}}, "df": 5, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.walk": {"tf": 1}}, "df": 2}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.4142135623730951}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}}, "e": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 3.872983346207417}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.replace": {"tf": 1.7320508075688772}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}}, "df": 70, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.parse": {"tf": 1}, "sqlglot.diff": {"tf": 3.3166247903554}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}}, "df": 6}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Func": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2.449489742783178}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1.7320508075688772}, "sqlglot.trie.in_trie": {"tf": 1.7320508075688772}}, "df": 65}}, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 7}, "i": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 2.449489742783178}, "sqlglot.trie.in_trie": {"tf": 3.4641016151377544}}, "df": 24, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {"sqlglot": {"tf": 4.358898943540674}, "sqlglot.pretty": {"tf": 1}, "sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.parse_one": {"tf": 1.7320508075688772}, "sqlglot.transpile": {"tf": 2.23606797749979}, "sqlglot.dataframe": {"tf": 3.7416573867739413}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 2.23606797749979}, "sqlglot.dialects": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 3.7416573867739413}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 3.7416573867739413}, "sqlglot.diff": {"tf": 8.48528137423857}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 6.708203932499369}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 2}, "sqlglot.executor.python.Python.Generator": {"tf": 3.7416573867739413}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.set": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 2}, "sqlglot.expressions.Condition.or_": {"tf": 2}, "sqlglot.expressions.Unionable.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Join.on": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.using": {"tf": 2.449489742783178}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2.8284271247461903}, "sqlglot.expressions.Union.limit": {"tf": 2}, "sqlglot.expressions.Select.from_": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.group_by": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.order_by": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.sort_by": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.cluster_by": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.limit": {"tf": 2}, "sqlglot.expressions.Select.offset": {"tf": 2}, "sqlglot.expressions.Select.select": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.lateral": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.join": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.where": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.having": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.ctas": {"tf": 2.23606797749979}, "sqlglot.expressions.Func": {"tf": 2.449489742783178}, "sqlglot.expressions.maybe_parse": {"tf": 2.449489742783178}, "sqlglot.expressions.union": {"tf": 2.23606797749979}, "sqlglot.expressions.intersect": {"tf": 2.23606797749979}, "sqlglot.expressions.except_": {"tf": 2.23606797749979}, "sqlglot.expressions.select": {"tf": 2}, "sqlglot.expressions.from_": {"tf": 2}, "sqlglot.expressions.update": {"tf": 2.23606797749979}, "sqlglot.expressions.delete": {"tf": 1.7320508075688772}, "sqlglot.expressions.condition": {"tf": 2}, "sqlglot.expressions.and_": {"tf": 2}, "sqlglot.expressions.or_": {"tf": 2}, "sqlglot.expressions.not_": {"tf": 2}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 2.6457513110645907}, "sqlglot.expressions.subquery": {"tf": 2.23606797749979}, "sqlglot.expressions.cast": {"tf": 2.23606797749979}, "sqlglot.expressions.values": {"tf": 2}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 2}, "sqlglot.expressions.func": {"tf": 2.23606797749979}, "sqlglot.generator.Generator": {"tf": 3.7416573867739413}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.7320508075688772}, "sqlglot.helper.apply_index_offset": {"tf": 1.7320508075688772}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.7320508075688772}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 2}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.expression": {"tf": 2}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 2.23606797749979}, "sqlglot.planner.Scan.from_expression": {"tf": 2.23606797749979}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2.23606797749979}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.7320508075688772}, "sqlglot.transforms.delegate": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1.7320508075688772}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 178, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "g": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse_into": {"tf": 1.7320508075688772}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 24}, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dialects": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.executor": {"tf": 2}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 21}, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 1.7320508075688772}}, "df": 2}}}}}}}, "o": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "l": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "p": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}}, "df": 3}}}}}}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}}, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 4.242640687119285}, "sqlglot.schema": {"tf": 1.4142135623730951}, "sqlglot.parse": {"tf": 2}, "sqlglot.parse_one": {"tf": 2.6457513110645907}, "sqlglot.transpile": {"tf": 4}, "sqlglot.dataframe": {"tf": 4.358898943540674}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 3}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects": {"tf": 2.6457513110645907}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 2}, "sqlglot.dialects.drill.if_sql": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 4.47213595499958}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2.6457513110645907}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 4.47213595499958}, "sqlglot.diff": {"tf": 15.066519173319364}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.diff": {"tf": 3.3166247903554}, "sqlglot.diff.ChangeDistiller": {"tf": 1.7320508075688772}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor": {"tf": 8.48528137423857}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.__init__": {"tf": 1.7320508075688772}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 4.47213595499958}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 3.1622776601683795}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.set": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.find_all": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.dfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.bfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.transform": {"tf": 2.6457513110645907}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 2.23606797749979}, "sqlglot.expressions.Condition.or_": {"tf": 2.23606797749979}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 2.449489742783178}, "sqlglot.expressions.Unionable.intersect": {"tf": 2.449489742783178}, "sqlglot.expressions.Unionable.except_": {"tf": 2.449489742783178}, "sqlglot.expressions.Column.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Literal.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 2.8284271247461903}, "sqlglot.expressions.Join.using": {"tf": 3}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 3.4641016151377544}, "sqlglot.expressions.Union.limit": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.from_": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.group_by": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.order_by": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.sort_by": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.cluster_by": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.limit": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.offset": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.select": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.lateral": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.join": {"tf": 3.3166247903554}, "sqlglot.expressions.Select.where": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.having": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.distinct": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.ctas": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.lock": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Star.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Alias.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 2.8284271247461903}, "sqlglot.expressions.Cast.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 3}, "sqlglot.expressions.union": {"tf": 3.1622776601683795}, "sqlglot.expressions.intersect": {"tf": 3.1622776601683795}, "sqlglot.expressions.except_": {"tf": 3.1622776601683795}, "sqlglot.expressions.select": {"tf": 3}, "sqlglot.expressions.from_": {"tf": 3.3166247903554}, "sqlglot.expressions.update": {"tf": 2.23606797749979}, "sqlglot.expressions.delete": {"tf": 2.23606797749979}, "sqlglot.expressions.condition": {"tf": 3}, "sqlglot.expressions.and_": {"tf": 2.23606797749979}, "sqlglot.expressions.or_": {"tf": 2.23606797749979}, "sqlglot.expressions.not_": {"tf": 2.23606797749979}, "sqlglot.expressions.to_identifier": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 2.8284271247461903}, "sqlglot.expressions.subquery": {"tf": 2.449489742783178}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 2}, "sqlglot.expressions.rename_table": {"tf": 2}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.expressions.func": {"tf": 3}, "sqlglot.generator.Generator": {"tf": 4.47213595499958}, "sqlglot.generator.Generator.generate": {"tf": 1.7320508075688772}, "sqlglot.helper.AutoName": {"tf": 1.4142135623730951}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1.7320508075688772}, "sqlglot.helper.ensure_collection": {"tf": 1.7320508075688772}, "sqlglot.helper.csv": {"tf": 1.7320508075688772}, "sqlglot.helper.subclasses": {"tf": 2.23606797749979}, "sqlglot.helper.apply_index_offset": {"tf": 2.449489742783178}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1.7320508075688772}, "sqlglot.helper.tsort": {"tf": 1.4142135623730951}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 2.6457513110645907}, "sqlglot.helper.is_iterable": {"tf": 1.7320508075688772}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 2.449489742783178}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 2.449489742783178}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2.449489742783178}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 2.449489742783178}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 2.6457513110645907}, "sqlglot.parser.Parser.parse": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.parse_into": {"tf": 2.8284271247461903}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 2.449489742783178}, "sqlglot.planner.Scan.from_expression": {"tf": 2.449489742783178}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2.449489742783178}, "sqlglot.schema.Schema.add_table": {"tf": 1.7320508075688772}, "sqlglot.schema.Schema.column_names": {"tf": 1.7320508075688772}, "sqlglot.schema.Schema.get_column_type": {"tf": 2.23606797749979}, "sqlglot.schema.MappingSchema": {"tf": 2.23606797749979}, "sqlglot.schema.MappingSchema.add_table": {"tf": 2}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 2.23606797749979}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 2.23606797749979}, "sqlglot.trie.in_trie": {"tf": 2.23606797749979}}, "df": 224, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 16}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.executor": {"tf": 2}}, "df": 4, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 5}, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}}, "df": 7}, "i": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 9}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 4}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 3.1622776601683795}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.449489742783178}, "sqlglot.diff": {"tf": 5.744562646538029}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.executor": {"tf": 3.605551275463989}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.7320508075688772}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.transforms.delegate": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 63}, "n": {"docs": {"sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 3, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3}}, "k": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot": {"tf": 4.58257569495584}, "sqlglot.dataframe": {"tf": 2.449489742783178}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 6.244997998398398}, "sqlglot.diff.diff": {"tf": 3.3166247903554}, "sqlglot.executor": {"tf": 2.6457513110645907}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.offset": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 3}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.add_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 165}, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}}, "df": 4}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 1}}, "df": 3, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 7.280109889280518}, "sqlglot.diff.diff": {"tf": 2.6457513110645907}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 33, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 3.3166247903554}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.ctas": {"tf": 2.8284271247461903}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_table": {"tf": 2.449489742783178}, "sqlglot.expressions.to_column": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 1.7320508075688772}, "sqlglot.expressions.column": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_": {"tf": 2}, "sqlglot.expressions.rename_table": {"tf": 2}, "sqlglot.expressions.column_table_names": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_name": {"tf": 2.6457513110645907}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 2.449489742783178}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_derived_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 2.23606797749979}, "sqlglot.schema.Schema.column_names": {"tf": 1.7320508075688772}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 2.449489742783178}, "sqlglot.schema.MappingSchema.add_table": {"tf": 2.23606797749979}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.4142135623730951}}, "df": 81, "s": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 22, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 39}}}}}}, "|": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 1}}}}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 4, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 3}, "n": {"docs": {"sqlglot.helper.find_new_name": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "g": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Tag": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.helper.is_iterable": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}}, "df": 29, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Expression.text": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "m": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.449489742783178}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 2.449489742783178}, "sqlglot.generator.Generator": {"tf": 2.449489742783178}, "sqlglot.time.format_time": {"tf": 2.23606797749979}}, "df": 27, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}}, "df": 2}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "b": {"docs": {}, "df": 0, "l": {"1": {"docs": {"sqlglot.expressions.Select.join": {"tf": 2}}, "df": 1}, "2": {"docs": {"sqlglot.expressions.Subqueryable.with_": {"tf": 2}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2.8284271247461903}}, "df": 3}, "docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.replace": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 2}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 2}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.7320508075688772}}, "df": 25}}, "w": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.diff": {"tf": 5}, "sqlglot.executor": {"tf": 1}}, "df": 5}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "y": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 2.23606797749979}, "sqlglot.dialects": {"tf": 3.1622776601683795}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Tables": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2.23606797749979}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.get_column_type": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema": {"tf": 2}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1.4142135623730951}}, "df": 30, "s": {"docs": {"sqlglot.dataframe": {"tf": 5.656854249492381}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.4142135623730951}}, "df": 21}, "o": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}}}}, "p": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1, "h": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}}, "df": 3}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 4, "[": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "[": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.trie.new_trie": {"tf": 1.4142135623730951}}, "df": 3, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}}, "df": 11, "r": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.schema": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}}, "df": 9, "/": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}}, "df": 10}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 2}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 12, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}}, "df": 2}}, "[": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 81}}}}, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}}, "df": 40}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.unnest_operands": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}}, "df": 3}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}}, "r": {"docs": {"sqlglot": {"tf": 3.605551275463989}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 3.7416573867739413}, "sqlglot.executor": {"tf": 2.6457513110645907}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 2.23606797749979}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 2}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 2.449489742783178}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1.7320508075688772}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 2.8284271247461903}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.flatten": {"tf": 2}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 2.8284271247461903}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 80, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 17, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}}, "df": 3}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 39}}}}}}, "g": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "/": {"3": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "/": {"4": {"3": {"3": {"9": {"2": {"3": {"0": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}}}}}}}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 5}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1, "/": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "f": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.parse": {"tf": 1}, "sqlglot.transpile": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 3.1622776601683795}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.23606797749979}, "sqlglot.diff": {"tf": 10.488088481701515}, "sqlglot.diff.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.executor": {"tf": 4.69041575982343}, "sqlglot.executor.execute": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1.4142135623730951}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2.23606797749979}, "sqlglot.expressions": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 2}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.7320508075688772}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_children": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 2.23606797749979}, "sqlglot.generator.Generator": {"tf": 2.23606797749979}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 2}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 2}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1.4142135623730951}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 2}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope": {"tf": 3.1622776601683795}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.parse": {"tf": 2}, "sqlglot.parser.Parser.parse_into": {"tf": 2}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1.7320508075688772}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 150, "f": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 2.23606797749979}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 21}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 5, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Identifier.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Literal.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Subquery.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Star.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Alias.output_name": {"tf": 2.23606797749979}, "sqlglot.expressions.Cast.output_name": {"tf": 2.23606797749979}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}}, "df": 34, "s": {"docs": {"sqlglot.optimizer.scope.Scope.selects": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}}, "df": 6}}}, "r": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1}}, "df": 3}}, "n": {"docs": {"sqlglot": {"tf": 2.8284271247461903}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 4.795831523312719}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor": {"tf": 3}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 2.449489742783178}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}}, "df": 44, "e": {"docs": {"sqlglot": {"tf": 4.242640687119285}, "sqlglot.parse": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.diff": {"tf": 3.3166247903554}, "sqlglot.diff.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 2}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 2}, "sqlglot.expressions.Identifier.output_name": {"tf": 2}, "sqlglot.expressions.Literal.output_name": {"tf": 2}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 2}, "sqlglot.expressions.Star.output_name": {"tf": 2}, "sqlglot.expressions.Alias.output_name": {"tf": 2}, "sqlglot.expressions.Cast.output_name": {"tf": 2}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 64, "s": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 2}}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 63}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 3}}, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "b": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.dfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.bfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1.7320508075688772}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 11, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}}, "df": 6}}}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 44, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 19}}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 5, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}}}}}, "s": {"docs": {"sqlglot.dataframe": {"tf": 2}}, "df": 1}, "w": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.7320508075688772}}, "df": 2}}}, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.schema": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 10, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 4}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 2}}, "df": 3}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 24, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 21}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}, "v": {"docs": {"sqlglot.executor.context.Context.__init__": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}}}, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}}}}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.helper.AutoName": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.Dialects": {"tf": 1}, "sqlglot.errors.ErrorLevel": {"tf": 1}, "sqlglot.expressions.Properties.Location": {"tf": 1}, "sqlglot.expressions.DataType.Type": {"tf": 1}, "sqlglot.optimizer.scope.ScopeType": {"tf": 1}, "sqlglot.tokens.TokenType": {"tf": 1}}, "df": 6}}}}}}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 4}}}, "y": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2.8284271247461903}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 11}}, "r": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "x": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1, "p": {"docs": {"sqlglot": {"tf": 4.123105625617661}, "sqlglot.dialects": {"tf": 3.3166247903554}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}}, "df": 19, "r": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 3.4641016151377544}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.expressions": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 3.7416573867739413}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1}, "sqlglot.expressions.Expression.set": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 2}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.union": {"tf": 2.449489742783178}, "sqlglot.expressions.Unionable.intersect": {"tf": 2.449489742783178}, "sqlglot.expressions.Unionable.except_": {"tf": 2.449489742783178}, "sqlglot.expressions.Column.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Literal.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.using": {"tf": 2.23606797749979}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subqueryable.with_": {"tf": 3}, "sqlglot.expressions.Union.limit": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.from_": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.group_by": {"tf": 3}, "sqlglot.expressions.Select.order_by": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.sort_by": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.cluster_by": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.limit": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.offset": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.select": {"tf": 2}, "sqlglot.expressions.Select.lateral": {"tf": 2}, "sqlglot.expressions.Select.join": {"tf": 3}, "sqlglot.expressions.Select.where": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.having": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.distinct": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.ctas": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.lock": {"tf": 1.7320508075688772}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Star.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Alias.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.Cast.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 2.8284271247461903}, "sqlglot.expressions.union": {"tf": 2.6457513110645907}, "sqlglot.expressions.intersect": {"tf": 2.6457513110645907}, "sqlglot.expressions.except_": {"tf": 2.449489742783178}, "sqlglot.expressions.select": {"tf": 2}, "sqlglot.expressions.from_": {"tf": 2.449489742783178}, "sqlglot.expressions.condition": {"tf": 2.8284271247461903}, "sqlglot.expressions.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.not_": {"tf": 2}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 2.23606797749979}, "sqlglot.expressions.subquery": {"tf": 2.6457513110645907}, "sqlglot.expressions.column": {"tf": 1.4142135623730951}, "sqlglot.expressions.cast": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_": {"tf": 1.7320508075688772}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1.4142135623730951}, "sqlglot.expressions.convert": {"tf": 1.7320508075688772}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 2}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 2.23606797749979}, "sqlglot.expressions.replace_placeholders": {"tf": 2.23606797749979}, "sqlglot.expressions.expand": {"tf": 2.23606797749979}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.expressions.false": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.7320508075688772}, "sqlglot.helper.while_changing": {"tf": 2}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2.8284271247461903}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 2.8284271247461903}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 2.8284271247461903}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 2.23606797749979}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 2.6457513110645907}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 3}, "sqlglot.optimizer.normalize.normalize": {"tf": 2.6457513110645907}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 2.449489742783178}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2.23606797749979}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2.6457513110645907}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2.6457513110645907}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 2.6457513110645907}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 2.6457513110645907}, "sqlglot.optimizer.scope.Scope": {"tf": 2}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 2}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 3}, "sqlglot.optimizer.scope.build_scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 2}, "sqlglot.optimizer.simplify.simplify": {"tf": 2.6457513110645907}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2.6457513110645907}, "sqlglot.parser.Parser.parse_into": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.expression": {"tf": 2.23606797749979}, "sqlglot.parser.Parser.validate_expression": {"tf": 2}, "sqlglot.planner.Step.from_expression": {"tf": 2.6457513110645907}, "sqlglot.planner.Scan.from_expression": {"tf": 2.6457513110645907}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2.6457513110645907}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.7320508075688772}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}}, "df": 142, "s": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Literal.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Join.on": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.using": {"tf": 2.23606797749979}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.lateral": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.join": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.where": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.having": {"tf": 2.449489742783178}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Star.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Alias.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1.7320508075688772}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 2.23606797749979}, "sqlglot.expressions.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1.4142135623730951}}, "df": 85}, "|": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression.replace": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 39}}}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.values": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.expand": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 1}}}}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 87, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 16}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 2.8284271247461903}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 7}}, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "e": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "d": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 2}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 2.23606797749979}, "sqlglot.expressions.except_": {"tf": 2.23606797749979}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 5, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}}, "df": 7}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}}, "df": 2}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}}, "df": 2}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}}, "df": 4}}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}}, "df": 2}}}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1}}, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}}, "df": 1}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 19}}}}}, "t": {"docs": {"sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}}, "df": 7}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 2.449489742783178}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 2.449489742783178}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1.4142135623730951}}, "df": 27, "s": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.errors.ErrorLevel.IGNORE": {"tf": 1}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 27}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 39}}}}}}}}}, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 2, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 2, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "s": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 2}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "f": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}, "g": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 24}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 4.123105625617661}}, "df": 1, "s": {"docs": {"sqlglot.dataframe": {"tf": 3}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}}, "df": 9}}}, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.helper.subclasses": {"tf": 1.4142135623730951}}, "df": 1, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 2}, "sqlglot.generator.Generator": {"tf": 2}}, "df": 22}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 2}}}}}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 1, "d": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.helper.first": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}}, "df": 2}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}}, "df": 5}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}}, "df": 3}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 1}}, "df": 1}}}}}}}}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 9}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 3.872983346207417}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 3}}, "df": 1}}}, "u": {"docs": {}, "df": 0, ":": {"8": {"0": {"9": {"0": {"docs": {}, "df": 0, "/": {"1": {"1": {"5": {"docs": {}, "df": 0, "/": {"1": {"docs": {}, "df": 0, "/": {"1": {"9": {"9": {"5": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.convert": {"tf": 1}}, "df": 2}}}}}}}}}, "t": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2, "c": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 3}}, "u": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}}, "c": {"docs": {"sqlglot": {"tf": 3.605551275463989}, "sqlglot.diff": {"tf": 3.4641016151377544}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.flatten": {"tf": 1.4142135623730951}, "sqlglot.expressions.Column.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Identifier.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Literal.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Star.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Alias.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.Cast.output_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.simplify.flatten": {"tf": 2}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 22, "a": {"docs": {"sqlglot.trie.in_trie": {"tf": 1}}, "df": 1, "n": {"docs": {"sqlglot": {"tf": 3.872983346207417}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 4.242640687119285}, "sqlglot.executor": {"tf": 4}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 27, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 3, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 1}}}}}}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.6457513110645907}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 2.449489742783178}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.helper.ensure_list": {"tf": 1}}, "df": 6, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.values": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot.helper.ensure_list": {"tf": 1}}, "df": 1}}, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.7320508075688772}}, "df": 13, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 5}, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 4}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}}, "df": 2}}}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "d": {"docs": {"sqlglot.diff.diff": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 2}}, "t": {"docs": {"sqlglot.trie.in_trie": {"tf": 2}}, "df": 1, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}}, "df": 7}}}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.helper.camel_to_snake_case": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3}}, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.func": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 36}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_correlated_subquery": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 3}}}}}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "m": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}}, "df": 4, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}}, "df": 1, "d": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}}, "df": 1}}, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "x": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 2}}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}}, "df": 2}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}}, "df": 1, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "m": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 3.7416573867739413}}, "df": 1, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}}, "df": 25}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 3.4641016151377544}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_cte": {"tf": 1}}, "df": 13, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 21, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1}}}}, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}}, "df": 2, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}}, "df": 4}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 3, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 40}}, "/": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "b": {"1": {"9": {"3": {"0": {"6": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}, "docs": {}, "df": 0}}}}, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "/": {"8": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 1}, "docs": {}, "df": 0}}}}}}}}}}}}}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.transpile": {"tf": 1}}, "df": 1}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "x": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context.__init__": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 2}, "sqlglot.planner.Scan.from_expression": {"tf": 2}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2}}, "df": 27}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.flatten": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}}, "df": 5}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}}, "df": 2}}}}}, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.not_": {"tf": 1.7320508075688772}, "sqlglot.expressions.condition": {"tf": 2}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 10, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 4}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}}, "df": 2}}}}}}}}, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}}, "df": 2}}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Join.using": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 2, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 22}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 19}}}}, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 1}}}}}}}, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2.8284271247461903}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.7320508075688772}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 10, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}}, "df": 8}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 2.449489742783178}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 4}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.convert": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1}}}}}}}, "j": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}}, "df": 2}}}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 3.605551275463989}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 66}}, "l": {"1": {"docs": {"sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}}, "df": 3}, "2": {"docs": {"sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}}, "df": 3}, "docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 3.1622776601683795}, "sqlglot.executor.execute": {"tf": 1.7320508075688772}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 2}, "sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}}, "df": 7, "a": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2.6457513110645907}}, "df": 3}, "b": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 2}}, "df": 2}, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 3.3166247903554}, "sqlglot.dataframe": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.diff.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1.7320508075688772}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 2.449489742783178}, "sqlglot.expressions.column": {"tf": 2}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.7320508075688772}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 1.7320508075688772}, "sqlglot.schema.Schema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.get_column_type": {"tf": 2}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 2}}, "df": 58, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 26}, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.execute": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.parse": {"tf": 1.4142135623730951}, "sqlglot.helper.ensure_collection": {"tf": 1.4142135623730951}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}}, "df": 1}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 2}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1.4142135623730951}}, "df": 6, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}}, "df": 2}}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 3, "n": {"docs": {}, "df": 0, "\u2019": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 1}, "d": {"docs": {"sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1.4142135623730951}}, "df": 24}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 26, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 8, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3}}}}}}, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}}, "df": 6, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 8}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 3.3166247903554}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.diff.diff": {"tf": 1}}, "df": 3}, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}}, "df": 3}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.6457513110645907}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 2.6457513110645907}, "sqlglot.generator.Generator": {"tf": 2.6457513110645907}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 23, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 40}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2}}}}}, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.assert_is": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.transforms.preprocess": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "n": {"docs": {"sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 2}}}}, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 2}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 7, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.expressions.replace_children": {"tf": 1}}, "df": 2}}}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 9}}, "x": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Select.ctas": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 2}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.transforms.delegate": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 9, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.helper.object_to_dict": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1}}}}}}}}}, "s": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 5}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 24}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "a": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "f": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.diff": {"tf": 3.3166247903554}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}}, "df": 4}}}}}}, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 3}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 2.23606797749979}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 2}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 2}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 2}}, "df": 22, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema.add_table": {"tf": 1}}, "df": 4}}}}, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}, "m": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.Select.cluster_by": {"tf": 2}}, "df": 1}}}}}, "s": {"docs": {"sqlglot.helper.count_params": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot.dataframe": {"tf": 2}}, "df": 1, "v": {"docs": {"sqlglot.helper.csv": {"tf": 1.4142135623730951}, "sqlglot.helper.csv_reader": {"tf": 2}}, "df": 2}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}}}, "i": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "n": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}}, "df": 3}}}, "b": {"docs": {"sqlglot": {"tf": 4.795831523312719}, "sqlglot.diff": {"tf": 3.7416573867739413}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1.4142135623730951}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.helper.dict_depth": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.flatten": {"tf": 2}, "sqlglot.optimizer.simplify.uniq_sort": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.absorb_and_eliminate": {"tf": 3.1622776601683795}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1.7320508075688772}, "sqlglot.trie.new_trie": {"tf": 1.4142135623730951}}, "df": 35, "e": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 3}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 4.242640687119285}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 4}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.while_changing": {"tf": 1.4142135623730951}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.7320508075688772}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2.449489742783178}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 97, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 6}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 4}}}, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 3}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 23}}}}}}, "f": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 23}}}}, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 26}}}, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.diff.Keep": {"tf": 1}, "sqlglot.executor": {"tf": 2.23606797749979}}, "df": 6}}, "y": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 2.449489742783178}, "sqlglot.dialects.bigquery": {"tf": 1}}, "df": 3}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}}, "df": 2}}}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.diff": {"tf": 3.872983346207417}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.build_scope": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 14, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}}, "df": 4}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}, "s": {"docs": {"sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 9}}, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2}}, "df": 2}}}, "g": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 2}, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 5}, "l": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.pretty": {"tf": 1}, "sqlglot.schema": {"tf": 1}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 4.47213595499958}, "sqlglot.diff.ChangeDistiller": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 2}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.7320508075688772}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1.4142135623730951}}, "df": 79, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.python.PythonExecutor.generate_tuple": {"tf": 1}}, "df": 1, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {"sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}}, "df": 3}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1.7320508075688772}}, "df": 2}}}}}, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "z": {"docs": {"sqlglot": {"tf": 2.8284271247461903}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}}, "df": 3}, "r": {"docs": {"sqlglot": {"tf": 2.8284271247461903}, "sqlglot.executor": {"tf": 2}, "sqlglot.expressions.alias_": {"tf": 2}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 2}}, "df": 5, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}, "a": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "c": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "e": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 15, "d": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.executor": {"tf": 2}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 6}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.449489742783178}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.449489742783178}, "sqlglot.executor.python.Python.Generator": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2.449489742783178}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 58, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.expressions.false": {"tf": 1}}, "df": 5, "s": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}}, "df": 4}, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.helper.seq_get": {"tf": 1}}, "df": 1}}}}, "b": {"docs": {"sqlglot.trie.in_trie": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "d": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}}, "df": 3}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}}, "df": 2}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {"sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 9, "n": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.expressions.not_": {"tf": 1.4142135623730951}}, "df": 1}}, "b": {"docs": {"sqlglot.trie.new_trie": {"tf": 1}}, "df": 1}}}, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.4142135623730951}}, "df": 5}}}, "u": {"docs": {"sqlglot.executor": {"tf": 2}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.7320508075688772}}, "df": 2, "s": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.23606797749979}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 2.23606797749979}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 2.23606797749979}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 84, "d": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.schema": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 1.4142135623730951}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 68}, "s": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 4}, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 7}}}, "r": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}}, "df": 3, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 5}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 2}, "sqlglot.expressions.Select.join": {"tf": 2}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 10}}}, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}}, "df": 23, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.23606797749979}, "sqlglot.executor.python.Python.Generator": {"tf": 2.23606797749979}, "sqlglot.generator.Generator": {"tf": 2.23606797749979}}, "df": 22, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}}}}, "r": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.trie.in_trie": {"tf": 1}}, "df": 1}}}}}}}}}}, "i": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.TimeUnit": {"tf": 1}}, "df": 3}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}}, "df": 3}}}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Unionable.union": {"tf": 2.23606797749979}, "sqlglot.expressions.Union.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.is_union": {"tf": 1}}, "df": 5, "s": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.4142135623730951}}, "df": 1}, "/": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "q": {"docs": {"sqlglot.optimizer.simplify.uniq_sort": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}}, "df": 3}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}}, "df": 2, "d": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.7320508075688772}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 3}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}}, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 4}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}, "f": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.apply_index_offset": {"tf": 1}}, "df": 1}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}}, "df": 3}}}}}, "p": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}}, "df": 5, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 21}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 2}, "sqlglot.expressions.update": {"tf": 2.23606797749979}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 2}, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.Update": {"tf": 1}}, "df": 2}}}}}}, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "d": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}}, "df": 1}}}}, "f": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.dataframe": {"tf": 4.69041575982343}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 5, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 3.4641016151377544}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 2.8284271247461903}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 6.855654600401044}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.errors.SqlglotError": {"tf": 1}, "sqlglot.errors.UnsupportedError": {"tf": 1}, "sqlglot.errors.ParseError": {"tf": 1}, "sqlglot.errors.TokenError": {"tf": 1}, "sqlglot.errors.OptimizeError": {"tf": 1}, "sqlglot.errors.SchemaError": {"tf": 1}, "sqlglot.errors.ExecuteError": {"tf": 1}, "sqlglot.executor": {"tf": 4}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 2}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 2.23606797749979}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 2.6457513110645907}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.schema.Schema": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 81, "m": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}}, "df": 10, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.pretty": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1.7320508075688772}}, "df": 26, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.csv": {"tf": 1}}, "df": 23}}}, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}}, "df": 2}}, "l": {"docs": {"sqlglot.helper.count_params": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot.executor.execute": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 3}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 14}, "u": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}}, "df": 8, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 12}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 3}}}}, "k": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot": {"tf": 6.557438524302}, "sqlglot.dataframe": {"tf": 4.58257569495584}, "sqlglot.dialects": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 4.358898943540674}, "sqlglot.executor": {"tf": 4}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 2}, "sqlglot.expressions.Unionable.intersect": {"tf": 2}, "sqlglot.expressions.Unionable.except_": {"tf": 2}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 2}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.group_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.order_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.sort_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.distinct": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 2}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.union": {"tf": 2.23606797749979}, "sqlglot.expressions.intersect": {"tf": 2.23606797749979}, "sqlglot.expressions.except_": {"tf": 2.23606797749979}, "sqlglot.expressions.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.from_": {"tf": 2.23606797749979}, "sqlglot.expressions.update": {"tf": 2}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 1.7320508075688772}, "sqlglot.expressions.replace_placeholders": {"tf": 1.7320508075688772}, "sqlglot.expressions.expand": {"tf": 2.23606797749979}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 2}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 2}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 2}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2.8284271247461903}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 2}, "sqlglot.optimizer.scope.Scope.branch": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 2.23606797749979}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1.7320508075688772}, "sqlglot.planner.Scan.from_expression": {"tf": 1.7320508075688772}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.7320508075688772}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 116, "s": {"docs": {"sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}}}, "e": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}}, "df": 4, "c": {"docs": {"sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.func": {"tf": 2}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 5, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 2}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.7320508075688772}, "sqlglot.expressions.func": {"tf": 2.23606797749979}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_udtf": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}}, "df": 36, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 30}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dataframe.sql.Column.cast": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 4}}}}}}}}}}}, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}}, "df": 3, "y": {"docs": {"sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}}, "df": 2}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"6": {"4": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 1.7320508075688772}}, "df": 2}, "docs": {}, "df": 0}, "docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dialects": {"tf": 1}}, "df": 2}}, "r": {"docs": {}, "df": 0, "\u00e9": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.helper.flatten": {"tf": 1.4142135623730951}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "s": {"docs": {"sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}}, "df": 6}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.flatten": {"tf": 1}}, "df": 1}}}}}}, "g": {"docs": {"sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}}, "df": 6}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 2.449489742783178}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}}, "df": 9, "/": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 3}}, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 15}}}, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}}, "l": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}}, "df": 1}}, "g": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "x": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 3.1622776601683795}, "sqlglot.dataframe": {"tf": 3.4641016151377544}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1}, "sqlglot.diff.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.false": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 72}}, "l": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 2, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}}}, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}, "w": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2}}, "df": 1}}}}}, "l": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 3, "i": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.expressions.Predicate": {"tf": 1}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.to_interval": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}}, "df": 9}}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 22, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 22}, "/": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.lineage.lineage": {"tf": 2}}, "df": 1}}}}, "k": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.PythonExecutor.generate": {"tf": 1}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}}, "df": 8, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}}, "df": 2}}}}}, "t": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}}, "df": 2, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.transpile": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 2}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1.4142135623730951}, "sqlglot.helper.ensure_list": {"tf": 2}, "sqlglot.helper.ensure_collection": {"tf": 1.4142135623730951}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 2.8284271247461903}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse": {"tf": 2}, "sqlglot.parser.Parser.parse_into": {"tf": 2}, "sqlglot.parser.Parser.raise_error": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}}, "df": 53, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "[": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 2}}, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 2}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}}, "df": 10}}}}}}, "b": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}}}, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.limit": {"tf": 2.23606797749979}}, "df": 4, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Union.limit": {"tf": 1}}, "df": 1}}}}}, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}, "o": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "k": {"docs": {"sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.errors.ErrorLevel.WARN": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.dialects": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}}, "df": 4}}}}, "s": {"docs": {"sqlglot.parser.Parser.check_errors": {"tf": 1}}, "df": 1}}, "w": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1.7320508075688772}}, "df": 22}}}, "t": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1}}, "df": 3}, "o": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}, "p": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}}, "df": 10}}, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 44}, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 21}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.7320508075688772}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 5.196152422706632}}, "df": 1}}}, "f": {"docs": {"sqlglot.diff": {"tf": 6.324555320336759}, "sqlglot.expressions.Expression.text": {"tf": 1}}, "df": 2}, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}}, "df": 4}}}, "n": {"docs": {"sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 2, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 24}}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "s": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "x": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}}, "df": 4}}}}, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 42, "r": {"docs": {"sqlglot.expressions.condition": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 41}}, "b": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.Select.lateral": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}}, "df": 1}}}}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "w": {"docs": {"sqlglot.optimizer.simplify.simplify_not": {"tf": 1}}, "df": 1}}, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 8, "/": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}}, "df": 1}}}}}}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}, "l": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "r": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2, "e": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 2, "a": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1.4142135623730951}}, "df": 8, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1.4142135623730951}}, "df": 1}}, "c": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.helper.csv_reader": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {"sqlglot": {"tf": 1.7320508075688772}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "d": {"docs": {"sqlglot.helper.while_changing": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}}, "df": 4, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.env.null_if_any": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1}}, "df": 4}, "s": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 3}}}}}}, "f": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}}, "df": 2, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 6}, "d": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}}, "df": 5}}}}}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "c": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}}, "df": 4, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 5}}}}}}}}, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}}}}, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 1}}}}}, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}}, "df": 10, "s": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.alias": {"tf": 1}, "sqlglot.expressions.Expression.copy": {"tf": 1}, "sqlglot.expressions.Expression.depth": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.parent_select": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.dfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.bfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.unnest": {"tf": 1}, "sqlglot.expressions.Expression.unalias": {"tf": 1}, "sqlglot.expressions.Expression.unnest_operands": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.expressions.Subquery.unnest": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.from_": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.expressions.delete": {"tf": 1}, "sqlglot.expressions.condition": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.column": {"tf": 1}, "sqlglot.expressions.cast": {"tf": 1}, "sqlglot.expressions.table_": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.expressions.column_table_names": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.4142135623730951}, "sqlglot.expressions.true": {"tf": 1}, "sqlglot.expressions.false": {"tf": 1}, "sqlglot.expressions.null": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.csv": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.find_new_name": {"tf": 1}, "sqlglot.helper.object_to_dict": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.helper.is_iterable": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.helper.first": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.Scope.tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ctes": {"tf": 1}, "sqlglot.optimizer.scope.Scope.derived_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.Scope.external_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.unqualified_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.tokens.Tokenizer.tokenize": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 161}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Expression.load": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.to_table": {"tf": 1}, "sqlglot.expressions.to_column": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.serde.load": {"tf": 1}}, "df": 38}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1}}, "df": 3}}}}}}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.simplify.simplify": {"tf": 1}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 12}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}}}, "p": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 3}}, "s": {"docs": {"sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 25}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 4}}}}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 1}}, "df": 10, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}}, "df": 2}}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 3}}}}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.Column.cast": {"tf": 1}}, "df": 1}}}}}}}, "m": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.diff.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.pop": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1}, "sqlglot.optimizer.scope.Scope.remove_source": {"tf": 1}}, "df": 12, "d": {"docs": {"sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 4}, "s": {"docs": {"sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.transforms.remove_precision_parameterized_types": {"tf": 1}}, "df": 3}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.optimizer.simplify.remove_compliments": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 2}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Predicate": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 42}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 2}, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"1": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}, "docs": {"sqlglot.dataframe": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.helper.camel_to_snake_case": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 10, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}}, "df": 5}}}, "s": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 3}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "n": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1}}, "df": 1}}}}, "m": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}}, "df": 8}}}, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.helper.count_params": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "g": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1}}, "df": 4, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}}, "df": 1}}}}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.helper.flatten": {"tf": 1}}, "df": 1}}}}}}, "y": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}}, "d": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.4142135623730951}}, "df": 3}}}}}, "u": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.expressions.rename_table": {"tf": 1}, "sqlglot.optimizer.scope.Scope.rename_source": {"tf": 1}}, "df": 2}}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "w": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "o": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "w": {"docs": {"sqlglot.dataframe": {"tf": 2.449489742783178}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "t": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.is_root": {"tf": 1}, "sqlglot.optimizer.scope.build_scope": {"tf": 1}}, "df": 4}}, "u": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.errors.ErrorLevel.RAISE": {"tf": 1}, "sqlglot.errors.ErrorLevel.IMMEDIATE": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 43, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1}, "sqlglot.parser.Parser.check_errors": {"tf": 1}, "sqlglot.parser.Parser.raise_error": {"tf": 1}}, "df": 5}, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 39}}}}, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 2}}, "k": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "j": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "w": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 3}}, "u": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}}, "df": 6, "n": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 2}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}}, "df": 3}}}}, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.lineage.lineage": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimizer.optimize": {"tf": 2}}, "df": 3}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}, "\u00e9": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 4}}}}}, "w": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 21}}, "o": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 2.6457513110645907}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 4.58257569495584}, "sqlglot.executor": {"tf": 3.4641016151377544}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}, "sqlglot.expressions.subquery": {"tf": 1}, "sqlglot.expressions.values": {"tf": 1}, "sqlglot.expressions.replace_children": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope.replace": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}, "sqlglot.parser.Parser.expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}, "sqlglot.tokens.Token.number": {"tf": 1}, "sqlglot.tokens.Token.string": {"tf": 1}, "sqlglot.tokens.Token.identifier": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}}, "df": 47, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.helper.count_params": {"tf": 1}}, "df": 6}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.executor.context.Context.__init__": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 5}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 2}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.walk": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.expressions.Func": {"tf": 1.4142135623730951}, "sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.transforms.unalias_group": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1}}, "df": 70}}, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.transforms.eliminate_distinct_on": {"tf": 1.4142135623730951}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.8284271247461903}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.context.Context": {"tf": 1}}, "df": 5}}, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 2.23606797749979}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 2.23606797749979}, "sqlglot.diff": {"tf": 4}, "sqlglot.diff.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 2.23606797749979}, "sqlglot.expressions": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 2.23606797749979}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}}, "df": 49}}, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 3}, "sqlglot.expressions.Select.where": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.lock": {"tf": 2}, "sqlglot.expressions.update": {"tf": 2}, "sqlglot.expressions.delete": {"tf": 2}, "sqlglot.expressions.condition": {"tf": 2.449489742783178}, "sqlglot.expressions.replace_placeholders": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.7320508075688772}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2}, "sqlglot.trie.in_trie": {"tf": 1.4142135623730951}}, "df": 18}}, "n": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.renametable_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 3.4641016151377544}, "sqlglot.executor": {"tf": 2}, "sqlglot.executor.context.Context": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 51}, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.pretty": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.is_string": {"tf": 1}, "sqlglot.expressions.Expression.is_number": {"tf": 1}, "sqlglot.expressions.Expression.is_int": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 34}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 6, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}}}, "o": {"docs": {"sqlglot.expressions.Expression.flatten": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot.executor": {"tf": 2}}, "df": 1}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 5}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2}}, "df": 4}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}, "p": {"docs": {"sqlglot.expressions.Condition.not_": {"tf": 1}, "sqlglot.expressions.not_": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1.4142135623730951}}, "df": 11}}}, "s": {"docs": {"sqlglot.helper.ensure_list": {"tf": 1}, "sqlglot.helper.ensure_collection": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 22}, "e": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}}, "df": 4, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 4, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 2.6457513110645907}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 6, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "l": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 2.23606797749979}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 2.449489742783178}, "sqlglot.diff": {"tf": 5.5677643628300215}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_cnf": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_dnf": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 15, "l": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 3}}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1.4142135623730951}}, "df": 3}}, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "\u2019": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 5, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1, "\u2019": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1}, "r": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 2.8284271247461903}}, "df": 2}}, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}, "k": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 5, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.expressions.TimeUnit": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.tokens.Token.var": {"tf": 1.4142135623730951}}, "df": 3, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}}}}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.Func": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 2.23606797749979}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.error_messages": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}, "e": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 2, "d": {"docs": {"sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 1}, "s": {"docs": {"sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 1}}}}}}, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.append": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.set": {"tf": 1.7320508075688772}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.expressions.convert": {"tf": 1.4142135623730951}, "sqlglot.helper.AutoName": {"tf": 1}, "sqlglot.helper.seq_get": {"tf": 1}, "sqlglot.helper.ensure_list": {"tf": 2.23606797749979}, "sqlglot.helper.ensure_collection": {"tf": 2.23606797749979}, "sqlglot.helper.split_num_words": {"tf": 2}, "sqlglot.helper.is_iterable": {"tf": 2}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1.7320508075688772}}, "df": 16, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}, "sqlglot.expressions.values": {"tf": 2.8284271247461903}, "sqlglot.helper.split_num_words": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 11}}}}}, "e": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}}, "df": 2, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 4}, "s": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "a": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "c": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1}}, "df": 2}}}}, "s": {"docs": {"sqlglot.executor.context.Context": {"tf": 1.4142135623730951}}, "df": 1}}}}}}, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}, "i": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}}, "df": 1, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "z": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.expressions.Expression.dfs": {"tf": 1}, "sqlglot.expressions.Expression.bfs": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 7}}, "b": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}}, "df": 3}}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.expressions.Select.lateral": {"tf": 1}}, "df": 1}}}, "\u00e4": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {"sqlglot.executor.table.Tables": {"tf": 2.23606797749979}, "sqlglot.schema.AbstractMappingSchema": {"tf": 2.23606797749979}}, "df": 2}}, "g": {"docs": {"sqlglot.schema": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.schema.Schema.supported_table_args": {"tf": 1}}, "df": 6, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1.7320508075688772}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.7320508075688772}}, "df": 5, "[": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 2.23606797749979}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_all": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.walk": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.dfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.bfs": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.transforms.preprocess": {"tf": 1.4142135623730951}, "sqlglot.transforms.delegate": {"tf": 1.4142135623730951}}, "df": 38}}, "e": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3, "d": {"docs": {"sqlglot.pretty": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "s": {"docs": {"sqlglot.generator.Generator.generate": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.expressions.Tag": {"tf": 1}}, "df": 5}}, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Func": {"tf": 1}}, "df": 3}}}}, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}}, "df": 1}}}}}}}, "t": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.table_name": {"tf": 1}, "sqlglot.helper.dict_depth": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.scope.Scope.source_columns": {"tf": 1}, "sqlglot.schema.Schema.column_names": {"tf": 1}, "sqlglot.schema.Schema.get_column_type": {"tf": 1}, "sqlglot.schema.MappingSchema.column_names": {"tf": 1}, "sqlglot.schema.MappingSchema.get_column_type": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 14, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}}}}, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}}, "df": 2}, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "o": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2}}}}, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "m": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}, "t": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 5.656854249492381}, "sqlglot.diff.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Expression.replace": {"tf": 3}, "sqlglot.expressions.Expression.assert_is": {"tf": 2.449489742783178}, "sqlglot.expressions.Condition.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.not_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Predicate": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 2.449489742783178}, "sqlglot.expressions.Unionable.intersect": {"tf": 2.449489742783178}, "sqlglot.expressions.Unionable.except_": {"tf": 2.449489742783178}, "sqlglot.expressions.Column.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Identifier.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Literal.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Join.on": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.using": {"tf": 2.449489742783178}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 2.449489742783178}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Union.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.group_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.order_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.sort_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.cluster_by": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.limit": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.offset": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.lateral": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.join": {"tf": 3}, "sqlglot.expressions.Select.where": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.having": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.distinct": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.ctas": {"tf": 1.7320508075688772}, "sqlglot.expressions.Select.lock": {"tf": 2.449489742783178}, "sqlglot.expressions.Subquery.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Star.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.Cast.output_name": {"tf": 3.4641016151377544}, "sqlglot.expressions.maybe_parse": {"tf": 2.449489742783178}, "sqlglot.expressions.union": {"tf": 1.7320508075688772}, "sqlglot.expressions.intersect": {"tf": 1.7320508075688772}, "sqlglot.expressions.except_": {"tf": 1.7320508075688772}, "sqlglot.expressions.select": {"tf": 1.7320508075688772}, "sqlglot.expressions.from_": {"tf": 1.7320508075688772}, "sqlglot.expressions.update": {"tf": 2.23606797749979}, "sqlglot.expressions.delete": {"tf": 2.23606797749979}, "sqlglot.expressions.condition": {"tf": 3.4641016151377544}, "sqlglot.expressions.and_": {"tf": 1.7320508075688772}, "sqlglot.expressions.or_": {"tf": 1.7320508075688772}, "sqlglot.expressions.not_": {"tf": 1.7320508075688772}, "sqlglot.expressions.alias_": {"tf": 2.449489742783178}, "sqlglot.expressions.subquery": {"tf": 1.7320508075688772}, "sqlglot.expressions.cast": {"tf": 1.7320508075688772}, "sqlglot.expressions.values": {"tf": 1.7320508075688772}, "sqlglot.expressions.column_table_names": {"tf": 2.449489742783178}, "sqlglot.expressions.table_name": {"tf": 2.449489742783178}, "sqlglot.expressions.replace_tables": {"tf": 2.449489742783178}, "sqlglot.expressions.replace_placeholders": {"tf": 2.449489742783178}, "sqlglot.expressions.expand": {"tf": 2.449489742783178}, "sqlglot.expressions.func": {"tf": 2.449489742783178}, "sqlglot.helper.split_num_words": {"tf": 3}, "sqlglot.helper.is_iterable": {"tf": 2.449489742783178}, "sqlglot.helper.flatten": {"tf": 2.449489742783178}, "sqlglot.helper.dict_depth": {"tf": 3.872983346207417}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 4}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 3.4641016151377544}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 3.4641016151377544}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3.872983346207417}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 3.4641016151377544}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 2.449489742783178}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 3}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 3}, "sqlglot.optimizer.normalize.normalize": {"tf": 3}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 3}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2.449489742783178}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 3.4641016151377544}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 3.4641016151377544}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 3.4641016151377544}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 3}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 3.872983346207417}, "sqlglot.optimizer.simplify.simplify": {"tf": 3}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 3}, "sqlglot.time.format_time": {"tf": 1.7320508075688772}, "sqlglot.transforms.unalias_group": {"tf": 2.449489742783178}, "sqlglot.trie.new_trie": {"tf": 1.7320508075688772}, "sqlglot.trie.in_trie": {"tf": 3}}, "df": 93}, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 2.6457513110645907}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}, "sqlglot.transforms.unalias_group": {"tf": 2}}, "df": 13, "b": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 2.23606797749979}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "p": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1.7320508075688772}, "sqlglot.lineage.lineage": {"tf": 1}}, "df": 3}}, "m": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1}}, "df": 1}}}}}}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "n": {"docs": {"sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.generator.Generator.generate": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.helper.while_changing": {"tf": 1}, "sqlglot.helper.tsort": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.time.format_time": {"tf": 1}}, "df": 40}}}, "t": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1, "h": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "z": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.helper.open_file": {"tf": 1}}, "df": 1}}}}, "q": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 3}}, "c": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 2.8284271247461903}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}}, "df": 6}, "d": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1}}}, "y": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 3.7416573867739413}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 26, "b": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "u": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 14.594519519326424}, "sqlglot.dataframe": {"tf": 10.392304845413264}, "sqlglot.dialects": {"tf": 5.385164807134504}, "sqlglot.diff": {"tf": 5.830951894845301}, "sqlglot.diff.diff": {"tf": 2}, "sqlglot.executor": {"tf": 3.7416573867739413}, "sqlglot.expressions.Expression": {"tf": 2}, "sqlglot.expressions.Expression.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.assert_is": {"tf": 2}, "sqlglot.expressions.Condition.and_": {"tf": 2}, "sqlglot.expressions.Condition.or_": {"tf": 2}, "sqlglot.expressions.Condition.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Unionable.union": {"tf": 2}, "sqlglot.expressions.Unionable.intersect": {"tf": 2}, "sqlglot.expressions.Unionable.except_": {"tf": 2}, "sqlglot.expressions.Column.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Identifier.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Literal.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.on": {"tf": 2}, "sqlglot.expressions.Join.using": {"tf": 2.449489742783178}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 2.449489742783178}, "sqlglot.expressions.Subqueryable.with_": {"tf": 2.8284271247461903}, "sqlglot.expressions.Union.limit": {"tf": 2}, "sqlglot.expressions.Select.from_": {"tf": 2}, "sqlglot.expressions.Select.group_by": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.order_by": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.sort_by": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.cluster_by": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.limit": {"tf": 2}, "sqlglot.expressions.Select.offset": {"tf": 2}, "sqlglot.expressions.Select.select": {"tf": 2}, "sqlglot.expressions.Select.lateral": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.join": {"tf": 5.477225575051661}, "sqlglot.expressions.Select.where": {"tf": 2.8284271247461903}, "sqlglot.expressions.Select.having": {"tf": 3.1622776601683795}, "sqlglot.expressions.Select.distinct": {"tf": 2}, "sqlglot.expressions.Select.ctas": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.lock": {"tf": 4.47213595499958}, "sqlglot.expressions.Subquery.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Star.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Alias.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.Cast.output_name": {"tf": 2.449489742783178}, "sqlglot.expressions.maybe_parse": {"tf": 2}, "sqlglot.expressions.union": {"tf": 2}, "sqlglot.expressions.intersect": {"tf": 2}, "sqlglot.expressions.except_": {"tf": 2}, "sqlglot.expressions.select": {"tf": 2.449489742783178}, "sqlglot.expressions.from_": {"tf": 2.449489742783178}, "sqlglot.expressions.update": {"tf": 4}, "sqlglot.expressions.delete": {"tf": 2}, "sqlglot.expressions.condition": {"tf": 3.1622776601683795}, "sqlglot.expressions.and_": {"tf": 2.449489742783178}, "sqlglot.expressions.or_": {"tf": 2.449489742783178}, "sqlglot.expressions.not_": {"tf": 2}, "sqlglot.expressions.values": {"tf": 1.4142135623730951}, "sqlglot.expressions.column_table_names": {"tf": 1.4142135623730951}, "sqlglot.expressions.table_name": {"tf": 1.4142135623730951}, "sqlglot.expressions.replace_tables": {"tf": 2.449489742783178}, "sqlglot.expressions.replace_placeholders": {"tf": 2.8284271247461903}, "sqlglot.expressions.expand": {"tf": 2.449489742783178}, "sqlglot.expressions.func": {"tf": 2.449489742783178}, "sqlglot.helper.split_num_words": {"tf": 3.4641016151377544}, "sqlglot.helper.is_iterable": {"tf": 1.4142135623730951}, "sqlglot.helper.flatten": {"tf": 1.4142135623730951}, "sqlglot.helper.dict_depth": {"tf": 3.1622776601683795}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 3.1622776601683795}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 2}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 2}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalization_distance": {"tf": 1.4142135623730951}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1.4142135623730951}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 2.8284271247461903}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 2}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.simplify": {"tf": 1.4142135623730951}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.time.format_time": {"tf": 2.449489742783178}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 2.449489742783178}, "sqlglot.trie.in_trie": {"tf": 3.4641016151377544}}, "df": 87, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 25, "d": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.diff.diff": {"tf": 2}, "sqlglot.expressions.maybe_parse": {"tf": 1}, "sqlglot.expressions.to_identifier": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1.4142135623730951}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 6}, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}}, "df": 25}}}, "k": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}}, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}}, "df": 6, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.lineage.lineage": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "d": {"docs": {"sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1.4142135623730951}, "sqlglot.optimizer.qualify_columns.validate_qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1.4142135623730951}}, "df": 4}}}}}}}}}, "y": {"docs": {"sqlglot": {"tf": 3.3166247903554}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 3.4641016151377544}, "sqlglot.expressions.Expression.replace": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Predicate": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 3.1622776601683795}, "sqlglot.expressions.Select.having": {"tf": 2}, "sqlglot.expressions.Kwarg": {"tf": 1}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.4142135623730951}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 2}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 2}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 3}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 2.8284271247461903}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2}, "sqlglot.optimizer.scope.Scope": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 2}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2.8284271247461903}, "sqlglot.planner.Step.from_expression": {"tf": 2.8284271247461903}, "sqlglot.planner.Scan.from_expression": {"tf": 2.8284271247461903}, "sqlglot.planner.SetOperation.from_expression": {"tf": 2.8284271247461903}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}}, "df": 39, "o": {"docs": {}, "df": 0, "u": {"docs": {"sqlglot": {"tf": 2.23606797749979}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 2}, "sqlglot.executor": {"tf": 2}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}}, "df": 7, "r": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 4}}}, "y": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "y": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.time.format_time": {"tf": 1.4142135623730951}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1}, "sqlglot.expressions.Expression.flatten": {"tf": 1}, "sqlglot.helper.csv_reader": {"tf": 1}, "sqlglot.helper.flatten": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.Scope.traverse": {"tf": 1}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}}, "df": 8}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "e": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "h": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot": {"tf": 1}}, "df": 1, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}}}, "e": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.dialects.dialect.create_with_partitions_sql": {"tf": 1}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}}, "df": 7}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "y": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.diff": {"tf": 3.7416573867739413}}, "df": 1, "g": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}}, "df": 1}}}}}}}}, "m": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1.4142135623730951}}, "df": 1}}}}, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 4, "e": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 3}}}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.executor.context.Context": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}}, "df": 2}, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 18}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "p": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "q": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "o": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}}}, "l": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.expressions.values": {"tf": 1}}, "df": 3, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dialects.dialect.format_time_lambda": {"tf": 1}, "sqlglot.expressions": {"tf": 1}}, "df": 2, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "f": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.expressions.condition": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 4}}}}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}}}}}}}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 2}}, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.with_properties": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 4.69041575982343}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.qualify_columns.qualify_columns": {"tf": 1}, "sqlglot.optimizer.qualify_tables.qualify_tables": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}}, "df": 9, "n": {"docs": {}, "df": 0, "\u2019": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.executor": {"tf": 2}, "sqlglot.expressions.Select.having": {"tf": 1.7320508075688772}}, "df": 2}}}}, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.diff.Insert": {"tf": 1}, "sqlglot.diff.Remove": {"tf": 1}, "sqlglot.diff.Move": {"tf": 1}, "sqlglot.diff.Update": {"tf": 1}, "sqlglot.executor": {"tf": 2.449489742783178}, "sqlglot.expressions.Expression.output_name": {"tf": 1}, "sqlglot.expressions.Column.output_name": {"tf": 1}, "sqlglot.expressions.Identifier.output_name": {"tf": 1}, "sqlglot.expressions.Literal.output_name": {"tf": 1}, "sqlglot.expressions.Subquery.output_name": {"tf": 1}, "sqlglot.expressions.Star.output_name": {"tf": 1}, "sqlglot.expressions.Alias.output_name": {"tf": 1}, "sqlglot.expressions.Cast.output_name": {"tf": 1}, "sqlglot.expressions.alias_": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 19, "n": {"docs": {"sqlglot.diff.Keep": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2, "\u2019": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "h": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}}, "df": 2}, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.union": {"tf": 1.4142135623730951}, "sqlglot.expressions.intersect": {"tf": 1.4142135623730951}, "sqlglot.expressions.except_": {"tf": 1.4142135623730951}}, "df": 3, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1}}, "df": 2}}, "w": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "f": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "p": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "u": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "\u2019": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "t": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, ":": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "x": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}}}}}}}}}}, "d": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1}}}, "e": {"docs": {}, "df": 0, "v": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 1}}}, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "j": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}}, "df": 1}}}}}}}}}, ":": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "/": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "p": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "b": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 1}}}}}}}}}}}, "m": {"docs": {"sqlglot.expressions.Matches": {"tf": 1}}, "df": 1, "l": {"docs": {"sqlglot.dataframe.sql.DataFrame.persist": {"tf": 1}, "sqlglot.lineage.LineageHTML": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 3}}}}, "m": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 3, "a": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.values_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1}}, "df": 9, "b": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}}, "df": 1}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 2}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot.dialects": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.env.null_if_any": {"tf": 1}, "sqlglot.optimizer.lower_identities.lower_identities": {"tf": 1}}, "df": 4}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 2}}}}, "p": {"docs": {"sqlglot.expressions.Func": {"tf": 1}}, "df": 1, "p": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1.4142135623730951}, "sqlglot.executor.table.Tables": {"tf": 1.7320508075688772}, "sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.replace_tables": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.4142135623730951}, "sqlglot.lineage.lineage": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.scope.Scope": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.cte_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.ref_count": {"tf": 1}, "sqlglot.schema.Schema.add_table": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema": {"tf": 1.7320508075688772}, "sqlglot.schema.MappingSchema.add_table": {"tf": 1.7320508075688772}, "sqlglot.time.format_time": {"tf": 1.4142135623730951}}, "df": 39, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 22}, "[": {"docs": {}, "df": 0, "k": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.replace_tables": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}}, "df": 2}}}, "s": {"docs": {"sqlglot.expressions.Expression": {"tf": 1}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 5}}, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 3, "t": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}}, "df": 6}, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.parser.Parser.validate_expression": {"tf": 1}}, "df": 2}}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.diff": {"tf": 2}, "sqlglot.expressions.Expression.find": {"tf": 1}, "sqlglot.expressions.Expression.find_all": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find_all": {"tf": 1.4142135623730951}}, "df": 7, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.values_sql": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.expressions.Expression.find": {"tf": 1.4142135623730951}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1.4142135623730951}}, "df": 6}, "d": {"docs": {"sqlglot.diff": {"tf": 2.23606797749979}}, "df": 1}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.diff": {"tf": 7.14142842854285}, "sqlglot.expressions.Expression.find_ancestor": {"tf": 1}, "sqlglot.expressions.Matches": {"tf": 1}, "sqlglot.optimizer.scope.Scope.find": {"tf": 1}}, "df": 4, "s": {"docs": {"sqlglot.diff": {"tf": 3}}, "df": 1}}}}}}, "t": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "i": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "h": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "x": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1.7320508075688772}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1.7320508075688772}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1.7320508075688772}, "sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor.python.Python.Generator": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.normalize": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 42, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}}, "df": 39}}, "a": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot.optimizer.normalize.normalize": {"tf": 1}}, "df": 1}}}}}, "r": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.diff.ChangeDistiller": {"tf": 1}}, "df": 2, "e": {"docs": {}, "df": 0, "z": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "o": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "e": {"docs": {"sqlglot.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}}, "df": 2, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "a": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dataframe": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}}, "l": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "h": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.canonicalize.canonicalize": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 45, "s": {"docs": {"sqlglot.helper.count_params": {"tf": 1}, "sqlglot.transforms.delegate": {"tf": 1}}, "df": 2}}}}, "r": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}}, "df": 1}}}}}, "s": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1.4142135623730951}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser": {"tf": 1.4142135623730951}}, "df": 18, "s": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Parser": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Parser": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Parser": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Parser": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Parser": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Parser": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Parser": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Parser": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Parser": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Parser": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Parser": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Parser": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Parser": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Parser": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Parser": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Parser": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression.error_messages": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.parser.Parser": {"tf": 1}, "sqlglot.parser.Parser.parse": {"tf": 1}, "sqlglot.parser.Parser.parse_into": {"tf": 1}}, "df": 43}}}}}}, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}}, "df": 1, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2}}, "df": 1, "s": {"docs": {"sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 1}}}}}, "o": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "f": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot": {"tf": 1.7320508075688772}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}}, "df": 21}, "i": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.Expression.transform": {"tf": 1}}, "df": 2}}}}}}}, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.expressions.Expression.transform": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.distinct": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}}, "df": 18}}}}}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.expressions": {"tf": 1}, "sqlglot.helper.subclasses": {"tf": 1.4142135623730951}}, "df": 4}}}, "e": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.helper.open_file": {"tf": 1}}, "df": 23, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dataframe": {"tf": 1}}, "df": 1}}}}}, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {"sqlglot.expressions.to_interval": {"tf": 1}}, "df": 1}}}, "p": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "v": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 3.1622776601683795}, "sqlglot.diff.diff": {"tf": 1}}, "df": 3, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 2}}, "df": 1}}}}}, "d": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}}, "df": 1}}}, "z": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "r": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.6457513110645907}, "sqlglot.executor": {"tf": 2}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.helper.apply_index_offset": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 8}, "a": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 5, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1}}, "df": 3}}}}, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 1}}}, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}, "u": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "i": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}}, "df": 2, "p": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "e": {"docs": {"sqlglot.executor": {"tf": 1.7320508075688772}, "sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.select": {"tf": 1}, "sqlglot.expressions.and_": {"tf": 1}, "sqlglot.expressions.or_": {"tf": 1}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 11}}}}}}, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}}, "df": 4}}, "c": {"docs": {}, "df": 0, "h": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}}, "df": 2}}, "t": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1}}, "df": 2}}}}}}}, "y": {"docs": {"sqlglot.diff": {"tf": 2.449489742783178}, "sqlglot.executor": {"tf": 2.23606797749979}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.delete": {"tf": 1.4142135623730951}}, "df": 4, "s": {"docs": {}, "df": 0, "q": {"docs": {}, "df": 0, "l": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.parse": {"tf": 1}, "sqlglot.parse_one": {"tf": 1}, "sqlglot.transpile": {"tf": 1.4142135623730951}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.executor.execute": {"tf": 1}, "sqlglot.expressions.Expression.sql": {"tf": 1}, "sqlglot.expressions.Select.lock": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 1}}, "df": 9}}, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "f": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 2.6457513110645907}}, "df": 1}}}}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "c": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "x": {"docs": {"sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}}, "df": 1, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.dataframe.sql.DataFrame.orderBy": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.sort": {"tf": 1}}, "df": 2}}}}, "g": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dialects.snowflake.Snowflake.Generator.select_sql": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 1}, "sqlglot.planner.Step.from_expression": {"tf": 1}, "sqlglot.planner.Scan.from_expression": {"tf": 1}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 8}}}, "n": {"docs": {"sqlglot.diff": {"tf": 1.4142135623730951}, "sqlglot.helper.split_num_words": {"tf": 1}}, "df": 2, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}, "i": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "u": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.helper.split_num_words": {"tf": 1}}, "df": 1}}}}}, "d": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "s": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "h": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "l": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "s": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}}}}}}}, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.schema.MappingSchema": {"tf": 1}}, "df": 1}}}}}}, "j": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.executor": {"tf": 2.449489742783178}, "sqlglot.expressions.Join.on": {"tf": 2.23606797749979}, "sqlglot.expressions.Join.using": {"tf": 2.23606797749979}, "sqlglot.expressions.Select.join": {"tf": 3.7416573867739413}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 2.23606797749979}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2}, "sqlglot.optimizer.scope.Scope.selected_sources": {"tf": 1}, "sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}, "sqlglot.planner.Step.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.Scan.from_expression": {"tf": 1.4142135623730951}, "sqlglot.planner.SetOperation.from_expression": {"tf": 1.4142135623730951}}, "df": 17, "s": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.executor": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimize_joins.reorder_joins": {"tf": 1}, "sqlglot.optimizer.optimize_joins.normalize": {"tf": 1}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 1}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 1.4142135623730951}}, "df": 9}, "h": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.scope.Scope.join_hints": {"tf": 1}}, "df": 1}}}}}}, "h": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}, "u": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "y": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}, "b": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}, "u": {"docs": {}, "df": 0, "s": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dataframe.sql.DataFrame.fillna": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator.datatype_sql": {"tf": 1}, "sqlglot.diff": {"tf": 2.23606797749979}, "sqlglot.executor": {"tf": 2.23606797749979}}, "df": 5}}, "n": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "c": {"docs": {}, "df": 0, "k": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}, "m": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "v": {"docs": {}, "df": 0, "a": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 1}}, "df": 2}}}, "e": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}, "v": {"docs": {}, "df": 0, "m": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}, "s": {"docs": {"sqlglot.lineage.LineageHTML": {"tf": 1}}, "df": 1, "o": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.expressions.Expression.dump": {"tf": 1}, "sqlglot.serde.dump": {"tf": 1}}, "df": 2}}}}, "x": {"docs": {"sqlglot": {"tf": 4.898979485566356}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor": {"tf": 4.358898943540674}, "sqlglot.expressions.Expression.replace": {"tf": 1}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Condition.not_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Predicate": {"tf": 1.7320508075688772}, "sqlglot.expressions.Join.on": {"tf": 1.4142135623730951}, "sqlglot.expressions.Join.using": {"tf": 1.4142135623730951}, "sqlglot.expressions.Subqueryable.subquery": {"tf": 2}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.from_": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.group_by": {"tf": 2}, "sqlglot.expressions.Select.order_by": {"tf": 2}, "sqlglot.expressions.Select.sort_by": {"tf": 2}, "sqlglot.expressions.Select.cluster_by": {"tf": 2}, "sqlglot.expressions.Select.limit": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.offset": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.select": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.where": {"tf": 2.449489742783178}, "sqlglot.expressions.Select.having": {"tf": 2}, "sqlglot.expressions.Select.distinct": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.ctas": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lock": {"tf": 2.8284271247461903}, "sqlglot.expressions.Tag": {"tf": 1}, "sqlglot.expressions.maybe_parse": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.condition": {"tf": 2}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.subquery": {"tf": 2}, "sqlglot.expressions.cast": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.7320508075688772}, "sqlglot.optimizer.annotate_types.annotate_types": {"tf": 1.7320508075688772}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 2.23606797749979}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 2.23606797749979}, "sqlglot.optimizer.expand_laterals.expand_laterals": {"tf": 2.23606797749979}, "sqlglot.optimizer.expand_multi_table_selects.expand_multi_table_selects": {"tf": 1.4142135623730951}, "sqlglot.optimizer.merge_subqueries.merge_subqueries": {"tf": 2.8284271247461903}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 2.449489742783178}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2}, "sqlglot.optimizer.pushdown_predicates.pushdown_predicates": {"tf": 2}, "sqlglot.optimizer.pushdown_projections.pushdown_projections": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope": {"tf": 2.23606797749979}, "sqlglot.optimizer.scope.Scope.subqueries": {"tf": 1}, "sqlglot.optimizer.scope.Scope.selects": {"tf": 1}, "sqlglot.optimizer.scope.traverse_scope": {"tf": 2}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.7320508075688772}, "sqlglot.optimizer.simplify.simplify_not": {"tf": 2}, "sqlglot.optimizer.unnest_subqueries.unnest_subqueries": {"tf": 2.449489742783178}, "sqlglot.planner.Step.from_expression": {"tf": 4}, "sqlglot.planner.Scan.from_expression": {"tf": 4}, "sqlglot.planner.SetOperation.from_expression": {"tf": 4}, "sqlglot.transforms.unalias_group": {"tf": 1.4142135623730951}}, "df": 60, "a": {"docs": {}, "df": 0, "v": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}, "z": {"docs": {"sqlglot": {"tf": 3}, "sqlglot.expressions.Expression.assert_is": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.lateral": {"tf": 1.4142135623730951}, "sqlglot.expressions.Select.join": {"tf": 1.4142135623730951}, "sqlglot.expressions.update": {"tf": 1.4142135623730951}, "sqlglot.expressions.and_": {"tf": 1.4142135623730951}, "sqlglot.expressions.or_": {"tf": 1.4142135623730951}, "sqlglot.expressions.expand": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_ctes.eliminate_ctes": {"tf": 1.4142135623730951}, "sqlglot.optimizer.eliminate_subqueries.eliminate_subqueries": {"tf": 1.4142135623730951}, "sqlglot.optimizer.normalize.normalize": {"tf": 1.7320508075688772}, "sqlglot.optimizer.normalize.distributive_law": {"tf": 2.23606797749979}, "sqlglot.optimizer.optimize_joins.optimize_joins": {"tf": 2.449489742783178}, "sqlglot.optimizer.simplify.rewrite_between": {"tf": 1.4142135623730951}}, "df": 14, "e": {"docs": {}, "df": 0, "i": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "m": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "n": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}, "r": {"docs": {}, "df": 0, "o": {"docs": {"sqlglot.executor": {"tf": 1}}, "df": 1}}}}, "k": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "p": {"docs": {"sqlglot": {"tf": 1}, "sqlglot.diff": {"tf": 3.605551275463989}, "sqlglot.diff.diff": {"tf": 1.7320508075688772}, "sqlglot.executor": {"tf": 1}}, "df": 4}}, "y": {"docs": {"sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression": {"tf": 2}, "sqlglot.expressions.Expression.this": {"tf": 1}, "sqlglot.expressions.Expression.expression": {"tf": 1}, "sqlglot.expressions.Expression.expressions": {"tf": 1}, "sqlglot.expressions.Expression.text": {"tf": 1}, "sqlglot.expressions.Expression.append": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.set": {"tf": 1.4142135623730951}, "sqlglot.expressions.Expression.walk": {"tf": 1}, "sqlglot.generator.Generator": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.join_condition": {"tf": 1.4142135623730951}, "sqlglot.optimizer.scope.walk_in_scope": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}, "sqlglot.trie.in_trie": {"tf": 2}}, "df": 34, "w": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.dialects.drill.if_sql": {"tf": 1}, "sqlglot.executor": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}, "sqlglot.trie.new_trie": {"tf": 1}, "sqlglot.trie.in_trie": {"tf": 1}}, "df": 6, "s": {"docs": {"sqlglot": {"tf": 1.4142135623730951}, "sqlglot.dialects": {"tf": 1.4142135623730951}, "sqlglot.trie.new_trie": {"tf": 2}}, "df": 3}}}}}, "s": {"docs": {"sqlglot.dataframe": {"tf": 1}, "sqlglot.dialects.bigquery.BigQuery.Generator": {"tf": 1}, "sqlglot.dialects.clickhouse.ClickHouse.Generator": {"tf": 1}, "sqlglot.dialects.databricks.Databricks.Generator": {"tf": 1}, "sqlglot.dialects.drill.Drill.Generator": {"tf": 1}, "sqlglot.dialects.duckdb.DuckDB.Generator": {"tf": 1}, "sqlglot.dialects.hive.Hive.Generator": {"tf": 1}, "sqlglot.dialects.mysql.MySQL.Generator": {"tf": 1}, "sqlglot.dialects.oracle.Oracle.Generator": {"tf": 1}, "sqlglot.dialects.postgres.Postgres.Generator": {"tf": 1}, "sqlglot.dialects.presto.Presto.Generator": {"tf": 1}, "sqlglot.dialects.redshift.Redshift.Generator": {"tf": 1}, "sqlglot.dialects.snowflake.Snowflake.Generator": {"tf": 1}, "sqlglot.dialects.spark.Spark.Generator": {"tf": 1}, "sqlglot.dialects.sqlite.SQLite.Generator": {"tf": 1}, "sqlglot.dialects.starrocks.StarRocks.Generator": {"tf": 1}, "sqlglot.dialects.tableau.Tableau.Generator": {"tf": 1}, "sqlglot.dialects.teradata.Teradata.Generator": {"tf": 1}, "sqlglot.dialects.trino.Trino.Generator": {"tf": 1}, "sqlglot.dialects.tsql.TSQL.Generator": {"tf": 1}, "sqlglot.diff": {"tf": 1}, "sqlglot.executor.python.Python.Generator": {"tf": 1}, "sqlglot.expressions.Expression": {"tf": 1.7320508075688772}, "sqlglot.generator.Generator": {"tf": 1}}, "df": 24}, "e": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "r": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1}}, "df": 2}}}}, "d": {"docs": {"sqlglot.trie.new_trie": {"tf": 1}}, "df": 1}}}, "r": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "l": {"docs": {}, "df": 0, "s": {"docs": {"sqlglot": {"tf": 1}}, "df": 1}}}}}, "p": {"docs": {}, "df": 0, "t": {"docs": {"sqlglot.optimizer.scope.Scope.replace": {"tf": 1}}, "df": 1}}}, "a": {"docs": {}, "df": 0, "t": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.dataframe": {"tf": 1.7320508075688772}}, "df": 1}}}, "i": {"docs": {}, "df": 0, "n": {"docs": {}, "df": 0, "d": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1, "s": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}, "n": {"docs": {}, "df": 0, "o": {"docs": {}, "df": 0, "w": {"docs": {"sqlglot.diff": {"tf": 1}, "sqlglot.optimizer.eliminate_joins.eliminate_joins": {"tf": 1}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1}}, "df": 3, "l": {"docs": {}, "df": 0, "e": {"docs": {}, "df": 0, "d": {"docs": {}, "df": 0, "g": {"docs": {}, "df": 0, "e": {"docs": {"sqlglot.diff": {"tf": 1}}, "df": 1}}}}}}}}, "t": {"docs": {"sqlglot.executor.table.Tables": {"tf": 1.4142135623730951}, "sqlglot.schema.AbstractMappingSchema": {"tf": 1.4142135623730951}}, "df": 2}, "w": {"docs": {}, "df": 0, "a": {"docs": {}, "df": 0, "r": {"docs": {}, "df": 0, "g": {"docs": {"sqlglot.expressions.Kwarg": {"tf": 1.4142135623730951}}, "df": 1, "s": {"docs": {"sqlglot.expressions.Condition.and_": {"tf": 1}, "sqlglot.expressions.Condition.or_": {"tf": 1}, "sqlglot.expressions.Unionable.union": {"tf": 1}, "sqlglot.expressions.Unionable.intersect": {"tf": 1}, "sqlglot.expressions.Unionable.except_": {"tf": 1}, "sqlglot.expressions.Join.on": {"tf": 1}, "sqlglot.expressions.Join.using": {"tf": 1}, "sqlglot.expressions.Subqueryable.with_": {"tf": 1}, "sqlglot.expressions.Union.limit": {"tf": 1}, "sqlglot.expressions.Select.from_": {"tf": 1}, "sqlglot.expressions.Select.group_by": {"tf": 1}, "sqlglot.expressions.Select.order_by": {"tf": 1}, "sqlglot.expressions.Select.sort_by": {"tf": 1}, "sqlglot.expressions.Select.cluster_by": {"tf": 1}, "sqlglot.expressions.Select.limit": {"tf": 1}, "sqlglot.expressions.Select.offset": {"tf": 1}, "sqlglot.expressions.Select.select": {"tf": 1}, "sqlglot.expressions.Select.lateral": {"tf": 1}, "sqlglot.expressions.Select.join": {"tf": 1}, "sqlglot.expressions.Select.where": {"tf": 1}, "sqlglot.expressions.Select.having": {"tf": 1}, "sqlglot.expressions.Select.ctas": {"tf": 1}, "sqlglot.expressions.union": {"tf": 1}, "sqlglot.expressions.intersect": {"tf": 1}, "sqlglot.expressions.except_": {"tf": 1}, "sqlglot.expressions.replace_placeholders": {"tf": 1}, "sqlglot.expressions.func": {"tf": 1.7320508075688772}, "sqlglot.optimizer.optimizer.optimize": {"tf": 1.4142135623730951}, "sqlglot.parser.Parser.expression": {"tf": 1}}, "df": 29}}}}}}}}}, "pipeline": ["trimmer"], "_isPrebuiltIndex": true}; + + // mirrored in build-search-index.js (part 1) + // Also split on html tags. this is a cheap heuristic, but good enough. + elasticlunr.tokenizer.setSeperator(/[\s\-.;&_'"=,()]+|<[^>]*>/); + + let searchIndex; + if (docs._isPrebuiltIndex) { + console.info("using precompiled search index"); + searchIndex = elasticlunr.Index.load(docs); + } else { + console.time("building search index"); + // mirrored in build-search-index.js (part 2) + searchIndex = elasticlunr(function () { + this.pipeline.remove(elasticlunr.stemmer); + this.pipeline.remove(elasticlunr.stopWordFilter); + this.addField("qualname"); + this.addField("fullname"); + this.addField("annotation"); + this.addField("default_value"); + this.addField("signature"); + this.addField("bases"); + this.addField("doc"); + this.setRef("fullname"); + }); + for (let doc of docs) { + searchIndex.addDoc(doc); + } + console.timeEnd("building search index"); + } + + return (term) => searchIndex.search(term, { + fields: { + qualname: {boost: 4}, + fullname: {boost: 2}, + annotation: {boost: 2}, + default_value: {boost: 2}, + signature: {boost: 2}, + bases: {boost: 2}, + doc: {boost: 1}, + }, + expand: true + }); +})();
\ No newline at end of file diff --git a/docs/sqlglot.html b/docs/sqlglot.html new file mode 100644 index 0000000..e7a1724 --- /dev/null +++ b/docs/sqlglot.html @@ -0,0 +1,1226 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + <h2>Contents</h2> + <ul> + <li><a href="#sqlglot">SQLGlot</a> + <ul> + <li><a href="#table-of-contents">Table of Contents</a></li> + <li><a href="#install">Install</a></li> + <li><a href="#get-in-touch">Get in Touch</a></li> + <li><a href="#examples">Examples</a></li> + <li><a href="#used-by">Used By</a></li> + <li><a href="#documentation">Documentation</a></li> + <li><a href="#run-tests-and-lint">Run Tests and Lint</a></li> + <li><a href="#benchmarks">Benchmarks</a></li> + <li><a href="#optional-dependencies">Optional Dependencies</a></li> + </ul></li> +</ul> + + + <h2>Submodules</h2> + <ul> + <li><a href="sqlglot/dataframe.html">dataframe</a></li> + <li><a href="sqlglot/dialects.html">dialects</a></li> + <li><a href="sqlglot/diff.html">diff</a></li> + <li><a href="sqlglot/errors.html">errors</a></li> + <li><a href="sqlglot/executor.html">executor</a></li> + <li><a href="sqlglot/expressions.html">expressions</a></li> + <li><a href="sqlglot/generator.html">generator</a></li> + <li><a href="sqlglot/helper.html">helper</a></li> + <li><a href="sqlglot/lineage.html">lineage</a></li> + <li><a href="sqlglot/optimizer.html">optimizer</a></li> + <li><a href="sqlglot/parser.html">parser</a></li> + <li><a href="sqlglot/planner.html">planner</a></li> + <li><a href="sqlglot/schema.html">schema</a></li> + <li><a href="sqlglot/serde.html">serde</a></li> + <li><a href="sqlglot/time.html">time</a></li> + <li><a href="sqlglot/tokens.html">tokens</a></li> + <li><a href="sqlglot/transforms.html">transforms</a></li> + <li><a href="sqlglot/trie.html">trie</a></li> + </ul> + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="variable" href="#pretty">pretty</a> + </li> + <li> + <a class="variable" href="#schema">schema</a> + </li> + <li> + <a class="function" href="#parse">parse</a> + </li> + <li> + <a class="function" href="#parse_one">parse_one</a> + </li> + <li> + <a class="function" href="#transpile">transpile</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/__init__.py">Edit on GitHub</a> + + <div class="docstring"><h1 id="sqlglot">SQLGlot</h1> + +<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> + +<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> + +<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> + +<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’s goal, so some syntax errors may go unnoticed.</p> + +<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> + +<h2 id="table-of-contents">Table of Contents</h2> + +<ul> +<li><a href="#install">Install</a></li> +<li><a href="#get-in-touch">Get in Touch</a></li> +<li><a href="#examples">Examples</a> +<ul> +<li><a href="#formatting-and-transpiling">Formatting and Transpiling</a></li> +<li><a href="#metadata">Metadata</a></li> +<li><a href="#parser-errors">Parser Errors</a></li> +<li><a href="#unsupported-errors">Unsupported Errors</a></li> +<li><a href="#build-and-modify-sql">Build and Modify SQL</a></li> +<li><a href="#sql-optimizer">SQL Optimizer</a></li> +<li><a href="#ast-introspection">AST Introspection</a></li> +<li><a href="#ast-diff">AST Diff</a></li> +<li><a href="#custom-dialects">Custom Dialects</a></li> +<li><a href="#sql-execution">SQL Execution</a></li> +</ul></li> +<li><a href="#used-by">Used By</a></li> +<li><a href="#documentation">Documentation</a></li> +<li><a href="#run-tests-and-lint">Run Tests and Lint</a></li> +<li><a href="#benchmarks">Benchmarks</a></li> +<li><a href="#optional-dependencies">Optional Dependencies</a></li> +</ul> + +<h2 id="install">Install</h2> + +<p>From PyPI:</p> + +<pre><code>pip3 install sqlglot +</code></pre> + +<p>Or with a local checkout:</p> + +<pre><code>make install +</code></pre> + +<p>Requirements for development (optional):</p> + +<pre><code>make install-dev +</code></pre> + +<h2 id="get-in-touch">Get in Touch</h2> + +<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> + +<h2 id="examples">Examples</h2> + +<h3 id="formatting-and-transpiling">Formatting and Transpiling</h3> + +<p>Easily translate from one dialect to another. For example, date/time functions vary from dialects and can be hard to deal with:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="s2">"SELECT EPOCH_MS(1618088028295)"</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="s2">"duckdb"</span><span class="p">,</span> <span class="n">write</span><span class="o">=</span><span class="s2">"hive"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="s1">'SELECT FROM_UNIXTIME(1618088028295 / 1000)'</span> +</code></pre> +</div> + +<p>SQLGlot can even translate custom time formats:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="s2">"SELECT STRFTIME(x, '%y-%-m-%S')"</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="s2">"duckdb"</span><span class="p">,</span> <span class="n">write</span><span class="o">=</span><span class="s2">"hive"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="ss">"SELECT DATE_FORMAT(x, 'yy-M-ss')"</span> +</code></pre> +</div> + +<p>As another example, let's suppose that we want to read in a SQL query that contains a CTE and a cast to <code>REAL</code>, and then transpile it to Spark, which uses backticks for identifiers and <code>FLOAT</code> instead of <code>REAL</code>:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> + +<span class="n">sql</span> <span class="o">=</span> <span class="s2">"""WITH baz AS (SELECT a, c FROM foo WHERE a = 1) SELECT f.a, b.b, baz.c, CAST("b"."a" AS REAL) d FROM foo f JOIN bar b ON f.a = b.a LEFT JOIN baz ON f.a = baz.a"""</span> +<span class="nb">print</span><span class="p">(</span><span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">write</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">,</span> <span class="n">identify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">WITH</span><span class="w"> </span><span class="o">`</span><span class="n">baz</span><span class="o">`</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="k">SELECT</span> +<span class="w"> </span><span class="o">`</span><span class="n">a</span><span class="o">`</span><span class="p">,</span> +<span class="w"> </span><span class="o">`</span><span class="k">c</span><span class="o">`</span> +<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="o">`</span><span class="n">foo</span><span class="o">`</span> +<span class="w"> </span><span class="k">WHERE</span> +<span class="w"> </span><span class="o">`</span><span class="n">a</span><span class="o">`</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span> +<span class="p">)</span> +<span class="k">SELECT</span> +<span class="w"> </span><span class="o">`</span><span class="n">f</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">a</span><span class="o">`</span><span class="p">,</span> +<span class="w"> </span><span class="o">`</span><span class="n">b</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">b</span><span class="o">`</span><span class="p">,</span> +<span class="w"> </span><span class="o">`</span><span class="n">baz</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="k">c</span><span class="o">`</span><span class="p">,</span> +<span class="w"> </span><span class="k">CAST</span><span class="p">(</span><span class="o">`</span><span class="n">b</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">a</span><span class="o">`</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="nb">FLOAT</span><span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="o">`</span><span class="n">d</span><span class="o">`</span> +<span class="k">FROM</span><span class="w"> </span><span class="o">`</span><span class="n">foo</span><span class="o">`</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="o">`</span><span class="n">f</span><span class="o">`</span> +<span class="k">JOIN</span><span class="w"> </span><span class="o">`</span><span class="n">bar</span><span class="o">`</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="o">`</span><span class="n">b</span><span class="o">`</span> +<span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="o">`</span><span class="n">f</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">a</span><span class="o">`</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">`</span><span class="n">b</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">a</span><span class="o">`</span> +<span class="k">LEFT</span><span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="o">`</span><span class="n">baz</span><span class="o">`</span> +<span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="o">`</span><span class="n">f</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">a</span><span class="o">`</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">`</span><span class="n">baz</span><span class="o">`</span><span class="p">.</span><span class="o">`</span><span class="n">a</span><span class="o">`</span> +</code></pre> +</div> + +<p>Comments are also preserved in a best-effort basis when transpiling SQL code:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">sql</span> <span class="o">=</span> <span class="s2">"""</span> +<span class="s2">/* multi</span> +<span class="s2"> line</span> +<span class="s2"> comment</span> +<span class="s2">*/</span> +<span class="s2">SELECT</span> +<span class="s2"> tbl.cola /* comment 1 */ + tbl.colb /* comment 2 */,</span> +<span class="s2"> CAST(x AS INT), # comment 3</span> +<span class="s2"> y -- comment 4</span> +<span class="s2">FROM</span> +<span class="s2"> bar /* comment 5 */,</span> +<span class="s2"> tbl # comment 6</span> +<span class="s2">"""</span> + +<span class="nb">print</span><span class="p">(</span><span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="s1">'mysql'</span><span class="p">,</span> <span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">)[</span><span class="mi">0</span><span class="p">])</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="cm">/* multi</span> +<span class="cm"> line</span> +<span class="cm"> comment</span> +<span class="cm">*/</span> +<span class="k">SELECT</span> +<span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">cola</span><span class="w"> </span><span class="cm">/* comment 1 */</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">colb</span><span class="w"> </span><span class="cm">/* comment 2 */</span><span class="p">,</span> +<span class="w"> </span><span class="k">CAST</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="nb">INT</span><span class="p">),</span><span class="w"> </span><span class="cm">/* comment 3 */</span> +<span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="cm">/* comment 4 */</span> +<span class="k">FROM</span><span class="w"> </span><span class="n">bar</span><span class="w"> </span><span class="cm">/* comment 5 */</span><span class="p">,</span><span class="w"> </span><span class="n">tbl</span><span class="w"> </span><span class="cm">/* comment 6 */</span> +</code></pre> +</div> + +<h3 id="metadata">Metadata</h3> + +<p>You can explore SQL with expression helpers to do things like find columns and tables:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span><span class="p">,</span> <span class="n">exp</span> + +<span class="c1"># print all column references (a and b)</span> +<span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a, b + 1 AS c FROM d"</span><span class="p">)</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> + +<span class="c1"># find all projections in select statements (a and c)</span> +<span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a, b + 1 AS c FROM d"</span><span class="p">)</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> + <span class="k">for</span> <span class="n">projection</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> + <span class="nb">print</span><span class="p">(</span><span class="n">projection</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> + +<span class="c1"># find all tables (x, y, z)</span> +<span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT * FROM x JOIN y JOIN z"</span><span class="p">)</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</code></pre> +</div> + +<h3 id="parser-errors">Parser Errors</h3> + +<p>When the parser detects an error in the syntax, it raises a ParserError:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="s2">"SELECT foo( FROM bar"</span><span class="p">)</span> +</code></pre> +</div> + +<pre><code><a href="sqlglot/errors.html#ParseError">sqlglot.errors.ParseError</a>: Expecting ). Line 1, Col: 13. + select foo( FROM bar + ~~~~ +</code></pre> + +<p>Structured syntax errors are accessible for programmatic use:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="k">try</span><span class="p">:</span> + <span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="s2">"SELECT foo( FROM bar"</span><span class="p">)</span> +<span class="k">except</span> <span class="n"><a href="sqlglot/errors.html#ParseError">sqlglot.errors.ParseError</a></span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> + <span class="nb">print</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">errors</span><span class="p">)</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="p">[{</span> + <span class="s1">'description'</span><span class="p">:</span> <span class="s1">'Expecting )'</span><span class="p">,</span> + <span class="s1">'line'</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> + <span class="s1">'col'</span><span class="p">:</span> <span class="mi">13</span><span class="p">,</span> + <span class="s1">'start_context'</span><span class="p">:</span> <span class="s1">'SELECT foo( '</span><span class="p">,</span> + <span class="s1">'highlight'</span><span class="p">:</span> <span class="s1">'FROM'</span><span class="p">,</span> + <span class="s1">'end_context'</span><span class="p">:</span> <span class="s1">' bar'</span> +<span class="p">}]</span> +</code></pre> +</div> + +<h3 id="unsupported-errors">Unsupported Errors</h3> + +<p>Presto <code>APPROX_DISTINCT</code> supports the accuracy argument which is not supported in Hive:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="n"><a href="#transpile">sqlglot.transpile</a></span><span class="p">(</span><span class="s2">"SELECT APPROX_DISTINCT(a, 0.1) FROM foo"</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="s2">"presto"</span><span class="p">,</span> <span class="n">write</span><span class="o">=</span><span class="s2">"hive"</span><span class="p">)</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">APPROX_COUNT_DISTINCT</span><span class="w"> </span><span class="n">does</span><span class="w"> </span><span class="k">not</span><span class="w"> </span><span class="n">support</span><span class="w"> </span><span class="n">accuracy</span> +<span class="s1">'SELECT APPROX_COUNT_DISTINCT(a) FROM foo'</span> +</code></pre> +</div> + +<h3 id="build-and-modify-sql">Build and Modify SQL</h3> + +<p>SQLGlot supports incrementally building sql expressions:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">select</span><span class="p">,</span> <span class="n">condition</span> + +<span class="n">where</span> <span class="o">=</span> <span class="n">condition</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">)</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="s2">"y=1"</span><span class="p">)</span> +<span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"y"</span><span class="p">)</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">where</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="s1">'SELECT * FROM y WHERE x = 1 AND y = 1'</span> +</code></pre> +</div> + +<p>You can also modify a parsed tree:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT x FROM y"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"z"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="s1">'SELECT x FROM y, z'</span> +</code></pre> +</div> + +<p>There is also a way to recursively transform the parsed tree by applying a mapping function to each tree node:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">parse_one</span> + +<span class="n">expression_tree</span> <span class="o">=</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a FROM x"</span><span class="p">)</span> + +<span class="k">def</span> <span class="nf">transformer</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> + <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"a"</span><span class="p">:</span> + <span class="k">return</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"FUN(a)"</span><span class="p">)</span> + <span class="k">return</span> <span class="n">node</span> + +<span class="n">transformed_tree</span> <span class="o">=</span> <span class="n">expression_tree</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">transformer</span><span class="p">)</span> +<span class="n">transformed_tree</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="s1">'SELECT FUN(a) FROM x'</span> +</code></pre> +</div> + +<h3 id="sql-optimizer">SQL Optimizer</h3> + +<p>SQLGlot can rewrite queries into an "optimized" form. It performs a variety of <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/optimizer/optimizer.py">techniques</a> to create a new canonical AST. This AST can be used to standardize queries or provide the foundations for implementing an actual engine. For example:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="kn">from</span> <span class="nn"><a href="sqlglot/optimizer.html">sqlglot.optimizer</a></span> <span class="kn">import</span> <span class="n">optimize</span> + +<span class="nb">print</span><span class="p">(</span> + <span class="n">optimize</span><span class="p">(</span> + <span class="n"><a href="#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"""</span> +<span class="s2"> SELECT A OR (B OR (C AND D))</span> +<span class="s2"> FROM x</span> +<span class="s2"> WHERE Z = date '2021-01-01' + INTERVAL '1' month OR 1 = 0</span> +<span class="s2"> """</span><span class="p">),</span> + <span class="n">schema</span><span class="o">=</span><span class="p">{</span><span class="s2">"x"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"A"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"B"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"C"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"Z"</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">}}</span> + <span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +<span class="p">)</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">SELECT</span> +<span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"a"</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"b"</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"c"</span> +<span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"a"</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"b"</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"d"</span> +<span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="ss">"_col_0"</span> +<span class="k">FROM</span><span class="w"> </span><span class="ss">"x"</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="ss">"x"</span> +<span class="k">WHERE</span> +<span class="w"> </span><span class="k">CAST</span><span class="p">(</span><span class="ss">"x"</span><span class="p">.</span><span class="ss">"z"</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="nb">DATE</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">CAST</span><span class="p">(</span><span class="s1">'2021-02-01'</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="nb">DATE</span><span class="p">)</span> +</code></pre> +</div> + +<h3 id="ast-introspection">AST Introspection</h3> + +<p>You can see the AST version of the sql by calling <code>repr</code>:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="nb">print</span><span class="p">(</span><span class="nb">repr</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a + 1 AS z"</span><span class="p">)))</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="p">(</span><span class="n">SELECT</span> <span class="n">expressions</span><span class="p">:</span> + <span class="p">(</span><span class="n">ALIAS</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">ADD</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">COLUMN</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">a</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)),</span> <span class="n">expression</span><span class="p">:</span> + <span class="p">(</span><span class="n">LITERAL</span> <span class="n">this</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="n">is_string</span><span class="p">:</span> <span class="kc">False</span><span class="p">)),</span> <span class="n">alias</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">z</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)))</span> +</code></pre> +</div> + +<h3 id="ast-diff">AST Diff</h3> + +<p>SQLGlot can calculate the difference between two expressions and output changes in a form of a sequence of actions needed to transform a source expression into a target one:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">diff</span><span class="p">,</span> <span class="n">parse_one</span> +<span class="n">diff</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a + b, c, d"</span><span class="p">),</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT c, a - b, d"</span><span class="p">))</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="p">[</span> + <span class="n">Remove</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="p">(</span><span class="n">ADD</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">COLUMN</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">a</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)),</span> <span class="n">expression</span><span class="p">:</span> + <span class="p">(</span><span class="n">COLUMN</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">b</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)))),</span> + <span class="n">Insert</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="p">(</span><span class="n">SUB</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">COLUMN</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">a</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)),</span> <span class="n">expression</span><span class="p">:</span> + <span class="p">(</span><span class="n">COLUMN</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">b</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)))),</span> + <span class="n">Move</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="p">(</span><span class="n">COLUMN</span> <span class="n">this</span><span class="p">:</span> + <span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">c</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">))),</span> + <span class="n">Keep</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">b</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">),</span> <span class="n">target</span><span class="o">=</span><span class="p">(</span><span class="n">IDENTIFIER</span> <span class="n">this</span><span class="p">:</span> <span class="n">b</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="kc">False</span><span class="p">)),</span> + <span class="o">...</span> +<span class="p">]</span> +</code></pre> +</div> + +<p>See also: <a href="https://github.com/tobymao/sqlglot/blob/main/posts/sql_diff.md">Semantic Diff for SQL</a>.</p> + +<h3 id="custom-dialects">Custom Dialects</h3> + +<p><a href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects">Dialects</a> can be added by subclassing <code>Dialect</code>:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +<span class="kn">from</span> <span class="nn"><a href="sqlglot/dialects/dialect.html">sqlglot.dialects.dialect</a></span> <span class="kn">import</span> <span class="n">Dialect</span> +<span class="kn">from</span> <span class="nn"><a href="sqlglot/generator.html">sqlglot.generator</a></span> <span class="kn">import</span> <span class="n">Generator</span> +<span class="kn">from</span> <span class="nn"><a href="sqlglot/tokens.html">sqlglot.tokens</a></span> <span class="kn">import</span> <span class="n">Tokenizer</span><span class="p">,</span> <span class="n">TokenType</span> + + +<span class="k">class</span> <span class="nc">Custom</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> + <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Tokenizer</span><span class="p">):</span> + <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> + <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> + + <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> + <span class="o">**</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> + <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> + <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> + <span class="p">}</span> + + <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Generator</span><span class="p">):</span> + <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">}</span> + + <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BOOL"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> + <span class="p">}</span> + +<span class="nb">print</span><span class="p">(</span><span class="n">Dialect</span><span class="p">[</span><span class="s2">"custom"</span><span class="p">])</span> +</code></pre> +</div> + +<pre><code><class '__main__.Custom'> +</code></pre> + +<h3 id="sql-execution">SQL Execution</h3> + +<p>One can even interpret SQL queries using SQLGlot, where the tables are represented as Python dictionaries. Although the engine is not very fast (it's not supposed to be) and is in a relatively early stage of development, it can be useful for unit testing and running SQL natively across Python objects. Additionally, the foundation can be easily integrated with fast compute kernels (arrow, pandas). Below is an example showcasing the execution of a SELECT expression that involves aggregations and JOINs:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn"><a href="sqlglot/executor.html">sqlglot.executor</a></span> <span class="kn">import</span> <span class="n">execute</span> + +<span class="n">tables</span> <span class="o">=</span> <span class="p">{</span> + <span class="s2">"sushi"</span><span class="p">:</span> <span class="p">[</span> + <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">},</span> + <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">:</span> <span class="mf">2.0</span><span class="p">},</span> + <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> <span class="s2">"price"</span><span class="p">:</span> <span class="mf">3.0</span><span class="p">},</span> + <span class="p">],</span> + <span class="s2">"order_items"</span><span class="p">:</span> <span class="p">[</span> + <span class="p">{</span><span class="s2">"sushi_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"order_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span> + <span class="p">{</span><span class="s2">"sushi_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"order_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span> + <span class="p">{</span><span class="s2">"sushi_id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">"order_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span> + <span class="p">{</span><span class="s2">"sushi_id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> <span class="s2">"order_id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span> + <span class="p">],</span> + <span class="s2">"orders"</span><span class="p">:</span> <span class="p">[</span> + <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">},</span> + <span class="p">{</span><span class="s2">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s2">"user_id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">},</span> + <span class="p">],</span> +<span class="p">}</span> + +<span class="n">execute</span><span class="p">(</span> +<span class="w"> </span><span class="sd">"""</span> +<span class="sd"> SELECT</span> +<span class="sd"> o.user_id,</span> +<span class="sd"> SUM(s.price) AS price</span> +<span class="sd"> FROM orders o</span> +<span class="sd"> JOIN order_items i</span> +<span class="sd"> ON o.id = i.order_id</span> +<span class="sd"> JOIN sushi s</span> +<span class="sd"> ON i.sushi_id = s.id</span> +<span class="sd"> GROUP BY o.user_id</span> +<span class="sd"> """</span><span class="p">,</span> + <span class="n">tables</span><span class="o">=</span><span class="n">tables</span> +<span class="p">)</span> +</code></pre> +</div> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">user_id</span> <span class="n">price</span> + <span class="mi">1</span> <span class="mf">4.0</span> + <span class="mi">2</span> <span class="mf">3.0</span> +</code></pre> +</div> + +<p>See also: <a href="https://github.com/tobymao/sqlglot/blob/main/posts/python_sql_engine.md">Writing a Python SQL engine from scratch</a>.</p> + +<h2 id="used-by">Used By</h2> + +<ul> +<li><a href="https://github.com/fugue-project/fugue">Fugue</a></li> +<li><a href="https://github.com/ibis-project/ibis">ibis</a></li> +<li><a href="https://github.com/kelsin/mysql-mimic">mysql-mimic</a></li> +<li><a href="https://github.com/pinterest/querybook">Querybook</a></li> +<li><a href="https://github.com/marsupialtail/quokka">Quokka</a></li> +<li><a href="https://github.com/moj-analytical-services/splink">Splink</a></li> +</ul> + +<h2 id="documentation">Documentation</h2> + +<p>SQLGlot uses <a href="https://pdoc.dev/">pdoc</a> to serve its API documentation:</p> + +<pre><code>make docs-serve +</code></pre> + +<h2 id="run-tests-and-lint">Run Tests and Lint</h2> + +<pre><code>make check # Set SKIP_INTEGRATION=1 to skip integration tests +</code></pre> + +<h2 id="benchmarks">Benchmarks</h2> + +<p><a href="https://github.com/tobymao/sqlglot/blob/main/benchmarks/bench.py">Benchmarks</a> run on Python 3.10.5 in seconds.</p> + +<table> +<thead> +<tr> + <th>Query</th> + <th>sqlglot</th> + <th>sqlfluff</th> + <th>sqltree</th> + <th>sqlparse</th> + <th>moz_sql_parser</th> + <th>sqloxide</th> +</tr> +</thead> +<tbody> +<tr> + <td>tpch</td> + <td>0.01308 (1.0)</td> + <td>1.60626 (122.7)</td> + <td>0.01168 (0.893)</td> + <td>0.04958 (3.791)</td> + <td>0.08543 (6.531)</td> + <td>0.00136 (0.104)</td> +</tr> +<tr> + <td>short</td> + <td>0.00109 (1.0)</td> + <td>0.14134 (129.2)</td> + <td>0.00099 (0.906)</td> + <td>0.00342 (3.131)</td> + <td>0.00652 (5.970)</td> + <td>8.76E-5 (0.080)</td> +</tr> +<tr> + <td>long</td> + <td>0.01399 (1.0)</td> + <td>2.12632 (151.9)</td> + <td>0.01126 (0.805)</td> + <td>0.04410 (3.151)</td> + <td>0.06671 (4.767)</td> + <td>0.00107 (0.076)</td> +</tr> +<tr> + <td>crazy</td> + <td>0.03969 (1.0)</td> + <td>24.3777 (614.1)</td> + <td>0.03917 (0.987)</td> + <td>11.7043 (294.8)</td> + <td>1.03280 (26.02)</td> + <td>0.00625 (0.157)</td> +</tr> +</tbody> +</table> + +<h2 id="optional-dependencies">Optional Dependencies</h2> + +<p>SQLGlot uses <a href="https://github.com/dateutil/dateutil">dateutil</a> to simplify literal timedelta expressions. The optimizer will not simplify expressions like the following if the module cannot be found:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">x</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">interval</span><span class="w"> </span><span class="s1">'1'</span><span class="w"> </span><span class="k">month</span> +</code></pre> +</div> + +<hr /> +</div> + + <input id="mod-sqlglot-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-sqlglot-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">"""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="sd">.. include:: ../README.md</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="sd">----</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="sd">"""</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">Dialects</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="kn">from</span> <span class="nn">sqlglot.diff</span> <span class="kn">import</span> <span class="n">diff</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ErrorLevel</span><span class="p">,</span> <span class="n">ParseError</span><span class="p">,</span> <span class="n">TokenError</span><span class="p">,</span> <span class="n">UnsupportedError</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">Expression</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">alias_</span> <span class="k">as</span> <span class="n">alias</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">and_</span><span class="p">,</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="n">column</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="n">condition</span><span class="p">,</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="n">except_</span><span class="p">,</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">from_</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">intersect</span><span class="p">,</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="n">maybe_parse</span><span class="p">,</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">not_</span><span class="p">,</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">or_</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">select</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">subquery</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a><span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">table_</span> <span class="k">as</span> <span class="n">table</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">to_column</span><span class="p">,</span> <span class="n">to_table</span><span class="p">,</span> <span class="n">union</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="kn">from</span> <span class="nn">sqlglot.generator</span> <span class="kn">import</span> <span class="n">Generator</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="kn">from</span> <span class="nn">sqlglot.parser</span> <span class="kn">import</span> <span class="n">Parser</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">MappingSchema</span><span class="p">,</span> <span class="n">Schema</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">Tokenizer</span><span class="p">,</span> <span class="n">TokenType</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">DialectType</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">T</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"T"</span><span class="p">,</span> <span class="n">bound</span><span class="o">=</span><span class="n">Expression</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="n">__version__</span> <span class="o">=</span> <span class="s2">"11.0.0"</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="n">pretty</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="sd">"""Whether to format generated SQL by default."""</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="n">schema</span> <span class="o">=</span> <span class="n">MappingSchema</span><span class="p">()</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd">"""The default schema used by SQLGlot (e.g. in the optimizer)."""</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="sd"> Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> Args:</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> sql: the SQL code string to parse.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="sd"> read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="sd"> **opts: other `sqlglot.parser.Parser` options.</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a><span class="sd"> Returns:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> The resulting syntax tree collection.</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="sd"> """</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">dialect</span> <span class="o">=</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">read</span><span class="p">)()</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="k">return</span> <span class="n">dialect</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">read</span><span class="p">:</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">T</span><span class="p">]</span> <span class="o">=</span> <span class="o">...</span><span class="p">,</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">T</span><span class="p">:</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="o">...</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">T</span><span class="p">],</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">T</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="o">...</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">read</span><span class="p">:</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Expression</span><span class="p">]]]]</span> <span class="o">=</span> <span class="o">...</span><span class="p">,</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="o">...</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span><span class="p">,</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Expression</span><span class="p">]]]],</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="o">...</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="o">...</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a><span class="sd"> Parses the given SQL string and returns a syntax tree for the first parsed SQL statement.</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a><span class="sd"> Args:</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a><span class="sd"> sql: the SQL code string to parse.</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a><span class="sd"> read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a><span class="sd"> into: the SQLGlot Expression to parse into.</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a><span class="sd"> **opts: other `sqlglot.parser.Parser` options.</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a><span class="sd"> Returns:</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a><span class="sd"> The syntax tree for the first parsed statement.</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a><span class="sd"> """</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">dialect</span> <span class="o">=</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">read</span><span class="p">)()</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">if</span> <span class="n">into</span><span class="p">:</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">dialect</span><span class="o">.</span><span class="n">parse_into</span><span class="p">(</span><span class="n">into</span><span class="p">,</span> <span class="n">sql</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">dialect</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No expression was parsed from '</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No expression was parsed from '</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a><span class="k">def</span> <span class="nf">transpile</span><span class="p">(</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">write</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">identity</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">error_level</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ErrorLevel</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a><span class="sd"> Parses the given SQL string in accordance with the source dialect and returns a list of SQL strings transformed</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a><span class="sd"> to conform to the target dialect. Each string in the returned list represents a single transformed SQL statement.</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a><span class="sd"> Args:</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a><span class="sd"> sql: the SQL code string to transpile.</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a><span class="sd"> read: the source dialect used to parse the input string (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a><span class="sd"> write: the target dialect into which the input should be transformed (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a><span class="sd"> identity: if set to `True` and if the target dialect is not specified the source dialect will be used as both:</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a><span class="sd"> the source and the target dialect.</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a><span class="sd"> error_level: the desired error level of the parser.</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a><span class="sd"> **opts: other `sqlglot.generator.Generator` options.</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a><span class="sd"> Returns:</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a><span class="sd"> The list of transpiled SQL statements.</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a><span class="sd"> """</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">write</span> <span class="o">=</span> <span class="n">write</span> <span class="ow">or</span> <span class="n">read</span> <span class="k">if</span> <span class="n">identity</span> <span class="k">else</span> <span class="n">write</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">write</span><span class="p">)()</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">read</span><span class="p">,</span> <span class="n">error_level</span><span class="o">=</span><span class="n">error_level</span><span class="p">)</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="p">]</span> +</span></pre></div> + + + </section> + <section id="pretty"> + <div class="attr variable"> + <span class="name">pretty</span><span class="default_value"> = False</span> + + + </div> + <a class="headerlink" href="#pretty"></a> + + <div class="docstring"><p>Whether to format generated SQL by default.</p> +</div> + + + </section> + <section id="schema"> + <div class="attr variable"> + <span class="name">schema</span><span class="default_value"> = <<a href="sqlglot/schema.html#MappingSchema">sqlglot.schema.MappingSchema</a> object></span> + + + </div> + <a class="headerlink" href="#schema"></a> + + <div class="docstring"><p>The default schema used by SQLGlot (e.g. in the optimizer).</p> +</div> + + + </section> + <section id="parse"> + <input id="parse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">read</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="n"><a href="sqlglot/expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="parse-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#parse"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="parse-53"><a href="#parse-53"><span class="linenos">53</span></a><span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="parse-54"><a href="#parse-54"><span class="linenos">54</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="parse-55"><a href="#parse-55"><span class="linenos">55</span></a><span class="sd"> Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.</span> +</span><span id="parse-56"><a href="#parse-56"><span class="linenos">56</span></a> +</span><span id="parse-57"><a href="#parse-57"><span class="linenos">57</span></a><span class="sd"> Args:</span> +</span><span id="parse-58"><a href="#parse-58"><span class="linenos">58</span></a><span class="sd"> sql: the SQL code string to parse.</span> +</span><span id="parse-59"><a href="#parse-59"><span class="linenos">59</span></a><span class="sd"> read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="parse-60"><a href="#parse-60"><span class="linenos">60</span></a><span class="sd"> **opts: other `sqlglot.parser.Parser` options.</span> +</span><span id="parse-61"><a href="#parse-61"><span class="linenos">61</span></a> +</span><span id="parse-62"><a href="#parse-62"><span class="linenos">62</span></a><span class="sd"> Returns:</span> +</span><span id="parse-63"><a href="#parse-63"><span class="linenos">63</span></a><span class="sd"> The resulting syntax tree collection.</span> +</span><span id="parse-64"><a href="#parse-64"><span class="linenos">64</span></a><span class="sd"> """</span> +</span><span id="parse-65"><a href="#parse-65"><span class="linenos">65</span></a> <span class="n">dialect</span> <span class="o">=</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">read</span><span class="p">)()</span> +</span><span id="parse-66"><a href="#parse-66"><span class="linenos">66</span></a> <span class="k">return</span> <span class="n">dialect</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql:</strong> the SQL code string to parse.</li> +<li><strong>read:</strong> the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</li> +<li><strong>**opts:</strong> other <code><a href="sqlglot/parser.html#Parser">sqlglot.parser.Parser</a></code> options.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The resulting syntax tree collection.</p> +</blockquote> +</div> + + + </section> + <section id="parse_one"> + <input id="parse_one-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse_one</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">read</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">into</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="sqlglot/expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="n">Collection</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="sqlglot/expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="sqlglot/expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="parse_one-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#parse_one"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="parse_one-117"><a href="#parse_one-117"><span class="linenos">117</span></a><span class="k">def</span> <span class="nf">parse_one</span><span class="p">(</span> +</span><span id="parse_one-118"><a href="#parse_one-118"><span class="linenos">118</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="parse_one-119"><a href="#parse_one-119"><span class="linenos">119</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="parse_one-120"><a href="#parse_one-120"><span class="linenos">120</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="parse_one-121"><a href="#parse_one-121"><span class="linenos">121</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="parse_one-122"><a href="#parse_one-122"><span class="linenos">122</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="parse_one-123"><a href="#parse_one-123"><span class="linenos">123</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="parse_one-124"><a href="#parse_one-124"><span class="linenos">124</span></a><span class="sd"> Parses the given SQL string and returns a syntax tree for the first parsed SQL statement.</span> +</span><span id="parse_one-125"><a href="#parse_one-125"><span class="linenos">125</span></a> +</span><span id="parse_one-126"><a href="#parse_one-126"><span class="linenos">126</span></a><span class="sd"> Args:</span> +</span><span id="parse_one-127"><a href="#parse_one-127"><span class="linenos">127</span></a><span class="sd"> sql: the SQL code string to parse.</span> +</span><span id="parse_one-128"><a href="#parse_one-128"><span class="linenos">128</span></a><span class="sd"> read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="parse_one-129"><a href="#parse_one-129"><span class="linenos">129</span></a><span class="sd"> into: the SQLGlot Expression to parse into.</span> +</span><span id="parse_one-130"><a href="#parse_one-130"><span class="linenos">130</span></a><span class="sd"> **opts: other `sqlglot.parser.Parser` options.</span> +</span><span id="parse_one-131"><a href="#parse_one-131"><span class="linenos">131</span></a> +</span><span id="parse_one-132"><a href="#parse_one-132"><span class="linenos">132</span></a><span class="sd"> Returns:</span> +</span><span id="parse_one-133"><a href="#parse_one-133"><span class="linenos">133</span></a><span class="sd"> The syntax tree for the first parsed statement.</span> +</span><span id="parse_one-134"><a href="#parse_one-134"><span class="linenos">134</span></a><span class="sd"> """</span> +</span><span id="parse_one-135"><a href="#parse_one-135"><span class="linenos">135</span></a> +</span><span id="parse_one-136"><a href="#parse_one-136"><span class="linenos">136</span></a> <span class="n">dialect</span> <span class="o">=</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">read</span><span class="p">)()</span> +</span><span id="parse_one-137"><a href="#parse_one-137"><span class="linenos">137</span></a> +</span><span id="parse_one-138"><a href="#parse_one-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="n">into</span><span class="p">:</span> +</span><span id="parse_one-139"><a href="#parse_one-139"><span class="linenos">139</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">dialect</span><span class="o">.</span><span class="n">parse_into</span><span class="p">(</span><span class="n">into</span><span class="p">,</span> <span class="n">sql</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="parse_one-140"><a href="#parse_one-140"><span class="linenos">140</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="parse_one-141"><a href="#parse_one-141"><span class="linenos">141</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">dialect</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="parse_one-142"><a href="#parse_one-142"><span class="linenos">142</span></a> +</span><span id="parse_one-143"><a href="#parse_one-143"><span class="linenos">143</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span> +</span><span id="parse_one-144"><a href="#parse_one-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="parse_one-145"><a href="#parse_one-145"><span class="linenos">145</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No expression was parsed from '</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="parse_one-146"><a href="#parse_one-146"><span class="linenos">146</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="parse_one-147"><a href="#parse_one-147"><span class="linenos">147</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="parse_one-148"><a href="#parse_one-148"><span class="linenos">148</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No expression was parsed from '</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parses the given SQL string and returns a syntax tree for the first parsed SQL statement.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql:</strong> the SQL code string to parse.</li> +<li><strong>read:</strong> the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</li> +<li><strong>into:</strong> the SQLGlot Expression to parse into.</li> +<li><strong>**opts:</strong> other <code><a href="sqlglot/parser.html#Parser">sqlglot.parser.Parser</a></code> options.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The syntax tree for the first parsed statement.</p> +</blockquote> +</div> + + + </section> + <section id="transpile"> + <input id="transpile-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transpile</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">read</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">write</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="sqlglot/dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">identity</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>,</span><span class="param"> <span class="n">error_level</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="sqlglot/errors.html#ErrorLevel">sqlglot.errors.ErrorLevel</a></span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="transpile-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#transpile"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="transpile-151"><a href="#transpile-151"><span class="linenos">151</span></a><span class="k">def</span> <span class="nf">transpile</span><span class="p">(</span> +</span><span id="transpile-152"><a href="#transpile-152"><span class="linenos">152</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="transpile-153"><a href="#transpile-153"><span class="linenos">153</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="transpile-154"><a href="#transpile-154"><span class="linenos">154</span></a> <span class="n">write</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="transpile-155"><a href="#transpile-155"><span class="linenos">155</span></a> <span class="n">identity</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="transpile-156"><a href="#transpile-156"><span class="linenos">156</span></a> <span class="n">error_level</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ErrorLevel</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="transpile-157"><a href="#transpile-157"><span class="linenos">157</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="transpile-158"><a href="#transpile-158"><span class="linenos">158</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="transpile-159"><a href="#transpile-159"><span class="linenos">159</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="transpile-160"><a href="#transpile-160"><span class="linenos">160</span></a><span class="sd"> Parses the given SQL string in accordance with the source dialect and returns a list of SQL strings transformed</span> +</span><span id="transpile-161"><a href="#transpile-161"><span class="linenos">161</span></a><span class="sd"> to conform to the target dialect. Each string in the returned list represents a single transformed SQL statement.</span> +</span><span id="transpile-162"><a href="#transpile-162"><span class="linenos">162</span></a> +</span><span id="transpile-163"><a href="#transpile-163"><span class="linenos">163</span></a><span class="sd"> Args:</span> +</span><span id="transpile-164"><a href="#transpile-164"><span class="linenos">164</span></a><span class="sd"> sql: the SQL code string to transpile.</span> +</span><span id="transpile-165"><a href="#transpile-165"><span class="linenos">165</span></a><span class="sd"> read: the source dialect used to parse the input string (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="transpile-166"><a href="#transpile-166"><span class="linenos">166</span></a><span class="sd"> write: the target dialect into which the input should be transformed (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="transpile-167"><a href="#transpile-167"><span class="linenos">167</span></a><span class="sd"> identity: if set to `True` and if the target dialect is not specified the source dialect will be used as both:</span> +</span><span id="transpile-168"><a href="#transpile-168"><span class="linenos">168</span></a><span class="sd"> the source and the target dialect.</span> +</span><span id="transpile-169"><a href="#transpile-169"><span class="linenos">169</span></a><span class="sd"> error_level: the desired error level of the parser.</span> +</span><span id="transpile-170"><a href="#transpile-170"><span class="linenos">170</span></a><span class="sd"> **opts: other `sqlglot.generator.Generator` options.</span> +</span><span id="transpile-171"><a href="#transpile-171"><span class="linenos">171</span></a> +</span><span id="transpile-172"><a href="#transpile-172"><span class="linenos">172</span></a><span class="sd"> Returns:</span> +</span><span id="transpile-173"><a href="#transpile-173"><span class="linenos">173</span></a><span class="sd"> The list of transpiled SQL statements.</span> +</span><span id="transpile-174"><a href="#transpile-174"><span class="linenos">174</span></a><span class="sd"> """</span> +</span><span id="transpile-175"><a href="#transpile-175"><span class="linenos">175</span></a> <span class="n">write</span> <span class="o">=</span> <span class="n">write</span> <span class="ow">or</span> <span class="n">read</span> <span class="k">if</span> <span class="n">identity</span> <span class="k">else</span> <span class="n">write</span> +</span><span id="transpile-176"><a href="#transpile-176"><span class="linenos">176</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="transpile-177"><a href="#transpile-177"><span class="linenos">177</span></a> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">write</span><span class="p">)()</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="transpile-178"><a href="#transpile-178"><span class="linenos">178</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">read</span><span class="p">,</span> <span class="n">error_level</span><span class="o">=</span><span class="n">error_level</span><span class="p">)</span> +</span><span id="transpile-179"><a href="#transpile-179"><span class="linenos">179</span></a> <span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Parses the given SQL string in accordance with the source dialect and returns a list of SQL strings transformed +to conform to the target dialect. Each string in the returned list represents a single transformed SQL statement.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql:</strong> the SQL code string to transpile.</li> +<li><strong>read:</strong> the source dialect used to parse the input string (eg. "spark", "hive", "presto", "mysql").</li> +<li><strong>write:</strong> the target dialect into which the input should be transformed (eg. "spark", "hive", "presto", "mysql").</li> +<li><strong>identity:</strong> if set to <code>True</code> and if the target dialect is not specified the source dialect will be used as both: +the source and the target dialect.</li> +<li><strong>error_level:</strong> the desired error level of the parser.</li> +<li><strong>**opts:</strong> other <code><a href="sqlglot/generator.html#Generator">sqlglot.generator.Generator</a></code> options.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The list of transpiled SQL statements.</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dataframe.html b/docs/sqlglot/dataframe.html new file mode 100644 index 0000000..ea6f345 --- /dev/null +++ b/docs/sqlglot/dataframe.html @@ -0,0 +1,506 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dataframe API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + <h2>Contents</h2> + <ul> + <li><a href="#pyspark-dataframe-sql-generator">PySpark DataFrame SQL Generator</a></li> + <li><a href="#how-to-use">How to use</a> + <ul> + <li><a href="#instructions">Instructions</a></li> + <li><a href="#examples">Examples</a></li> + <li><a href="#registering-custom-schema-class">Registering Custom Schema Class</a></li> + <li><a href="#example-implementations">Example Implementations</a></li> + </ul></li> + <li><a href="#unsupportable-operations">Unsupportable Operations</a></li> +</ul> + + + <h2>Submodules</h2> + <ul> + <li><a href="dataframe/sql.html">sql</a></li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dataframe/__init__.py">Edit on GitHub</a> + + <div class="docstring"><h1 id="pyspark-dataframe-sql-generator">PySpark DataFrame SQL Generator</h1> + +<p>This is a drop-in replacement for the PySpark DataFrame API that will generate SQL instead of executing DataFrame operations directly. This, when combined with the transpiling support in SQLGlot, allows one to write PySpark DataFrame code and execute it on other engines 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>. </p> + +<p>Currently many of the common operations are covered and more functionality will be added over time. Please <a href="https://github.com/tobymao/sqlglot/issues">open an issue</a> or <a href="https://github.com/tobymao/sqlglot/pulls">PR</a> with your feedback or contribution to help influence what should be prioritized next and make sure your use case is properly supported.</p> + +<h1 id="how-to-use">How to use</h1> + +<h2 id="instructions">Instructions</h2> + +<ul> +<li><a href="https://github.com/tobymao/sqlglot/blob/main/README.md#install">Install SQLGlot</a> and that is all that is required to just generate SQL. <a href="#examples">The examples</a> show generating SQL and then executing that SQL on a specific engine and that will require that engine's client library.</li> +<li>Find/replace all <code>from pyspark.sql</code> with <code>from <a href="">sqlglot.dataframe</a></code>.</li> +<li>Prior to any <code>spark.read.table</code> or <code>spark.table</code> run <code>sqlglot.schema.add_table('<table_name>', <column_structure>)</code>. +<ul> +<li>The column structure can be defined the following ways: +<ul> +<li>Dictionary where the keys are column names and values are string of the Spark SQL type name. +<ul> +<li>Ex: <code>{'cola': 'string', 'colb': 'int'}</code></li> +</ul></li> +<li>PySpark DataFrame <code>StructType</code> similar to when using <code>createDataFrame</code>. +<ul> +<li>Ex: <code>StructType([StructField('cola', StringType()), StructField('colb', IntegerType())])</code></li> +</ul></li> +<li>A string of names and types similar to what is supported in <code>createDataFrame</code>. +<ul> +<li>Ex: <code>cola: STRING, colb: INT</code></li> +</ul></li> +<li>[Not Recommended] A list of string column names without type. +<ul> +<li>Ex: <code>['cola', 'colb']</code></li> +<li>The lack of types may limit functionality in future releases.</li> +</ul></li> +</ul></li> +<li>See <a href="#registering-custom-schema-class">Registering Custom Schema</a> for information on how to skip this step if the information is stored externally.</li> +</ul></li> +<li>Add <code>.sql(pretty=True)</code> to your final DataFrame command to return a list of sql statements to run that command. +<ul> +<li>In most cases a single SQL statement is returned. Currently the only exception is when caching DataFrames which isn't supported in other dialects. </li> +<li>Spark is the default output dialect. See <a href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects">dialects</a> for a full list of dialects.</li> +<li>Ex: <code>.sql(pretty=True, dialect='bigquery')</code></li> +</ul></li> +</ul> + +<h2 id="examples">Examples</h2> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> +<span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">functions</span> <span class="k">as</span> <span class="n">F</span> + +<span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span><span class="s1">'employee'</span><span class="p">,</span> <span class="p">{</span> + <span class="s1">'employee_id'</span><span class="p">:</span> <span class="s1">'INT'</span><span class="p">,</span> + <span class="s1">'fname'</span><span class="p">:</span> <span class="s1">'STRING'</span><span class="p">,</span> + <span class="s1">'lname'</span><span class="p">:</span> <span class="s1">'STRING'</span><span class="p">,</span> + <span class="s1">'age'</span><span class="p">:</span> <span class="s1">'INT'</span><span class="p">,</span> +<span class="p">})</span> <span class="c1"># Register the table structure prior to reading from the table</span> + +<span class="n">spark</span> <span class="o">=</span> <span class="n">SparkSession</span><span class="p">()</span> + +<span class="n">df</span> <span class="o">=</span> <span class="p">(</span> + <span class="n">spark</span> + <span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="s1">'employee'</span><span class="p">)</span> + <span class="o">.</span><span class="n">groupBy</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"age"</span><span class="p">))</span> + <span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">countDistinct</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"employee_id"</span><span class="p">))</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_employees"</span><span class="p">))</span> +<span class="p">)</span> + +<span class="nb">print</span><span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> <span class="c1"># Spark will be the dialect used by default</span> +</code></pre> +</div> + +<pre><code>SELECT + `employee`.`age` AS `age`, + COUNT(DISTINCT `employee`.`employee_id`) AS `num_employees` +FROM `employee` AS `employee` +GROUP BY + `employee`.`age` +</code></pre> + +<h2 id="registering-custom-schema-class">Registering Custom Schema Class</h2> + +<p>The step of adding <code>sqlglot.schema.add_table</code> can be skipped if you have the column structure stored externally like in a file or from an external metadata table. This can be done by writing a class that implements the <code><a href="schema.html#Schema">sqlglot.schema.Schema</a></code> abstract class and then assigning that class to <code><a href="schema.html">sqlglot.schema</a></code>. </p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> +<span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">functions</span> <span class="k">as</span> <span class="n">F</span> +<span class="kn">from</span> <span class="nn"><a href="schema.html">sqlglot.schema</a></span> <span class="kn">import</span> <span class="n">Schema</span> + + +<span class="k">class</span> <span class="nc">ExternalSchema</span><span class="p">(</span><span class="n">Schema</span><span class="p">):</span> + <span class="o">...</span> + +<span class="n"><a href="schema.html">sqlglot.schema</a></span> <span class="o">=</span> <span class="n">ExternalSchema</span><span class="p">()</span> + +<span class="n">spark</span> <span class="o">=</span> <span class="n">SparkSession</span><span class="p">()</span> + +<span class="n">df</span> <span class="o">=</span> <span class="p">(</span> + <span class="n">spark</span> + <span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="s1">'employee'</span><span class="p">)</span> + <span class="o">.</span><span class="n">groupBy</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"age"</span><span class="p">))</span> + <span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">countDistinct</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"employee_id"</span><span class="p">))</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_employees"</span><span class="p">))</span> +<span class="p">)</span> + +<span class="nb">print</span><span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</code></pre> +</div> + +<h2 id="example-implementations">Example Implementations</h2> + +<h3 id="bigquery">Bigquery</h3> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">google.cloud</span> <span class="kn">import</span> <span class="n">bigquery</span> +<span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> +<span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">types</span> +<span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">functions</span> <span class="k">as</span> <span class="n">F</span> + +<span class="n">client</span> <span class="o">=</span> <span class="n">bigquery</span><span class="o">.</span><span class="n">Client</span><span class="p">()</span> + +<span class="n">data</span> <span class="o">=</span> <span class="p">[</span> + <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s2">"Jack"</span><span class="p">,</span> <span class="s2">"Shephard"</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> + <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"John"</span><span class="p">,</span> <span class="s2">"Locke"</span><span class="p">,</span> <span class="mi">48</span><span class="p">),</span> + <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s2">"Kate"</span><span class="p">,</span> <span class="s2">"Austen"</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> + <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="s2">"Claire"</span><span class="p">,</span> <span class="s2">"Littleton"</span><span class="p">,</span> <span class="mi">22</span><span class="p">),</span> + <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="s2">"Hugo"</span><span class="p">,</span> <span class="s2">"Reyes"</span><span class="p">,</span> <span class="mi">26</span><span class="p">),</span> +<span class="p">]</span> +<span class="n">schema</span> <span class="o">=</span> <span class="n">types</span><span class="o">.</span><span class="n">StructType</span><span class="p">([</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'employee_id'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">IntegerType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'fname'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">StringType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'lname'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">StringType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'age'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">IntegerType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> +<span class="p">])</span> + +<span class="n">sql_statements</span> <span class="o">=</span> <span class="p">(</span> + <span class="n">SparkSession</span><span class="p">()</span> + <span class="o">.</span><span class="n">createDataFrame</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> + <span class="o">.</span><span class="n">groupBy</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"age"</span><span class="p">))</span> + <span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">countDistinct</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"employee_id"</span><span class="p">))</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_employees"</span><span class="p">))</span> + <span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">dialect</span><span class="o">=</span><span class="s2">"bigquery"</span><span class="p">)</span> +<span class="p">)</span> + +<span class="n">result</span> <span class="o">=</span> <span class="kc">None</span> +<span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">sql_statements</span><span class="p">:</span> + <span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> + +<span class="k">assert</span> <span class="n">result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +<span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">client</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">result</span><span class="p">):</span> + <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Age: </span><span class="si">{</span><span class="n">row</span><span class="p">[</span><span class="s1">'age'</span><span class="p">]</span><span class="si">}</span><span class="s2">, Num Employees: </span><span class="si">{</span><span class="n">row</span><span class="p">[</span><span class="s1">'num_employees'</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</code></pre> +</div> + +<h3 id="snowflake">Snowflake</h3> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">import</span> <span class="nn">os</span> + +<span class="kn">import</span> <span class="nn">snowflake.connector</span> +<span class="kn">from</span> <span class="nn">sqlglot.dataframe.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> +<span class="kn">from</span> <span class="nn"><a href="">sqlglot.dataframe</a></span> <span class="kn">import</span> <span class="n">types</span> +<span class="kn">from</span> <span class="nn"><a href="">sqlglot.dataframe</a></span> <span class="kn">import</span> <span class="n">functions</span> <span class="k">as</span> <span class="n">F</span> + +<span class="n">ctx</span> <span class="o">=</span> <span class="n">snowflake</span><span class="o">.</span><span class="n">connector</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span> + <span class="n">user</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">"SNOWFLAKE_USER"</span><span class="p">],</span> + <span class="n">password</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">"SNOWFLAKE_PASS"</span><span class="p">],</span> + <span class="n">account</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">"SNOWFLAKE_ACCOUNT"</span><span class="p">]</span> +<span class="p">)</span> +<span class="n">cs</span> <span class="o">=</span> <span class="n">ctx</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span> + +<span class="n">data</span> <span class="o">=</span> <span class="p">[</span> + <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s2">"Jack"</span><span class="p">,</span> <span class="s2">"Shephard"</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> + <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"John"</span><span class="p">,</span> <span class="s2">"Locke"</span><span class="p">,</span> <span class="mi">48</span><span class="p">),</span> + <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s2">"Kate"</span><span class="p">,</span> <span class="s2">"Austen"</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> + <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="s2">"Claire"</span><span class="p">,</span> <span class="s2">"Littleton"</span><span class="p">,</span> <span class="mi">22</span><span class="p">),</span> + <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="s2">"Hugo"</span><span class="p">,</span> <span class="s2">"Reyes"</span><span class="p">,</span> <span class="mi">26</span><span class="p">),</span> +<span class="p">]</span> +<span class="n">schema</span> <span class="o">=</span> <span class="n">types</span><span class="o">.</span><span class="n">StructType</span><span class="p">([</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'employee_id'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">IntegerType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'fname'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">StringType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'lname'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">StringType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'age'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">IntegerType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> +<span class="p">])</span> + +<span class="n">sql_statements</span> <span class="o">=</span> <span class="p">(</span> + <span class="n">SparkSession</span><span class="p">()</span> + <span class="o">.</span><span class="n">createDataFrame</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> + <span class="o">.</span><span class="n">groupBy</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"age"</span><span class="p">))</span> + <span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">countDistinct</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"lname"</span><span class="p">))</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_employees"</span><span class="p">))</span> + <span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">dialect</span><span class="o">=</span><span class="s2">"snowflake"</span><span class="p">)</span> +<span class="p">)</span> + +<span class="k">try</span><span class="p">:</span> + <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">sql_statements</span><span class="p">:</span> + <span class="n">cs</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> + <span class="n">results</span> <span class="o">=</span> <span class="n">cs</span><span class="o">.</span><span class="n">fetchall</span><span class="p">()</span> + <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">results</span><span class="p">:</span> + <span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Age: </span><span class="si">{</span><span class="n">row</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}</span><span class="s2">, Num Employees: </span><span class="si">{</span><span class="n">row</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +<span class="k">finally</span><span class="p">:</span> + <span class="n">cs</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> +<span class="n">ctx</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> +</code></pre> +</div> + +<h3 id="spark">Spark</h3> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">pyspark.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> <span class="k">as</span> <span class="n">PySparkSession</span> +<span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> +<span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">types</span> +<span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">functions</span> <span class="k">as</span> <span class="n">F</span> + +<span class="n">data</span> <span class="o">=</span> <span class="p">[</span> + <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s2">"Jack"</span><span class="p">,</span> <span class="s2">"Shephard"</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> + <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s2">"John"</span><span class="p">,</span> <span class="s2">"Locke"</span><span class="p">,</span> <span class="mi">48</span><span class="p">),</span> + <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="s2">"Kate"</span><span class="p">,</span> <span class="s2">"Austen"</span><span class="p">,</span> <span class="mi">34</span><span class="p">),</span> + <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="s2">"Claire"</span><span class="p">,</span> <span class="s2">"Littleton"</span><span class="p">,</span> <span class="mi">22</span><span class="p">),</span> + <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="s2">"Hugo"</span><span class="p">,</span> <span class="s2">"Reyes"</span><span class="p">,</span> <span class="mi">26</span><span class="p">),</span> +<span class="p">]</span> +<span class="n">schema</span> <span class="o">=</span> <span class="n">types</span><span class="o">.</span><span class="n">StructType</span><span class="p">([</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'employee_id'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">IntegerType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'fname'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">StringType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'lname'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">StringType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> + <span class="n">types</span><span class="o">.</span><span class="n">StructField</span><span class="p">(</span><span class="s1">'age'</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">IntegerType</span><span class="p">(),</span> <span class="kc">False</span><span class="p">),</span> +<span class="p">])</span> + +<span class="n">sql_statements</span> <span class="o">=</span> <span class="p">(</span> + <span class="n">SparkSession</span><span class="p">()</span> + <span class="o">.</span><span class="n">createDataFrame</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> + <span class="o">.</span><span class="n">groupBy</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"age"</span><span class="p">))</span> + <span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">countDistinct</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"employee_id"</span><span class="p">))</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_employees"</span><span class="p">))</span> + <span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">)</span> +<span class="p">)</span> + +<span class="n">pyspark</span> <span class="o">=</span> <span class="n">PySparkSession</span><span class="o">.</span><span class="n">builder</span><span class="o">.</span><span class="n">master</span><span class="p">(</span><span class="s2">"local[*]"</span><span class="p">)</span><span class="o">.</span><span class="n">getOrCreate</span><span class="p">()</span> + +<span class="n">df</span> <span class="o">=</span> <span class="kc">None</span> +<span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">sql_statements</span><span class="p">:</span> + <span class="n">df</span> <span class="o">=</span> <span class="n">pyspark</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> + +<span class="k">assert</span> <span class="n">df</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +<span class="n">df</span><span class="o">.</span><span class="n">show</span><span class="p">()</span> +</code></pre> +</div> + +<h1 id="unsupportable-operations">Unsupportable Operations</h1> + +<p>Any operation that lacks a way to represent it in SQL cannot be supported by this tool. An example of this would be rdd operations. Since the DataFrame API though is mostly modeled around SQL concepts most operations can be supported.</p> +</div> + + <input id="mod-dataframe-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-dataframe-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos">1</span></a><span class="sd">"""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos">2</span></a><span class="sd">.. include:: ./README.md</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos">3</span></a><span class="sd">"""</span> +</span></pre></div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dataframe/sql.html b/docs/sqlglot/dataframe/sql.html new file mode 100644 index 0000000..83f5418 --- /dev/null +++ b/docs/sqlglot/dataframe/sql.html @@ -0,0 +1,4953 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dataframe.sql API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dataframe.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dataframe</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#SparkSession">SparkSession</a> + <ul class="memberlist"> + <li> + <a class="function" href="#SparkSession.__init__">SparkSession</a> + </li> + <li> + <a class="function" href="#SparkSession.table">table</a> + </li> + <li> + <a class="function" href="#SparkSession.createDataFrame">createDataFrame</a> + </li> + <li> + <a class="function" href="#SparkSession.sql">sql</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#DataFrame">DataFrame</a> + <ul class="memberlist"> + <li> + <a class="function" href="#DataFrame.__init__">DataFrame</a> + </li> + <li> + <a class="function" href="#DataFrame.sql">sql</a> + </li> + <li> + <a class="function" href="#DataFrame.copy">copy</a> + </li> + <li> + <a class="function" href="#DataFrame.select">select</a> + </li> + <li> + <a class="function" href="#DataFrame.alias">alias</a> + </li> + <li> + <a class="function" href="#DataFrame.where">where</a> + </li> + <li> + <a class="function" href="#DataFrame.filter">filter</a> + </li> + <li> + <a class="function" href="#DataFrame.groupBy">groupBy</a> + </li> + <li> + <a class="function" href="#DataFrame.agg">agg</a> + </li> + <li> + <a class="function" href="#DataFrame.join">join</a> + </li> + <li> + <a class="function" href="#DataFrame.orderBy">orderBy</a> + </li> + <li> + <a class="function" href="#DataFrame.sort">sort</a> + </li> + <li> + <a class="function" href="#DataFrame.union">union</a> + </li> + <li> + <a class="function" href="#DataFrame.unionAll">unionAll</a> + </li> + <li> + <a class="function" href="#DataFrame.unionByName">unionByName</a> + </li> + <li> + <a class="function" href="#DataFrame.intersect">intersect</a> + </li> + <li> + <a class="function" href="#DataFrame.intersectAll">intersectAll</a> + </li> + <li> + <a class="function" href="#DataFrame.exceptAll">exceptAll</a> + </li> + <li> + <a class="function" href="#DataFrame.distinct">distinct</a> + </li> + <li> + <a class="function" href="#DataFrame.dropDuplicates">dropDuplicates</a> + </li> + <li> + <a class="function" href="#DataFrame.dropna">dropna</a> + </li> + <li> + <a class="function" href="#DataFrame.fillna">fillna</a> + </li> + <li> + <a class="function" href="#DataFrame.replace">replace</a> + </li> + <li> + <a class="function" href="#DataFrame.withColumn">withColumn</a> + </li> + <li> + <a class="function" href="#DataFrame.withColumnRenamed">withColumnRenamed</a> + </li> + <li> + <a class="function" href="#DataFrame.drop">drop</a> + </li> + <li> + <a class="function" href="#DataFrame.limit">limit</a> + </li> + <li> + <a class="function" href="#DataFrame.hint">hint</a> + </li> + <li> + <a class="function" href="#DataFrame.repartition">repartition</a> + </li> + <li> + <a class="function" href="#DataFrame.coalesce">coalesce</a> + </li> + <li> + <a class="function" href="#DataFrame.cache">cache</a> + </li> + <li> + <a class="function" href="#DataFrame.persist">persist</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#GroupedData">GroupedData</a> + <ul class="memberlist"> + <li> + <a class="function" href="#GroupedData.__init__">GroupedData</a> + </li> + <li> + <a class="function" href="#GroupedData.agg">agg</a> + </li> + <li> + <a class="function" href="#GroupedData.count">count</a> + </li> + <li> + <a class="function" href="#GroupedData.mean">mean</a> + </li> + <li> + <a class="function" href="#GroupedData.avg">avg</a> + </li> + <li> + <a class="function" href="#GroupedData.max">max</a> + </li> + <li> + <a class="function" href="#GroupedData.min">min</a> + </li> + <li> + <a class="function" href="#GroupedData.sum">sum</a> + </li> + <li> + <a class="function" href="#GroupedData.pivot">pivot</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Column">Column</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Column.__init__">Column</a> + </li> + <li> + <a class="function" href="#Column.ensure_col">ensure_col</a> + </li> + <li> + <a class="function" href="#Column.ensure_cols">ensure_cols</a> + </li> + <li> + <a class="function" href="#Column.invoke_anonymous_function">invoke_anonymous_function</a> + </li> + <li> + <a class="function" href="#Column.invoke_expression_over_column">invoke_expression_over_column</a> + </li> + <li> + <a class="function" href="#Column.binary_op">binary_op</a> + </li> + <li> + <a class="function" href="#Column.inverse_binary_op">inverse_binary_op</a> + </li> + <li> + <a class="function" href="#Column.unary_op">unary_op</a> + </li> + <li> + <a class="function" href="#Column.ensure_literal">ensure_literal</a> + </li> + <li> + <a class="function" href="#Column.copy">copy</a> + </li> + <li> + <a class="function" href="#Column.set_table_name">set_table_name</a> + </li> + <li> + <a class="function" href="#Column.sql">sql</a> + </li> + <li> + <a class="function" href="#Column.alias">alias</a> + </li> + <li> + <a class="function" href="#Column.asc">asc</a> + </li> + <li> + <a class="function" href="#Column.desc">desc</a> + </li> + <li> + <a class="function" href="#Column.asc_nulls_first">asc_nulls_first</a> + </li> + <li> + <a class="function" href="#Column.asc_nulls_last">asc_nulls_last</a> + </li> + <li> + <a class="function" href="#Column.desc_nulls_first">desc_nulls_first</a> + </li> + <li> + <a class="function" href="#Column.desc_nulls_last">desc_nulls_last</a> + </li> + <li> + <a class="function" href="#Column.when">when</a> + </li> + <li> + <a class="function" href="#Column.otherwise">otherwise</a> + </li> + <li> + <a class="function" href="#Column.isNull">isNull</a> + </li> + <li> + <a class="function" href="#Column.isNotNull">isNotNull</a> + </li> + <li> + <a class="function" href="#Column.cast">cast</a> + </li> + <li> + <a class="function" href="#Column.startswith">startswith</a> + </li> + <li> + <a class="function" href="#Column.endswith">endswith</a> + </li> + <li> + <a class="function" href="#Column.rlike">rlike</a> + </li> + <li> + <a class="function" href="#Column.like">like</a> + </li> + <li> + <a class="function" href="#Column.ilike">ilike</a> + </li> + <li> + <a class="function" href="#Column.substr">substr</a> + </li> + <li> + <a class="function" href="#Column.isin">isin</a> + </li> + <li> + <a class="function" href="#Column.between">between</a> + </li> + <li> + <a class="function" href="#Column.over">over</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#DataFrameNaFunctions">DataFrameNaFunctions</a> + <ul class="memberlist"> + <li> + <a class="function" href="#DataFrameNaFunctions.__init__">DataFrameNaFunctions</a> + </li> + <li> + <a class="function" href="#DataFrameNaFunctions.drop">drop</a> + </li> + <li> + <a class="function" href="#DataFrameNaFunctions.fill">fill</a> + </li> + <li> + <a class="function" href="#DataFrameNaFunctions.replace">replace</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Window">Window</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Window.__init__">Window</a> + </li> + <li> + <a class="function" href="#Window.partitionBy">partitionBy</a> + </li> + <li> + <a class="function" href="#Window.orderBy">orderBy</a> + </li> + <li> + <a class="function" href="#Window.rowsBetween">rowsBetween</a> + </li> + <li> + <a class="function" href="#Window.rangeBetween">rangeBetween</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#WindowSpec">WindowSpec</a> + <ul class="memberlist"> + <li> + <a class="function" href="#WindowSpec.__init__">WindowSpec</a> + </li> + <li> + <a class="function" href="#WindowSpec.copy">copy</a> + </li> + <li> + <a class="function" href="#WindowSpec.sql">sql</a> + </li> + <li> + <a class="function" href="#WindowSpec.partitionBy">partitionBy</a> + </li> + <li> + <a class="function" href="#WindowSpec.orderBy">orderBy</a> + </li> + <li> + <a class="function" href="#WindowSpec.rowsBetween">rowsBetween</a> + </li> + <li> + <a class="function" href="#WindowSpec.rangeBetween">rangeBetween</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#DataFrameReader">DataFrameReader</a> + <ul class="memberlist"> + <li> + <a class="function" href="#DataFrameReader.__init__">DataFrameReader</a> + </li> + <li> + <a class="function" href="#DataFrameReader.table">table</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#DataFrameWriter">DataFrameWriter</a> + <ul class="memberlist"> + <li> + <a class="function" href="#DataFrameWriter.__init__">DataFrameWriter</a> + </li> + <li> + <a class="function" href="#DataFrameWriter.copy">copy</a> + </li> + <li> + <a class="function" href="#DataFrameWriter.sql">sql</a> + </li> + <li> + <a class="function" href="#DataFrameWriter.mode">mode</a> + </li> + <li> + <a class="function" href="#DataFrameWriter.insertInto">insertInto</a> + </li> + <li> + <a class="function" href="#DataFrameWriter.saveAsTable">saveAsTable</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dataframe/sql/__init__.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dataframe.html">dataframe</a><wbr>.sql </h1> + + + <input id="mod-sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-sql-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.column</span> <span class="kn">import</span> <span class="n">Column</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.dataframe</span> <span class="kn">import</span> <span class="n">DataFrame</span><span class="p">,</span> <span class="n">DataFrameNaFunctions</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.group</span> <span class="kn">import</span> <span class="n">GroupedData</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.readwriter</span> <span class="kn">import</span> <span class="n">DataFrameReader</span><span class="p">,</span> <span class="n">DataFrameWriter</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.window</span> <span class="kn">import</span> <span class="n">Window</span><span class="p">,</span> <span class="n">WindowSpec</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="s2">"SparkSession"</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="s2">"DataFrame"</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="s2">"GroupedData"</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="s2">"Column"</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="s2">"DataFrameNaFunctions"</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="s2">"Window"</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="s2">"WindowSpec"</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="s2">"DataFrameReader"</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="s2">"DataFrameWriter"</span><span class="p">,</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="p">]</span> +</span></pre></div> + + + </section> + <section id="SparkSession"> + <input id="SparkSession-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SparkSession</span>: + + <label class="view-source-button" for="SparkSession-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SparkSession"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SparkSession-20"><a href="#SparkSession-20"><span class="linenos"> 20</span></a><span class="k">class</span> <span class="nc">SparkSession</span><span class="p">:</span> +</span><span id="SparkSession-21"><a href="#SparkSession-21"><span class="linenos"> 21</span></a> <span class="n">known_ids</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">ClassVar</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="SparkSession-22"><a href="#SparkSession-22"><span class="linenos"> 22</span></a> <span class="n">known_branch_ids</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">ClassVar</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="SparkSession-23"><a href="#SparkSession-23"><span class="linenos"> 23</span></a> <span class="n">known_sequence_ids</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">ClassVar</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="SparkSession-24"><a href="#SparkSession-24"><span class="linenos"> 24</span></a> <span class="n">name_to_sequence_id_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">ClassVar</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> +</span><span id="SparkSession-25"><a href="#SparkSession-25"><span class="linenos"> 25</span></a> +</span><span id="SparkSession-26"><a href="#SparkSession-26"><span class="linenos"> 26</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="SparkSession-27"><a href="#SparkSession-27"><span class="linenos"> 27</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">incrementing_id</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="SparkSession-28"><a href="#SparkSession-28"><span class="linenos"> 28</span></a> +</span><span id="SparkSession-29"><a href="#SparkSession-29"><span class="linenos"> 29</span></a> <span class="k">def</span> <span class="fm">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">SparkSession</span><span class="p">:</span> +</span><span id="SparkSession-30"><a href="#SparkSession-30"><span class="linenos"> 30</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="SparkSession-31"><a href="#SparkSession-31"><span class="linenos"> 31</span></a> +</span><span id="SparkSession-32"><a href="#SparkSession-32"><span class="linenos"> 32</span></a> <span class="k">def</span> <span class="fm">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">SparkSession</span><span class="p">:</span> +</span><span id="SparkSession-33"><a href="#SparkSession-33"><span class="linenos"> 33</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="SparkSession-34"><a href="#SparkSession-34"><span class="linenos"> 34</span></a> +</span><span id="SparkSession-35"><a href="#SparkSession-35"><span class="linenos"> 35</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-36"><a href="#SparkSession-36"><span class="linenos"> 36</span></a> <span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrameReader</span><span class="p">:</span> +</span><span id="SparkSession-37"><a href="#SparkSession-37"><span class="linenos"> 37</span></a> <span class="k">return</span> <span class="n">DataFrameReader</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="SparkSession-38"><a href="#SparkSession-38"><span class="linenos"> 38</span></a> +</span><span id="SparkSession-39"><a href="#SparkSession-39"><span class="linenos"> 39</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="SparkSession-40"><a href="#SparkSession-40"><span class="linenos"> 40</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">read</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">tableName</span><span class="p">)</span> +</span><span id="SparkSession-41"><a href="#SparkSession-41"><span class="linenos"> 41</span></a> +</span><span id="SparkSession-42"><a href="#SparkSession-42"><span class="linenos"> 42</span></a> <span class="k">def</span> <span class="nf">createDataFrame</span><span class="p">(</span> +</span><span id="SparkSession-43"><a href="#SparkSession-43"><span class="linenos"> 43</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="SparkSession-44"><a href="#SparkSession-44"><span class="linenos"> 44</span></a> <span class="n">data</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">ColumnLiterals</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnLiterals</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">]],</span> +</span><span id="SparkSession-45"><a href="#SparkSession-45"><span class="linenos"> 45</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">SchemaInput</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SparkSession-46"><a href="#SparkSession-46"><span class="linenos"> 46</span></a> <span class="n">samplingRatio</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SparkSession-47"><a href="#SparkSession-47"><span class="linenos"> 47</span></a> <span class="n">verifySchema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SparkSession-48"><a href="#SparkSession-48"><span class="linenos"> 48</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="SparkSession-49"><a href="#SparkSession-49"><span class="linenos"> 49</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.dataframe</span> <span class="kn">import</span> <span class="n">DataFrame</span> +</span><span id="SparkSession-50"><a href="#SparkSession-50"><span class="linenos"> 50</span></a> +</span><span id="SparkSession-51"><a href="#SparkSession-51"><span class="linenos"> 51</span></a> <span class="k">if</span> <span class="n">samplingRatio</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">verifySchema</span><span class="p">:</span> +</span><span id="SparkSession-52"><a href="#SparkSession-52"><span class="linenos"> 52</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Sampling Ratio and Verify Schema are not supported"</span><span class="p">)</span> +</span><span id="SparkSession-53"><a href="#SparkSession-53"><span class="linenos"> 53</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="SparkSession-54"><a href="#SparkSession-54"><span class="linenos"> 54</span></a> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="p">(</span><span class="n">StructType</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">list</span><span class="p">))</span> +</span><span id="SparkSession-55"><a href="#SparkSession-55"><span class="linenos"> 55</span></a> <span class="ow">or</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">str</span><span class="p">))</span> +</span><span id="SparkSession-56"><a href="#SparkSession-56"><span class="linenos"> 56</span></a> <span class="p">):</span> +</span><span id="SparkSession-57"><a href="#SparkSession-57"><span class="linenos"> 57</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Only schema of either list or string of list supported"</span><span class="p">)</span> +</span><span id="SparkSession-58"><a href="#SparkSession-58"><span class="linenos"> 58</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">data</span><span class="p">:</span> +</span><span id="SparkSession-59"><a href="#SparkSession-59"><span class="linenos"> 59</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Must provide data to create into a DataFrame"</span><span class="p">)</span> +</span><span id="SparkSession-60"><a href="#SparkSession-60"><span class="linenos"> 60</span></a> +</span><span id="SparkSession-61"><a href="#SparkSession-61"><span class="linenos"> 61</span></a> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> +</span><span id="SparkSession-62"><a href="#SparkSession-62"><span class="linenos"> 62</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="SparkSession-63"><a href="#SparkSession-63"><span class="linenos"> 63</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="n">get_column_mapping_from_schema_input</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="SparkSession-64"><a href="#SparkSession-64"><span class="linenos"> 64</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="SparkSession-65"><a href="#SparkSession-65"><span class="linenos"> 65</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">col_name</span><span class="o">.</span><span class="n">strip</span><span class="p">():</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">col_name</span> <span class="ow">in</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]}</span> +</span><span id="SparkSession-66"><a href="#SparkSession-66"><span class="linenos"> 66</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="SparkSession-67"><a href="#SparkSession-67"><span class="linenos"> 67</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="sa">f</span><span class="s2">"_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)}</span> +</span><span id="SparkSession-68"><a href="#SparkSession-68"><span class="linenos"> 68</span></a> +</span><span id="SparkSession-69"><a href="#SparkSession-69"><span class="linenos"> 69</span></a> <span class="n">data_expressions</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="SparkSession-70"><a href="#SparkSession-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">(</span> +</span><span id="SparkSession-71"><a href="#SparkSession-71"><span class="linenos"> 71</span></a> <span class="n">expressions</span><span class="o">=</span><span class="nb">list</span><span class="p">(</span> +</span><span id="SparkSession-72"><a href="#SparkSession-72"><span class="linenos"> 72</span></a> <span class="nb">map</span><span class="p">(</span> +</span><span id="SparkSession-73"><a href="#SparkSession-73"><span class="linenos"> 73</span></a> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="SparkSession-74"><a href="#SparkSession-74"><span class="linenos"> 74</span></a> <span class="n">row</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="k">else</span> <span class="n">row</span><span class="o">.</span><span class="n">values</span><span class="p">(),</span> +</span><span id="SparkSession-75"><a href="#SparkSession-75"><span class="linenos"> 75</span></a> <span class="p">)</span> +</span><span id="SparkSession-76"><a href="#SparkSession-76"><span class="linenos"> 76</span></a> <span class="p">)</span> +</span><span id="SparkSession-77"><a href="#SparkSession-77"><span class="linenos"> 77</span></a> <span class="p">)</span> +</span><span id="SparkSession-78"><a href="#SparkSession-78"><span class="linenos"> 78</span></a> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">data</span> +</span><span id="SparkSession-79"><a href="#SparkSession-79"><span class="linenos"> 79</span></a> <span class="p">]</span> +</span><span id="SparkSession-80"><a href="#SparkSession-80"><span class="linenos"> 80</span></a> +</span><span id="SparkSession-81"><a href="#SparkSession-81"><span class="linenos"> 81</span></a> <span class="n">sel_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="SparkSession-82"><a href="#SparkSession-82"><span class="linenos"> 82</span></a> <span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">data_type</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="SparkSession-83"><a href="#SparkSession-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="n">data_type</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="SparkSession-84"><a href="#SparkSession-84"><span class="linenos"> 84</span></a> <span class="k">else</span> <span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="SparkSession-85"><a href="#SparkSession-85"><span class="linenos"> 85</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">data_type</span> <span class="ow">in</span> <span class="n">column_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="SparkSession-86"><a href="#SparkSession-86"><span class="linenos"> 86</span></a> <span class="p">]</span> +</span><span id="SparkSession-87"><a href="#SparkSession-87"><span class="linenos"> 87</span></a> +</span><span id="SparkSession-88"><a href="#SparkSession-88"><span class="linenos"> 88</span></a> <span class="n">select_kwargs</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SparkSession-89"><a href="#SparkSession-89"><span class="linenos"> 89</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="n">sel_columns</span><span class="p">,</span> +</span><span id="SparkSession-90"><a href="#SparkSession-90"><span class="linenos"> 90</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">(</span> +</span><span id="SparkSession-91"><a href="#SparkSession-91"><span class="linenos"> 91</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span> +</span><span id="SparkSession-92"><a href="#SparkSession-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">(</span> +</span><span id="SparkSession-93"><a href="#SparkSession-93"><span class="linenos"> 93</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">data_expressions</span><span class="p">,</span> +</span><span id="SparkSession-94"><a href="#SparkSession-94"><span class="linenos"> 94</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span> +</span><span id="SparkSession-95"><a href="#SparkSession-95"><span class="linenos"> 95</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_auto_incrementing_name</span><span class="p">),</span> +</span><span id="SparkSession-96"><a href="#SparkSession-96"><span class="linenos"> 96</span></a> <span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">col_name</span><span class="p">)</span> <span class="k">for</span> <span class="n">col_name</span> <span class="ow">in</span> <span class="n">column_mapping</span><span class="p">],</span> +</span><span id="SparkSession-97"><a href="#SparkSession-97"><span class="linenos"> 97</span></a> <span class="p">),</span> +</span><span id="SparkSession-98"><a href="#SparkSession-98"><span class="linenos"> 98</span></a> <span class="p">),</span> +</span><span id="SparkSession-99"><a href="#SparkSession-99"><span class="linenos"> 99</span></a> <span class="p">],</span> +</span><span id="SparkSession-100"><a href="#SparkSession-100"><span class="linenos">100</span></a> <span class="p">),</span> +</span><span id="SparkSession-101"><a href="#SparkSession-101"><span class="linenos">101</span></a> <span class="p">}</span> +</span><span id="SparkSession-102"><a href="#SparkSession-102"><span class="linenos">102</span></a> +</span><span id="SparkSession-103"><a href="#SparkSession-103"><span class="linenos">103</span></a> <span class="n">sel_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="o">**</span><span class="n">select_kwargs</span><span class="p">)</span> +</span><span id="SparkSession-104"><a href="#SparkSession-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="n">DataFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sel_expression</span><span class="p">)</span> +</span><span id="SparkSession-105"><a href="#SparkSession-105"><span class="linenos">105</span></a> +</span><span id="SparkSession-106"><a href="#SparkSession-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sqlQuery</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="SparkSession-107"><a href="#SparkSession-107"><span class="linenos">107</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">parse_one</span><span class="p">(</span><span class="n">sqlQuery</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">)</span> +</span><span id="SparkSession-108"><a href="#SparkSession-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="SparkSession-109"><a href="#SparkSession-109"><span class="linenos">109</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">DataFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="SparkSession-110"><a href="#SparkSession-110"><span class="linenos">110</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="SparkSession-111"><a href="#SparkSession-111"><span class="linenos">111</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">)):</span> +</span><span id="SparkSession-112"><a href="#SparkSession-112"><span class="linenos">112</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="SparkSession-113"><a href="#SparkSession-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">):</span> +</span><span id="SparkSession-114"><a href="#SparkSession-114"><span class="linenos">114</span></a> <span class="n">select_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">))</span> +</span><span id="SparkSession-115"><a href="#SparkSession-115"><span class="linenos">115</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="SparkSession-116"><a href="#SparkSession-116"><span class="linenos">116</span></a> <span class="k">del</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expression"</span><span class="p">]</span> +</span><span id="SparkSession-117"><a href="#SparkSession-117"><span class="linenos">117</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">DataFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">select_expression</span><span class="p">,</span> <span class="n">output_expression_container</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="SparkSession-118"><a href="#SparkSession-118"><span class="linenos">118</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="SparkSession-119"><a href="#SparkSession-119"><span class="linenos">119</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="SparkSession-120"><a href="#SparkSession-120"><span class="linenos">120</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span> +</span><span id="SparkSession-121"><a href="#SparkSession-121"><span class="linenos">121</span></a> <span class="s2">"Unknown expression type provided in the SQL. Please create an issue with the SQL."</span> +</span><span id="SparkSession-122"><a href="#SparkSession-122"><span class="linenos">122</span></a> <span class="p">)</span> +</span><span id="SparkSession-123"><a href="#SparkSession-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">df</span> +</span><span id="SparkSession-124"><a href="#SparkSession-124"><span class="linenos">124</span></a> +</span><span id="SparkSession-125"><a href="#SparkSession-125"><span class="linenos">125</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-126"><a href="#SparkSession-126"><span class="linenos">126</span></a> <span class="k">def</span> <span class="nf">_auto_incrementing_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="SparkSession-127"><a href="#SparkSession-127"><span class="linenos">127</span></a> <span class="n">name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"a</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">incrementing_id</span><span class="si">}</span><span class="s2">"</span> +</span><span id="SparkSession-128"><a href="#SparkSession-128"><span class="linenos">128</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">incrementing_id</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="SparkSession-129"><a href="#SparkSession-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="n">name</span> +</span><span id="SparkSession-130"><a href="#SparkSession-130"><span class="linenos">130</span></a> +</span><span id="SparkSession-131"><a href="#SparkSession-131"><span class="linenos">131</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-132"><a href="#SparkSession-132"><span class="linenos">132</span></a> <span class="k">def</span> <span class="nf">_random_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="SparkSession-133"><a href="#SparkSession-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="s2">"r"</span> <span class="o">+</span> <span class="n">uuid</span><span class="o">.</span><span class="n">uuid4</span><span class="p">()</span><span class="o">.</span><span class="n">hex</span> +</span><span id="SparkSession-134"><a href="#SparkSession-134"><span class="linenos">134</span></a> +</span><span id="SparkSession-135"><a href="#SparkSession-135"><span class="linenos">135</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-136"><a href="#SparkSession-136"><span class="linenos">136</span></a> <span class="k">def</span> <span class="nf">_random_branch_id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="SparkSession-137"><a href="#SparkSession-137"><span class="linenos">137</span></a> <span class="nb">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_random_id</span> +</span><span id="SparkSession-138"><a href="#SparkSession-138"><span class="linenos">138</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">known_branch_ids</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span> +</span><span id="SparkSession-139"><a href="#SparkSession-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="nb">id</span> +</span><span id="SparkSession-140"><a href="#SparkSession-140"><span class="linenos">140</span></a> +</span><span id="SparkSession-141"><a href="#SparkSession-141"><span class="linenos">141</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-142"><a href="#SparkSession-142"><span class="linenos">142</span></a> <span class="k">def</span> <span class="nf">_random_sequence_id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="SparkSession-143"><a href="#SparkSession-143"><span class="linenos">143</span></a> <span class="nb">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_random_id</span> +</span><span id="SparkSession-144"><a href="#SparkSession-144"><span class="linenos">144</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">known_sequence_ids</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span> +</span><span id="SparkSession-145"><a href="#SparkSession-145"><span class="linenos">145</span></a> <span class="k">return</span> <span class="nb">id</span> +</span><span id="SparkSession-146"><a href="#SparkSession-146"><span class="linenos">146</span></a> +</span><span id="SparkSession-147"><a href="#SparkSession-147"><span class="linenos">147</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-148"><a href="#SparkSession-148"><span class="linenos">148</span></a> <span class="k">def</span> <span class="nf">_random_id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="SparkSession-149"><a href="#SparkSession-149"><span class="linenos">149</span></a> <span class="nb">id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_random_name</span> +</span><span id="SparkSession-150"><a href="#SparkSession-150"><span class="linenos">150</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">known_ids</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="nb">id</span><span class="p">)</span> +</span><span id="SparkSession-151"><a href="#SparkSession-151"><span class="linenos">151</span></a> <span class="k">return</span> <span class="nb">id</span> +</span><span id="SparkSession-152"><a href="#SparkSession-152"><span class="linenos">152</span></a> +</span><span id="SparkSession-153"><a href="#SparkSession-153"><span class="linenos">153</span></a> <span class="nd">@property</span> +</span><span id="SparkSession-154"><a href="#SparkSession-154"><span class="linenos">154</span></a> <span class="k">def</span> <span class="nf">_join_hint_names</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="SparkSession-155"><a href="#SparkSession-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="p">{</span><span class="s2">"BROADCAST"</span><span class="p">,</span> <span class="s2">"MERGE"</span><span class="p">,</span> <span class="s2">"SHUFFLE_HASH"</span><span class="p">,</span> <span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">}</span> +</span><span id="SparkSession-156"><a href="#SparkSession-156"><span class="linenos">156</span></a> +</span><span id="SparkSession-157"><a href="#SparkSession-157"><span class="linenos">157</span></a> <span class="k">def</span> <span class="nf">_add_alias_to_mapping</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sequence_id</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="SparkSession-158"><a href="#SparkSession-158"><span class="linenos">158</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">name_to_sequence_id_mapping</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sequence_id</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="SparkSession.__init__" class="classattr"> + <input id="SparkSession.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">SparkSession</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="SparkSession.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SparkSession.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SparkSession.__init__-26"><a href="#SparkSession.__init__-26"><span class="linenos">26</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="SparkSession.__init__-27"><a href="#SparkSession.__init__-27"><span class="linenos">27</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">incrementing_id</span> <span class="o">=</span> <span class="mi">1</span> +</span></pre></div> + + + + + </div> + <div id="SparkSession.table" class="classattr"> + <input id="SparkSession.table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="SparkSession.table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SparkSession.table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SparkSession.table-39"><a href="#SparkSession.table-39"><span class="linenos">39</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="SparkSession.table-40"><a href="#SparkSession.table-40"><span class="linenos">40</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">read</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">tableName</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="SparkSession.createDataFrame" class="classattr"> + <input id="SparkSession.createDataFrame-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">createDataFrame</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">data</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700333898336'</span><span class="o">></span><span class="p">],</span> <span class="n">List</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700333898336'</span><span class="o">></span><span class="p">],</span> <span class="n">Tuple</span><span class="p">]]</span>,</span><span class="param"> <span class="n">schema</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700333867312'</span><span class="o">></span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">samplingRatio</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">verifySchema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="SparkSession.createDataFrame-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SparkSession.createDataFrame"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SparkSession.createDataFrame-42"><a href="#SparkSession.createDataFrame-42"><span class="linenos"> 42</span></a> <span class="k">def</span> <span class="nf">createDataFrame</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-43"><a href="#SparkSession.createDataFrame-43"><span class="linenos"> 43</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-44"><a href="#SparkSession.createDataFrame-44"><span class="linenos"> 44</span></a> <span class="n">data</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">ColumnLiterals</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnLiterals</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">]],</span> +</span><span id="SparkSession.createDataFrame-45"><a href="#SparkSession.createDataFrame-45"><span class="linenos"> 45</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">SchemaInput</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-46"><a href="#SparkSession.createDataFrame-46"><span class="linenos"> 46</span></a> <span class="n">samplingRatio</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">float</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-47"><a href="#SparkSession.createDataFrame-47"><span class="linenos"> 47</span></a> <span class="n">verifySchema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-48"><a href="#SparkSession.createDataFrame-48"><span class="linenos"> 48</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="SparkSession.createDataFrame-49"><a href="#SparkSession.createDataFrame-49"><span class="linenos"> 49</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.dataframe</span> <span class="kn">import</span> <span class="n">DataFrame</span> +</span><span id="SparkSession.createDataFrame-50"><a href="#SparkSession.createDataFrame-50"><span class="linenos"> 50</span></a> +</span><span id="SparkSession.createDataFrame-51"><a href="#SparkSession.createDataFrame-51"><span class="linenos"> 51</span></a> <span class="k">if</span> <span class="n">samplingRatio</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">verifySchema</span><span class="p">:</span> +</span><span id="SparkSession.createDataFrame-52"><a href="#SparkSession.createDataFrame-52"><span class="linenos"> 52</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Sampling Ratio and Verify Schema are not supported"</span><span class="p">)</span> +</span><span id="SparkSession.createDataFrame-53"><a href="#SparkSession.createDataFrame-53"><span class="linenos"> 53</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="SparkSession.createDataFrame-54"><a href="#SparkSession.createDataFrame-54"><span class="linenos"> 54</span></a> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="p">(</span><span class="n">StructType</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">list</span><span class="p">))</span> +</span><span id="SparkSession.createDataFrame-55"><a href="#SparkSession.createDataFrame-55"><span class="linenos"> 55</span></a> <span class="ow">or</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">str</span><span class="p">))</span> +</span><span id="SparkSession.createDataFrame-56"><a href="#SparkSession.createDataFrame-56"><span class="linenos"> 56</span></a> <span class="p">):</span> +</span><span id="SparkSession.createDataFrame-57"><a href="#SparkSession.createDataFrame-57"><span class="linenos"> 57</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Only schema of either list or string of list supported"</span><span class="p">)</span> +</span><span id="SparkSession.createDataFrame-58"><a href="#SparkSession.createDataFrame-58"><span class="linenos"> 58</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">data</span><span class="p">:</span> +</span><span id="SparkSession.createDataFrame-59"><a href="#SparkSession.createDataFrame-59"><span class="linenos"> 59</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Must provide data to create into a DataFrame"</span><span class="p">)</span> +</span><span id="SparkSession.createDataFrame-60"><a href="#SparkSession.createDataFrame-60"><span class="linenos"> 60</span></a> +</span><span id="SparkSession.createDataFrame-61"><a href="#SparkSession.createDataFrame-61"><span class="linenos"> 61</span></a> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> +</span><span id="SparkSession.createDataFrame-62"><a href="#SparkSession.createDataFrame-62"><span class="linenos"> 62</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="SparkSession.createDataFrame-63"><a href="#SparkSession.createDataFrame-63"><span class="linenos"> 63</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="n">get_column_mapping_from_schema_input</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="SparkSession.createDataFrame-64"><a href="#SparkSession.createDataFrame-64"><span class="linenos"> 64</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="SparkSession.createDataFrame-65"><a href="#SparkSession.createDataFrame-65"><span class="linenos"> 65</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">col_name</span><span class="o">.</span><span class="n">strip</span><span class="p">():</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">col_name</span> <span class="ow">in</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]}</span> +</span><span id="SparkSession.createDataFrame-66"><a href="#SparkSession.createDataFrame-66"><span class="linenos"> 66</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="SparkSession.createDataFrame-67"><a href="#SparkSession.createDataFrame-67"><span class="linenos"> 67</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="sa">f</span><span class="s2">"_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)}</span> +</span><span id="SparkSession.createDataFrame-68"><a href="#SparkSession.createDataFrame-68"><span class="linenos"> 68</span></a> +</span><span id="SparkSession.createDataFrame-69"><a href="#SparkSession.createDataFrame-69"><span class="linenos"> 69</span></a> <span class="n">data_expressions</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="SparkSession.createDataFrame-70"><a href="#SparkSession.createDataFrame-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-71"><a href="#SparkSession.createDataFrame-71"><span class="linenos"> 71</span></a> <span class="n">expressions</span><span class="o">=</span><span class="nb">list</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-72"><a href="#SparkSession.createDataFrame-72"><span class="linenos"> 72</span></a> <span class="nb">map</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-73"><a href="#SparkSession.createDataFrame-73"><span class="linenos"> 73</span></a> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-74"><a href="#SparkSession.createDataFrame-74"><span class="linenos"> 74</span></a> <span class="n">row</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="nb">dict</span><span class="p">)</span> <span class="k">else</span> <span class="n">row</span><span class="o">.</span><span class="n">values</span><span class="p">(),</span> +</span><span id="SparkSession.createDataFrame-75"><a href="#SparkSession.createDataFrame-75"><span class="linenos"> 75</span></a> <span class="p">)</span> +</span><span id="SparkSession.createDataFrame-76"><a href="#SparkSession.createDataFrame-76"><span class="linenos"> 76</span></a> <span class="p">)</span> +</span><span id="SparkSession.createDataFrame-77"><a href="#SparkSession.createDataFrame-77"><span class="linenos"> 77</span></a> <span class="p">)</span> +</span><span id="SparkSession.createDataFrame-78"><a href="#SparkSession.createDataFrame-78"><span class="linenos"> 78</span></a> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">data</span> +</span><span id="SparkSession.createDataFrame-79"><a href="#SparkSession.createDataFrame-79"><span class="linenos"> 79</span></a> <span class="p">]</span> +</span><span id="SparkSession.createDataFrame-80"><a href="#SparkSession.createDataFrame-80"><span class="linenos"> 80</span></a> +</span><span id="SparkSession.createDataFrame-81"><a href="#SparkSession.createDataFrame-81"><span class="linenos"> 81</span></a> <span class="n">sel_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="SparkSession.createDataFrame-82"><a href="#SparkSession.createDataFrame-82"><span class="linenos"> 82</span></a> <span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">data_type</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="SparkSession.createDataFrame-83"><a href="#SparkSession.createDataFrame-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="n">data_type</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="SparkSession.createDataFrame-84"><a href="#SparkSession.createDataFrame-84"><span class="linenos"> 84</span></a> <span class="k">else</span> <span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="SparkSession.createDataFrame-85"><a href="#SparkSession.createDataFrame-85"><span class="linenos"> 85</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">data_type</span> <span class="ow">in</span> <span class="n">column_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="SparkSession.createDataFrame-86"><a href="#SparkSession.createDataFrame-86"><span class="linenos"> 86</span></a> <span class="p">]</span> +</span><span id="SparkSession.createDataFrame-87"><a href="#SparkSession.createDataFrame-87"><span class="linenos"> 87</span></a> +</span><span id="SparkSession.createDataFrame-88"><a href="#SparkSession.createDataFrame-88"><span class="linenos"> 88</span></a> <span class="n">select_kwargs</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SparkSession.createDataFrame-89"><a href="#SparkSession.createDataFrame-89"><span class="linenos"> 89</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="n">sel_columns</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-90"><a href="#SparkSession.createDataFrame-90"><span class="linenos"> 90</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-91"><a href="#SparkSession.createDataFrame-91"><span class="linenos"> 91</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span> +</span><span id="SparkSession.createDataFrame-92"><a href="#SparkSession.createDataFrame-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-93"><a href="#SparkSession.createDataFrame-93"><span class="linenos"> 93</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">data_expressions</span><span class="p">,</span> +</span><span id="SparkSession.createDataFrame-94"><a href="#SparkSession.createDataFrame-94"><span class="linenos"> 94</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span> +</span><span id="SparkSession.createDataFrame-95"><a href="#SparkSession.createDataFrame-95"><span class="linenos"> 95</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_auto_incrementing_name</span><span class="p">),</span> +</span><span id="SparkSession.createDataFrame-96"><a href="#SparkSession.createDataFrame-96"><span class="linenos"> 96</span></a> <span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">col_name</span><span class="p">)</span> <span class="k">for</span> <span class="n">col_name</span> <span class="ow">in</span> <span class="n">column_mapping</span><span class="p">],</span> +</span><span id="SparkSession.createDataFrame-97"><a href="#SparkSession.createDataFrame-97"><span class="linenos"> 97</span></a> <span class="p">),</span> +</span><span id="SparkSession.createDataFrame-98"><a href="#SparkSession.createDataFrame-98"><span class="linenos"> 98</span></a> <span class="p">),</span> +</span><span id="SparkSession.createDataFrame-99"><a href="#SparkSession.createDataFrame-99"><span class="linenos"> 99</span></a> <span class="p">],</span> +</span><span id="SparkSession.createDataFrame-100"><a href="#SparkSession.createDataFrame-100"><span class="linenos">100</span></a> <span class="p">),</span> +</span><span id="SparkSession.createDataFrame-101"><a href="#SparkSession.createDataFrame-101"><span class="linenos">101</span></a> <span class="p">}</span> +</span><span id="SparkSession.createDataFrame-102"><a href="#SparkSession.createDataFrame-102"><span class="linenos">102</span></a> +</span><span id="SparkSession.createDataFrame-103"><a href="#SparkSession.createDataFrame-103"><span class="linenos">103</span></a> <span class="n">sel_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="o">**</span><span class="n">select_kwargs</span><span class="p">)</span> +</span><span id="SparkSession.createDataFrame-104"><a href="#SparkSession.createDataFrame-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="n">DataFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sel_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="SparkSession.sql" class="classattr"> + <input id="SparkSession.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sqlQuery</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="SparkSession.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SparkSession.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SparkSession.sql-106"><a href="#SparkSession.sql-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sqlQuery</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="SparkSession.sql-107"><a href="#SparkSession.sql-107"><span class="linenos">107</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">parse_one</span><span class="p">(</span><span class="n">sqlQuery</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">)</span> +</span><span id="SparkSession.sql-108"><a href="#SparkSession.sql-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="SparkSession.sql-109"><a href="#SparkSession.sql-109"><span class="linenos">109</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">DataFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="SparkSession.sql-110"><a href="#SparkSession.sql-110"><span class="linenos">110</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="SparkSession.sql-111"><a href="#SparkSession.sql-111"><span class="linenos">111</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">)):</span> +</span><span id="SparkSession.sql-112"><a href="#SparkSession.sql-112"><span class="linenos">112</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="SparkSession.sql-113"><a href="#SparkSession.sql-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">):</span> +</span><span id="SparkSession.sql-114"><a href="#SparkSession.sql-114"><span class="linenos">114</span></a> <span class="n">select_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">))</span> +</span><span id="SparkSession.sql-115"><a href="#SparkSession.sql-115"><span class="linenos">115</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="SparkSession.sql-116"><a href="#SparkSession.sql-116"><span class="linenos">116</span></a> <span class="k">del</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expression"</span><span class="p">]</span> +</span><span id="SparkSession.sql-117"><a href="#SparkSession.sql-117"><span class="linenos">117</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">DataFrame</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">select_expression</span><span class="p">,</span> <span class="n">output_expression_container</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="SparkSession.sql-118"><a href="#SparkSession.sql-118"><span class="linenos">118</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="SparkSession.sql-119"><a href="#SparkSession.sql-119"><span class="linenos">119</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="SparkSession.sql-120"><a href="#SparkSession.sql-120"><span class="linenos">120</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span> +</span><span id="SparkSession.sql-121"><a href="#SparkSession.sql-121"><span class="linenos">121</span></a> <span class="s2">"Unknown expression type provided in the SQL. Please create an issue with the SQL."</span> +</span><span id="SparkSession.sql-122"><a href="#SparkSession.sql-122"><span class="linenos">122</span></a> <span class="p">)</span> +</span><span id="SparkSession.sql-123"><a href="#SparkSession.sql-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">df</span> +</span></pre></div> + + + + + </div> + </section> + <section id="DataFrame"> + <input id="DataFrame-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataFrame</span>: + + <label class="view-source-button" for="DataFrame-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame-46"><a href="#DataFrame-46"><span class="linenos"> 46</span></a><span class="k">class</span> <span class="nc">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-47"><a href="#DataFrame-47"><span class="linenos"> 47</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="DataFrame-48"><a href="#DataFrame-48"><span class="linenos"> 48</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-49"><a href="#DataFrame-49"><span class="linenos"> 49</span></a> <span class="n">spark</span><span class="p">:</span> <span class="n">SparkSession</span><span class="p">,</span> +</span><span id="DataFrame-50"><a href="#DataFrame-50"><span class="linenos"> 50</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> +</span><span id="DataFrame-51"><a href="#DataFrame-51"><span class="linenos"> 51</span></a> <span class="n">branch_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-52"><a href="#DataFrame-52"><span class="linenos"> 52</span></a> <span class="n">sequence_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-53"><a href="#DataFrame-53"><span class="linenos"> 53</span></a> <span class="n">last_op</span><span class="p">:</span> <span class="n">Operation</span> <span class="o">=</span> <span class="n">Operation</span><span class="o">.</span><span class="n">INIT</span><span class="p">,</span> +</span><span id="DataFrame-54"><a href="#DataFrame-54"><span class="linenos"> 54</span></a> <span class="n">pending_hints</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-55"><a href="#DataFrame-55"><span class="linenos"> 55</span></a> <span class="n">output_expression_container</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">OutputExpressionContainer</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-56"><a href="#DataFrame-56"><span class="linenos"> 56</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="DataFrame-57"><a href="#DataFrame-57"><span class="linenos"> 57</span></a> <span class="p">):</span> +</span><span id="DataFrame-58"><a href="#DataFrame-58"><span class="linenos"> 58</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> <span class="o">=</span> <span class="n">spark</span> +</span><span id="DataFrame-59"><a href="#DataFrame-59"><span class="linenos"> 59</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="DataFrame-60"><a href="#DataFrame-60"><span class="linenos"> 60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">branch_id</span> <span class="o">=</span> <span class="n">branch_id</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_branch_id</span> +</span><span id="DataFrame-61"><a href="#DataFrame-61"><span class="linenos"> 61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span> <span class="o">=</span> <span class="n">sequence_id</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_sequence_id</span> +</span><span id="DataFrame-62"><a href="#DataFrame-62"><span class="linenos"> 62</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">last_op</span> <span class="o">=</span> <span class="n">last_op</span> +</span><span id="DataFrame-63"><a href="#DataFrame-63"><span class="linenos"> 63</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pending_hints</span> <span class="o">=</span> <span class="n">pending_hints</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="DataFrame-64"><a href="#DataFrame-64"><span class="linenos"> 64</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">output_expression_container</span> <span class="o">=</span> <span class="n">output_expression_container</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">()</span> +</span><span id="DataFrame-65"><a href="#DataFrame-65"><span class="linenos"> 65</span></a> +</span><span id="DataFrame-66"><a href="#DataFrame-66"><span class="linenos"> 66</span></a> <span class="k">def</span> <span class="fm">__getattr__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="DataFrame-67"><a href="#DataFrame-67"><span class="linenos"> 67</span></a> <span class="k">return</span> <span class="bp">self</span><span class="p">[</span><span class="n">column_name</span><span class="p">]</span> +</span><span id="DataFrame-68"><a href="#DataFrame-68"><span class="linenos"> 68</span></a> +</span><span id="DataFrame-69"><a href="#DataFrame-69"><span class="linenos"> 69</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="DataFrame-70"><a href="#DataFrame-70"><span class="linenos"> 70</span></a> <span class="n">column_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">branch_id</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">column_name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="DataFrame-71"><a href="#DataFrame-71"><span class="linenos"> 71</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">column_name</span><span class="p">)</span> +</span><span id="DataFrame-72"><a href="#DataFrame-72"><span class="linenos"> 72</span></a> +</span><span id="DataFrame-73"><a href="#DataFrame-73"><span class="linenos"> 73</span></a> <span class="k">def</span> <span class="nf">__copy__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DataFrame-74"><a href="#DataFrame-74"><span class="linenos"> 74</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-75"><a href="#DataFrame-75"><span class="linenos"> 75</span></a> +</span><span id="DataFrame-76"><a href="#DataFrame-76"><span class="linenos"> 76</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-77"><a href="#DataFrame-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">sparkSession</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DataFrame-78"><a href="#DataFrame-78"><span class="linenos"> 78</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> +</span><span id="DataFrame-79"><a href="#DataFrame-79"><span class="linenos"> 79</span></a> +</span><span id="DataFrame-80"><a href="#DataFrame-80"><span class="linenos"> 80</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-81"><a href="#DataFrame-81"><span class="linenos"> 81</span></a> <span class="k">def</span> <span class="nf">write</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DataFrame-82"><a href="#DataFrame-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="n">DataFrameWriter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="DataFrame-83"><a href="#DataFrame-83"><span class="linenos"> 83</span></a> +</span><span id="DataFrame-84"><a href="#DataFrame-84"><span class="linenos"> 84</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-85"><a href="#DataFrame-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="nf">latest_cte_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="DataFrame-86"><a href="#DataFrame-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">:</span> +</span><span id="DataFrame-87"><a href="#DataFrame-87"><span class="linenos"> 87</span></a> <span class="n">from_exp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"from"</span><span class="p">]</span> +</span><span id="DataFrame-88"><a href="#DataFrame-88"><span class="linenos"> 88</span></a> <span class="k">if</span> <span class="n">from_exp</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> +</span><span id="DataFrame-89"><a href="#DataFrame-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="n">from_exp</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame-90"><a href="#DataFrame-90"><span class="linenos"> 90</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">from_exp</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> +</span><span id="DataFrame-91"><a href="#DataFrame-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_alias</span><span class="p">:</span> +</span><span id="DataFrame-92"><a href="#DataFrame-92"><span class="linenos"> 92</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span> +</span><span id="DataFrame-93"><a href="#DataFrame-93"><span class="linenos"> 93</span></a> <span class="sa">f</span><span class="s2">"Could not find an alias name for this expression: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="si">}</span><span class="s2">"</span> +</span><span id="DataFrame-94"><a href="#DataFrame-94"><span class="linenos"> 94</span></a> <span class="p">)</span> +</span><span id="DataFrame-95"><a href="#DataFrame-95"><span class="linenos"> 95</span></a> <span class="k">return</span> <span class="n">table_alias</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame-96"><a href="#DataFrame-96"><span class="linenos"> 96</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">alias</span> +</span><span id="DataFrame-97"><a href="#DataFrame-97"><span class="linenos"> 97</span></a> +</span><span id="DataFrame-98"><a href="#DataFrame-98"><span class="linenos"> 98</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-99"><a href="#DataFrame-99"><span class="linenos"> 99</span></a> <span class="k">def</span> <span class="nf">pending_join_hints</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DataFrame-100"><a href="#DataFrame-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">hint</span> <span class="k">for</span> <span class="n">hint</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">pending_hints</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">hint</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">)]</span> +</span><span id="DataFrame-101"><a href="#DataFrame-101"><span class="linenos">101</span></a> +</span><span id="DataFrame-102"><a href="#DataFrame-102"><span class="linenos">102</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-103"><a href="#DataFrame-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">pending_partition_hints</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DataFrame-104"><a href="#DataFrame-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">hint</span> <span class="k">for</span> <span class="n">hint</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">pending_hints</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">hint</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">)]</span> +</span><span id="DataFrame-105"><a href="#DataFrame-105"><span class="linenos">105</span></a> +</span><span id="DataFrame-106"><a href="#DataFrame-106"><span class="linenos">106</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-107"><a href="#DataFrame-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="DataFrame-108"><a href="#DataFrame-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="DataFrame-109"><a href="#DataFrame-109"><span class="linenos">109</span></a> +</span><span id="DataFrame-110"><a href="#DataFrame-110"><span class="linenos">110</span></a> <span class="nd">@property</span> +</span><span id="DataFrame-111"><a href="#DataFrame-111"><span class="linenos">111</span></a> <span class="k">def</span> <span class="nf">na</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrameNaFunctions</span><span class="p">:</span> +</span><span id="DataFrame-112"><a href="#DataFrame-112"><span class="linenos">112</span></a> <span class="k">return</span> <span class="n">DataFrameNaFunctions</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="DataFrame-113"><a href="#DataFrame-113"><span class="linenos">113</span></a> +</span><span id="DataFrame-114"><a href="#DataFrame-114"><span class="linenos">114</span></a> <span class="k">def</span> <span class="nf">_replace_cte_names_with_hashes</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="DataFrame-115"><a href="#DataFrame-115"><span class="linenos">115</span></a> <span class="n">replacement_mapping</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="DataFrame-116"><a href="#DataFrame-116"><span class="linenos">116</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">:</span> +</span><span id="DataFrame-117"><a href="#DataFrame-117"><span class="linenos">117</span></a> <span class="n">old_name_id</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> +</span><span id="DataFrame-118"><a href="#DataFrame-118"><span class="linenos">118</span></a> <span class="n">new_hashed_id</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span> +</span><span id="DataFrame-119"><a href="#DataFrame-119"><span class="linenos">119</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_create_hash_from_expression</span><span class="p">(</span><span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">quoted</span><span class="o">=</span><span class="n">old_name_id</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"quoted"</span><span class="p">]</span> +</span><span id="DataFrame-120"><a href="#DataFrame-120"><span class="linenos">120</span></a> <span class="p">)</span> +</span><span id="DataFrame-121"><a href="#DataFrame-121"><span class="linenos">121</span></a> <span class="n">replacement_mapping</span><span class="p">[</span><span class="n">old_name_id</span><span class="p">]</span> <span class="o">=</span> <span class="n">new_hashed_id</span> +</span><span id="DataFrame-122"><a href="#DataFrame-122"><span class="linenos">122</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">replace_id_value</span><span class="p">,</span> <span class="n">replacement_mapping</span><span class="p">)</span> +</span><span id="DataFrame-123"><a href="#DataFrame-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="DataFrame-124"><a href="#DataFrame-124"><span class="linenos">124</span></a> +</span><span id="DataFrame-125"><a href="#DataFrame-125"><span class="linenos">125</span></a> <span class="k">def</span> <span class="nf">_create_cte_from_expression</span><span class="p">(</span> +</span><span id="DataFrame-126"><a href="#DataFrame-126"><span class="linenos">126</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-127"><a href="#DataFrame-127"><span class="linenos">127</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> +</span><span id="DataFrame-128"><a href="#DataFrame-128"><span class="linenos">128</span></a> <span class="n">branch_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-129"><a href="#DataFrame-129"><span class="linenos">129</span></a> <span class="n">sequence_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-130"><a href="#DataFrame-130"><span class="linenos">130</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="DataFrame-131"><a href="#DataFrame-131"><span class="linenos">131</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="DataFrame-132"><a href="#DataFrame-132"><span class="linenos">132</span></a> <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_name</span> +</span><span id="DataFrame-133"><a href="#DataFrame-133"><span class="linenos">133</span></a> <span class="n">expression_to_cte</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-134"><a href="#DataFrame-134"><span class="linenos">134</span></a> <span class="n">expression_to_cte</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame-135"><a href="#DataFrame-135"><span class="linenos">135</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">with_</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">as_</span><span class="o">=</span><span class="n">expression_to_cte</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span><span class="o">.</span><span class="n">ctes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="DataFrame-136"><a href="#DataFrame-136"><span class="linenos">136</span></a> <span class="n">cte</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"branch_id"</span><span class="p">,</span> <span class="n">branch_id</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">branch_id</span><span class="p">)</span> +</span><span id="DataFrame-137"><a href="#DataFrame-137"><span class="linenos">137</span></a> <span class="n">cte</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"sequence_id"</span><span class="p">,</span> <span class="n">sequence_id</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span><span class="p">)</span> +</span><span id="DataFrame-138"><a href="#DataFrame-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">cte</span><span class="p">,</span> <span class="n">name</span> +</span><span id="DataFrame-139"><a href="#DataFrame-139"><span class="linenos">139</span></a> +</span><span id="DataFrame-140"><a href="#DataFrame-140"><span class="linenos">140</span></a> <span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="DataFrame-141"><a href="#DataFrame-141"><span class="linenos">141</span></a> <span class="k">def</span> <span class="nf">_ensure_list_of_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]:</span> +</span><span id="DataFrame-142"><a href="#DataFrame-142"><span class="linenos">142</span></a> <span class="o">...</span> +</span><span id="DataFrame-143"><a href="#DataFrame-143"><span class="linenos">143</span></a> +</span><span id="DataFrame-144"><a href="#DataFrame-144"><span class="linenos">144</span></a> <span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="DataFrame-145"><a href="#DataFrame-145"><span class="linenos">145</span></a> <span class="k">def</span> <span class="nf">_ensure_list_of_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cols</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]:</span> +</span><span id="DataFrame-146"><a href="#DataFrame-146"><span class="linenos">146</span></a> <span class="o">...</span> +</span><span id="DataFrame-147"><a href="#DataFrame-147"><span class="linenos">147</span></a> +</span><span id="DataFrame-148"><a href="#DataFrame-148"><span class="linenos">148</span></a> <span class="k">def</span> <span class="nf">_ensure_list_of_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cols</span><span class="p">):</span> +</span><span id="DataFrame-149"><a href="#DataFrame-149"><span class="linenos">149</span></a> <span class="k">return</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_cols</span><span class="p">(</span><span class="n">ensure_list</span><span class="p">(</span><span class="n">cols</span><span class="p">))</span> +</span><span id="DataFrame-150"><a href="#DataFrame-150"><span class="linenos">150</span></a> +</span><span id="DataFrame-151"><a href="#DataFrame-151"><span class="linenos">151</span></a> <span class="k">def</span> <span class="nf">_ensure_and_normalize_cols</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cols</span><span class="p">):</span> +</span><span id="DataFrame-152"><a href="#DataFrame-152"><span class="linenos">152</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-153"><a href="#DataFrame-153"><span class="linenos">153</span></a> <span class="n">normalize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-154"><a href="#DataFrame-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="n">cols</span> +</span><span id="DataFrame-155"><a href="#DataFrame-155"><span class="linenos">155</span></a> +</span><span id="DataFrame-156"><a href="#DataFrame-156"><span class="linenos">156</span></a> <span class="k">def</span> <span class="nf">_ensure_and_normalize_col</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">col</span><span class="p">):</span> +</span><span id="DataFrame-157"><a href="#DataFrame-157"><span class="linenos">157</span></a> <span class="n">col</span> <span class="o">=</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">col</span><span class="p">)</span> +</span><span id="DataFrame-158"><a href="#DataFrame-158"><span class="linenos">158</span></a> <span class="n">normalize</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span> +</span><span id="DataFrame-159"><a href="#DataFrame-159"><span class="linenos">159</span></a> <span class="k">return</span> <span class="n">col</span> +</span><span id="DataFrame-160"><a href="#DataFrame-160"><span class="linenos">160</span></a> +</span><span id="DataFrame-161"><a href="#DataFrame-161"><span class="linenos">161</span></a> <span class="k">def</span> <span class="nf">_convert_leaf_to_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sequence_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-162"><a href="#DataFrame-162"><span class="linenos">162</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_resolve_pending_hints</span><span class="p">()</span> +</span><span id="DataFrame-163"><a href="#DataFrame-163"><span class="linenos">163</span></a> <span class="n">sequence_id</span> <span class="o">=</span> <span class="n">sequence_id</span> <span class="ow">or</span> <span class="n">df</span><span class="o">.</span><span class="n">sequence_id</span> +</span><span id="DataFrame-164"><a href="#DataFrame-164"><span class="linenos">164</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-165"><a href="#DataFrame-165"><span class="linenos">165</span></a> <span class="n">cte_expression</span><span class="p">,</span> <span class="n">cte_name</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_create_cte_from_expression</span><span class="p">(</span> +</span><span id="DataFrame-166"><a href="#DataFrame-166"><span class="linenos">166</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">sequence_id</span><span class="o">=</span><span class="n">sequence_id</span> +</span><span id="DataFrame-167"><a href="#DataFrame-167"><span class="linenos">167</span></a> <span class="p">)</span> +</span><span id="DataFrame-168"><a href="#DataFrame-168"><span class="linenos">168</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_add_ctes_to_expression</span><span class="p">(</span> +</span><span id="DataFrame-169"><a href="#DataFrame-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(),</span> <span class="n">expression</span><span class="o">.</span><span class="n">ctes</span> <span class="o">+</span> <span class="p">[</span><span class="n">cte_expression</span><span class="p">]</span> +</span><span id="DataFrame-170"><a href="#DataFrame-170"><span class="linenos">170</span></a> <span class="p">)</span> +</span><span id="DataFrame-171"><a href="#DataFrame-171"><span class="linenos">171</span></a> <span class="n">sel_columns</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">cte_expression</span><span class="p">)</span> +</span><span id="DataFrame-172"><a href="#DataFrame-172"><span class="linenos">172</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">new_expression</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">cte_name</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span> +</span><span id="DataFrame-173"><a href="#DataFrame-173"><span class="linenos">173</span></a> <span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">sel_columns</span><span class="p">]</span> +</span><span id="DataFrame-174"><a href="#DataFrame-174"><span class="linenos">174</span></a> <span class="p">)</span> +</span><span id="DataFrame-175"><a href="#DataFrame-175"><span class="linenos">175</span></a> <span class="k">return</span> <span class="n">df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">new_expression</span><span class="p">,</span> <span class="n">sequence_id</span><span class="o">=</span><span class="n">sequence_id</span><span class="p">)</span> +</span><span id="DataFrame-176"><a href="#DataFrame-176"><span class="linenos">176</span></a> +</span><span id="DataFrame-177"><a href="#DataFrame-177"><span class="linenos">177</span></a> <span class="k">def</span> <span class="nf">_resolve_pending_hints</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-178"><a href="#DataFrame-178"><span class="linenos">178</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-179"><a href="#DataFrame-179"><span class="linenos">179</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pending_hints</span><span class="p">:</span> +</span><span id="DataFrame-180"><a href="#DataFrame-180"><span class="linenos">180</span></a> <span class="k">return</span> <span class="n">df</span> +</span><span id="DataFrame-181"><a href="#DataFrame-181"><span class="linenos">181</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">expression</span> +</span><span id="DataFrame-182"><a href="#DataFrame-182"><span class="linenos">182</span></a> <span class="n">hint_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"hint"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[])</span> +</span><span id="DataFrame-183"><a href="#DataFrame-183"><span class="linenos">183</span></a> <span class="k">for</span> <span class="n">hint</span> <span class="ow">in</span> <span class="n">df</span><span class="o">.</span><span class="n">pending_partition_hints</span><span class="p">:</span> +</span><span id="DataFrame-184"><a href="#DataFrame-184"><span class="linenos">184</span></a> <span class="n">hint_expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">hint</span><span class="p">)</span> +</span><span id="DataFrame-185"><a href="#DataFrame-185"><span class="linenos">185</span></a> <span class="n">df</span><span class="o">.</span><span class="n">pending_hints</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">hint</span><span class="p">)</span> +</span><span id="DataFrame-186"><a href="#DataFrame-186"><span class="linenos">186</span></a> +</span><span id="DataFrame-187"><a href="#DataFrame-187"><span class="linenos">187</span></a> <span class="n">join_aliases</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataFrame-188"><a href="#DataFrame-188"><span class="linenos">188</span></a> <span class="n">join_table</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame-189"><a href="#DataFrame-189"><span class="linenos">189</span></a> <span class="k">for</span> <span class="n">join_table</span> <span class="ow">in</span> <span class="n">get_tables_from_expression_with_join</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-190"><a href="#DataFrame-190"><span class="linenos">190</span></a> <span class="p">}</span> +</span><span id="DataFrame-191"><a href="#DataFrame-191"><span class="linenos">191</span></a> <span class="k">if</span> <span class="n">join_aliases</span><span class="p">:</span> +</span><span id="DataFrame-192"><a href="#DataFrame-192"><span class="linenos">192</span></a> <span class="k">for</span> <span class="n">hint</span> <span class="ow">in</span> <span class="n">df</span><span class="o">.</span><span class="n">pending_join_hints</span><span class="p">:</span> +</span><span id="DataFrame-193"><a href="#DataFrame-193"><span class="linenos">193</span></a> <span class="k">for</span> <span class="n">sequence_id_expression</span> <span class="ow">in</span> <span class="n">hint</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="DataFrame-194"><a href="#DataFrame-194"><span class="linenos">194</span></a> <span class="n">sequence_id_or_name</span> <span class="o">=</span> <span class="n">sequence_id_expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame-195"><a href="#DataFrame-195"><span class="linenos">195</span></a> <span class="n">sequence_ids_to_match</span> <span class="o">=</span> <span class="p">[</span><span class="n">sequence_id_or_name</span><span class="p">]</span> +</span><span id="DataFrame-196"><a href="#DataFrame-196"><span class="linenos">196</span></a> <span class="k">if</span> <span class="n">sequence_id_or_name</span> <span class="ow">in</span> <span class="n">df</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">name_to_sequence_id_mapping</span><span class="p">:</span> +</span><span id="DataFrame-197"><a href="#DataFrame-197"><span class="linenos">197</span></a> <span class="n">sequence_ids_to_match</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">name_to_sequence_id_mapping</span><span class="p">[</span> +</span><span id="DataFrame-198"><a href="#DataFrame-198"><span class="linenos">198</span></a> <span class="n">sequence_id_or_name</span> +</span><span id="DataFrame-199"><a href="#DataFrame-199"><span class="linenos">199</span></a> <span class="p">]</span> +</span><span id="DataFrame-200"><a href="#DataFrame-200"><span class="linenos">200</span></a> <span class="n">matching_ctes</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-201"><a href="#DataFrame-201"><span class="linenos">201</span></a> <span class="n">cte</span> +</span><span id="DataFrame-202"><a href="#DataFrame-202"><span class="linenos">202</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">)</span> +</span><span id="DataFrame-203"><a href="#DataFrame-203"><span class="linenos">203</span></a> <span class="k">if</span> <span class="n">cte</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"sequence_id"</span><span class="p">]</span> <span class="ow">in</span> <span class="n">sequence_ids_to_match</span> +</span><span id="DataFrame-204"><a href="#DataFrame-204"><span class="linenos">204</span></a> <span class="p">]</span> +</span><span id="DataFrame-205"><a href="#DataFrame-205"><span class="linenos">205</span></a> <span class="k">for</span> <span class="n">matching_cte</span> <span class="ow">in</span> <span class="n">matching_ctes</span><span class="p">:</span> +</span><span id="DataFrame-206"><a href="#DataFrame-206"><span class="linenos">206</span></a> <span class="k">if</span> <span class="n">matching_cte</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">join_aliases</span><span class="p">:</span> +</span><span id="DataFrame-207"><a href="#DataFrame-207"><span class="linenos">207</span></a> <span class="n">sequence_id_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">matching_cte</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="DataFrame-208"><a href="#DataFrame-208"><span class="linenos">208</span></a> <span class="n">df</span><span class="o">.</span><span class="n">pending_hints</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">hint</span><span class="p">)</span> +</span><span id="DataFrame-209"><a href="#DataFrame-209"><span class="linenos">209</span></a> <span class="k">break</span> +</span><span id="DataFrame-210"><a href="#DataFrame-210"><span class="linenos">210</span></a> <span class="n">hint_expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">hint</span><span class="p">)</span> +</span><span id="DataFrame-211"><a href="#DataFrame-211"><span class="linenos">211</span></a> <span class="k">if</span> <span class="n">hint_expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="DataFrame-212"><a href="#DataFrame-212"><span class="linenos">212</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"hint"</span><span class="p">,</span> <span class="n">hint_expression</span><span class="p">)</span> +</span><span id="DataFrame-213"><a href="#DataFrame-213"><span class="linenos">213</span></a> <span class="k">return</span> <span class="n">df</span> +</span><span id="DataFrame-214"><a href="#DataFrame-214"><span class="linenos">214</span></a> +</span><span id="DataFrame-215"><a href="#DataFrame-215"><span class="linenos">215</span></a> <span class="k">def</span> <span class="nf">_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">hint_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-216"><a href="#DataFrame-216"><span class="linenos">216</span></a> <span class="n">hint_name</span> <span class="o">=</span> <span class="n">hint_name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="DataFrame-217"><a href="#DataFrame-217"><span class="linenos">217</span></a> <span class="n">hint_expression</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame-218"><a href="#DataFrame-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">(</span> +</span><span id="DataFrame-219"><a href="#DataFrame-219"><span class="linenos">219</span></a> <span class="n">this</span><span class="o">=</span><span class="n">hint_name</span><span class="p">,</span> +</span><span id="DataFrame-220"><a href="#DataFrame-220"><span class="linenos">220</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">parameter</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> <span class="k">for</span> <span class="n">parameter</span> <span class="ow">in</span> <span class="n">args</span><span class="p">],</span> +</span><span id="DataFrame-221"><a href="#DataFrame-221"><span class="linenos">221</span></a> <span class="p">)</span> +</span><span id="DataFrame-222"><a href="#DataFrame-222"><span class="linenos">222</span></a> <span class="k">if</span> <span class="n">hint_name</span> <span class="ow">in</span> <span class="n">JOIN_HINTS</span> +</span><span id="DataFrame-223"><a href="#DataFrame-223"><span class="linenos">223</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">(</span> +</span><span id="DataFrame-224"><a href="#DataFrame-224"><span class="linenos">224</span></a> <span class="n">this</span><span class="o">=</span><span class="n">hint_name</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">parameter</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">parameter</span> <span class="ow">in</span> <span class="n">args</span><span class="p">]</span> +</span><span id="DataFrame-225"><a href="#DataFrame-225"><span class="linenos">225</span></a> <span class="p">)</span> +</span><span id="DataFrame-226"><a href="#DataFrame-226"><span class="linenos">226</span></a> <span class="p">)</span> +</span><span id="DataFrame-227"><a href="#DataFrame-227"><span class="linenos">227</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-228"><a href="#DataFrame-228"><span class="linenos">228</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">pending_hints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">hint_expression</span><span class="p">)</span> +</span><span id="DataFrame-229"><a href="#DataFrame-229"><span class="linenos">229</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span><span id="DataFrame-230"><a href="#DataFrame-230"><span class="linenos">230</span></a> +</span><span id="DataFrame-231"><a href="#DataFrame-231"><span class="linenos">231</span></a> <span class="k">def</span> <span class="nf">_set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> <span class="n">distinct</span><span class="p">:</span> <span class="nb">bool</span><span class="p">):</span> +</span><span id="DataFrame-232"><a href="#DataFrame-232"><span class="linenos">232</span></a> <span class="n">other_df</span> <span class="o">=</span> <span class="n">other</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="DataFrame-233"><a href="#DataFrame-233"><span class="linenos">233</span></a> <span class="n">base_expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-234"><a href="#DataFrame-234"><span class="linenos">234</span></a> <span class="n">base_expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add_ctes_to_expression</span><span class="p">(</span><span class="n">base_expression</span><span class="p">,</span> <span class="n">other_df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">)</span> +</span><span id="DataFrame-235"><a href="#DataFrame-235"><span class="linenos">235</span></a> <span class="n">all_ctes</span> <span class="o">=</span> <span class="n">base_expression</span><span class="o">.</span><span class="n">ctes</span> +</span><span id="DataFrame-236"><a href="#DataFrame-236"><span class="linenos">236</span></a> <span class="n">other_df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame-237"><a href="#DataFrame-237"><span class="linenos">237</span></a> <span class="n">base_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame-238"><a href="#DataFrame-238"><span class="linenos">238</span></a> <span class="n">operation</span> <span class="o">=</span> <span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">base_expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">other_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-239"><a href="#DataFrame-239"><span class="linenos">239</span></a> <span class="n">operation</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">all_ctes</span><span class="p">))</span> +</span><span id="DataFrame-240"><a href="#DataFrame-240"><span class="linenos">240</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">operation</span><span class="p">)</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="DataFrame-241"><a href="#DataFrame-241"><span class="linenos">241</span></a> +</span><span id="DataFrame-242"><a href="#DataFrame-242"><span class="linenos">242</span></a> <span class="k">def</span> <span class="nf">_cache</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">storage_level</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="DataFrame-243"><a href="#DataFrame-243"><span class="linenos">243</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="DataFrame-244"><a href="#DataFrame-244"><span class="linenos">244</span></a> <span class="n">df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"cache_storage_level"</span><span class="p">,</span> <span class="n">storage_level</span><span class="p">)</span> +</span><span id="DataFrame-245"><a href="#DataFrame-245"><span class="linenos">245</span></a> <span class="k">return</span> <span class="n">df</span> +</span><span id="DataFrame-246"><a href="#DataFrame-246"><span class="linenos">246</span></a> +</span><span id="DataFrame-247"><a href="#DataFrame-247"><span class="linenos">247</span></a> <span class="nd">@classmethod</span> +</span><span id="DataFrame-248"><a href="#DataFrame-248"><span class="linenos">248</span></a> <span class="k">def</span> <span class="nf">_add_ctes_to_expression</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> +</span><span id="DataFrame-249"><a href="#DataFrame-249"><span class="linenos">249</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-250"><a href="#DataFrame-250"><span class="linenos">250</span></a> <span class="n">with_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="DataFrame-251"><a href="#DataFrame-251"><span class="linenos">251</span></a> <span class="k">if</span> <span class="n">with_expression</span><span class="p">:</span> +</span><span id="DataFrame-252"><a href="#DataFrame-252"><span class="linenos">252</span></a> <span class="n">existing_ctes</span> <span class="o">=</span> <span class="n">with_expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="DataFrame-253"><a href="#DataFrame-253"><span class="linenos">253</span></a> <span class="n">existsing_cte_names</span> <span class="o">=</span> <span class="p">{</span><span class="n">x</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">existing_ctes</span><span class="p">}</span> +</span><span id="DataFrame-254"><a href="#DataFrame-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">ctes</span><span class="p">:</span> +</span><span id="DataFrame-255"><a href="#DataFrame-255"><span class="linenos">255</span></a> <span class="k">if</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">existsing_cte_names</span><span class="p">:</span> +</span><span id="DataFrame-256"><a href="#DataFrame-256"><span class="linenos">256</span></a> <span class="n">existing_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cte</span><span class="p">)</span> +</span><span id="DataFrame-257"><a href="#DataFrame-257"><span class="linenos">257</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-258"><a href="#DataFrame-258"><span class="linenos">258</span></a> <span class="n">existing_ctes</span> <span class="o">=</span> <span class="n">ctes</span> +</span><span id="DataFrame-259"><a href="#DataFrame-259"><span class="linenos">259</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">existing_ctes</span><span class="p">))</span> +</span><span id="DataFrame-260"><a href="#DataFrame-260"><span class="linenos">260</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="DataFrame-261"><a href="#DataFrame-261"><span class="linenos">261</span></a> +</span><span id="DataFrame-262"><a href="#DataFrame-262"><span class="linenos">262</span></a> <span class="nd">@classmethod</span> +</span><span id="DataFrame-263"><a href="#DataFrame-263"><span class="linenos">263</span></a> <span class="k">def</span> <span class="nf">_get_outer_select_columns</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">item</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">DataFrame</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]:</span> +</span><span id="DataFrame-264"><a href="#DataFrame-264"><span class="linenos">264</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">expression</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="k">else</span> <span class="n">item</span> +</span><span id="DataFrame-265"><a href="#DataFrame-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">]</span> +</span><span id="DataFrame-266"><a href="#DataFrame-266"><span class="linenos">266</span></a> +</span><span id="DataFrame-267"><a href="#DataFrame-267"><span class="linenos">267</span></a> <span class="nd">@classmethod</span> +</span><span id="DataFrame-268"><a href="#DataFrame-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">_create_hash_from_expression</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="DataFrame-269"><a href="#DataFrame-269"><span class="linenos">269</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="DataFrame-270"><a href="#DataFrame-270"><span class="linenos">270</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"t</span><span class="si">{</span><span class="n">zlib</span><span class="o">.</span><span class="n">crc32</span><span class="p">(</span><span class="n">value</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">[:</span><span class="mi">6</span><span class="p">]</span> +</span><span id="DataFrame-271"><a href="#DataFrame-271"><span class="linenos">271</span></a> +</span><span id="DataFrame-272"><a href="#DataFrame-272"><span class="linenos">272</span></a> <span class="k">def</span> <span class="nf">_get_select_expressions</span><span class="p">(</span> +</span><span id="DataFrame-273"><a href="#DataFrame-273"><span class="linenos">273</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-274"><a href="#DataFrame-274"><span class="linenos">274</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">],</span> <span class="n">OutputExpressionContainer</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">]]:</span> +</span><span id="DataFrame-275"><a href="#DataFrame-275"><span class="linenos">275</span></a> <span class="n">select_expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span> +</span><span id="DataFrame-276"><a href="#DataFrame-276"><span class="linenos">276</span></a> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">],</span> <span class="n">OutputExpressionContainer</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">]</span> +</span><span id="DataFrame-277"><a href="#DataFrame-277"><span class="linenos">277</span></a> <span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame-278"><a href="#DataFrame-278"><span class="linenos">278</span></a> <span class="n">main_select_ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame-279"><a href="#DataFrame-279"><span class="linenos">279</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">:</span> +</span><span id="DataFrame-280"><a href="#DataFrame-280"><span class="linenos">280</span></a> <span class="n">cache_storage_level</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cache_storage_level"</span><span class="p">)</span> +</span><span id="DataFrame-281"><a href="#DataFrame-281"><span class="linenos">281</span></a> <span class="k">if</span> <span class="n">cache_storage_level</span><span class="p">:</span> +</span><span id="DataFrame-282"><a href="#DataFrame-282"><span class="linenos">282</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-283"><a href="#DataFrame-283"><span class="linenos">283</span></a> <span class="n">select_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">copy</span><span class="p">(</span><span class="n">main_select_ctes</span><span class="p">)))</span> +</span><span id="DataFrame-284"><a href="#DataFrame-284"><span class="linenos">284</span></a> <span class="n">select_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"cte_alias_name"</span><span class="p">,</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> +</span><span id="DataFrame-285"><a href="#DataFrame-285"><span class="linenos">285</span></a> <span class="n">select_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"cache_storage_level"</span><span class="p">,</span> <span class="n">cache_storage_level</span><span class="p">)</span> +</span><span id="DataFrame-286"><a href="#DataFrame-286"><span class="linenos">286</span></a> <span class="n">select_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> <span class="n">select_expression</span><span class="p">))</span> +</span><span id="DataFrame-287"><a href="#DataFrame-287"><span class="linenos">287</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-288"><a href="#DataFrame-288"><span class="linenos">288</span></a> <span class="n">main_select_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cte</span><span class="p">)</span> +</span><span id="DataFrame-289"><a href="#DataFrame-289"><span class="linenos">289</span></a> <span class="n">main_select</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-290"><a href="#DataFrame-290"><span class="linenos">290</span></a> <span class="k">if</span> <span class="n">main_select_ctes</span><span class="p">:</span> +</span><span id="DataFrame-291"><a href="#DataFrame-291"><span class="linenos">291</span></a> <span class="n">main_select</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">main_select_ctes</span><span class="p">))</span> +</span><span id="DataFrame-292"><a href="#DataFrame-292"><span class="linenos">292</span></a> <span class="n">expression_select_pair</span> <span class="o">=</span> <span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_expression_container</span><span class="p">),</span> <span class="n">main_select</span><span class="p">)</span> +</span><span id="DataFrame-293"><a href="#DataFrame-293"><span class="linenos">293</span></a> <span class="n">select_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">expression_select_pair</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="DataFrame-294"><a href="#DataFrame-294"><span class="linenos">294</span></a> <span class="k">return</span> <span class="n">select_expressions</span> +</span><span id="DataFrame-295"><a href="#DataFrame-295"><span class="linenos">295</span></a> +</span><span id="DataFrame-296"><a href="#DataFrame-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">,</span> <span class="n">optimize</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="DataFrame-297"><a href="#DataFrame-297"><span class="linenos">297</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_resolve_pending_hints</span><span class="p">()</span> +</span><span id="DataFrame-298"><a href="#DataFrame-298"><span class="linenos">298</span></a> <span class="n">select_expressions</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_get_select_expressions</span><span class="p">()</span> +</span><span id="DataFrame-299"><a href="#DataFrame-299"><span class="linenos">299</span></a> <span class="n">output_expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame-300"><a href="#DataFrame-300"><span class="linenos">300</span></a> <span class="n">replacement_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="DataFrame-301"><a href="#DataFrame-301"><span class="linenos">301</span></a> <span class="k">for</span> <span class="n">expression_type</span><span class="p">,</span> <span class="n">select_expression</span> <span class="ow">in</span> <span class="n">select_expressions</span><span class="p">:</span> +</span><span id="DataFrame-302"><a href="#DataFrame-302"><span class="linenos">302</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">replace_id_value</span><span class="p">,</span> <span class="n">replacement_mapping</span><span class="p">)</span> +</span><span id="DataFrame-303"><a href="#DataFrame-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="n">optimize</span><span class="p">:</span> +</span><span id="DataFrame-304"><a href="#DataFrame-304"><span class="linenos">304</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">optimize_func</span><span class="p">(</span><span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame-305"><a href="#DataFrame-305"><span class="linenos">305</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_replace_cte_names_with_hashes</span><span class="p">(</span><span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame-306"><a href="#DataFrame-306"><span class="linenos">306</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">]</span> +</span><span id="DataFrame-307"><a href="#DataFrame-307"><span class="linenos">307</span></a> <span class="k">if</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">:</span> +</span><span id="DataFrame-308"><a href="#DataFrame-308"><span class="linenos">308</span></a> <span class="n">cache_table_name</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_create_hash_from_expression</span><span class="p">(</span><span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame-309"><a href="#DataFrame-309"><span class="linenos">309</span></a> <span class="n">cache_table</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">cache_table_name</span><span class="p">)</span> +</span><span id="DataFrame-310"><a href="#DataFrame-310"><span class="linenos">310</span></a> <span class="n">original_alias_name</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"cte_alias_name"</span><span class="p">]</span> +</span><span id="DataFrame-311"><a href="#DataFrame-311"><span class="linenos">311</span></a> +</span><span id="DataFrame-312"><a href="#DataFrame-312"><span class="linenos">312</span></a> <span class="n">replacement_mapping</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">original_alias_name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="DataFrame-313"><a href="#DataFrame-313"><span class="linenos">313</span></a> <span class="n">cache_table_name</span> +</span><span id="DataFrame-314"><a href="#DataFrame-314"><span class="linenos">314</span></a> <span class="p">)</span> +</span><span id="DataFrame-315"><a href="#DataFrame-315"><span class="linenos">315</span></a> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span> +</span><span id="DataFrame-316"><a href="#DataFrame-316"><span class="linenos">316</span></a> <span class="n">cache_table_name</span><span class="p">,</span> +</span><span id="DataFrame-317"><a href="#DataFrame-317"><span class="linenos">317</span></a> <span class="p">{</span> +</span><span id="DataFrame-318"><a href="#DataFrame-318"><span class="linenos">318</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="s2">"spark"</span><span class="p">)</span> +</span><span id="DataFrame-319"><a href="#DataFrame-319"><span class="linenos">319</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="DataFrame-320"><a href="#DataFrame-320"><span class="linenos">320</span></a> <span class="p">},</span> +</span><span id="DataFrame-321"><a href="#DataFrame-321"><span class="linenos">321</span></a> <span class="p">)</span> +</span><span id="DataFrame-322"><a href="#DataFrame-322"><span class="linenos">322</span></a> <span class="n">cache_storage_level</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"cache_storage_level"</span><span class="p">]</span> +</span><span id="DataFrame-323"><a href="#DataFrame-323"><span class="linenos">323</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-324"><a href="#DataFrame-324"><span class="linenos">324</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"storageLevel"</span><span class="p">),</span> +</span><span id="DataFrame-325"><a href="#DataFrame-325"><span class="linenos">325</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">cache_storage_level</span><span class="p">),</span> +</span><span id="DataFrame-326"><a href="#DataFrame-326"><span class="linenos">326</span></a> <span class="p">]</span> +</span><span id="DataFrame-327"><a href="#DataFrame-327"><span class="linenos">327</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">(</span> +</span><span id="DataFrame-328"><a href="#DataFrame-328"><span class="linenos">328</span></a> <span class="n">this</span><span class="o">=</span><span class="n">cache_table</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">select_expression</span><span class="p">,</span> <span class="n">lazy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="n">options</span> +</span><span id="DataFrame-329"><a href="#DataFrame-329"><span class="linenos">329</span></a> <span class="p">)</span> +</span><span id="DataFrame-330"><a href="#DataFrame-330"><span class="linenos">330</span></a> <span class="c1"># We will drop the "view" if it exists before running the cache table</span> +</span><span id="DataFrame-331"><a href="#DataFrame-331"><span class="linenos">331</span></a> <span class="n">output_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">cache_table</span><span class="p">,</span> <span class="n">exists</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"VIEW"</span><span class="p">))</span> +</span><span id="DataFrame-332"><a href="#DataFrame-332"><span class="linenos">332</span></a> <span class="k">elif</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> +</span><span id="DataFrame-333"><a href="#DataFrame-333"><span class="linenos">333</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">output_expression_container</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-334"><a href="#DataFrame-334"><span class="linenos">334</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">,</span> <span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame-335"><a href="#DataFrame-335"><span class="linenos">335</span></a> <span class="k">elif</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">:</span> +</span><span id="DataFrame-336"><a href="#DataFrame-336"><span class="linenos">336</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">output_expression_container</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-337"><a href="#DataFrame-337"><span class="linenos">337</span></a> <span class="n">select_without_ctes</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-338"><a href="#DataFrame-338"><span class="linenos">338</span></a> <span class="n">select_without_ctes</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame-339"><a href="#DataFrame-339"><span class="linenos">339</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">,</span> <span class="n">select_without_ctes</span><span class="p">)</span> +</span><span id="DataFrame-340"><a href="#DataFrame-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">:</span> +</span><span id="DataFrame-341"><a href="#DataFrame-341"><span class="linenos">341</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">select_expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">))</span> +</span><span id="DataFrame-342"><a href="#DataFrame-342"><span class="linenos">342</span></a> <span class="k">elif</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> +</span><span id="DataFrame-343"><a href="#DataFrame-343"><span class="linenos">343</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">select_expression</span> +</span><span id="DataFrame-344"><a href="#DataFrame-344"><span class="linenos">344</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-345"><a href="#DataFrame-345"><span class="linenos">345</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid expression type: </span><span class="si">{</span><span class="n">expression_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="DataFrame-346"><a href="#DataFrame-346"><span class="linenos">346</span></a> <span class="n">output_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-347"><a href="#DataFrame-347"><span class="linenos">347</span></a> +</span><span id="DataFrame-348"><a href="#DataFrame-348"><span class="linenos">348</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="DataFrame-349"><a href="#DataFrame-349"><span class="linenos">349</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">output_expressions</span> +</span><span id="DataFrame-350"><a href="#DataFrame-350"><span class="linenos">350</span></a> <span class="p">]</span> +</span><span id="DataFrame-351"><a href="#DataFrame-351"><span class="linenos">351</span></a> +</span><span id="DataFrame-352"><a href="#DataFrame-352"><span class="linenos">352</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-353"><a href="#DataFrame-353"><span class="linenos">353</span></a> <span class="k">return</span> <span class="n">DataFrame</span><span class="p">(</span><span class="o">**</span><span class="n">object_to_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span><span id="DataFrame-354"><a href="#DataFrame-354"><span class="linenos">354</span></a> +</span><span id="DataFrame-355"><a href="#DataFrame-355"><span class="linenos">355</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-356"><a href="#DataFrame-356"><span class="linenos">356</span></a> <span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-357"><a href="#DataFrame-357"><span class="linenos">357</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-358"><a href="#DataFrame-358"><span class="linenos">358</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"append"</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"append"</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame-359"><a href="#DataFrame-359"><span class="linenos">359</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">):</span> +</span><span id="DataFrame-360"><a href="#DataFrame-360"><span class="linenos">360</span></a> <span class="n">ambiguous_cols</span> <span class="o">=</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">cols</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">col</span><span class="o">.</span><span class="n">column_expression</span><span class="o">.</span><span class="n">table</span><span class="p">]</span> +</span><span id="DataFrame-361"><a href="#DataFrame-361"><span class="linenos">361</span></a> <span class="k">if</span> <span class="n">ambiguous_cols</span><span class="p">:</span> +</span><span id="DataFrame-362"><a href="#DataFrame-362"><span class="linenos">362</span></a> <span class="n">join_table_identifiers</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-363"><a href="#DataFrame-363"><span class="linenos">363</span></a> <span class="n">x</span><span class="o">.</span><span class="n">this</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">get_tables_from_expression_with_join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-364"><a href="#DataFrame-364"><span class="linenos">364</span></a> <span class="p">]</span> +</span><span id="DataFrame-365"><a href="#DataFrame-365"><span class="linenos">365</span></a> <span class="n">cte_names_in_join</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">this</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">join_table_identifiers</span><span class="p">]</span> +</span><span id="DataFrame-366"><a href="#DataFrame-366"><span class="linenos">366</span></a> <span class="k">for</span> <span class="n">ambiguous_col</span> <span class="ow">in</span> <span class="n">ambiguous_cols</span><span class="p">:</span> +</span><span id="DataFrame-367"><a href="#DataFrame-367"><span class="linenos">367</span></a> <span class="n">ctes_with_column</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-368"><a href="#DataFrame-368"><span class="linenos">368</span></a> <span class="n">cte</span> +</span><span id="DataFrame-369"><a href="#DataFrame-369"><span class="linenos">369</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span> +</span><span id="DataFrame-370"><a href="#DataFrame-370"><span class="linenos">370</span></a> <span class="k">if</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">cte_names_in_join</span> +</span><span id="DataFrame-371"><a href="#DataFrame-371"><span class="linenos">371</span></a> <span class="ow">and</span> <span class="n">ambiguous_col</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="DataFrame-372"><a href="#DataFrame-372"><span class="linenos">372</span></a> <span class="p">]</span> +</span><span id="DataFrame-373"><a href="#DataFrame-373"><span class="linenos">373</span></a> <span class="c1"># If the select column does not specify a table and there is a join</span> +</span><span id="DataFrame-374"><a href="#DataFrame-374"><span class="linenos">374</span></a> <span class="c1"># then we assume they are referring to the left table</span> +</span><span id="DataFrame-375"><a href="#DataFrame-375"><span class="linenos">375</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">ctes_with_column</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="DataFrame-376"><a href="#DataFrame-376"><span class="linenos">376</span></a> <span class="n">table_identifier</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"from"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expressions"</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> +</span><span id="DataFrame-377"><a href="#DataFrame-377"><span class="linenos">377</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-378"><a href="#DataFrame-378"><span class="linenos">378</span></a> <span class="n">table_identifier</span> <span class="o">=</span> <span class="n">ctes_with_column</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> +</span><span id="DataFrame-379"><a href="#DataFrame-379"><span class="linenos">379</span></a> <span class="n">ambiguous_col</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">table_identifier</span><span class="p">)</span> +</span><span id="DataFrame-380"><a href="#DataFrame-380"><span class="linenos">380</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="DataFrame-381"><a href="#DataFrame-381"><span class="linenos">381</span></a> <span class="n">qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="p">)</span> +</span><span id="DataFrame-382"><a href="#DataFrame-382"><span class="linenos">382</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="DataFrame-383"><a href="#DataFrame-383"><span class="linenos">383</span></a> +</span><span id="DataFrame-384"><a href="#DataFrame-384"><span class="linenos">384</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame-385"><a href="#DataFrame-385"><span class="linenos">385</span></a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-386"><a href="#DataFrame-386"><span class="linenos">386</span></a> <span class="n">new_sequence_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_sequence_id</span> +</span><span id="DataFrame-387"><a href="#DataFrame-387"><span class="linenos">387</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-388"><a href="#DataFrame-388"><span class="linenos">388</span></a> <span class="k">for</span> <span class="n">join_hint</span> <span class="ow">in</span> <span class="n">df</span><span class="o">.</span><span class="n">pending_join_hints</span><span class="p">:</span> +</span><span id="DataFrame-389"><a href="#DataFrame-389"><span class="linenos">389</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">join_hint</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="DataFrame-390"><a href="#DataFrame-390"><span class="linenos">390</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span><span class="p">:</span> +</span><span id="DataFrame-391"><a href="#DataFrame-391"><span class="linenos">391</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">new_sequence_id</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-392"><a href="#DataFrame-392"><span class="linenos">392</span></a> <span class="n">df</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_add_alias_to_mapping</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">new_sequence_id</span><span class="p">)</span> +</span><span id="DataFrame-393"><a href="#DataFrame-393"><span class="linenos">393</span></a> <span class="k">return</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">(</span><span class="n">sequence_id</span><span class="o">=</span><span class="n">new_sequence_id</span><span class="p">)</span> +</span><span id="DataFrame-394"><a href="#DataFrame-394"><span class="linenos">394</span></a> +</span><span id="DataFrame-395"><a href="#DataFrame-395"><span class="linenos">395</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">WHERE</span><span class="p">)</span> +</span><span id="DataFrame-396"><a href="#DataFrame-396"><span class="linenos">396</span></a> <span class="k">def</span> <span class="nf">where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">Column</span><span class="p">,</span> <span class="nb">bool</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-397"><a href="#DataFrame-397"><span class="linenos">397</span></a> <span class="n">col</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_col</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="DataFrame-398"><a href="#DataFrame-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">))</span> +</span><span id="DataFrame-399"><a href="#DataFrame-399"><span class="linenos">399</span></a> +</span><span id="DataFrame-400"><a href="#DataFrame-400"><span class="linenos">400</span></a> <span class="nb">filter</span> <span class="o">=</span> <span class="n">where</span> +</span><span id="DataFrame-401"><a href="#DataFrame-401"><span class="linenos">401</span></a> +</span><span id="DataFrame-402"><a href="#DataFrame-402"><span class="linenos">402</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">GROUP_BY</span><span class="p">)</span> +</span><span id="DataFrame-403"><a href="#DataFrame-403"><span class="linenos">403</span></a> <span class="k">def</span> <span class="nf">groupBy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">GroupedData</span><span class="p">:</span> +</span><span id="DataFrame-404"><a href="#DataFrame-404"><span class="linenos">404</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-405"><a href="#DataFrame-405"><span class="linenos">405</span></a> <span class="k">return</span> <span class="n">GroupedData</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_op</span><span class="p">)</span> +</span><span id="DataFrame-406"><a href="#DataFrame-406"><span class="linenos">406</span></a> +</span><span id="DataFrame-407"><a href="#DataFrame-407"><span class="linenos">407</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-408"><a href="#DataFrame-408"><span class="linenos">408</span></a> <span class="k">def</span> <span class="nf">agg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">exprs</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-409"><a href="#DataFrame-409"><span class="linenos">409</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">exprs</span><span class="p">)</span> +</span><span id="DataFrame-410"><a href="#DataFrame-410"><span class="linenos">410</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">groupBy</span><span class="p">()</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-411"><a href="#DataFrame-411"><span class="linenos">411</span></a> +</span><span id="DataFrame-412"><a href="#DataFrame-412"><span class="linenos">412</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-413"><a href="#DataFrame-413"><span class="linenos">413</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span> +</span><span id="DataFrame-414"><a href="#DataFrame-414"><span class="linenos">414</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-415"><a href="#DataFrame-415"><span class="linenos">415</span></a> <span class="n">other_df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> +</span><span id="DataFrame-416"><a href="#DataFrame-416"><span class="linenos">416</span></a> <span class="n">on</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">Column</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]],</span> +</span><span id="DataFrame-417"><a href="#DataFrame-417"><span class="linenos">417</span></a> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"inner"</span><span class="p">,</span> +</span><span id="DataFrame-418"><a href="#DataFrame-418"><span class="linenos">418</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="DataFrame-419"><a href="#DataFrame-419"><span class="linenos">419</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-420"><a href="#DataFrame-420"><span class="linenos">420</span></a> <span class="n">other_df</span> <span class="o">=</span> <span class="n">other_df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="DataFrame-421"><a href="#DataFrame-421"><span class="linenos">421</span></a> <span class="n">pre_join_self_latest_cte_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">latest_cte_name</span> +</span><span id="DataFrame-422"><a href="#DataFrame-422"><span class="linenos">422</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">on</span><span class="p">)</span> +</span><span id="DataFrame-423"><a href="#DataFrame-423"><span class="linenos">423</span></a> <span class="n">join_type</span> <span class="o">=</span> <span class="n">how</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"_"</span><span class="p">,</span> <span class="s2">" "</span><span class="p">)</span> +</span><span id="DataFrame-424"><a href="#DataFrame-424"><span class="linenos">424</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="DataFrame-425"><a href="#DataFrame-425"><span class="linenos">425</span></a> <span class="n">join_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-426"><a href="#DataFrame-426"><span class="linenos">426</span></a> <span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="DataFrame-427"><a href="#DataFrame-427"><span class="linenos">427</span></a> <span class="p">]</span> +</span><span id="DataFrame-428"><a href="#DataFrame-428"><span class="linenos">428</span></a> <span class="n">join_clause</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span> +</span><span id="DataFrame-429"><a href="#DataFrame-429"><span class="linenos">429</span></a> <span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span> <span class="o">&</span> <span class="n">y</span><span class="p">,</span> +</span><span id="DataFrame-430"><a href="#DataFrame-430"><span class="linenos">430</span></a> <span class="p">[</span> +</span><span id="DataFrame-431"><a href="#DataFrame-431"><span class="linenos">431</span></a> <span class="n">col</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame-432"><a href="#DataFrame-432"><span class="linenos">432</span></a> <span class="o">==</span> <span class="n">col</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame-433"><a href="#DataFrame-433"><span class="linenos">433</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="DataFrame-434"><a href="#DataFrame-434"><span class="linenos">434</span></a> <span class="p">],</span> +</span><span id="DataFrame-435"><a href="#DataFrame-435"><span class="linenos">435</span></a> <span class="p">)</span> +</span><span id="DataFrame-436"><a href="#DataFrame-436"><span class="linenos">436</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-437"><a href="#DataFrame-437"><span class="linenos">437</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="DataFrame-438"><a href="#DataFrame-438"><span class="linenos">438</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span> <span class="o">&</span> <span class="n">y</span><span class="p">,</span> <span class="n">columns</span><span class="p">)]</span> +</span><span id="DataFrame-439"><a href="#DataFrame-439"><span class="linenos">439</span></a> <span class="n">join_clause</span> <span class="o">=</span> <span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="DataFrame-440"><a href="#DataFrame-440"><span class="linenos">440</span></a> <span class="n">join_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-441"><a href="#DataFrame-441"><span class="linenos">441</span></a> <span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame-442"><a href="#DataFrame-442"><span class="linenos">442</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">0</span> +</span><span id="DataFrame-443"><a href="#DataFrame-443"><span class="linenos">443</span></a> <span class="k">else</span> <span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame-444"><a href="#DataFrame-444"><span class="linenos">444</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">join_clause</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> +</span><span id="DataFrame-445"><a href="#DataFrame-445"><span class="linenos">445</span></a> <span class="p">]</span> +</span><span id="DataFrame-446"><a href="#DataFrame-446"><span class="linenos">446</span></a> <span class="n">self_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-447"><a href="#DataFrame-447"><span class="linenos">447</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame-448"><a href="#DataFrame-448"><span class="linenos">448</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="DataFrame-449"><a href="#DataFrame-449"><span class="linenos">449</span></a> <span class="p">]</span> +</span><span id="DataFrame-450"><a href="#DataFrame-450"><span class="linenos">450</span></a> <span class="n">other_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-451"><a href="#DataFrame-451"><span class="linenos">451</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame-452"><a href="#DataFrame-452"><span class="linenos">452</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">other_df</span><span class="p">)</span> +</span><span id="DataFrame-453"><a href="#DataFrame-453"><span class="linenos">453</span></a> <span class="p">]</span> +</span><span id="DataFrame-454"><a href="#DataFrame-454"><span class="linenos">454</span></a> <span class="n">column_value_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataFrame-455"><a href="#DataFrame-455"><span class="linenos">455</span></a> <span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame-456"><a href="#DataFrame-456"><span class="linenos">456</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">)</span> +</span><span id="DataFrame-457"><a href="#DataFrame-457"><span class="linenos">457</span></a> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">sql</span><span class="p">():</span> <span class="n">column</span> +</span><span id="DataFrame-458"><a href="#DataFrame-458"><span class="linenos">458</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">other_columns</span> <span class="o">+</span> <span class="n">self_columns</span> <span class="o">+</span> <span class="n">join_columns</span> +</span><span id="DataFrame-459"><a href="#DataFrame-459"><span class="linenos">459</span></a> <span class="p">}</span> +</span><span id="DataFrame-460"><a href="#DataFrame-460"><span class="linenos">460</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-461"><a href="#DataFrame-461"><span class="linenos">461</span></a> <span class="n">column_value_mapping</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="DataFrame-462"><a href="#DataFrame-462"><span class="linenos">462</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">{</span><span class="n">x</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">join_columns</span> <span class="o">+</span> <span class="n">self_columns</span> <span class="o">+</span> <span class="n">other_columns</span><span class="p">}</span> +</span><span id="DataFrame-463"><a href="#DataFrame-463"><span class="linenos">463</span></a> <span class="p">]</span> +</span><span id="DataFrame-464"><a href="#DataFrame-464"><span class="linenos">464</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span> +</span><span id="DataFrame-465"><a href="#DataFrame-465"><span class="linenos">465</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="DataFrame-466"><a href="#DataFrame-466"><span class="linenos">466</span></a> <span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">,</span> <span class="n">on</span><span class="o">=</span><span class="n">join_clause</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">join_type</span><span class="o">=</span><span class="n">join_type</span> +</span><span id="DataFrame-467"><a href="#DataFrame-467"><span class="linenos">467</span></a> <span class="p">)</span> +</span><span id="DataFrame-468"><a href="#DataFrame-468"><span class="linenos">468</span></a> <span class="p">)</span> +</span><span id="DataFrame-469"><a href="#DataFrame-469"><span class="linenos">469</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">_add_ctes_to_expression</span><span class="p">(</span> +</span><span id="DataFrame-470"><a href="#DataFrame-470"><span class="linenos">470</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">other_df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span> +</span><span id="DataFrame-471"><a href="#DataFrame-471"><span class="linenos">471</span></a> <span class="p">)</span> +</span><span id="DataFrame-472"><a href="#DataFrame-472"><span class="linenos">472</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">pending_hints</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">pending_hints</span><span class="p">)</span> +</span><span id="DataFrame-473"><a href="#DataFrame-473"><span class="linenos">473</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="o">.</span><span class="n">__wrapped__</span><span class="p">(</span><span class="n">new_df</span><span class="p">,</span> <span class="o">*</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="DataFrame-474"><a href="#DataFrame-474"><span class="linenos">474</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span><span id="DataFrame-475"><a href="#DataFrame-475"><span class="linenos">475</span></a> +</span><span id="DataFrame-476"><a href="#DataFrame-476"><span class="linenos">476</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">)</span> +</span><span id="DataFrame-477"><a href="#DataFrame-477"><span class="linenos">477</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span> +</span><span id="DataFrame-478"><a href="#DataFrame-478"><span class="linenos">478</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-479"><a href="#DataFrame-479"><span class="linenos">479</span></a> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">],</span> +</span><span id="DataFrame-480"><a href="#DataFrame-480"><span class="linenos">480</span></a> <span class="n">ascending</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-481"><a href="#DataFrame-481"><span class="linenos">481</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-482"><a href="#DataFrame-482"><span class="linenos">482</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame-483"><a href="#DataFrame-483"><span class="linenos">483</span></a><span class="sd"> This implementation lets any ordered columns take priority over whatever is provided in `ascending`. Spark</span> +</span><span id="DataFrame-484"><a href="#DataFrame-484"><span class="linenos">484</span></a><span class="sd"> has irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this</span> +</span><span id="DataFrame-485"><a href="#DataFrame-485"><span class="linenos">485</span></a><span class="sd"> is unlikely to come up.</span> +</span><span id="DataFrame-486"><a href="#DataFrame-486"><span class="linenos">486</span></a><span class="sd"> """</span> +</span><span id="DataFrame-487"><a href="#DataFrame-487"><span class="linenos">487</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-488"><a href="#DataFrame-488"><span class="linenos">488</span></a> <span class="n">pre_ordered_col_indexes</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-489"><a href="#DataFrame-489"><span class="linenos">489</span></a> <span class="n">x</span> +</span><span id="DataFrame-490"><a href="#DataFrame-490"><span class="linenos">490</span></a> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="DataFrame-491"><a href="#DataFrame-491"><span class="linenos">491</span></a> <span class="n">i</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="DataFrame-492"><a href="#DataFrame-492"><span class="linenos">492</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">col</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame-493"><a href="#DataFrame-493"><span class="linenos">493</span></a> <span class="p">]</span> +</span><span id="DataFrame-494"><a href="#DataFrame-494"><span class="linenos">494</span></a> <span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="DataFrame-495"><a href="#DataFrame-495"><span class="linenos">495</span></a> <span class="p">]</span> +</span><span id="DataFrame-496"><a href="#DataFrame-496"><span class="linenos">496</span></a> <span class="k">if</span> <span class="n">ascending</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrame-497"><a href="#DataFrame-497"><span class="linenos">497</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="kc">True</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame-498"><a href="#DataFrame-498"><span class="linenos">498</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ascending</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="DataFrame-499"><a href="#DataFrame-499"><span class="linenos">499</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="n">ascending</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame-500"><a href="#DataFrame-500"><span class="linenos">500</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="nb">bool</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">ascending</span><span class="p">)]</span> +</span><span id="DataFrame-501"><a href="#DataFrame-501"><span class="linenos">501</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span> +</span><span id="DataFrame-502"><a href="#DataFrame-502"><span class="linenos">502</span></a> <span class="n">ascending</span> +</span><span id="DataFrame-503"><a href="#DataFrame-503"><span class="linenos">503</span></a> <span class="p">),</span> <span class="s2">"The length of items in ascending must equal the number of columns provided"</span> +</span><span id="DataFrame-504"><a href="#DataFrame-504"><span class="linenos">504</span></a> <span class="n">col_and_ascending</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="n">ascending</span><span class="p">))</span> +</span><span id="DataFrame-505"><a href="#DataFrame-505"><span class="linenos">505</span></a> <span class="n">order_by_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-506"><a href="#DataFrame-506"><span class="linenos">506</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="ow">not</span> <span class="n">asc</span><span class="p">)</span> +</span><span id="DataFrame-507"><a href="#DataFrame-507"><span class="linenos">507</span></a> <span class="k">if</span> <span class="n">i</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">pre_ordered_col_indexes</span> +</span><span id="DataFrame-508"><a href="#DataFrame-508"><span class="linenos">508</span></a> <span class="k">else</span> <span class="n">columns</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">column_expression</span> +</span><span id="DataFrame-509"><a href="#DataFrame-509"><span class="linenos">509</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">asc</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">col_and_ascending</span><span class="p">)</span> +</span><span id="DataFrame-510"><a href="#DataFrame-510"><span class="linenos">510</span></a> <span class="p">]</span> +</span><span id="DataFrame-511"><a href="#DataFrame-511"><span class="linenos">511</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="o">*</span><span class="n">order_by_columns</span><span class="p">))</span> +</span><span id="DataFrame-512"><a href="#DataFrame-512"><span class="linenos">512</span></a> +</span><span id="DataFrame-513"><a href="#DataFrame-513"><span class="linenos">513</span></a> <span class="n">sort</span> <span class="o">=</span> <span class="n">orderBy</span> +</span><span id="DataFrame-514"><a href="#DataFrame-514"><span class="linenos">514</span></a> +</span><span id="DataFrame-515"><a href="#DataFrame-515"><span class="linenos">515</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-516"><a href="#DataFrame-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-517"><a href="#DataFrame-517"><span class="linenos">517</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame-518"><a href="#DataFrame-518"><span class="linenos">518</span></a> +</span><span id="DataFrame-519"><a href="#DataFrame-519"><span class="linenos">519</span></a> <span class="n">unionAll</span> <span class="o">=</span> <span class="n">union</span> +</span><span id="DataFrame-520"><a href="#DataFrame-520"><span class="linenos">520</span></a> +</span><span id="DataFrame-521"><a href="#DataFrame-521"><span class="linenos">521</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-522"><a href="#DataFrame-522"><span class="linenos">522</span></a> <span class="k">def</span> <span class="nf">unionByName</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> <span class="n">allowMissingColumns</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="DataFrame-523"><a href="#DataFrame-523"><span class="linenos">523</span></a> <span class="n">l_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> +</span><span id="DataFrame-524"><a href="#DataFrame-524"><span class="linenos">524</span></a> <span class="n">r_columns</span> <span class="o">=</span> <span class="n">other</span><span class="o">.</span><span class="n">columns</span> +</span><span id="DataFrame-525"><a href="#DataFrame-525"><span class="linenos">525</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">allowMissingColumns</span><span class="p">:</span> +</span><span id="DataFrame-526"><a href="#DataFrame-526"><span class="linenos">526</span></a> <span class="n">l_expressions</span> <span class="o">=</span> <span class="n">l_columns</span> +</span><span id="DataFrame-527"><a href="#DataFrame-527"><span class="linenos">527</span></a> <span class="n">r_expressions</span> <span class="o">=</span> <span class="n">l_columns</span> +</span><span id="DataFrame-528"><a href="#DataFrame-528"><span class="linenos">528</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-529"><a href="#DataFrame-529"><span class="linenos">529</span></a> <span class="n">l_expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame-530"><a href="#DataFrame-530"><span class="linenos">530</span></a> <span class="n">r_expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame-531"><a href="#DataFrame-531"><span class="linenos">531</span></a> <span class="n">r_columns_unused</span> <span class="o">=</span> <span class="n">copy</span><span class="p">(</span><span class="n">r_columns</span><span class="p">)</span> +</span><span id="DataFrame-532"><a href="#DataFrame-532"><span class="linenos">532</span></a> <span class="k">for</span> <span class="n">l_column</span> <span class="ow">in</span> <span class="n">l_columns</span><span class="p">:</span> +</span><span id="DataFrame-533"><a href="#DataFrame-533"><span class="linenos">533</span></a> <span class="n">l_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">l_column</span><span class="p">)</span> +</span><span id="DataFrame-534"><a href="#DataFrame-534"><span class="linenos">534</span></a> <span class="k">if</span> <span class="n">l_column</span> <span class="ow">in</span> <span class="n">r_columns</span><span class="p">:</span> +</span><span id="DataFrame-535"><a href="#DataFrame-535"><span class="linenos">535</span></a> <span class="n">r_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">l_column</span><span class="p">)</span> +</span><span id="DataFrame-536"><a href="#DataFrame-536"><span class="linenos">536</span></a> <span class="n">r_columns_unused</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">l_column</span><span class="p">)</span> +</span><span id="DataFrame-537"><a href="#DataFrame-537"><span class="linenos">537</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-538"><a href="#DataFrame-538"><span class="linenos">538</span></a> <span class="n">r_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">(),</span> <span class="n">l_column</span><span class="p">))</span> +</span><span id="DataFrame-539"><a href="#DataFrame-539"><span class="linenos">539</span></a> <span class="k">for</span> <span class="n">r_column</span> <span class="ow">in</span> <span class="n">r_columns_unused</span><span class="p">:</span> +</span><span id="DataFrame-540"><a href="#DataFrame-540"><span class="linenos">540</span></a> <span class="n">l_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">(),</span> <span class="n">r_column</span><span class="p">))</span> +</span><span id="DataFrame-541"><a href="#DataFrame-541"><span class="linenos">541</span></a> <span class="n">r_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">r_column</span><span class="p">)</span> +</span><span id="DataFrame-542"><a href="#DataFrame-542"><span class="linenos">542</span></a> <span class="n">r_df</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame-543"><a href="#DataFrame-543"><span class="linenos">543</span></a> <span class="n">other</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">r_expressions</span><span class="p">))</span> +</span><span id="DataFrame-544"><a href="#DataFrame-544"><span class="linenos">544</span></a> <span class="p">)</span> +</span><span id="DataFrame-545"><a href="#DataFrame-545"><span class="linenos">545</span></a> <span class="n">l_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-546"><a href="#DataFrame-546"><span class="linenos">546</span></a> <span class="k">if</span> <span class="n">allowMissingColumns</span><span class="p">:</span> +</span><span id="DataFrame-547"><a href="#DataFrame-547"><span class="linenos">547</span></a> <span class="n">l_df</span> <span class="o">=</span> <span class="n">l_df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">l_expressions</span><span class="p">))</span> +</span><span id="DataFrame-548"><a href="#DataFrame-548"><span class="linenos">548</span></a> <span class="k">return</span> <span class="n">l_df</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">r_df</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame-549"><a href="#DataFrame-549"><span class="linenos">549</span></a> +</span><span id="DataFrame-550"><a href="#DataFrame-550"><span class="linenos">550</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-551"><a href="#DataFrame-551"><span class="linenos">551</span></a> <span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-552"><a href="#DataFrame-552"><span class="linenos">552</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame-553"><a href="#DataFrame-553"><span class="linenos">553</span></a> +</span><span id="DataFrame-554"><a href="#DataFrame-554"><span class="linenos">554</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-555"><a href="#DataFrame-555"><span class="linenos">555</span></a> <span class="k">def</span> <span class="nf">intersectAll</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-556"><a href="#DataFrame-556"><span class="linenos">556</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame-557"><a href="#DataFrame-557"><span class="linenos">557</span></a> +</span><span id="DataFrame-558"><a href="#DataFrame-558"><span class="linenos">558</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-559"><a href="#DataFrame-559"><span class="linenos">559</span></a> <span class="k">def</span> <span class="nf">exceptAll</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-560"><a href="#DataFrame-560"><span class="linenos">560</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame-561"><a href="#DataFrame-561"><span class="linenos">561</span></a> +</span><span id="DataFrame-562"><a href="#DataFrame-562"><span class="linenos">562</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-563"><a href="#DataFrame-563"><span class="linenos">563</span></a> <span class="k">def</span> <span class="nf">distinct</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-564"><a href="#DataFrame-564"><span class="linenos">564</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">distinct</span><span class="p">())</span> +</span><span id="DataFrame-565"><a href="#DataFrame-565"><span class="linenos">565</span></a> +</span><span id="DataFrame-566"><a href="#DataFrame-566"><span class="linenos">566</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-567"><a href="#DataFrame-567"><span class="linenos">567</span></a> <span class="k">def</span> <span class="nf">dropDuplicates</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span> +</span><span id="DataFrame-568"><a href="#DataFrame-568"><span class="linenos">568</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">subset</span><span class="p">:</span> +</span><span id="DataFrame-569"><a href="#DataFrame-569"><span class="linenos">569</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span><span class="p">()</span> +</span><span id="DataFrame-570"><a href="#DataFrame-570"><span class="linenos">570</span></a> <span class="n">column_names</span> <span class="o">=</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> +</span><span id="DataFrame-571"><a href="#DataFrame-571"><span class="linenos">571</span></a> <span class="n">window</span> <span class="o">=</span> <span class="n">Window</span><span class="o">.</span><span class="n">partitionBy</span><span class="p">(</span><span class="o">*</span><span class="n">column_names</span><span class="p">)</span><span class="o">.</span><span class="n">orderBy</span><span class="p">(</span><span class="o">*</span><span class="n">column_names</span><span class="p">)</span> +</span><span id="DataFrame-572"><a href="#DataFrame-572"><span class="linenos">572</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="DataFrame-573"><a href="#DataFrame-573"><span class="linenos">573</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-574"><a href="#DataFrame-574"><span class="linenos">574</span></a> <span class="o">.</span><span class="n">withColumn</span><span class="p">(</span><span class="s2">"row_num"</span><span class="p">,</span> <span class="n">F</span><span class="o">.</span><span class="n">row_number</span><span class="p">()</span><span class="o">.</span><span class="n">over</span><span class="p">(</span><span class="n">window</span><span class="p">))</span> +</span><span id="DataFrame-575"><a href="#DataFrame-575"><span class="linenos">575</span></a> <span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"row_num"</span><span class="p">)</span> <span class="o">==</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span> +</span><span id="DataFrame-576"><a href="#DataFrame-576"><span class="linenos">576</span></a> <span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="s2">"row_num"</span><span class="p">)</span> +</span><span id="DataFrame-577"><a href="#DataFrame-577"><span class="linenos">577</span></a> <span class="p">)</span> +</span><span id="DataFrame-578"><a href="#DataFrame-578"><span class="linenos">578</span></a> +</span><span id="DataFrame-579"><a href="#DataFrame-579"><span class="linenos">579</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-580"><a href="#DataFrame-580"><span class="linenos">580</span></a> <span class="k">def</span> <span class="nf">dropna</span><span class="p">(</span> +</span><span id="DataFrame-581"><a href="#DataFrame-581"><span class="linenos">581</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-582"><a href="#DataFrame-582"><span class="linenos">582</span></a> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="DataFrame-583"><a href="#DataFrame-583"><span class="linenos">583</span></a> <span class="n">thresh</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-584"><a href="#DataFrame-584"><span class="linenos">584</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-585"><a href="#DataFrame-585"><span class="linenos">585</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-586"><a href="#DataFrame-586"><span class="linenos">586</span></a> <span class="n">minimum_non_null</span> <span class="o">=</span> <span class="n">thresh</span> <span class="ow">or</span> <span class="mi">0</span> <span class="c1"># will be determined later if thresh is null</span> +</span><span id="DataFrame-587"><a href="#DataFrame-587"><span class="linenos">587</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-588"><a href="#DataFrame-588"><span class="linenos">588</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-589"><a href="#DataFrame-589"><span class="linenos">589</span></a> <span class="k">if</span> <span class="n">subset</span><span class="p">:</span> +</span><span id="DataFrame-590"><a href="#DataFrame-590"><span class="linenos">590</span></a> <span class="n">null_check_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> +</span><span id="DataFrame-591"><a href="#DataFrame-591"><span class="linenos">591</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-592"><a href="#DataFrame-592"><span class="linenos">592</span></a> <span class="n">null_check_columns</span> <span class="o">=</span> <span class="n">all_columns</span> +</span><span id="DataFrame-593"><a href="#DataFrame-593"><span class="linenos">593</span></a> <span class="k">if</span> <span class="n">thresh</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrame-594"><a href="#DataFrame-594"><span class="linenos">594</span></a> <span class="n">minimum_num_nulls</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">how</span> <span class="o">==</span> <span class="s2">"any"</span> <span class="k">else</span> <span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">)</span> +</span><span id="DataFrame-595"><a href="#DataFrame-595"><span class="linenos">595</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-596"><a href="#DataFrame-596"><span class="linenos">596</span></a> <span class="n">minimum_num_nulls</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">)</span> <span class="o">-</span> <span class="n">minimum_non_null</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="DataFrame-597"><a href="#DataFrame-597"><span class="linenos">597</span></a> <span class="k">if</span> <span class="n">minimum_num_nulls</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">):</span> +</span><span id="DataFrame-598"><a href="#DataFrame-598"><span class="linenos">598</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span> +</span><span id="DataFrame-599"><a href="#DataFrame-599"><span class="linenos">599</span></a> <span class="sa">f</span><span class="s2">"The minimum num nulls for dropna must be less than or equal to the number of columns. "</span> +</span><span id="DataFrame-600"><a href="#DataFrame-600"><span class="linenos">600</span></a> <span class="sa">f</span><span class="s2">"Minimum num nulls: </span><span class="si">{</span><span class="n">minimum_num_nulls</span><span class="si">}</span><span class="s2">, Num Columns: </span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="DataFrame-601"><a href="#DataFrame-601"><span class="linenos">601</span></a> <span class="p">)</span> +</span><span id="DataFrame-602"><a href="#DataFrame-602"><span class="linenos">602</span></a> <span class="n">if_null_checks</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-603"><a href="#DataFrame-603"><span class="linenos">603</span></a> <span class="n">F</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">isNull</span><span class="p">(),</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">null_check_columns</span> +</span><span id="DataFrame-604"><a href="#DataFrame-604"><span class="linenos">604</span></a> <span class="p">]</span> +</span><span id="DataFrame-605"><a href="#DataFrame-605"><span class="linenos">605</span></a> <span class="n">nulls_added_together</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">,</span> <span class="n">if_null_checks</span><span class="p">)</span> +</span><span id="DataFrame-606"><a href="#DataFrame-606"><span class="linenos">606</span></a> <span class="n">num_nulls</span> <span class="o">=</span> <span class="n">nulls_added_together</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_nulls"</span><span class="p">)</span> +</span><span id="DataFrame-607"><a href="#DataFrame-607"><span class="linenos">607</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">num_nulls</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame-608"><a href="#DataFrame-608"><span class="linenos">608</span></a> <span class="n">filtered_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"num_nulls"</span><span class="p">)</span> <span class="o"><</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">minimum_num_nulls</span><span class="p">))</span> +</span><span id="DataFrame-609"><a href="#DataFrame-609"><span class="linenos">609</span></a> <span class="n">final_df</span> <span class="o">=</span> <span class="n">filtered_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="DataFrame-610"><a href="#DataFrame-610"><span class="linenos">610</span></a> <span class="k">return</span> <span class="n">final_df</span> +</span><span id="DataFrame-611"><a href="#DataFrame-611"><span class="linenos">611</span></a> +</span><span id="DataFrame-612"><a href="#DataFrame-612"><span class="linenos">612</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-613"><a href="#DataFrame-613"><span class="linenos">613</span></a> <span class="k">def</span> <span class="nf">fillna</span><span class="p">(</span> +</span><span id="DataFrame-614"><a href="#DataFrame-614"><span class="linenos">614</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-615"><a href="#DataFrame-615"><span class="linenos">615</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnLiterals</span><span class="p">],</span> +</span><span id="DataFrame-616"><a href="#DataFrame-616"><span class="linenos">616</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-617"><a href="#DataFrame-617"><span class="linenos">617</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-618"><a href="#DataFrame-618"><span class="linenos">618</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame-619"><a href="#DataFrame-619"><span class="linenos">619</span></a><span class="sd"> Functionality Difference: If you provide a value to replace a null and that type conflicts</span> +</span><span id="DataFrame-620"><a href="#DataFrame-620"><span class="linenos">620</span></a><span class="sd"> with the type of the column then PySpark will just ignore your replacement.</span> +</span><span id="DataFrame-621"><a href="#DataFrame-621"><span class="linenos">621</span></a><span class="sd"> This will try to cast them to be the same in some cases. So they won't always match.</span> +</span><span id="DataFrame-622"><a href="#DataFrame-622"><span class="linenos">622</span></a><span class="sd"> Best to not mix types so make sure replacement is the same type as the column</span> +</span><span id="DataFrame-623"><a href="#DataFrame-623"><span class="linenos">623</span></a> +</span><span id="DataFrame-624"><a href="#DataFrame-624"><span class="linenos">624</span></a><span class="sd"> Possibility for improvement: Use `typeof` function to get the type of the column</span> +</span><span id="DataFrame-625"><a href="#DataFrame-625"><span class="linenos">625</span></a><span class="sd"> and check if it matches the type of the value provided. If not then make it null.</span> +</span><span id="DataFrame-626"><a href="#DataFrame-626"><span class="linenos">626</span></a><span class="sd"> """</span> +</span><span id="DataFrame-627"><a href="#DataFrame-627"><span class="linenos">627</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="DataFrame-628"><a href="#DataFrame-628"><span class="linenos">628</span></a> +</span><span id="DataFrame-629"><a href="#DataFrame-629"><span class="linenos">629</span></a> <span class="n">values</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="DataFrame-630"><a href="#DataFrame-630"><span class="linenos">630</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="DataFrame-631"><a href="#DataFrame-631"><span class="linenos">631</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-632"><a href="#DataFrame-632"><span class="linenos">632</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-633"><a href="#DataFrame-633"><span class="linenos">633</span></a> <span class="n">all_column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span><span class="p">}</span> +</span><span id="DataFrame-634"><a href="#DataFrame-634"><span class="linenos">634</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="DataFrame-635"><a href="#DataFrame-635"><span class="linenos">635</span></a> <span class="n">values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="DataFrame-636"><a href="#DataFrame-636"><span class="linenos">636</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">value</span><span class="p">))</span> +</span><span id="DataFrame-637"><a href="#DataFrame-637"><span class="linenos">637</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="DataFrame-638"><a href="#DataFrame-638"><span class="linenos">638</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> <span class="k">if</span> <span class="n">subset</span> <span class="k">else</span> <span class="n">all_columns</span> +</span><span id="DataFrame-639"><a href="#DataFrame-639"><span class="linenos">639</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">values</span><span class="p">:</span> +</span><span id="DataFrame-640"><a href="#DataFrame-640"><span class="linenos">640</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame-641"><a href="#DataFrame-641"><span class="linenos">641</span></a> <span class="n">value_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">]</span> +</span><span id="DataFrame-642"><a href="#DataFrame-642"><span class="linenos">642</span></a> +</span><span id="DataFrame-643"><a href="#DataFrame-643"><span class="linenos">643</span></a> <span class="n">null_replacement_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataFrame-644"><a href="#DataFrame-644"><span class="linenos">644</span></a> <span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="p">(</span> +</span><span id="DataFrame-645"><a href="#DataFrame-645"><span class="linenos">645</span></a> <span class="n">F</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">isNull</span><span class="p">(),</span> <span class="n">value</span><span class="p">)</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">column</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> +</span><span id="DataFrame-646"><a href="#DataFrame-646"><span class="linenos">646</span></a> <span class="p">)</span> +</span><span id="DataFrame-647"><a href="#DataFrame-647"><span class="linenos">647</span></a> <span class="k">for</span> <span class="n">column</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="n">value_columns</span><span class="p">)</span> +</span><span id="DataFrame-648"><a href="#DataFrame-648"><span class="linenos">648</span></a> <span class="p">}</span> +</span><span id="DataFrame-649"><a href="#DataFrame-649"><span class="linenos">649</span></a> <span class="n">null_replacement_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">all_column_mapping</span><span class="p">,</span> <span class="o">**</span><span class="n">null_replacement_mapping</span><span class="p">}</span> +</span><span id="DataFrame-650"><a href="#DataFrame-650"><span class="linenos">650</span></a> <span class="n">null_replacement_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-651"><a href="#DataFrame-651"><span class="linenos">651</span></a> <span class="n">null_replacement_mapping</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span> +</span><span id="DataFrame-652"><a href="#DataFrame-652"><span class="linenos">652</span></a> <span class="p">]</span> +</span><span id="DataFrame-653"><a href="#DataFrame-653"><span class="linenos">653</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">null_replacement_columns</span><span class="p">)</span> +</span><span id="DataFrame-654"><a href="#DataFrame-654"><span class="linenos">654</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span><span id="DataFrame-655"><a href="#DataFrame-655"><span class="linenos">655</span></a> +</span><span id="DataFrame-656"><a href="#DataFrame-656"><span class="linenos">656</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame-657"><a href="#DataFrame-657"><span class="linenos">657</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span> +</span><span id="DataFrame-658"><a href="#DataFrame-658"><span class="linenos">658</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame-659"><a href="#DataFrame-659"><span class="linenos">659</span></a> <span class="n">to_replace</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">],</span> +</span><span id="DataFrame-660"><a href="#DataFrame-660"><span class="linenos">660</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-661"><a href="#DataFrame-661"><span class="linenos">661</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]</span> <span class="o">|</span> <span class="n">ColumnOrName</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame-662"><a href="#DataFrame-662"><span class="linenos">662</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-663"><a href="#DataFrame-663"><span class="linenos">663</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="DataFrame-664"><a href="#DataFrame-664"><span class="linenos">664</span></a> +</span><span id="DataFrame-665"><a href="#DataFrame-665"><span class="linenos">665</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="DataFrame-666"><a href="#DataFrame-666"><span class="linenos">666</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-667"><a href="#DataFrame-667"><span class="linenos">667</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-668"><a href="#DataFrame-668"><span class="linenos">668</span></a> <span class="n">all_column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span><span class="p">}</span> +</span><span id="DataFrame-669"><a href="#DataFrame-669"><span class="linenos">669</span></a> +</span><span id="DataFrame-670"><a href="#DataFrame-670"><span class="linenos">670</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> <span class="k">if</span> <span class="n">subset</span> <span class="k">else</span> <span class="n">all_columns</span> +</span><span id="DataFrame-671"><a href="#DataFrame-671"><span class="linenos">671</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">to_replace</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="DataFrame-672"><a href="#DataFrame-672"><span class="linenos">672</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">to_replace</span><span class="p">)</span> +</span><span id="DataFrame-673"><a href="#DataFrame-673"><span class="linenos">673</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">to_replace</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="DataFrame-674"><a href="#DataFrame-674"><span class="linenos">674</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="n">old_values</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">to_replace</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="DataFrame-675"><a href="#DataFrame-675"><span class="linenos">675</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">list</span><span class="p">),</span> <span class="s2">"value must be a list since the replacements are a list"</span> +</span><span id="DataFrame-676"><a href="#DataFrame-676"><span class="linenos">676</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">to_replace</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span> +</span><span id="DataFrame-677"><a href="#DataFrame-677"><span class="linenos">677</span></a> <span class="n">value</span> +</span><span id="DataFrame-678"><a href="#DataFrame-678"><span class="linenos">678</span></a> <span class="p">),</span> <span class="s2">"the replacements and values must be the same length"</span> +</span><span id="DataFrame-679"><a href="#DataFrame-679"><span class="linenos">679</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="n">to_replace</span> +</span><span id="DataFrame-680"><a href="#DataFrame-680"><span class="linenos">680</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="DataFrame-681"><a href="#DataFrame-681"><span class="linenos">681</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-682"><a href="#DataFrame-682"><span class="linenos">682</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">to_replace</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame-683"><a href="#DataFrame-683"><span class="linenos">683</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame-684"><a href="#DataFrame-684"><span class="linenos">684</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">old_values</span><span class="p">]</span> +</span><span id="DataFrame-685"><a href="#DataFrame-685"><span class="linenos">685</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">new_values</span><span class="p">]</span> +</span><span id="DataFrame-686"><a href="#DataFrame-686"><span class="linenos">686</span></a> +</span><span id="DataFrame-687"><a href="#DataFrame-687"><span class="linenos">687</span></a> <span class="n">replacement_mapping</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="DataFrame-688"><a href="#DataFrame-688"><span class="linenos">688</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="DataFrame-689"><a href="#DataFrame-689"><span class="linenos">689</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame-690"><a href="#DataFrame-690"><span class="linenos">690</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">old_value</span><span class="p">,</span> <span class="n">new_value</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">old_values</span><span class="p">,</span> <span class="n">new_values</span><span class="p">)):</span> +</span><span id="DataFrame-691"><a href="#DataFrame-691"><span class="linenos">691</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="DataFrame-692"><a href="#DataFrame-692"><span class="linenos">692</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">F</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span> <span class="o">==</span> <span class="n">old_value</span><span class="p">,</span> <span class="n">new_value</span><span class="p">)</span> +</span><span id="DataFrame-693"><a href="#DataFrame-693"><span class="linenos">693</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-694"><a href="#DataFrame-694"><span class="linenos">694</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span> <span class="o">==</span> <span class="n">old_value</span><span class="p">,</span> <span class="n">new_value</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="DataFrame-695"><a href="#DataFrame-695"><span class="linenos">695</span></a> <span class="n">replacement_mapping</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">column</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span> +</span><span id="DataFrame-696"><a href="#DataFrame-696"><span class="linenos">696</span></a> <span class="n">column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame-697"><a href="#DataFrame-697"><span class="linenos">697</span></a> <span class="p">)</span> +</span><span id="DataFrame-698"><a href="#DataFrame-698"><span class="linenos">698</span></a> +</span><span id="DataFrame-699"><a href="#DataFrame-699"><span class="linenos">699</span></a> <span class="n">replacement_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">all_column_mapping</span><span class="p">,</span> <span class="o">**</span><span class="n">replacement_mapping</span><span class="p">}</span> +</span><span id="DataFrame-700"><a href="#DataFrame-700"><span class="linenos">700</span></a> <span class="n">replacement_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">replacement_mapping</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span><span class="p">]</span> +</span><span id="DataFrame-701"><a href="#DataFrame-701"><span class="linenos">701</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">replacement_columns</span><span class="p">)</span> +</span><span id="DataFrame-702"><a href="#DataFrame-702"><span class="linenos">702</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span><span id="DataFrame-703"><a href="#DataFrame-703"><span class="linenos">703</span></a> +</span><span id="DataFrame-704"><a href="#DataFrame-704"><span class="linenos">704</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-705"><a href="#DataFrame-705"><span class="linenos">705</span></a> <span class="k">def</span> <span class="nf">withColumn</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">colName</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">col</span><span class="p">:</span> <span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-706"><a href="#DataFrame-706"><span class="linenos">706</span></a> <span class="n">col</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_col</span><span class="p">(</span><span class="n">col</span><span class="p">)</span> +</span><span id="DataFrame-707"><a href="#DataFrame-707"><span class="linenos">707</span></a> <span class="n">existing_col_names</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="DataFrame-708"><a href="#DataFrame-708"><span class="linenos">708</span></a> <span class="n">existing_col_index</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame-709"><a href="#DataFrame-709"><span class="linenos">709</span></a> <span class="n">existing_col_names</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">colName</span><span class="p">)</span> <span class="k">if</span> <span class="n">colName</span> <span class="ow">in</span> <span class="n">existing_col_names</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="DataFrame-710"><a href="#DataFrame-710"><span class="linenos">710</span></a> <span class="p">)</span> +</span><span id="DataFrame-711"><a href="#DataFrame-711"><span class="linenos">711</span></a> <span class="k">if</span> <span class="n">existing_col_index</span><span class="p">:</span> +</span><span id="DataFrame-712"><a href="#DataFrame-712"><span class="linenos">712</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-713"><a href="#DataFrame-713"><span class="linenos">713</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="n">existing_col_index</span><span class="p">]</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">expression</span> +</span><span id="DataFrame-714"><a href="#DataFrame-714"><span class="linenos">714</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-715"><a href="#DataFrame-715"><span class="linenos">715</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">colName</span><span class="p">),</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame-716"><a href="#DataFrame-716"><span class="linenos">716</span></a> +</span><span id="DataFrame-717"><a href="#DataFrame-717"><span class="linenos">717</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-718"><a href="#DataFrame-718"><span class="linenos">718</span></a> <span class="k">def</span> <span class="nf">withColumnRenamed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">existing</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">new</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="DataFrame-719"><a href="#DataFrame-719"><span class="linenos">719</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame-720"><a href="#DataFrame-720"><span class="linenos">720</span></a> <span class="n">existing_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-721"><a href="#DataFrame-721"><span class="linenos">721</span></a> <span class="n">expression</span> +</span><span id="DataFrame-722"><a href="#DataFrame-722"><span class="linenos">722</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="DataFrame-723"><a href="#DataFrame-723"><span class="linenos">723</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="n">existing</span> +</span><span id="DataFrame-724"><a href="#DataFrame-724"><span class="linenos">724</span></a> <span class="p">]</span> +</span><span id="DataFrame-725"><a href="#DataFrame-725"><span class="linenos">725</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">existing_columns</span><span class="p">:</span> +</span><span id="DataFrame-726"><a href="#DataFrame-726"><span class="linenos">726</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Tried to rename a column that doesn't exist"</span><span class="p">)</span> +</span><span id="DataFrame-727"><a href="#DataFrame-727"><span class="linenos">727</span></a> <span class="k">for</span> <span class="n">existing_column</span> <span class="ow">in</span> <span class="n">existing_columns</span><span class="p">:</span> +</span><span id="DataFrame-728"><a href="#DataFrame-728"><span class="linenos">728</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">existing_column</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="DataFrame-729"><a href="#DataFrame-729"><span class="linenos">729</span></a> <span class="n">existing_column</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">existing_column</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">new</span><span class="p">))</span> +</span><span id="DataFrame-730"><a href="#DataFrame-730"><span class="linenos">730</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame-731"><a href="#DataFrame-731"><span class="linenos">731</span></a> <span class="n">existing_column</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">new</span><span class="p">))</span> +</span><span id="DataFrame-732"><a href="#DataFrame-732"><span class="linenos">732</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-733"><a href="#DataFrame-733"><span class="linenos">733</span></a> +</span><span id="DataFrame-734"><a href="#DataFrame-734"><span class="linenos">734</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame-735"><a href="#DataFrame-735"><span class="linenos">735</span></a> <span class="k">def</span> <span class="nf">drop</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-736"><a href="#DataFrame-736"><span class="linenos">736</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame-737"><a href="#DataFrame-737"><span class="linenos">737</span></a> <span class="n">drop_cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-738"><a href="#DataFrame-738"><span class="linenos">738</span></a> <span class="n">new_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame-739"><a href="#DataFrame-739"><span class="linenos">739</span></a> <span class="n">col</span> +</span><span id="DataFrame-740"><a href="#DataFrame-740"><span class="linenos">740</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">all_columns</span> +</span><span id="DataFrame-741"><a href="#DataFrame-741"><span class="linenos">741</span></a> <span class="k">if</span> <span class="n">col</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="n">drop_column</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">drop_column</span> <span class="ow">in</span> <span class="n">drop_cols</span><span class="p">]</span> +</span><span id="DataFrame-742"><a href="#DataFrame-742"><span class="linenos">742</span></a> <span class="p">]</span> +</span><span id="DataFrame-743"><a href="#DataFrame-743"><span class="linenos">743</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">new_columns</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame-744"><a href="#DataFrame-744"><span class="linenos">744</span></a> +</span><span id="DataFrame-745"><a href="#DataFrame-745"><span class="linenos">745</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">LIMIT</span><span class="p">)</span> +</span><span id="DataFrame-746"><a href="#DataFrame-746"><span class="linenos">746</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">num</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-747"><a href="#DataFrame-747"><span class="linenos">747</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="n">num</span><span class="p">))</span> +</span><span id="DataFrame-748"><a href="#DataFrame-748"><span class="linenos">748</span></a> +</span><span id="DataFrame-749"><a href="#DataFrame-749"><span class="linenos">749</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame-750"><a href="#DataFrame-750"><span class="linenos">750</span></a> <span class="k">def</span> <span class="nf">hint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">*</span><span class="n">parameters</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-751"><a href="#DataFrame-751"><span class="linenos">751</span></a> <span class="n">parameter_list</span> <span class="o">=</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">parameters</span><span class="p">)</span> +</span><span id="DataFrame-752"><a href="#DataFrame-752"><span class="linenos">752</span></a> <span class="n">parameter_columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame-753"><a href="#DataFrame-753"><span class="linenos">753</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">parameter_list</span><span class="p">)</span> +</span><span id="DataFrame-754"><a href="#DataFrame-754"><span class="linenos">754</span></a> <span class="k">if</span> <span class="n">parameters</span> +</span><span id="DataFrame-755"><a href="#DataFrame-755"><span class="linenos">755</span></a> <span class="k">else</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_cols</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span><span class="p">])</span> +</span><span id="DataFrame-756"><a href="#DataFrame-756"><span class="linenos">756</span></a> <span class="p">)</span> +</span><span id="DataFrame-757"><a href="#DataFrame-757"><span class="linenos">757</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hint</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">parameter_columns</span><span class="p">)</span> +</span><span id="DataFrame-758"><a href="#DataFrame-758"><span class="linenos">758</span></a> +</span><span id="DataFrame-759"><a href="#DataFrame-759"><span class="linenos">759</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame-760"><a href="#DataFrame-760"><span class="linenos">760</span></a> <span class="k">def</span> <span class="nf">repartition</span><span class="p">(</span> +</span><span id="DataFrame-761"><a href="#DataFrame-761"><span class="linenos">761</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">numPartitions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">ColumnOrName</span><span class="p">],</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">ColumnOrName</span> +</span><span id="DataFrame-762"><a href="#DataFrame-762"><span class="linenos">762</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-763"><a href="#DataFrame-763"><span class="linenos">763</span></a> <span class="n">num_partition_cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">numPartitions</span><span class="p">)</span> +</span><span id="DataFrame-764"><a href="#DataFrame-764"><span class="linenos">764</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame-765"><a href="#DataFrame-765"><span class="linenos">765</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">num_partition_cols</span> <span class="o">+</span> <span class="n">columns</span> +</span><span id="DataFrame-766"><a href="#DataFrame-766"><span class="linenos">766</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hint</span><span class="p">(</span><span class="s2">"repartition"</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="DataFrame-767"><a href="#DataFrame-767"><span class="linenos">767</span></a> +</span><span id="DataFrame-768"><a href="#DataFrame-768"><span class="linenos">768</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame-769"><a href="#DataFrame-769"><span class="linenos">769</span></a> <span class="k">def</span> <span class="nf">coalesce</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">numPartitions</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-770"><a href="#DataFrame-770"><span class="linenos">770</span></a> <span class="n">num_partitions</span> <span class="o">=</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_cols</span><span class="p">([</span><span class="n">numPartitions</span><span class="p">])</span> +</span><span id="DataFrame-771"><a href="#DataFrame-771"><span class="linenos">771</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hint</span><span class="p">(</span><span class="s2">"coalesce"</span><span class="p">,</span> <span class="n">num_partitions</span><span class="p">)</span> +</span><span id="DataFrame-772"><a href="#DataFrame-772"><span class="linenos">772</span></a> +</span><span id="DataFrame-773"><a href="#DataFrame-773"><span class="linenos">773</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame-774"><a href="#DataFrame-774"><span class="linenos">774</span></a> <span class="k">def</span> <span class="nf">cache</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-775"><a href="#DataFrame-775"><span class="linenos">775</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="p">(</span><span class="n">storage_level</span><span class="o">=</span><span class="s2">"MEMORY_AND_DISK"</span><span class="p">)</span> +</span><span id="DataFrame-776"><a href="#DataFrame-776"><span class="linenos">776</span></a> +</span><span id="DataFrame-777"><a href="#DataFrame-777"><span class="linenos">777</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame-778"><a href="#DataFrame-778"><span class="linenos">778</span></a> <span class="k">def</span> <span class="nf">persist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">storageLevel</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"MEMORY_AND_DISK_SER"</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame-779"><a href="#DataFrame-779"><span class="linenos">779</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame-780"><a href="#DataFrame-780"><span class="linenos">780</span></a><span class="sd"> Storage Level Options: https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-aux-cache-cache-table.html</span> +</span><span id="DataFrame-781"><a href="#DataFrame-781"><span class="linenos">781</span></a><span class="sd"> """</span> +</span><span id="DataFrame-782"><a href="#DataFrame-782"><span class="linenos">782</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="p">(</span><span class="n">storageLevel</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="DataFrame.__init__" class="classattr"> + <input id="DataFrame.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">DataFrame</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">spark</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700332957056'</span><span class="o">></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Select">sqlglot.expressions.Select</a></span>,</span><span class="param"> <span class="n">branch_id</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">sequence_id</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">last_op</span><span class="p">:</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">dataframe</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">operations</span><span class="o">.</span><span class="n">Operation</span> <span class="o">=</span> <span class="o"><</span><span class="n">Operation</span><span class="o">.</span><span class="n">INIT</span><span class="p">:</span> <span class="o">-</span><span class="mi">1</span><span class="o">></span>,</span><span class="param"> <span class="n">pending_hints</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">output_expression_container</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700332981504'</span><span class="o">></span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span>)</span> + + <label class="view-source-button" for="DataFrame.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.__init__-47"><a href="#DataFrame.__init__-47"><span class="linenos">47</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="DataFrame.__init__-48"><a href="#DataFrame.__init__-48"><span class="linenos">48</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.__init__-49"><a href="#DataFrame.__init__-49"><span class="linenos">49</span></a> <span class="n">spark</span><span class="p">:</span> <span class="n">SparkSession</span><span class="p">,</span> +</span><span id="DataFrame.__init__-50"><a href="#DataFrame.__init__-50"><span class="linenos">50</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> +</span><span id="DataFrame.__init__-51"><a href="#DataFrame.__init__-51"><span class="linenos">51</span></a> <span class="n">branch_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.__init__-52"><a href="#DataFrame.__init__-52"><span class="linenos">52</span></a> <span class="n">sequence_id</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.__init__-53"><a href="#DataFrame.__init__-53"><span class="linenos">53</span></a> <span class="n">last_op</span><span class="p">:</span> <span class="n">Operation</span> <span class="o">=</span> <span class="n">Operation</span><span class="o">.</span><span class="n">INIT</span><span class="p">,</span> +</span><span id="DataFrame.__init__-54"><a href="#DataFrame.__init__-54"><span class="linenos">54</span></a> <span class="n">pending_hints</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.__init__-55"><a href="#DataFrame.__init__-55"><span class="linenos">55</span></a> <span class="n">output_expression_container</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">OutputExpressionContainer</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.__init__-56"><a href="#DataFrame.__init__-56"><span class="linenos">56</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="DataFrame.__init__-57"><a href="#DataFrame.__init__-57"><span class="linenos">57</span></a> <span class="p">):</span> +</span><span id="DataFrame.__init__-58"><a href="#DataFrame.__init__-58"><span class="linenos">58</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> <span class="o">=</span> <span class="n">spark</span> +</span><span id="DataFrame.__init__-59"><a href="#DataFrame.__init__-59"><span class="linenos">59</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="DataFrame.__init__-60"><a href="#DataFrame.__init__-60"><span class="linenos">60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">branch_id</span> <span class="o">=</span> <span class="n">branch_id</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_branch_id</span> +</span><span id="DataFrame.__init__-61"><a href="#DataFrame.__init__-61"><span class="linenos">61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span> <span class="o">=</span> <span class="n">sequence_id</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_sequence_id</span> +</span><span id="DataFrame.__init__-62"><a href="#DataFrame.__init__-62"><span class="linenos">62</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">last_op</span> <span class="o">=</span> <span class="n">last_op</span> +</span><span id="DataFrame.__init__-63"><a href="#DataFrame.__init__-63"><span class="linenos">63</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pending_hints</span> <span class="o">=</span> <span class="n">pending_hints</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="DataFrame.__init__-64"><a href="#DataFrame.__init__-64"><span class="linenos">64</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">output_expression_container</span> <span class="o">=</span> <span class="n">output_expression_container</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.sql" class="classattr"> + <input id="DataFrame.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="s1">'spark'</span>, </span><span class="param"><span class="n">optimize</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="DataFrame.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.sql-296"><a href="#DataFrame.sql-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">,</span> <span class="n">optimize</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="DataFrame.sql-297"><a href="#DataFrame.sql-297"><span class="linenos">297</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_resolve_pending_hints</span><span class="p">()</span> +</span><span id="DataFrame.sql-298"><a href="#DataFrame.sql-298"><span class="linenos">298</span></a> <span class="n">select_expressions</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_get_select_expressions</span><span class="p">()</span> +</span><span id="DataFrame.sql-299"><a href="#DataFrame.sql-299"><span class="linenos">299</span></a> <span class="n">output_expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame.sql-300"><a href="#DataFrame.sql-300"><span class="linenos">300</span></a> <span class="n">replacement_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="DataFrame.sql-301"><a href="#DataFrame.sql-301"><span class="linenos">301</span></a> <span class="k">for</span> <span class="n">expression_type</span><span class="p">,</span> <span class="n">select_expression</span> <span class="ow">in</span> <span class="n">select_expressions</span><span class="p">:</span> +</span><span id="DataFrame.sql-302"><a href="#DataFrame.sql-302"><span class="linenos">302</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">replace_id_value</span><span class="p">,</span> <span class="n">replacement_mapping</span><span class="p">)</span> +</span><span id="DataFrame.sql-303"><a href="#DataFrame.sql-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="n">optimize</span><span class="p">:</span> +</span><span id="DataFrame.sql-304"><a href="#DataFrame.sql-304"><span class="linenos">304</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">optimize_func</span><span class="p">(</span><span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame.sql-305"><a href="#DataFrame.sql-305"><span class="linenos">305</span></a> <span class="n">select_expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_replace_cte_names_with_hashes</span><span class="p">(</span><span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame.sql-306"><a href="#DataFrame.sql-306"><span class="linenos">306</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">]</span> +</span><span id="DataFrame.sql-307"><a href="#DataFrame.sql-307"><span class="linenos">307</span></a> <span class="k">if</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">:</span> +</span><span id="DataFrame.sql-308"><a href="#DataFrame.sql-308"><span class="linenos">308</span></a> <span class="n">cache_table_name</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_create_hash_from_expression</span><span class="p">(</span><span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame.sql-309"><a href="#DataFrame.sql-309"><span class="linenos">309</span></a> <span class="n">cache_table</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">cache_table_name</span><span class="p">)</span> +</span><span id="DataFrame.sql-310"><a href="#DataFrame.sql-310"><span class="linenos">310</span></a> <span class="n">original_alias_name</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"cte_alias_name"</span><span class="p">]</span> +</span><span id="DataFrame.sql-311"><a href="#DataFrame.sql-311"><span class="linenos">311</span></a> +</span><span id="DataFrame.sql-312"><a href="#DataFrame.sql-312"><span class="linenos">312</span></a> <span class="n">replacement_mapping</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">original_alias_name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="DataFrame.sql-313"><a href="#DataFrame.sql-313"><span class="linenos">313</span></a> <span class="n">cache_table_name</span> +</span><span id="DataFrame.sql-314"><a href="#DataFrame.sql-314"><span class="linenos">314</span></a> <span class="p">)</span> +</span><span id="DataFrame.sql-315"><a href="#DataFrame.sql-315"><span class="linenos">315</span></a> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span> +</span><span id="DataFrame.sql-316"><a href="#DataFrame.sql-316"><span class="linenos">316</span></a> <span class="n">cache_table_name</span><span class="p">,</span> +</span><span id="DataFrame.sql-317"><a href="#DataFrame.sql-317"><span class="linenos">317</span></a> <span class="p">{</span> +</span><span id="DataFrame.sql-318"><a href="#DataFrame.sql-318"><span class="linenos">318</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="s2">"spark"</span><span class="p">)</span> +</span><span id="DataFrame.sql-319"><a href="#DataFrame.sql-319"><span class="linenos">319</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="DataFrame.sql-320"><a href="#DataFrame.sql-320"><span class="linenos">320</span></a> <span class="p">},</span> +</span><span id="DataFrame.sql-321"><a href="#DataFrame.sql-321"><span class="linenos">321</span></a> <span class="p">)</span> +</span><span id="DataFrame.sql-322"><a href="#DataFrame.sql-322"><span class="linenos">322</span></a> <span class="n">cache_storage_level</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"cache_storage_level"</span><span class="p">]</span> +</span><span id="DataFrame.sql-323"><a href="#DataFrame.sql-323"><span class="linenos">323</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.sql-324"><a href="#DataFrame.sql-324"><span class="linenos">324</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"storageLevel"</span><span class="p">),</span> +</span><span id="DataFrame.sql-325"><a href="#DataFrame.sql-325"><span class="linenos">325</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">cache_storage_level</span><span class="p">),</span> +</span><span id="DataFrame.sql-326"><a href="#DataFrame.sql-326"><span class="linenos">326</span></a> <span class="p">]</span> +</span><span id="DataFrame.sql-327"><a href="#DataFrame.sql-327"><span class="linenos">327</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">(</span> +</span><span id="DataFrame.sql-328"><a href="#DataFrame.sql-328"><span class="linenos">328</span></a> <span class="n">this</span><span class="o">=</span><span class="n">cache_table</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">select_expression</span><span class="p">,</span> <span class="n">lazy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="n">options</span> +</span><span id="DataFrame.sql-329"><a href="#DataFrame.sql-329"><span class="linenos">329</span></a> <span class="p">)</span> +</span><span id="DataFrame.sql-330"><a href="#DataFrame.sql-330"><span class="linenos">330</span></a> <span class="c1"># We will drop the "view" if it exists before running the cache table</span> +</span><span id="DataFrame.sql-331"><a href="#DataFrame.sql-331"><span class="linenos">331</span></a> <span class="n">output_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">cache_table</span><span class="p">,</span> <span class="n">exists</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"VIEW"</span><span class="p">))</span> +</span><span id="DataFrame.sql-332"><a href="#DataFrame.sql-332"><span class="linenos">332</span></a> <span class="k">elif</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> +</span><span id="DataFrame.sql-333"><a href="#DataFrame.sql-333"><span class="linenos">333</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">output_expression_container</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.sql-334"><a href="#DataFrame.sql-334"><span class="linenos">334</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">,</span> <span class="n">select_expression</span><span class="p">)</span> +</span><span id="DataFrame.sql-335"><a href="#DataFrame.sql-335"><span class="linenos">335</span></a> <span class="k">elif</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">:</span> +</span><span id="DataFrame.sql-336"><a href="#DataFrame.sql-336"><span class="linenos">336</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">output_expression_container</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.sql-337"><a href="#DataFrame.sql-337"><span class="linenos">337</span></a> <span class="n">select_without_ctes</span> <span class="o">=</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.sql-338"><a href="#DataFrame.sql-338"><span class="linenos">338</span></a> <span class="n">select_without_ctes</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame.sql-339"><a href="#DataFrame.sql-339"><span class="linenos">339</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">,</span> <span class="n">select_without_ctes</span><span class="p">)</span> +</span><span id="DataFrame.sql-340"><a href="#DataFrame.sql-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="n">select_expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">:</span> +</span><span id="DataFrame.sql-341"><a href="#DataFrame.sql-341"><span class="linenos">341</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">select_expression</span><span class="o">.</span><span class="n">ctes</span><span class="p">))</span> +</span><span id="DataFrame.sql-342"><a href="#DataFrame.sql-342"><span class="linenos">342</span></a> <span class="k">elif</span> <span class="n">expression_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> +</span><span id="DataFrame.sql-343"><a href="#DataFrame.sql-343"><span class="linenos">343</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">select_expression</span> +</span><span id="DataFrame.sql-344"><a href="#DataFrame.sql-344"><span class="linenos">344</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.sql-345"><a href="#DataFrame.sql-345"><span class="linenos">345</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid expression type: </span><span class="si">{</span><span class="n">expression_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="DataFrame.sql-346"><a href="#DataFrame.sql-346"><span class="linenos">346</span></a> <span class="n">output_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.sql-347"><a href="#DataFrame.sql-347"><span class="linenos">347</span></a> +</span><span id="DataFrame.sql-348"><a href="#DataFrame.sql-348"><span class="linenos">348</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="DataFrame.sql-349"><a href="#DataFrame.sql-349"><span class="linenos">349</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">output_expressions</span> +</span><span id="DataFrame.sql-350"><a href="#DataFrame.sql-350"><span class="linenos">350</span></a> <span class="p">]</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.copy" class="classattr"> + <input id="DataFrame.copy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">copy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.copy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.copy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.copy-352"><a href="#DataFrame.copy-352"><span class="linenos">352</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.copy-353"><a href="#DataFrame.copy-353"><span class="linenos">353</span></a> <span class="k">return</span> <span class="n">DataFrame</span><span class="p">(</span><span class="o">**</span><span class="n">object_to_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.select" class="classattr"> + <input id="DataFrame.select-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">select</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.select-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.select"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.select-355"><a href="#DataFrame.select-355"><span class="linenos">355</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.select-356"><a href="#DataFrame.select-356"><span class="linenos">356</span></a> <span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.select-357"><a href="#DataFrame.select-357"><span class="linenos">357</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame.select-358"><a href="#DataFrame.select-358"><span class="linenos">358</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"append"</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"append"</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span><span id="DataFrame.select-359"><a href="#DataFrame.select-359"><span class="linenos">359</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">):</span> +</span><span id="DataFrame.select-360"><a href="#DataFrame.select-360"><span class="linenos">360</span></a> <span class="n">ambiguous_cols</span> <span class="o">=</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">cols</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">col</span><span class="o">.</span><span class="n">column_expression</span><span class="o">.</span><span class="n">table</span><span class="p">]</span> +</span><span id="DataFrame.select-361"><a href="#DataFrame.select-361"><span class="linenos">361</span></a> <span class="k">if</span> <span class="n">ambiguous_cols</span><span class="p">:</span> +</span><span id="DataFrame.select-362"><a href="#DataFrame.select-362"><span class="linenos">362</span></a> <span class="n">join_table_identifiers</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.select-363"><a href="#DataFrame.select-363"><span class="linenos">363</span></a> <span class="n">x</span><span class="o">.</span><span class="n">this</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">get_tables_from_expression_with_join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.select-364"><a href="#DataFrame.select-364"><span class="linenos">364</span></a> <span class="p">]</span> +</span><span id="DataFrame.select-365"><a href="#DataFrame.select-365"><span class="linenos">365</span></a> <span class="n">cte_names_in_join</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">this</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">join_table_identifiers</span><span class="p">]</span> +</span><span id="DataFrame.select-366"><a href="#DataFrame.select-366"><span class="linenos">366</span></a> <span class="k">for</span> <span class="n">ambiguous_col</span> <span class="ow">in</span> <span class="n">ambiguous_cols</span><span class="p">:</span> +</span><span id="DataFrame.select-367"><a href="#DataFrame.select-367"><span class="linenos">367</span></a> <span class="n">ctes_with_column</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.select-368"><a href="#DataFrame.select-368"><span class="linenos">368</span></a> <span class="n">cte</span> +</span><span id="DataFrame.select-369"><a href="#DataFrame.select-369"><span class="linenos">369</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span> +</span><span id="DataFrame.select-370"><a href="#DataFrame.select-370"><span class="linenos">370</span></a> <span class="k">if</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">cte_names_in_join</span> +</span><span id="DataFrame.select-371"><a href="#DataFrame.select-371"><span class="linenos">371</span></a> <span class="ow">and</span> <span class="n">ambiguous_col</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="DataFrame.select-372"><a href="#DataFrame.select-372"><span class="linenos">372</span></a> <span class="p">]</span> +</span><span id="DataFrame.select-373"><a href="#DataFrame.select-373"><span class="linenos">373</span></a> <span class="c1"># If the select column does not specify a table and there is a join</span> +</span><span id="DataFrame.select-374"><a href="#DataFrame.select-374"><span class="linenos">374</span></a> <span class="c1"># then we assume they are referring to the left table</span> +</span><span id="DataFrame.select-375"><a href="#DataFrame.select-375"><span class="linenos">375</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">ctes_with_column</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="DataFrame.select-376"><a href="#DataFrame.select-376"><span class="linenos">376</span></a> <span class="n">table_identifier</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"from"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expressions"</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> +</span><span id="DataFrame.select-377"><a href="#DataFrame.select-377"><span class="linenos">377</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.select-378"><a href="#DataFrame.select-378"><span class="linenos">378</span></a> <span class="n">table_identifier</span> <span class="o">=</span> <span class="n">ctes_with_column</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> +</span><span id="DataFrame.select-379"><a href="#DataFrame.select-379"><span class="linenos">379</span></a> <span class="n">ambiguous_col</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">table_identifier</span><span class="p">)</span> +</span><span id="DataFrame.select-380"><a href="#DataFrame.select-380"><span class="linenos">380</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="DataFrame.select-381"><a href="#DataFrame.select-381"><span class="linenos">381</span></a> <span class="n">qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="p">)</span> +</span><span id="DataFrame.select-382"><a href="#DataFrame.select-382"><span class="linenos">382</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.alias" class="classattr"> + <input id="DataFrame.alias-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.NO_OP)</div> + + <span class="def">def</span> + <span class="name">alias</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">name</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.alias-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.alias"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.alias-384"><a href="#DataFrame.alias-384"><span class="linenos">384</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame.alias-385"><a href="#DataFrame.alias-385"><span class="linenos">385</span></a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.alias-386"><a href="#DataFrame.alias-386"><span class="linenos">386</span></a> <span class="n">new_sequence_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_random_sequence_id</span> +</span><span id="DataFrame.alias-387"><a href="#DataFrame.alias-387"><span class="linenos">387</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.alias-388"><a href="#DataFrame.alias-388"><span class="linenos">388</span></a> <span class="k">for</span> <span class="n">join_hint</span> <span class="ow">in</span> <span class="n">df</span><span class="o">.</span><span class="n">pending_join_hints</span><span class="p">:</span> +</span><span id="DataFrame.alias-389"><a href="#DataFrame.alias-389"><span class="linenos">389</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">join_hint</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="DataFrame.alias-390"><a href="#DataFrame.alias-390"><span class="linenos">390</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span><span class="p">:</span> +</span><span id="DataFrame.alias-391"><a href="#DataFrame.alias-391"><span class="linenos">391</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">new_sequence_id</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.alias-392"><a href="#DataFrame.alias-392"><span class="linenos">392</span></a> <span class="n">df</span><span class="o">.</span><span class="n">spark</span><span class="o">.</span><span class="n">_add_alias_to_mapping</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">new_sequence_id</span><span class="p">)</span> +</span><span id="DataFrame.alias-393"><a href="#DataFrame.alias-393"><span class="linenos">393</span></a> <span class="k">return</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">(</span><span class="n">sequence_id</span><span class="o">=</span><span class="n">new_sequence_id</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.where" class="classattr"> + <input id="DataFrame.where-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.WHERE)</div> + + <span class="def">def</span> + <span class="name">where</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">column</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.where-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.where"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.where-395"><a href="#DataFrame.where-395"><span class="linenos">395</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">WHERE</span><span class="p">)</span> +</span><span id="DataFrame.where-396"><a href="#DataFrame.where-396"><span class="linenos">396</span></a> <span class="k">def</span> <span class="nf">where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">Column</span><span class="p">,</span> <span class="nb">bool</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.where-397"><a href="#DataFrame.where-397"><span class="linenos">397</span></a> <span class="n">col</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_col</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="DataFrame.where-398"><a href="#DataFrame.where-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.filter" class="classattr"> + <input id="DataFrame.filter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.WHERE)</div> + + <span class="def">def</span> + <span class="name">filter</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">column</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.filter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.filter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.filter-395"><a href="#DataFrame.filter-395"><span class="linenos">395</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">WHERE</span><span class="p">)</span> +</span><span id="DataFrame.filter-396"><a href="#DataFrame.filter-396"><span class="linenos">396</span></a> <span class="k">def</span> <span class="nf">where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">Column</span><span class="p">,</span> <span class="nb">bool</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.filter-397"><a href="#DataFrame.filter-397"><span class="linenos">397</span></a> <span class="n">col</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_col</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="DataFrame.filter-398"><a href="#DataFrame.filter-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.groupBy" class="classattr"> + <input id="DataFrame.groupBy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.GROUP_BY)</div> + + <span class="def">def</span> + <span class="name">groupBy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#GroupedData">sqlglot.dataframe.sql.GroupedData</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.groupBy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.groupBy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.groupBy-402"><a href="#DataFrame.groupBy-402"><span class="linenos">402</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">GROUP_BY</span><span class="p">)</span> +</span><span id="DataFrame.groupBy-403"><a href="#DataFrame.groupBy-403"><span class="linenos">403</span></a> <span class="k">def</span> <span class="nf">groupBy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">GroupedData</span><span class="p">:</span> +</span><span id="DataFrame.groupBy-404"><a href="#DataFrame.groupBy-404"><span class="linenos">404</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame.groupBy-405"><a href="#DataFrame.groupBy-405"><span class="linenos">405</span></a> <span class="k">return</span> <span class="n">GroupedData</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_op</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.agg" class="classattr"> + <input id="DataFrame.agg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">agg</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">exprs</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.agg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.agg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.agg-407"><a href="#DataFrame.agg-407"><span class="linenos">407</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.agg-408"><a href="#DataFrame.agg-408"><span class="linenos">408</span></a> <span class="k">def</span> <span class="nf">agg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">exprs</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.agg-409"><a href="#DataFrame.agg-409"><span class="linenos">409</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">exprs</span><span class="p">)</span> +</span><span id="DataFrame.agg-410"><a href="#DataFrame.agg-410"><span class="linenos">410</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">groupBy</span><span class="p">()</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.join" class="classattr"> + <input id="DataFrame.join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">join</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other_df</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>,</span><span class="param"> <span class="n">on</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]]</span>,</span><span class="param"> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">'inner'</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.join-412"><a href="#DataFrame.join-412"><span class="linenos">412</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.join-413"><a href="#DataFrame.join-413"><span class="linenos">413</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span> +</span><span id="DataFrame.join-414"><a href="#DataFrame.join-414"><span class="linenos">414</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.join-415"><a href="#DataFrame.join-415"><span class="linenos">415</span></a> <span class="n">other_df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> +</span><span id="DataFrame.join-416"><a href="#DataFrame.join-416"><span class="linenos">416</span></a> <span class="n">on</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">Column</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]],</span> +</span><span id="DataFrame.join-417"><a href="#DataFrame.join-417"><span class="linenos">417</span></a> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"inner"</span><span class="p">,</span> +</span><span id="DataFrame.join-418"><a href="#DataFrame.join-418"><span class="linenos">418</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="DataFrame.join-419"><a href="#DataFrame.join-419"><span class="linenos">419</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.join-420"><a href="#DataFrame.join-420"><span class="linenos">420</span></a> <span class="n">other_df</span> <span class="o">=</span> <span class="n">other_df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span> +</span><span id="DataFrame.join-421"><a href="#DataFrame.join-421"><span class="linenos">421</span></a> <span class="n">pre_join_self_latest_cte_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">latest_cte_name</span> +</span><span id="DataFrame.join-422"><a href="#DataFrame.join-422"><span class="linenos">422</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">on</span><span class="p">)</span> +</span><span id="DataFrame.join-423"><a href="#DataFrame.join-423"><span class="linenos">423</span></a> <span class="n">join_type</span> <span class="o">=</span> <span class="n">how</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"_"</span><span class="p">,</span> <span class="s2">" "</span><span class="p">)</span> +</span><span id="DataFrame.join-424"><a href="#DataFrame.join-424"><span class="linenos">424</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="DataFrame.join-425"><a href="#DataFrame.join-425"><span class="linenos">425</span></a> <span class="n">join_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.join-426"><a href="#DataFrame.join-426"><span class="linenos">426</span></a> <span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="DataFrame.join-427"><a href="#DataFrame.join-427"><span class="linenos">427</span></a> <span class="p">]</span> +</span><span id="DataFrame.join-428"><a href="#DataFrame.join-428"><span class="linenos">428</span></a> <span class="n">join_clause</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span> +</span><span id="DataFrame.join-429"><a href="#DataFrame.join-429"><span class="linenos">429</span></a> <span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span> <span class="o">&</span> <span class="n">y</span><span class="p">,</span> +</span><span id="DataFrame.join-430"><a href="#DataFrame.join-430"><span class="linenos">430</span></a> <span class="p">[</span> +</span><span id="DataFrame.join-431"><a href="#DataFrame.join-431"><span class="linenos">431</span></a> <span class="n">col</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame.join-432"><a href="#DataFrame.join-432"><span class="linenos">432</span></a> <span class="o">==</span> <span class="n">col</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame.join-433"><a href="#DataFrame.join-433"><span class="linenos">433</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="DataFrame.join-434"><a href="#DataFrame.join-434"><span class="linenos">434</span></a> <span class="p">],</span> +</span><span id="DataFrame.join-435"><a href="#DataFrame.join-435"><span class="linenos">435</span></a> <span class="p">)</span> +</span><span id="DataFrame.join-436"><a href="#DataFrame.join-436"><span class="linenos">436</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.join-437"><a href="#DataFrame.join-437"><span class="linenos">437</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="DataFrame.join-438"><a href="#DataFrame.join-438"><span class="linenos">438</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span> <span class="o">&</span> <span class="n">y</span><span class="p">,</span> <span class="n">columns</span><span class="p">)]</span> +</span><span id="DataFrame.join-439"><a href="#DataFrame.join-439"><span class="linenos">439</span></a> <span class="n">join_clause</span> <span class="o">=</span> <span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="DataFrame.join-440"><a href="#DataFrame.join-440"><span class="linenos">440</span></a> <span class="n">join_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.join-441"><a href="#DataFrame.join-441"><span class="linenos">441</span></a> <span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame.join-442"><a href="#DataFrame.join-442"><span class="linenos">442</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">0</span> +</span><span id="DataFrame.join-443"><a href="#DataFrame.join-443"><span class="linenos">443</span></a> <span class="k">else</span> <span class="n">Column</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">)</span> +</span><span id="DataFrame.join-444"><a href="#DataFrame.join-444"><span class="linenos">444</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">join_clause</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> +</span><span id="DataFrame.join-445"><a href="#DataFrame.join-445"><span class="linenos">445</span></a> <span class="p">]</span> +</span><span id="DataFrame.join-446"><a href="#DataFrame.join-446"><span class="linenos">446</span></a> <span class="n">self_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.join-447"><a href="#DataFrame.join-447"><span class="linenos">447</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">pre_join_self_latest_cte_name</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame.join-448"><a href="#DataFrame.join-448"><span class="linenos">448</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="DataFrame.join-449"><a href="#DataFrame.join-449"><span class="linenos">449</span></a> <span class="p">]</span> +</span><span id="DataFrame.join-450"><a href="#DataFrame.join-450"><span class="linenos">450</span></a> <span class="n">other_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.join-451"><a href="#DataFrame.join-451"><span class="linenos">451</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set_table_name</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame.join-452"><a href="#DataFrame.join-452"><span class="linenos">452</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">other_df</span><span class="p">)</span> +</span><span id="DataFrame.join-453"><a href="#DataFrame.join-453"><span class="linenos">453</span></a> <span class="p">]</span> +</span><span id="DataFrame.join-454"><a href="#DataFrame.join-454"><span class="linenos">454</span></a> <span class="n">column_value_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataFrame.join-455"><a href="#DataFrame.join-455"><span class="linenos">455</span></a> <span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame.join-456"><a href="#DataFrame.join-456"><span class="linenos">456</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">)</span> +</span><span id="DataFrame.join-457"><a href="#DataFrame.join-457"><span class="linenos">457</span></a> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">sql</span><span class="p">():</span> <span class="n">column</span> +</span><span id="DataFrame.join-458"><a href="#DataFrame.join-458"><span class="linenos">458</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">other_columns</span> <span class="o">+</span> <span class="n">self_columns</span> <span class="o">+</span> <span class="n">join_columns</span> +</span><span id="DataFrame.join-459"><a href="#DataFrame.join-459"><span class="linenos">459</span></a> <span class="p">}</span> +</span><span id="DataFrame.join-460"><a href="#DataFrame.join-460"><span class="linenos">460</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.join-461"><a href="#DataFrame.join-461"><span class="linenos">461</span></a> <span class="n">column_value_mapping</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="DataFrame.join-462"><a href="#DataFrame.join-462"><span class="linenos">462</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">{</span><span class="n">x</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">join_columns</span> <span class="o">+</span> <span class="n">self_columns</span> <span class="o">+</span> <span class="n">other_columns</span><span class="p">}</span> +</span><span id="DataFrame.join-463"><a href="#DataFrame.join-463"><span class="linenos">463</span></a> <span class="p">]</span> +</span><span id="DataFrame.join-464"><a href="#DataFrame.join-464"><span class="linenos">464</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span> +</span><span id="DataFrame.join-465"><a href="#DataFrame.join-465"><span class="linenos">465</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="DataFrame.join-466"><a href="#DataFrame.join-466"><span class="linenos">466</span></a> <span class="n">other_df</span><span class="o">.</span><span class="n">latest_cte_name</span><span class="p">,</span> <span class="n">on</span><span class="o">=</span><span class="n">join_clause</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">join_type</span><span class="o">=</span><span class="n">join_type</span> +</span><span id="DataFrame.join-467"><a href="#DataFrame.join-467"><span class="linenos">467</span></a> <span class="p">)</span> +</span><span id="DataFrame.join-468"><a href="#DataFrame.join-468"><span class="linenos">468</span></a> <span class="p">)</span> +</span><span id="DataFrame.join-469"><a href="#DataFrame.join-469"><span class="linenos">469</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">_add_ctes_to_expression</span><span class="p">(</span> +</span><span id="DataFrame.join-470"><a href="#DataFrame.join-470"><span class="linenos">470</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">other_df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">ctes</span> +</span><span id="DataFrame.join-471"><a href="#DataFrame.join-471"><span class="linenos">471</span></a> <span class="p">)</span> +</span><span id="DataFrame.join-472"><a href="#DataFrame.join-472"><span class="linenos">472</span></a> <span class="n">new_df</span><span class="o">.</span><span class="n">pending_hints</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">other_df</span><span class="o">.</span><span class="n">pending_hints</span><span class="p">)</span> +</span><span id="DataFrame.join-473"><a href="#DataFrame.join-473"><span class="linenos">473</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="o">.</span><span class="n">__wrapped__</span><span class="p">(</span><span class="n">new_df</span><span class="p">,</span> <span class="o">*</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="DataFrame.join-474"><a href="#DataFrame.join-474"><span class="linenos">474</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.orderBy" class="classattr"> + <input id="DataFrame.orderBy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.ORDER_BY)</div> + + <span class="def">def</span> + <span class="name">orderBy</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">ascending</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.orderBy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.orderBy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.orderBy-476"><a href="#DataFrame.orderBy-476"><span class="linenos">476</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-477"><a href="#DataFrame.orderBy-477"><span class="linenos">477</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span> +</span><span id="DataFrame.orderBy-478"><a href="#DataFrame.orderBy-478"><span class="linenos">478</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.orderBy-479"><a href="#DataFrame.orderBy-479"><span class="linenos">479</span></a> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">],</span> +</span><span id="DataFrame.orderBy-480"><a href="#DataFrame.orderBy-480"><span class="linenos">480</span></a> <span class="n">ascending</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.orderBy-481"><a href="#DataFrame.orderBy-481"><span class="linenos">481</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.orderBy-482"><a href="#DataFrame.orderBy-482"><span class="linenos">482</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame.orderBy-483"><a href="#DataFrame.orderBy-483"><span class="linenos">483</span></a><span class="sd"> This implementation lets any ordered columns take priority over whatever is provided in `ascending`. Spark</span> +</span><span id="DataFrame.orderBy-484"><a href="#DataFrame.orderBy-484"><span class="linenos">484</span></a><span class="sd"> has irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this</span> +</span><span id="DataFrame.orderBy-485"><a href="#DataFrame.orderBy-485"><span class="linenos">485</span></a><span class="sd"> is unlikely to come up.</span> +</span><span id="DataFrame.orderBy-486"><a href="#DataFrame.orderBy-486"><span class="linenos">486</span></a><span class="sd"> """</span> +</span><span id="DataFrame.orderBy-487"><a href="#DataFrame.orderBy-487"><span class="linenos">487</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-488"><a href="#DataFrame.orderBy-488"><span class="linenos">488</span></a> <span class="n">pre_ordered_col_indexes</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.orderBy-489"><a href="#DataFrame.orderBy-489"><span class="linenos">489</span></a> <span class="n">x</span> +</span><span id="DataFrame.orderBy-490"><a href="#DataFrame.orderBy-490"><span class="linenos">490</span></a> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="DataFrame.orderBy-491"><a href="#DataFrame.orderBy-491"><span class="linenos">491</span></a> <span class="n">i</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="DataFrame.orderBy-492"><a href="#DataFrame.orderBy-492"><span class="linenos">492</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">col</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-493"><a href="#DataFrame.orderBy-493"><span class="linenos">493</span></a> <span class="p">]</span> +</span><span id="DataFrame.orderBy-494"><a href="#DataFrame.orderBy-494"><span class="linenos">494</span></a> <span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="DataFrame.orderBy-495"><a href="#DataFrame.orderBy-495"><span class="linenos">495</span></a> <span class="p">]</span> +</span><span id="DataFrame.orderBy-496"><a href="#DataFrame.orderBy-496"><span class="linenos">496</span></a> <span class="k">if</span> <span class="n">ascending</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrame.orderBy-497"><a href="#DataFrame.orderBy-497"><span class="linenos">497</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="kc">True</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-498"><a href="#DataFrame.orderBy-498"><span class="linenos">498</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ascending</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="DataFrame.orderBy-499"><a href="#DataFrame.orderBy-499"><span class="linenos">499</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="n">ascending</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-500"><a href="#DataFrame.orderBy-500"><span class="linenos">500</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="nb">bool</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">ascending</span><span class="p">)]</span> +</span><span id="DataFrame.orderBy-501"><a href="#DataFrame.orderBy-501"><span class="linenos">501</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span> +</span><span id="DataFrame.orderBy-502"><a href="#DataFrame.orderBy-502"><span class="linenos">502</span></a> <span class="n">ascending</span> +</span><span id="DataFrame.orderBy-503"><a href="#DataFrame.orderBy-503"><span class="linenos">503</span></a> <span class="p">),</span> <span class="s2">"The length of items in ascending must equal the number of columns provided"</span> +</span><span id="DataFrame.orderBy-504"><a href="#DataFrame.orderBy-504"><span class="linenos">504</span></a> <span class="n">col_and_ascending</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="n">ascending</span><span class="p">))</span> +</span><span id="DataFrame.orderBy-505"><a href="#DataFrame.orderBy-505"><span class="linenos">505</span></a> <span class="n">order_by_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.orderBy-506"><a href="#DataFrame.orderBy-506"><span class="linenos">506</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="ow">not</span> <span class="n">asc</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-507"><a href="#DataFrame.orderBy-507"><span class="linenos">507</span></a> <span class="k">if</span> <span class="n">i</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">pre_ordered_col_indexes</span> +</span><span id="DataFrame.orderBy-508"><a href="#DataFrame.orderBy-508"><span class="linenos">508</span></a> <span class="k">else</span> <span class="n">columns</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">column_expression</span> +</span><span id="DataFrame.orderBy-509"><a href="#DataFrame.orderBy-509"><span class="linenos">509</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">asc</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">col_and_ascending</span><span class="p">)</span> +</span><span id="DataFrame.orderBy-510"><a href="#DataFrame.orderBy-510"><span class="linenos">510</span></a> <span class="p">]</span> +</span><span id="DataFrame.orderBy-511"><a href="#DataFrame.orderBy-511"><span class="linenos">511</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="o">*</span><span class="n">order_by_columns</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>This implementation lets any ordered columns take priority over whatever is provided in <code>ascending</code>. Spark +has irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this +is unlikely to come up.</p> +</div> + + + </div> + <div id="DataFrame.sort" class="classattr"> + <input id="DataFrame.sort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.ORDER_BY)</div> + + <span class="def">def</span> + <span class="name">sort</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">ascending</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="n">Any</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.sort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.sort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.sort-476"><a href="#DataFrame.sort-476"><span class="linenos">476</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">)</span> +</span><span id="DataFrame.sort-477"><a href="#DataFrame.sort-477"><span class="linenos">477</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span> +</span><span id="DataFrame.sort-478"><a href="#DataFrame.sort-478"><span class="linenos">478</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.sort-479"><a href="#DataFrame.sort-479"><span class="linenos">479</span></a> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">],</span> +</span><span id="DataFrame.sort-480"><a href="#DataFrame.sort-480"><span class="linenos">480</span></a> <span class="n">ascending</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.sort-481"><a href="#DataFrame.sort-481"><span class="linenos">481</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.sort-482"><a href="#DataFrame.sort-482"><span class="linenos">482</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame.sort-483"><a href="#DataFrame.sort-483"><span class="linenos">483</span></a><span class="sd"> This implementation lets any ordered columns take priority over whatever is provided in `ascending`. Spark</span> +</span><span id="DataFrame.sort-484"><a href="#DataFrame.sort-484"><span class="linenos">484</span></a><span class="sd"> has irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this</span> +</span><span id="DataFrame.sort-485"><a href="#DataFrame.sort-485"><span class="linenos">485</span></a><span class="sd"> is unlikely to come up.</span> +</span><span id="DataFrame.sort-486"><a href="#DataFrame.sort-486"><span class="linenos">486</span></a><span class="sd"> """</span> +</span><span id="DataFrame.sort-487"><a href="#DataFrame.sort-487"><span class="linenos">487</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame.sort-488"><a href="#DataFrame.sort-488"><span class="linenos">488</span></a> <span class="n">pre_ordered_col_indexes</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.sort-489"><a href="#DataFrame.sort-489"><span class="linenos">489</span></a> <span class="n">x</span> +</span><span id="DataFrame.sort-490"><a href="#DataFrame.sort-490"><span class="linenos">490</span></a> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="DataFrame.sort-491"><a href="#DataFrame.sort-491"><span class="linenos">491</span></a> <span class="n">i</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="DataFrame.sort-492"><a href="#DataFrame.sort-492"><span class="linenos">492</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">col</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.sort-493"><a href="#DataFrame.sort-493"><span class="linenos">493</span></a> <span class="p">]</span> +</span><span id="DataFrame.sort-494"><a href="#DataFrame.sort-494"><span class="linenos">494</span></a> <span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="DataFrame.sort-495"><a href="#DataFrame.sort-495"><span class="linenos">495</span></a> <span class="p">]</span> +</span><span id="DataFrame.sort-496"><a href="#DataFrame.sort-496"><span class="linenos">496</span></a> <span class="k">if</span> <span class="n">ascending</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrame.sort-497"><a href="#DataFrame.sort-497"><span class="linenos">497</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="kc">True</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.sort-498"><a href="#DataFrame.sort-498"><span class="linenos">498</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ascending</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="DataFrame.sort-499"><a href="#DataFrame.sort-499"><span class="linenos">499</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="n">ascending</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.sort-500"><a href="#DataFrame.sort-500"><span class="linenos">500</span></a> <span class="n">ascending</span> <span class="o">=</span> <span class="p">[</span><span class="nb">bool</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">ascending</span><span class="p">)]</span> +</span><span id="DataFrame.sort-501"><a href="#DataFrame.sort-501"><span class="linenos">501</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span> +</span><span id="DataFrame.sort-502"><a href="#DataFrame.sort-502"><span class="linenos">502</span></a> <span class="n">ascending</span> +</span><span id="DataFrame.sort-503"><a href="#DataFrame.sort-503"><span class="linenos">503</span></a> <span class="p">),</span> <span class="s2">"The length of items in ascending must equal the number of columns provided"</span> +</span><span id="DataFrame.sort-504"><a href="#DataFrame.sort-504"><span class="linenos">504</span></a> <span class="n">col_and_ascending</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="n">ascending</span><span class="p">))</span> +</span><span id="DataFrame.sort-505"><a href="#DataFrame.sort-505"><span class="linenos">505</span></a> <span class="n">order_by_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.sort-506"><a href="#DataFrame.sort-506"><span class="linenos">506</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">col</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="ow">not</span> <span class="n">asc</span><span class="p">)</span> +</span><span id="DataFrame.sort-507"><a href="#DataFrame.sort-507"><span class="linenos">507</span></a> <span class="k">if</span> <span class="n">i</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">pre_ordered_col_indexes</span> +</span><span id="DataFrame.sort-508"><a href="#DataFrame.sort-508"><span class="linenos">508</span></a> <span class="k">else</span> <span class="n">columns</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">column_expression</span> +</span><span id="DataFrame.sort-509"><a href="#DataFrame.sort-509"><span class="linenos">509</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">asc</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">col_and_ascending</span><span class="p">)</span> +</span><span id="DataFrame.sort-510"><a href="#DataFrame.sort-510"><span class="linenos">510</span></a> <span class="p">]</span> +</span><span id="DataFrame.sort-511"><a href="#DataFrame.sort-511"><span class="linenos">511</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="o">*</span><span class="n">order_by_columns</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>This implementation lets any ordered columns take priority over whatever is provided in <code>ascending</code>. Spark +has irregular behavior and can result in runtime errors. Users shouldn't be mixing the two anyways so this +is unlikely to come up.</p> +</div> + + + </div> + <div id="DataFrame.union" class="classattr"> + <input id="DataFrame.union-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">union</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.union-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.union"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.union-515"><a href="#DataFrame.union-515"><span class="linenos">515</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.union-516"><a href="#DataFrame.union-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.union-517"><a href="#DataFrame.union-517"><span class="linenos">517</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.unionAll" class="classattr"> + <input id="DataFrame.unionAll-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">unionAll</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.unionAll-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.unionAll"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.unionAll-515"><a href="#DataFrame.unionAll-515"><span class="linenos">515</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.unionAll-516"><a href="#DataFrame.unionAll-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.unionAll-517"><a href="#DataFrame.unionAll-517"><span class="linenos">517</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.unionByName" class="classattr"> + <input id="DataFrame.unionByName-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">unionByName</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>,</span><span class="param"> <span class="n">allowMissingColumns</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="DataFrame.unionByName-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.unionByName"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.unionByName-521"><a href="#DataFrame.unionByName-521"><span class="linenos">521</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.unionByName-522"><a href="#DataFrame.unionByName-522"><span class="linenos">522</span></a> <span class="k">def</span> <span class="nf">unionByName</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> <span class="n">allowMissingColumns</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="DataFrame.unionByName-523"><a href="#DataFrame.unionByName-523"><span class="linenos">523</span></a> <span class="n">l_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> +</span><span id="DataFrame.unionByName-524"><a href="#DataFrame.unionByName-524"><span class="linenos">524</span></a> <span class="n">r_columns</span> <span class="o">=</span> <span class="n">other</span><span class="o">.</span><span class="n">columns</span> +</span><span id="DataFrame.unionByName-525"><a href="#DataFrame.unionByName-525"><span class="linenos">525</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">allowMissingColumns</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-526"><a href="#DataFrame.unionByName-526"><span class="linenos">526</span></a> <span class="n">l_expressions</span> <span class="o">=</span> <span class="n">l_columns</span> +</span><span id="DataFrame.unionByName-527"><a href="#DataFrame.unionByName-527"><span class="linenos">527</span></a> <span class="n">r_expressions</span> <span class="o">=</span> <span class="n">l_columns</span> +</span><span id="DataFrame.unionByName-528"><a href="#DataFrame.unionByName-528"><span class="linenos">528</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-529"><a href="#DataFrame.unionByName-529"><span class="linenos">529</span></a> <span class="n">l_expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame.unionByName-530"><a href="#DataFrame.unionByName-530"><span class="linenos">530</span></a> <span class="n">r_expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="DataFrame.unionByName-531"><a href="#DataFrame.unionByName-531"><span class="linenos">531</span></a> <span class="n">r_columns_unused</span> <span class="o">=</span> <span class="n">copy</span><span class="p">(</span><span class="n">r_columns</span><span class="p">)</span> +</span><span id="DataFrame.unionByName-532"><a href="#DataFrame.unionByName-532"><span class="linenos">532</span></a> <span class="k">for</span> <span class="n">l_column</span> <span class="ow">in</span> <span class="n">l_columns</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-533"><a href="#DataFrame.unionByName-533"><span class="linenos">533</span></a> <span class="n">l_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">l_column</span><span class="p">)</span> +</span><span id="DataFrame.unionByName-534"><a href="#DataFrame.unionByName-534"><span class="linenos">534</span></a> <span class="k">if</span> <span class="n">l_column</span> <span class="ow">in</span> <span class="n">r_columns</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-535"><a href="#DataFrame.unionByName-535"><span class="linenos">535</span></a> <span class="n">r_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">l_column</span><span class="p">)</span> +</span><span id="DataFrame.unionByName-536"><a href="#DataFrame.unionByName-536"><span class="linenos">536</span></a> <span class="n">r_columns_unused</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">l_column</span><span class="p">)</span> +</span><span id="DataFrame.unionByName-537"><a href="#DataFrame.unionByName-537"><span class="linenos">537</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-538"><a href="#DataFrame.unionByName-538"><span class="linenos">538</span></a> <span class="n">r_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">(),</span> <span class="n">l_column</span><span class="p">))</span> +</span><span id="DataFrame.unionByName-539"><a href="#DataFrame.unionByName-539"><span class="linenos">539</span></a> <span class="k">for</span> <span class="n">r_column</span> <span class="ow">in</span> <span class="n">r_columns_unused</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-540"><a href="#DataFrame.unionByName-540"><span class="linenos">540</span></a> <span class="n">l_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">(),</span> <span class="n">r_column</span><span class="p">))</span> +</span><span id="DataFrame.unionByName-541"><a href="#DataFrame.unionByName-541"><span class="linenos">541</span></a> <span class="n">r_expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">r_column</span><span class="p">)</span> +</span><span id="DataFrame.unionByName-542"><a href="#DataFrame.unionByName-542"><span class="linenos">542</span></a> <span class="n">r_df</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame.unionByName-543"><a href="#DataFrame.unionByName-543"><span class="linenos">543</span></a> <span class="n">other</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">r_expressions</span><span class="p">))</span> +</span><span id="DataFrame.unionByName-544"><a href="#DataFrame.unionByName-544"><span class="linenos">544</span></a> <span class="p">)</span> +</span><span id="DataFrame.unionByName-545"><a href="#DataFrame.unionByName-545"><span class="linenos">545</span></a> <span class="n">l_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.unionByName-546"><a href="#DataFrame.unionByName-546"><span class="linenos">546</span></a> <span class="k">if</span> <span class="n">allowMissingColumns</span><span class="p">:</span> +</span><span id="DataFrame.unionByName-547"><a href="#DataFrame.unionByName-547"><span class="linenos">547</span></a> <span class="n">l_df</span> <span class="o">=</span> <span class="n">l_df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">l_expressions</span><span class="p">))</span> +</span><span id="DataFrame.unionByName-548"><a href="#DataFrame.unionByName-548"><span class="linenos">548</span></a> <span class="k">return</span> <span class="n">l_df</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">r_df</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.intersect" class="classattr"> + <input id="DataFrame.intersect-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">intersect</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.intersect-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.intersect"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.intersect-550"><a href="#DataFrame.intersect-550"><span class="linenos">550</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.intersect-551"><a href="#DataFrame.intersect-551"><span class="linenos">551</span></a> <span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.intersect-552"><a href="#DataFrame.intersect-552"><span class="linenos">552</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.intersectAll" class="classattr"> + <input id="DataFrame.intersectAll-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">intersectAll</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.intersectAll-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.intersectAll"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.intersectAll-554"><a href="#DataFrame.intersectAll-554"><span class="linenos">554</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.intersectAll-555"><a href="#DataFrame.intersectAll-555"><span class="linenos">555</span></a> <span class="k">def</span> <span class="nf">intersectAll</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.intersectAll-556"><a href="#DataFrame.intersectAll-556"><span class="linenos">556</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.exceptAll" class="classattr"> + <input id="DataFrame.exceptAll-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">exceptAll</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.exceptAll-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.exceptAll"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.exceptAll-558"><a href="#DataFrame.exceptAll-558"><span class="linenos">558</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.exceptAll-559"><a href="#DataFrame.exceptAll-559"><span class="linenos">559</span></a> <span class="k">def</span> <span class="nf">exceptAll</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.exceptAll-560"><a href="#DataFrame.exceptAll-560"><span class="linenos">560</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_operation</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">,</span> <span class="n">other</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.distinct" class="classattr"> + <input id="DataFrame.distinct-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">distinct</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.distinct-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.distinct"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.distinct-562"><a href="#DataFrame.distinct-562"><span class="linenos">562</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.distinct-563"><a href="#DataFrame.distinct-563"><span class="linenos">563</span></a> <span class="k">def</span> <span class="nf">distinct</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.distinct-564"><a href="#DataFrame.distinct-564"><span class="linenos">564</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">distinct</span><span class="p">())</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.dropDuplicates" class="classattr"> + <input id="DataFrame.dropDuplicates-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">dropDuplicates</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">subset</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="DataFrame.dropDuplicates-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.dropDuplicates"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.dropDuplicates-566"><a href="#DataFrame.dropDuplicates-566"><span class="linenos">566</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.dropDuplicates-567"><a href="#DataFrame.dropDuplicates-567"><span class="linenos">567</span></a> <span class="k">def</span> <span class="nf">dropDuplicates</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span> +</span><span id="DataFrame.dropDuplicates-568"><a href="#DataFrame.dropDuplicates-568"><span class="linenos">568</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">subset</span><span class="p">:</span> +</span><span id="DataFrame.dropDuplicates-569"><a href="#DataFrame.dropDuplicates-569"><span class="linenos">569</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span><span class="p">()</span> +</span><span id="DataFrame.dropDuplicates-570"><a href="#DataFrame.dropDuplicates-570"><span class="linenos">570</span></a> <span class="n">column_names</span> <span class="o">=</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> +</span><span id="DataFrame.dropDuplicates-571"><a href="#DataFrame.dropDuplicates-571"><span class="linenos">571</span></a> <span class="n">window</span> <span class="o">=</span> <span class="n">Window</span><span class="o">.</span><span class="n">partitionBy</span><span class="p">(</span><span class="o">*</span><span class="n">column_names</span><span class="p">)</span><span class="o">.</span><span class="n">orderBy</span><span class="p">(</span><span class="o">*</span><span class="n">column_names</span><span class="p">)</span> +</span><span id="DataFrame.dropDuplicates-572"><a href="#DataFrame.dropDuplicates-572"><span class="linenos">572</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="DataFrame.dropDuplicates-573"><a href="#DataFrame.dropDuplicates-573"><span class="linenos">573</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.dropDuplicates-574"><a href="#DataFrame.dropDuplicates-574"><span class="linenos">574</span></a> <span class="o">.</span><span class="n">withColumn</span><span class="p">(</span><span class="s2">"row_num"</span><span class="p">,</span> <span class="n">F</span><span class="o">.</span><span class="n">row_number</span><span class="p">()</span><span class="o">.</span><span class="n">over</span><span class="p">(</span><span class="n">window</span><span class="p">))</span> +</span><span id="DataFrame.dropDuplicates-575"><a href="#DataFrame.dropDuplicates-575"><span class="linenos">575</span></a> <span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"row_num"</span><span class="p">)</span> <span class="o">==</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span> +</span><span id="DataFrame.dropDuplicates-576"><a href="#DataFrame.dropDuplicates-576"><span class="linenos">576</span></a> <span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="s2">"row_num"</span><span class="p">)</span> +</span><span id="DataFrame.dropDuplicates-577"><a href="#DataFrame.dropDuplicates-577"><span class="linenos">577</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.dropna" class="classattr"> + <input id="DataFrame.dropna-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">dropna</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">'any'</span>,</span><span class="param"> <span class="n">thresh</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">subset</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.dropna-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.dropna"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.dropna-579"><a href="#DataFrame.dropna-579"><span class="linenos">579</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.dropna-580"><a href="#DataFrame.dropna-580"><span class="linenos">580</span></a> <span class="k">def</span> <span class="nf">dropna</span><span class="p">(</span> +</span><span id="DataFrame.dropna-581"><a href="#DataFrame.dropna-581"><span class="linenos">581</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.dropna-582"><a href="#DataFrame.dropna-582"><span class="linenos">582</span></a> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="DataFrame.dropna-583"><a href="#DataFrame.dropna-583"><span class="linenos">583</span></a> <span class="n">thresh</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.dropna-584"><a href="#DataFrame.dropna-584"><span class="linenos">584</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.dropna-585"><a href="#DataFrame.dropna-585"><span class="linenos">585</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.dropna-586"><a href="#DataFrame.dropna-586"><span class="linenos">586</span></a> <span class="n">minimum_non_null</span> <span class="o">=</span> <span class="n">thresh</span> <span class="ow">or</span> <span class="mi">0</span> <span class="c1"># will be determined later if thresh is null</span> +</span><span id="DataFrame.dropna-587"><a href="#DataFrame.dropna-587"><span class="linenos">587</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.dropna-588"><a href="#DataFrame.dropna-588"><span class="linenos">588</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.dropna-589"><a href="#DataFrame.dropna-589"><span class="linenos">589</span></a> <span class="k">if</span> <span class="n">subset</span><span class="p">:</span> +</span><span id="DataFrame.dropna-590"><a href="#DataFrame.dropna-590"><span class="linenos">590</span></a> <span class="n">null_check_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> +</span><span id="DataFrame.dropna-591"><a href="#DataFrame.dropna-591"><span class="linenos">591</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.dropna-592"><a href="#DataFrame.dropna-592"><span class="linenos">592</span></a> <span class="n">null_check_columns</span> <span class="o">=</span> <span class="n">all_columns</span> +</span><span id="DataFrame.dropna-593"><a href="#DataFrame.dropna-593"><span class="linenos">593</span></a> <span class="k">if</span> <span class="n">thresh</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrame.dropna-594"><a href="#DataFrame.dropna-594"><span class="linenos">594</span></a> <span class="n">minimum_num_nulls</span> <span class="o">=</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">how</span> <span class="o">==</span> <span class="s2">"any"</span> <span class="k">else</span> <span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">)</span> +</span><span id="DataFrame.dropna-595"><a href="#DataFrame.dropna-595"><span class="linenos">595</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.dropna-596"><a href="#DataFrame.dropna-596"><span class="linenos">596</span></a> <span class="n">minimum_num_nulls</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">)</span> <span class="o">-</span> <span class="n">minimum_non_null</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="DataFrame.dropna-597"><a href="#DataFrame.dropna-597"><span class="linenos">597</span></a> <span class="k">if</span> <span class="n">minimum_num_nulls</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">):</span> +</span><span id="DataFrame.dropna-598"><a href="#DataFrame.dropna-598"><span class="linenos">598</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span> +</span><span id="DataFrame.dropna-599"><a href="#DataFrame.dropna-599"><span class="linenos">599</span></a> <span class="sa">f</span><span class="s2">"The minimum num nulls for dropna must be less than or equal to the number of columns. "</span> +</span><span id="DataFrame.dropna-600"><a href="#DataFrame.dropna-600"><span class="linenos">600</span></a> <span class="sa">f</span><span class="s2">"Minimum num nulls: </span><span class="si">{</span><span class="n">minimum_num_nulls</span><span class="si">}</span><span class="s2">, Num Columns: </span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">null_check_columns</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="DataFrame.dropna-601"><a href="#DataFrame.dropna-601"><span class="linenos">601</span></a> <span class="p">)</span> +</span><span id="DataFrame.dropna-602"><a href="#DataFrame.dropna-602"><span class="linenos">602</span></a> <span class="n">if_null_checks</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.dropna-603"><a href="#DataFrame.dropna-603"><span class="linenos">603</span></a> <span class="n">F</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">isNull</span><span class="p">(),</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">null_check_columns</span> +</span><span id="DataFrame.dropna-604"><a href="#DataFrame.dropna-604"><span class="linenos">604</span></a> <span class="p">]</span> +</span><span id="DataFrame.dropna-605"><a href="#DataFrame.dropna-605"><span class="linenos">605</span></a> <span class="n">nulls_added_together</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">,</span> <span class="n">if_null_checks</span><span class="p">)</span> +</span><span id="DataFrame.dropna-606"><a href="#DataFrame.dropna-606"><span class="linenos">606</span></a> <span class="n">num_nulls</span> <span class="o">=</span> <span class="n">nulls_added_together</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"num_nulls"</span><span class="p">)</span> +</span><span id="DataFrame.dropna-607"><a href="#DataFrame.dropna-607"><span class="linenos">607</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">num_nulls</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrame.dropna-608"><a href="#DataFrame.dropna-608"><span class="linenos">608</span></a> <span class="n">filtered_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">col</span><span class="p">(</span><span class="s2">"num_nulls"</span><span class="p">)</span> <span class="o"><</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">minimum_num_nulls</span><span class="p">))</span> +</span><span id="DataFrame.dropna-609"><a href="#DataFrame.dropna-609"><span class="linenos">609</span></a> <span class="n">final_df</span> <span class="o">=</span> <span class="n">filtered_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="DataFrame.dropna-610"><a href="#DataFrame.dropna-610"><span class="linenos">610</span></a> <span class="k">return</span> <span class="n">final_df</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.fillna" class="classattr"> + <input id="DataFrame.fillna-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">fillna</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331804992'</span><span class="o">></span>,</span><span class="param"> <span class="n">subset</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.fillna-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.fillna"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.fillna-612"><a href="#DataFrame.fillna-612"><span class="linenos">612</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.fillna-613"><a href="#DataFrame.fillna-613"><span class="linenos">613</span></a> <span class="k">def</span> <span class="nf">fillna</span><span class="p">(</span> +</span><span id="DataFrame.fillna-614"><a href="#DataFrame.fillna-614"><span class="linenos">614</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.fillna-615"><a href="#DataFrame.fillna-615"><span class="linenos">615</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnLiterals</span><span class="p">],</span> +</span><span id="DataFrame.fillna-616"><a href="#DataFrame.fillna-616"><span class="linenos">616</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.fillna-617"><a href="#DataFrame.fillna-617"><span class="linenos">617</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.fillna-618"><a href="#DataFrame.fillna-618"><span class="linenos">618</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame.fillna-619"><a href="#DataFrame.fillna-619"><span class="linenos">619</span></a><span class="sd"> Functionality Difference: If you provide a value to replace a null and that type conflicts</span> +</span><span id="DataFrame.fillna-620"><a href="#DataFrame.fillna-620"><span class="linenos">620</span></a><span class="sd"> with the type of the column then PySpark will just ignore your replacement.</span> +</span><span id="DataFrame.fillna-621"><a href="#DataFrame.fillna-621"><span class="linenos">621</span></a><span class="sd"> This will try to cast them to be the same in some cases. So they won't always match.</span> +</span><span id="DataFrame.fillna-622"><a href="#DataFrame.fillna-622"><span class="linenos">622</span></a><span class="sd"> Best to not mix types so make sure replacement is the same type as the column</span> +</span><span id="DataFrame.fillna-623"><a href="#DataFrame.fillna-623"><span class="linenos">623</span></a> +</span><span id="DataFrame.fillna-624"><a href="#DataFrame.fillna-624"><span class="linenos">624</span></a><span class="sd"> Possibility for improvement: Use `typeof` function to get the type of the column</span> +</span><span id="DataFrame.fillna-625"><a href="#DataFrame.fillna-625"><span class="linenos">625</span></a><span class="sd"> and check if it matches the type of the value provided. If not then make it null.</span> +</span><span id="DataFrame.fillna-626"><a href="#DataFrame.fillna-626"><span class="linenos">626</span></a><span class="sd"> """</span> +</span><span id="DataFrame.fillna-627"><a href="#DataFrame.fillna-627"><span class="linenos">627</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="DataFrame.fillna-628"><a href="#DataFrame.fillna-628"><span class="linenos">628</span></a> +</span><span id="DataFrame.fillna-629"><a href="#DataFrame.fillna-629"><span class="linenos">629</span></a> <span class="n">values</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="DataFrame.fillna-630"><a href="#DataFrame.fillna-630"><span class="linenos">630</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="DataFrame.fillna-631"><a href="#DataFrame.fillna-631"><span class="linenos">631</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.fillna-632"><a href="#DataFrame.fillna-632"><span class="linenos">632</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.fillna-633"><a href="#DataFrame.fillna-633"><span class="linenos">633</span></a> <span class="n">all_column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span><span class="p">}</span> +</span><span id="DataFrame.fillna-634"><a href="#DataFrame.fillna-634"><span class="linenos">634</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="DataFrame.fillna-635"><a href="#DataFrame.fillna-635"><span class="linenos">635</span></a> <span class="n">values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="DataFrame.fillna-636"><a href="#DataFrame.fillna-636"><span class="linenos">636</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">value</span><span class="p">))</span> +</span><span id="DataFrame.fillna-637"><a href="#DataFrame.fillna-637"><span class="linenos">637</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="DataFrame.fillna-638"><a href="#DataFrame.fillna-638"><span class="linenos">638</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> <span class="k">if</span> <span class="n">subset</span> <span class="k">else</span> <span class="n">all_columns</span> +</span><span id="DataFrame.fillna-639"><a href="#DataFrame.fillna-639"><span class="linenos">639</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">values</span><span class="p">:</span> +</span><span id="DataFrame.fillna-640"><a href="#DataFrame.fillna-640"><span class="linenos">640</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.fillna-641"><a href="#DataFrame.fillna-641"><span class="linenos">641</span></a> <span class="n">value_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">]</span> +</span><span id="DataFrame.fillna-642"><a href="#DataFrame.fillna-642"><span class="linenos">642</span></a> +</span><span id="DataFrame.fillna-643"><a href="#DataFrame.fillna-643"><span class="linenos">643</span></a> <span class="n">null_replacement_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataFrame.fillna-644"><a href="#DataFrame.fillna-644"><span class="linenos">644</span></a> <span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="p">(</span> +</span><span id="DataFrame.fillna-645"><a href="#DataFrame.fillna-645"><span class="linenos">645</span></a> <span class="n">F</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">isNull</span><span class="p">(),</span> <span class="n">value</span><span class="p">)</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">column</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> +</span><span id="DataFrame.fillna-646"><a href="#DataFrame.fillna-646"><span class="linenos">646</span></a> <span class="p">)</span> +</span><span id="DataFrame.fillna-647"><a href="#DataFrame.fillna-647"><span class="linenos">647</span></a> <span class="k">for</span> <span class="n">column</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="n">value_columns</span><span class="p">)</span> +</span><span id="DataFrame.fillna-648"><a href="#DataFrame.fillna-648"><span class="linenos">648</span></a> <span class="p">}</span> +</span><span id="DataFrame.fillna-649"><a href="#DataFrame.fillna-649"><span class="linenos">649</span></a> <span class="n">null_replacement_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">all_column_mapping</span><span class="p">,</span> <span class="o">**</span><span class="n">null_replacement_mapping</span><span class="p">}</span> +</span><span id="DataFrame.fillna-650"><a href="#DataFrame.fillna-650"><span class="linenos">650</span></a> <span class="n">null_replacement_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.fillna-651"><a href="#DataFrame.fillna-651"><span class="linenos">651</span></a> <span class="n">null_replacement_mapping</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span> +</span><span id="DataFrame.fillna-652"><a href="#DataFrame.fillna-652"><span class="linenos">652</span></a> <span class="p">]</span> +</span><span id="DataFrame.fillna-653"><a href="#DataFrame.fillna-653"><span class="linenos">653</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">null_replacement_columns</span><span class="p">)</span> +</span><span id="DataFrame.fillna-654"><a href="#DataFrame.fillna-654"><span class="linenos">654</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span></pre></div> + + + <div class="docstring"><p>Functionality Difference: If you provide a value to replace a null and that type conflicts +with the type of the column then PySpark will just ignore your replacement. +This will try to cast them to be the same in some cases. So they won't always match. +Best to not mix types so make sure replacement is the same type as the column</p> + +<p>Possibility for improvement: Use <code>typeof</code> function to get the type of the column +and check if it matches the type of the value provided. If not then make it null.</p> +</div> + + + </div> + <div id="DataFrame.replace" class="classattr"> + <input id="DataFrame.replace-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.FROM)</div> + + <span class="def">def</span> + <span class="name">replace</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">to_replace</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span><span class="p">]</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">subset</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Collection</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331990208'</span><span class="o">></span><span class="p">],</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331990208'</span><span class="o">></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.replace-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.replace"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.replace-656"><a href="#DataFrame.replace-656"><span class="linenos">656</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="DataFrame.replace-657"><a href="#DataFrame.replace-657"><span class="linenos">657</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span> +</span><span id="DataFrame.replace-658"><a href="#DataFrame.replace-658"><span class="linenos">658</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrame.replace-659"><a href="#DataFrame.replace-659"><span class="linenos">659</span></a> <span class="n">to_replace</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">],</span> +</span><span id="DataFrame.replace-660"><a href="#DataFrame.replace-660"><span class="linenos">660</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.replace-661"><a href="#DataFrame.replace-661"><span class="linenos">661</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]</span> <span class="o">|</span> <span class="n">ColumnOrName</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrame.replace-662"><a href="#DataFrame.replace-662"><span class="linenos">662</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.replace-663"><a href="#DataFrame.replace-663"><span class="linenos">663</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="DataFrame.replace-664"><a href="#DataFrame.replace-664"><span class="linenos">664</span></a> +</span><span id="DataFrame.replace-665"><a href="#DataFrame.replace-665"><span class="linenos">665</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="DataFrame.replace-666"><a href="#DataFrame.replace-666"><span class="linenos">666</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.replace-667"><a href="#DataFrame.replace-667"><span class="linenos">667</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="n">new_df</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.replace-668"><a href="#DataFrame.replace-668"><span class="linenos">668</span></a> <span class="n">all_column_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span><span class="p">}</span> +</span><span id="DataFrame.replace-669"><a href="#DataFrame.replace-669"><span class="linenos">669</span></a> +</span><span id="DataFrame.replace-670"><a href="#DataFrame.replace-670"><span class="linenos">670</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> <span class="k">if</span> <span class="n">subset</span> <span class="k">else</span> <span class="n">all_columns</span> +</span><span id="DataFrame.replace-671"><a href="#DataFrame.replace-671"><span class="linenos">671</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">to_replace</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="DataFrame.replace-672"><a href="#DataFrame.replace-672"><span class="linenos">672</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">to_replace</span><span class="p">)</span> +</span><span id="DataFrame.replace-673"><a href="#DataFrame.replace-673"><span class="linenos">673</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">to_replace</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="DataFrame.replace-674"><a href="#DataFrame.replace-674"><span class="linenos">674</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="n">old_values</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">to_replace</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="DataFrame.replace-675"><a href="#DataFrame.replace-675"><span class="linenos">675</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">list</span><span class="p">),</span> <span class="s2">"value must be a list since the replacements are a list"</span> +</span><span id="DataFrame.replace-676"><a href="#DataFrame.replace-676"><span class="linenos">676</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">to_replace</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span> +</span><span id="DataFrame.replace-677"><a href="#DataFrame.replace-677"><span class="linenos">677</span></a> <span class="n">value</span> +</span><span id="DataFrame.replace-678"><a href="#DataFrame.replace-678"><span class="linenos">678</span></a> <span class="p">),</span> <span class="s2">"the replacements and values must be the same length"</span> +</span><span id="DataFrame.replace-679"><a href="#DataFrame.replace-679"><span class="linenos">679</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="n">to_replace</span> +</span><span id="DataFrame.replace-680"><a href="#DataFrame.replace-680"><span class="linenos">680</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="DataFrame.replace-681"><a href="#DataFrame.replace-681"><span class="linenos">681</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.replace-682"><a href="#DataFrame.replace-682"><span class="linenos">682</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">to_replace</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.replace-683"><a href="#DataFrame.replace-683"><span class="linenos">683</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrame.replace-684"><a href="#DataFrame.replace-684"><span class="linenos">684</span></a> <span class="n">old_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">old_values</span><span class="p">]</span> +</span><span id="DataFrame.replace-685"><a href="#DataFrame.replace-685"><span class="linenos">685</span></a> <span class="n">new_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">new_values</span><span class="p">]</span> +</span><span id="DataFrame.replace-686"><a href="#DataFrame.replace-686"><span class="linenos">686</span></a> +</span><span id="DataFrame.replace-687"><a href="#DataFrame.replace-687"><span class="linenos">687</span></a> <span class="n">replacement_mapping</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="DataFrame.replace-688"><a href="#DataFrame.replace-688"><span class="linenos">688</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="DataFrame.replace-689"><a href="#DataFrame.replace-689"><span class="linenos">689</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">Column</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> +</span><span id="DataFrame.replace-690"><a href="#DataFrame.replace-690"><span class="linenos">690</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">old_value</span><span class="p">,</span> <span class="n">new_value</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">old_values</span><span class="p">,</span> <span class="n">new_values</span><span class="p">)):</span> +</span><span id="DataFrame.replace-691"><a href="#DataFrame.replace-691"><span class="linenos">691</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="DataFrame.replace-692"><a href="#DataFrame.replace-692"><span class="linenos">692</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">F</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span> <span class="o">==</span> <span class="n">old_value</span><span class="p">,</span> <span class="n">new_value</span><span class="p">)</span> +</span><span id="DataFrame.replace-693"><a href="#DataFrame.replace-693"><span class="linenos">693</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.replace-694"><a href="#DataFrame.replace-694"><span class="linenos">694</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">when</span><span class="p">(</span><span class="n">column</span> <span class="o">==</span> <span class="n">old_value</span><span class="p">,</span> <span class="n">new_value</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="DataFrame.replace-695"><a href="#DataFrame.replace-695"><span class="linenos">695</span></a> <span class="n">replacement_mapping</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">otherwise</span><span class="p">(</span><span class="n">column</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span> +</span><span id="DataFrame.replace-696"><a href="#DataFrame.replace-696"><span class="linenos">696</span></a> <span class="n">column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="DataFrame.replace-697"><a href="#DataFrame.replace-697"><span class="linenos">697</span></a> <span class="p">)</span> +</span><span id="DataFrame.replace-698"><a href="#DataFrame.replace-698"><span class="linenos">698</span></a> +</span><span id="DataFrame.replace-699"><a href="#DataFrame.replace-699"><span class="linenos">699</span></a> <span class="n">replacement_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">all_column_mapping</span><span class="p">,</span> <span class="o">**</span><span class="n">replacement_mapping</span><span class="p">}</span> +</span><span id="DataFrame.replace-700"><a href="#DataFrame.replace-700"><span class="linenos">700</span></a> <span class="n">replacement_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">replacement_mapping</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">all_columns</span><span class="p">]</span> +</span><span id="DataFrame.replace-701"><a href="#DataFrame.replace-701"><span class="linenos">701</span></a> <span class="n">new_df</span> <span class="o">=</span> <span class="n">new_df</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">replacement_columns</span><span class="p">)</span> +</span><span id="DataFrame.replace-702"><a href="#DataFrame.replace-702"><span class="linenos">702</span></a> <span class="k">return</span> <span class="n">new_df</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.withColumn" class="classattr"> + <input id="DataFrame.withColumn-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">withColumn</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">colName</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">col</span><span class="p">:</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.withColumn-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.withColumn"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.withColumn-704"><a href="#DataFrame.withColumn-704"><span class="linenos">704</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.withColumn-705"><a href="#DataFrame.withColumn-705"><span class="linenos">705</span></a> <span class="k">def</span> <span class="nf">withColumn</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">colName</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">col</span><span class="p">:</span> <span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.withColumn-706"><a href="#DataFrame.withColumn-706"><span class="linenos">706</span></a> <span class="n">col</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_col</span><span class="p">(</span><span class="n">col</span><span class="p">)</span> +</span><span id="DataFrame.withColumn-707"><a href="#DataFrame.withColumn-707"><span class="linenos">707</span></a> <span class="n">existing_col_names</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="DataFrame.withColumn-708"><a href="#DataFrame.withColumn-708"><span class="linenos">708</span></a> <span class="n">existing_col_index</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame.withColumn-709"><a href="#DataFrame.withColumn-709"><span class="linenos">709</span></a> <span class="n">existing_col_names</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">colName</span><span class="p">)</span> <span class="k">if</span> <span class="n">colName</span> <span class="ow">in</span> <span class="n">existing_col_names</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="DataFrame.withColumn-710"><a href="#DataFrame.withColumn-710"><span class="linenos">710</span></a> <span class="p">)</span> +</span><span id="DataFrame.withColumn-711"><a href="#DataFrame.withColumn-711"><span class="linenos">711</span></a> <span class="k">if</span> <span class="n">existing_col_index</span><span class="p">:</span> +</span><span id="DataFrame.withColumn-712"><a href="#DataFrame.withColumn-712"><span class="linenos">712</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.withColumn-713"><a href="#DataFrame.withColumn-713"><span class="linenos">713</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="n">existing_col_index</span><span class="p">]</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">expression</span> +</span><span id="DataFrame.withColumn-714"><a href="#DataFrame.withColumn-714"><span class="linenos">714</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.withColumn-715"><a href="#DataFrame.withColumn-715"><span class="linenos">715</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">colName</span><span class="p">),</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.withColumnRenamed" class="classattr"> + <input id="DataFrame.withColumnRenamed-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">withColumnRenamed</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">existing</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="n">new</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="DataFrame.withColumnRenamed-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.withColumnRenamed"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.withColumnRenamed-717"><a href="#DataFrame.withColumnRenamed-717"><span class="linenos">717</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.withColumnRenamed-718"><a href="#DataFrame.withColumnRenamed-718"><span class="linenos">718</span></a> <span class="k">def</span> <span class="nf">withColumnRenamed</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">existing</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">new</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="DataFrame.withColumnRenamed-719"><a href="#DataFrame.withColumnRenamed-719"><span class="linenos">719</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="DataFrame.withColumnRenamed-720"><a href="#DataFrame.withColumnRenamed-720"><span class="linenos">720</span></a> <span class="n">existing_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.withColumnRenamed-721"><a href="#DataFrame.withColumnRenamed-721"><span class="linenos">721</span></a> <span class="n">expression</span> +</span><span id="DataFrame.withColumnRenamed-722"><a href="#DataFrame.withColumnRenamed-722"><span class="linenos">722</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="DataFrame.withColumnRenamed-723"><a href="#DataFrame.withColumnRenamed-723"><span class="linenos">723</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="n">existing</span> +</span><span id="DataFrame.withColumnRenamed-724"><a href="#DataFrame.withColumnRenamed-724"><span class="linenos">724</span></a> <span class="p">]</span> +</span><span id="DataFrame.withColumnRenamed-725"><a href="#DataFrame.withColumnRenamed-725"><span class="linenos">725</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">existing_columns</span><span class="p">:</span> +</span><span id="DataFrame.withColumnRenamed-726"><a href="#DataFrame.withColumnRenamed-726"><span class="linenos">726</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Tried to rename a column that doesn't exist"</span><span class="p">)</span> +</span><span id="DataFrame.withColumnRenamed-727"><a href="#DataFrame.withColumnRenamed-727"><span class="linenos">727</span></a> <span class="k">for</span> <span class="n">existing_column</span> <span class="ow">in</span> <span class="n">existing_columns</span><span class="p">:</span> +</span><span id="DataFrame.withColumnRenamed-728"><a href="#DataFrame.withColumnRenamed-728"><span class="linenos">728</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">existing_column</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="DataFrame.withColumnRenamed-729"><a href="#DataFrame.withColumnRenamed-729"><span class="linenos">729</span></a> <span class="n">existing_column</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">existing_column</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">new</span><span class="p">))</span> +</span><span id="DataFrame.withColumnRenamed-730"><a href="#DataFrame.withColumnRenamed-730"><span class="linenos">730</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataFrame.withColumnRenamed-731"><a href="#DataFrame.withColumnRenamed-731"><span class="linenos">731</span></a> <span class="n">existing_column</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">new</span><span class="p">))</span> +</span><span id="DataFrame.withColumnRenamed-732"><a href="#DataFrame.withColumnRenamed-732"><span class="linenos">732</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.drop" class="classattr"> + <input id="DataFrame.drop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">drop</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.drop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.drop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.drop-734"><a href="#DataFrame.drop-734"><span class="linenos">734</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="DataFrame.drop-735"><a href="#DataFrame.drop-735"><span class="linenos">735</span></a> <span class="k">def</span> <span class="nf">drop</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.drop-736"><a href="#DataFrame.drop-736"><span class="linenos">736</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_outer_select_columns</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="DataFrame.drop-737"><a href="#DataFrame.drop-737"><span class="linenos">737</span></a> <span class="n">drop_cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame.drop-738"><a href="#DataFrame.drop-738"><span class="linenos">738</span></a> <span class="n">new_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="DataFrame.drop-739"><a href="#DataFrame.drop-739"><span class="linenos">739</span></a> <span class="n">col</span> +</span><span id="DataFrame.drop-740"><a href="#DataFrame.drop-740"><span class="linenos">740</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">all_columns</span> +</span><span id="DataFrame.drop-741"><a href="#DataFrame.drop-741"><span class="linenos">741</span></a> <span class="k">if</span> <span class="n">col</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="n">drop_column</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">drop_column</span> <span class="ow">in</span> <span class="n">drop_cols</span><span class="p">]</span> +</span><span id="DataFrame.drop-742"><a href="#DataFrame.drop-742"><span class="linenos">742</span></a> <span class="p">]</span> +</span><span id="DataFrame.drop-743"><a href="#DataFrame.drop-743"><span class="linenos">743</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">new_columns</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.limit" class="classattr"> + <input id="DataFrame.limit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.LIMIT)</div> + + <span class="def">def</span> + <span class="name">limit</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">num</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.limit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.limit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.limit-745"><a href="#DataFrame.limit-745"><span class="linenos">745</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">LIMIT</span><span class="p">)</span> +</span><span id="DataFrame.limit-746"><a href="#DataFrame.limit-746"><span class="linenos">746</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">num</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.limit-747"><a href="#DataFrame.limit-747"><span class="linenos">747</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="n">num</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.hint" class="classattr"> + <input id="DataFrame.hint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.NO_OP)</div> + + <span class="def">def</span> + <span class="name">hint</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="o">*</span><span class="n">parameters</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.hint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.hint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.hint-749"><a href="#DataFrame.hint-749"><span class="linenos">749</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame.hint-750"><a href="#DataFrame.hint-750"><span class="linenos">750</span></a> <span class="k">def</span> <span class="nf">hint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">*</span><span class="n">parameters</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.hint-751"><a href="#DataFrame.hint-751"><span class="linenos">751</span></a> <span class="n">parameter_list</span> <span class="o">=</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">parameters</span><span class="p">)</span> +</span><span id="DataFrame.hint-752"><a href="#DataFrame.hint-752"><span class="linenos">752</span></a> <span class="n">parameter_columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="DataFrame.hint-753"><a href="#DataFrame.hint-753"><span class="linenos">753</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">parameter_list</span><span class="p">)</span> +</span><span id="DataFrame.hint-754"><a href="#DataFrame.hint-754"><span class="linenos">754</span></a> <span class="k">if</span> <span class="n">parameters</span> +</span><span id="DataFrame.hint-755"><a href="#DataFrame.hint-755"><span class="linenos">755</span></a> <span class="k">else</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_cols</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">sequence_id</span><span class="p">])</span> +</span><span id="DataFrame.hint-756"><a href="#DataFrame.hint-756"><span class="linenos">756</span></a> <span class="p">)</span> +</span><span id="DataFrame.hint-757"><a href="#DataFrame.hint-757"><span class="linenos">757</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hint</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">parameter_columns</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.repartition" class="classattr"> + <input id="DataFrame.repartition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.NO_OP)</div> + + <span class="def">def</span> + <span class="name">repartition</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">numPartitions</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700332136032'</span><span class="o">></span><span class="p">]</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700332245248'</span><span class="o">></span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.repartition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.repartition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.repartition-759"><a href="#DataFrame.repartition-759"><span class="linenos">759</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame.repartition-760"><a href="#DataFrame.repartition-760"><span class="linenos">760</span></a> <span class="k">def</span> <span class="nf">repartition</span><span class="p">(</span> +</span><span id="DataFrame.repartition-761"><a href="#DataFrame.repartition-761"><span class="linenos">761</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">numPartitions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">ColumnOrName</span><span class="p">],</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">ColumnOrName</span> +</span><span id="DataFrame.repartition-762"><a href="#DataFrame.repartition-762"><span class="linenos">762</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.repartition-763"><a href="#DataFrame.repartition-763"><span class="linenos">763</span></a> <span class="n">num_partition_cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_list_of_columns</span><span class="p">(</span><span class="n">numPartitions</span><span class="p">)</span> +</span><span id="DataFrame.repartition-764"><a href="#DataFrame.repartition-764"><span class="linenos">764</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> +</span><span id="DataFrame.repartition-765"><a href="#DataFrame.repartition-765"><span class="linenos">765</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">num_partition_cols</span> <span class="o">+</span> <span class="n">columns</span> +</span><span id="DataFrame.repartition-766"><a href="#DataFrame.repartition-766"><span class="linenos">766</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hint</span><span class="p">(</span><span class="s2">"repartition"</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.coalesce" class="classattr"> + <input id="DataFrame.coalesce-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.NO_OP)</div> + + <span class="def">def</span> + <span class="name">coalesce</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">numPartitions</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.coalesce-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.coalesce"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.coalesce-768"><a href="#DataFrame.coalesce-768"><span class="linenos">768</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame.coalesce-769"><a href="#DataFrame.coalesce-769"><span class="linenos">769</span></a> <span class="k">def</span> <span class="nf">coalesce</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">numPartitions</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.coalesce-770"><a href="#DataFrame.coalesce-770"><span class="linenos">770</span></a> <span class="n">num_partitions</span> <span class="o">=</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_cols</span><span class="p">([</span><span class="n">numPartitions</span><span class="p">])</span> +</span><span id="DataFrame.coalesce-771"><a href="#DataFrame.coalesce-771"><span class="linenos">771</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_hint</span><span class="p">(</span><span class="s2">"coalesce"</span><span class="p">,</span> <span class="n">num_partitions</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.cache" class="classattr"> + <input id="DataFrame.cache-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.NO_OP)</div> + + <span class="def">def</span> + <span class="name">cache</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.cache-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.cache"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.cache-773"><a href="#DataFrame.cache-773"><span class="linenos">773</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame.cache-774"><a href="#DataFrame.cache-774"><span class="linenos">774</span></a> <span class="k">def</span> <span class="nf">cache</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.cache-775"><a href="#DataFrame.cache-775"><span class="linenos">775</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="p">(</span><span class="n">storage_level</span><span class="o">=</span><span class="s2">"MEMORY_AND_DISK"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrame.persist" class="classattr"> + <input id="DataFrame.persist-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.NO_OP)</div> + + <span class="def">def</span> + <span class="name">persist</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">storageLevel</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">'MEMORY_AND_DISK_SER'</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrame.persist-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrame.persist"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrame.persist-777"><a href="#DataFrame.persist-777"><span class="linenos">777</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">NO_OP</span><span class="p">)</span> +</span><span id="DataFrame.persist-778"><a href="#DataFrame.persist-778"><span class="linenos">778</span></a> <span class="k">def</span> <span class="nf">persist</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">storageLevel</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"MEMORY_AND_DISK_SER"</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrame.persist-779"><a href="#DataFrame.persist-779"><span class="linenos">779</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="DataFrame.persist-780"><a href="#DataFrame.persist-780"><span class="linenos">780</span></a><span class="sd"> Storage Level Options: https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-aux-cache-cache-table.html</span> +</span><span id="DataFrame.persist-781"><a href="#DataFrame.persist-781"><span class="linenos">781</span></a><span class="sd"> """</span> +</span><span id="DataFrame.persist-782"><a href="#DataFrame.persist-782"><span class="linenos">782</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_cache</span><span class="p">(</span><span class="n">storageLevel</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Storage Level Options: <a href="https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-aux-cache-cache-table.html">https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-aux-cache-cache-table.html</a></p> +</div> + + + </div> + </section> + <section id="GroupedData"> + <input id="GroupedData-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">GroupedData</span>: + + <label class="view-source-button" for="GroupedData-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData-14"><a href="#GroupedData-14"><span class="linenos">14</span></a><span class="k">class</span> <span class="nc">GroupedData</span><span class="p">:</span> +</span><span id="GroupedData-15"><a href="#GroupedData-15"><span class="linenos">15</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> <span class="n">group_by_cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">],</span> <span class="n">last_op</span><span class="p">:</span> <span class="n">Operation</span><span class="p">):</span> +</span><span id="GroupedData-16"><a href="#GroupedData-16"><span class="linenos">16</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="GroupedData-17"><a href="#GroupedData-17"><span class="linenos">17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">spark</span> +</span><span id="GroupedData-18"><a href="#GroupedData-18"><span class="linenos">18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">last_op</span> <span class="o">=</span> <span class="n">last_op</span> +</span><span id="GroupedData-19"><a href="#GroupedData-19"><span class="linenos">19</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">group_by_cols</span> <span class="o">=</span> <span class="n">group_by_cols</span> +</span><span id="GroupedData-20"><a href="#GroupedData-20"><span class="linenos">20</span></a> +</span><span id="GroupedData-21"><a href="#GroupedData-21"><span class="linenos">21</span></a> <span class="k">def</span> <span class="nf">_get_function_applied_columns</span><span class="p">(</span> +</span><span id="GroupedData-22"><a href="#GroupedData-22"><span class="linenos">22</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">func_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> +</span><span id="GroupedData-23"><a href="#GroupedData-23"><span class="linenos">23</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]:</span> +</span><span id="GroupedData-24"><a href="#GroupedData-24"><span class="linenos">24</span></a> <span class="n">func_name</span> <span class="o">=</span> <span class="n">func_name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="GroupedData-25"><a href="#GroupedData-25"><span class="linenos">25</span></a> <span class="k">return</span> <span class="p">[</span><span class="nb">getattr</span><span class="p">(</span><span class="n">F</span><span class="p">,</span> <span class="n">func_name</span><span class="p">)(</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">func_name</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span> +</span><span id="GroupedData-26"><a href="#GroupedData-26"><span class="linenos">26</span></a> +</span><span id="GroupedData-27"><a href="#GroupedData-27"><span class="linenos">27</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="GroupedData-28"><a href="#GroupedData-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">agg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">exprs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">Column</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-29"><a href="#GroupedData-29"><span class="linenos">29</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="GroupedData-30"><a href="#GroupedData-30"><span class="linenos">30</span></a> <span class="p">[</span><span class="n">Column</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">agg_func</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">column_name</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> <span class="k">for</span> <span class="n">column_name</span><span class="p">,</span> <span class="n">agg_func</span> <span class="ow">in</span> <span class="n">exprs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span> +</span><span id="GroupedData-31"><a href="#GroupedData-31"><span class="linenos">31</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exprs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">dict</span><span class="p">)</span> +</span><span id="GroupedData-32"><a href="#GroupedData-32"><span class="linenos">32</span></a> <span class="k">else</span> <span class="n">exprs</span> +</span><span id="GroupedData-33"><a href="#GroupedData-33"><span class="linenos">33</span></a> <span class="p">)</span> +</span><span id="GroupedData-34"><a href="#GroupedData-34"><span class="linenos">34</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="GroupedData-35"><a href="#GroupedData-35"><span class="linenos">35</span></a> +</span><span id="GroupedData-36"><a href="#GroupedData-36"><span class="linenos">36</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span> +</span><span id="GroupedData-37"><a href="#GroupedData-37"><span class="linenos">37</span></a> <span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">group_by_cols</span><span class="p">]</span> +</span><span id="GroupedData-38"><a href="#GroupedData-38"><span class="linenos">38</span></a> <span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">group_by_cols</span> <span class="o">+</span> <span class="n">cols</span><span class="p">],</span> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="GroupedData-39"><a href="#GroupedData-39"><span class="linenos">39</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="GroupedData-40"><a href="#GroupedData-40"><span class="linenos">40</span></a> +</span><span id="GroupedData-41"><a href="#GroupedData-41"><span class="linenos">41</span></a> <span class="k">def</span> <span class="nf">count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-42"><a href="#GroupedData-42"><span class="linenos">42</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"count"</span><span class="p">))</span> +</span><span id="GroupedData-43"><a href="#GroupedData-43"><span class="linenos">43</span></a> +</span><span id="GroupedData-44"><a href="#GroupedData-44"><span class="linenos">44</span></a> <span class="k">def</span> <span class="nf">mean</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-45"><a href="#GroupedData-45"><span class="linenos">45</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">avg</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span><span id="GroupedData-46"><a href="#GroupedData-46"><span class="linenos">46</span></a> +</span><span id="GroupedData-47"><a href="#GroupedData-47"><span class="linenos">47</span></a> <span class="k">def</span> <span class="nf">avg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-48"><a href="#GroupedData-48"><span class="linenos">48</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"avg"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span><span id="GroupedData-49"><a href="#GroupedData-49"><span class="linenos">49</span></a> +</span><span id="GroupedData-50"><a href="#GroupedData-50"><span class="linenos">50</span></a> <span class="k">def</span> <span class="nf">max</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-51"><a href="#GroupedData-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"max"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span><span id="GroupedData-52"><a href="#GroupedData-52"><span class="linenos">52</span></a> +</span><span id="GroupedData-53"><a href="#GroupedData-53"><span class="linenos">53</span></a> <span class="k">def</span> <span class="nf">min</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-54"><a href="#GroupedData-54"><span class="linenos">54</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"min"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span><span id="GroupedData-55"><a href="#GroupedData-55"><span class="linenos">55</span></a> +</span><span id="GroupedData-56"><a href="#GroupedData-56"><span class="linenos">56</span></a> <span class="k">def</span> <span class="nf">sum</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-57"><a href="#GroupedData-57"><span class="linenos">57</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"sum"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span><span id="GroupedData-58"><a href="#GroupedData-58"><span class="linenos">58</span></a> +</span><span id="GroupedData-59"><a href="#GroupedData-59"><span class="linenos">59</span></a> <span class="k">def</span> <span class="nf">pivot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData-60"><a href="#GroupedData-60"><span class="linenos">60</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Sum distinct is not currently implemented"</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="GroupedData.__init__" class="classattr"> + <input id="GroupedData.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">GroupedData</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">df</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>,</span><span class="param"> <span class="n">group_by_cols</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">last_op</span><span class="p">:</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">dataframe</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">operations</span><span class="o">.</span><span class="n">Operation</span></span>)</span> + + <label class="view-source-button" for="GroupedData.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.__init__-15"><a href="#GroupedData.__init__-15"><span class="linenos">15</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> <span class="n">group_by_cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">],</span> <span class="n">last_op</span><span class="p">:</span> <span class="n">Operation</span><span class="p">):</span> +</span><span id="GroupedData.__init__-16"><a href="#GroupedData.__init__-16"><span class="linenos">16</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="GroupedData.__init__-17"><a href="#GroupedData.__init__-17"><span class="linenos">17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">spark</span> +</span><span id="GroupedData.__init__-18"><a href="#GroupedData.__init__-18"><span class="linenos">18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">last_op</span> <span class="o">=</span> <span class="n">last_op</span> +</span><span id="GroupedData.__init__-19"><a href="#GroupedData.__init__-19"><span class="linenos">19</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">group_by_cols</span> <span class="o">=</span> <span class="n">group_by_cols</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.agg" class="classattr"> + <input id="GroupedData.agg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@operation(Operation.SELECT)</div> + + <span class="def">def</span> + <span class="name">agg</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">exprs</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">,</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.agg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.agg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.agg-27"><a href="#GroupedData.agg-27"><span class="linenos">27</span></a> <span class="nd">@operation</span><span class="p">(</span><span class="n">Operation</span><span class="o">.</span><span class="n">SELECT</span><span class="p">)</span> +</span><span id="GroupedData.agg-28"><a href="#GroupedData.agg-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">agg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">exprs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">Column</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]])</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.agg-29"><a href="#GroupedData.agg-29"><span class="linenos">29</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="GroupedData.agg-30"><a href="#GroupedData.agg-30"><span class="linenos">30</span></a> <span class="p">[</span><span class="n">Column</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">agg_func</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">column_name</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> <span class="k">for</span> <span class="n">column_name</span><span class="p">,</span> <span class="n">agg_func</span> <span class="ow">in</span> <span class="n">exprs</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span> +</span><span id="GroupedData.agg-31"><a href="#GroupedData.agg-31"><span class="linenos">31</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exprs</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">dict</span><span class="p">)</span> +</span><span id="GroupedData.agg-32"><a href="#GroupedData.agg-32"><span class="linenos">32</span></a> <span class="k">else</span> <span class="n">exprs</span> +</span><span id="GroupedData.agg-33"><a href="#GroupedData.agg-33"><span class="linenos">33</span></a> <span class="p">)</span> +</span><span id="GroupedData.agg-34"><a href="#GroupedData.agg-34"><span class="linenos">34</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">_ensure_and_normalize_cols</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="GroupedData.agg-35"><a href="#GroupedData.agg-35"><span class="linenos">35</span></a> +</span><span id="GroupedData.agg-36"><a href="#GroupedData.agg-36"><span class="linenos">36</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span> +</span><span id="GroupedData.agg-37"><a href="#GroupedData.agg-37"><span class="linenos">37</span></a> <span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">group_by_cols</span><span class="p">]</span> +</span><span id="GroupedData.agg-38"><a href="#GroupedData.agg-38"><span class="linenos">38</span></a> <span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">group_by_cols</span> <span class="o">+</span> <span class="n">cols</span><span class="p">],</span> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="GroupedData.agg-39"><a href="#GroupedData.agg-39"><span class="linenos">39</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.count" class="classattr"> + <input id="GroupedData.count-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">count</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.count-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.count"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.count-41"><a href="#GroupedData.count-41"><span class="linenos">41</span></a> <span class="k">def</span> <span class="nf">count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.count-42"><a href="#GroupedData.count-42"><span class="linenos">42</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="n">F</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="s2">"count"</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.mean" class="classattr"> + <input id="GroupedData.mean-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">mean</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.mean-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.mean"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.mean-44"><a href="#GroupedData.mean-44"><span class="linenos">44</span></a> <span class="k">def</span> <span class="nf">mean</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.mean-45"><a href="#GroupedData.mean-45"><span class="linenos">45</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">avg</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.avg" class="classattr"> + <input id="GroupedData.avg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">avg</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.avg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.avg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.avg-47"><a href="#GroupedData.avg-47"><span class="linenos">47</span></a> <span class="k">def</span> <span class="nf">avg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.avg-48"><a href="#GroupedData.avg-48"><span class="linenos">48</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"avg"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.max" class="classattr"> + <input id="GroupedData.max-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">max</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.max-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.max"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.max-50"><a href="#GroupedData.max-50"><span class="linenos">50</span></a> <span class="k">def</span> <span class="nf">max</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.max-51"><a href="#GroupedData.max-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"max"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.min" class="classattr"> + <input id="GroupedData.min-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">min</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.min-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.min"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.min-53"><a href="#GroupedData.min-53"><span class="linenos">53</span></a> <span class="k">def</span> <span class="nf">min</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.min-54"><a href="#GroupedData.min-54"><span class="linenos">54</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"min"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.sum" class="classattr"> + <input id="GroupedData.sum-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sum</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.sum-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.sum"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.sum-56"><a href="#GroupedData.sum-56"><span class="linenos">56</span></a> <span class="k">def</span> <span class="nf">sum</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.sum-57"><a href="#GroupedData.sum-57"><span class="linenos">57</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">agg</span><span class="p">(</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">_get_function_applied_columns</span><span class="p">(</span><span class="s2">"sum"</span><span class="p">,</span> <span class="n">cols</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="GroupedData.pivot" class="classattr"> + <input id="GroupedData.pivot-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pivot</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="GroupedData.pivot-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupedData.pivot"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupedData.pivot-59"><a href="#GroupedData.pivot-59"><span class="linenos">59</span></a> <span class="k">def</span> <span class="nf">pivot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="GroupedData.pivot-60"><a href="#GroupedData.pivot-60"><span class="linenos">60</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Sum distinct is not currently implemented"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="Column"> + <input id="Column-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Column</span>: + + <label class="view-source-button" for="Column-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column-16"><a href="#Column-16"><span class="linenos"> 16</span></a><span class="k">class</span> <span class="nc">Column</span><span class="p">:</span> +</span><span id="Column-17"><a href="#Column-17"><span class="linenos"> 17</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]):</span> +</span><span id="Column-18"><a href="#Column-18"><span class="linenos"> 18</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="Column-19"><a href="#Column-19"><span class="linenos"> 19</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span> <span class="c1"># type: ignore</span> +</span><span id="Column-20"><a href="#Column-20"><span class="linenos"> 20</span></a> <span class="k">elif</span> <span class="n">expression</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)):</span> +</span><span id="Column-21"><a href="#Column-21"><span class="linenos"> 21</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="c1"># type: ignore</span> +</span><span id="Column-22"><a href="#Column-22"><span class="linenos"> 22</span></a> +</span><span id="Column-23"><a href="#Column-23"><span class="linenos"> 23</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">)</span> +</span><span id="Column-24"><a href="#Column-24"><span class="linenos"> 24</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Column-25"><a href="#Column-25"><span class="linenos"> 25</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not parse </span><span class="si">{</span><span class="n">expression</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Column-26"><a href="#Column-26"><span class="linenos"> 26</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Column-27"><a href="#Column-27"><span class="linenos"> 27</span></a> +</span><span id="Column-28"><a href="#Column-28"><span class="linenos"> 28</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-29"><a href="#Column-29"><span class="linenos"> 29</span></a> <span class="k">return</span> <span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Column-30"><a href="#Column-30"><span class="linenos"> 30</span></a> +</span><span id="Column-31"><a href="#Column-31"><span class="linenos"> 31</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-32"><a href="#Column-32"><span class="linenos"> 32</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Column-33"><a href="#Column-33"><span class="linenos"> 33</span></a> +</span><span id="Column-34"><a href="#Column-34"><span class="linenos"> 34</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Column-35"><a href="#Column-35"><span class="linenos"> 35</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-36"><a href="#Column-36"><span class="linenos"> 36</span></a> +</span><span id="Column-37"><a href="#Column-37"><span class="linenos"> 37</span></a> <span class="k">def</span> <span class="fm">__ne__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Column-38"><a href="#Column-38"><span class="linenos"> 38</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-39"><a href="#Column-39"><span class="linenos"> 39</span></a> +</span><span id="Column-40"><a href="#Column-40"><span class="linenos"> 40</span></a> <span class="k">def</span> <span class="fm">__gt__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-41"><a href="#Column-41"><span class="linenos"> 41</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-42"><a href="#Column-42"><span class="linenos"> 42</span></a> +</span><span id="Column-43"><a href="#Column-43"><span class="linenos"> 43</span></a> <span class="k">def</span> <span class="fm">__ge__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-44"><a href="#Column-44"><span class="linenos"> 44</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-45"><a href="#Column-45"><span class="linenos"> 45</span></a> +</span><span id="Column-46"><a href="#Column-46"><span class="linenos"> 46</span></a> <span class="k">def</span> <span class="fm">__lt__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-47"><a href="#Column-47"><span class="linenos"> 47</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-48"><a href="#Column-48"><span class="linenos"> 48</span></a> +</span><span id="Column-49"><a href="#Column-49"><span class="linenos"> 49</span></a> <span class="k">def</span> <span class="fm">__le__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-50"><a href="#Column-50"><span class="linenos"> 50</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-51"><a href="#Column-51"><span class="linenos"> 51</span></a> +</span><span id="Column-52"><a href="#Column-52"><span class="linenos"> 52</span></a> <span class="k">def</span> <span class="fm">__and__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-53"><a href="#Column-53"><span class="linenos"> 53</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-54"><a href="#Column-54"><span class="linenos"> 54</span></a> +</span><span id="Column-55"><a href="#Column-55"><span class="linenos"> 55</span></a> <span class="k">def</span> <span class="fm">__or__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-56"><a href="#Column-56"><span class="linenos"> 56</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-57"><a href="#Column-57"><span class="linenos"> 57</span></a> +</span><span id="Column-58"><a href="#Column-58"><span class="linenos"> 58</span></a> <span class="k">def</span> <span class="fm">__mod__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-59"><a href="#Column-59"><span class="linenos"> 59</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-60"><a href="#Column-60"><span class="linenos"> 60</span></a> +</span><span id="Column-61"><a href="#Column-61"><span class="linenos"> 61</span></a> <span class="k">def</span> <span class="fm">__add__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-62"><a href="#Column-62"><span class="linenos"> 62</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-63"><a href="#Column-63"><span class="linenos"> 63</span></a> +</span><span id="Column-64"><a href="#Column-64"><span class="linenos"> 64</span></a> <span class="k">def</span> <span class="fm">__sub__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-65"><a href="#Column-65"><span class="linenos"> 65</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-66"><a href="#Column-66"><span class="linenos"> 66</span></a> +</span><span id="Column-67"><a href="#Column-67"><span class="linenos"> 67</span></a> <span class="k">def</span> <span class="fm">__mul__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-68"><a href="#Column-68"><span class="linenos"> 68</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-69"><a href="#Column-69"><span class="linenos"> 69</span></a> +</span><span id="Column-70"><a href="#Column-70"><span class="linenos"> 70</span></a> <span class="k">def</span> <span class="fm">__truediv__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-71"><a href="#Column-71"><span class="linenos"> 71</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-72"><a href="#Column-72"><span class="linenos"> 72</span></a> +</span><span id="Column-73"><a href="#Column-73"><span class="linenos"> 73</span></a> <span class="k">def</span> <span class="nf">__div__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-74"><a href="#Column-74"><span class="linenos"> 74</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-75"><a href="#Column-75"><span class="linenos"> 75</span></a> +</span><span id="Column-76"><a href="#Column-76"><span class="linenos"> 76</span></a> <span class="k">def</span> <span class="fm">__neg__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-77"><a href="#Column-77"><span class="linenos"> 77</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">unary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">)</span> +</span><span id="Column-78"><a href="#Column-78"><span class="linenos"> 78</span></a> +</span><span id="Column-79"><a href="#Column-79"><span class="linenos"> 79</span></a> <span class="k">def</span> <span class="fm">__radd__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-80"><a href="#Column-80"><span class="linenos"> 80</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-81"><a href="#Column-81"><span class="linenos"> 81</span></a> +</span><span id="Column-82"><a href="#Column-82"><span class="linenos"> 82</span></a> <span class="k">def</span> <span class="fm">__rsub__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-83"><a href="#Column-83"><span class="linenos"> 83</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-84"><a href="#Column-84"><span class="linenos"> 84</span></a> +</span><span id="Column-85"><a href="#Column-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="fm">__rmul__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-86"><a href="#Column-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-87"><a href="#Column-87"><span class="linenos"> 87</span></a> +</span><span id="Column-88"><a href="#Column-88"><span class="linenos"> 88</span></a> <span class="k">def</span> <span class="nf">__rdiv__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-89"><a href="#Column-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-90"><a href="#Column-90"><span class="linenos"> 90</span></a> +</span><span id="Column-91"><a href="#Column-91"><span class="linenos"> 91</span></a> <span class="k">def</span> <span class="fm">__rtruediv__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-92"><a href="#Column-92"><span class="linenos"> 92</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-93"><a href="#Column-93"><span class="linenos"> 93</span></a> +</span><span id="Column-94"><a href="#Column-94"><span class="linenos"> 94</span></a> <span class="k">def</span> <span class="fm">__rmod__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-95"><a href="#Column-95"><span class="linenos"> 95</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-96"><a href="#Column-96"><span class="linenos"> 96</span></a> +</span><span id="Column-97"><a href="#Column-97"><span class="linenos"> 97</span></a> <span class="k">def</span> <span class="fm">__pow__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">power</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">modulo</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Column-98"><a href="#Column-98"><span class="linenos"> 98</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">Column</span><span class="p">(</span><span class="n">power</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Column-99"><a href="#Column-99"><span class="linenos"> 99</span></a> +</span><span id="Column-100"><a href="#Column-100"><span class="linenos">100</span></a> <span class="k">def</span> <span class="fm">__rpow__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">power</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">):</span> +</span><span id="Column-101"><a href="#Column-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">Column</span><span class="p">(</span><span class="n">power</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Column-102"><a href="#Column-102"><span class="linenos">102</span></a> +</span><span id="Column-103"><a href="#Column-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="fm">__invert__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-104"><a href="#Column-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">unary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">)</span> +</span><span id="Column-105"><a href="#Column-105"><span class="linenos">105</span></a> +</span><span id="Column-106"><a href="#Column-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="fm">__rand__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-107"><a href="#Column-107"><span class="linenos">107</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-108"><a href="#Column-108"><span class="linenos">108</span></a> +</span><span id="Column-109"><a href="#Column-109"><span class="linenos">109</span></a> <span class="k">def</span> <span class="fm">__ror__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-110"><a href="#Column-110"><span class="linenos">110</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_binary_op</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> +</span><span id="Column-111"><a href="#Column-111"><span class="linenos">111</span></a> +</span><span id="Column-112"><a href="#Column-112"><span class="linenos">112</span></a> <span class="nd">@classmethod</span> +</span><span id="Column-113"><a href="#Column-113"><span class="linenos">113</span></a> <span class="k">def</span> <span class="nf">ensure_col</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]):</span> +</span><span id="Column-114"><a href="#Column-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Column-115"><a href="#Column-115"><span class="linenos">115</span></a> +</span><span id="Column-116"><a href="#Column-116"><span class="linenos">116</span></a> <span class="nd">@classmethod</span> +</span><span id="Column-117"><a href="#Column-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">ensure_cols</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]:</span> +</span><span id="Column-118"><a href="#Column-118"><span class="linenos">118</span></a> <span class="k">return</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">x</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">args</span><span class="p">]</span> +</span><span id="Column-119"><a href="#Column-119"><span class="linenos">119</span></a> +</span><span id="Column-120"><a href="#Column-120"><span class="linenos">120</span></a> <span class="nd">@classmethod</span> +</span><span id="Column-121"><a href="#Column-121"><span class="linenos">121</span></a> <span class="k">def</span> <span class="nf">_lit</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-122"><a href="#Column-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="Column-123"><a href="#Column-123"><span class="linenos">123</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">v</span><span class="p">)</span><span class="o">.</span><span class="n">alias</span><span class="p">(</span><span class="n">k</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span> +</span><span id="Column-124"><a href="#Column-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">columns</span><span class="p">))</span> +</span><span id="Column-125"><a href="#Column-125"><span class="linenos">125</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">))</span> +</span><span id="Column-126"><a href="#Column-126"><span class="linenos">126</span></a> +</span><span id="Column-127"><a href="#Column-127"><span class="linenos">127</span></a> <span class="nd">@classmethod</span> +</span><span id="Column-128"><a href="#Column-128"><span class="linenos">128</span></a> <span class="k">def</span> <span class="nf">invoke_anonymous_function</span><span class="p">(</span> +</span><span id="Column-129"><a href="#Column-129"><span class="linenos">129</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> <span class="n">func_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">]</span> +</span><span id="Column-130"><a href="#Column-130"><span class="linenos">130</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-131"><a href="#Column-131"><span class="linenos">131</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">[]</span> <span class="k">if</span> <span class="n">column</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">column</span><span class="p">)]</span> +</span><span id="Column-132"><a href="#Column-132"><span class="linenos">132</span></a> <span class="n">column_args</span> <span class="o">=</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">]</span> +</span><span id="Column-133"><a href="#Column-133"><span class="linenos">133</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span> <span class="o">+</span> <span class="n">column_args</span><span class="p">]</span> +</span><span id="Column-134"><a href="#Column-134"><span class="linenos">134</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">func_name</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Column-135"><a href="#Column-135"><span class="linenos">135</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-136"><a href="#Column-136"><span class="linenos">136</span></a> +</span><span id="Column-137"><a href="#Column-137"><span class="linenos">137</span></a> <span class="nd">@classmethod</span> +</span><span id="Column-138"><a href="#Column-138"><span class="linenos">138</span></a> <span class="k">def</span> <span class="nf">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column-139"><a href="#Column-139"><span class="linenos">139</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> <span class="n">callable_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="Column-140"><a href="#Column-140"><span class="linenos">140</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-141"><a href="#Column-141"><span class="linenos">141</span></a> <span class="n">ensured_column</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">column</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="Column-142"><a href="#Column-142"><span class="linenos">142</span></a> <span class="n">ensure_expression_values</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Column-143"><a href="#Column-143"><span class="linenos">143</span></a> <span class="n">k</span><span class="p">:</span> <span class="p">[</span><span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">v</span><span class="p">]</span> +</span><span id="Column-144"><a href="#Column-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="n">is_iterable</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> +</span><span id="Column-145"><a href="#Column-145"><span class="linenos">145</span></a> <span class="k">else</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">v</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-146"><a href="#Column-146"><span class="linenos">146</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Column-147"><a href="#Column-147"><span class="linenos">147</span></a> <span class="p">}</span> +</span><span id="Column-148"><a href="#Column-148"><span class="linenos">148</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Column-149"><a href="#Column-149"><span class="linenos">149</span></a> <span class="n">callable_expression</span><span class="p">(</span><span class="o">**</span><span class="n">ensure_expression_values</span><span class="p">)</span> +</span><span id="Column-150"><a href="#Column-150"><span class="linenos">150</span></a> <span class="k">if</span> <span class="n">ensured_column</span> <span class="ow">is</span> <span class="kc">None</span> +</span><span id="Column-151"><a href="#Column-151"><span class="linenos">151</span></a> <span class="k">else</span> <span class="n">callable_expression</span><span class="p">(</span> +</span><span id="Column-152"><a href="#Column-152"><span class="linenos">152</span></a> <span class="n">this</span><span class="o">=</span><span class="n">ensured_column</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">ensure_expression_values</span> +</span><span id="Column-153"><a href="#Column-153"><span class="linenos">153</span></a> <span class="p">)</span> +</span><span id="Column-154"><a href="#Column-154"><span class="linenos">154</span></a> <span class="p">)</span> +</span><span id="Column-155"><a href="#Column-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-156"><a href="#Column-156"><span class="linenos">156</span></a> +</span><span id="Column-157"><a href="#Column-157"><span class="linenos">157</span></a> <span class="k">def</span> <span class="nf">binary_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-158"><a href="#Column-158"><span class="linenos">158</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="Column-159"><a href="#Column-159"><span class="linenos">159</span></a> <span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">Column</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Column-160"><a href="#Column-160"><span class="linenos">160</span></a> <span class="p">)</span> +</span><span id="Column-161"><a href="#Column-161"><span class="linenos">161</span></a> +</span><span id="Column-162"><a href="#Column-162"><span class="linenos">162</span></a> <span class="k">def</span> <span class="nf">inverse_binary_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-163"><a href="#Column-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="Column-164"><a href="#Column-164"><span class="linenos">164</span></a> <span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">Column</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Column-165"><a href="#Column-165"><span class="linenos">165</span></a> <span class="p">)</span> +</span><span id="Column-166"><a href="#Column-166"><span class="linenos">166</span></a> +</span><span id="Column-167"><a href="#Column-167"><span class="linenos">167</span></a> <span class="k">def</span> <span class="nf">unary_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-168"><a href="#Column-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span><span id="Column-169"><a href="#Column-169"><span class="linenos">169</span></a> +</span><span id="Column-170"><a href="#Column-170"><span class="linenos">170</span></a> <span class="nd">@property</span> +</span><span id="Column-171"><a href="#Column-171"><span class="linenos">171</span></a> <span class="k">def</span> <span class="nf">is_alias</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-172"><a href="#Column-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)</span> +</span><span id="Column-173"><a href="#Column-173"><span class="linenos">173</span></a> +</span><span id="Column-174"><a href="#Column-174"><span class="linenos">174</span></a> <span class="nd">@property</span> +</span><span id="Column-175"><a href="#Column-175"><span class="linenos">175</span></a> <span class="k">def</span> <span class="nf">is_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-176"><a href="#Column-176"><span class="linenos">176</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> +</span><span id="Column-177"><a href="#Column-177"><span class="linenos">177</span></a> +</span><span id="Column-178"><a href="#Column-178"><span class="linenos">178</span></a> <span class="nd">@property</span> +</span><span id="Column-179"><a href="#Column-179"><span class="linenos">179</span></a> <span class="k">def</span> <span class="nf">column_expression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">:</span> +</span><span id="Column-180"><a href="#Column-180"><span class="linenos">180</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">unalias</span><span class="p">()</span> +</span><span id="Column-181"><a href="#Column-181"><span class="linenos">181</span></a> +</span><span id="Column-182"><a href="#Column-182"><span class="linenos">182</span></a> <span class="nd">@property</span> +</span><span id="Column-183"><a href="#Column-183"><span class="linenos">183</span></a> <span class="k">def</span> <span class="nf">alias_or_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Column-184"><a href="#Column-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="Column-185"><a href="#Column-185"><span class="linenos">185</span></a> +</span><span id="Column-186"><a href="#Column-186"><span class="linenos">186</span></a> <span class="nd">@classmethod</span> +</span><span id="Column-187"><a href="#Column-187"><span class="linenos">187</span></a> <span class="k">def</span> <span class="nf">ensure_literal</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-188"><a href="#Column-188"><span class="linenos">188</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="Column-189"><a href="#Column-189"><span class="linenos">189</span></a> +</span><span id="Column-190"><a href="#Column-190"><span class="linenos">190</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">cls</span><span class="p">):</span> +</span><span id="Column-191"><a href="#Column-191"><span class="linenos">191</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-192"><a href="#Column-192"><span class="linenos">192</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">):</span> +</span><span id="Column-193"><a href="#Column-193"><span class="linenos">193</span></a> <span class="k">return</span> <span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Column-194"><a href="#Column-194"><span class="linenos">194</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Column-195"><a href="#Column-195"><span class="linenos">195</span></a> +</span><span id="Column-196"><a href="#Column-196"><span class="linenos">196</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-197"><a href="#Column-197"><span class="linenos">197</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="Column-198"><a href="#Column-198"><span class="linenos">198</span></a> +</span><span id="Column-199"><a href="#Column-199"><span class="linenos">199</span></a> <span class="k">def</span> <span class="nf">set_table_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-200"><a href="#Column-200"><span class="linenos">200</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="k">if</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-201"><a href="#Column-201"><span class="linenos">201</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table_name</span><span class="p">))</span> +</span><span id="Column-202"><a href="#Column-202"><span class="linenos">202</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Column-203"><a href="#Column-203"><span class="linenos">203</span></a> +</span><span id="Column-204"><a href="#Column-204"><span class="linenos">204</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Column-205"><a href="#Column-205"><span class="linenos">205</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="s2">"spark"</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> +</span><span id="Column-206"><a href="#Column-206"><span class="linenos">206</span></a> +</span><span id="Column-207"><a href="#Column-207"><span class="linenos">207</span></a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-208"><a href="#Column-208"><span class="linenos">208</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="Column-209"><a href="#Column-209"><span class="linenos">209</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-210"><a href="#Column-210"><span class="linenos">210</span></a> +</span><span id="Column-211"><a href="#Column-211"><span class="linenos">211</span></a> <span class="k">def</span> <span class="nf">asc</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-212"><a href="#Column-212"><span class="linenos">212</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Column-213"><a href="#Column-213"><span class="linenos">213</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-214"><a href="#Column-214"><span class="linenos">214</span></a> +</span><span id="Column-215"><a href="#Column-215"><span class="linenos">215</span></a> <span class="k">def</span> <span class="nf">desc</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-216"><a href="#Column-216"><span class="linenos">216</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Column-217"><a href="#Column-217"><span class="linenos">217</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-218"><a href="#Column-218"><span class="linenos">218</span></a> +</span><span id="Column-219"><a href="#Column-219"><span class="linenos">219</span></a> <span class="n">asc_nulls_first</span> <span class="o">=</span> <span class="n">asc</span> +</span><span id="Column-220"><a href="#Column-220"><span class="linenos">220</span></a> +</span><span id="Column-221"><a href="#Column-221"><span class="linenos">221</span></a> <span class="k">def</span> <span class="nf">asc_nulls_last</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-222"><a href="#Column-222"><span class="linenos">222</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Column-223"><a href="#Column-223"><span class="linenos">223</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-224"><a href="#Column-224"><span class="linenos">224</span></a> +</span><span id="Column-225"><a href="#Column-225"><span class="linenos">225</span></a> <span class="k">def</span> <span class="nf">desc_nulls_first</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-226"><a href="#Column-226"><span class="linenos">226</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Column-227"><a href="#Column-227"><span class="linenos">227</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-228"><a href="#Column-228"><span class="linenos">228</span></a> +</span><span id="Column-229"><a href="#Column-229"><span class="linenos">229</span></a> <span class="n">desc_nulls_last</span> <span class="o">=</span> <span class="n">desc</span> +</span><span id="Column-230"><a href="#Column-230"><span class="linenos">230</span></a> +</span><span id="Column-231"><a href="#Column-231"><span class="linenos">231</span></a> <span class="k">def</span> <span class="nf">when</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">condition</span><span class="p">:</span> <span class="n">Column</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-232"><a href="#Column-232"><span class="linenos">232</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">when</span> +</span><span id="Column-233"><a href="#Column-233"><span class="linenos">233</span></a> +</span><span id="Column-234"><a href="#Column-234"><span class="linenos">234</span></a> <span class="n">column_with_if</span> <span class="o">=</span> <span class="n">when</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Column-235"><a href="#Column-235"><span class="linenos">235</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">):</span> +</span><span id="Column-236"><a href="#Column-236"><span class="linenos">236</span></a> <span class="k">return</span> <span class="n">column_with_if</span> +</span><span id="Column-237"><a href="#Column-237"><span class="linenos">237</span></a> <span class="n">new_column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Column-238"><a href="#Column-238"><span class="linenos">238</span></a> <span class="n">new_column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">]</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">column_with_if</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">])</span> +</span><span id="Column-239"><a href="#Column-239"><span class="linenos">239</span></a> <span class="k">return</span> <span class="n">new_column</span> +</span><span id="Column-240"><a href="#Column-240"><span class="linenos">240</span></a> +</span><span id="Column-241"><a href="#Column-241"><span class="linenos">241</span></a> <span class="k">def</span> <span class="nf">otherwise</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-242"><a href="#Column-242"><span class="linenos">242</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="Column-243"><a href="#Column-243"><span class="linenos">243</span></a> +</span><span id="Column-244"><a href="#Column-244"><span class="linenos">244</span></a> <span class="n">true_value</span> <span class="o">=</span> <span class="n">value</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Column-245"><a href="#Column-245"><span class="linenos">245</span></a> <span class="n">new_column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Column-246"><a href="#Column-246"><span class="linenos">246</span></a> <span class="n">new_column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"default"</span><span class="p">,</span> <span class="n">true_value</span><span class="o">.</span><span class="n">column_expression</span><span class="p">)</span> +</span><span id="Column-247"><a href="#Column-247"><span class="linenos">247</span></a> <span class="k">return</span> <span class="n">new_column</span> +</span><span id="Column-248"><a href="#Column-248"><span class="linenos">248</span></a> +</span><span id="Column-249"><a href="#Column-249"><span class="linenos">249</span></a> <span class="k">def</span> <span class="nf">isNull</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-250"><a href="#Column-250"><span class="linenos">250</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">())</span> +</span><span id="Column-251"><a href="#Column-251"><span class="linenos">251</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-252"><a href="#Column-252"><span class="linenos">252</span></a> +</span><span id="Column-253"><a href="#Column-253"><span class="linenos">253</span></a> <span class="k">def</span> <span class="nf">isNotNull</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-254"><a href="#Column-254"><span class="linenos">254</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">()))</span> +</span><span id="Column-255"><a href="#Column-255"><span class="linenos">255</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span><span id="Column-256"><a href="#Column-256"><span class="linenos">256</span></a> +</span><span id="Column-257"><a href="#Column-257"><span class="linenos">257</span></a> <span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dataType</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">DataType</span><span class="p">]):</span> +</span><span id="Column-258"><a href="#Column-258"><span class="linenos">258</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Column-259"><a href="#Column-259"><span class="linenos">259</span></a><span class="sd"> Functionality Difference: PySpark cast accepts a datatype instance of the datatype class</span> +</span><span id="Column-260"><a href="#Column-260"><span class="linenos">260</span></a><span class="sd"> Sqlglot doesn't currently replicate this class so it only accepts a string</span> +</span><span id="Column-261"><a href="#Column-261"><span class="linenos">261</span></a><span class="sd"> """</span> +</span><span id="Column-262"><a href="#Column-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dataType</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="Column-263"><a href="#Column-263"><span class="linenos">263</span></a> <span class="n">dataType</span> <span class="o">=</span> <span class="n">dataType</span><span class="o">.</span><span class="n">simpleString</span><span class="p">()</span> +</span><span id="Column-264"><a href="#Column-264"><span class="linenos">264</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">dataType</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">))</span> +</span><span id="Column-265"><a href="#Column-265"><span class="linenos">265</span></a> +</span><span id="Column-266"><a href="#Column-266"><span class="linenos">266</span></a> <span class="k">def</span> <span class="nf">startswith</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-267"><a href="#Column-267"><span class="linenos">267</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">value</span> +</span><span id="Column-268"><a href="#Column-268"><span class="linenos">268</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_anonymous_function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">"STARTSWITH"</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Column-269"><a href="#Column-269"><span class="linenos">269</span></a> +</span><span id="Column-270"><a href="#Column-270"><span class="linenos">270</span></a> <span class="k">def</span> <span class="nf">endswith</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-271"><a href="#Column-271"><span class="linenos">271</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">value</span> +</span><span id="Column-272"><a href="#Column-272"><span class="linenos">272</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_anonymous_function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">"ENDSWITH"</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Column-273"><a href="#Column-273"><span class="linenos">273</span></a> +</span><span id="Column-274"><a href="#Column-274"><span class="linenos">274</span></a> <span class="k">def</span> <span class="nf">rlike</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">regexp</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-275"><a href="#Column-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column-276"><a href="#Column-276"><span class="linenos">276</span></a> <span class="n">column</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">callable_expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">regexp</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-277"><a href="#Column-277"><span class="linenos">277</span></a> <span class="p">)</span> +</span><span id="Column-278"><a href="#Column-278"><span class="linenos">278</span></a> +</span><span id="Column-279"><a href="#Column-279"><span class="linenos">279</span></a> <span class="k">def</span> <span class="nf">like</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Column-280"><a href="#Column-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column-281"><a href="#Column-281"><span class="linenos">281</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-282"><a href="#Column-282"><span class="linenos">282</span></a> <span class="p">)</span> +</span><span id="Column-283"><a href="#Column-283"><span class="linenos">283</span></a> +</span><span id="Column-284"><a href="#Column-284"><span class="linenos">284</span></a> <span class="k">def</span> <span class="nf">ilike</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Column-285"><a href="#Column-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column-286"><a href="#Column-286"><span class="linenos">286</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-287"><a href="#Column-287"><span class="linenos">287</span></a> <span class="p">)</span> +</span><span id="Column-288"><a href="#Column-288"><span class="linenos">288</span></a> +</span><span id="Column-289"><a href="#Column-289"><span class="linenos">289</span></a> <span class="k">def</span> <span class="nf">substr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">startPos</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">Column</span><span class="p">],</span> <span class="n">length</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-290"><a href="#Column-290"><span class="linenos">290</span></a> <span class="n">startPos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">startPos</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">startPos</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">startPos</span> +</span><span id="Column-291"><a href="#Column-291"><span class="linenos">291</span></a> <span class="n">length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">length</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">length</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">length</span> +</span><span id="Column-292"><a href="#Column-292"><span class="linenos">292</span></a> <span class="k">return</span> <span class="n">Column</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column-293"><a href="#Column-293"><span class="linenos">293</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="n">startPos</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="n">length</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column-294"><a href="#Column-294"><span class="linenos">294</span></a> <span class="p">)</span> +</span><span id="Column-295"><a href="#Column-295"><span class="linenos">295</span></a> +</span><span id="Column-296"><a href="#Column-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="nf">isin</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">]]):</span> +</span><span id="Column-297"><a href="#Column-297"><span class="linenos">297</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">))</span> <span class="k">else</span> <span class="n">cols</span> <span class="c1"># type: ignore</span> +</span><span id="Column-298"><a href="#Column-298"><span class="linenos">298</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">]</span> +</span><span id="Column-299"><a href="#Column-299"><span class="linenos">299</span></a> <span class="k">return</span> <span class="n">Column</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Column-300"><a href="#Column-300"><span class="linenos">300</span></a> +</span><span id="Column-301"><a href="#Column-301"><span class="linenos">301</span></a> <span class="k">def</span> <span class="nf">between</span><span class="p">(</span> +</span><span id="Column-302"><a href="#Column-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Column-303"><a href="#Column-303"><span class="linenos">303</span></a> <span class="n">lowerBound</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> +</span><span id="Column-304"><a href="#Column-304"><span class="linenos">304</span></a> <span class="n">upperBound</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> +</span><span id="Column-305"><a href="#Column-305"><span class="linenos">305</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-306"><a href="#Column-306"><span class="linenos">306</span></a> <span class="n">lower_bound_exp</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Column-307"><a href="#Column-307"><span class="linenos">307</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">lowerBound</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">lowerBound</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">lowerBound</span> +</span><span id="Column-308"><a href="#Column-308"><span class="linenos">308</span></a> <span class="p">)</span> +</span><span id="Column-309"><a href="#Column-309"><span class="linenos">309</span></a> <span class="n">upper_bound_exp</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Column-310"><a href="#Column-310"><span class="linenos">310</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">upperBound</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">upperBound</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">upperBound</span> +</span><span id="Column-311"><a href="#Column-311"><span class="linenos">311</span></a> <span class="p">)</span> +</span><span id="Column-312"><a href="#Column-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="Column-313"><a href="#Column-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">(</span> +</span><span id="Column-314"><a href="#Column-314"><span class="linenos">314</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> +</span><span id="Column-315"><a href="#Column-315"><span class="linenos">315</span></a> <span class="n">low</span><span class="o">=</span><span class="n">lower_bound_exp</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Column-316"><a href="#Column-316"><span class="linenos">316</span></a> <span class="n">high</span><span class="o">=</span><span class="n">upper_bound_exp</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Column-317"><a href="#Column-317"><span class="linenos">317</span></a> <span class="p">)</span> +</span><span id="Column-318"><a href="#Column-318"><span class="linenos">318</span></a> <span class="p">)</span> +</span><span id="Column-319"><a href="#Column-319"><span class="linenos">319</span></a> +</span><span id="Column-320"><a href="#Column-320"><span class="linenos">320</span></a> <span class="k">def</span> <span class="nf">over</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">window</span><span class="p">:</span> <span class="n">WindowSpec</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column-321"><a href="#Column-321"><span class="linenos">321</span></a> <span class="n">window_expression</span> <span class="o">=</span> <span class="n">window</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Column-322"><a href="#Column-322"><span class="linenos">322</span></a> <span class="n">window_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">)</span> +</span><span id="Column-323"><a href="#Column-323"><span class="linenos">323</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">window_expression</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Column.__init__" class="classattr"> + <input id="Column.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Column</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700332259696'</span><span class="o">></span><span class="p">,</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span></span>)</span> + + <label class="view-source-button" for="Column.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.__init__-17"><a href="#Column.__init__-17"><span class="linenos">17</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]):</span> +</span><span id="Column.__init__-18"><a href="#Column.__init__-18"><span class="linenos">18</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="Column.__init__-19"><a href="#Column.__init__-19"><span class="linenos">19</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span> <span class="c1"># type: ignore</span> +</span><span id="Column.__init__-20"><a href="#Column.__init__-20"><span class="linenos">20</span></a> <span class="k">elif</span> <span class="n">expression</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)):</span> +</span><span id="Column.__init__-21"><a href="#Column.__init__-21"><span class="linenos">21</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="c1"># type: ignore</span> +</span><span id="Column.__init__-22"><a href="#Column.__init__-22"><span class="linenos">22</span></a> +</span><span id="Column.__init__-23"><a href="#Column.__init__-23"><span class="linenos">23</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">)</span> +</span><span id="Column.__init__-24"><a href="#Column.__init__-24"><span class="linenos">24</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Column.__init__-25"><a href="#Column.__init__-25"><span class="linenos">25</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not parse </span><span class="si">{</span><span class="n">expression</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Column.__init__-26"><a href="#Column.__init__-26"><span class="linenos">26</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">=</span> <span class="n">expression</span> +</span></pre></div> + + + + + </div> + <div id="Column.ensure_col" class="classattr"> + <input id="Column.ensure_col-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">ensure_col</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700330611696'</span><span class="o">></span><span class="p">,</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Column.ensure_col-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.ensure_col"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.ensure_col-112"><a href="#Column.ensure_col-112"><span class="linenos">112</span></a> <span class="nd">@classmethod</span> +</span><span id="Column.ensure_col-113"><a href="#Column.ensure_col-113"><span class="linenos">113</span></a> <span class="k">def</span> <span class="nf">ensure_col</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]):</span> +</span><span id="Column.ensure_col-114"><a href="#Column.ensure_col-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.ensure_cols" class="classattr"> + <input id="Column.ensure_cols-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">ensure_cols</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">args</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700330840736'</span><span class="o">></span><span class="p">,</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Column.ensure_cols-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.ensure_cols"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.ensure_cols-116"><a href="#Column.ensure_cols-116"><span class="linenos">116</span></a> <span class="nd">@classmethod</span> +</span><span id="Column.ensure_cols-117"><a href="#Column.ensure_cols-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">ensure_cols</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Column</span><span class="p">]:</span> +</span><span id="Column.ensure_cols-118"><a href="#Column.ensure_cols-118"><span class="linenos">118</span></a> <span class="k">return</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">x</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">args</span><span class="p">]</span> +</span></pre></div> + + + + + </div> + <div id="Column.invoke_anonymous_function" class="classattr"> + <input id="Column.invoke_anonymous_function-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">invoke_anonymous_function</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">column</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700330924096'</span><span class="o">></span><span class="p">]</span>,</span><span class="param"> <span class="n">func_name</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700330964112'</span><span class="o">></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.invoke_anonymous_function-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.invoke_anonymous_function"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.invoke_anonymous_function-127"><a href="#Column.invoke_anonymous_function-127"><span class="linenos">127</span></a> <span class="nd">@classmethod</span> +</span><span id="Column.invoke_anonymous_function-128"><a href="#Column.invoke_anonymous_function-128"><span class="linenos">128</span></a> <span class="k">def</span> <span class="nf">invoke_anonymous_function</span><span class="p">(</span> +</span><span id="Column.invoke_anonymous_function-129"><a href="#Column.invoke_anonymous_function-129"><span class="linenos">129</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> <span class="n">func_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">]</span> +</span><span id="Column.invoke_anonymous_function-130"><a href="#Column.invoke_anonymous_function-130"><span class="linenos">130</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.invoke_anonymous_function-131"><a href="#Column.invoke_anonymous_function-131"><span class="linenos">131</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">[]</span> <span class="k">if</span> <span class="n">column</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">column</span><span class="p">)]</span> +</span><span id="Column.invoke_anonymous_function-132"><a href="#Column.invoke_anonymous_function-132"><span class="linenos">132</span></a> <span class="n">column_args</span> <span class="o">=</span> <span class="p">[</span><span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">]</span> +</span><span id="Column.invoke_anonymous_function-133"><a href="#Column.invoke_anonymous_function-133"><span class="linenos">133</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span> <span class="o">+</span> <span class="n">column_args</span><span class="p">]</span> +</span><span id="Column.invoke_anonymous_function-134"><a href="#Column.invoke_anonymous_function-134"><span class="linenos">134</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">func_name</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Column.invoke_anonymous_function-135"><a href="#Column.invoke_anonymous_function-135"><span class="linenos">135</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.invoke_expression_over_column" class="classattr"> + <input id="Column.invoke_expression_over_column-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">invoke_expression_over_column</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">column</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331029648'</span><span class="o">></span><span class="p">]</span>,</span><span class="param"> <span class="n">callable_expression</span><span class="p">:</span> <span class="n">Callable</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.invoke_expression_over_column-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.invoke_expression_over_column"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.invoke_expression_over_column-137"><a href="#Column.invoke_expression_over_column-137"><span class="linenos">137</span></a> <span class="nd">@classmethod</span> +</span><span id="Column.invoke_expression_over_column-138"><a href="#Column.invoke_expression_over_column-138"><span class="linenos">138</span></a> <span class="k">def</span> <span class="nf">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column.invoke_expression_over_column-139"><a href="#Column.invoke_expression_over_column-139"><span class="linenos">139</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> <span class="n">callable_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="Column.invoke_expression_over_column-140"><a href="#Column.invoke_expression_over_column-140"><span class="linenos">140</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.invoke_expression_over_column-141"><a href="#Column.invoke_expression_over_column-141"><span class="linenos">141</span></a> <span class="n">ensured_column</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">column</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="bp">cls</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="Column.invoke_expression_over_column-142"><a href="#Column.invoke_expression_over_column-142"><span class="linenos">142</span></a> <span class="n">ensure_expression_values</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Column.invoke_expression_over_column-143"><a href="#Column.invoke_expression_over_column-143"><span class="linenos">143</span></a> <span class="n">k</span><span class="p">:</span> <span class="p">[</span><span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">v</span><span class="p">]</span> +</span><span id="Column.invoke_expression_over_column-144"><a href="#Column.invoke_expression_over_column-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="n">is_iterable</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> +</span><span id="Column.invoke_expression_over_column-145"><a href="#Column.invoke_expression_over_column-145"><span class="linenos">145</span></a> <span class="k">else</span> <span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">v</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.invoke_expression_over_column-146"><a href="#Column.invoke_expression_over_column-146"><span class="linenos">146</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Column.invoke_expression_over_column-147"><a href="#Column.invoke_expression_over_column-147"><span class="linenos">147</span></a> <span class="p">}</span> +</span><span id="Column.invoke_expression_over_column-148"><a href="#Column.invoke_expression_over_column-148"><span class="linenos">148</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Column.invoke_expression_over_column-149"><a href="#Column.invoke_expression_over_column-149"><span class="linenos">149</span></a> <span class="n">callable_expression</span><span class="p">(</span><span class="o">**</span><span class="n">ensure_expression_values</span><span class="p">)</span> +</span><span id="Column.invoke_expression_over_column-150"><a href="#Column.invoke_expression_over_column-150"><span class="linenos">150</span></a> <span class="k">if</span> <span class="n">ensured_column</span> <span class="ow">is</span> <span class="kc">None</span> +</span><span id="Column.invoke_expression_over_column-151"><a href="#Column.invoke_expression_over_column-151"><span class="linenos">151</span></a> <span class="k">else</span> <span class="n">callable_expression</span><span class="p">(</span> +</span><span id="Column.invoke_expression_over_column-152"><a href="#Column.invoke_expression_over_column-152"><span class="linenos">152</span></a> <span class="n">this</span><span class="o">=</span><span class="n">ensured_column</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">ensure_expression_values</span> +</span><span id="Column.invoke_expression_over_column-153"><a href="#Column.invoke_expression_over_column-153"><span class="linenos">153</span></a> <span class="p">)</span> +</span><span id="Column.invoke_expression_over_column-154"><a href="#Column.invoke_expression_over_column-154"><span class="linenos">154</span></a> <span class="p">)</span> +</span><span id="Column.invoke_expression_over_column-155"><a href="#Column.invoke_expression_over_column-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.binary_op" class="classattr"> + <input id="Column.binary_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">binary_op</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">klass</span><span class="p">:</span> <span class="n">Callable</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331083136'</span><span class="o">></span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.binary_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.binary_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.binary_op-157"><a href="#Column.binary_op-157"><span class="linenos">157</span></a> <span class="k">def</span> <span class="nf">binary_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.binary_op-158"><a href="#Column.binary_op-158"><span class="linenos">158</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="Column.binary_op-159"><a href="#Column.binary_op-159"><span class="linenos">159</span></a> <span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">Column</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Column.binary_op-160"><a href="#Column.binary_op-160"><span class="linenos">160</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.inverse_binary_op" class="classattr"> + <input id="Column.inverse_binary_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">inverse_binary_op</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">klass</span><span class="p">:</span> <span class="n">Callable</span>,</span><span class="param"> <span class="n">other</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331093216'</span><span class="o">></span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.inverse_binary_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.inverse_binary_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.inverse_binary_op-162"><a href="#Column.inverse_binary_op-162"><span class="linenos">162</span></a> <span class="k">def</span> <span class="nf">inverse_binary_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.inverse_binary_op-163"><a href="#Column.inverse_binary_op-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="Column.inverse_binary_op-164"><a href="#Column.inverse_binary_op-164"><span class="linenos">164</span></a> <span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">Column</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Column.inverse_binary_op-165"><a href="#Column.inverse_binary_op-165"><span class="linenos">165</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.unary_op" class="classattr"> + <input id="Column.unary_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unary_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">klass</span><span class="p">:</span> <span class="n">Callable</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.unary_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.unary_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.unary_op-167"><a href="#Column.unary_op-167"><span class="linenos">167</span></a> <span class="k">def</span> <span class="nf">unary_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">klass</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.unary_op-168"><a href="#Column.unary_op-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">klass</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="Column.ensure_literal" class="classattr"> + <input id="Column.ensure_literal-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">ensure_literal</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">value</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.ensure_literal-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.ensure_literal"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.ensure_literal-186"><a href="#Column.ensure_literal-186"><span class="linenos">186</span></a> <span class="nd">@classmethod</span> +</span><span id="Column.ensure_literal-187"><a href="#Column.ensure_literal-187"><span class="linenos">187</span></a> <span class="k">def</span> <span class="nf">ensure_literal</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.ensure_literal-188"><a href="#Column.ensure_literal-188"><span class="linenos">188</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="Column.ensure_literal-189"><a href="#Column.ensure_literal-189"><span class="linenos">189</span></a> +</span><span id="Column.ensure_literal-190"><a href="#Column.ensure_literal-190"><span class="linenos">190</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="bp">cls</span><span class="p">):</span> +</span><span id="Column.ensure_literal-191"><a href="#Column.ensure_literal-191"><span class="linenos">191</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.ensure_literal-192"><a href="#Column.ensure_literal-192"><span class="linenos">192</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">):</span> +</span><span id="Column.ensure_literal-193"><a href="#Column.ensure_literal-193"><span class="linenos">193</span></a> <span class="k">return</span> <span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Column.ensure_literal-194"><a href="#Column.ensure_literal-194"><span class="linenos">194</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.copy" class="classattr"> + <input id="Column.copy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">copy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.copy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.copy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.copy-196"><a href="#Column.copy-196"><span class="linenos">196</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.copy-197"><a href="#Column.copy-197"><span class="linenos">197</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span></pre></div> + + + + + </div> + <div id="Column.set_table_name" class="classattr"> + <input id="Column.set_table_name-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_table_name</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">table_name</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="n">copy</span><span class="o">=</span><span class="kc">False</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.set_table_name-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.set_table_name"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.set_table_name-199"><a href="#Column.set_table_name-199"><span class="linenos">199</span></a> <span class="k">def</span> <span class="nf">set_table_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.set_table_name-200"><a href="#Column.set_table_name-200"><span class="linenos">200</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="k">if</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.set_table_name-201"><a href="#Column.set_table_name-201"><span class="linenos">201</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table_name</span><span class="p">))</span> +</span><span id="Column.set_table_name-202"><a href="#Column.set_table_name-202"><span class="linenos">202</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.sql" class="classattr"> + <input id="Column.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Column.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.sql-204"><a href="#Column.sql-204"><span class="linenos">204</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Column.sql-205"><a href="#Column.sql-205"><span class="linenos">205</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="s2">"spark"</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> +</span></pre></div> + + + + + </div> + <div id="Column.alias" class="classattr"> + <input id="Column.alias-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">alias</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">name</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.alias-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.alias"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.alias-207"><a href="#Column.alias-207"><span class="linenos">207</span></a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.alias-208"><a href="#Column.alias-208"><span class="linenos">208</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="Column.alias-209"><a href="#Column.alias-209"><span class="linenos">209</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.asc" class="classattr"> + <input id="Column.asc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">asc</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.asc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.asc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.asc-211"><a href="#Column.asc-211"><span class="linenos">211</span></a> <span class="k">def</span> <span class="nf">asc</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.asc-212"><a href="#Column.asc-212"><span class="linenos">212</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Column.asc-213"><a href="#Column.asc-213"><span class="linenos">213</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.desc" class="classattr"> + <input id="Column.desc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">desc</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.desc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.desc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.desc-215"><a href="#Column.desc-215"><span class="linenos">215</span></a> <span class="k">def</span> <span class="nf">desc</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.desc-216"><a href="#Column.desc-216"><span class="linenos">216</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Column.desc-217"><a href="#Column.desc-217"><span class="linenos">217</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.asc_nulls_first" class="classattr"> + <input id="Column.asc_nulls_first-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">asc_nulls_first</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.asc_nulls_first-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.asc_nulls_first"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.asc_nulls_first-211"><a href="#Column.asc_nulls_first-211"><span class="linenos">211</span></a> <span class="k">def</span> <span class="nf">asc</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.asc_nulls_first-212"><a href="#Column.asc_nulls_first-212"><span class="linenos">212</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Column.asc_nulls_first-213"><a href="#Column.asc_nulls_first-213"><span class="linenos">213</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.asc_nulls_last" class="classattr"> + <input id="Column.asc_nulls_last-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">asc_nulls_last</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.asc_nulls_last-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.asc_nulls_last"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.asc_nulls_last-221"><a href="#Column.asc_nulls_last-221"><span class="linenos">221</span></a> <span class="k">def</span> <span class="nf">asc_nulls_last</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.asc_nulls_last-222"><a href="#Column.asc_nulls_last-222"><span class="linenos">222</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Column.asc_nulls_last-223"><a href="#Column.asc_nulls_last-223"><span class="linenos">223</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.desc_nulls_first" class="classattr"> + <input id="Column.desc_nulls_first-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">desc_nulls_first</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.desc_nulls_first-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.desc_nulls_first"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.desc_nulls_first-225"><a href="#Column.desc_nulls_first-225"><span class="linenos">225</span></a> <span class="k">def</span> <span class="nf">desc_nulls_first</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.desc_nulls_first-226"><a href="#Column.desc_nulls_first-226"><span class="linenos">226</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Column.desc_nulls_first-227"><a href="#Column.desc_nulls_first-227"><span class="linenos">227</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.desc_nulls_last" class="classattr"> + <input id="Column.desc_nulls_last-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">desc_nulls_last</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.desc_nulls_last-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.desc_nulls_last"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.desc_nulls_last-215"><a href="#Column.desc_nulls_last-215"><span class="linenos">215</span></a> <span class="k">def</span> <span class="nf">desc</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.desc_nulls_last-216"><a href="#Column.desc_nulls_last-216"><span class="linenos">216</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Column.desc_nulls_last-217"><a href="#Column.desc_nulls_last-217"><span class="linenos">217</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.when" class="classattr"> + <input id="Column.when-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">when</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">condition</span><span class="p">:</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Any</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.when-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.when"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.when-231"><a href="#Column.when-231"><span class="linenos">231</span></a> <span class="k">def</span> <span class="nf">when</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">condition</span><span class="p">:</span> <span class="n">Column</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.when-232"><a href="#Column.when-232"><span class="linenos">232</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">when</span> +</span><span id="Column.when-233"><a href="#Column.when-233"><span class="linenos">233</span></a> +</span><span id="Column.when-234"><a href="#Column.when-234"><span class="linenos">234</span></a> <span class="n">column_with_if</span> <span class="o">=</span> <span class="n">when</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Column.when-235"><a href="#Column.when-235"><span class="linenos">235</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">):</span> +</span><span id="Column.when-236"><a href="#Column.when-236"><span class="linenos">236</span></a> <span class="k">return</span> <span class="n">column_with_if</span> +</span><span id="Column.when-237"><a href="#Column.when-237"><span class="linenos">237</span></a> <span class="n">new_column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Column.when-238"><a href="#Column.when-238"><span class="linenos">238</span></a> <span class="n">new_column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">]</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">column_with_if</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">])</span> +</span><span id="Column.when-239"><a href="#Column.when-239"><span class="linenos">239</span></a> <span class="k">return</span> <span class="n">new_column</span> +</span></pre></div> + + + + + </div> + <div id="Column.otherwise" class="classattr"> + <input id="Column.otherwise-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">otherwise</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">value</span><span class="p">:</span> <span class="n">Any</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.otherwise-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.otherwise"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.otherwise-241"><a href="#Column.otherwise-241"><span class="linenos">241</span></a> <span class="k">def</span> <span class="nf">otherwise</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.otherwise-242"><a href="#Column.otherwise-242"><span class="linenos">242</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.functions</span> <span class="kn">import</span> <span class="n">lit</span> +</span><span id="Column.otherwise-243"><a href="#Column.otherwise-243"><span class="linenos">243</span></a> +</span><span id="Column.otherwise-244"><a href="#Column.otherwise-244"><span class="linenos">244</span></a> <span class="n">true_value</span> <span class="o">=</span> <span class="n">value</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Column.otherwise-245"><a href="#Column.otherwise-245"><span class="linenos">245</span></a> <span class="n">new_column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Column.otherwise-246"><a href="#Column.otherwise-246"><span class="linenos">246</span></a> <span class="n">new_column</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"default"</span><span class="p">,</span> <span class="n">true_value</span><span class="o">.</span><span class="n">column_expression</span><span class="p">)</span> +</span><span id="Column.otherwise-247"><a href="#Column.otherwise-247"><span class="linenos">247</span></a> <span class="k">return</span> <span class="n">new_column</span> +</span></pre></div> + + + + + </div> + <div id="Column.isNull" class="classattr"> + <input id="Column.isNull-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">isNull</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.isNull-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.isNull"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.isNull-249"><a href="#Column.isNull-249"><span class="linenos">249</span></a> <span class="k">def</span> <span class="nf">isNull</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.isNull-250"><a href="#Column.isNull-250"><span class="linenos">250</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">())</span> +</span><span id="Column.isNull-251"><a href="#Column.isNull-251"><span class="linenos">251</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.isNotNull" class="classattr"> + <input id="Column.isNotNull-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">isNotNull</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.isNotNull-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.isNotNull"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.isNotNull-253"><a href="#Column.isNotNull-253"><span class="linenos">253</span></a> <span class="k">def</span> <span class="nf">isNotNull</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.isNotNull-254"><a href="#Column.isNotNull-254"><span class="linenos">254</span></a> <span class="n">new_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">()))</span> +</span><span id="Column.isNotNull-255"><a href="#Column.isNotNull-255"><span class="linenos">255</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">new_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.cast" class="classattr"> + <input id="Column.cast-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cast</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">dataType</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">dataframe</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">types</span><span class="o">.</span><span class="n">DataType</span><span class="p">]</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Column.cast-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.cast"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.cast-257"><a href="#Column.cast-257"><span class="linenos">257</span></a> <span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dataType</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">DataType</span><span class="p">]):</span> +</span><span id="Column.cast-258"><a href="#Column.cast-258"><span class="linenos">258</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Column.cast-259"><a href="#Column.cast-259"><span class="linenos">259</span></a><span class="sd"> Functionality Difference: PySpark cast accepts a datatype instance of the datatype class</span> +</span><span id="Column.cast-260"><a href="#Column.cast-260"><span class="linenos">260</span></a><span class="sd"> Sqlglot doesn't currently replicate this class so it only accepts a string</span> +</span><span id="Column.cast-261"><a href="#Column.cast-261"><span class="linenos">261</span></a><span class="sd"> """</span> +</span><span id="Column.cast-262"><a href="#Column.cast-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dataType</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="Column.cast-263"><a href="#Column.cast-263"><span class="linenos">263</span></a> <span class="n">dataType</span> <span class="o">=</span> <span class="n">dataType</span><span class="o">.</span><span class="n">simpleString</span><span class="p">()</span> +</span><span id="Column.cast-264"><a href="#Column.cast-264"><span class="linenos">264</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> <span class="n">dataType</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Functionality Difference: PySpark cast accepts a datatype instance of the datatype class +Sqlglot doesn't currently replicate this class so it only accepts a string</p> +</div> + + + </div> + <div id="Column.startswith" class="classattr"> + <input id="Column.startswith-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">startswith</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.startswith-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.startswith"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.startswith-266"><a href="#Column.startswith-266"><span class="linenos">266</span></a> <span class="k">def</span> <span class="nf">startswith</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.startswith-267"><a href="#Column.startswith-267"><span class="linenos">267</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">value</span> +</span><span id="Column.startswith-268"><a href="#Column.startswith-268"><span class="linenos">268</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_anonymous_function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">"STARTSWITH"</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.endswith" class="classattr"> + <input id="Column.endswith-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">endswith</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.endswith-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.endswith"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.endswith-270"><a href="#Column.endswith-270"><span class="linenos">270</span></a> <span class="k">def</span> <span class="nf">endswith</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.endswith-271"><a href="#Column.endswith-271"><span class="linenos">271</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">value</span> +</span><span id="Column.endswith-272"><a href="#Column.endswith-272"><span class="linenos">272</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_anonymous_function</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">"ENDSWITH"</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.rlike" class="classattr"> + <input id="Column.rlike-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rlike</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">regexp</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.rlike-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.rlike"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.rlike-274"><a href="#Column.rlike-274"><span class="linenos">274</span></a> <span class="k">def</span> <span class="nf">rlike</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">regexp</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.rlike-275"><a href="#Column.rlike-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column.rlike-276"><a href="#Column.rlike-276"><span class="linenos">276</span></a> <span class="n">column</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">callable_expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">regexp</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.rlike-277"><a href="#Column.rlike-277"><span class="linenos">277</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.like" class="classattr"> + <input id="Column.like-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">like</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">other</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Column.like-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.like"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.like-279"><a href="#Column.like-279"><span class="linenos">279</span></a> <span class="k">def</span> <span class="nf">like</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Column.like-280"><a href="#Column.like-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column.like-281"><a href="#Column.like-281"><span class="linenos">281</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.like-282"><a href="#Column.like-282"><span class="linenos">282</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.ilike" class="classattr"> + <input id="Column.ilike-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ilike</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">other</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Column.ilike-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.ilike"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.ilike-284"><a href="#Column.ilike-284"><span class="linenos">284</span></a> <span class="k">def</span> <span class="nf">ilike</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Column.ilike-285"><a href="#Column.ilike-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column.ilike-286"><a href="#Column.ilike-286"><span class="linenos">286</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">other</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.ilike-287"><a href="#Column.ilike-287"><span class="linenos">287</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.substr" class="classattr"> + <input id="Column.substr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">substr</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">startPos</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">length</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.substr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.substr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.substr-289"><a href="#Column.substr-289"><span class="linenos">289</span></a> <span class="k">def</span> <span class="nf">substr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">startPos</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">Column</span><span class="p">],</span> <span class="n">length</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">Column</span><span class="p">])</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.substr-290"><a href="#Column.substr-290"><span class="linenos">290</span></a> <span class="n">startPos</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">startPos</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">startPos</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">startPos</span> +</span><span id="Column.substr-291"><a href="#Column.substr-291"><span class="linenos">291</span></a> <span class="n">length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">length</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">length</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">length</span> +</span><span id="Column.substr-292"><a href="#Column.substr-292"><span class="linenos">292</span></a> <span class="k">return</span> <span class="n">Column</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span> +</span><span id="Column.substr-293"><a href="#Column.substr-293"><span class="linenos">293</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="n">startPos</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="n">length</span><span class="o">.</span><span class="n">expression</span> +</span><span id="Column.substr-294"><a href="#Column.substr-294"><span class="linenos">294</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.isin" class="classattr"> + <input id="Column.isin-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">isin</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331213104'</span><span class="o">></span><span class="p">,</span> <span class="n">Iterable</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331213104'</span><span class="o">></span><span class="p">]]</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Column.isin-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.isin"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.isin-296"><a href="#Column.isin-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="nf">isin</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">]]):</span> +</span><span id="Column.isin-297"><a href="#Column.isin-297"><span class="linenos">297</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">))</span> <span class="k">else</span> <span class="n">cols</span> <span class="c1"># type: ignore</span> +</span><span id="Column.isin-298"><a href="#Column.isin-298"><span class="linenos">298</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">]</span> +</span><span id="Column.isin-299"><a href="#Column.isin-299"><span class="linenos">299</span></a> <span class="k">return</span> <span class="n">Column</span><span class="o">.</span><span class="n">invoke_expression_over_column</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span></pre></div> + + + + + </div> + <div id="Column.between" class="classattr"> + <input id="Column.between-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">between</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">lowerBound</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700331299440'</span><span class="o">></span>,</span><span class="param"> <span class="n">upperBound</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329240384'</span><span class="o">></span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.between-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.between"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.between-301"><a href="#Column.between-301"><span class="linenos">301</span></a> <span class="k">def</span> <span class="nf">between</span><span class="p">(</span> +</span><span id="Column.between-302"><a href="#Column.between-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Column.between-303"><a href="#Column.between-303"><span class="linenos">303</span></a> <span class="n">lowerBound</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> +</span><span id="Column.between-304"><a href="#Column.between-304"><span class="linenos">304</span></a> <span class="n">upperBound</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrLiteral</span><span class="p">],</span> +</span><span id="Column.between-305"><a href="#Column.between-305"><span class="linenos">305</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.between-306"><a href="#Column.between-306"><span class="linenos">306</span></a> <span class="n">lower_bound_exp</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Column.between-307"><a href="#Column.between-307"><span class="linenos">307</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">lowerBound</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">lowerBound</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">lowerBound</span> +</span><span id="Column.between-308"><a href="#Column.between-308"><span class="linenos">308</span></a> <span class="p">)</span> +</span><span id="Column.between-309"><a href="#Column.between-309"><span class="linenos">309</span></a> <span class="n">upper_bound_exp</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Column.between-310"><a href="#Column.between-310"><span class="linenos">310</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_lit</span><span class="p">(</span><span class="n">upperBound</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">upperBound</span><span class="p">,</span> <span class="n">Column</span><span class="p">)</span> <span class="k">else</span> <span class="n">upperBound</span> +</span><span id="Column.between-311"><a href="#Column.between-311"><span class="linenos">311</span></a> <span class="p">)</span> +</span><span id="Column.between-312"><a href="#Column.between-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="Column.between-313"><a href="#Column.between-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">(</span> +</span><span id="Column.between-314"><a href="#Column.between-314"><span class="linenos">314</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">,</span> +</span><span id="Column.between-315"><a href="#Column.between-315"><span class="linenos">315</span></a> <span class="n">low</span><span class="o">=</span><span class="n">lower_bound_exp</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Column.between-316"><a href="#Column.between-316"><span class="linenos">316</span></a> <span class="n">high</span><span class="o">=</span><span class="n">upper_bound_exp</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Column.between-317"><a href="#Column.between-317"><span class="linenos">317</span></a> <span class="p">)</span> +</span><span id="Column.between-318"><a href="#Column.between-318"><span class="linenos">318</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Column.over" class="classattr"> + <input id="Column.over-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">over</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">window</span><span class="p">:</span> <span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329314480'</span><span class="o">></span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.dataframe.sql.Column</a></span>:</span></span> + + <label class="view-source-button" for="Column.over-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column.over"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column.over-320"><a href="#Column.over-320"><span class="linenos">320</span></a> <span class="k">def</span> <span class="nf">over</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">window</span><span class="p">:</span> <span class="n">WindowSpec</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="Column.over-321"><a href="#Column.over-321"><span class="linenos">321</span></a> <span class="n">window_expression</span> <span class="o">=</span> <span class="n">window</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Column.over-322"><a href="#Column.over-322"><span class="linenos">322</span></a> <span class="n">window_expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_expression</span><span class="p">)</span> +</span><span id="Column.over-323"><a href="#Column.over-323"><span class="linenos">323</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">window_expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="DataFrameNaFunctions"> + <input id="DataFrameNaFunctions-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataFrameNaFunctions</span>: + + <label class="view-source-button" for="DataFrameNaFunctions-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameNaFunctions"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameNaFunctions-785"><a href="#DataFrameNaFunctions-785"><span class="linenos">785</span></a><span class="k">class</span> <span class="nc">DataFrameNaFunctions</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions-786"><a href="#DataFrameNaFunctions-786"><span class="linenos">786</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">):</span> +</span><span id="DataFrameNaFunctions-787"><a href="#DataFrameNaFunctions-787"><span class="linenos">787</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">df</span> <span class="o">=</span> <span class="n">df</span> +</span><span id="DataFrameNaFunctions-788"><a href="#DataFrameNaFunctions-788"><span class="linenos">788</span></a> +</span><span id="DataFrameNaFunctions-789"><a href="#DataFrameNaFunctions-789"><span class="linenos">789</span></a> <span class="k">def</span> <span class="nf">drop</span><span class="p">(</span> +</span><span id="DataFrameNaFunctions-790"><a href="#DataFrameNaFunctions-790"><span class="linenos">790</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-791"><a href="#DataFrameNaFunctions-791"><span class="linenos">791</span></a> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-792"><a href="#DataFrameNaFunctions-792"><span class="linenos">792</span></a> <span class="n">thresh</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-793"><a href="#DataFrameNaFunctions-793"><span class="linenos">793</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-794"><a href="#DataFrameNaFunctions-794"><span class="linenos">794</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions-795"><a href="#DataFrameNaFunctions-795"><span class="linenos">795</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">df</span><span class="o">.</span><span class="n">dropna</span><span class="p">(</span><span class="n">how</span><span class="o">=</span><span class="n">how</span><span class="p">,</span> <span class="n">thresh</span><span class="o">=</span><span class="n">thresh</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="n">subset</span><span class="p">)</span> +</span><span id="DataFrameNaFunctions-796"><a href="#DataFrameNaFunctions-796"><span class="linenos">796</span></a> +</span><span id="DataFrameNaFunctions-797"><a href="#DataFrameNaFunctions-797"><span class="linenos">797</span></a> <span class="k">def</span> <span class="nf">fill</span><span class="p">(</span> +</span><span id="DataFrameNaFunctions-798"><a href="#DataFrameNaFunctions-798"><span class="linenos">798</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-799"><a href="#DataFrameNaFunctions-799"><span class="linenos">799</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]],</span> +</span><span id="DataFrameNaFunctions-800"><a href="#DataFrameNaFunctions-800"><span class="linenos">800</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-801"><a href="#DataFrameNaFunctions-801"><span class="linenos">801</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions-802"><a href="#DataFrameNaFunctions-802"><span class="linenos">802</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">df</span><span class="o">.</span><span class="n">fillna</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="n">subset</span><span class="p">)</span> +</span><span id="DataFrameNaFunctions-803"><a href="#DataFrameNaFunctions-803"><span class="linenos">803</span></a> +</span><span id="DataFrameNaFunctions-804"><a href="#DataFrameNaFunctions-804"><span class="linenos">804</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span> +</span><span id="DataFrameNaFunctions-805"><a href="#DataFrameNaFunctions-805"><span class="linenos">805</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-806"><a href="#DataFrameNaFunctions-806"><span class="linenos">806</span></a> <span class="n">to_replace</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">],</span> +</span><span id="DataFrameNaFunctions-807"><a href="#DataFrameNaFunctions-807"><span class="linenos">807</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-808"><a href="#DataFrameNaFunctions-808"><span class="linenos">808</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions-809"><a href="#DataFrameNaFunctions-809"><span class="linenos">809</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions-810"><a href="#DataFrameNaFunctions-810"><span class="linenos">810</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">df</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">to_replace</span><span class="o">=</span><span class="n">to_replace</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="n">subset</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="DataFrameNaFunctions.__init__" class="classattr"> + <input id="DataFrameNaFunctions.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">DataFrameNaFunctions</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">df</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span></span>)</span> + + <label class="view-source-button" for="DataFrameNaFunctions.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameNaFunctions.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameNaFunctions.__init__-786"><a href="#DataFrameNaFunctions.__init__-786"><span class="linenos">786</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">):</span> +</span><span id="DataFrameNaFunctions.__init__-787"><a href="#DataFrameNaFunctions.__init__-787"><span class="linenos">787</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">df</span> <span class="o">=</span> <span class="n">df</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameNaFunctions.drop" class="classattr"> + <input id="DataFrameNaFunctions.drop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">drop</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">'any'</span>,</span><span class="param"> <span class="n">thresh</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">subset</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameNaFunctions.drop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameNaFunctions.drop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameNaFunctions.drop-789"><a href="#DataFrameNaFunctions.drop-789"><span class="linenos">789</span></a> <span class="k">def</span> <span class="nf">drop</span><span class="p">(</span> +</span><span id="DataFrameNaFunctions.drop-790"><a href="#DataFrameNaFunctions.drop-790"><span class="linenos">790</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.drop-791"><a href="#DataFrameNaFunctions.drop-791"><span class="linenos">791</span></a> <span class="n">how</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.drop-792"><a href="#DataFrameNaFunctions.drop-792"><span class="linenos">792</span></a> <span class="n">thresh</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.drop-793"><a href="#DataFrameNaFunctions.drop-793"><span class="linenos">793</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.drop-794"><a href="#DataFrameNaFunctions.drop-794"><span class="linenos">794</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions.drop-795"><a href="#DataFrameNaFunctions.drop-795"><span class="linenos">795</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">df</span><span class="o">.</span><span class="n">dropna</span><span class="p">(</span><span class="n">how</span><span class="o">=</span><span class="n">how</span><span class="p">,</span> <span class="n">thresh</span><span class="o">=</span><span class="n">thresh</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="n">subset</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameNaFunctions.fill" class="classattr"> + <input id="DataFrameNaFunctions.fill-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">fill</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]]</span>,</span><span class="param"> <span class="n">subset</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameNaFunctions.fill-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameNaFunctions.fill"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameNaFunctions.fill-797"><a href="#DataFrameNaFunctions.fill-797"><span class="linenos">797</span></a> <span class="k">def</span> <span class="nf">fill</span><span class="p">(</span> +</span><span id="DataFrameNaFunctions.fill-798"><a href="#DataFrameNaFunctions.fill-798"><span class="linenos">798</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.fill-799"><a href="#DataFrameNaFunctions.fill-799"><span class="linenos">799</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]],</span> +</span><span id="DataFrameNaFunctions.fill-800"><a href="#DataFrameNaFunctions.fill-800"><span class="linenos">800</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.fill-801"><a href="#DataFrameNaFunctions.fill-801"><span class="linenos">801</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions.fill-802"><a href="#DataFrameNaFunctions.fill-802"><span class="linenos">802</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">df</span><span class="o">.</span><span class="n">fillna</span><span class="p">(</span><span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="n">subset</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameNaFunctions.replace" class="classattr"> + <input id="DataFrameNaFunctions.replace-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">to_replace</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Dict</span><span class="p">]</span>,</span><span class="param"> <span class="n">value</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">subset</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameNaFunctions.replace-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameNaFunctions.replace"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameNaFunctions.replace-804"><a href="#DataFrameNaFunctions.replace-804"><span class="linenos">804</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span> +</span><span id="DataFrameNaFunctions.replace-805"><a href="#DataFrameNaFunctions.replace-805"><span class="linenos">805</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.replace-806"><a href="#DataFrameNaFunctions.replace-806"><span class="linenos">806</span></a> <span class="n">to_replace</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">],</span> +</span><span id="DataFrameNaFunctions.replace-807"><a href="#DataFrameNaFunctions.replace-807"><span class="linenos">807</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.replace-808"><a href="#DataFrameNaFunctions.replace-808"><span class="linenos">808</span></a> <span class="n">subset</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameNaFunctions.replace-809"><a href="#DataFrameNaFunctions.replace-809"><span class="linenos">809</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameNaFunctions.replace-810"><a href="#DataFrameNaFunctions.replace-810"><span class="linenos">810</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">df</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">to_replace</span><span class="o">=</span><span class="n">to_replace</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="n">subset</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="Window"> + <input id="Window-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Window</span>: + + <label class="view-source-button" for="Window-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Window"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Window-15"><a href="#Window-15"><span class="linenos">15</span></a><span class="k">class</span> <span class="nc">Window</span><span class="p">:</span> +</span><span id="Window-16"><a href="#Window-16"><span class="linenos">16</span></a> <span class="n">_JAVA_MIN_LONG</span> <span class="o">=</span> <span class="o">-</span><span class="p">(</span><span class="mi">1</span> <span class="o"><<</span> <span class="mi">63</span><span class="p">)</span> <span class="c1"># -9223372036854775808</span> +</span><span id="Window-17"><a href="#Window-17"><span class="linenos">17</span></a> <span class="n">_JAVA_MAX_LONG</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span> <span class="o"><<</span> <span class="mi">63</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span> <span class="c1"># 9223372036854775807</span> +</span><span id="Window-18"><a href="#Window-18"><span class="linenos">18</span></a> <span class="n">_PRECEDING_THRESHOLD</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="o">-</span><span class="n">sys</span><span class="o">.</span><span class="n">maxsize</span><span class="p">,</span> <span class="n">_JAVA_MIN_LONG</span><span class="p">)</span> +</span><span id="Window-19"><a href="#Window-19"><span class="linenos">19</span></a> <span class="n">_FOLLOWING_THRESHOLD</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">maxsize</span><span class="p">,</span> <span class="n">_JAVA_MAX_LONG</span><span class="p">)</span> +</span><span id="Window-20"><a href="#Window-20"><span class="linenos">20</span></a> +</span><span id="Window-21"><a href="#Window-21"><span class="linenos">21</span></a> <span class="n">unboundedPreceding</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">_JAVA_MIN_LONG</span> +</span><span id="Window-22"><a href="#Window-22"><span class="linenos">22</span></a> +</span><span id="Window-23"><a href="#Window-23"><span class="linenos">23</span></a> <span class="n">unboundedFollowing</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">_JAVA_MAX_LONG</span> +</span><span id="Window-24"><a href="#Window-24"><span class="linenos">24</span></a> +</span><span id="Window-25"><a href="#Window-25"><span class="linenos">25</span></a> <span class="n">currentRow</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Window-26"><a href="#Window-26"><span class="linenos">26</span></a> +</span><span id="Window-27"><a href="#Window-27"><span class="linenos">27</span></a> <span class="nd">@classmethod</span> +</span><span id="Window-28"><a href="#Window-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">partitionBy</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window-29"><a href="#Window-29"><span class="linenos">29</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">partitionBy</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span><span id="Window-30"><a href="#Window-30"><span class="linenos">30</span></a> +</span><span id="Window-31"><a href="#Window-31"><span class="linenos">31</span></a> <span class="nd">@classmethod</span> +</span><span id="Window-32"><a href="#Window-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window-33"><a href="#Window-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">orderBy</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span><span id="Window-34"><a href="#Window-34"><span class="linenos">34</span></a> +</span><span id="Window-35"><a href="#Window-35"><span class="linenos">35</span></a> <span class="nd">@classmethod</span> +</span><span id="Window-36"><a href="#Window-36"><span class="linenos">36</span></a> <span class="k">def</span> <span class="nf">rowsBetween</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window-37"><a href="#Window-37"><span class="linenos">37</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">rowsBetween</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="Window-38"><a href="#Window-38"><span class="linenos">38</span></a> +</span><span id="Window-39"><a href="#Window-39"><span class="linenos">39</span></a> <span class="nd">@classmethod</span> +</span><span id="Window-40"><a href="#Window-40"><span class="linenos">40</span></a> <span class="k">def</span> <span class="nf">rangeBetween</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window-41"><a href="#Window-41"><span class="linenos">41</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">rangeBetween</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Window.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Window</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Window.__init__"></a> + + + + </div> + <div id="Window.partitionBy" class="classattr"> + <input id="Window.partitionBy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">partitionBy</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329626592'</span><span class="o">></span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329626592'</span><span class="o">></span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="Window.partitionBy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Window.partitionBy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Window.partitionBy-27"><a href="#Window.partitionBy-27"><span class="linenos">27</span></a> <span class="nd">@classmethod</span> +</span><span id="Window.partitionBy-28"><a href="#Window.partitionBy-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">partitionBy</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window.partitionBy-29"><a href="#Window.partitionBy-29"><span class="linenos">29</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">partitionBy</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Window.orderBy" class="classattr"> + <input id="Window.orderBy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">orderBy</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329828768'</span><span class="o">></span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329828768'</span><span class="o">></span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="Window.orderBy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Window.orderBy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Window.orderBy-31"><a href="#Window.orderBy-31"><span class="linenos">31</span></a> <span class="nd">@classmethod</span> +</span><span id="Window.orderBy-32"><a href="#Window.orderBy-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window.orderBy-33"><a href="#Window.orderBy-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">orderBy</span><span class="p">(</span><span class="o">*</span><span class="n">cols</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Window.rowsBetween" class="classattr"> + <input id="Window.rowsBetween-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">rowsBetween</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">start</span><span class="p">:</span> <span class="nb">int</span>, </span><span class="param"><span class="n">end</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="Window.rowsBetween-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Window.rowsBetween"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Window.rowsBetween-35"><a href="#Window.rowsBetween-35"><span class="linenos">35</span></a> <span class="nd">@classmethod</span> +</span><span id="Window.rowsBetween-36"><a href="#Window.rowsBetween-36"><span class="linenos">36</span></a> <span class="k">def</span> <span class="nf">rowsBetween</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window.rowsBetween-37"><a href="#Window.rowsBetween-37"><span class="linenos">37</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">rowsBetween</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Window.rangeBetween" class="classattr"> + <input id="Window.rangeBetween-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">rangeBetween</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">start</span><span class="p">:</span> <span class="nb">int</span>, </span><span class="param"><span class="n">end</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="Window.rangeBetween-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Window.rangeBetween"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Window.rangeBetween-39"><a href="#Window.rangeBetween-39"><span class="linenos">39</span></a> <span class="nd">@classmethod</span> +</span><span id="Window.rangeBetween-40"><a href="#Window.rangeBetween-40"><span class="linenos">40</span></a> <span class="k">def</span> <span class="nf">rangeBetween</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="Window.rangeBetween-41"><a href="#Window.rangeBetween-41"><span class="linenos">41</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">()</span><span class="o">.</span><span class="n">rangeBetween</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="WindowSpec"> + <input id="WindowSpec-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">WindowSpec</span>: + + <label class="view-source-button" for="WindowSpec-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec-44"><a href="#WindowSpec-44"><span class="linenos"> 44</span></a><span class="k">class</span> <span class="nc">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec-45"><a href="#WindowSpec-45"><span class="linenos"> 45</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">()):</span> +</span><span id="WindowSpec-46"><a href="#WindowSpec-46"><span class="linenos"> 46</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="WindowSpec-47"><a href="#WindowSpec-47"><span class="linenos"> 47</span></a> +</span><span id="WindowSpec-48"><a href="#WindowSpec-48"><span class="linenos"> 48</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="WindowSpec-49"><a href="#WindowSpec-49"><span class="linenos"> 49</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="WindowSpec-50"><a href="#WindowSpec-50"><span class="linenos"> 50</span></a> +</span><span id="WindowSpec-51"><a href="#WindowSpec-51"><span class="linenos"> 51</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="WindowSpec-52"><a href="#WindowSpec-52"><span class="linenos"> 52</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="WindowSpec-53"><a href="#WindowSpec-53"><span class="linenos"> 53</span></a> +</span><span id="WindowSpec-54"><a href="#WindowSpec-54"><span class="linenos"> 54</span></a> <span class="k">def</span> <span class="nf">partitionBy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec-55"><a href="#WindowSpec-55"><span class="linenos"> 55</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.column</span> <span class="kn">import</span> <span class="n">Column</span> +</span><span id="WindowSpec-56"><a href="#WindowSpec-56"><span class="linenos"> 56</span></a> +</span><span id="WindowSpec-57"><a href="#WindowSpec-57"><span class="linenos"> 57</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">))</span> <span class="k">else</span> <span class="n">cols</span> <span class="c1"># type: ignore</span> +</span><span id="WindowSpec-58"><a href="#WindowSpec-58"><span class="linenos"> 58</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span> +</span><span id="WindowSpec-59"><a href="#WindowSpec-59"><span class="linenos"> 59</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec-60"><a href="#WindowSpec-60"><span class="linenos"> 60</span></a> <span class="n">partition_by_expressions</span> <span class="o">=</span> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="WindowSpec-61"><a href="#WindowSpec-61"><span class="linenos"> 61</span></a> <span class="n">partition_by_expressions</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="WindowSpec-62"><a href="#WindowSpec-62"><span class="linenos"> 62</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="n">partition_by_expressions</span><span class="p">)</span> +</span><span id="WindowSpec-63"><a href="#WindowSpec-63"><span class="linenos"> 63</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span><span id="WindowSpec-64"><a href="#WindowSpec-64"><span class="linenos"> 64</span></a> +</span><span id="WindowSpec-65"><a href="#WindowSpec-65"><span class="linenos"> 65</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec-66"><a href="#WindowSpec-66"><span class="linenos"> 66</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.column</span> <span class="kn">import</span> <span class="n">Column</span> +</span><span id="WindowSpec-67"><a href="#WindowSpec-67"><span class="linenos"> 67</span></a> +</span><span id="WindowSpec-68"><a href="#WindowSpec-68"><span class="linenos"> 68</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">))</span> <span class="k">else</span> <span class="n">cols</span> <span class="c1"># type: ignore</span> +</span><span id="WindowSpec-69"><a href="#WindowSpec-69"><span class="linenos"> 69</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span> +</span><span id="WindowSpec-70"><a href="#WindowSpec-70"><span class="linenos"> 70</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec-71"><a href="#WindowSpec-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="WindowSpec-72"><a href="#WindowSpec-72"><span class="linenos"> 72</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"order"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[]))</span> +</span><span id="WindowSpec-73"><a href="#WindowSpec-73"><span class="linenos"> 73</span></a> <span class="n">order_by</span> <span class="o">=</span> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"order"</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="WindowSpec-74"><a href="#WindowSpec-74"><span class="linenos"> 74</span></a> <span class="n">order_by</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="WindowSpec-75"><a href="#WindowSpec-75"><span class="linenos"> 75</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"order"</span><span class="p">]</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">order_by</span><span class="p">)</span> +</span><span id="WindowSpec-76"><a href="#WindowSpec-76"><span class="linenos"> 76</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span><span id="WindowSpec-77"><a href="#WindowSpec-77"><span class="linenos"> 77</span></a> +</span><span id="WindowSpec-78"><a href="#WindowSpec-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">_calc_start_end</span><span class="p">(</span> +</span><span id="WindowSpec-79"><a href="#WindowSpec-79"><span class="linenos"> 79</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span> +</span><span id="WindowSpec-80"><a href="#WindowSpec-80"><span class="linenos"> 80</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="WindowSpec-81"><a href="#WindowSpec-81"><span class="linenos"> 81</span></a> <span class="n">kwargs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="WindowSpec-82"><a href="#WindowSpec-82"><span class="linenos"> 82</span></a> <span class="s2">"start_side"</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="WindowSpec-83"><a href="#WindowSpec-83"><span class="linenos"> 83</span></a> <span class="s2">"end_side"</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="WindowSpec-84"><a href="#WindowSpec-84"><span class="linenos"> 84</span></a> <span class="p">}</span> +</span><span id="WindowSpec-85"><a href="#WindowSpec-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="n">start</span> <span class="o">==</span> <span class="n">Window</span><span class="o">.</span><span class="n">currentRow</span><span class="p">:</span> +</span><span id="WindowSpec-86"><a href="#WindowSpec-86"><span class="linenos"> 86</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"start"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"CURRENT ROW"</span> +</span><span id="WindowSpec-87"><a href="#WindowSpec-87"><span class="linenos"> 87</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="WindowSpec-88"><a href="#WindowSpec-88"><span class="linenos"> 88</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="WindowSpec-89"><a href="#WindowSpec-89"><span class="linenos"> 89</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="WindowSpec-90"><a href="#WindowSpec-90"><span class="linenos"> 90</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="WindowSpec-91"><a href="#WindowSpec-91"><span class="linenos"> 91</span></a> <span class="s2">"start_side"</span><span class="p">:</span> <span class="s2">"PRECEDING"</span><span class="p">,</span> +</span><span id="WindowSpec-92"><a href="#WindowSpec-92"><span class="linenos"> 92</span></a> <span class="s2">"start"</span><span class="p">:</span> <span class="s2">"UNBOUNDED"</span> +</span><span id="WindowSpec-93"><a href="#WindowSpec-93"><span class="linenos"> 93</span></a> <span class="k">if</span> <span class="n">start</span> <span class="o"><=</span> <span class="n">Window</span><span class="o">.</span><span class="n">unboundedPreceding</span> +</span><span id="WindowSpec-94"><a href="#WindowSpec-94"><span class="linenos"> 94</span></a> <span class="k">else</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">start</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="WindowSpec-95"><a href="#WindowSpec-95"><span class="linenos"> 95</span></a> <span class="p">},</span> +</span><span id="WindowSpec-96"><a href="#WindowSpec-96"><span class="linenos"> 96</span></a> <span class="p">}</span> +</span><span id="WindowSpec-97"><a href="#WindowSpec-97"><span class="linenos"> 97</span></a> <span class="k">if</span> <span class="n">end</span> <span class="o">==</span> <span class="n">Window</span><span class="o">.</span><span class="n">currentRow</span><span class="p">:</span> +</span><span id="WindowSpec-98"><a href="#WindowSpec-98"><span class="linenos"> 98</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"end"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"CURRENT ROW"</span> +</span><span id="WindowSpec-99"><a href="#WindowSpec-99"><span class="linenos"> 99</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="WindowSpec-100"><a href="#WindowSpec-100"><span class="linenos">100</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="WindowSpec-101"><a href="#WindowSpec-101"><span class="linenos">101</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="WindowSpec-102"><a href="#WindowSpec-102"><span class="linenos">102</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="WindowSpec-103"><a href="#WindowSpec-103"><span class="linenos">103</span></a> <span class="s2">"end_side"</span><span class="p">:</span> <span class="s2">"FOLLOWING"</span><span class="p">,</span> +</span><span id="WindowSpec-104"><a href="#WindowSpec-104"><span class="linenos">104</span></a> <span class="s2">"end"</span><span class="p">:</span> <span class="s2">"UNBOUNDED"</span> +</span><span id="WindowSpec-105"><a href="#WindowSpec-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="n">end</span> <span class="o">>=</span> <span class="n">Window</span><span class="o">.</span><span class="n">unboundedFollowing</span> +</span><span id="WindowSpec-106"><a href="#WindowSpec-106"><span class="linenos">106</span></a> <span class="k">else</span> <span class="n">F</span><span class="o">.</span><span class="n">lit</span><span class="p">(</span><span class="n">end</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="WindowSpec-107"><a href="#WindowSpec-107"><span class="linenos">107</span></a> <span class="p">},</span> +</span><span id="WindowSpec-108"><a href="#WindowSpec-108"><span class="linenos">108</span></a> <span class="p">}</span> +</span><span id="WindowSpec-109"><a href="#WindowSpec-109"><span class="linenos">109</span></a> <span class="k">return</span> <span class="n">kwargs</span> +</span><span id="WindowSpec-110"><a href="#WindowSpec-110"><span class="linenos">110</span></a> +</span><span id="WindowSpec-111"><a href="#WindowSpec-111"><span class="linenos">111</span></a> <span class="k">def</span> <span class="nf">rowsBetween</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec-112"><a href="#WindowSpec-112"><span class="linenos">112</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec-113"><a href="#WindowSpec-113"><span class="linenos">113</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_calc_start_end</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="WindowSpec-114"><a href="#WindowSpec-114"><span class="linenos">114</span></a> <span class="n">spec</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"ROWS"</span> +</span><span id="WindowSpec-115"><a href="#WindowSpec-115"><span class="linenos">115</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="WindowSpec-116"><a href="#WindowSpec-116"><span class="linenos">116</span></a> <span class="s2">"spec"</span><span class="p">,</span> +</span><span id="WindowSpec-117"><a href="#WindowSpec-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">(</span> +</span><span id="WindowSpec-118"><a href="#WindowSpec-118"><span class="linenos">118</span></a> <span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">spec</span><span class="p">}</span> +</span><span id="WindowSpec-119"><a href="#WindowSpec-119"><span class="linenos">119</span></a> <span class="p">),</span> +</span><span id="WindowSpec-120"><a href="#WindowSpec-120"><span class="linenos">120</span></a> <span class="p">)</span> +</span><span id="WindowSpec-121"><a href="#WindowSpec-121"><span class="linenos">121</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span><span id="WindowSpec-122"><a href="#WindowSpec-122"><span class="linenos">122</span></a> +</span><span id="WindowSpec-123"><a href="#WindowSpec-123"><span class="linenos">123</span></a> <span class="k">def</span> <span class="nf">rangeBetween</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec-124"><a href="#WindowSpec-124"><span class="linenos">124</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec-125"><a href="#WindowSpec-125"><span class="linenos">125</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_calc_start_end</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="WindowSpec-126"><a href="#WindowSpec-126"><span class="linenos">126</span></a> <span class="n">spec</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"RANGE"</span> +</span><span id="WindowSpec-127"><a href="#WindowSpec-127"><span class="linenos">127</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="WindowSpec-128"><a href="#WindowSpec-128"><span class="linenos">128</span></a> <span class="s2">"spec"</span><span class="p">,</span> +</span><span id="WindowSpec-129"><a href="#WindowSpec-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">(</span> +</span><span id="WindowSpec-130"><a href="#WindowSpec-130"><span class="linenos">130</span></a> <span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">spec</span><span class="p">}</span> +</span><span id="WindowSpec-131"><a href="#WindowSpec-131"><span class="linenos">131</span></a> <span class="p">),</span> +</span><span id="WindowSpec-132"><a href="#WindowSpec-132"><span class="linenos">132</span></a> <span class="p">)</span> +</span><span id="WindowSpec-133"><a href="#WindowSpec-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span></pre></div> + + + + + <div id="WindowSpec.__init__" class="classattr"> + <input id="WindowSpec.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">WindowSpec</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span> <span class="o">=</span> <span class="p">(</span><span class="n">WINDOW</span> <span class="p">)</span></span>)</span> + + <label class="view-source-button" for="WindowSpec.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.__init__-45"><a href="#WindowSpec.__init__-45"><span class="linenos">45</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">()):</span> +</span><span id="WindowSpec.__init__-46"><a href="#WindowSpec.__init__-46"><span class="linenos">46</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span></pre></div> + + + + + </div> + <div id="WindowSpec.copy" class="classattr"> + <input id="WindowSpec.copy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">copy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="WindowSpec.copy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.copy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.copy-48"><a href="#WindowSpec.copy-48"><span class="linenos">48</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="WindowSpec.copy-49"><a href="#WindowSpec.copy-49"><span class="linenos">49</span></a> <span class="k">return</span> <span class="n">WindowSpec</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span></pre></div> + + + + + </div> + <div id="WindowSpec.sql" class="classattr"> + <input id="WindowSpec.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="WindowSpec.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.sql-51"><a href="#WindowSpec.sql-51"><span class="linenos">51</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="WindowSpec.sql-52"><a href="#WindowSpec.sql-52"><span class="linenos">52</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="WindowSpec.partitionBy" class="classattr"> + <input id="WindowSpec.partitionBy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">partitionBy</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329685440'</span><span class="o">></span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329685440'</span><span class="o">></span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="WindowSpec.partitionBy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.partitionBy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.partitionBy-54"><a href="#WindowSpec.partitionBy-54"><span class="linenos">54</span></a> <span class="k">def</span> <span class="nf">partitionBy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec.partitionBy-55"><a href="#WindowSpec.partitionBy-55"><span class="linenos">55</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.column</span> <span class="kn">import</span> <span class="n">Column</span> +</span><span id="WindowSpec.partitionBy-56"><a href="#WindowSpec.partitionBy-56"><span class="linenos">56</span></a> +</span><span id="WindowSpec.partitionBy-57"><a href="#WindowSpec.partitionBy-57"><span class="linenos">57</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">))</span> <span class="k">else</span> <span class="n">cols</span> <span class="c1"># type: ignore</span> +</span><span id="WindowSpec.partitionBy-58"><a href="#WindowSpec.partitionBy-58"><span class="linenos">58</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span> +</span><span id="WindowSpec.partitionBy-59"><a href="#WindowSpec.partitionBy-59"><span class="linenos">59</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec.partitionBy-60"><a href="#WindowSpec.partitionBy-60"><span class="linenos">60</span></a> <span class="n">partition_by_expressions</span> <span class="o">=</span> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="WindowSpec.partitionBy-61"><a href="#WindowSpec.partitionBy-61"><span class="linenos">61</span></a> <span class="n">partition_by_expressions</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="WindowSpec.partitionBy-62"><a href="#WindowSpec.partitionBy-62"><span class="linenos">62</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="n">partition_by_expressions</span><span class="p">)</span> +</span><span id="WindowSpec.partitionBy-63"><a href="#WindowSpec.partitionBy-63"><span class="linenos">63</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span></pre></div> + + + + + </div> + <div id="WindowSpec.orderBy" class="classattr"> + <input id="WindowSpec.orderBy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">orderBy</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329654400'</span><span class="o">></span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="o"><</span><span class="n">MagicMock</span> <span class="nb">id</span><span class="o">=</span><span class="s1">'140700329654400'</span><span class="o">></span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="WindowSpec.orderBy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.orderBy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.orderBy-65"><a href="#WindowSpec.orderBy-65"><span class="linenos">65</span></a> <span class="k">def</span> <span class="nf">orderBy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">cols</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">ColumnOrName</span><span class="p">]])</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec.orderBy-66"><a href="#WindowSpec.orderBy-66"><span class="linenos">66</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.column</span> <span class="kn">import</span> <span class="n">Column</span> +</span><span id="WindowSpec.orderBy-67"><a href="#WindowSpec.orderBy-67"><span class="linenos">67</span></a> +</span><span id="WindowSpec.orderBy-68"><a href="#WindowSpec.orderBy-68"><span class="linenos">68</span></a> <span class="n">cols</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">cols</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cols</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">set</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">))</span> <span class="k">else</span> <span class="n">cols</span> <span class="c1"># type: ignore</span> +</span><span id="WindowSpec.orderBy-69"><a href="#WindowSpec.orderBy-69"><span class="linenos">69</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">Column</span><span class="o">.</span><span class="n">ensure_col</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">expression</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">cols</span><span class="p">]</span> +</span><span id="WindowSpec.orderBy-70"><a href="#WindowSpec.orderBy-70"><span class="linenos">70</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec.orderBy-71"><a href="#WindowSpec.orderBy-71"><span class="linenos">71</span></a> <span class="k">if</span> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="WindowSpec.orderBy-72"><a href="#WindowSpec.orderBy-72"><span class="linenos">72</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"order"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[]))</span> +</span><span id="WindowSpec.orderBy-73"><a href="#WindowSpec.orderBy-73"><span class="linenos">73</span></a> <span class="n">order_by</span> <span class="o">=</span> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"order"</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="WindowSpec.orderBy-74"><a href="#WindowSpec.orderBy-74"><span class="linenos">74</span></a> <span class="n">order_by</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="WindowSpec.orderBy-75"><a href="#WindowSpec.orderBy-75"><span class="linenos">75</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"order"</span><span class="p">]</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">order_by</span><span class="p">)</span> +</span><span id="WindowSpec.orderBy-76"><a href="#WindowSpec.orderBy-76"><span class="linenos">76</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span></pre></div> + + + + + </div> + <div id="WindowSpec.rowsBetween" class="classattr"> + <input id="WindowSpec.rowsBetween-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rowsBetween</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">start</span><span class="p">:</span> <span class="nb">int</span>, </span><span class="param"><span class="n">end</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="WindowSpec.rowsBetween-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.rowsBetween"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.rowsBetween-111"><a href="#WindowSpec.rowsBetween-111"><span class="linenos">111</span></a> <span class="k">def</span> <span class="nf">rowsBetween</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec.rowsBetween-112"><a href="#WindowSpec.rowsBetween-112"><span class="linenos">112</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec.rowsBetween-113"><a href="#WindowSpec.rowsBetween-113"><span class="linenos">113</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_calc_start_end</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="WindowSpec.rowsBetween-114"><a href="#WindowSpec.rowsBetween-114"><span class="linenos">114</span></a> <span class="n">spec</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"ROWS"</span> +</span><span id="WindowSpec.rowsBetween-115"><a href="#WindowSpec.rowsBetween-115"><span class="linenos">115</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="WindowSpec.rowsBetween-116"><a href="#WindowSpec.rowsBetween-116"><span class="linenos">116</span></a> <span class="s2">"spec"</span><span class="p">,</span> +</span><span id="WindowSpec.rowsBetween-117"><a href="#WindowSpec.rowsBetween-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">(</span> +</span><span id="WindowSpec.rowsBetween-118"><a href="#WindowSpec.rowsBetween-118"><span class="linenos">118</span></a> <span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">spec</span><span class="p">}</span> +</span><span id="WindowSpec.rowsBetween-119"><a href="#WindowSpec.rowsBetween-119"><span class="linenos">119</span></a> <span class="p">),</span> +</span><span id="WindowSpec.rowsBetween-120"><a href="#WindowSpec.rowsBetween-120"><span class="linenos">120</span></a> <span class="p">)</span> +</span><span id="WindowSpec.rowsBetween-121"><a href="#WindowSpec.rowsBetween-121"><span class="linenos">121</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span></pre></div> + + + + + </div> + <div id="WindowSpec.rangeBetween" class="classattr"> + <input id="WindowSpec.rangeBetween-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rangeBetween</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">start</span><span class="p">:</span> <span class="nb">int</span>, </span><span class="param"><span class="n">end</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#WindowSpec">sqlglot.dataframe.sql.WindowSpec</a></span>:</span></span> + + <label class="view-source-button" for="WindowSpec.rangeBetween-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec.rangeBetween"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec.rangeBetween-123"><a href="#WindowSpec.rangeBetween-123"><span class="linenos">123</span></a> <span class="k">def</span> <span class="nf">rangeBetween</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">WindowSpec</span><span class="p">:</span> +</span><span id="WindowSpec.rangeBetween-124"><a href="#WindowSpec.rangeBetween-124"><span class="linenos">124</span></a> <span class="n">window_spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="WindowSpec.rangeBetween-125"><a href="#WindowSpec.rangeBetween-125"><span class="linenos">125</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_calc_start_end</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="WindowSpec.rangeBetween-126"><a href="#WindowSpec.rangeBetween-126"><span class="linenos">126</span></a> <span class="n">spec</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"RANGE"</span> +</span><span id="WindowSpec.rangeBetween-127"><a href="#WindowSpec.rangeBetween-127"><span class="linenos">127</span></a> <span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="WindowSpec.rangeBetween-128"><a href="#WindowSpec.rangeBetween-128"><span class="linenos">128</span></a> <span class="s2">"spec"</span><span class="p">,</span> +</span><span id="WindowSpec.rangeBetween-129"><a href="#WindowSpec.rangeBetween-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">(</span> +</span><span id="WindowSpec.rangeBetween-130"><a href="#WindowSpec.rangeBetween-130"><span class="linenos">130</span></a> <span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">window_spec</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">spec</span><span class="p">}</span> +</span><span id="WindowSpec.rangeBetween-131"><a href="#WindowSpec.rangeBetween-131"><span class="linenos">131</span></a> <span class="p">),</span> +</span><span id="WindowSpec.rangeBetween-132"><a href="#WindowSpec.rangeBetween-132"><span class="linenos">132</span></a> <span class="p">)</span> +</span><span id="WindowSpec.rangeBetween-133"><a href="#WindowSpec.rangeBetween-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="n">window_spec</span> +</span></pre></div> + + + + + </div> + </section> + <section id="DataFrameReader"> + <input id="DataFrameReader-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataFrameReader</span>: + + <label class="view-source-button" for="DataFrameReader-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameReader"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameReader-15"><a href="#DataFrameReader-15"><span class="linenos">15</span></a><span class="k">class</span> <span class="nc">DataFrameReader</span><span class="p">:</span> +</span><span id="DataFrameReader-16"><a href="#DataFrameReader-16"><span class="linenos">16</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spark</span><span class="p">:</span> <span class="n">SparkSession</span><span class="p">):</span> +</span><span id="DataFrameReader-17"><a href="#DataFrameReader-17"><span class="linenos">17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> <span class="o">=</span> <span class="n">spark</span> +</span><span id="DataFrameReader-18"><a href="#DataFrameReader-18"><span class="linenos">18</span></a> +</span><span id="DataFrameReader-19"><a href="#DataFrameReader-19"><span class="linenos">19</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameReader-20"><a href="#DataFrameReader-20"><span class="linenos">20</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.dataframe</span> <span class="kn">import</span> <span class="n">DataFrame</span> +</span><span id="DataFrameReader-21"><a href="#DataFrameReader-21"><span class="linenos">21</span></a> +</span><span id="DataFrameReader-22"><a href="#DataFrameReader-22"><span class="linenos">22</span></a> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span><span class="n">tableName</span><span class="p">)</span> +</span><span id="DataFrameReader-23"><a href="#DataFrameReader-23"><span class="linenos">23</span></a> <span class="k">return</span> <span class="n">DataFrame</span><span class="p">(</span> +</span><span id="DataFrameReader-24"><a href="#DataFrameReader-24"><span class="linenos">24</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="p">,</span> +</span><span id="DataFrameReader-25"><a href="#DataFrameReader-25"><span class="linenos">25</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">tableName</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">tableName</span><span class="p">)),</span> +</span><span id="DataFrameReader-26"><a href="#DataFrameReader-26"><span class="linenos">26</span></a> <span class="p">)</span> +</span></pre></div> + + + + + <div id="DataFrameReader.__init__" class="classattr"> + <input id="DataFrameReader.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">DataFrameReader</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">spark</span><span class="p">:</span> <span class="n"><a href="#SparkSession">sqlglot.dataframe.sql.SparkSession</a></span></span>)</span> + + <label class="view-source-button" for="DataFrameReader.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameReader.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameReader.__init__-16"><a href="#DataFrameReader.__init__-16"><span class="linenos">16</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">spark</span><span class="p">:</span> <span class="n">SparkSession</span><span class="p">):</span> +</span><span id="DataFrameReader.__init__-17"><a href="#DataFrameReader.__init__-17"><span class="linenos">17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span> <span class="o">=</span> <span class="n">spark</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameReader.table" class="classattr"> + <input id="DataFrameReader.table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameReader.table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameReader.table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameReader.table-19"><a href="#DataFrameReader.table-19"><span class="linenos">19</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrame</span><span class="p">:</span> +</span><span id="DataFrameReader.table-20"><a href="#DataFrameReader.table-20"><span class="linenos">20</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.dataframe</span> <span class="kn">import</span> <span class="n">DataFrame</span> +</span><span id="DataFrameReader.table-21"><a href="#DataFrameReader.table-21"><span class="linenos">21</span></a> +</span><span id="DataFrameReader.table-22"><a href="#DataFrameReader.table-22"><span class="linenos">22</span></a> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span><span class="n">tableName</span><span class="p">)</span> +</span><span id="DataFrameReader.table-23"><a href="#DataFrameReader.table-23"><span class="linenos">23</span></a> <span class="k">return</span> <span class="n">DataFrame</span><span class="p">(</span> +</span><span id="DataFrameReader.table-24"><a href="#DataFrameReader.table-24"><span class="linenos">24</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">spark</span><span class="p">,</span> +</span><span id="DataFrameReader.table-25"><a href="#DataFrameReader.table-25"><span class="linenos">25</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">tableName</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">tableName</span><span class="p">)),</span> +</span><span id="DataFrameReader.table-26"><a href="#DataFrameReader.table-26"><span class="linenos">26</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="DataFrameWriter"> + <input id="DataFrameWriter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataFrameWriter</span>: + + <label class="view-source-button" for="DataFrameWriter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter-29"><a href="#DataFrameWriter-29"><span class="linenos">29</span></a><span class="k">class</span> <span class="nc">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter-30"><a href="#DataFrameWriter-30"><span class="linenos">30</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="DataFrameWriter-31"><a href="#DataFrameWriter-31"><span class="linenos">31</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameWriter-32"><a href="#DataFrameWriter-32"><span class="linenos">32</span></a> <span class="n">df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> +</span><span id="DataFrameWriter-33"><a href="#DataFrameWriter-33"><span class="linenos">33</span></a> <span class="n">spark</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">SparkSession</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameWriter-34"><a href="#DataFrameWriter-34"><span class="linenos">34</span></a> <span class="n">mode</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameWriter-35"><a href="#DataFrameWriter-35"><span class="linenos">35</span></a> <span class="n">by_name</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="DataFrameWriter-36"><a href="#DataFrameWriter-36"><span class="linenos">36</span></a> <span class="p">):</span> +</span><span id="DataFrameWriter-37"><a href="#DataFrameWriter-37"><span class="linenos">37</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span> <span class="o">=</span> <span class="n">df</span> +</span><span id="DataFrameWriter-38"><a href="#DataFrameWriter-38"><span class="linenos">38</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_spark</span> <span class="o">=</span> <span class="n">spark</span> <span class="ow">or</span> <span class="n">df</span><span class="o">.</span><span class="n">spark</span> +</span><span id="DataFrameWriter-39"><a href="#DataFrameWriter-39"><span class="linenos">39</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_mode</span> <span class="o">=</span> <span class="n">mode</span> +</span><span id="DataFrameWriter-40"><a href="#DataFrameWriter-40"><span class="linenos">40</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_by_name</span> <span class="o">=</span> <span class="n">by_name</span> +</span><span id="DataFrameWriter-41"><a href="#DataFrameWriter-41"><span class="linenos">41</span></a> +</span><span id="DataFrameWriter-42"><a href="#DataFrameWriter-42"><span class="linenos">42</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter-43"><a href="#DataFrameWriter-43"><span class="linenos">43</span></a> <span class="k">return</span> <span class="n">DataFrameWriter</span><span class="p">(</span> +</span><span id="DataFrameWriter-44"><a href="#DataFrameWriter-44"><span class="linenos">44</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="DataFrameWriter-45"><a href="#DataFrameWriter-45"><span class="linenos">45</span></a> <span class="n">k</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="k">if</span> <span class="n">k</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"_"</span><span class="p">)</span> <span class="k">else</span> <span class="n">k</span><span class="p">:</span> <span class="n">v</span> +</span><span id="DataFrameWriter-46"><a href="#DataFrameWriter-46"><span class="linenos">46</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">object_to_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="DataFrameWriter-47"><a href="#DataFrameWriter-47"><span class="linenos">47</span></a> <span class="p">}</span> +</span><span id="DataFrameWriter-48"><a href="#DataFrameWriter-48"><span class="linenos">48</span></a> <span class="p">)</span> +</span><span id="DataFrameWriter-49"><a href="#DataFrameWriter-49"><span class="linenos">49</span></a> +</span><span id="DataFrameWriter-50"><a href="#DataFrameWriter-50"><span class="linenos">50</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="DataFrameWriter-51"><a href="#DataFrameWriter-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="DataFrameWriter-52"><a href="#DataFrameWriter-52"><span class="linenos">52</span></a> +</span><span id="DataFrameWriter-53"><a href="#DataFrameWriter-53"><span class="linenos">53</span></a> <span class="k">def</span> <span class="nf">mode</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">saveMode</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">])</span> <span class="o">-></span> <span class="n">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter-54"><a href="#DataFrameWriter-54"><span class="linenos">54</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">_mode</span><span class="o">=</span><span class="n">saveMode</span><span class="p">)</span> +</span><span id="DataFrameWriter-55"><a href="#DataFrameWriter-55"><span class="linenos">55</span></a> +</span><span id="DataFrameWriter-56"><a href="#DataFrameWriter-56"><span class="linenos">56</span></a> <span class="nd">@property</span> +</span><span id="DataFrameWriter-57"><a href="#DataFrameWriter-57"><span class="linenos">57</span></a> <span class="k">def</span> <span class="nf">byName</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DataFrameWriter-58"><a href="#DataFrameWriter-58"><span class="linenos">58</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">by_name</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrameWriter-59"><a href="#DataFrameWriter-59"><span class="linenos">59</span></a> +</span><span id="DataFrameWriter-60"><a href="#DataFrameWriter-60"><span class="linenos">60</span></a> <span class="k">def</span> <span class="nf">insertInto</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">overwrite</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter-61"><a href="#DataFrameWriter-61"><span class="linenos">61</span></a> <span class="n">output_expression_container</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span> +</span><span id="DataFrameWriter-62"><a href="#DataFrameWriter-62"><span class="linenos">62</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="DataFrameWriter-63"><a href="#DataFrameWriter-63"><span class="linenos">63</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">tableName</span><span class="p">),</span> +</span><span id="DataFrameWriter-64"><a href="#DataFrameWriter-64"><span class="linenos">64</span></a> <span class="s2">"overwrite"</span><span class="p">:</span> <span class="n">overwrite</span><span class="p">,</span> +</span><span id="DataFrameWriter-65"><a href="#DataFrameWriter-65"><span class="linenos">65</span></a> <span class="p">}</span> +</span><span id="DataFrameWriter-66"><a href="#DataFrameWriter-66"><span class="linenos">66</span></a> <span class="p">)</span> +</span><span id="DataFrameWriter-67"><a href="#DataFrameWriter-67"><span class="linenos">67</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">output_expression_container</span><span class="o">=</span><span class="n">output_expression_container</span><span class="p">)</span> +</span><span id="DataFrameWriter-68"><a href="#DataFrameWriter-68"><span class="linenos">68</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_by_name</span><span class="p">:</span> +</span><span id="DataFrameWriter-69"><a href="#DataFrameWriter-69"><span class="linenos">69</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">tableName</span><span class="p">,</span> <span class="n">only_visible</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrameWriter-70"><a href="#DataFrameWriter-70"><span class="linenos">70</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrameWriter-71"><a href="#DataFrameWriter-71"><span class="linenos">71</span></a> +</span><span id="DataFrameWriter-72"><a href="#DataFrameWriter-72"><span class="linenos">72</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">_df</span><span class="o">=</span><span class="n">df</span><span class="p">)</span> +</span><span id="DataFrameWriter-73"><a href="#DataFrameWriter-73"><span class="linenos">73</span></a> +</span><span id="DataFrameWriter-74"><a href="#DataFrameWriter-74"><span class="linenos">74</span></a> <span class="k">def</span> <span class="nf">saveAsTable</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">format</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">mode</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span> +</span><span id="DataFrameWriter-75"><a href="#DataFrameWriter-75"><span class="linenos">75</span></a> <span class="k">if</span> <span class="nb">format</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrameWriter-76"><a href="#DataFrameWriter-76"><span class="linenos">76</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Providing Format in the save as table is not supported"</span><span class="p">)</span> +</span><span id="DataFrameWriter-77"><a href="#DataFrameWriter-77"><span class="linenos">77</span></a> <span class="n">exists</span><span class="p">,</span> <span class="n">replace</span><span class="p">,</span> <span class="n">mode</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="n">mode</span> <span class="ow">or</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_mode</span><span class="p">)</span> +</span><span id="DataFrameWriter-78"><a href="#DataFrameWriter-78"><span class="linenos">78</span></a> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">"append"</span><span class="p">:</span> +</span><span id="DataFrameWriter-79"><a href="#DataFrameWriter-79"><span class="linenos">79</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">insertInto</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> +</span><span id="DataFrameWriter-80"><a href="#DataFrameWriter-80"><span class="linenos">80</span></a> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">"ignore"</span><span class="p">:</span> +</span><span id="DataFrameWriter-81"><a href="#DataFrameWriter-81"><span class="linenos">81</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="DataFrameWriter-82"><a href="#DataFrameWriter-82"><span class="linenos">82</span></a> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">"overwrite"</span><span class="p">:</span> +</span><span id="DataFrameWriter-83"><a href="#DataFrameWriter-83"><span class="linenos">83</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="DataFrameWriter-84"><a href="#DataFrameWriter-84"><span class="linenos">84</span></a> <span class="n">output_expression_container</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span> +</span><span id="DataFrameWriter-85"><a href="#DataFrameWriter-85"><span class="linenos">85</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">name</span><span class="p">),</span> +</span><span id="DataFrameWriter-86"><a href="#DataFrameWriter-86"><span class="linenos">86</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"TABLE"</span><span class="p">,</span> +</span><span id="DataFrameWriter-87"><a href="#DataFrameWriter-87"><span class="linenos">87</span></a> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span><span class="p">,</span> +</span><span id="DataFrameWriter-88"><a href="#DataFrameWriter-88"><span class="linenos">88</span></a> <span class="n">replace</span><span class="o">=</span><span class="n">replace</span><span class="p">,</span> +</span><span id="DataFrameWriter-89"><a href="#DataFrameWriter-89"><span class="linenos">89</span></a> <span class="p">)</span> +</span><span id="DataFrameWriter-90"><a href="#DataFrameWriter-90"><span class="linenos">90</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">_df</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">output_expression_container</span><span class="o">=</span><span class="n">output_expression_container</span><span class="p">))</span> +</span></pre></div> + + + + + <div id="DataFrameWriter.__init__" class="classattr"> + <input id="DataFrameWriter.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">DataFrameWriter</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">df</span><span class="p">:</span> <span class="n"><a href="#DataFrame">sqlglot.dataframe.sql.DataFrame</a></span>,</span><span class="param"> <span class="n">spark</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="#SparkSession">sqlglot.dataframe.sql.SparkSession</a></span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">mode</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">by_name</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span>)</span> + + <label class="view-source-button" for="DataFrameWriter.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter.__init__-30"><a href="#DataFrameWriter.__init__-30"><span class="linenos">30</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="DataFrameWriter.__init__-31"><a href="#DataFrameWriter.__init__-31"><span class="linenos">31</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="DataFrameWriter.__init__-32"><a href="#DataFrameWriter.__init__-32"><span class="linenos">32</span></a> <span class="n">df</span><span class="p">:</span> <span class="n">DataFrame</span><span class="p">,</span> +</span><span id="DataFrameWriter.__init__-33"><a href="#DataFrameWriter.__init__-33"><span class="linenos">33</span></a> <span class="n">spark</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">SparkSession</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameWriter.__init__-34"><a href="#DataFrameWriter.__init__-34"><span class="linenos">34</span></a> <span class="n">mode</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="DataFrameWriter.__init__-35"><a href="#DataFrameWriter.__init__-35"><span class="linenos">35</span></a> <span class="n">by_name</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="DataFrameWriter.__init__-36"><a href="#DataFrameWriter.__init__-36"><span class="linenos">36</span></a> <span class="p">):</span> +</span><span id="DataFrameWriter.__init__-37"><a href="#DataFrameWriter.__init__-37"><span class="linenos">37</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span> <span class="o">=</span> <span class="n">df</span> +</span><span id="DataFrameWriter.__init__-38"><a href="#DataFrameWriter.__init__-38"><span class="linenos">38</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_spark</span> <span class="o">=</span> <span class="n">spark</span> <span class="ow">or</span> <span class="n">df</span><span class="o">.</span><span class="n">spark</span> +</span><span id="DataFrameWriter.__init__-39"><a href="#DataFrameWriter.__init__-39"><span class="linenos">39</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_mode</span> <span class="o">=</span> <span class="n">mode</span> +</span><span id="DataFrameWriter.__init__-40"><a href="#DataFrameWriter.__init__-40"><span class="linenos">40</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_by_name</span> <span class="o">=</span> <span class="n">by_name</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameWriter.copy" class="classattr"> + <input id="DataFrameWriter.copy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">copy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrameWriter">sqlglot.dataframe.sql.DataFrameWriter</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameWriter.copy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter.copy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter.copy-42"><a href="#DataFrameWriter.copy-42"><span class="linenos">42</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter.copy-43"><a href="#DataFrameWriter.copy-43"><span class="linenos">43</span></a> <span class="k">return</span> <span class="n">DataFrameWriter</span><span class="p">(</span> +</span><span id="DataFrameWriter.copy-44"><a href="#DataFrameWriter.copy-44"><span class="linenos">44</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="DataFrameWriter.copy-45"><a href="#DataFrameWriter.copy-45"><span class="linenos">45</span></a> <span class="n">k</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="k">if</span> <span class="n">k</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"_"</span><span class="p">)</span> <span class="k">else</span> <span class="n">k</span><span class="p">:</span> <span class="n">v</span> +</span><span id="DataFrameWriter.copy-46"><a href="#DataFrameWriter.copy-46"><span class="linenos">46</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">object_to_dict</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="DataFrameWriter.copy-47"><a href="#DataFrameWriter.copy-47"><span class="linenos">47</span></a> <span class="p">}</span> +</span><span id="DataFrameWriter.copy-48"><a href="#DataFrameWriter.copy-48"><span class="linenos">48</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameWriter.sql" class="classattr"> + <input id="DataFrameWriter.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="DataFrameWriter.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter.sql-50"><a href="#DataFrameWriter.sql-50"><span class="linenos">50</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="DataFrameWriter.sql-51"><a href="#DataFrameWriter.sql-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameWriter.mode" class="classattr"> + <input id="DataFrameWriter.mode-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">mode</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">saveMode</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrameWriter">sqlglot.dataframe.sql.DataFrameWriter</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameWriter.mode-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter.mode"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter.mode-53"><a href="#DataFrameWriter.mode-53"><span class="linenos">53</span></a> <span class="k">def</span> <span class="nf">mode</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">saveMode</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">])</span> <span class="o">-></span> <span class="n">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter.mode-54"><a href="#DataFrameWriter.mode-54"><span class="linenos">54</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">_mode</span><span class="o">=</span><span class="n">saveMode</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameWriter.insertInto" class="classattr"> + <input id="DataFrameWriter.insertInto-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">insertInto</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">overwrite</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataFrameWriter">sqlglot.dataframe.sql.DataFrameWriter</a></span>:</span></span> + + <label class="view-source-button" for="DataFrameWriter.insertInto-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter.insertInto"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter.insertInto-60"><a href="#DataFrameWriter.insertInto-60"><span class="linenos">60</span></a> <span class="k">def</span> <span class="nf">insertInto</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tableName</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">overwrite</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">DataFrameWriter</span><span class="p">:</span> +</span><span id="DataFrameWriter.insertInto-61"><a href="#DataFrameWriter.insertInto-61"><span class="linenos">61</span></a> <span class="n">output_expression_container</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">(</span> +</span><span id="DataFrameWriter.insertInto-62"><a href="#DataFrameWriter.insertInto-62"><span class="linenos">62</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="DataFrameWriter.insertInto-63"><a href="#DataFrameWriter.insertInto-63"><span class="linenos">63</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">tableName</span><span class="p">),</span> +</span><span id="DataFrameWriter.insertInto-64"><a href="#DataFrameWriter.insertInto-64"><span class="linenos">64</span></a> <span class="s2">"overwrite"</span><span class="p">:</span> <span class="n">overwrite</span><span class="p">,</span> +</span><span id="DataFrameWriter.insertInto-65"><a href="#DataFrameWriter.insertInto-65"><span class="linenos">65</span></a> <span class="p">}</span> +</span><span id="DataFrameWriter.insertInto-66"><a href="#DataFrameWriter.insertInto-66"><span class="linenos">66</span></a> <span class="p">)</span> +</span><span id="DataFrameWriter.insertInto-67"><a href="#DataFrameWriter.insertInto-67"><span class="linenos">67</span></a> <span class="n">df</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">output_expression_container</span><span class="o">=</span><span class="n">output_expression_container</span><span class="p">)</span> +</span><span id="DataFrameWriter.insertInto-68"><a href="#DataFrameWriter.insertInto-68"><span class="linenos">68</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_by_name</span><span class="p">:</span> +</span><span id="DataFrameWriter.insertInto-69"><a href="#DataFrameWriter.insertInto-69"><span class="linenos">69</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">tableName</span><span class="p">,</span> <span class="n">only_visible</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="DataFrameWriter.insertInto-70"><a href="#DataFrameWriter.insertInto-70"><span class="linenos">70</span></a> <span class="n">df</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">_convert_leaf_to_cte</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">columns</span><span class="p">)</span> +</span><span id="DataFrameWriter.insertInto-71"><a href="#DataFrameWriter.insertInto-71"><span class="linenos">71</span></a> +</span><span id="DataFrameWriter.insertInto-72"><a href="#DataFrameWriter.insertInto-72"><span class="linenos">72</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">_df</span><span class="o">=</span><span class="n">df</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="DataFrameWriter.saveAsTable" class="classattr"> + <input id="DataFrameWriter.saveAsTable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">saveAsTable</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="nb">format</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">mode</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="DataFrameWriter.saveAsTable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataFrameWriter.saveAsTable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataFrameWriter.saveAsTable-74"><a href="#DataFrameWriter.saveAsTable-74"><span class="linenos">74</span></a> <span class="k">def</span> <span class="nf">saveAsTable</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">format</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">mode</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span> +</span><span id="DataFrameWriter.saveAsTable-75"><a href="#DataFrameWriter.saveAsTable-75"><span class="linenos">75</span></a> <span class="k">if</span> <span class="nb">format</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataFrameWriter.saveAsTable-76"><a href="#DataFrameWriter.saveAsTable-76"><span class="linenos">76</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Providing Format in the save as table is not supported"</span><span class="p">)</span> +</span><span id="DataFrameWriter.saveAsTable-77"><a href="#DataFrameWriter.saveAsTable-77"><span class="linenos">77</span></a> <span class="n">exists</span><span class="p">,</span> <span class="n">replace</span><span class="p">,</span> <span class="n">mode</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="n">mode</span> <span class="ow">or</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_mode</span><span class="p">)</span> +</span><span id="DataFrameWriter.saveAsTable-78"><a href="#DataFrameWriter.saveAsTable-78"><span class="linenos">78</span></a> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">"append"</span><span class="p">:</span> +</span><span id="DataFrameWriter.saveAsTable-79"><a href="#DataFrameWriter.saveAsTable-79"><span class="linenos">79</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">insertInto</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> +</span><span id="DataFrameWriter.saveAsTable-80"><a href="#DataFrameWriter.saveAsTable-80"><span class="linenos">80</span></a> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">"ignore"</span><span class="p">:</span> +</span><span id="DataFrameWriter.saveAsTable-81"><a href="#DataFrameWriter.saveAsTable-81"><span class="linenos">81</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="DataFrameWriter.saveAsTable-82"><a href="#DataFrameWriter.saveAsTable-82"><span class="linenos">82</span></a> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">"overwrite"</span><span class="p">:</span> +</span><span id="DataFrameWriter.saveAsTable-83"><a href="#DataFrameWriter.saveAsTable-83"><span class="linenos">83</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="DataFrameWriter.saveAsTable-84"><a href="#DataFrameWriter.saveAsTable-84"><span class="linenos">84</span></a> <span class="n">output_expression_container</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">(</span> +</span><span id="DataFrameWriter.saveAsTable-85"><a href="#DataFrameWriter.saveAsTable-85"><span class="linenos">85</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">name</span><span class="p">),</span> +</span><span id="DataFrameWriter.saveAsTable-86"><a href="#DataFrameWriter.saveAsTable-86"><span class="linenos">86</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"TABLE"</span><span class="p">,</span> +</span><span id="DataFrameWriter.saveAsTable-87"><a href="#DataFrameWriter.saveAsTable-87"><span class="linenos">87</span></a> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span><span class="p">,</span> +</span><span id="DataFrameWriter.saveAsTable-88"><a href="#DataFrameWriter.saveAsTable-88"><span class="linenos">88</span></a> <span class="n">replace</span><span class="o">=</span><span class="n">replace</span><span class="p">,</span> +</span><span id="DataFrameWriter.saveAsTable-89"><a href="#DataFrameWriter.saveAsTable-89"><span class="linenos">89</span></a> <span class="p">)</span> +</span><span id="DataFrameWriter.saveAsTable-90"><a href="#DataFrameWriter.saveAsTable-90"><span class="linenos">90</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">_df</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_df</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">output_expression_container</span><span class="o">=</span><span class="n">output_expression_container</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects.html b/docs/sqlglot/dialects.html new file mode 100644 index 0000000..7a6c455 --- /dev/null +++ b/docs/sqlglot/dialects.html @@ -0,0 +1,400 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + <h2>Contents</h2> + <ul> + <li><a href="#dialects">Dialects</a></li> +</ul> + + + <h2>Submodules</h2> + <ul> + <li><a href="dialects/bigquery.html">bigquery</a></li> + <li><a href="dialects/clickhouse.html">clickhouse</a></li> + <li><a href="dialects/databricks.html">databricks</a></li> + <li><a href="dialects/dialect.html">dialect</a></li> + <li><a href="dialects/drill.html">drill</a></li> + <li><a href="dialects/duckdb.html">duckdb</a></li> + <li><a href="dialects/hive.html">hive</a></li> + <li><a href="dialects/mysql.html">mysql</a></li> + <li><a href="dialects/oracle.html">oracle</a></li> + <li><a href="dialects/postgres.html">postgres</a></li> + <li><a href="dialects/presto.html">presto</a></li> + <li><a href="dialects/redshift.html">redshift</a></li> + <li><a href="dialects/snowflake.html">snowflake</a></li> + <li><a href="dialects/spark.html">spark</a></li> + <li><a href="dialects/sqlite.html">sqlite</a></li> + <li><a href="dialects/starrocks.html">starrocks</a></li> + <li><a href="dialects/tableau.html">tableau</a></li> + <li><a href="dialects/teradata.html">teradata</a></li> + <li><a href="dialects/trino.html">trino</a></li> + <li><a href="dialects/tsql.html">tsql</a></li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/__init__.py">Edit on GitHub</a> + + <div class="docstring"><h2 id="dialects">Dialects</h2> + +<p>While there is a SQL standard, most SQL engines support a variation of that standard. This makes it difficult +to write portable SQL code. SQLGlot bridges all the different variations, called "dialects", with an extensible +SQL transpilation framework. </p> + +<p>The base <code><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></code> class implements a generic dialect that aims to be as universal as possible.</p> + +<p>Each SQL variation has its own <code>Dialect</code> subclass, extending the corresponding <code>Tokenizer</code>, <code>Parser</code> and <code>Generator</code> +classes as needed.</p> + +<h3 id="implementing-a-custom-dialect">Implementing a custom Dialect</h3> + +<p>Consider the following example:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +<span class="kn">from</span> <span class="nn"><a href="dialects/dialect.html">sqlglot.dialects.dialect</a></span> <span class="kn">import</span> <span class="n">Dialect</span> +<span class="kn">from</span> <span class="nn"><a href="generator.html">sqlglot.generator</a></span> <span class="kn">import</span> <span class="n">Generator</span> +<span class="kn">from</span> <span class="nn"><a href="tokens.html">sqlglot.tokens</a></span> <span class="kn">import</span> <span class="n">Tokenizer</span><span class="p">,</span> <span class="n">TokenType</span> + + +<span class="k">class</span> <span class="nc">Custom</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> + <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Tokenizer</span><span class="p">):</span> + <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> + <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> + + <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> + <span class="o">**</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> + <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> + <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> + <span class="p">}</span> + + <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Generator</span><span class="p">):</span> + <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">}</span> + + <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BOOL"</span><span class="p">,</span> + <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> + <span class="p">}</span> +</code></pre> +</div> + +<p>This is a typical example of adding a new dialect implementation in SQLGlot: we specify its identifier and string +delimiters, as well as what tokens it uses for its types and how they're associated with SQLGlot types. Since +the <code>Expression</code> classes are common for each dialect supported in SQLGlot, we may also need to override the generation +logic for some expressions; this is usually done by adding new entries to the <code>TRANSFORMS</code> mapping.</p> + +<hr /> +</div> + + <input id="mod-dialects-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-dialects-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">"""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="sd">## Dialects</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="sd">While there is a SQL standard, most SQL engines support a variation of that standard. This makes it difficult</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="sd">to write portable SQL code. SQLGlot bridges all the different variations, called "dialects", with an extensible</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="sd">SQL transpilation framework. </span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd">The base `sqlglot.dialects.dialect.Dialect` class implements a generic dialect that aims to be as universal as possible.</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd">Each SQL variation has its own `Dialect` subclass, extending the corresponding `Tokenizer`, `Parser` and `Generator`</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd">classes as needed.</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd">### Implementing a custom Dialect</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd">Consider the following example:</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="sd">```python</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd">from sqlglot import exp</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="sd">from sqlglot.dialects.dialect import Dialect</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="sd">from sqlglot.generator import Generator</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="sd">from sqlglot.tokens import Tokenizer, TokenType</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a><span class="sd">class Custom(Dialect):</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a><span class="sd"> class Tokenizer(Tokenizer):</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a><span class="sd"> QUOTES = ["'", '"']</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a><span class="sd"> IDENTIFIERS = ["`"]</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a><span class="sd"> KEYWORDS = {</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a><span class="sd"> **Tokenizer.KEYWORDS,</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a><span class="sd"> "INT64": TokenType.BIGINT,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a><span class="sd"> "FLOAT64": TokenType.DOUBLE,</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a><span class="sd"> }</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a><span class="sd"> class Generator(Generator):</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a><span class="sd"> TRANSFORMS = {exp.Array: lambda self, e: f"[{self.expressions(e)}]"}</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a><span class="sd"> TYPE_MAPPING = {</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a><span class="sd"> exp.DataType.Type.TINYINT: "INT64",</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a><span class="sd"> exp.DataType.Type.SMALLINT: "INT64",</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a><span class="sd"> exp.DataType.Type.INT: "INT64",</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a><span class="sd"> exp.DataType.Type.BIGINT: "INT64",</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a><span class="sd"> exp.DataType.Type.DECIMAL: "NUMERIC",</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a><span class="sd"> exp.DataType.Type.FLOAT: "FLOAT64",</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a><span class="sd"> exp.DataType.Type.DOUBLE: "FLOAT64",</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a><span class="sd"> exp.DataType.Type.BOOLEAN: "BOOL",</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a><span class="sd"> exp.DataType.Type.TEXT: "STRING",</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a><span class="sd"> }</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a><span class="sd">```</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a><span class="sd">This is a typical example of adding a new dialect implementation in SQLGlot: we specify its identifier and string</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a><span class="sd">delimiters, as well as what tokens it uses for its types and how they're associated with SQLGlot types. Since</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a><span class="sd">the `Expression` classes are common for each dialect supported in SQLGlot, we may also need to override the generation</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a><span class="sd">logic for some expressions; this is usually done by adding new entries to the `TRANSFORMS` mapping.</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a><span class="sd">----</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a><span class="sd">"""</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.bigquery</span> <span class="kn">import</span> <span class="n">BigQuery</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.clickhouse</span> <span class="kn">import</span> <span class="n">ClickHouse</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.databricks</span> <span class="kn">import</span> <span class="n">Databricks</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">Dialects</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.drill</span> <span class="kn">import</span> <span class="n">Drill</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.duckdb</span> <span class="kn">import</span> <span class="n">DuckDB</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.hive</span> <span class="kn">import</span> <span class="n">Hive</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.mysql</span> <span class="kn">import</span> <span class="n">MySQL</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.oracle</span> <span class="kn">import</span> <span class="n">Oracle</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.postgres</span> <span class="kn">import</span> <span class="n">Postgres</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.presto</span> <span class="kn">import</span> <span class="n">Presto</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.redshift</span> <span class="kn">import</span> <span class="n">Redshift</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.snowflake</span> <span class="kn">import</span> <span class="n">Snowflake</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.spark</span> <span class="kn">import</span> <span class="n">Spark</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.sqlite</span> <span class="kn">import</span> <span class="n">SQLite</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.starrocks</span> <span class="kn">import</span> <span class="n">StarRocks</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.tableau</span> <span class="kn">import</span> <span class="n">Tableau</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.teradata</span> <span class="kn">import</span> <span class="n">Teradata</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos">77</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.trino</span> <span class="kn">import</span> <span class="n">Trino</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos">78</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.tsql</span> <span class="kn">import</span> <span class="n">TSQL</span> +</span></pre></div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/bigquery.html b/docs/sqlglot/dialects/bigquery.html new file mode 100644 index 0000000..903fccb --- /dev/null +++ b/docs/sqlglot/dialects/bigquery.html @@ -0,0 +1,1434 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.bigquery API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#BigQuery">BigQuery</a> + <ul class="memberlist"> + <li> + <a class="function" href="#BigQuery.__init__">BigQuery</a> + </li> + <li> + <a class="class" href="#BigQuery.Tokenizer">BigQuery.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BigQuery.Parser">BigQuery.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BigQuery.Generator">BigQuery.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#BigQuery.Generator.array_sql">array_sql</a> + </li> + <li> + <a class="function" href="#BigQuery.Generator.transaction_sql">transaction_sql</a> + </li> + <li> + <a class="function" href="#BigQuery.Generator.commit_sql">commit_sql</a> + </li> + <li> + <a class="function" href="#BigQuery.Generator.rollback_sql">rollback_sql</a> + </li> + <li> + <a class="function" href="#BigQuery.Generator.in_unnest_op">in_unnest_op</a> + </li> + <li> + <a class="function" href="#BigQuery.Generator.except_op">except_op</a> + </li> + <li> + <a class="function" href="#BigQuery.Generator.intersect_op">intersect_op</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/bigquery.py">Edit on GitHub</a> + + <div class="docstring"><p>Supports BigQuery Standard SQL.</p> +</div> + + <input id="mod-bigquery-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-bigquery-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">"""Supports BigQuery Standard SQL."""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span><span class="p">,</span> <span class="n">transforms</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="p">)</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="n">E</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"E"</span><span class="p">,</span> <span class="n">bound</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="k">def</span> <span class="nf">_date_add</span><span class="p">(</span><span class="n">expression_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">E</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">],</span> <span class="n">E</span><span class="p">]:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="n">interval</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="k">return</span> <span class="n">expression_class</span><span class="p">(</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">interval</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">interval</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">),</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">return</span> <span class="n">func</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="k">def</span> <span class="nf">_date_trunc</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">unit</span><span class="p">)</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="k">def</span> <span class="nf">_date_add_sql</span><span class="p">(</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">data_type</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">kind</span><span class="p">:</span> <span class="nb">str</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">data_type</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s1">'day'</span><span class="p">)))</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">return</span> <span class="n">func</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="k">def</span> <span class="nf">_derived_table_values_to_unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">,</span> <span class="n">transforms</span><span class="o">.</span><span class="n">remove_precision_parameterized_types</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">tuple_exp</span><span class="o">.</span><span class="n">expressions</span> <span class="k">for</span> <span class="n">tuple_exp</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)]</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">structs</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">rows</span><span class="p">:</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">aliases</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">for</span> <span class="n">value</span><span class="p">,</span> <span class="n">column_name</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"columns"</span><span class="p">])</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="p">]</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">structs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">aliases</span><span class="p">))</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">unnest_exp</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">structs</span><span class="p">)])</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_sql</span><span class="p">(</span><span class="n">unnest_exp</span><span class="p">)</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="k">def</span> <span class="nf">_returnsproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2"> <</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">>"</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURNS </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="k">def</span> <span class="nf">_create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">returns</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">if</span> <span class="n">kind</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"FUNCTION"</span> <span class="ow">and</span> <span class="n">returns</span> <span class="ow">and</span> <span class="n">returns</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"is_table"</span><span class="p">):</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="s2">"TABLE FUNCTION"</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="p">(</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">,</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">,</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="p">),</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="p">):</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a><span class="k">def</span> <span class="nf">_unqualify_unnest</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a><span class="w"> </span><span class="sd">"""Remove references to unnest table aliases since bigquery doesn't allow them.</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a><span class="sd"> These are added by the optimizer's qualify_column step.</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a><span class="sd"> """</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">unnests</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">unnest</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">for</span> <span class="n">unnest</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[]))</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unnest</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="ow">and</span> <span class="n">unnest</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="p">}</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="n">unnests</span><span class="p">:</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="ow">in</span> <span class="n">unnests</span><span class="p">:</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a><span class="k">class</span> <span class="nc">BigQuery</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">unnest_column_only</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="s2">"%M"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="s2">"%m"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="s2">"%y"</span><span class="p">:</span> <span class="s2">"%-y"</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="s2">"%H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="s2">"%I"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="s2">"%S"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="s2">"%j"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="p">}</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">quote</span><span class="p">,</span> <span class="n">quote</span><span class="p">)</span> <span class="k">if</span> <span class="n">prefix</span> <span class="k">else</span> <span class="n">quote</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">for</span> <span class="n">quote</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">,</span> <span class="s1">'"""'</span><span class="p">,</span> <span class="s2">"'''"</span><span class="p">]</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">,</span> <span class="s2">"R"</span><span class="p">]</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="p">]</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0X"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="s2">"BEGIN TRANSACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="s2">"CURRENT_DATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="s2">"CURRENT_TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="s2">"GEOGRAPHY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"UNKNOWN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="p">}</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"DIV"</span><span class="p">)</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">_date_trunc</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"DATETIME_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">),</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="s2">"DIV"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="s2">"REGEXP_CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="s2">"TIME_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">),</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="s2">"TIMESTAMP_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">),</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">),</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="s2">"DATETIME_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">),</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="s2">"TIME_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">),</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="s2">"TIMESTAMP_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">),</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="s2">"PARSE_TIMESTAMP"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">(</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="nb">format</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="p">),</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="p">}</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="s2">"ARRAY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()]),</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">NO_PAREN_FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDatetime</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTime</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="p">}</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">NESTED_TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NESTED_TYPE_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="p">}</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">ID_VAR_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="p">}</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"VOLATILE"</span><span class="p">)</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="p">),</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="p">}</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">REMOVE_PRECISION_PARAMETERIZED_TYPES</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_LENGTH"</span><span class="p">),</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATE"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATE"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATETIME"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATETIME"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">,</span><span class="w"> </span><span class="s1">'DAY'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRING_AGG"</span><span class="p">),</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DIV"</span><span class="p">),</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="p">[</span><span class="n">_unqualify_unnest</span><span class="p">],</span> <span class="n">transforms</span><span class="o">.</span><span class="n">delegate</span><span class="p">(</span><span class="s2">"select_sql"</span><span class="p">)</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="p">),</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARSE_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIME"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIME"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">:</span> <span class="n">_derived_table_values_to_unnest</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="n">_returnsproperty_sql</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">_create_sql</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DETERMINISTIC"</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"IMMUTABLE"</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="k">else</span> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">,</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_CONTAINS"</span><span class="p">),</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="p">}</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BOOL"</span><span class="p">,</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="p">}</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="k">def</span> <span class="nf">array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">first_arg</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first_arg</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">first_arg</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">return</span> <span class="n">inline_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="s2">"BEGIN TRANSACTION"</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="k">return</span> <span class="s2">"COMMIT TRANSACTION"</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="k">return</span> <span class="s2">"ROLLBACK TRANSACTION"</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + </section> + <section id="BigQuery"> + <input id="BigQuery-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BigQuery</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="BigQuery-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery-120"><a href="#BigQuery-120"><span class="linenos">120</span></a><span class="k">class</span> <span class="nc">BigQuery</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="BigQuery-121"><a href="#BigQuery-121"><span class="linenos">121</span></a> <span class="n">unnest_column_only</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="BigQuery-122"><a href="#BigQuery-122"><span class="linenos">122</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-123"><a href="#BigQuery-123"><span class="linenos">123</span></a> <span class="s2">"%M"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="BigQuery-124"><a href="#BigQuery-124"><span class="linenos">124</span></a> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="BigQuery-125"><a href="#BigQuery-125"><span class="linenos">125</span></a> <span class="s2">"%m"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="BigQuery-126"><a href="#BigQuery-126"><span class="linenos">126</span></a> <span class="s2">"%y"</span><span class="p">:</span> <span class="s2">"%-y"</span><span class="p">,</span> +</span><span id="BigQuery-127"><a href="#BigQuery-127"><span class="linenos">127</span></a> <span class="s2">"%H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="BigQuery-128"><a href="#BigQuery-128"><span class="linenos">128</span></a> <span class="s2">"%I"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="BigQuery-129"><a href="#BigQuery-129"><span class="linenos">129</span></a> <span class="s2">"%S"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="BigQuery-130"><a href="#BigQuery-130"><span class="linenos">130</span></a> <span class="s2">"%j"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> +</span><span id="BigQuery-131"><a href="#BigQuery-131"><span class="linenos">131</span></a> <span class="p">}</span> +</span><span id="BigQuery-132"><a href="#BigQuery-132"><span class="linenos">132</span></a> +</span><span id="BigQuery-133"><a href="#BigQuery-133"><span class="linenos">133</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="BigQuery-134"><a href="#BigQuery-134"><span class="linenos">134</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="BigQuery-135"><a href="#BigQuery-135"><span class="linenos">135</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">quote</span><span class="p">,</span> <span class="n">quote</span><span class="p">)</span> <span class="k">if</span> <span class="n">prefix</span> <span class="k">else</span> <span class="n">quote</span> +</span><span id="BigQuery-136"><a href="#BigQuery-136"><span class="linenos">136</span></a> <span class="k">for</span> <span class="n">quote</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">,</span> <span class="s1">'"""'</span><span class="p">,</span> <span class="s2">"'''"</span><span class="p">]</span> +</span><span id="BigQuery-137"><a href="#BigQuery-137"><span class="linenos">137</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">,</span> <span class="s2">"R"</span><span class="p">]</span> +</span><span id="BigQuery-138"><a href="#BigQuery-138"><span class="linenos">138</span></a> <span class="p">]</span> +</span><span id="BigQuery-139"><a href="#BigQuery-139"><span class="linenos">139</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="BigQuery-140"><a href="#BigQuery-140"><span class="linenos">140</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="BigQuery-141"><a href="#BigQuery-141"><span class="linenos">141</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="BigQuery-142"><a href="#BigQuery-142"><span class="linenos">142</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0X"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="BigQuery-143"><a href="#BigQuery-143"><span class="linenos">143</span></a> +</span><span id="BigQuery-144"><a href="#BigQuery-144"><span class="linenos">144</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-145"><a href="#BigQuery-145"><span class="linenos">145</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="BigQuery-146"><a href="#BigQuery-146"><span class="linenos">146</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="BigQuery-147"><a href="#BigQuery-147"><span class="linenos">147</span></a> <span class="s2">"BEGIN TRANSACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="BigQuery-148"><a href="#BigQuery-148"><span class="linenos">148</span></a> <span class="s2">"CURRENT_DATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">,</span> +</span><span id="BigQuery-149"><a href="#BigQuery-149"><span class="linenos">149</span></a> <span class="s2">"CURRENT_TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="BigQuery-150"><a href="#BigQuery-150"><span class="linenos">150</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="BigQuery-151"><a href="#BigQuery-151"><span class="linenos">151</span></a> <span class="s2">"GEOGRAPHY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="BigQuery-152"><a href="#BigQuery-152"><span class="linenos">152</span></a> <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="BigQuery-153"><a href="#BigQuery-153"><span class="linenos">153</span></a> <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="BigQuery-154"><a href="#BigQuery-154"><span class="linenos">154</span></a> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="BigQuery-155"><a href="#BigQuery-155"><span class="linenos">155</span></a> <span class="s2">"UNKNOWN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> +</span><span id="BigQuery-156"><a href="#BigQuery-156"><span class="linenos">156</span></a> <span class="p">}</span> +</span><span id="BigQuery-157"><a href="#BigQuery-157"><span class="linenos">157</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"DIV"</span><span class="p">)</span> +</span><span id="BigQuery-158"><a href="#BigQuery-158"><span class="linenos">158</span></a> +</span><span id="BigQuery-159"><a href="#BigQuery-159"><span class="linenos">159</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="BigQuery-160"><a href="#BigQuery-160"><span class="linenos">160</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-161"><a href="#BigQuery-161"><span class="linenos">161</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-162"><a href="#BigQuery-162"><span class="linenos">162</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">_date_trunc</span><span class="p">,</span> +</span><span id="BigQuery-163"><a href="#BigQuery-163"><span class="linenos">163</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="BigQuery-164"><a href="#BigQuery-164"><span class="linenos">164</span></a> <span class="s2">"DATETIME_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">),</span> +</span><span id="BigQuery-165"><a href="#BigQuery-165"><span class="linenos">165</span></a> <span class="s2">"DIV"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> +</span><span id="BigQuery-166"><a href="#BigQuery-166"><span class="linenos">166</span></a> <span class="s2">"REGEXP_CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="BigQuery-167"><a href="#BigQuery-167"><span class="linenos">167</span></a> <span class="s2">"TIME_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">),</span> +</span><span id="BigQuery-168"><a href="#BigQuery-168"><span class="linenos">168</span></a> <span class="s2">"TIMESTAMP_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">),</span> +</span><span id="BigQuery-169"><a href="#BigQuery-169"><span class="linenos">169</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">),</span> +</span><span id="BigQuery-170"><a href="#BigQuery-170"><span class="linenos">170</span></a> <span class="s2">"DATETIME_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">),</span> +</span><span id="BigQuery-171"><a href="#BigQuery-171"><span class="linenos">171</span></a> <span class="s2">"TIME_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">),</span> +</span><span id="BigQuery-172"><a href="#BigQuery-172"><span class="linenos">172</span></a> <span class="s2">"TIMESTAMP_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">),</span> +</span><span id="BigQuery-173"><a href="#BigQuery-173"><span class="linenos">173</span></a> <span class="s2">"PARSE_TIMESTAMP"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">(</span> +</span><span id="BigQuery-174"><a href="#BigQuery-174"><span class="linenos">174</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="nb">format</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="BigQuery-175"><a href="#BigQuery-175"><span class="linenos">175</span></a> <span class="p">),</span> +</span><span id="BigQuery-176"><a href="#BigQuery-176"><span class="linenos">176</span></a> <span class="p">}</span> +</span><span id="BigQuery-177"><a href="#BigQuery-177"><span class="linenos">177</span></a> +</span><span id="BigQuery-178"><a href="#BigQuery-178"><span class="linenos">178</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-179"><a href="#BigQuery-179"><span class="linenos">179</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-180"><a href="#BigQuery-180"><span class="linenos">180</span></a> <span class="s2">"ARRAY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()]),</span> +</span><span id="BigQuery-181"><a href="#BigQuery-181"><span class="linenos">181</span></a> <span class="p">}</span> +</span><span id="BigQuery-182"><a href="#BigQuery-182"><span class="linenos">182</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="BigQuery-183"><a href="#BigQuery-183"><span class="linenos">183</span></a> +</span><span id="BigQuery-184"><a href="#BigQuery-184"><span class="linenos">184</span></a> <span class="n">NO_PAREN_FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-185"><a href="#BigQuery-185"><span class="linenos">185</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-186"><a href="#BigQuery-186"><span class="linenos">186</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDatetime</span><span class="p">,</span> +</span><span id="BigQuery-187"><a href="#BigQuery-187"><span class="linenos">187</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTime</span><span class="p">,</span> +</span><span id="BigQuery-188"><a href="#BigQuery-188"><span class="linenos">188</span></a> <span class="p">}</span> +</span><span id="BigQuery-189"><a href="#BigQuery-189"><span class="linenos">189</span></a> +</span><span id="BigQuery-190"><a href="#BigQuery-190"><span class="linenos">190</span></a> <span class="n">NESTED_TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-191"><a href="#BigQuery-191"><span class="linenos">191</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NESTED_TYPE_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-192"><a href="#BigQuery-192"><span class="linenos">192</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="BigQuery-193"><a href="#BigQuery-193"><span class="linenos">193</span></a> <span class="p">}</span> +</span><span id="BigQuery-194"><a href="#BigQuery-194"><span class="linenos">194</span></a> +</span><span id="BigQuery-195"><a href="#BigQuery-195"><span class="linenos">195</span></a> <span class="n">ID_VAR_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-196"><a href="#BigQuery-196"><span class="linenos">196</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-197"><a href="#BigQuery-197"><span class="linenos">197</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">,</span> +</span><span id="BigQuery-198"><a href="#BigQuery-198"><span class="linenos">198</span></a> <span class="p">}</span> +</span><span id="BigQuery-199"><a href="#BigQuery-199"><span class="linenos">199</span></a> +</span><span id="BigQuery-200"><a href="#BigQuery-200"><span class="linenos">200</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-201"><a href="#BigQuery-201"><span class="linenos">201</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-202"><a href="#BigQuery-202"><span class="linenos">202</span></a> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="BigQuery-203"><a href="#BigQuery-203"><span class="linenos">203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"VOLATILE"</span><span class="p">)</span> +</span><span id="BigQuery-204"><a href="#BigQuery-204"><span class="linenos">204</span></a> <span class="p">),</span> +</span><span id="BigQuery-205"><a href="#BigQuery-205"><span class="linenos">205</span></a> <span class="p">}</span> +</span><span id="BigQuery-206"><a href="#BigQuery-206"><span class="linenos">206</span></a> +</span><span id="BigQuery-207"><a href="#BigQuery-207"><span class="linenos">207</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="BigQuery-208"><a href="#BigQuery-208"><span class="linenos">208</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-209"><a href="#BigQuery-209"><span class="linenos">209</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-210"><a href="#BigQuery-210"><span class="linenos">210</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">REMOVE_PRECISION_PARAMETERIZED_TYPES</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-211"><a href="#BigQuery-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_LENGTH"</span><span class="p">),</span> +</span><span id="BigQuery-212"><a href="#BigQuery-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATE"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery-213"><a href="#BigQuery-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATE"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery-214"><a href="#BigQuery-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATETIME"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery-215"><a href="#BigQuery-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATETIME"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery-216"><a href="#BigQuery-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">,</span><span class="w"> </span><span class="s1">'DAY'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="BigQuery-217"><a href="#BigQuery-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="BigQuery-218"><a href="#BigQuery-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRING_AGG"</span><span class="p">),</span> +</span><span id="BigQuery-219"><a href="#BigQuery-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="BigQuery-220"><a href="#BigQuery-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DIV"</span><span class="p">),</span> +</span><span id="BigQuery-221"><a href="#BigQuery-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="BigQuery-222"><a href="#BigQuery-222"><span class="linenos">222</span></a> <span class="p">[</span><span class="n">_unqualify_unnest</span><span class="p">],</span> <span class="n">transforms</span><span class="o">.</span><span class="n">delegate</span><span class="p">(</span><span class="s2">"select_sql"</span><span class="p">)</span> +</span><span id="BigQuery-223"><a href="#BigQuery-223"><span class="linenos">223</span></a> <span class="p">),</span> +</span><span id="BigQuery-224"><a href="#BigQuery-224"><span class="linenos">224</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARSE_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="BigQuery-225"><a href="#BigQuery-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIME"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery-226"><a href="#BigQuery-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIME"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery-227"><a href="#BigQuery-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery-228"><a href="#BigQuery-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery-229"><a href="#BigQuery-229"><span class="linenos">229</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="BigQuery-230"><a href="#BigQuery-230"><span class="linenos">230</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="BigQuery-231"><a href="#BigQuery-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">:</span> <span class="n">_derived_table_values_to_unnest</span><span class="p">,</span> +</span><span id="BigQuery-232"><a href="#BigQuery-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="n">_returnsproperty_sql</span><span class="p">,</span> +</span><span id="BigQuery-233"><a href="#BigQuery-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">_create_sql</span><span class="p">,</span> +</span><span id="BigQuery-234"><a href="#BigQuery-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="BigQuery-235"><a href="#BigQuery-235"><span class="linenos">235</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DETERMINISTIC"</span> +</span><span id="BigQuery-236"><a href="#BigQuery-236"><span class="linenos">236</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"IMMUTABLE"</span> +</span><span id="BigQuery-237"><a href="#BigQuery-237"><span class="linenos">237</span></a> <span class="k">else</span> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">,</span> +</span><span id="BigQuery-238"><a href="#BigQuery-238"><span class="linenos">238</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_CONTAINS"</span><span class="p">),</span> +</span><span id="BigQuery-239"><a href="#BigQuery-239"><span class="linenos">239</span></a> <span class="p">}</span> +</span><span id="BigQuery-240"><a href="#BigQuery-240"><span class="linenos">240</span></a> +</span><span id="BigQuery-241"><a href="#BigQuery-241"><span class="linenos">241</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery-242"><a href="#BigQuery-242"><span class="linenos">242</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery-243"><a href="#BigQuery-243"><span class="linenos">243</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery-244"><a href="#BigQuery-244"><span class="linenos">244</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery-245"><a href="#BigQuery-245"><span class="linenos">245</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery-246"><a href="#BigQuery-246"><span class="linenos">246</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery-247"><a href="#BigQuery-247"><span class="linenos">247</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> +</span><span id="BigQuery-248"><a href="#BigQuery-248"><span class="linenos">248</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> +</span><span id="BigQuery-249"><a href="#BigQuery-249"><span class="linenos">249</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> +</span><span id="BigQuery-250"><a href="#BigQuery-250"><span class="linenos">250</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BOOL"</span><span class="p">,</span> +</span><span id="BigQuery-251"><a href="#BigQuery-251"><span class="linenos">251</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="BigQuery-252"><a href="#BigQuery-252"><span class="linenos">252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="BigQuery-253"><a href="#BigQuery-253"><span class="linenos">253</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="BigQuery-254"><a href="#BigQuery-254"><span class="linenos">254</span></a> <span class="p">}</span> +</span><span id="BigQuery-255"><a href="#BigQuery-255"><span class="linenos">255</span></a> +</span><span id="BigQuery-256"><a href="#BigQuery-256"><span class="linenos">256</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="BigQuery-257"><a href="#BigQuery-257"><span class="linenos">257</span></a> +</span><span id="BigQuery-258"><a href="#BigQuery-258"><span class="linenos">258</span></a> <span class="k">def</span> <span class="nf">array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-259"><a href="#BigQuery-259"><span class="linenos">259</span></a> <span class="n">first_arg</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="BigQuery-260"><a href="#BigQuery-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first_arg</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="BigQuery-261"><a href="#BigQuery-261"><span class="linenos">261</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">first_arg</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="BigQuery-262"><a href="#BigQuery-262"><span class="linenos">262</span></a> +</span><span id="BigQuery-263"><a href="#BigQuery-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="n">inline_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="BigQuery-264"><a href="#BigQuery-264"><span class="linenos">264</span></a> +</span><span id="BigQuery-265"><a href="#BigQuery-265"><span class="linenos">265</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-266"><a href="#BigQuery-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="s2">"BEGIN TRANSACTION"</span> +</span><span id="BigQuery-267"><a href="#BigQuery-267"><span class="linenos">267</span></a> +</span><span id="BigQuery-268"><a href="#BigQuery-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-269"><a href="#BigQuery-269"><span class="linenos">269</span></a> <span class="k">return</span> <span class="s2">"COMMIT TRANSACTION"</span> +</span><span id="BigQuery-270"><a href="#BigQuery-270"><span class="linenos">270</span></a> +</span><span id="BigQuery-271"><a href="#BigQuery-271"><span class="linenos">271</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-272"><a href="#BigQuery-272"><span class="linenos">272</span></a> <span class="k">return</span> <span class="s2">"ROLLBACK TRANSACTION"</span> +</span><span id="BigQuery-273"><a href="#BigQuery-273"><span class="linenos">273</span></a> +</span><span id="BigQuery-274"><a href="#BigQuery-274"><span class="linenos">274</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-275"><a href="#BigQuery-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="BigQuery-276"><a href="#BigQuery-276"><span class="linenos">276</span></a> +</span><span id="BigQuery-277"><a href="#BigQuery-277"><span class="linenos">277</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-278"><a href="#BigQuery-278"><span class="linenos">278</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="BigQuery-279"><a href="#BigQuery-279"><span class="linenos">279</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="BigQuery-280"><a href="#BigQuery-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="BigQuery-281"><a href="#BigQuery-281"><span class="linenos">281</span></a> +</span><span id="BigQuery-282"><a href="#BigQuery-282"><span class="linenos">282</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery-283"><a href="#BigQuery-283"><span class="linenos">283</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="BigQuery-284"><a href="#BigQuery-284"><span class="linenos">284</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="BigQuery-285"><a href="#BigQuery-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + <div id="BigQuery.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">BigQuery</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#BigQuery.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="BigQuery.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="BigQuery.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="BigQuery.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="BigQuery.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="BigQuery.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="BigQuery.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="BigQuery.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="BigQuery.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BigQuery.Tokenizer"> + <input id="BigQuery.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BigQuery.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="BigQuery.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Tokenizer-133"><a href="#BigQuery.Tokenizer-133"><span class="linenos">133</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="BigQuery.Tokenizer-134"><a href="#BigQuery.Tokenizer-134"><span class="linenos">134</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="BigQuery.Tokenizer-135"><a href="#BigQuery.Tokenizer-135"><span class="linenos">135</span></a> <span class="p">(</span><span class="n">prefix</span> <span class="o">+</span> <span class="n">quote</span><span class="p">,</span> <span class="n">quote</span><span class="p">)</span> <span class="k">if</span> <span class="n">prefix</span> <span class="k">else</span> <span class="n">quote</span> +</span><span id="BigQuery.Tokenizer-136"><a href="#BigQuery.Tokenizer-136"><span class="linenos">136</span></a> <span class="k">for</span> <span class="n">quote</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">,</span> <span class="s1">'"""'</span><span class="p">,</span> <span class="s2">"'''"</span><span class="p">]</span> +</span><span id="BigQuery.Tokenizer-137"><a href="#BigQuery.Tokenizer-137"><span class="linenos">137</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"r"</span><span class="p">,</span> <span class="s2">"R"</span><span class="p">]</span> +</span><span id="BigQuery.Tokenizer-138"><a href="#BigQuery.Tokenizer-138"><span class="linenos">138</span></a> <span class="p">]</span> +</span><span id="BigQuery.Tokenizer-139"><a href="#BigQuery.Tokenizer-139"><span class="linenos">139</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="BigQuery.Tokenizer-140"><a href="#BigQuery.Tokenizer-140"><span class="linenos">140</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="BigQuery.Tokenizer-141"><a href="#BigQuery.Tokenizer-141"><span class="linenos">141</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="BigQuery.Tokenizer-142"><a href="#BigQuery.Tokenizer-142"><span class="linenos">142</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0X"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="BigQuery.Tokenizer-143"><a href="#BigQuery.Tokenizer-143"><span class="linenos">143</span></a> +</span><span id="BigQuery.Tokenizer-144"><a href="#BigQuery.Tokenizer-144"><span class="linenos">144</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Tokenizer-145"><a href="#BigQuery.Tokenizer-145"><span class="linenos">145</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-146"><a href="#BigQuery.Tokenizer-146"><span class="linenos">146</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-147"><a href="#BigQuery.Tokenizer-147"><span class="linenos">147</span></a> <span class="s2">"BEGIN TRANSACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-148"><a href="#BigQuery.Tokenizer-148"><span class="linenos">148</span></a> <span class="s2">"CURRENT_DATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-149"><a href="#BigQuery.Tokenizer-149"><span class="linenos">149</span></a> <span class="s2">"CURRENT_TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-150"><a href="#BigQuery.Tokenizer-150"><span class="linenos">150</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-151"><a href="#BigQuery.Tokenizer-151"><span class="linenos">151</span></a> <span class="s2">"GEOGRAPHY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-152"><a href="#BigQuery.Tokenizer-152"><span class="linenos">152</span></a> <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-153"><a href="#BigQuery.Tokenizer-153"><span class="linenos">153</span></a> <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-154"><a href="#BigQuery.Tokenizer-154"><span class="linenos">154</span></a> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-155"><a href="#BigQuery.Tokenizer-155"><span class="linenos">155</span></a> <span class="s2">"UNKNOWN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> +</span><span id="BigQuery.Tokenizer-156"><a href="#BigQuery.Tokenizer-156"><span class="linenos">156</span></a> <span class="p">}</span> +</span><span id="BigQuery.Tokenizer-157"><a href="#BigQuery.Tokenizer-157"><span class="linenos">157</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"DIV"</span><span class="p">)</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="BigQuery.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="BigQuery.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="BigQuery.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BigQuery.Parser"> + <input id="BigQuery.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BigQuery.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="BigQuery.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Parser-159"><a href="#BigQuery.Parser-159"><span class="linenos">159</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="BigQuery.Parser-160"><a href="#BigQuery.Parser-160"><span class="linenos">160</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Parser-161"><a href="#BigQuery.Parser-161"><span class="linenos">161</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Parser-162"><a href="#BigQuery.Parser-162"><span class="linenos">162</span></a> <span class="s2">"DATE_TRUNC"</span><span class="p">:</span> <span class="n">_date_trunc</span><span class="p">,</span> +</span><span id="BigQuery.Parser-163"><a href="#BigQuery.Parser-163"><span class="linenos">163</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="BigQuery.Parser-164"><a href="#BigQuery.Parser-164"><span class="linenos">164</span></a> <span class="s2">"DATETIME_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">),</span> +</span><span id="BigQuery.Parser-165"><a href="#BigQuery.Parser-165"><span class="linenos">165</span></a> <span class="s2">"DIV"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> +</span><span id="BigQuery.Parser-166"><a href="#BigQuery.Parser-166"><span class="linenos">166</span></a> <span class="s2">"REGEXP_CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="BigQuery.Parser-167"><a href="#BigQuery.Parser-167"><span class="linenos">167</span></a> <span class="s2">"TIME_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">),</span> +</span><span id="BigQuery.Parser-168"><a href="#BigQuery.Parser-168"><span class="linenos">168</span></a> <span class="s2">"TIMESTAMP_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">),</span> +</span><span id="BigQuery.Parser-169"><a href="#BigQuery.Parser-169"><span class="linenos">169</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">),</span> +</span><span id="BigQuery.Parser-170"><a href="#BigQuery.Parser-170"><span class="linenos">170</span></a> <span class="s2">"DATETIME_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">),</span> +</span><span id="BigQuery.Parser-171"><a href="#BigQuery.Parser-171"><span class="linenos">171</span></a> <span class="s2">"TIME_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">),</span> +</span><span id="BigQuery.Parser-172"><a href="#BigQuery.Parser-172"><span class="linenos">172</span></a> <span class="s2">"TIMESTAMP_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">),</span> +</span><span id="BigQuery.Parser-173"><a href="#BigQuery.Parser-173"><span class="linenos">173</span></a> <span class="s2">"PARSE_TIMESTAMP"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">(</span> +</span><span id="BigQuery.Parser-174"><a href="#BigQuery.Parser-174"><span class="linenos">174</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="nb">format</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="BigQuery.Parser-175"><a href="#BigQuery.Parser-175"><span class="linenos">175</span></a> <span class="p">),</span> +</span><span id="BigQuery.Parser-176"><a href="#BigQuery.Parser-176"><span class="linenos">176</span></a> <span class="p">}</span> +</span><span id="BigQuery.Parser-177"><a href="#BigQuery.Parser-177"><span class="linenos">177</span></a> +</span><span id="BigQuery.Parser-178"><a href="#BigQuery.Parser-178"><span class="linenos">178</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Parser-179"><a href="#BigQuery.Parser-179"><span class="linenos">179</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Parser-180"><a href="#BigQuery.Parser-180"><span class="linenos">180</span></a> <span class="s2">"ARRAY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()]),</span> +</span><span id="BigQuery.Parser-181"><a href="#BigQuery.Parser-181"><span class="linenos">181</span></a> <span class="p">}</span> +</span><span id="BigQuery.Parser-182"><a href="#BigQuery.Parser-182"><span class="linenos">182</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="BigQuery.Parser-183"><a href="#BigQuery.Parser-183"><span class="linenos">183</span></a> +</span><span id="BigQuery.Parser-184"><a href="#BigQuery.Parser-184"><span class="linenos">184</span></a> <span class="n">NO_PAREN_FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Parser-185"><a href="#BigQuery.Parser-185"><span class="linenos">185</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Parser-186"><a href="#BigQuery.Parser-186"><span class="linenos">186</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDatetime</span><span class="p">,</span> +</span><span id="BigQuery.Parser-187"><a href="#BigQuery.Parser-187"><span class="linenos">187</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTime</span><span class="p">,</span> +</span><span id="BigQuery.Parser-188"><a href="#BigQuery.Parser-188"><span class="linenos">188</span></a> <span class="p">}</span> +</span><span id="BigQuery.Parser-189"><a href="#BigQuery.Parser-189"><span class="linenos">189</span></a> +</span><span id="BigQuery.Parser-190"><a href="#BigQuery.Parser-190"><span class="linenos">190</span></a> <span class="n">NESTED_TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Parser-191"><a href="#BigQuery.Parser-191"><span class="linenos">191</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NESTED_TYPE_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Parser-192"><a href="#BigQuery.Parser-192"><span class="linenos">192</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="BigQuery.Parser-193"><a href="#BigQuery.Parser-193"><span class="linenos">193</span></a> <span class="p">}</span> +</span><span id="BigQuery.Parser-194"><a href="#BigQuery.Parser-194"><span class="linenos">194</span></a> +</span><span id="BigQuery.Parser-195"><a href="#BigQuery.Parser-195"><span class="linenos">195</span></a> <span class="n">ID_VAR_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Parser-196"><a href="#BigQuery.Parser-196"><span class="linenos">196</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Parser-197"><a href="#BigQuery.Parser-197"><span class="linenos">197</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">,</span> +</span><span id="BigQuery.Parser-198"><a href="#BigQuery.Parser-198"><span class="linenos">198</span></a> <span class="p">}</span> +</span><span id="BigQuery.Parser-199"><a href="#BigQuery.Parser-199"><span class="linenos">199</span></a> +</span><span id="BigQuery.Parser-200"><a href="#BigQuery.Parser-200"><span class="linenos">200</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Parser-201"><a href="#BigQuery.Parser-201"><span class="linenos">201</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Parser-202"><a href="#BigQuery.Parser-202"><span class="linenos">202</span></a> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="BigQuery.Parser-203"><a href="#BigQuery.Parser-203"><span class="linenos">203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"VOLATILE"</span><span class="p">)</span> +</span><span id="BigQuery.Parser-204"><a href="#BigQuery.Parser-204"><span class="linenos">204</span></a> <span class="p">),</span> +</span><span id="BigQuery.Parser-205"><a href="#BigQuery.Parser-205"><span class="linenos">205</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="BigQuery.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="BigQuery.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="BigQuery.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="BigQuery.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="BigQuery.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="BigQuery.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="BigQuery.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="BigQuery.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BigQuery.Generator"> + <input id="BigQuery.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BigQuery.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="BigQuery.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator-207"><a href="#BigQuery.Generator-207"><span class="linenos">207</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="BigQuery.Generator-208"><a href="#BigQuery.Generator-208"><span class="linenos">208</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Generator-209"><a href="#BigQuery.Generator-209"><span class="linenos">209</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Generator-210"><a href="#BigQuery.Generator-210"><span class="linenos">210</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">REMOVE_PRECISION_PARAMETERIZED_TYPES</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Generator-211"><a href="#BigQuery.Generator-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_LENGTH"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-212"><a href="#BigQuery.Generator-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATE"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-213"><a href="#BigQuery.Generator-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATE"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-214"><a href="#BigQuery.Generator-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATETIME"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-215"><a href="#BigQuery.Generator-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"DATETIME"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-216"><a href="#BigQuery.Generator-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">,</span><span class="w"> </span><span class="s1">'DAY'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-217"><a href="#BigQuery.Generator-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="BigQuery.Generator-218"><a href="#BigQuery.Generator-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRING_AGG"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-219"><a href="#BigQuery.Generator-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="BigQuery.Generator-220"><a href="#BigQuery.Generator-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DIV"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-221"><a href="#BigQuery.Generator-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">(</span> +</span><span id="BigQuery.Generator-222"><a href="#BigQuery.Generator-222"><span class="linenos">222</span></a> <span class="p">[</span><span class="n">_unqualify_unnest</span><span class="p">],</span> <span class="n">transforms</span><span class="o">.</span><span class="n">delegate</span><span class="p">(</span><span class="s2">"select_sql"</span><span class="p">)</span> +</span><span id="BigQuery.Generator-223"><a href="#BigQuery.Generator-223"><span class="linenos">223</span></a> <span class="p">),</span> +</span><span id="BigQuery.Generator-224"><a href="#BigQuery.Generator-224"><span class="linenos">224</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARSE_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-225"><a href="#BigQuery.Generator-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIME"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-226"><a href="#BigQuery.Generator-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIME"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-227"><a href="#BigQuery.Generator-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">,</span> <span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-228"><a href="#BigQuery.Generator-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">,</span> <span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-229"><a href="#BigQuery.Generator-229"><span class="linenos">229</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="BigQuery.Generator-230"><a href="#BigQuery.Generator-230"><span class="linenos">230</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-231"><a href="#BigQuery.Generator-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">:</span> <span class="n">_derived_table_values_to_unnest</span><span class="p">,</span> +</span><span id="BigQuery.Generator-232"><a href="#BigQuery.Generator-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="n">_returnsproperty_sql</span><span class="p">,</span> +</span><span id="BigQuery.Generator-233"><a href="#BigQuery.Generator-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">_create_sql</span><span class="p">,</span> +</span><span id="BigQuery.Generator-234"><a href="#BigQuery.Generator-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-235"><a href="#BigQuery.Generator-235"><span class="linenos">235</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DETERMINISTIC"</span> +</span><span id="BigQuery.Generator-236"><a href="#BigQuery.Generator-236"><span class="linenos">236</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"IMMUTABLE"</span> +</span><span id="BigQuery.Generator-237"><a href="#BigQuery.Generator-237"><span class="linenos">237</span></a> <span class="k">else</span> <span class="s2">"NOT DETERMINISTIC"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-238"><a href="#BigQuery.Generator-238"><span class="linenos">238</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_CONTAINS"</span><span class="p">),</span> +</span><span id="BigQuery.Generator-239"><a href="#BigQuery.Generator-239"><span class="linenos">239</span></a> <span class="p">}</span> +</span><span id="BigQuery.Generator-240"><a href="#BigQuery.Generator-240"><span class="linenos">240</span></a> +</span><span id="BigQuery.Generator-241"><a href="#BigQuery.Generator-241"><span class="linenos">241</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="BigQuery.Generator-242"><a href="#BigQuery.Generator-242"><span class="linenos">242</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="BigQuery.Generator-243"><a href="#BigQuery.Generator-243"><span class="linenos">243</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-244"><a href="#BigQuery.Generator-244"><span class="linenos">244</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-245"><a href="#BigQuery.Generator-245"><span class="linenos">245</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-246"><a href="#BigQuery.Generator-246"><span class="linenos">246</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INT64"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-247"><a href="#BigQuery.Generator-247"><span class="linenos">247</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-248"><a href="#BigQuery.Generator-248"><span class="linenos">248</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-249"><a href="#BigQuery.Generator-249"><span class="linenos">249</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"FLOAT64"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-250"><a href="#BigQuery.Generator-250"><span class="linenos">250</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BOOL"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-251"><a href="#BigQuery.Generator-251"><span class="linenos">251</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-252"><a href="#BigQuery.Generator-252"><span class="linenos">252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-253"><a href="#BigQuery.Generator-253"><span class="linenos">253</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="BigQuery.Generator-254"><a href="#BigQuery.Generator-254"><span class="linenos">254</span></a> <span class="p">}</span> +</span><span id="BigQuery.Generator-255"><a href="#BigQuery.Generator-255"><span class="linenos">255</span></a> +</span><span id="BigQuery.Generator-256"><a href="#BigQuery.Generator-256"><span class="linenos">256</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="BigQuery.Generator-257"><a href="#BigQuery.Generator-257"><span class="linenos">257</span></a> +</span><span id="BigQuery.Generator-258"><a href="#BigQuery.Generator-258"><span class="linenos">258</span></a> <span class="k">def</span> <span class="nf">array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-259"><a href="#BigQuery.Generator-259"><span class="linenos">259</span></a> <span class="n">first_arg</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="BigQuery.Generator-260"><a href="#BigQuery.Generator-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first_arg</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="BigQuery.Generator-261"><a href="#BigQuery.Generator-261"><span class="linenos">261</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">first_arg</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="BigQuery.Generator-262"><a href="#BigQuery.Generator-262"><span class="linenos">262</span></a> +</span><span id="BigQuery.Generator-263"><a href="#BigQuery.Generator-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="n">inline_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="BigQuery.Generator-264"><a href="#BigQuery.Generator-264"><span class="linenos">264</span></a> +</span><span id="BigQuery.Generator-265"><a href="#BigQuery.Generator-265"><span class="linenos">265</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-266"><a href="#BigQuery.Generator-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="s2">"BEGIN TRANSACTION"</span> +</span><span id="BigQuery.Generator-267"><a href="#BigQuery.Generator-267"><span class="linenos">267</span></a> +</span><span id="BigQuery.Generator-268"><a href="#BigQuery.Generator-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-269"><a href="#BigQuery.Generator-269"><span class="linenos">269</span></a> <span class="k">return</span> <span class="s2">"COMMIT TRANSACTION"</span> +</span><span id="BigQuery.Generator-270"><a href="#BigQuery.Generator-270"><span class="linenos">270</span></a> +</span><span id="BigQuery.Generator-271"><a href="#BigQuery.Generator-271"><span class="linenos">271</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-272"><a href="#BigQuery.Generator-272"><span class="linenos">272</span></a> <span class="k">return</span> <span class="s2">"ROLLBACK TRANSACTION"</span> +</span><span id="BigQuery.Generator-273"><a href="#BigQuery.Generator-273"><span class="linenos">273</span></a> +</span><span id="BigQuery.Generator-274"><a href="#BigQuery.Generator-274"><span class="linenos">274</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-275"><a href="#BigQuery.Generator-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="BigQuery.Generator-276"><a href="#BigQuery.Generator-276"><span class="linenos">276</span></a> +</span><span id="BigQuery.Generator-277"><a href="#BigQuery.Generator-277"><span class="linenos">277</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-278"><a href="#BigQuery.Generator-278"><span class="linenos">278</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="BigQuery.Generator-279"><a href="#BigQuery.Generator-279"><span class="linenos">279</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="BigQuery.Generator-280"><a href="#BigQuery.Generator-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="BigQuery.Generator-281"><a href="#BigQuery.Generator-281"><span class="linenos">281</span></a> +</span><span id="BigQuery.Generator-282"><a href="#BigQuery.Generator-282"><span class="linenos">282</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator-283"><a href="#BigQuery.Generator-283"><span class="linenos">283</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="BigQuery.Generator-284"><a href="#BigQuery.Generator-284"><span class="linenos">284</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="BigQuery.Generator-285"><a href="#BigQuery.Generator-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="BigQuery.Generator.array_sql" class="classattr"> + <input id="BigQuery.Generator.array_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">array_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Array">sqlglot.expressions.Array</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.array_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.array_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.array_sql-258"><a href="#BigQuery.Generator.array_sql-258"><span class="linenos">258</span></a> <span class="k">def</span> <span class="nf">array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.array_sql-259"><a href="#BigQuery.Generator.array_sql-259"><span class="linenos">259</span></a> <span class="n">first_arg</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="BigQuery.Generator.array_sql-260"><a href="#BigQuery.Generator.array_sql-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first_arg</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="BigQuery.Generator.array_sql-261"><a href="#BigQuery.Generator.array_sql-261"><span class="linenos">261</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">first_arg</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="BigQuery.Generator.array_sql-262"><a href="#BigQuery.Generator.array_sql-262"><span class="linenos">262</span></a> +</span><span id="BigQuery.Generator.array_sql-263"><a href="#BigQuery.Generator.array_sql-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="n">inline_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="BigQuery.Generator.transaction_sql" class="classattr"> + <input id="BigQuery.Generator.transaction_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transaction_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.transaction_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.transaction_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.transaction_sql-265"><a href="#BigQuery.Generator.transaction_sql-265"><span class="linenos">265</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.transaction_sql-266"><a href="#BigQuery.Generator.transaction_sql-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="s2">"BEGIN TRANSACTION"</span> +</span></pre></div> + + + + + </div> + <div id="BigQuery.Generator.commit_sql" class="classattr"> + <input id="BigQuery.Generator.commit_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">commit_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.commit_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.commit_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.commit_sql-268"><a href="#BigQuery.Generator.commit_sql-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.commit_sql-269"><a href="#BigQuery.Generator.commit_sql-269"><span class="linenos">269</span></a> <span class="k">return</span> <span class="s2">"COMMIT TRANSACTION"</span> +</span></pre></div> + + + + + </div> + <div id="BigQuery.Generator.rollback_sql" class="classattr"> + <input id="BigQuery.Generator.rollback_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rollback_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.rollback_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.rollback_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.rollback_sql-271"><a href="#BigQuery.Generator.rollback_sql-271"><span class="linenos">271</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.rollback_sql-272"><a href="#BigQuery.Generator.rollback_sql-272"><span class="linenos">272</span></a> <span class="k">return</span> <span class="s2">"ROLLBACK TRANSACTION"</span> +</span></pre></div> + + + + + </div> + <div id="BigQuery.Generator.in_unnest_op" class="classattr"> + <input id="BigQuery.Generator.in_unnest_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">in_unnest_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Unnest">sqlglot.expressions.Unnest</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.in_unnest_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.in_unnest_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.in_unnest_op-274"><a href="#BigQuery.Generator.in_unnest_op-274"><span class="linenos">274</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.in_unnest_op-275"><a href="#BigQuery.Generator.in_unnest_op-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="BigQuery.Generator.except_op" class="classattr"> + <input id="BigQuery.Generator.except_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">except_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Except">sqlglot.expressions.Except</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.except_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.except_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.except_op-277"><a href="#BigQuery.Generator.except_op-277"><span class="linenos">277</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.except_op-278"><a href="#BigQuery.Generator.except_op-278"><span class="linenos">278</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="BigQuery.Generator.except_op-279"><a href="#BigQuery.Generator.except_op-279"><span class="linenos">279</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="BigQuery.Generator.except_op-280"><a href="#BigQuery.Generator.except_op-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="BigQuery.Generator.intersect_op" class="classattr"> + <input id="BigQuery.Generator.intersect_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intersect_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Intersect">sqlglot.expressions.Intersect</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="BigQuery.Generator.intersect_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BigQuery.Generator.intersect_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BigQuery.Generator.intersect_op-282"><a href="#BigQuery.Generator.intersect_op-282"><span class="linenos">282</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="BigQuery.Generator.intersect_op-283"><a href="#BigQuery.Generator.intersect_op-283"><span class="linenos">283</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="BigQuery.Generator.intersect_op-284"><a href="#BigQuery.Generator.intersect_op-284"><span class="linenos">284</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT without DISTINCT is not supported in BigQuery"</span><span class="p">)</span> +</span><span id="BigQuery.Generator.intersect_op-285"><a href="#BigQuery.Generator.intersect_op-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">' DISTINCT'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="BigQuery.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="BigQuery.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="BigQuery.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="BigQuery.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="BigQuery.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="BigQuery.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="BigQuery.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="BigQuery.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="BigQuery.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="BigQuery.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="BigQuery.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="BigQuery.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="BigQuery.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="BigQuery.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="BigQuery.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="BigQuery.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="BigQuery.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="BigQuery.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="BigQuery.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="BigQuery.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="BigQuery.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="BigQuery.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="BigQuery.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="BigQuery.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="BigQuery.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="BigQuery.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="BigQuery.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="BigQuery.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="BigQuery.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="BigQuery.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="BigQuery.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="BigQuery.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="BigQuery.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="BigQuery.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="BigQuery.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="BigQuery.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="BigQuery.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="BigQuery.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="BigQuery.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="BigQuery.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="BigQuery.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="BigQuery.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="BigQuery.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="BigQuery.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="BigQuery.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="BigQuery.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="BigQuery.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="BigQuery.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="BigQuery.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="BigQuery.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="BigQuery.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="BigQuery.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="BigQuery.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="BigQuery.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="BigQuery.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="BigQuery.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="BigQuery.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="BigQuery.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="BigQuery.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="BigQuery.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="BigQuery.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="BigQuery.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="BigQuery.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="BigQuery.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="BigQuery.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="BigQuery.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="BigQuery.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="BigQuery.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="BigQuery.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="BigQuery.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="BigQuery.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="BigQuery.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="BigQuery.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="BigQuery.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="BigQuery.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="BigQuery.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="BigQuery.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="BigQuery.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="BigQuery.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="BigQuery.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="BigQuery.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="BigQuery.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="BigQuery.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="BigQuery.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="BigQuery.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="BigQuery.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="BigQuery.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="BigQuery.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="BigQuery.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="BigQuery.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="BigQuery.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="BigQuery.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="BigQuery.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="BigQuery.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="BigQuery.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="BigQuery.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="BigQuery.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="BigQuery.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="BigQuery.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="BigQuery.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="BigQuery.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="BigQuery.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="BigQuery.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="BigQuery.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="BigQuery.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="BigQuery.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="BigQuery.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="BigQuery.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="BigQuery.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="BigQuery.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="BigQuery.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="BigQuery.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="BigQuery.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="BigQuery.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="BigQuery.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="BigQuery.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="BigQuery.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="BigQuery.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="BigQuery.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="BigQuery.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="BigQuery.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="BigQuery.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="BigQuery.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="BigQuery.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="BigQuery.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="BigQuery.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="BigQuery.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="BigQuery.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="BigQuery.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="BigQuery.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="BigQuery.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="BigQuery.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="BigQuery.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="BigQuery.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="BigQuery.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="BigQuery.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="BigQuery.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="BigQuery.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="BigQuery.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="BigQuery.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="BigQuery.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="BigQuery.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="BigQuery.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="BigQuery.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="BigQuery.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="BigQuery.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="BigQuery.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="BigQuery.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="BigQuery.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="BigQuery.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="BigQuery.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="BigQuery.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="BigQuery.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="BigQuery.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="BigQuery.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="BigQuery.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="BigQuery.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="BigQuery.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="BigQuery.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="BigQuery.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="BigQuery.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="BigQuery.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="BigQuery.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="BigQuery.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="BigQuery.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="BigQuery.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="BigQuery.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="BigQuery.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="BigQuery.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="BigQuery.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="BigQuery.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="BigQuery.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="BigQuery.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="BigQuery.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="BigQuery.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="BigQuery.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="BigQuery.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="BigQuery.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="BigQuery.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="BigQuery.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="BigQuery.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="BigQuery.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="BigQuery.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="BigQuery.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="BigQuery.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="BigQuery.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="BigQuery.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="BigQuery.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="BigQuery.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="BigQuery.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="BigQuery.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="BigQuery.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="BigQuery.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="BigQuery.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/clickhouse.html b/docs/sqlglot/dialects/clickhouse.html new file mode 100644 index 0000000..06bc3cd --- /dev/null +++ b/docs/sqlglot/dialects/clickhouse.html @@ -0,0 +1,1077 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.clickhouse API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#ClickHouse">ClickHouse</a> + <ul class="memberlist"> + <li> + <a class="function" href="#ClickHouse.__init__">ClickHouse</a> + </li> + <li> + <a class="class" href="#ClickHouse.Tokenizer">ClickHouse.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ClickHouse.Parser">ClickHouse.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ClickHouse.Generator">ClickHouse.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#ClickHouse.Generator.cte_sql">cte_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/clickhouse.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.clickhouse </h1> + + + <input id="mod-clickhouse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-clickhouse-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">inline_array_sql</span><span class="p">,</span> <span class="n">var_map_sql</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ParseError</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.parser</span> <span class="kn">import</span> <span class="n">parse_var_map</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="k">def</span> <span class="nf">_lower_func</span><span class="p">(</span><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">index</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="s2">"("</span><span class="p">)</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="k">return</span> <span class="n">sql</span><span class="p">[:</span><span class="n">index</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">+</span> <span class="n">sql</span><span class="p">[</span><span class="n">index</span><span class="p">:]</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="k">class</span> <span class="nc">ClickHouse</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">normalize_functions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="s2">"#!"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="s2">"`"</span><span class="p">]</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="s2">"ASOF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASOF</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="s2">"GLOBAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOBAL</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="s2">"DATETIME64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="s2">"FINAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">,</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="s2">"FLOAT32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="s2">"INT16"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="s2">"INT32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="s2">"INT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="s2">"TUPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="p">}</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="s2">"QUANTILE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">args</span><span class="p">,</span> <span class="n">quantile</span><span class="o">=</span><span class="n">params</span><span class="p">),</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="s2">"QUANTILES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</span><span class="p">(</span><span class="n">parameters</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">),</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="s2">"QUANTILEIF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</span><span class="p">(</span><span class="n">parameters</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">),</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="p">}</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">RANGE_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">,</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOBAL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">)</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">is_global</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="p">}</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">JOIN_KINDS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">JOIN_KINDS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASOF</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span><span class="p">}</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="c1"># WITH <expression> AS <identifier></span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"DateTime64"</span><span class="p">,</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">:</span> <span class="s2">"Tuple"</span><span class="p">,</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"Int32"</span><span class="p">,</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"Float32"</span><span class="p">,</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="p">}</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'substr'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> FINAL"</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">_lower_func</span><span class="p">(</span><span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)),</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">_lower_func</span><span class="p">(</span><span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)),</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="p">}</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">params_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">args_name</span><span class="p">:</span> <span class="nb">str</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">params_name</span><span class="p">))</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">args_name</span><span class="p">))</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="ClickHouse"> + <input id="ClickHouse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ClickHouse</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="ClickHouse-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ClickHouse"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse-18"><a href="#ClickHouse-18"><span class="linenos"> 18</span></a><span class="k">class</span> <span class="nc">ClickHouse</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="ClickHouse-19"><a href="#ClickHouse-19"><span class="linenos"> 19</span></a> <span class="n">normalize_functions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="ClickHouse-20"><a href="#ClickHouse-20"><span class="linenos"> 20</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="ClickHouse-21"><a href="#ClickHouse-21"><span class="linenos"> 21</span></a> +</span><span id="ClickHouse-22"><a href="#ClickHouse-22"><span class="linenos"> 22</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="ClickHouse-23"><a href="#ClickHouse-23"><span class="linenos"> 23</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="s2">"#!"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="ClickHouse-24"><a href="#ClickHouse-24"><span class="linenos"> 24</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="s2">"`"</span><span class="p">]</span> +</span><span id="ClickHouse-25"><a href="#ClickHouse-25"><span class="linenos"> 25</span></a> +</span><span id="ClickHouse-26"><a href="#ClickHouse-26"><span class="linenos"> 26</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-27"><a href="#ClickHouse-27"><span class="linenos"> 27</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="ClickHouse-28"><a href="#ClickHouse-28"><span class="linenos"> 28</span></a> <span class="s2">"ASOF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASOF</span><span class="p">,</span> +</span><span id="ClickHouse-29"><a href="#ClickHouse-29"><span class="linenos"> 29</span></a> <span class="s2">"GLOBAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOBAL</span><span class="p">,</span> +</span><span id="ClickHouse-30"><a href="#ClickHouse-30"><span class="linenos"> 30</span></a> <span class="s2">"DATETIME64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="ClickHouse-31"><a href="#ClickHouse-31"><span class="linenos"> 31</span></a> <span class="s2">"FINAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">,</span> +</span><span id="ClickHouse-32"><a href="#ClickHouse-32"><span class="linenos"> 32</span></a> <span class="s2">"FLOAT32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="ClickHouse-33"><a href="#ClickHouse-33"><span class="linenos"> 33</span></a> <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="ClickHouse-34"><a href="#ClickHouse-34"><span class="linenos"> 34</span></a> <span class="s2">"INT16"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="ClickHouse-35"><a href="#ClickHouse-35"><span class="linenos"> 35</span></a> <span class="s2">"INT32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="ClickHouse-36"><a href="#ClickHouse-36"><span class="linenos"> 36</span></a> <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="ClickHouse-37"><a href="#ClickHouse-37"><span class="linenos"> 37</span></a> <span class="s2">"INT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="ClickHouse-38"><a href="#ClickHouse-38"><span class="linenos"> 38</span></a> <span class="s2">"TUPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="ClickHouse-39"><a href="#ClickHouse-39"><span class="linenos"> 39</span></a> <span class="p">}</span> +</span><span id="ClickHouse-40"><a href="#ClickHouse-40"><span class="linenos"> 40</span></a> +</span><span id="ClickHouse-41"><a href="#ClickHouse-41"><span class="linenos"> 41</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="ClickHouse-42"><a href="#ClickHouse-42"><span class="linenos"> 42</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-43"><a href="#ClickHouse-43"><span class="linenos"> 43</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse-44"><a href="#ClickHouse-44"><span class="linenos"> 44</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="ClickHouse-45"><a href="#ClickHouse-45"><span class="linenos"> 45</span></a> <span class="s2">"QUANTILE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">args</span><span class="p">,</span> <span class="n">quantile</span><span class="o">=</span><span class="n">params</span><span class="p">),</span> +</span><span id="ClickHouse-46"><a href="#ClickHouse-46"><span class="linenos"> 46</span></a> <span class="s2">"QUANTILES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</span><span class="p">(</span><span class="n">parameters</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">),</span> +</span><span id="ClickHouse-47"><a href="#ClickHouse-47"><span class="linenos"> 47</span></a> <span class="s2">"QUANTILEIF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</span><span class="p">(</span><span class="n">parameters</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">),</span> +</span><span id="ClickHouse-48"><a href="#ClickHouse-48"><span class="linenos"> 48</span></a> <span class="p">}</span> +</span><span id="ClickHouse-49"><a href="#ClickHouse-49"><span class="linenos"> 49</span></a> +</span><span id="ClickHouse-50"><a href="#ClickHouse-50"><span class="linenos"> 50</span></a> <span class="n">RANGE_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-51"><a href="#ClickHouse-51"><span class="linenos"> 51</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">,</span> +</span><span id="ClickHouse-52"><a href="#ClickHouse-52"><span class="linenos"> 52</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOBAL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">)</span> +</span><span id="ClickHouse-53"><a href="#ClickHouse-53"><span class="linenos"> 53</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">is_global</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="ClickHouse-54"><a href="#ClickHouse-54"><span class="linenos"> 54</span></a> <span class="p">}</span> +</span><span id="ClickHouse-55"><a href="#ClickHouse-55"><span class="linenos"> 55</span></a> +</span><span id="ClickHouse-56"><a href="#ClickHouse-56"><span class="linenos"> 56</span></a> <span class="n">JOIN_KINDS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">JOIN_KINDS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASOF</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse-57"><a href="#ClickHouse-57"><span class="linenos"> 57</span></a> +</span><span id="ClickHouse-58"><a href="#ClickHouse-58"><span class="linenos"> 58</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span><span class="p">}</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse-59"><a href="#ClickHouse-59"><span class="linenos"> 59</span></a> +</span><span id="ClickHouse-60"><a href="#ClickHouse-60"><span class="linenos"> 60</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> +</span><span id="ClickHouse-61"><a href="#ClickHouse-61"><span class="linenos"> 61</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="ClickHouse-62"><a href="#ClickHouse-62"><span class="linenos"> 62</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="ClickHouse-63"><a href="#ClickHouse-63"><span class="linenos"> 63</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse-64"><a href="#ClickHouse-64"><span class="linenos"> 64</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> +</span><span id="ClickHouse-65"><a href="#ClickHouse-65"><span class="linenos"> 65</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse-66"><a href="#ClickHouse-66"><span class="linenos"> 66</span></a> +</span><span id="ClickHouse-67"><a href="#ClickHouse-67"><span class="linenos"> 67</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="ClickHouse-68"><a href="#ClickHouse-68"><span class="linenos"> 68</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="ClickHouse-69"><a href="#ClickHouse-69"><span class="linenos"> 69</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="ClickHouse-70"><a href="#ClickHouse-70"><span class="linenos"> 70</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> +</span><span id="ClickHouse-71"><a href="#ClickHouse-71"><span class="linenos"> 71</span></a> +</span><span id="ClickHouse-72"><a href="#ClickHouse-72"><span class="linenos"> 72</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> +</span><span id="ClickHouse-73"><a href="#ClickHouse-73"><span class="linenos"> 73</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse-74"><a href="#ClickHouse-74"><span class="linenos"> 74</span></a> +</span><span id="ClickHouse-75"><a href="#ClickHouse-75"><span class="linenos"> 75</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse-76"><a href="#ClickHouse-76"><span class="linenos"> 76</span></a> +</span><span id="ClickHouse-77"><a href="#ClickHouse-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="ClickHouse-78"><a href="#ClickHouse-78"><span class="linenos"> 78</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="ClickHouse-79"><a href="#ClickHouse-79"><span class="linenos"> 79</span></a> +</span><span id="ClickHouse-80"><a href="#ClickHouse-80"><span class="linenos"> 80</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> +</span><span id="ClickHouse-81"><a href="#ClickHouse-81"><span class="linenos"> 81</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="ClickHouse-82"><a href="#ClickHouse-82"><span class="linenos"> 82</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="ClickHouse-83"><a href="#ClickHouse-83"><span class="linenos"> 83</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="ClickHouse-84"><a href="#ClickHouse-84"><span class="linenos"> 84</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> +</span><span id="ClickHouse-85"><a href="#ClickHouse-85"><span class="linenos"> 85</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> +</span><span id="ClickHouse-86"><a href="#ClickHouse-86"><span class="linenos"> 86</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="ClickHouse-87"><a href="#ClickHouse-87"><span class="linenos"> 87</span></a> <span class="c1"># WITH <expression> AS <identifier></span> +</span><span id="ClickHouse-88"><a href="#ClickHouse-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="ClickHouse-89"><a href="#ClickHouse-89"><span class="linenos"> 89</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="ClickHouse-90"><a href="#ClickHouse-90"><span class="linenos"> 90</span></a> +</span><span id="ClickHouse-91"><a href="#ClickHouse-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse-92"><a href="#ClickHouse-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> +</span><span id="ClickHouse-93"><a href="#ClickHouse-93"><span class="linenos"> 93</span></a> +</span><span id="ClickHouse-94"><a href="#ClickHouse-94"><span class="linenos"> 94</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse-95"><a href="#ClickHouse-95"><span class="linenos"> 95</span></a> +</span><span id="ClickHouse-96"><a href="#ClickHouse-96"><span class="linenos"> 96</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="ClickHouse-97"><a href="#ClickHouse-97"><span class="linenos"> 97</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="ClickHouse-98"><a href="#ClickHouse-98"><span class="linenos"> 98</span></a> +</span><span id="ClickHouse-99"><a href="#ClickHouse-99"><span class="linenos"> 99</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-100"><a href="#ClickHouse-100"><span class="linenos">100</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse-101"><a href="#ClickHouse-101"><span class="linenos">101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> +</span><span id="ClickHouse-102"><a href="#ClickHouse-102"><span class="linenos">102</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"DateTime64"</span><span class="p">,</span> +</span><span id="ClickHouse-103"><a href="#ClickHouse-103"><span class="linenos">103</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> +</span><span id="ClickHouse-104"><a href="#ClickHouse-104"><span class="linenos">104</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> +</span><span id="ClickHouse-105"><a href="#ClickHouse-105"><span class="linenos">105</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">:</span> <span class="s2">"Tuple"</span><span class="p">,</span> +</span><span id="ClickHouse-106"><a href="#ClickHouse-106"><span class="linenos">106</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> +</span><span id="ClickHouse-107"><a href="#ClickHouse-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> +</span><span id="ClickHouse-108"><a href="#ClickHouse-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"Int32"</span><span class="p">,</span> +</span><span id="ClickHouse-109"><a href="#ClickHouse-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> +</span><span id="ClickHouse-110"><a href="#ClickHouse-110"><span class="linenos">110</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"Float32"</span><span class="p">,</span> +</span><span id="ClickHouse-111"><a href="#ClickHouse-111"><span class="linenos">111</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> +</span><span id="ClickHouse-112"><a href="#ClickHouse-112"><span class="linenos">112</span></a> <span class="p">}</span> +</span><span id="ClickHouse-113"><a href="#ClickHouse-113"><span class="linenos">113</span></a> +</span><span id="ClickHouse-114"><a href="#ClickHouse-114"><span class="linenos">114</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse-115"><a href="#ClickHouse-115"><span class="linenos">115</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse-116"><a href="#ClickHouse-116"><span class="linenos">116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="ClickHouse-117"><a href="#ClickHouse-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'substr'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="ClickHouse-118"><a href="#ClickHouse-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> FINAL"</span><span class="p">,</span> +</span><span id="ClickHouse-119"><a href="#ClickHouse-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">_lower_func</span><span class="p">(</span><span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)),</span> +</span><span id="ClickHouse-120"><a href="#ClickHouse-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">_lower_func</span><span class="p">(</span><span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)),</span> +</span><span id="ClickHouse-121"><a href="#ClickHouse-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse-122"><a href="#ClickHouse-122"><span class="linenos">122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse-123"><a href="#ClickHouse-123"><span class="linenos">123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse-124"><a href="#ClickHouse-124"><span class="linenos">124</span></a> <span class="p">}</span> +</span><span id="ClickHouse-125"><a href="#ClickHouse-125"><span class="linenos">125</span></a> +</span><span id="ClickHouse-126"><a href="#ClickHouse-126"><span class="linenos">126</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse-127"><a href="#ClickHouse-127"><span class="linenos">127</span></a> +</span><span id="ClickHouse-128"><a href="#ClickHouse-128"><span class="linenos">128</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> +</span><span id="ClickHouse-129"><a href="#ClickHouse-129"><span class="linenos">129</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">params_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">args_name</span><span class="p">:</span> <span class="nb">str</span> +</span><span id="ClickHouse-130"><a href="#ClickHouse-130"><span class="linenos">130</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse-131"><a href="#ClickHouse-131"><span class="linenos">131</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">params_name</span><span class="p">))</span> +</span><span id="ClickHouse-132"><a href="#ClickHouse-132"><span class="linenos">132</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">args_name</span><span class="p">))</span> +</span><span id="ClickHouse-133"><a href="#ClickHouse-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="ClickHouse-134"><a href="#ClickHouse-134"><span class="linenos">134</span></a> +</span><span id="ClickHouse-135"><a href="#ClickHouse-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse-136"><a href="#ClickHouse-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse-137"><a href="#ClickHouse-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="ClickHouse-138"><a href="#ClickHouse-138"><span class="linenos">138</span></a> +</span><span id="ClickHouse-139"><a href="#ClickHouse-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="ClickHouse.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">ClickHouse</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#ClickHouse.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="ClickHouse.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="ClickHouse.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="ClickHouse.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="ClickHouse.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="ClickHouse.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="ClickHouse.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="ClickHouse.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="ClickHouse.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ClickHouse.Tokenizer"> + <input id="ClickHouse.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ClickHouse.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="ClickHouse.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ClickHouse.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Tokenizer-22"><a href="#ClickHouse.Tokenizer-22"><span class="linenos">22</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="ClickHouse.Tokenizer-23"><a href="#ClickHouse.Tokenizer-23"><span class="linenos">23</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="s2">"#!"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="ClickHouse.Tokenizer-24"><a href="#ClickHouse.Tokenizer-24"><span class="linenos">24</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="s2">"`"</span><span class="p">]</span> +</span><span id="ClickHouse.Tokenizer-25"><a href="#ClickHouse.Tokenizer-25"><span class="linenos">25</span></a> +</span><span id="ClickHouse.Tokenizer-26"><a href="#ClickHouse.Tokenizer-26"><span class="linenos">26</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Tokenizer-27"><a href="#ClickHouse.Tokenizer-27"><span class="linenos">27</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-28"><a href="#ClickHouse.Tokenizer-28"><span class="linenos">28</span></a> <span class="s2">"ASOF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASOF</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-29"><a href="#ClickHouse.Tokenizer-29"><span class="linenos">29</span></a> <span class="s2">"GLOBAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOBAL</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-30"><a href="#ClickHouse.Tokenizer-30"><span class="linenos">30</span></a> <span class="s2">"DATETIME64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-31"><a href="#ClickHouse.Tokenizer-31"><span class="linenos">31</span></a> <span class="s2">"FINAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-32"><a href="#ClickHouse.Tokenizer-32"><span class="linenos">32</span></a> <span class="s2">"FLOAT32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-33"><a href="#ClickHouse.Tokenizer-33"><span class="linenos">33</span></a> <span class="s2">"FLOAT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-34"><a href="#ClickHouse.Tokenizer-34"><span class="linenos">34</span></a> <span class="s2">"INT16"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-35"><a href="#ClickHouse.Tokenizer-35"><span class="linenos">35</span></a> <span class="s2">"INT32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-36"><a href="#ClickHouse.Tokenizer-36"><span class="linenos">36</span></a> <span class="s2">"INT64"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-37"><a href="#ClickHouse.Tokenizer-37"><span class="linenos">37</span></a> <span class="s2">"INT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-38"><a href="#ClickHouse.Tokenizer-38"><span class="linenos">38</span></a> <span class="s2">"TUPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="ClickHouse.Tokenizer-39"><a href="#ClickHouse.Tokenizer-39"><span class="linenos">39</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="ClickHouse.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="ClickHouse.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="ClickHouse.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ClickHouse.Parser"> + <input id="ClickHouse.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ClickHouse.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="ClickHouse.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ClickHouse.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Parser-41"><a href="#ClickHouse.Parser-41"><span class="linenos">41</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="ClickHouse.Parser-42"><a href="#ClickHouse.Parser-42"><span class="linenos">42</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Parser-43"><a href="#ClickHouse.Parser-43"><span class="linenos">43</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse.Parser-44"><a href="#ClickHouse.Parser-44"><span class="linenos">44</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="ClickHouse.Parser-45"><a href="#ClickHouse.Parser-45"><span class="linenos">45</span></a> <span class="s2">"QUANTILE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">args</span><span class="p">,</span> <span class="n">quantile</span><span class="o">=</span><span class="n">params</span><span class="p">),</span> +</span><span id="ClickHouse.Parser-46"><a href="#ClickHouse.Parser-46"><span class="linenos">46</span></a> <span class="s2">"QUANTILES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</span><span class="p">(</span><span class="n">parameters</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">),</span> +</span><span id="ClickHouse.Parser-47"><a href="#ClickHouse.Parser-47"><span class="linenos">47</span></a> <span class="s2">"QUANTILEIF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">params</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</span><span class="p">(</span><span class="n">parameters</span><span class="o">=</span><span class="n">params</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">),</span> +</span><span id="ClickHouse.Parser-48"><a href="#ClickHouse.Parser-48"><span class="linenos">48</span></a> <span class="p">}</span> +</span><span id="ClickHouse.Parser-49"><a href="#ClickHouse.Parser-49"><span class="linenos">49</span></a> +</span><span id="ClickHouse.Parser-50"><a href="#ClickHouse.Parser-50"><span class="linenos">50</span></a> <span class="n">RANGE_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Parser-51"><a href="#ClickHouse.Parser-51"><span class="linenos">51</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">,</span> +</span><span id="ClickHouse.Parser-52"><a href="#ClickHouse.Parser-52"><span class="linenos">52</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOBAL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-53"><a href="#ClickHouse.Parser-53"><span class="linenos">53</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">is_global</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="ClickHouse.Parser-54"><a href="#ClickHouse.Parser-54"><span class="linenos">54</span></a> <span class="p">}</span> +</span><span id="ClickHouse.Parser-55"><a href="#ClickHouse.Parser-55"><span class="linenos">55</span></a> +</span><span id="ClickHouse.Parser-56"><a href="#ClickHouse.Parser-56"><span class="linenos">56</span></a> <span class="n">JOIN_KINDS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">JOIN_KINDS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASOF</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse.Parser-57"><a href="#ClickHouse.Parser-57"><span class="linenos">57</span></a> +</span><span id="ClickHouse.Parser-58"><a href="#ClickHouse.Parser-58"><span class="linenos">58</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span><span class="p">}</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse.Parser-59"><a href="#ClickHouse.Parser-59"><span class="linenos">59</span></a> +</span><span id="ClickHouse.Parser-60"><a href="#ClickHouse.Parser-60"><span class="linenos">60</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span> +</span><span id="ClickHouse.Parser-61"><a href="#ClickHouse.Parser-61"><span class="linenos">61</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">is_global</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="ClickHouse.Parser-62"><a href="#ClickHouse.Parser-62"><span class="linenos">62</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-63"><a href="#ClickHouse.Parser-63"><span class="linenos">63</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-64"><a href="#ClickHouse.Parser-64"><span class="linenos">64</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">,</span> <span class="n">is_global</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-65"><a href="#ClickHouse.Parser-65"><span class="linenos">65</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse.Parser-66"><a href="#ClickHouse.Parser-66"><span class="linenos">66</span></a> +</span><span id="ClickHouse.Parser-67"><a href="#ClickHouse.Parser-67"><span class="linenos">67</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="ClickHouse.Parser-68"><a href="#ClickHouse.Parser-68"><span class="linenos">68</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="ClickHouse.Parser-69"><a href="#ClickHouse.Parser-69"><span class="linenos">69</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="ClickHouse.Parser-70"><a href="#ClickHouse.Parser-70"><span class="linenos">70</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-71"><a href="#ClickHouse.Parser-71"><span class="linenos">71</span></a> +</span><span id="ClickHouse.Parser-72"><a href="#ClickHouse.Parser-72"><span class="linenos">72</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FINAL</span><span class="p">):</span> +</span><span id="ClickHouse.Parser-73"><a href="#ClickHouse.Parser-73"><span class="linenos">73</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-74"><a href="#ClickHouse.Parser-74"><span class="linenos">74</span></a> +</span><span id="ClickHouse.Parser-75"><a href="#ClickHouse.Parser-75"><span class="linenos">75</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="ClickHouse.Parser-76"><a href="#ClickHouse.Parser-76"><span class="linenos">76</span></a> +</span><span id="ClickHouse.Parser-77"><a href="#ClickHouse.Parser-77"><span class="linenos">77</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-78"><a href="#ClickHouse.Parser-78"><span class="linenos">78</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(</span><span class="n">haystack_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-79"><a href="#ClickHouse.Parser-79"><span class="linenos">79</span></a> +</span><span id="ClickHouse.Parser-80"><a href="#ClickHouse.Parser-80"><span class="linenos">80</span></a> <span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/with/</span> +</span><span id="ClickHouse.Parser-81"><a href="#ClickHouse.Parser-81"><span class="linenos">81</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-82"><a href="#ClickHouse.Parser-82"><span class="linenos">82</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="ClickHouse.Parser-83"><a href="#ClickHouse.Parser-83"><span class="linenos">83</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-84"><a href="#ClickHouse.Parser-84"><span class="linenos">84</span></a> <span class="c1"># WITH <identifier> AS <subquery expression></span> +</span><span id="ClickHouse.Parser-85"><a href="#ClickHouse.Parser-85"><span class="linenos">85</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">()</span> +</span><span id="ClickHouse.Parser-86"><a href="#ClickHouse.Parser-86"><span class="linenos">86</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="ClickHouse.Parser-87"><a href="#ClickHouse.Parser-87"><span class="linenos">87</span></a> <span class="c1"># WITH <expression> AS <identifier></span> +</span><span id="ClickHouse.Parser-88"><a href="#ClickHouse.Parser-88"><span class="linenos">88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-89"><a href="#ClickHouse.Parser-89"><span class="linenos">89</span></a> <span class="n">statement</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="ClickHouse.Parser-90"><a href="#ClickHouse.Parser-90"><span class="linenos">90</span></a> +</span><span id="ClickHouse.Parser-91"><a href="#ClickHouse.Parser-91"><span class="linenos">91</span></a> <span class="k">if</span> <span class="n">statement</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse.Parser-92"><a href="#ClickHouse.Parser-92"><span class="linenos">92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> +</span><span id="ClickHouse.Parser-93"><a href="#ClickHouse.Parser-93"><span class="linenos">93</span></a> +</span><span id="ClickHouse.Parser-94"><a href="#ClickHouse.Parser-94"><span class="linenos">94</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">statement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">statement</span> <span class="ow">and</span> <span class="n">statement</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="ClickHouse.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="ClickHouse.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="ClickHouse.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="ClickHouse.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="ClickHouse.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="ClickHouse.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="ClickHouse.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="ClickHouse.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ClickHouse.Generator"> + <input id="ClickHouse.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ClickHouse.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="ClickHouse.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ClickHouse.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Generator-96"><a href="#ClickHouse.Generator-96"><span class="linenos"> 96</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="ClickHouse.Generator-97"><a href="#ClickHouse.Generator-97"><span class="linenos"> 97</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="ClickHouse.Generator-98"><a href="#ClickHouse.Generator-98"><span class="linenos"> 98</span></a> +</span><span id="ClickHouse.Generator-99"><a href="#ClickHouse.Generator-99"><span class="linenos"> 99</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Generator-100"><a href="#ClickHouse.Generator-100"><span class="linenos">100</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse.Generator-101"><a href="#ClickHouse.Generator-101"><span class="linenos">101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">:</span> <span class="s2">"Nullable"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-102"><a href="#ClickHouse.Generator-102"><span class="linenos">102</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"DateTime64"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-103"><a href="#ClickHouse.Generator-103"><span class="linenos">103</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MAP</span><span class="p">:</span> <span class="s2">"Map"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-104"><a href="#ClickHouse.Generator-104"><span class="linenos">104</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">:</span> <span class="s2">"Array"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-105"><a href="#ClickHouse.Generator-105"><span class="linenos">105</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">:</span> <span class="s2">"Tuple"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-106"><a href="#ClickHouse.Generator-106"><span class="linenos">106</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"Int8"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-107"><a href="#ClickHouse.Generator-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"Int16"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-108"><a href="#ClickHouse.Generator-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"Int32"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-109"><a href="#ClickHouse.Generator-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"Int64"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-110"><a href="#ClickHouse.Generator-110"><span class="linenos">110</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"Float32"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-111"><a href="#ClickHouse.Generator-111"><span class="linenos">111</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"Float64"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-112"><a href="#ClickHouse.Generator-112"><span class="linenos">112</span></a> <span class="p">}</span> +</span><span id="ClickHouse.Generator-113"><a href="#ClickHouse.Generator-113"><span class="linenos">113</span></a> +</span><span id="ClickHouse.Generator-114"><a href="#ClickHouse.Generator-114"><span class="linenos">114</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ClickHouse.Generator-115"><a href="#ClickHouse.Generator-115"><span class="linenos">115</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="ClickHouse.Generator-116"><a href="#ClickHouse.Generator-116"><span class="linenos">116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-117"><a href="#ClickHouse.Generator-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"position(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'substr'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-118"><a href="#ClickHouse.Generator-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Final</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> FINAL"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-119"><a href="#ClickHouse.Generator-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">_lower_func</span><span class="p">(</span><span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)),</span> +</span><span id="ClickHouse.Generator-120"><a href="#ClickHouse.Generator-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">_lower_func</span><span class="p">(</span><span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)),</span> +</span><span id="ClickHouse.Generator-121"><a href="#ClickHouse.Generator-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantile</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-122"><a href="#ClickHouse.Generator-122"><span class="linenos">122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantiles</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantiles</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-123"><a href="#ClickHouse.Generator-123"><span class="linenos">123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">QuantileIf</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"quantileIf</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_param_args_sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'parameters'</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="ClickHouse.Generator-124"><a href="#ClickHouse.Generator-124"><span class="linenos">124</span></a> <span class="p">}</span> +</span><span id="ClickHouse.Generator-125"><a href="#ClickHouse.Generator-125"><span class="linenos">125</span></a> +</span><span id="ClickHouse.Generator-126"><a href="#ClickHouse.Generator-126"><span class="linenos">126</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ClickHouse.Generator-127"><a href="#ClickHouse.Generator-127"><span class="linenos">127</span></a> +</span><span id="ClickHouse.Generator-128"><a href="#ClickHouse.Generator-128"><span class="linenos">128</span></a> <span class="k">def</span> <span class="nf">_param_args_sql</span><span class="p">(</span> +</span><span id="ClickHouse.Generator-129"><a href="#ClickHouse.Generator-129"><span class="linenos">129</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">params_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">args_name</span><span class="p">:</span> <span class="nb">str</span> +</span><span id="ClickHouse.Generator-130"><a href="#ClickHouse.Generator-130"><span class="linenos">130</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse.Generator-131"><a href="#ClickHouse.Generator-131"><span class="linenos">131</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">params_name</span><span class="p">))</span> +</span><span id="ClickHouse.Generator-132"><a href="#ClickHouse.Generator-132"><span class="linenos">132</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">args_name</span><span class="p">))</span> +</span><span id="ClickHouse.Generator-133"><a href="#ClickHouse.Generator-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">params</span><span class="si">}</span><span class="s2">)(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="ClickHouse.Generator-134"><a href="#ClickHouse.Generator-134"><span class="linenos">134</span></a> +</span><span id="ClickHouse.Generator-135"><a href="#ClickHouse.Generator-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse.Generator-136"><a href="#ClickHouse.Generator-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse.Generator-137"><a href="#ClickHouse.Generator-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="ClickHouse.Generator-138"><a href="#ClickHouse.Generator-138"><span class="linenos">138</span></a> +</span><span id="ClickHouse.Generator-139"><a href="#ClickHouse.Generator-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="ClickHouse.Generator.cte_sql" class="classattr"> + <input id="ClickHouse.Generator.cte_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cte_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#CTE">sqlglot.expressions.CTE</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="ClickHouse.Generator.cte_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ClickHouse.Generator.cte_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ClickHouse.Generator.cte_sql-135"><a href="#ClickHouse.Generator.cte_sql-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="ClickHouse.Generator.cte_sql-136"><a href="#ClickHouse.Generator.cte_sql-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="ClickHouse.Generator.cte_sql-137"><a href="#ClickHouse.Generator.cte_sql-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="ClickHouse.Generator.cte_sql-138"><a href="#ClickHouse.Generator.cte_sql-138"><span class="linenos">138</span></a> +</span><span id="ClickHouse.Generator.cte_sql-139"><a href="#ClickHouse.Generator.cte_sql-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cte_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="ClickHouse.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="ClickHouse.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="ClickHouse.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="ClickHouse.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="ClickHouse.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="ClickHouse.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="ClickHouse.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="ClickHouse.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="ClickHouse.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="ClickHouse.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="ClickHouse.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="ClickHouse.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="ClickHouse.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="ClickHouse.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="ClickHouse.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="ClickHouse.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="ClickHouse.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="ClickHouse.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="ClickHouse.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="ClickHouse.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="ClickHouse.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="ClickHouse.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="ClickHouse.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="ClickHouse.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="ClickHouse.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="ClickHouse.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="ClickHouse.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="ClickHouse.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="ClickHouse.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="ClickHouse.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="ClickHouse.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="ClickHouse.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="ClickHouse.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="ClickHouse.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="ClickHouse.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="ClickHouse.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="ClickHouse.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="ClickHouse.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="ClickHouse.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="ClickHouse.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="ClickHouse.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="ClickHouse.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="ClickHouse.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="ClickHouse.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="ClickHouse.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="ClickHouse.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="ClickHouse.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="ClickHouse.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="ClickHouse.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="ClickHouse.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="ClickHouse.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="ClickHouse.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="ClickHouse.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="ClickHouse.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="ClickHouse.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="ClickHouse.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="ClickHouse.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="ClickHouse.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="ClickHouse.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="ClickHouse.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="ClickHouse.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="ClickHouse.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="ClickHouse.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="ClickHouse.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="ClickHouse.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="ClickHouse.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="ClickHouse.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="ClickHouse.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="ClickHouse.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="ClickHouse.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="ClickHouse.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="ClickHouse.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="ClickHouse.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="ClickHouse.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="ClickHouse.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="ClickHouse.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="ClickHouse.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="ClickHouse.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="ClickHouse.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="ClickHouse.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="ClickHouse.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="ClickHouse.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="ClickHouse.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="ClickHouse.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="ClickHouse.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="ClickHouse.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="ClickHouse.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="ClickHouse.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="ClickHouse.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="ClickHouse.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="ClickHouse.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="ClickHouse.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="ClickHouse.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="ClickHouse.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="ClickHouse.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="ClickHouse.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="ClickHouse.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="ClickHouse.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="ClickHouse.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="ClickHouse.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="ClickHouse.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="ClickHouse.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="ClickHouse.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="ClickHouse.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="ClickHouse.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="ClickHouse.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="ClickHouse.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="ClickHouse.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="ClickHouse.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="ClickHouse.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="ClickHouse.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="ClickHouse.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="ClickHouse.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="ClickHouse.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="ClickHouse.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="ClickHouse.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="ClickHouse.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="ClickHouse.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="ClickHouse.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="ClickHouse.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="ClickHouse.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="ClickHouse.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="ClickHouse.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="ClickHouse.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="ClickHouse.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="ClickHouse.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="ClickHouse.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="ClickHouse.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="ClickHouse.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="ClickHouse.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="ClickHouse.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="ClickHouse.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="ClickHouse.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="ClickHouse.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="ClickHouse.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="ClickHouse.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="ClickHouse.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="ClickHouse.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="ClickHouse.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="ClickHouse.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="ClickHouse.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="ClickHouse.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="ClickHouse.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="ClickHouse.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="ClickHouse.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="ClickHouse.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="ClickHouse.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="ClickHouse.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="ClickHouse.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="ClickHouse.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="ClickHouse.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="ClickHouse.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="ClickHouse.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="ClickHouse.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="ClickHouse.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="ClickHouse.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="ClickHouse.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="ClickHouse.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="ClickHouse.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="ClickHouse.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="ClickHouse.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="ClickHouse.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="ClickHouse.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="ClickHouse.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="ClickHouse.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="ClickHouse.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="ClickHouse.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="ClickHouse.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="ClickHouse.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="ClickHouse.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="ClickHouse.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="ClickHouse.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="ClickHouse.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="ClickHouse.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="ClickHouse.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="ClickHouse.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="ClickHouse.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="ClickHouse.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="ClickHouse.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="ClickHouse.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="ClickHouse.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="ClickHouse.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="ClickHouse.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="ClickHouse.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="ClickHouse.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="ClickHouse.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="ClickHouse.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="ClickHouse.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="ClickHouse.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="ClickHouse.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="ClickHouse.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="ClickHouse.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="ClickHouse.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="ClickHouse.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="ClickHouse.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="ClickHouse.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="ClickHouse.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="ClickHouse.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/databricks.html b/docs/sqlglot/dialects/databricks.html new file mode 100644 index 0000000..74464c8 --- /dev/null +++ b/docs/sqlglot/dialects/databricks.html @@ -0,0 +1,704 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.databricks API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Databricks">Databricks</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Databricks.__init__">Databricks</a> + </li> + <li> + <a class="class" href="#Databricks.Parser">Databricks.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Databricks.Generator">Databricks.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/databricks.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.databricks </h1> + + + <input id="mod-databricks-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-databricks-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">parse_date_delta</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.spark</span> <span class="kn">import</span> <span class="n">Spark</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.tsql</span> <span class="kn">import</span> <span class="n">generate_date_delta_with_unit_sql</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">Databricks</span><span class="p">(</span><span class="n">Spark</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="o">**</span><span class="n">Spark</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">),</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="p">}</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="o">**</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="p">}</span> +</span></pre></div> + + + </section> + <section id="Databricks"> + <input id="Databricks-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Databricks</span><wbr>(<span class="base"><a href="spark.html#Spark">sqlglot.dialects.spark.Spark</a></span>): + + <label class="view-source-button" for="Databricks-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Databricks"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Databricks-10"><a href="#Databricks-10"><span class="linenos">10</span></a><span class="k">class</span> <span class="nc">Databricks</span><span class="p">(</span><span class="n">Spark</span><span class="p">):</span> +</span><span id="Databricks-11"><a href="#Databricks-11"><span class="linenos">11</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Databricks-12"><a href="#Databricks-12"><span class="linenos">12</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Databricks-13"><a href="#Databricks-13"><span class="linenos">13</span></a> <span class="o">**</span><span class="n">Spark</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Databricks-14"><a href="#Databricks-14"><span class="linenos">14</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="Databricks-15"><a href="#Databricks-15"><span class="linenos">15</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="Databricks-16"><a href="#Databricks-16"><span class="linenos">16</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">),</span> +</span><span id="Databricks-17"><a href="#Databricks-17"><span class="linenos">17</span></a> <span class="p">}</span> +</span><span id="Databricks-18"><a href="#Databricks-18"><span class="linenos">18</span></a> +</span><span id="Databricks-19"><a href="#Databricks-19"><span class="linenos">19</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Databricks-20"><a href="#Databricks-20"><span class="linenos">20</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Databricks-21"><a href="#Databricks-21"><span class="linenos">21</span></a> <span class="o">**</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Databricks-22"><a href="#Databricks-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="Databricks-23"><a href="#Databricks-23"><span class="linenos">23</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="Databricks-24"><a href="#Databricks-24"><span class="linenos">24</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div id="Databricks.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Databricks</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Databricks.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="spark.html#Spark">sqlglot.dialects.spark.Spark</a></dt> + <dd id="Databricks.Tokenizer" class="class"><a href="spark.html#Spark.Tokenizer">Tokenizer</a></dd> + + </div> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Databricks.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Databricks.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Databricks.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Databricks.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Databricks.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Databricks.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Databricks.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Databricks.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Databricks.Parser"> + <input id="Databricks.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Databricks.Parser</span><wbr>(<span class="base"><a href="spark.html#Spark.Parser">sqlglot.dialects.spark.Spark.Parser</a></span>): + + <label class="view-source-button" for="Databricks.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Databricks.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Databricks.Parser-11"><a href="#Databricks.Parser-11"><span class="linenos">11</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Databricks.Parser-12"><a href="#Databricks.Parser-12"><span class="linenos">12</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Databricks.Parser-13"><a href="#Databricks.Parser-13"><span class="linenos">13</span></a> <span class="o">**</span><span class="n">Spark</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Databricks.Parser-14"><a href="#Databricks.Parser-14"><span class="linenos">14</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="Databricks.Parser-15"><a href="#Databricks.Parser-15"><span class="linenos">15</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="Databricks.Parser-16"><a href="#Databricks.Parser-16"><span class="linenos">16</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">),</span> +</span><span id="Databricks.Parser-17"><a href="#Databricks.Parser-17"><span class="linenos">17</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Databricks.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Databricks.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Databricks.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Databricks.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Databricks.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Databricks.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Databricks.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Databricks.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Databricks.Generator"> + <input id="Databricks.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Databricks.Generator</span><wbr>(<span class="base"><a href="spark.html#Spark.Generator">sqlglot.dialects.spark.Spark.Generator</a></span>): + + <label class="view-source-button" for="Databricks.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Databricks.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Databricks.Generator-19"><a href="#Databricks.Generator-19"><span class="linenos">19</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Databricks.Generator-20"><a href="#Databricks.Generator-20"><span class="linenos">20</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Databricks.Generator-21"><a href="#Databricks.Generator-21"><span class="linenos">21</span></a> <span class="o">**</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Databricks.Generator-22"><a href="#Databricks.Generator-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="Databricks.Generator-23"><a href="#Databricks.Generator-23"><span class="linenos">23</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="Databricks.Generator-24"><a href="#Databricks.Generator-24"><span class="linenos">24</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Databricks.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Databricks.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Databricks.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Databricks.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Databricks.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Databricks.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Databricks.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Databricks.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Databricks.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Databricks.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Databricks.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Databricks.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Databricks.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Databricks.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Databricks.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Databricks.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Databricks.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Databricks.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Databricks.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Databricks.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Databricks.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Databricks.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Databricks.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Databricks.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Databricks.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Databricks.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Databricks.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Databricks.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Databricks.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Databricks.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Databricks.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Databricks.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Databricks.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Databricks.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Databricks.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Databricks.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Databricks.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Databricks.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Databricks.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Databricks.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Databricks.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Databricks.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Databricks.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Databricks.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Databricks.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Databricks.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Databricks.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Databricks.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Databricks.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Databricks.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Databricks.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Databricks.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Databricks.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Databricks.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Databricks.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Databricks.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Databricks.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Databricks.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Databricks.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Databricks.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Databricks.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Databricks.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Databricks.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Databricks.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Databricks.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Databricks.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Databricks.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Databricks.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Databricks.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Databricks.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Databricks.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Databricks.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Databricks.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Databricks.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Databricks.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Databricks.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Databricks.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Databricks.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Databricks.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Databricks.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Databricks.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Databricks.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Databricks.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Databricks.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Databricks.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Databricks.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Databricks.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Databricks.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Databricks.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Databricks.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Databricks.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Databricks.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Databricks.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Databricks.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Databricks.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Databricks.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Databricks.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Databricks.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Databricks.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Databricks.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Databricks.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Databricks.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Databricks.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Databricks.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Databricks.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Databricks.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Databricks.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Databricks.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Databricks.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Databricks.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Databricks.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Databricks.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Databricks.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Databricks.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Databricks.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Databricks.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Databricks.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Databricks.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Databricks.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Databricks.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Databricks.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Databricks.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Databricks.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Databricks.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Databricks.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Databricks.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Databricks.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Databricks.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Databricks.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Databricks.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Databricks.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Databricks.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Databricks.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Databricks.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Databricks.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Databricks.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Databricks.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Databricks.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Databricks.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Databricks.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Databricks.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Databricks.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Databricks.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Databricks.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Databricks.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Databricks.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Databricks.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Databricks.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Databricks.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Databricks.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Databricks.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Databricks.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Databricks.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Databricks.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Databricks.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Databricks.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Databricks.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Databricks.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Databricks.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Databricks.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Databricks.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Databricks.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Databricks.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Databricks.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Databricks.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Databricks.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Databricks.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Databricks.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Databricks.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Databricks.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Databricks.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Databricks.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Databricks.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Databricks.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Databricks.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Databricks.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Databricks.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Databricks.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Databricks.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Databricks.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Databricks.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Databricks.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Databricks.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Databricks.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Databricks.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Databricks.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Databricks.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Databricks.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Databricks.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Databricks.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Databricks.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Databricks.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Databricks.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Databricks.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Databricks.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Databricks.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Databricks.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Databricks.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + <div><dt><a href="spark.html#Spark.Generator">sqlglot.dialects.spark.Spark.Generator</a></dt> + <dd id="Databricks.Generator.cast_sql" class="function"><a href="spark.html#Spark.Generator.cast_sql">cast_sql</a></dd> + + </div> + <div><dt><a href="hive.html#Hive.Generator">sqlglot.dialects.hive.Hive.Generator</a></dt> + <dd id="Databricks.Generator.with_properties" class="function"><a href="hive.html#Hive.Generator.with_properties">with_properties</a></dd> + <dd id="Databricks.Generator.datatype_sql" class="function"><a href="hive.html#Hive.Generator.datatype_sql">datatype_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/dialect.html b/docs/sqlglot/dialects/dialect.html new file mode 100644 index 0000000..8cf5456 --- /dev/null +++ b/docs/sqlglot/dialects/dialect.html @@ -0,0 +1,2134 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.dialect API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Dialects">Dialects</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Dialects.DIALECT">DIALECT</a> + </li> + <li> + <a class="variable" href="#Dialects.BIGQUERY">BIGQUERY</a> + </li> + <li> + <a class="variable" href="#Dialects.CLICKHOUSE">CLICKHOUSE</a> + </li> + <li> + <a class="variable" href="#Dialects.DUCKDB">DUCKDB</a> + </li> + <li> + <a class="variable" href="#Dialects.HIVE">HIVE</a> + </li> + <li> + <a class="variable" href="#Dialects.MYSQL">MYSQL</a> + </li> + <li> + <a class="variable" href="#Dialects.ORACLE">ORACLE</a> + </li> + <li> + <a class="variable" href="#Dialects.POSTGRES">POSTGRES</a> + </li> + <li> + <a class="variable" href="#Dialects.PRESTO">PRESTO</a> + </li> + <li> + <a class="variable" href="#Dialects.REDSHIFT">REDSHIFT</a> + </li> + <li> + <a class="variable" href="#Dialects.SNOWFLAKE">SNOWFLAKE</a> + </li> + <li> + <a class="variable" href="#Dialects.SPARK">SPARK</a> + </li> + <li> + <a class="variable" href="#Dialects.SQLITE">SQLITE</a> + </li> + <li> + <a class="variable" href="#Dialects.STARROCKS">STARROCKS</a> + </li> + <li> + <a class="variable" href="#Dialects.TABLEAU">TABLEAU</a> + </li> + <li> + <a class="variable" href="#Dialects.TRINO">TRINO</a> + </li> + <li> + <a class="variable" href="#Dialects.TSQL">TSQL</a> + </li> + <li> + <a class="variable" href="#Dialects.DATABRICKS">DATABRICKS</a> + </li> + <li> + <a class="variable" href="#Dialects.DRILL">DRILL</a> + </li> + <li> + <a class="variable" href="#Dialects.TERADATA">TERADATA</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Dialect">Dialect</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Dialect.__init__">Dialect</a> + </li> + <li> + <a class="function" href="#Dialect.get_or_raise">get_or_raise</a> + </li> + <li> + <a class="function" href="#Dialect.format_time">format_time</a> + </li> + <li> + <a class="function" href="#Dialect.parse">parse</a> + </li> + <li> + <a class="function" href="#Dialect.parse_into">parse_into</a> + </li> + <li> + <a class="function" href="#Dialect.generate">generate</a> + </li> + <li> + <a class="function" href="#Dialect.transpile">transpile</a> + </li> + <li> + <a class="function" href="#Dialect.parser">parser</a> + </li> + <li> + <a class="function" href="#Dialect.generator">generator</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#rename_func">rename_func</a> + </li> + <li> + <a class="function" href="#approx_count_distinct_sql">approx_count_distinct_sql</a> + </li> + <li> + <a class="function" href="#if_sql">if_sql</a> + </li> + <li> + <a class="function" href="#arrow_json_extract_sql">arrow_json_extract_sql</a> + </li> + <li> + <a class="function" href="#arrow_json_extract_scalar_sql">arrow_json_extract_scalar_sql</a> + </li> + <li> + <a class="function" href="#inline_array_sql">inline_array_sql</a> + </li> + <li> + <a class="function" href="#no_ilike_sql">no_ilike_sql</a> + </li> + <li> + <a class="function" href="#no_paren_current_date_sql">no_paren_current_date_sql</a> + </li> + <li> + <a class="function" href="#no_recursive_cte_sql">no_recursive_cte_sql</a> + </li> + <li> + <a class="function" href="#no_safe_divide_sql">no_safe_divide_sql</a> + </li> + <li> + <a class="function" href="#no_tablesample_sql">no_tablesample_sql</a> + </li> + <li> + <a class="function" href="#no_pivot_sql">no_pivot_sql</a> + </li> + <li> + <a class="function" href="#no_trycast_sql">no_trycast_sql</a> + </li> + <li> + <a class="function" href="#no_properties_sql">no_properties_sql</a> + </li> + <li> + <a class="function" href="#str_position_sql">str_position_sql</a> + </li> + <li> + <a class="function" href="#struct_extract_sql">struct_extract_sql</a> + </li> + <li> + <a class="function" href="#var_map_sql">var_map_sql</a> + </li> + <li> + <a class="function" href="#format_time_lambda">format_time_lambda</a> + </li> + <li> + <a class="function" href="#create_with_partitions_sql">create_with_partitions_sql</a> + </li> + <li> + <a class="function" href="#parse_date_delta">parse_date_delta</a> + </li> + <li> + <a class="function" href="#locate_to_strposition">locate_to_strposition</a> + </li> + <li> + <a class="function" href="#strposition_to_locate_sql">strposition_to_locate_sql</a> + </li> + <li> + <a class="function" href="#timestrtotime_sql">timestrtotime_sql</a> + </li> + <li> + <a class="function" href="#datestrtodate_sql">datestrtodate_sql</a> + </li> + <li> + <a class="function" href="#trim_sql">trim_sql</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/dialect.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.dialect </h1> + + + <input id="mod-dialect-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-dialect-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.generator</span> <span class="kn">import</span> <span class="n">Generator</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">flatten</span><span class="p">,</span> <span class="n">seq_get</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.parser</span> <span class="kn">import</span> <span class="n">Parser</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.time</span> <span class="kn">import</span> <span class="n">format_time</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">Tokenizer</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="kn">from</span> <span class="nn">sqlglot.trie</span> <span class="kn">import</span> <span class="n">new_trie</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="n">E</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"E"</span><span class="p">,</span> <span class="n">bound</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="k">class</span> <span class="nc">Dialects</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">Enum</span><span class="p">):</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">DIALECT</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="n">BIGQUERY</span> <span class="o">=</span> <span class="s2">"bigquery"</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="n">CLICKHOUSE</span> <span class="o">=</span> <span class="s2">"clickhouse"</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">DUCKDB</span> <span class="o">=</span> <span class="s2">"duckdb"</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">HIVE</span> <span class="o">=</span> <span class="s2">"hive"</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="n">MYSQL</span> <span class="o">=</span> <span class="s2">"mysql"</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">ORACLE</span> <span class="o">=</span> <span class="s2">"oracle"</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">POSTGRES</span> <span class="o">=</span> <span class="s2">"postgres"</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">PRESTO</span> <span class="o">=</span> <span class="s2">"presto"</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">REDSHIFT</span> <span class="o">=</span> <span class="s2">"redshift"</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">SNOWFLAKE</span> <span class="o">=</span> <span class="s2">"snowflake"</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">SPARK</span> <span class="o">=</span> <span class="s2">"spark"</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">SQLITE</span> <span class="o">=</span> <span class="s2">"sqlite"</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">STARROCKS</span> <span class="o">=</span> <span class="s2">"starrocks"</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">TABLEAU</span> <span class="o">=</span> <span class="s2">"tableau"</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">TRINO</span> <span class="o">=</span> <span class="s2">"trino"</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">TSQL</span> <span class="o">=</span> <span class="s2">"tsql"</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">DATABRICKS</span> <span class="o">=</span> <span class="s2">"databricks"</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">DRILL</span> <span class="o">=</span> <span class="s2">"drill"</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">TERADATA</span> <span class="o">=</span> <span class="s2">"teradata"</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="k">class</span> <span class="nc">_Dialect</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">classes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="nd">@classmethod</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]:</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">classes</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="nd">@classmethod</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">def</span> <span class="nf">get</span><span class="p">(</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">default</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]]:</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">classes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">default</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">):</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">)</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">enum</span> <span class="o">=</span> <span class="n">Dialects</span><span class="o">.</span><span class="n">__members__</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">clsname</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">classes</span><span class="p">[</span><span class="n">enum</span><span class="o">.</span><span class="n">value</span> <span class="k">if</span> <span class="n">enum</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">clsname</span><span class="o">.</span><span class="n">lower</span><span class="p">()]</span> <span class="o">=</span> <span class="n">klass</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">time_trie</span> <span class="o">=</span> <span class="n">new_trie</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">inverse_time_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">v</span><span class="p">:</span> <span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">time_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">inverse_time_trie</span> <span class="o">=</span> <span class="n">new_trie</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">inverse_time_mapping</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="s2">"Tokenizer"</span><span class="p">,</span> <span class="n">Tokenizer</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">parser_class</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="s2">"Parser"</span><span class="p">,</span> <span class="n">Parser</span><span class="p">)</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="s2">"Generator"</span><span class="p">,</span> <span class="n">Generator</span><span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">quote_start</span><span class="p">,</span> <span class="n">klass</span><span class="o">.</span><span class="n">quote_end</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_QUOTES</span><span class="o">.</span><span class="n">items</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">identifier_start</span><span class="p">,</span> <span class="n">klass</span><span class="o">.</span><span class="n">identifier_end</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_IDENTIFIERS</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="p">)[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_BIT_STRINGS</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="ow">and</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitString</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span><span class="o">.</span><span class="n">TRANSFORMS</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="p">):</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">bs_start</span><span class="p">,</span> <span class="n">bs_end</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_BIT_STRINGS</span><span class="o">.</span><span class="n">items</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">[</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitString</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="p">]</span> <span class="o">=</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">bs_start</span><span class="si">}{</span><span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">))</span><span class="si">:</span><span class="s2">b</span><span class="si">}{</span><span class="n">bs_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_HEX_STRINGS</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="ow">and</span> <span class="n">exp</span><span class="o">.</span><span class="n">HexString</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span><span class="o">.</span><span class="n">TRANSFORMS</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="p">):</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">hs_start</span><span class="p">,</span> <span class="n">hs_end</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_HEX_STRINGS</span><span class="o">.</span><span class="n">items</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">[</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">HexString</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="p">]</span> <span class="o">=</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">hs_start</span><span class="si">}{</span><span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">))</span><span class="si">:</span><span class="s2">X</span><span class="si">}{</span><span class="n">hs_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="ow">and</span> <span class="n">exp</span><span class="o">.</span><span class="n">ByteString</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span><span class="o">.</span><span class="n">TRANSFORMS</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="p">):</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">be_start</span><span class="p">,</span> <span class="n">be_end</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span><span class="o">.</span><span class="n">items</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">generator_class</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">[</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ByteString</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="p">]</span> <span class="o">=</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">be_start</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">be_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">return</span> <span class="n">klass</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a><span class="k">class</span> <span class="nc">Dialect</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Dialect</span><span class="p">):</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">index_offset</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">unnest_column_only</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="n">normalize_functions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"upper"</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_small"</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"'%Y-%m-</span><span class="si">%d</span><span class="s2">'"</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">dateint_format</span> <span class="o">=</span> <span class="s2">"'%Y%m</span><span class="si">%d</span><span class="s2">'"</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S'"</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">time_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="c1"># autofilled</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">quote_start</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">quote_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">identifier_start</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">identifier_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">time_trie</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">inverse_time_mapping</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">inverse_time_trie</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">tokenizer_class</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">parser_class</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">generator_class</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="nd">@classmethod</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">def</span> <span class="nf">get_or_raise</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]:</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">dialect</span><span class="p">:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">return</span> <span class="bp">cls</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dialect</span><span class="p">,</span> <span class="n">_Dialect</span><span class="p">):</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="n">dialect</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dialect</span><span class="p">,</span> <span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">return</span> <span class="n">dialect</span><span class="o">.</span><span class="vm">__class__</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">result</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">result</span><span class="p">:</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown dialect '</span><span class="si">{</span><span class="n">dialect</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">result</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="nd">@classmethod</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">expression</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="c1"># the time formats are quoted</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_trie</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="p">)</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="p">)</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_trie</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="p">)</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="p">)</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokenizer</span><span class="o">.</span><span class="n">tokenize</span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">parse_into</span><span class="p">(</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression_type</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">parse_into</span><span class="p">(</span><span class="n">expression_type</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer</span><span class="o">.</span><span class="n">tokenize</span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">def</span> <span class="nf">transpile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">)]</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="nd">@property</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">def</span> <span class="nf">tokenizer</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Tokenizer</span><span class="p">:</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">"_tokenizer"</span><span class="p">):</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokenizer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tokenizer</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">def</span> <span class="nf">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Parser</span><span class="p">:</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser_class</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="s2">"index_offset"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="s2">"unnest_column_only"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="s2">"null_ordering"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span><span class="p">,</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="p">},</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="p">)</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="k">def</span> <span class="nf">generator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Generator</span><span class="p">:</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator_class</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="s2">"quote_start"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="s2">"quote_end"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="p">,</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="s2">"identifier_start"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span><span class="p">,</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="s2">"identifier_end"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="s2">"string_escape"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">STRING_ESCAPES</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="s2">"identifier_escape"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">IDENTIFIER_ESCAPES</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="s2">"index_offset"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">,</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="s2">"time_mapping"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_time_mapping</span><span class="p">,</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="s2">"time_trie"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_time_trie</span><span class="p">,</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="s2">"unnest_column_only"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">,</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"normalize_functions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="s2">"null_ordering"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span><span class="p">,</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="p">}</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="p">)</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a><span class="n">DialectType</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">],</span> <span class="kc">None</span><span class="p">]</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a><span class="k">def</span> <span class="nf">rename_func</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="k">def</span> <span class="nf">_rename</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="k">return</span> <span class="n">_rename</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a><span class="k">def</span> <span class="nf">approx_count_distinct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"accuracy"</span><span class="p">):</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"APPROX_COUNT_DISTINCT does not support accuracy"</span><span class="p">)</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"APPROX_COUNT_DISTINCT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a><span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"true"</span><span class="p">),</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">)</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="p">)</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a><span class="k">def</span> <span class="nf">arrow_json_extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"->"</span><span class="p">)</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a><span class="k">def</span> <span class="nf">arrow_json_extract_scalar_sql</span><span class="p">(</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"->>"</span><span class="p">)</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a><span class="k">def</span> <span class="nf">inline_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a><span class="k">def</span> <span class="nf">no_ilike_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">like_sql</span><span class="p">(</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">(</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Lower</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expression"</span><span class="p">],</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="p">)</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="p">)</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a><span class="k">def</span> <span class="nf">no_paren_current_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CURRENT_DATE AT TIME ZONE </span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">zone</span> <span class="k">else</span> <span class="s2">"CURRENT_DATE"</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a><span class="k">def</span> <span class="nf">no_recursive_cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">):</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Recursive CTEs are unsupported"</span><span class="p">)</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"recursive"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">with_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a><span class="k">def</span> <span class="nf">no_safe_divide_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">n</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">d</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF(</span><span class="si">{</span><span class="n">d</span><span class="si">}</span><span class="s2"> <> 0, </span><span class="si">{</span><span class="n">n</span><span class="si">}</span><span class="s2"> / </span><span class="si">{</span><span class="n">d</span><span class="si">}</span><span class="s2">, NULL)"</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a><span class="k">def</span> <span class="nf">no_tablesample_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"TABLESAMPLE unsupported"</span><span class="p">)</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a><span class="k">def</span> <span class="nf">no_pivot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"PIVOT unsupported"</span><span class="p">)</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a><span class="k">def</span> <span class="nf">no_trycast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a><span class="k">def</span> <span class="nf">no_properties_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Properties unsupported"</span><span class="p">)</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a><span class="k">def</span> <span class="nf">str_position_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">substr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"substr"</span><span class="p">)</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="k">if</span> <span class="n">position</span><span class="p">:</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRPOS(SUBSTR(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">position</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="n">substr</span><span class="si">}</span><span class="s2">) + </span><span class="si">{</span><span class="n">position</span><span class="si">}</span><span class="s2"> - 1"</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRPOS(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">substr</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a><span class="k">def</span> <span class="nf">struct_extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="n">struct_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">struct_key</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a><span class="k">def</span> <span class="nf">var_map_sql</span><span class="p">(</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">,</span> <span class="n">map_func_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"MAP"</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"keys"</span><span class="p">]</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="n">values</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"values"</span><span class="p">]</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">):</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Cannot convert array columns into map."</span><span class="p">)</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">map_func_name</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span><span class="w"> </span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">keys</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">values</span><span class="o">.</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">key</span><span class="p">))</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">value</span><span class="p">))</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">map_func_name</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a><span class="k">def</span> <span class="nf">format_time_lambda</span><span class="p">(</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">E</span><span class="p">],</span> <span class="n">dialect</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">default</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span> <span class="o">|</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">],</span> <span class="n">E</span><span class="p">]:</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a><span class="w"> </span><span class="sd">"""Helper used for time expressions.</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a><span class="sd"> Args:</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a><span class="sd"> exp_class: the expression class to instantiate.</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a><span class="sd"> dialect: target sql dialect.</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a><span class="sd"> default: the default format, True being time.</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a><span class="sd"> Returns:</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a><span class="sd"> A callable that can be used to return the appropriately formatted time expression.</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a><span class="sd"> """</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="k">def</span> <span class="nf">_format_time</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">):</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="k">return</span> <span class="n">exp_class</span><span class="p">(</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="nb">format</span><span class="o">=</span><span class="n">Dialect</span><span class="p">[</span><span class="n">dialect</span><span class="p">]</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">Dialect</span><span class="p">[</span><span class="n">dialect</span><span class="p">]</span><span class="o">.</span><span class="n">time_format</span> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="kc">True</span> <span class="k">else</span> <span class="n">default</span> <span class="ow">or</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="p">),</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="p">)</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="k">return</span> <span class="n">_format_time</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a><span class="k">def</span> <span class="nf">create_with_partitions_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a><span class="sd"> In Hive and Spark, the PARTITIONED BY property acts as an extension of a table's schema. When the</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a><span class="sd"> PARTITIONED BY value is an array of column names, they are transformed into a schema. The corresponding</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a><span class="sd"> columns are removed from the create statement.</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a><span class="sd"> """</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="n">has_schema</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">)</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="n">is_partitionable</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"TABLE"</span><span class="p">,</span> <span class="s2">"VIEW"</span><span class="p">)</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">if</span> <span class="n">has_schema</span> <span class="ow">and</span> <span class="n">is_partitionable</span><span class="p">:</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="n">prop</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">)</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">prop</span> <span class="ow">and</span> <span class="n">prop</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">if</span> <span class="n">prop</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">{</span><span class="n">v</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">}</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="n">partitions</span> <span class="o">=</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">col</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">]</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">e</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">partitions</span><span class="p">])</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="n">prop</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">partitions</span><span class="p">)))</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a><span class="k">def</span> <span class="nf">parse_date_delta</span><span class="p">(</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">E</span><span class="p">],</span> <span class="n">unit_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">],</span> <span class="n">E</span><span class="p">]:</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="k">def</span> <span class="nf">inner_func</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">)</span> <span class="o">-></span> <span class="n">E</span><span class="p">:</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="n">unit_based</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_based</span> <span class="k">else</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_based</span> <span class="k">else</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_based</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">)</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">unit_mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="n">unit</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_mapping</span> <span class="k">else</span> <span class="n">unit</span> <span class="c1"># type: ignore</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="n">exp_class</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">)</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="k">return</span> <span class="n">inner_func</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a><span class="k">def</span> <span class="nf">locate_to_strposition</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="p">)</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a><span class="k">def</span> <span class="nf">strposition_to_locate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"substr"</span><span class="p">),</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"position"</span><span class="p">)</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="p">)</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LOCATE(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a><span class="k">def</span> <span class="nf">timestrtotime_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a><span class="k">def</span> <span class="nf">datestrtodate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a><span class="k">def</span> <span class="nf">trim_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="n">remove_chars</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collation"</span><span class="p">)</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="c1"># Use TRIM/LTRIM/RTRIM syntax if the expression isn't database-specific</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">remove_chars</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">collation</span><span class="p">:</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">trim_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">trim_type</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">trim_type</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="n">remove_chars</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">remove_chars</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">remove_chars</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">from_part</span> <span class="o">=</span> <span class="s2">"FROM "</span> <span class="k">if</span> <span class="n">trim_type</span> <span class="ow">or</span> <span class="n">remove_chars</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collation</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collation</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="n">trim_type</span><span class="si">}{</span><span class="n">remove_chars</span><span class="si">}{</span><span class="n">from_part</span><span class="si">}{</span><span class="n">target</span><span class="si">}{</span><span class="n">collation</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + </section> + <section id="Dialects"> + <input id="Dialects-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Dialects</span><wbr>(<span class="base">builtins.str</span>, <span class="base">enum.Enum</span>): + + <label class="view-source-button" for="Dialects-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialects"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialects-18"><a href="#Dialects-18"><span class="linenos">18</span></a><span class="k">class</span> <span class="nc">Dialects</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="n">Enum</span><span class="p">):</span> +</span><span id="Dialects-19"><a href="#Dialects-19"><span class="linenos">19</span></a> <span class="n">DIALECT</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Dialects-20"><a href="#Dialects-20"><span class="linenos">20</span></a> +</span><span id="Dialects-21"><a href="#Dialects-21"><span class="linenos">21</span></a> <span class="n">BIGQUERY</span> <span class="o">=</span> <span class="s2">"bigquery"</span> +</span><span id="Dialects-22"><a href="#Dialects-22"><span class="linenos">22</span></a> <span class="n">CLICKHOUSE</span> <span class="o">=</span> <span class="s2">"clickhouse"</span> +</span><span id="Dialects-23"><a href="#Dialects-23"><span class="linenos">23</span></a> <span class="n">DUCKDB</span> <span class="o">=</span> <span class="s2">"duckdb"</span> +</span><span id="Dialects-24"><a href="#Dialects-24"><span class="linenos">24</span></a> <span class="n">HIVE</span> <span class="o">=</span> <span class="s2">"hive"</span> +</span><span id="Dialects-25"><a href="#Dialects-25"><span class="linenos">25</span></a> <span class="n">MYSQL</span> <span class="o">=</span> <span class="s2">"mysql"</span> +</span><span id="Dialects-26"><a href="#Dialects-26"><span class="linenos">26</span></a> <span class="n">ORACLE</span> <span class="o">=</span> <span class="s2">"oracle"</span> +</span><span id="Dialects-27"><a href="#Dialects-27"><span class="linenos">27</span></a> <span class="n">POSTGRES</span> <span class="o">=</span> <span class="s2">"postgres"</span> +</span><span id="Dialects-28"><a href="#Dialects-28"><span class="linenos">28</span></a> <span class="n">PRESTO</span> <span class="o">=</span> <span class="s2">"presto"</span> +</span><span id="Dialects-29"><a href="#Dialects-29"><span class="linenos">29</span></a> <span class="n">REDSHIFT</span> <span class="o">=</span> <span class="s2">"redshift"</span> +</span><span id="Dialects-30"><a href="#Dialects-30"><span class="linenos">30</span></a> <span class="n">SNOWFLAKE</span> <span class="o">=</span> <span class="s2">"snowflake"</span> +</span><span id="Dialects-31"><a href="#Dialects-31"><span class="linenos">31</span></a> <span class="n">SPARK</span> <span class="o">=</span> <span class="s2">"spark"</span> +</span><span id="Dialects-32"><a href="#Dialects-32"><span class="linenos">32</span></a> <span class="n">SQLITE</span> <span class="o">=</span> <span class="s2">"sqlite"</span> +</span><span id="Dialects-33"><a href="#Dialects-33"><span class="linenos">33</span></a> <span class="n">STARROCKS</span> <span class="o">=</span> <span class="s2">"starrocks"</span> +</span><span id="Dialects-34"><a href="#Dialects-34"><span class="linenos">34</span></a> <span class="n">TABLEAU</span> <span class="o">=</span> <span class="s2">"tableau"</span> +</span><span id="Dialects-35"><a href="#Dialects-35"><span class="linenos">35</span></a> <span class="n">TRINO</span> <span class="o">=</span> <span class="s2">"trino"</span> +</span><span id="Dialects-36"><a href="#Dialects-36"><span class="linenos">36</span></a> <span class="n">TSQL</span> <span class="o">=</span> <span class="s2">"tsql"</span> +</span><span id="Dialects-37"><a href="#Dialects-37"><span class="linenos">37</span></a> <span class="n">DATABRICKS</span> <span class="o">=</span> <span class="s2">"databricks"</span> +</span><span id="Dialects-38"><a href="#Dialects-38"><span class="linenos">38</span></a> <span class="n">DRILL</span> <span class="o">=</span> <span class="s2">"drill"</span> +</span><span id="Dialects-39"><a href="#Dialects-39"><span class="linenos">39</span></a> <span class="n">TERADATA</span> <span class="o">=</span> <span class="s2">"teradata"</span> +</span></pre></div> + + + <div class="docstring"><p>An enumeration.</p> +</div> + + + <div id="Dialects.DIALECT" class="classattr"> + <div class="attr variable"> + <span class="name">DIALECT</span><span class="default_value"> = <<a href="#Dialects.DIALECT">Dialects.DIALECT</a>: ''></span> + + + </div> + <a class="headerlink" href="#Dialects.DIALECT"></a> + + + + </div> + <div id="Dialects.BIGQUERY" class="classattr"> + <div class="attr variable"> + <span class="name">BIGQUERY</span><span class="default_value"> = <<a href="#Dialects.BIGQUERY">Dialects.BIGQUERY</a>: 'bigquery'></span> + + + </div> + <a class="headerlink" href="#Dialects.BIGQUERY"></a> + + + + </div> + <div id="Dialects.CLICKHOUSE" class="classattr"> + <div class="attr variable"> + <span class="name">CLICKHOUSE</span><span class="default_value"> = <<a href="#Dialects.CLICKHOUSE">Dialects.CLICKHOUSE</a>: 'clickhouse'></span> + + + </div> + <a class="headerlink" href="#Dialects.CLICKHOUSE"></a> + + + + </div> + <div id="Dialects.DUCKDB" class="classattr"> + <div class="attr variable"> + <span class="name">DUCKDB</span><span class="default_value"> = <<a href="#Dialects.DUCKDB">Dialects.DUCKDB</a>: 'duckdb'></span> + + + </div> + <a class="headerlink" href="#Dialects.DUCKDB"></a> + + + + </div> + <div id="Dialects.HIVE" class="classattr"> + <div class="attr variable"> + <span class="name">HIVE</span><span class="default_value"> = <<a href="#Dialects.HIVE">Dialects.HIVE</a>: 'hive'></span> + + + </div> + <a class="headerlink" href="#Dialects.HIVE"></a> + + + + </div> + <div id="Dialects.MYSQL" class="classattr"> + <div class="attr variable"> + <span class="name">MYSQL</span><span class="default_value"> = <<a href="#Dialects.MYSQL">Dialects.MYSQL</a>: 'mysql'></span> + + + </div> + <a class="headerlink" href="#Dialects.MYSQL"></a> + + + + </div> + <div id="Dialects.ORACLE" class="classattr"> + <div class="attr variable"> + <span class="name">ORACLE</span><span class="default_value"> = <<a href="#Dialects.ORACLE">Dialects.ORACLE</a>: 'oracle'></span> + + + </div> + <a class="headerlink" href="#Dialects.ORACLE"></a> + + + + </div> + <div id="Dialects.POSTGRES" class="classattr"> + <div class="attr variable"> + <span class="name">POSTGRES</span><span class="default_value"> = <<a href="#Dialects.POSTGRES">Dialects.POSTGRES</a>: 'postgres'></span> + + + </div> + <a class="headerlink" href="#Dialects.POSTGRES"></a> + + + + </div> + <div id="Dialects.PRESTO" class="classattr"> + <div class="attr variable"> + <span class="name">PRESTO</span><span class="default_value"> = <<a href="#Dialects.PRESTO">Dialects.PRESTO</a>: 'presto'></span> + + + </div> + <a class="headerlink" href="#Dialects.PRESTO"></a> + + + + </div> + <div id="Dialects.REDSHIFT" class="classattr"> + <div class="attr variable"> + <span class="name">REDSHIFT</span><span class="default_value"> = <<a href="#Dialects.REDSHIFT">Dialects.REDSHIFT</a>: 'redshift'></span> + + + </div> + <a class="headerlink" href="#Dialects.REDSHIFT"></a> + + + + </div> + <div id="Dialects.SNOWFLAKE" class="classattr"> + <div class="attr variable"> + <span class="name">SNOWFLAKE</span><span class="default_value"> = <<a href="#Dialects.SNOWFLAKE">Dialects.SNOWFLAKE</a>: 'snowflake'></span> + + + </div> + <a class="headerlink" href="#Dialects.SNOWFLAKE"></a> + + + + </div> + <div id="Dialects.SPARK" class="classattr"> + <div class="attr variable"> + <span class="name">SPARK</span><span class="default_value"> = <<a href="#Dialects.SPARK">Dialects.SPARK</a>: 'spark'></span> + + + </div> + <a class="headerlink" href="#Dialects.SPARK"></a> + + + + </div> + <div id="Dialects.SQLITE" class="classattr"> + <div class="attr variable"> + <span class="name">SQLITE</span><span class="default_value"> = <<a href="#Dialects.SQLITE">Dialects.SQLITE</a>: 'sqlite'></span> + + + </div> + <a class="headerlink" href="#Dialects.SQLITE"></a> + + + + </div> + <div id="Dialects.STARROCKS" class="classattr"> + <div class="attr variable"> + <span class="name">STARROCKS</span><span class="default_value"> = <<a href="#Dialects.STARROCKS">Dialects.STARROCKS</a>: 'starrocks'></span> + + + </div> + <a class="headerlink" href="#Dialects.STARROCKS"></a> + + + + </div> + <div id="Dialects.TABLEAU" class="classattr"> + <div class="attr variable"> + <span class="name">TABLEAU</span><span class="default_value"> = <<a href="#Dialects.TABLEAU">Dialects.TABLEAU</a>: 'tableau'></span> + + + </div> + <a class="headerlink" href="#Dialects.TABLEAU"></a> + + + + </div> + <div id="Dialects.TRINO" class="classattr"> + <div class="attr variable"> + <span class="name">TRINO</span><span class="default_value"> = <<a href="#Dialects.TRINO">Dialects.TRINO</a>: 'trino'></span> + + + </div> + <a class="headerlink" href="#Dialects.TRINO"></a> + + + + </div> + <div id="Dialects.TSQL" class="classattr"> + <div class="attr variable"> + <span class="name">TSQL</span><span class="default_value"> = <<a href="#Dialects.TSQL">Dialects.TSQL</a>: 'tsql'></span> + + + </div> + <a class="headerlink" href="#Dialects.TSQL"></a> + + + + </div> + <div id="Dialects.DATABRICKS" class="classattr"> + <div class="attr variable"> + <span class="name">DATABRICKS</span><span class="default_value"> = <<a href="#Dialects.DATABRICKS">Dialects.DATABRICKS</a>: 'databricks'></span> + + + </div> + <a class="headerlink" href="#Dialects.DATABRICKS"></a> + + + + </div> + <div id="Dialects.DRILL" class="classattr"> + <div class="attr variable"> + <span class="name">DRILL</span><span class="default_value"> = <<a href="#Dialects.DRILL">Dialects.DRILL</a>: 'drill'></span> + + + </div> + <a class="headerlink" href="#Dialects.DRILL"></a> + + + + </div> + <div id="Dialects.TERADATA" class="classattr"> + <div class="attr variable"> + <span class="name">TERADATA</span><span class="default_value"> = <<a href="#Dialects.TERADATA">Dialects.TERADATA</a>: 'teradata'></span> + + + </div> + <a class="headerlink" href="#Dialects.TERADATA"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="Dialects.name" class="variable">name</dd> + <dd id="Dialects.value" class="variable">value</dd> + + </div> + <div><dt>builtins.str</dt> + <dd id="Dialects.encode" class="function">encode</dd> + <dd id="Dialects.replace" class="function">replace</dd> + <dd id="Dialects.split" class="function">split</dd> + <dd id="Dialects.rsplit" class="function">rsplit</dd> + <dd id="Dialects.join" class="function">join</dd> + <dd id="Dialects.capitalize" class="function">capitalize</dd> + <dd id="Dialects.casefold" class="function">casefold</dd> + <dd id="Dialects.title" class="function">title</dd> + <dd id="Dialects.center" class="function">center</dd> + <dd id="Dialects.count" class="function">count</dd> + <dd id="Dialects.expandtabs" class="function">expandtabs</dd> + <dd id="Dialects.find" class="function">find</dd> + <dd id="Dialects.partition" class="function">partition</dd> + <dd id="Dialects.index" class="function">index</dd> + <dd id="Dialects.ljust" class="function">ljust</dd> + <dd id="Dialects.lower" class="function">lower</dd> + <dd id="Dialects.lstrip" class="function">lstrip</dd> + <dd id="Dialects.rfind" class="function">rfind</dd> + <dd id="Dialects.rindex" class="function">rindex</dd> + <dd id="Dialects.rjust" class="function">rjust</dd> + <dd id="Dialects.rstrip" class="function">rstrip</dd> + <dd id="Dialects.rpartition" class="function">rpartition</dd> + <dd id="Dialects.splitlines" class="function">splitlines</dd> + <dd id="Dialects.strip" class="function">strip</dd> + <dd id="Dialects.swapcase" class="function">swapcase</dd> + <dd id="Dialects.translate" class="function">translate</dd> + <dd id="Dialects.upper" class="function">upper</dd> + <dd id="Dialects.startswith" class="function">startswith</dd> + <dd id="Dialects.endswith" class="function">endswith</dd> + <dd id="Dialects.removeprefix" class="function">removeprefix</dd> + <dd id="Dialects.removesuffix" class="function">removesuffix</dd> + <dd id="Dialects.isascii" class="function">isascii</dd> + <dd id="Dialects.islower" class="function">islower</dd> + <dd id="Dialects.isupper" class="function">isupper</dd> + <dd id="Dialects.istitle" class="function">istitle</dd> + <dd id="Dialects.isspace" class="function">isspace</dd> + <dd id="Dialects.isdecimal" class="function">isdecimal</dd> + <dd id="Dialects.isdigit" class="function">isdigit</dd> + <dd id="Dialects.isnumeric" class="function">isnumeric</dd> + <dd id="Dialects.isalpha" class="function">isalpha</dd> + <dd id="Dialects.isalnum" class="function">isalnum</dd> + <dd id="Dialects.isidentifier" class="function">isidentifier</dd> + <dd id="Dialects.isprintable" class="function">isprintable</dd> + <dd id="Dialects.zfill" class="function">zfill</dd> + <dd id="Dialects.format" class="function">format</dd> + <dd id="Dialects.format_map" class="function">format_map</dd> + <dd id="Dialects.maketrans" class="function">maketrans</dd> + + </div> + </dl> + </div> + </section> + <section id="Dialect"> + <input id="Dialect-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Dialect</span>: + + <label class="view-source-button" for="Dialect-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect-101"><a href="#Dialect-101"><span class="linenos">101</span></a><span class="k">class</span> <span class="nc">Dialect</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Dialect</span><span class="p">):</span> +</span><span id="Dialect-102"><a href="#Dialect-102"><span class="linenos">102</span></a> <span class="n">index_offset</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Dialect-103"><a href="#Dialect-103"><span class="linenos">103</span></a> <span class="n">unnest_column_only</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Dialect-104"><a href="#Dialect-104"><span class="linenos">104</span></a> <span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Dialect-105"><a href="#Dialect-105"><span class="linenos">105</span></a> <span class="n">normalize_functions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"upper"</span> +</span><span id="Dialect-106"><a href="#Dialect-106"><span class="linenos">106</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_small"</span> +</span><span id="Dialect-107"><a href="#Dialect-107"><span class="linenos">107</span></a> +</span><span id="Dialect-108"><a href="#Dialect-108"><span class="linenos">108</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"'%Y-%m-</span><span class="si">%d</span><span class="s2">'"</span> +</span><span id="Dialect-109"><a href="#Dialect-109"><span class="linenos">109</span></a> <span class="n">dateint_format</span> <span class="o">=</span> <span class="s2">"'%Y%m</span><span class="si">%d</span><span class="s2">'"</span> +</span><span id="Dialect-110"><a href="#Dialect-110"><span class="linenos">110</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S'"</span> +</span><span id="Dialect-111"><a href="#Dialect-111"><span class="linenos">111</span></a> <span class="n">time_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Dialect-112"><a href="#Dialect-112"><span class="linenos">112</span></a> +</span><span id="Dialect-113"><a href="#Dialect-113"><span class="linenos">113</span></a> <span class="c1"># autofilled</span> +</span><span id="Dialect-114"><a href="#Dialect-114"><span class="linenos">114</span></a> <span class="n">quote_start</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-115"><a href="#Dialect-115"><span class="linenos">115</span></a> <span class="n">quote_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-116"><a href="#Dialect-116"><span class="linenos">116</span></a> <span class="n">identifier_start</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-117"><a href="#Dialect-117"><span class="linenos">117</span></a> <span class="n">identifier_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-118"><a href="#Dialect-118"><span class="linenos">118</span></a> +</span><span id="Dialect-119"><a href="#Dialect-119"><span class="linenos">119</span></a> <span class="n">time_trie</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-120"><a href="#Dialect-120"><span class="linenos">120</span></a> <span class="n">inverse_time_mapping</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-121"><a href="#Dialect-121"><span class="linenos">121</span></a> <span class="n">inverse_time_trie</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-122"><a href="#Dialect-122"><span class="linenos">122</span></a> <span class="n">tokenizer_class</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-123"><a href="#Dialect-123"><span class="linenos">123</span></a> <span class="n">parser_class</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-124"><a href="#Dialect-124"><span class="linenos">124</span></a> <span class="n">generator_class</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Dialect-125"><a href="#Dialect-125"><span class="linenos">125</span></a> +</span><span id="Dialect-126"><a href="#Dialect-126"><span class="linenos">126</span></a> <span class="nd">@classmethod</span> +</span><span id="Dialect-127"><a href="#Dialect-127"><span class="linenos">127</span></a> <span class="k">def</span> <span class="nf">get_or_raise</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]:</span> +</span><span id="Dialect-128"><a href="#Dialect-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">dialect</span><span class="p">:</span> +</span><span id="Dialect-129"><a href="#Dialect-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="bp">cls</span> +</span><span id="Dialect-130"><a href="#Dialect-130"><span class="linenos">130</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dialect</span><span class="p">,</span> <span class="n">_Dialect</span><span class="p">):</span> +</span><span id="Dialect-131"><a href="#Dialect-131"><span class="linenos">131</span></a> <span class="k">return</span> <span class="n">dialect</span> +</span><span id="Dialect-132"><a href="#Dialect-132"><span class="linenos">132</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dialect</span><span class="p">,</span> <span class="n">Dialect</span><span class="p">):</span> +</span><span id="Dialect-133"><a href="#Dialect-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="n">dialect</span><span class="o">.</span><span class="vm">__class__</span> +</span><span id="Dialect-134"><a href="#Dialect-134"><span class="linenos">134</span></a> +</span><span id="Dialect-135"><a href="#Dialect-135"><span class="linenos">135</span></a> <span class="n">result</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="Dialect-136"><a href="#Dialect-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">result</span><span class="p">:</span> +</span><span id="Dialect-137"><a href="#Dialect-137"><span class="linenos">137</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown dialect '</span><span class="si">{</span><span class="n">dialect</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="Dialect-138"><a href="#Dialect-138"><span class="linenos">138</span></a> +</span><span id="Dialect-139"><a href="#Dialect-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">result</span> +</span><span id="Dialect-140"><a href="#Dialect-140"><span class="linenos">140</span></a> +</span><span id="Dialect-141"><a href="#Dialect-141"><span class="linenos">141</span></a> <span class="nd">@classmethod</span> +</span><span id="Dialect-142"><a href="#Dialect-142"><span class="linenos">142</span></a> <span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span> +</span><span id="Dialect-143"><a href="#Dialect-143"><span class="linenos">143</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Dialect-144"><a href="#Dialect-144"><span class="linenos">144</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Dialect-145"><a href="#Dialect-145"><span class="linenos">145</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Dialect-146"><a href="#Dialect-146"><span class="linenos">146</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="Dialect-147"><a href="#Dialect-147"><span class="linenos">147</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="Dialect-148"><a href="#Dialect-148"><span class="linenos">148</span></a> <span class="n">expression</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="c1"># the time formats are quoted</span> +</span><span id="Dialect-149"><a href="#Dialect-149"><span class="linenos">149</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="Dialect-150"><a href="#Dialect-150"><span class="linenos">150</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_trie</span><span class="p">,</span> +</span><span id="Dialect-151"><a href="#Dialect-151"><span class="linenos">151</span></a> <span class="p">)</span> +</span><span id="Dialect-152"><a href="#Dialect-152"><span class="linenos">152</span></a> <span class="p">)</span> +</span><span id="Dialect-153"><a href="#Dialect-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="Dialect-154"><a href="#Dialect-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="Dialect-155"><a href="#Dialect-155"><span class="linenos">155</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="Dialect-156"><a href="#Dialect-156"><span class="linenos">156</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Dialect-157"><a href="#Dialect-157"><span class="linenos">157</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="Dialect-158"><a href="#Dialect-158"><span class="linenos">158</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_trie</span><span class="p">,</span> +</span><span id="Dialect-159"><a href="#Dialect-159"><span class="linenos">159</span></a> <span class="p">)</span> +</span><span id="Dialect-160"><a href="#Dialect-160"><span class="linenos">160</span></a> <span class="p">)</span> +</span><span id="Dialect-161"><a href="#Dialect-161"><span class="linenos">161</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Dialect-162"><a href="#Dialect-162"><span class="linenos">162</span></a> +</span><span id="Dialect-163"><a href="#Dialect-163"><span class="linenos">163</span></a> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Dialect-164"><a href="#Dialect-164"><span class="linenos">164</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokenizer</span><span class="o">.</span><span class="n">tokenize</span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Dialect-165"><a href="#Dialect-165"><span class="linenos">165</span></a> +</span><span id="Dialect-166"><a href="#Dialect-166"><span class="linenos">166</span></a> <span class="k">def</span> <span class="nf">parse_into</span><span class="p">(</span> +</span><span id="Dialect-167"><a href="#Dialect-167"><span class="linenos">167</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression_type</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span> +</span><span id="Dialect-168"><a href="#Dialect-168"><span class="linenos">168</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Dialect-169"><a href="#Dialect-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">parse_into</span><span class="p">(</span><span class="n">expression_type</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer</span><span class="o">.</span><span class="n">tokenize</span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Dialect-170"><a href="#Dialect-170"><span class="linenos">170</span></a> +</span><span id="Dialect-171"><a href="#Dialect-171"><span class="linenos">171</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Dialect-172"><a href="#Dialect-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Dialect-173"><a href="#Dialect-173"><span class="linenos">173</span></a> +</span><span id="Dialect-174"><a href="#Dialect-174"><span class="linenos">174</span></a> <span class="k">def</span> <span class="nf">transpile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Dialect-175"><a href="#Dialect-175"><span class="linenos">175</span></a> <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">)]</span> +</span><span id="Dialect-176"><a href="#Dialect-176"><span class="linenos">176</span></a> +</span><span id="Dialect-177"><a href="#Dialect-177"><span class="linenos">177</span></a> <span class="nd">@property</span> +</span><span id="Dialect-178"><a href="#Dialect-178"><span class="linenos">178</span></a> <span class="k">def</span> <span class="nf">tokenizer</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Tokenizer</span><span class="p">:</span> +</span><span id="Dialect-179"><a href="#Dialect-179"><span class="linenos">179</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="s2">"_tokenizer"</span><span class="p">):</span> +</span><span id="Dialect-180"><a href="#Dialect-180"><span class="linenos">180</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokenizer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="Dialect-181"><a href="#Dialect-181"><span class="linenos">181</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tokenizer</span> +</span><span id="Dialect-182"><a href="#Dialect-182"><span class="linenos">182</span></a> +</span><span id="Dialect-183"><a href="#Dialect-183"><span class="linenos">183</span></a> <span class="k">def</span> <span class="nf">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Parser</span><span class="p">:</span> +</span><span id="Dialect-184"><a href="#Dialect-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser_class</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="Dialect-185"><a href="#Dialect-185"><span class="linenos">185</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="Dialect-186"><a href="#Dialect-186"><span class="linenos">186</span></a> <span class="s2">"index_offset"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">,</span> +</span><span id="Dialect-187"><a href="#Dialect-187"><span class="linenos">187</span></a> <span class="s2">"unnest_column_only"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">,</span> +</span><span id="Dialect-188"><a href="#Dialect-188"><span class="linenos">188</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">,</span> +</span><span id="Dialect-189"><a href="#Dialect-189"><span class="linenos">189</span></a> <span class="s2">"null_ordering"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span><span class="p">,</span> +</span><span id="Dialect-190"><a href="#Dialect-190"><span class="linenos">190</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Dialect-191"><a href="#Dialect-191"><span class="linenos">191</span></a> <span class="p">},</span> +</span><span id="Dialect-192"><a href="#Dialect-192"><span class="linenos">192</span></a> <span class="p">)</span> +</span><span id="Dialect-193"><a href="#Dialect-193"><span class="linenos">193</span></a> +</span><span id="Dialect-194"><a href="#Dialect-194"><span class="linenos">194</span></a> <span class="k">def</span> <span class="nf">generator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Generator</span><span class="p">:</span> +</span><span id="Dialect-195"><a href="#Dialect-195"><span class="linenos">195</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator_class</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="Dialect-196"><a href="#Dialect-196"><span class="linenos">196</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="Dialect-197"><a href="#Dialect-197"><span class="linenos">197</span></a> <span class="s2">"quote_start"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span><span class="p">,</span> +</span><span id="Dialect-198"><a href="#Dialect-198"><span class="linenos">198</span></a> <span class="s2">"quote_end"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="p">,</span> +</span><span id="Dialect-199"><a href="#Dialect-199"><span class="linenos">199</span></a> <span class="s2">"identifier_start"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span><span class="p">,</span> +</span><span id="Dialect-200"><a href="#Dialect-200"><span class="linenos">200</span></a> <span class="s2">"identifier_end"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="p">,</span> +</span><span id="Dialect-201"><a href="#Dialect-201"><span class="linenos">201</span></a> <span class="s2">"string_escape"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">STRING_ESCAPES</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> +</span><span id="Dialect-202"><a href="#Dialect-202"><span class="linenos">202</span></a> <span class="s2">"identifier_escape"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">IDENTIFIER_ESCAPES</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> +</span><span id="Dialect-203"><a href="#Dialect-203"><span class="linenos">203</span></a> <span class="s2">"index_offset"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">,</span> +</span><span id="Dialect-204"><a href="#Dialect-204"><span class="linenos">204</span></a> <span class="s2">"time_mapping"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_time_mapping</span><span class="p">,</span> +</span><span id="Dialect-205"><a href="#Dialect-205"><span class="linenos">205</span></a> <span class="s2">"time_trie"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_time_trie</span><span class="p">,</span> +</span><span id="Dialect-206"><a href="#Dialect-206"><span class="linenos">206</span></a> <span class="s2">"unnest_column_only"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">,</span> +</span><span id="Dialect-207"><a href="#Dialect-207"><span class="linenos">207</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">,</span> +</span><span id="Dialect-208"><a href="#Dialect-208"><span class="linenos">208</span></a> <span class="s2">"normalize_functions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span><span class="p">,</span> +</span><span id="Dialect-209"><a href="#Dialect-209"><span class="linenos">209</span></a> <span class="s2">"null_ordering"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span><span class="p">,</span> +</span><span id="Dialect-210"><a href="#Dialect-210"><span class="linenos">210</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Dialect-211"><a href="#Dialect-211"><span class="linenos">211</span></a> <span class="p">}</span> +</span><span id="Dialect-212"><a href="#Dialect-212"><span class="linenos">212</span></a> <span class="p">)</span> +</span></pre></div> + + + + + <div id="Dialect.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Dialect</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Dialect.__init__"></a> + + + + </div> + <div id="Dialect.get_or_raise" class="classattr"> + <input id="Dialect.get_or_raise-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">get_or_raise</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Dialect.get_or_raise-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.get_or_raise"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.get_or_raise-126"><a href="#Dialect.get_or_raise-126"><span class="linenos">126</span></a> <span class="nd">@classmethod</span> +</span><span id="Dialect.get_or_raise-127"><a href="#Dialect.get_or_raise-127"><span class="linenos">127</span></a> <span class="k">def</span> <span class="nf">get_or_raise</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Dialect</span><span class="p">]:</span> +</span><span id="Dialect.get_or_raise-128"><a href="#Dialect.get_or_raise-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">dialect</span><span class="p">:</span> +</span><span id="Dialect.get_or_raise-129"><a href="#Dialect.get_or_raise-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="bp">cls</span> +</span><span id="Dialect.get_or_raise-130"><a href="#Dialect.get_or_raise-130"><span class="linenos">130</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dialect</span><span class="p">,</span> <span class="n">_Dialect</span><span class="p">):</span> +</span><span id="Dialect.get_or_raise-131"><a href="#Dialect.get_or_raise-131"><span class="linenos">131</span></a> <span class="k">return</span> <span class="n">dialect</span> +</span><span id="Dialect.get_or_raise-132"><a href="#Dialect.get_or_raise-132"><span class="linenos">132</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dialect</span><span class="p">,</span> <span class="n">Dialect</span><span class="p">):</span> +</span><span id="Dialect.get_or_raise-133"><a href="#Dialect.get_or_raise-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="n">dialect</span><span class="o">.</span><span class="vm">__class__</span> +</span><span id="Dialect.get_or_raise-134"><a href="#Dialect.get_or_raise-134"><span class="linenos">134</span></a> +</span><span id="Dialect.get_or_raise-135"><a href="#Dialect.get_or_raise-135"><span class="linenos">135</span></a> <span class="n">result</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="Dialect.get_or_raise-136"><a href="#Dialect.get_or_raise-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">result</span><span class="p">:</span> +</span><span id="Dialect.get_or_raise-137"><a href="#Dialect.get_or_raise-137"><span class="linenos">137</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown dialect '</span><span class="si">{</span><span class="n">dialect</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="Dialect.get_or_raise-138"><a href="#Dialect.get_or_raise-138"><span class="linenos">138</span></a> +</span><span id="Dialect.get_or_raise-139"><a href="#Dialect.get_or_raise-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">result</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.format_time" class="classattr"> + <input id="Dialect.format_time-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">format_time</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Dialect.format_time-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.format_time"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.format_time-141"><a href="#Dialect.format_time-141"><span class="linenos">141</span></a> <span class="nd">@classmethod</span> +</span><span id="Dialect.format_time-142"><a href="#Dialect.format_time-142"><span class="linenos">142</span></a> <span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span> +</span><span id="Dialect.format_time-143"><a href="#Dialect.format_time-143"><span class="linenos">143</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Dialect.format_time-144"><a href="#Dialect.format_time-144"><span class="linenos">144</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Dialect.format_time-145"><a href="#Dialect.format_time-145"><span class="linenos">145</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Dialect.format_time-146"><a href="#Dialect.format_time-146"><span class="linenos">146</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="Dialect.format_time-147"><a href="#Dialect.format_time-147"><span class="linenos">147</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="Dialect.format_time-148"><a href="#Dialect.format_time-148"><span class="linenos">148</span></a> <span class="n">expression</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="c1"># the time formats are quoted</span> +</span><span id="Dialect.format_time-149"><a href="#Dialect.format_time-149"><span class="linenos">149</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="Dialect.format_time-150"><a href="#Dialect.format_time-150"><span class="linenos">150</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_trie</span><span class="p">,</span> +</span><span id="Dialect.format_time-151"><a href="#Dialect.format_time-151"><span class="linenos">151</span></a> <span class="p">)</span> +</span><span id="Dialect.format_time-152"><a href="#Dialect.format_time-152"><span class="linenos">152</span></a> <span class="p">)</span> +</span><span id="Dialect.format_time-153"><a href="#Dialect.format_time-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="Dialect.format_time-154"><a href="#Dialect.format_time-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="Dialect.format_time-155"><a href="#Dialect.format_time-155"><span class="linenos">155</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="Dialect.format_time-156"><a href="#Dialect.format_time-156"><span class="linenos">156</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="Dialect.format_time-157"><a href="#Dialect.format_time-157"><span class="linenos">157</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="Dialect.format_time-158"><a href="#Dialect.format_time-158"><span class="linenos">158</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">time_trie</span><span class="p">,</span> +</span><span id="Dialect.format_time-159"><a href="#Dialect.format_time-159"><span class="linenos">159</span></a> <span class="p">)</span> +</span><span id="Dialect.format_time-160"><a href="#Dialect.format_time-160"><span class="linenos">160</span></a> <span class="p">)</span> +</span><span id="Dialect.format_time-161"><a href="#Dialect.format_time-161"><span class="linenos">161</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.parse" class="classattr"> + <input id="Dialect.parse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="Dialect.parse-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.parse"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.parse-163"><a href="#Dialect.parse-163"><span class="linenos">163</span></a> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Dialect.parse-164"><a href="#Dialect.parse-164"><span class="linenos">164</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokenizer</span><span class="o">.</span><span class="n">tokenize</span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.parse_into" class="classattr"> + <input id="Dialect.parse_into-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse_into</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression_type</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="n">Collection</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]]]</span>,</span><span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="Dialect.parse_into-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.parse_into"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.parse_into-166"><a href="#Dialect.parse_into-166"><span class="linenos">166</span></a> <span class="k">def</span> <span class="nf">parse_into</span><span class="p">(</span> +</span><span id="Dialect.parse_into-167"><a href="#Dialect.parse_into-167"><span class="linenos">167</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression_type</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span> +</span><span id="Dialect.parse_into-168"><a href="#Dialect.parse_into-168"><span class="linenos">168</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Dialect.parse_into-169"><a href="#Dialect.parse_into-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">parse_into</span><span class="p">(</span><span class="n">expression_type</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer</span><span class="o">.</span><span class="n">tokenize</span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.generate" class="classattr"> + <input id="Dialect.generate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generate</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Dialect.generate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.generate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.generate-171"><a href="#Dialect.generate-171"><span class="linenos">171</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Dialect.generate-172"><a href="#Dialect.generate-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span><span class="p">(</span><span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.transpile" class="classattr"> + <input id="Dialect.transpile-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transpile</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Dialect.transpile-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.transpile"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.transpile-174"><a href="#Dialect.transpile-174"><span class="linenos">174</span></a> <span class="k">def</span> <span class="nf">transpile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Dialect.transpile-175"><a href="#Dialect.transpile-175"><span class="linenos">175</span></a> <span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">sql</span><span class="p">)]</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.parser" class="classattr"> + <input id="Dialect.parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parser</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>:</span></span> + + <label class="view-source-button" for="Dialect.parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.parser-183"><a href="#Dialect.parser-183"><span class="linenos">183</span></a> <span class="k">def</span> <span class="nf">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Parser</span><span class="p">:</span> +</span><span id="Dialect.parser-184"><a href="#Dialect.parser-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parser_class</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="Dialect.parser-185"><a href="#Dialect.parser-185"><span class="linenos">185</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="Dialect.parser-186"><a href="#Dialect.parser-186"><span class="linenos">186</span></a> <span class="s2">"index_offset"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">,</span> +</span><span id="Dialect.parser-187"><a href="#Dialect.parser-187"><span class="linenos">187</span></a> <span class="s2">"unnest_column_only"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">,</span> +</span><span id="Dialect.parser-188"><a href="#Dialect.parser-188"><span class="linenos">188</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">,</span> +</span><span id="Dialect.parser-189"><a href="#Dialect.parser-189"><span class="linenos">189</span></a> <span class="s2">"null_ordering"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span><span class="p">,</span> +</span><span id="Dialect.parser-190"><a href="#Dialect.parser-190"><span class="linenos">190</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Dialect.parser-191"><a href="#Dialect.parser-191"><span class="linenos">191</span></a> <span class="p">},</span> +</span><span id="Dialect.parser-192"><a href="#Dialect.parser-192"><span class="linenos">192</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Dialect.generator" class="classattr"> + <input id="Dialect.generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generator</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>:</span></span> + + <label class="view-source-button" for="Dialect.generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dialect.generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dialect.generator-194"><a href="#Dialect.generator-194"><span class="linenos">194</span></a> <span class="k">def</span> <span class="nf">generator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Generator</span><span class="p">:</span> +</span><span id="Dialect.generator-195"><a href="#Dialect.generator-195"><span class="linenos">195</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator_class</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="Dialect.generator-196"><a href="#Dialect.generator-196"><span class="linenos">196</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="Dialect.generator-197"><a href="#Dialect.generator-197"><span class="linenos">197</span></a> <span class="s2">"quote_start"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span><span class="p">,</span> +</span><span id="Dialect.generator-198"><a href="#Dialect.generator-198"><span class="linenos">198</span></a> <span class="s2">"quote_end"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="p">,</span> +</span><span id="Dialect.generator-199"><a href="#Dialect.generator-199"><span class="linenos">199</span></a> <span class="s2">"identifier_start"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span><span class="p">,</span> +</span><span id="Dialect.generator-200"><a href="#Dialect.generator-200"><span class="linenos">200</span></a> <span class="s2">"identifier_end"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="p">,</span> +</span><span id="Dialect.generator-201"><a href="#Dialect.generator-201"><span class="linenos">201</span></a> <span class="s2">"string_escape"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">STRING_ESCAPES</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> +</span><span id="Dialect.generator-202"><a href="#Dialect.generator-202"><span class="linenos">202</span></a> <span class="s2">"identifier_escape"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokenizer_class</span><span class="o">.</span><span class="n">IDENTIFIER_ESCAPES</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> +</span><span id="Dialect.generator-203"><a href="#Dialect.generator-203"><span class="linenos">203</span></a> <span class="s2">"index_offset"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">,</span> +</span><span id="Dialect.generator-204"><a href="#Dialect.generator-204"><span class="linenos">204</span></a> <span class="s2">"time_mapping"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_time_mapping</span><span class="p">,</span> +</span><span id="Dialect.generator-205"><a href="#Dialect.generator-205"><span class="linenos">205</span></a> <span class="s2">"time_trie"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">inverse_time_trie</span><span class="p">,</span> +</span><span id="Dialect.generator-206"><a href="#Dialect.generator-206"><span class="linenos">206</span></a> <span class="s2">"unnest_column_only"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">,</span> +</span><span id="Dialect.generator-207"><a href="#Dialect.generator-207"><span class="linenos">207</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">,</span> +</span><span id="Dialect.generator-208"><a href="#Dialect.generator-208"><span class="linenos">208</span></a> <span class="s2">"normalize_functions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span><span class="p">,</span> +</span><span id="Dialect.generator-209"><a href="#Dialect.generator-209"><span class="linenos">209</span></a> <span class="s2">"null_ordering"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span><span class="p">,</span> +</span><span id="Dialect.generator-210"><a href="#Dialect.generator-210"><span class="linenos">210</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Dialect.generator-211"><a href="#Dialect.generator-211"><span class="linenos">211</span></a> <span class="p">}</span> +</span><span id="Dialect.generator-212"><a href="#Dialect.generator-212"><span class="linenos">212</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="rename_func"> + <input id="rename_func-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rename_func</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n">Callable</span><span class="p">[[</span><span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span><span class="p">,</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="rename_func-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#rename_func"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="rename_func-218"><a href="#rename_func-218"><span class="linenos">218</span></a><span class="k">def</span> <span class="nf">rename_func</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="rename_func-219"><a href="#rename_func-219"><span class="linenos">219</span></a> <span class="k">def</span> <span class="nf">_rename</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="rename_func-220"><a href="#rename_func-220"><span class="linenos">220</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="rename_func-221"><a href="#rename_func-221"><span class="linenos">221</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="rename_func-222"><a href="#rename_func-222"><span class="linenos">222</span></a> +</span><span id="rename_func-223"><a href="#rename_func-223"><span class="linenos">223</span></a> <span class="k">return</span> <span class="n">_rename</span> +</span></pre></div> + + + + + </section> + <section id="approx_count_distinct_sql"> + <input id="approx_count_distinct_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">approx_count_distinct_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="approx_count_distinct_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#approx_count_distinct_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="approx_count_distinct_sql-226"><a href="#approx_count_distinct_sql-226"><span class="linenos">226</span></a><span class="k">def</span> <span class="nf">approx_count_distinct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="approx_count_distinct_sql-227"><a href="#approx_count_distinct_sql-227"><span class="linenos">227</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"accuracy"</span><span class="p">):</span> +</span><span id="approx_count_distinct_sql-228"><a href="#approx_count_distinct_sql-228"><span class="linenos">228</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"APPROX_COUNT_DISTINCT does not support accuracy"</span><span class="p">)</span> +</span><span id="approx_count_distinct_sql-229"><a href="#approx_count_distinct_sql-229"><span class="linenos">229</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"APPROX_COUNT_DISTINCT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + <section id="if_sql"> + <input id="if_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">if_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#If">sqlglot.expressions.If</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="if_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#if_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="if_sql-232"><a href="#if_sql-232"><span class="linenos">232</span></a><span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="if_sql-233"><a href="#if_sql-233"><span class="linenos">233</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="if_sql-234"><a href="#if_sql-234"><span class="linenos">234</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"true"</span><span class="p">),</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">)</span> +</span><span id="if_sql-235"><a href="#if_sql-235"><span class="linenos">235</span></a> <span class="p">)</span> +</span><span id="if_sql-236"><a href="#if_sql-236"><span class="linenos">236</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + <section id="arrow_json_extract_sql"> + <input id="arrow_json_extract_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">arrow_json_extract_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#JSONExtract">sqlglot.expressions.JSONExtract</a></span> <span class="o">|</span> <span class="n"><a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="arrow_json_extract_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#arrow_json_extract_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="arrow_json_extract_sql-239"><a href="#arrow_json_extract_sql-239"><span class="linenos">239</span></a><span class="k">def</span> <span class="nf">arrow_json_extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="arrow_json_extract_sql-240"><a href="#arrow_json_extract_sql-240"><span class="linenos">240</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"->"</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="arrow_json_extract_scalar_sql"> + <input id="arrow_json_extract_scalar_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">arrow_json_extract_scalar_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#JSONExtractScalar">sqlglot.expressions.JSONExtractScalar</a></span> <span class="o">|</span> <span class="n"><a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="arrow_json_extract_scalar_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#arrow_json_extract_scalar_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="arrow_json_extract_scalar_sql-243"><a href="#arrow_json_extract_scalar_sql-243"><span class="linenos">243</span></a><span class="k">def</span> <span class="nf">arrow_json_extract_scalar_sql</span><span class="p">(</span> +</span><span id="arrow_json_extract_scalar_sql-244"><a href="#arrow_json_extract_scalar_sql-244"><span class="linenos">244</span></a> <span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span> +</span><span id="arrow_json_extract_scalar_sql-245"><a href="#arrow_json_extract_scalar_sql-245"><span class="linenos">245</span></a><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="arrow_json_extract_scalar_sql-246"><a href="#arrow_json_extract_scalar_sql-246"><span class="linenos">246</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"->>"</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="inline_array_sql"> + <input id="inline_array_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">inline_array_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Array">sqlglot.expressions.Array</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="inline_array_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#inline_array_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="inline_array_sql-249"><a href="#inline_array_sql-249"><span class="linenos">249</span></a><span class="k">def</span> <span class="nf">inline_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="inline_array_sql-250"><a href="#inline_array_sql-250"><span class="linenos">250</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span> +</span></pre></div> + + + + + </section> + <section id="no_ilike_sql"> + <input id="no_ilike_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_ilike_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#ILike">sqlglot.expressions.ILike</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_ilike_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_ilike_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_ilike_sql-253"><a href="#no_ilike_sql-253"><span class="linenos">253</span></a><span class="k">def</span> <span class="nf">no_ilike_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_ilike_sql-254"><a href="#no_ilike_sql-254"><span class="linenos">254</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">like_sql</span><span class="p">(</span> +</span><span id="no_ilike_sql-255"><a href="#no_ilike_sql-255"><span class="linenos">255</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">(</span> +</span><span id="no_ilike_sql-256"><a href="#no_ilike_sql-256"><span class="linenos">256</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Lower</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="no_ilike_sql-257"><a href="#no_ilike_sql-257"><span class="linenos">257</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expression"</span><span class="p">],</span> +</span><span id="no_ilike_sql-258"><a href="#no_ilike_sql-258"><span class="linenos">258</span></a> <span class="p">)</span> +</span><span id="no_ilike_sql-259"><a href="#no_ilike_sql-259"><span class="linenos">259</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="no_paren_current_date_sql"> + <input id="no_paren_current_date_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_paren_current_date_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_paren_current_date_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_paren_current_date_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_paren_current_date_sql-262"><a href="#no_paren_current_date_sql-262"><span class="linenos">262</span></a><span class="k">def</span> <span class="nf">no_paren_current_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_paren_current_date_sql-263"><a href="#no_paren_current_date_sql-263"><span class="linenos">263</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="no_paren_current_date_sql-264"><a href="#no_paren_current_date_sql-264"><span class="linenos">264</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CURRENT_DATE AT TIME ZONE </span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">zone</span> <span class="k">else</span> <span class="s2">"CURRENT_DATE"</span> +</span></pre></div> + + + + + </section> + <section id="no_recursive_cte_sql"> + <input id="no_recursive_cte_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_recursive_cte_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#With">sqlglot.expressions.With</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_recursive_cte_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_recursive_cte_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_recursive_cte_sql-267"><a href="#no_recursive_cte_sql-267"><span class="linenos">267</span></a><span class="k">def</span> <span class="nf">no_recursive_cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_recursive_cte_sql-268"><a href="#no_recursive_cte_sql-268"><span class="linenos">268</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">):</span> +</span><span id="no_recursive_cte_sql-269"><a href="#no_recursive_cte_sql-269"><span class="linenos">269</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Recursive CTEs are unsupported"</span><span class="p">)</span> +</span><span id="no_recursive_cte_sql-270"><a href="#no_recursive_cte_sql-270"><span class="linenos">270</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"recursive"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="no_recursive_cte_sql-271"><a href="#no_recursive_cte_sql-271"><span class="linenos">271</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">with_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="no_safe_divide_sql"> + <input id="no_safe_divide_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_safe_divide_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_safe_divide_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_safe_divide_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_safe_divide_sql-274"><a href="#no_safe_divide_sql-274"><span class="linenos">274</span></a><span class="k">def</span> <span class="nf">no_safe_divide_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_safe_divide_sql-275"><a href="#no_safe_divide_sql-275"><span class="linenos">275</span></a> <span class="n">n</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="no_safe_divide_sql-276"><a href="#no_safe_divide_sql-276"><span class="linenos">276</span></a> <span class="n">d</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="no_safe_divide_sql-277"><a href="#no_safe_divide_sql-277"><span class="linenos">277</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF(</span><span class="si">{</span><span class="n">d</span><span class="si">}</span><span class="s2"> <> 0, </span><span class="si">{</span><span class="n">n</span><span class="si">}</span><span class="s2"> / </span><span class="si">{</span><span class="n">d</span><span class="si">}</span><span class="s2">, NULL)"</span> +</span></pre></div> + + + + + </section> + <section id="no_tablesample_sql"> + <input id="no_tablesample_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_tablesample_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#TableSample">sqlglot.expressions.TableSample</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_tablesample_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_tablesample_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_tablesample_sql-280"><a href="#no_tablesample_sql-280"><span class="linenos">280</span></a><span class="k">def</span> <span class="nf">no_tablesample_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_tablesample_sql-281"><a href="#no_tablesample_sql-281"><span class="linenos">281</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"TABLESAMPLE unsupported"</span><span class="p">)</span> +</span><span id="no_tablesample_sql-282"><a href="#no_tablesample_sql-282"><span class="linenos">282</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="no_pivot_sql"> + <input id="no_pivot_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_pivot_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Pivot">sqlglot.expressions.Pivot</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_pivot_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_pivot_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_pivot_sql-285"><a href="#no_pivot_sql-285"><span class="linenos">285</span></a><span class="k">def</span> <span class="nf">no_pivot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_pivot_sql-286"><a href="#no_pivot_sql-286"><span class="linenos">286</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"PIVOT unsupported"</span><span class="p">)</span> +</span><span id="no_pivot_sql-287"><a href="#no_pivot_sql-287"><span class="linenos">287</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="no_trycast_sql"> + <input id="no_trycast_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_trycast_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_trycast_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_trycast_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_trycast_sql-290"><a href="#no_trycast_sql-290"><span class="linenos">290</span></a><span class="k">def</span> <span class="nf">no_trycast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_trycast_sql-291"><a href="#no_trycast_sql-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="no_properties_sql"> + <input id="no_properties_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_properties_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Properties">sqlglot.expressions.Properties</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="no_properties_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#no_properties_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="no_properties_sql-294"><a href="#no_properties_sql-294"><span class="linenos">294</span></a><span class="k">def</span> <span class="nf">no_properties_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="no_properties_sql-295"><a href="#no_properties_sql-295"><span class="linenos">295</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Properties unsupported"</span><span class="p">)</span> +</span><span id="no_properties_sql-296"><a href="#no_properties_sql-296"><span class="linenos">296</span></a> <span class="k">return</span> <span class="s2">""</span> +</span></pre></div> + + + + + </section> + <section id="str_position_sql"> + <input id="str_position_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">str_position_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="str_position_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#str_position_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="str_position_sql-299"><a href="#str_position_sql-299"><span class="linenos">299</span></a><span class="k">def</span> <span class="nf">str_position_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="str_position_sql-300"><a href="#str_position_sql-300"><span class="linenos">300</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="str_position_sql-301"><a href="#str_position_sql-301"><span class="linenos">301</span></a> <span class="n">substr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"substr"</span><span class="p">)</span> +</span><span id="str_position_sql-302"><a href="#str_position_sql-302"><span class="linenos">302</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="str_position_sql-303"><a href="#str_position_sql-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="n">position</span><span class="p">:</span> +</span><span id="str_position_sql-304"><a href="#str_position_sql-304"><span class="linenos">304</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRPOS(SUBSTR(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">position</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="n">substr</span><span class="si">}</span><span class="s2">) + </span><span class="si">{</span><span class="n">position</span><span class="si">}</span><span class="s2"> - 1"</span> +</span><span id="str_position_sql-305"><a href="#str_position_sql-305"><span class="linenos">305</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRPOS(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">substr</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + <section id="struct_extract_sql"> + <input id="struct_extract_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">struct_extract_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="struct_extract_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#struct_extract_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="struct_extract_sql-308"><a href="#struct_extract_sql-308"><span class="linenos">308</span></a><span class="k">def</span> <span class="nf">struct_extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="struct_extract_sql-309"><a href="#struct_extract_sql-309"><span class="linenos">309</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="struct_extract_sql-310"><a href="#struct_extract_sql-310"><span class="linenos">310</span></a> <span class="n">struct_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="struct_extract_sql-311"><a href="#struct_extract_sql-311"><span class="linenos">311</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">struct_key</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </section> + <section id="var_map_sql"> + <input id="var_map_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">var_map_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Map">sqlglot.expressions.Map</a></span> <span class="o">|</span> <span class="n"><a href="../expressions.html#VarMap">sqlglot.expressions.VarMap</a></span>,</span><span class="param"> <span class="n">map_func_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">'MAP'</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="var_map_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#var_map_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="var_map_sql-314"><a href="#var_map_sql-314"><span class="linenos">314</span></a><span class="k">def</span> <span class="nf">var_map_sql</span><span class="p">(</span> +</span><span id="var_map_sql-315"><a href="#var_map_sql-315"><span class="linenos">315</span></a> <span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">,</span> <span class="n">map_func_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"MAP"</span> +</span><span id="var_map_sql-316"><a href="#var_map_sql-316"><span class="linenos">316</span></a><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="var_map_sql-317"><a href="#var_map_sql-317"><span class="linenos">317</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"keys"</span><span class="p">]</span> +</span><span id="var_map_sql-318"><a href="#var_map_sql-318"><span class="linenos">318</span></a> <span class="n">values</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"values"</span><span class="p">]</span> +</span><span id="var_map_sql-319"><a href="#var_map_sql-319"><span class="linenos">319</span></a> +</span><span id="var_map_sql-320"><a href="#var_map_sql-320"><span class="linenos">320</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">):</span> +</span><span id="var_map_sql-321"><a href="#var_map_sql-321"><span class="linenos">321</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Cannot convert array columns into map."</span><span class="p">)</span> +</span><span id="var_map_sql-322"><a href="#var_map_sql-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">map_func_name</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span><span class="w"> </span><span class="n">values</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="var_map_sql-323"><a href="#var_map_sql-323"><span class="linenos">323</span></a> +</span><span id="var_map_sql-324"><a href="#var_map_sql-324"><span class="linenos">324</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="var_map_sql-325"><a href="#var_map_sql-325"><span class="linenos">325</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">keys</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">values</span><span class="o">.</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="var_map_sql-326"><a href="#var_map_sql-326"><span class="linenos">326</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">key</span><span class="p">))</span> +</span><span id="var_map_sql-327"><a href="#var_map_sql-327"><span class="linenos">327</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">value</span><span class="p">))</span> +</span><span id="var_map_sql-328"><a href="#var_map_sql-328"><span class="linenos">328</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">map_func_name</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + <section id="format_time_lambda"> + <input id="format_time_lambda-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">format_time_lambda</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">exp_class</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="o">~</span><span class="n">E</span><span class="p">]</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">default</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">Callable</span><span class="p">[[</span><span class="n">Sequence</span><span class="p">],</span> <span class="o">~</span><span class="n">E</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="format_time_lambda-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#format_time_lambda"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="format_time_lambda-331"><a href="#format_time_lambda-331"><span class="linenos">331</span></a><span class="k">def</span> <span class="nf">format_time_lambda</span><span class="p">(</span> +</span><span id="format_time_lambda-332"><a href="#format_time_lambda-332"><span class="linenos">332</span></a> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">E</span><span class="p">],</span> <span class="n">dialect</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">default</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span> <span class="o">|</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="format_time_lambda-333"><a href="#format_time_lambda-333"><span class="linenos">333</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">],</span> <span class="n">E</span><span class="p">]:</span> +</span><span id="format_time_lambda-334"><a href="#format_time_lambda-334"><span class="linenos">334</span></a><span class="w"> </span><span class="sd">"""Helper used for time expressions.</span> +</span><span id="format_time_lambda-335"><a href="#format_time_lambda-335"><span class="linenos">335</span></a> +</span><span id="format_time_lambda-336"><a href="#format_time_lambda-336"><span class="linenos">336</span></a><span class="sd"> Args:</span> +</span><span id="format_time_lambda-337"><a href="#format_time_lambda-337"><span class="linenos">337</span></a><span class="sd"> exp_class: the expression class to instantiate.</span> +</span><span id="format_time_lambda-338"><a href="#format_time_lambda-338"><span class="linenos">338</span></a><span class="sd"> dialect: target sql dialect.</span> +</span><span id="format_time_lambda-339"><a href="#format_time_lambda-339"><span class="linenos">339</span></a><span class="sd"> default: the default format, True being time.</span> +</span><span id="format_time_lambda-340"><a href="#format_time_lambda-340"><span class="linenos">340</span></a> +</span><span id="format_time_lambda-341"><a href="#format_time_lambda-341"><span class="linenos">341</span></a><span class="sd"> Returns:</span> +</span><span id="format_time_lambda-342"><a href="#format_time_lambda-342"><span class="linenos">342</span></a><span class="sd"> A callable that can be used to return the appropriately formatted time expression.</span> +</span><span id="format_time_lambda-343"><a href="#format_time_lambda-343"><span class="linenos">343</span></a><span class="sd"> """</span> +</span><span id="format_time_lambda-344"><a href="#format_time_lambda-344"><span class="linenos">344</span></a> +</span><span id="format_time_lambda-345"><a href="#format_time_lambda-345"><span class="linenos">345</span></a> <span class="k">def</span> <span class="nf">_format_time</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">):</span> +</span><span id="format_time_lambda-346"><a href="#format_time_lambda-346"><span class="linenos">346</span></a> <span class="k">return</span> <span class="n">exp_class</span><span class="p">(</span> +</span><span id="format_time_lambda-347"><a href="#format_time_lambda-347"><span class="linenos">347</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="format_time_lambda-348"><a href="#format_time_lambda-348"><span class="linenos">348</span></a> <span class="nb">format</span><span class="o">=</span><span class="n">Dialect</span><span class="p">[</span><span class="n">dialect</span><span class="p">]</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span> +</span><span id="format_time_lambda-349"><a href="#format_time_lambda-349"><span class="linenos">349</span></a> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="format_time_lambda-350"><a href="#format_time_lambda-350"><span class="linenos">350</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">Dialect</span><span class="p">[</span><span class="n">dialect</span><span class="p">]</span><span class="o">.</span><span class="n">time_format</span> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="kc">True</span> <span class="k">else</span> <span class="n">default</span> <span class="ow">or</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="format_time_lambda-351"><a href="#format_time_lambda-351"><span class="linenos">351</span></a> <span class="p">),</span> +</span><span id="format_time_lambda-352"><a href="#format_time_lambda-352"><span class="linenos">352</span></a> <span class="p">)</span> +</span><span id="format_time_lambda-353"><a href="#format_time_lambda-353"><span class="linenos">353</span></a> +</span><span id="format_time_lambda-354"><a href="#format_time_lambda-354"><span class="linenos">354</span></a> <span class="k">return</span> <span class="n">_format_time</span> +</span></pre></div> + + + <div class="docstring"><p>Helper used for time expressions.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>exp_class:</strong> the expression class to instantiate.</li> +<li><strong>dialect:</strong> target sql dialect.</li> +<li><strong>default:</strong> the default format, True being time.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A callable that can be used to return the appropriately formatted time expression.</p> +</blockquote> +</div> + + + </section> + <section id="create_with_partitions_sql"> + <input id="create_with_partitions_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">create_with_partitions_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Create">sqlglot.expressions.Create</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="create_with_partitions_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#create_with_partitions_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="create_with_partitions_sql-357"><a href="#create_with_partitions_sql-357"><span class="linenos">357</span></a><span class="k">def</span> <span class="nf">create_with_partitions_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="create_with_partitions_sql-358"><a href="#create_with_partitions_sql-358"><span class="linenos">358</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="create_with_partitions_sql-359"><a href="#create_with_partitions_sql-359"><span class="linenos">359</span></a><span class="sd"> In Hive and Spark, the PARTITIONED BY property acts as an extension of a table's schema. When the</span> +</span><span id="create_with_partitions_sql-360"><a href="#create_with_partitions_sql-360"><span class="linenos">360</span></a><span class="sd"> PARTITIONED BY value is an array of column names, they are transformed into a schema. The corresponding</span> +</span><span id="create_with_partitions_sql-361"><a href="#create_with_partitions_sql-361"><span class="linenos">361</span></a><span class="sd"> columns are removed from the create statement.</span> +</span><span id="create_with_partitions_sql-362"><a href="#create_with_partitions_sql-362"><span class="linenos">362</span></a><span class="sd"> """</span> +</span><span id="create_with_partitions_sql-363"><a href="#create_with_partitions_sql-363"><span class="linenos">363</span></a> <span class="n">has_schema</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">)</span> +</span><span id="create_with_partitions_sql-364"><a href="#create_with_partitions_sql-364"><span class="linenos">364</span></a> <span class="n">is_partitionable</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"TABLE"</span><span class="p">,</span> <span class="s2">"VIEW"</span><span class="p">)</span> +</span><span id="create_with_partitions_sql-365"><a href="#create_with_partitions_sql-365"><span class="linenos">365</span></a> +</span><span id="create_with_partitions_sql-366"><a href="#create_with_partitions_sql-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="n">has_schema</span> <span class="ow">and</span> <span class="n">is_partitionable</span><span class="p">:</span> +</span><span id="create_with_partitions_sql-367"><a href="#create_with_partitions_sql-367"><span class="linenos">367</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="create_with_partitions_sql-368"><a href="#create_with_partitions_sql-368"><span class="linenos">368</span></a> <span class="n">prop</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">)</span> +</span><span id="create_with_partitions_sql-369"><a href="#create_with_partitions_sql-369"><span class="linenos">369</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">prop</span> <span class="ow">and</span> <span class="n">prop</span><span class="o">.</span><span class="n">this</span> +</span><span id="create_with_partitions_sql-370"><a href="#create_with_partitions_sql-370"><span class="linenos">370</span></a> <span class="k">if</span> <span class="n">prop</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="create_with_partitions_sql-371"><a href="#create_with_partitions_sql-371"><span class="linenos">371</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="create_with_partitions_sql-372"><a href="#create_with_partitions_sql-372"><span class="linenos">372</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">{</span><span class="n">v</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">}</span> +</span><span id="create_with_partitions_sql-373"><a href="#create_with_partitions_sql-373"><span class="linenos">373</span></a> <span class="n">partitions</span> <span class="o">=</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">col</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">]</span> +</span><span id="create_with_partitions_sql-374"><a href="#create_with_partitions_sql-374"><span class="linenos">374</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">schema</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">e</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">partitions</span><span class="p">])</span> +</span><span id="create_with_partitions_sql-375"><a href="#create_with_partitions_sql-375"><span class="linenos">375</span></a> <span class="n">prop</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">partitions</span><span class="p">)))</span> +</span><span id="create_with_partitions_sql-376"><a href="#create_with_partitions_sql-376"><span class="linenos">376</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> +</span><span id="create_with_partitions_sql-377"><a href="#create_with_partitions_sql-377"><span class="linenos">377</span></a> +</span><span id="create_with_partitions_sql-378"><a href="#create_with_partitions_sql-378"><span class="linenos">378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">create_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>In Hive and Spark, the PARTITIONED BY property acts as an extension of a table's schema. When the +PARTITIONED BY value is an array of column names, they are transformed into a schema. The corresponding +columns are removed from the create statement.</p> +</div> + + + </section> + <section id="parse_date_delta"> + <input id="parse_date_delta-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse_date_delta</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">exp_class</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="o">~</span><span class="n">E</span><span class="p">]</span>,</span><span class="param"> <span class="n">unit_mapping</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">Callable</span><span class="p">[[</span><span class="n">Sequence</span><span class="p">],</span> <span class="o">~</span><span class="n">E</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="parse_date_delta-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#parse_date_delta"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="parse_date_delta-381"><a href="#parse_date_delta-381"><span class="linenos">381</span></a><span class="k">def</span> <span class="nf">parse_date_delta</span><span class="p">(</span> +</span><span id="parse_date_delta-382"><a href="#parse_date_delta-382"><span class="linenos">382</span></a> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">E</span><span class="p">],</span> <span class="n">unit_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="parse_date_delta-383"><a href="#parse_date_delta-383"><span class="linenos">383</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">],</span> <span class="n">E</span><span class="p">]:</span> +</span><span id="parse_date_delta-384"><a href="#parse_date_delta-384"><span class="linenos">384</span></a> <span class="k">def</span> <span class="nf">inner_func</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">)</span> <span class="o">-></span> <span class="n">E</span><span class="p">:</span> +</span><span id="parse_date_delta-385"><a href="#parse_date_delta-385"><span class="linenos">385</span></a> <span class="n">unit_based</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span> +</span><span id="parse_date_delta-386"><a href="#parse_date_delta-386"><span class="linenos">386</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_based</span> <span class="k">else</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="parse_date_delta-387"><a href="#parse_date_delta-387"><span class="linenos">387</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_based</span> <span class="k">else</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="parse_date_delta-388"><a href="#parse_date_delta-388"><span class="linenos">388</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_based</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">)</span> +</span><span id="parse_date_delta-389"><a href="#parse_date_delta-389"><span class="linenos">389</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">unit_mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span> <span class="n">unit</span><span class="p">)</span> <span class="k">if</span> <span class="n">unit_mapping</span> <span class="k">else</span> <span class="n">unit</span> <span class="c1"># type: ignore</span> +</span><span id="parse_date_delta-390"><a href="#parse_date_delta-390"><span class="linenos">390</span></a> <span class="k">return</span> <span class="n">exp_class</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">)</span> +</span><span id="parse_date_delta-391"><a href="#parse_date_delta-391"><span class="linenos">391</span></a> +</span><span id="parse_date_delta-392"><a href="#parse_date_delta-392"><span class="linenos">392</span></a> <span class="k">return</span> <span class="n">inner_func</span> +</span></pre></div> + + + + + </section> + <section id="locate_to_strposition"> + <input id="locate_to_strposition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">locate_to_strposition</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">args</span><span class="p">:</span> <span class="n">Sequence</span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="locate_to_strposition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#locate_to_strposition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="locate_to_strposition-395"><a href="#locate_to_strposition-395"><span class="linenos">395</span></a><span class="k">def</span> <span class="nf">locate_to_strposition</span><span class="p">(</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="locate_to_strposition-396"><a href="#locate_to_strposition-396"><span class="linenos">396</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="locate_to_strposition-397"><a href="#locate_to_strposition-397"><span class="linenos">397</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="locate_to_strposition-398"><a href="#locate_to_strposition-398"><span class="linenos">398</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="locate_to_strposition-399"><a href="#locate_to_strposition-399"><span class="linenos">399</span></a> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="locate_to_strposition-400"><a href="#locate_to_strposition-400"><span class="linenos">400</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="strposition_to_locate_sql"> + <input id="strposition_to_locate_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">strposition_to_locate_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="strposition_to_locate_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#strposition_to_locate_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="strposition_to_locate_sql-403"><a href="#strposition_to_locate_sql-403"><span class="linenos">403</span></a><span class="k">def</span> <span class="nf">strposition_to_locate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="strposition_to_locate_sql-404"><a href="#strposition_to_locate_sql-404"><span class="linenos">404</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="strposition_to_locate_sql-405"><a href="#strposition_to_locate_sql-405"><span class="linenos">405</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"substr"</span><span class="p">),</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"position"</span><span class="p">)</span> +</span><span id="strposition_to_locate_sql-406"><a href="#strposition_to_locate_sql-406"><span class="linenos">406</span></a> <span class="p">)</span> +</span><span id="strposition_to_locate_sql-407"><a href="#strposition_to_locate_sql-407"><span class="linenos">407</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LOCATE(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + <section id="timestrtotime_sql"> + <input id="timestrtotime_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">timestrtotime_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="timestrtotime_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#timestrtotime_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="timestrtotime_sql-410"><a href="#timestrtotime_sql-410"><span class="linenos">410</span></a><span class="k">def</span> <span class="nf">timestrtotime_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="timestrtotime_sql-411"><a href="#timestrtotime_sql-411"><span class="linenos">411</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span> +</span></pre></div> + + + + + </section> + <section id="datestrtodate_sql"> + <input id="datestrtodate_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">datestrtodate_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="datestrtodate_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#datestrtodate_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="datestrtodate_sql-414"><a href="#datestrtodate_sql-414"><span class="linenos">414</span></a><span class="k">def</span> <span class="nf">datestrtodate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="datestrtodate_sql-415"><a href="#datestrtodate_sql-415"><span class="linenos">415</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span></pre></div> + + + + + </section> + <section id="trim_sql"> + <input id="trim_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">trim_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Trim">sqlglot.expressions.Trim</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="trim_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#trim_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="trim_sql-418"><a href="#trim_sql-418"><span class="linenos">418</span></a><span class="k">def</span> <span class="nf">trim_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="trim_sql-419"><a href="#trim_sql-419"><span class="linenos">419</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="trim_sql-420"><a href="#trim_sql-420"><span class="linenos">420</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="trim_sql-421"><a href="#trim_sql-421"><span class="linenos">421</span></a> <span class="n">remove_chars</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="trim_sql-422"><a href="#trim_sql-422"><span class="linenos">422</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collation"</span><span class="p">)</span> +</span><span id="trim_sql-423"><a href="#trim_sql-423"><span class="linenos">423</span></a> +</span><span id="trim_sql-424"><a href="#trim_sql-424"><span class="linenos">424</span></a> <span class="c1"># Use TRIM/LTRIM/RTRIM syntax if the expression isn't database-specific</span> +</span><span id="trim_sql-425"><a href="#trim_sql-425"><span class="linenos">425</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">remove_chars</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">collation</span><span class="p">:</span> +</span><span id="trim_sql-426"><a href="#trim_sql-426"><span class="linenos">426</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">trim_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="trim_sql-427"><a href="#trim_sql-427"><span class="linenos">427</span></a> +</span><span id="trim_sql-428"><a href="#trim_sql-428"><span class="linenos">428</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">trim_type</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">trim_type</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="trim_sql-429"><a href="#trim_sql-429"><span class="linenos">429</span></a> <span class="n">remove_chars</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">remove_chars</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">remove_chars</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="trim_sql-430"><a href="#trim_sql-430"><span class="linenos">430</span></a> <span class="n">from_part</span> <span class="o">=</span> <span class="s2">"FROM "</span> <span class="k">if</span> <span class="n">trim_type</span> <span class="ow">or</span> <span class="n">remove_chars</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="trim_sql-431"><a href="#trim_sql-431"><span class="linenos">431</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collation</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collation</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="trim_sql-432"><a href="#trim_sql-432"><span class="linenos">432</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="n">trim_type</span><span class="si">}{</span><span class="n">remove_chars</span><span class="si">}{</span><span class="n">from_part</span><span class="si">}{</span><span class="n">target</span><span class="si">}{</span><span class="n">collation</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/drill.html b/docs/sqlglot/dialects/drill.html new file mode 100644 index 0000000..0cea591 --- /dev/null +++ b/docs/sqlglot/dialects/drill.html @@ -0,0 +1,1088 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.drill API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#if_sql">if_sql</a> + </li> + <li> + <a class="class" href="#Drill">Drill</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Drill.__init__">Drill</a> + </li> + <li> + <a class="class" href="#Drill.Tokenizer">Drill.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Drill.Parser">Drill.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Drill.Generator">Drill.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Drill.Generator.normalize_func">normalize_func</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/drill.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.drill </h1> + + + <input id="mod-drill-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-drill-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">re</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">format_time_lambda</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="p">)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="k">def</span> <span class="nf">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRPTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="k">def</span> <span class="nf">_ts_or_ds_to_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="ow">and</span> <span class="n">time_format</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">Drill</span><span class="o">.</span><span class="n">time_format</span><span class="p">,</span> <span class="n">Drill</span><span class="o">.</span><span class="n">date_format</span><span class="p">):</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a><span class="k">def</span> <span class="nf">_date_add_sql</span><span class="p">(</span><span class="n">kind</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">],</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">or</span> <span class="s2">"DAY"</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="sa">f</span><span class="s2">"DATE_</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">return</span> <span class="n">func</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="sd"> Drill requires backticks around certain SQL reserved words, IF being one of them, This function</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="sd"> adds the backticks around the keyword IF.</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="sd"> Args:</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="sd"> self: The Drill dialect</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> expression: The input IF expression</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> Returns: The expression with IF in backticks.</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> """</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"true"</span><span class="p">),</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="p">)</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"`IF`(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="k">def</span> <span class="nf">_str_to_date</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="o">==</span> <span class="n">Drill</span><span class="o">.</span><span class="n">date_format</span><span class="p">:</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_DATE(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">time_format</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="k">class</span> <span class="nc">Drill</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">normalize_functions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd'"</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">dateint_format</span> <span class="o">=</span> <span class="s2">"'yyyyMMdd'"</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd HH:mm:ss'"</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="s2">"MMM"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="s2">"hh"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="s2">"SSSSSS"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="s2">"a"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="s2">"E"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="s2">"EE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="s2">"EEE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="s2">"EEEE"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="s2">"''T''"</span><span class="p">:</span> <span class="s2">"T"</span><span class="p">,</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="p">}</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="s2">"utf-8"</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"drill"</span><span class="p">),</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="p">}</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="p">}</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="p">}</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REPEATED_CONTAINS"</span><span class="p">),</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REPEATED_COUNT"</span><span class="p">),</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(TO_DATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Drill</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Drill</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> `ILIKE` </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_MATCHES"</span><span class="p">),</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s1">'DAY'</span><span class="p">)))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="p">}</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="n">name</span> <span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SAFE_IDENTIFIER_RE</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">"`</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">`"</span> +</span></pre></div> + + + </section> + <section id="if_sql"> + <input id="if_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">if_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span><span class="p">:</span> <span class="n"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#If">sqlglot.expressions.If</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="if_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#if_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="if_sql-43"><a href="#if_sql-43"><span class="linenos">43</span></a><span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">:</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="if_sql-44"><a href="#if_sql-44"><span class="linenos">44</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="if_sql-45"><a href="#if_sql-45"><span class="linenos">45</span></a><span class="sd"> Drill requires backticks around certain SQL reserved words, IF being one of them, This function</span> +</span><span id="if_sql-46"><a href="#if_sql-46"><span class="linenos">46</span></a><span class="sd"> adds the backticks around the keyword IF.</span> +</span><span id="if_sql-47"><a href="#if_sql-47"><span class="linenos">47</span></a><span class="sd"> Args:</span> +</span><span id="if_sql-48"><a href="#if_sql-48"><span class="linenos">48</span></a><span class="sd"> self: The Drill dialect</span> +</span><span id="if_sql-49"><a href="#if_sql-49"><span class="linenos">49</span></a><span class="sd"> expression: The input IF expression</span> +</span><span id="if_sql-50"><a href="#if_sql-50"><span class="linenos">50</span></a> +</span><span id="if_sql-51"><a href="#if_sql-51"><span class="linenos">51</span></a><span class="sd"> Returns: The expression with IF in backticks.</span> +</span><span id="if_sql-52"><a href="#if_sql-52"><span class="linenos">52</span></a> +</span><span id="if_sql-53"><a href="#if_sql-53"><span class="linenos">53</span></a><span class="sd"> """</span> +</span><span id="if_sql-54"><a href="#if_sql-54"><span class="linenos">54</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span> +</span><span id="if_sql-55"><a href="#if_sql-55"><span class="linenos">55</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"true"</span><span class="p">),</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">)</span> +</span><span id="if_sql-56"><a href="#if_sql-56"><span class="linenos">56</span></a> <span class="p">)</span> +</span><span id="if_sql-57"><a href="#if_sql-57"><span class="linenos">57</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"`IF`(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + <div class="docstring"><p>Drill requires backticks around certain SQL reserved words, IF being one of them, This function +adds the backticks around the keyword IF.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>self:</strong> The Drill dialect</li> +<li><strong>expression:</strong> The input IF expression</li> +</ul> + +<p>Returns: The expression with IF in backticks.</p> +</div> + + + </section> + <section id="Drill"> + <input id="Drill-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Drill</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Drill-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Drill"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Drill-68"><a href="#Drill-68"><span class="linenos"> 68</span></a><span class="k">class</span> <span class="nc">Drill</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Drill-69"><a href="#Drill-69"><span class="linenos"> 69</span></a> <span class="n">normalize_functions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Drill-70"><a href="#Drill-70"><span class="linenos"> 70</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="Drill-71"><a href="#Drill-71"><span class="linenos"> 71</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd'"</span> +</span><span id="Drill-72"><a href="#Drill-72"><span class="linenos"> 72</span></a> <span class="n">dateint_format</span> <span class="o">=</span> <span class="s2">"'yyyyMMdd'"</span> +</span><span id="Drill-73"><a href="#Drill-73"><span class="linenos"> 73</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd HH:mm:ss'"</span> +</span><span id="Drill-74"><a href="#Drill-74"><span class="linenos"> 74</span></a> +</span><span id="Drill-75"><a href="#Drill-75"><span class="linenos"> 75</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill-76"><a href="#Drill-76"><span class="linenos"> 76</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Drill-77"><a href="#Drill-77"><span class="linenos"> 77</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Drill-78"><a href="#Drill-78"><span class="linenos"> 78</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Drill-79"><a href="#Drill-79"><span class="linenos"> 79</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Drill-80"><a href="#Drill-80"><span class="linenos"> 80</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="Drill-81"><a href="#Drill-81"><span class="linenos"> 81</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="Drill-82"><a href="#Drill-82"><span class="linenos"> 82</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="Drill-83"><a href="#Drill-83"><span class="linenos"> 83</span></a> <span class="s2">"MMM"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="Drill-84"><a href="#Drill-84"><span class="linenos"> 84</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="Drill-85"><a href="#Drill-85"><span class="linenos"> 85</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="Drill-86"><a href="#Drill-86"><span class="linenos"> 86</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-87"><a href="#Drill-87"><span class="linenos"> 87</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-88"><a href="#Drill-88"><span class="linenos"> 88</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="Drill-89"><a href="#Drill-89"><span class="linenos"> 89</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="Drill-90"><a href="#Drill-90"><span class="linenos"> 90</span></a> <span class="s2">"hh"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="Drill-91"><a href="#Drill-91"><span class="linenos"> 91</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="Drill-92"><a href="#Drill-92"><span class="linenos"> 92</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="Drill-93"><a href="#Drill-93"><span class="linenos"> 93</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="Drill-94"><a href="#Drill-94"><span class="linenos"> 94</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="Drill-95"><a href="#Drill-95"><span class="linenos"> 95</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="Drill-96"><a href="#Drill-96"><span class="linenos"> 96</span></a> <span class="s2">"SSSSSS"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-97"><a href="#Drill-97"><span class="linenos"> 97</span></a> <span class="s2">"a"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="Drill-98"><a href="#Drill-98"><span class="linenos"> 98</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> +</span><span id="Drill-99"><a href="#Drill-99"><span class="linenos"> 99</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> +</span><span id="Drill-100"><a href="#Drill-100"><span class="linenos">100</span></a> <span class="s2">"E"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-101"><a href="#Drill-101"><span class="linenos">101</span></a> <span class="s2">"EE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-102"><a href="#Drill-102"><span class="linenos">102</span></a> <span class="s2">"EEE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-103"><a href="#Drill-103"><span class="linenos">103</span></a> <span class="s2">"EEEE"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="Drill-104"><a href="#Drill-104"><span class="linenos">104</span></a> <span class="s2">"''T''"</span><span class="p">:</span> <span class="s2">"T"</span><span class="p">,</span> +</span><span id="Drill-105"><a href="#Drill-105"><span class="linenos">105</span></a> <span class="p">}</span> +</span><span id="Drill-106"><a href="#Drill-106"><span class="linenos">106</span></a> +</span><span id="Drill-107"><a href="#Drill-107"><span class="linenos">107</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Drill-108"><a href="#Drill-108"><span class="linenos">108</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="Drill-109"><a href="#Drill-109"><span class="linenos">109</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="Drill-110"><a href="#Drill-110"><span class="linenos">110</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Drill-111"><a href="#Drill-111"><span class="linenos">111</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="s2">"utf-8"</span> +</span><span id="Drill-112"><a href="#Drill-112"><span class="linenos">112</span></a> +</span><span id="Drill-113"><a href="#Drill-113"><span class="linenos">113</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Drill-114"><a href="#Drill-114"><span class="linenos">114</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Drill-115"><a href="#Drill-115"><span class="linenos">115</span></a> +</span><span id="Drill-116"><a href="#Drill-116"><span class="linenos">116</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill-117"><a href="#Drill-117"><span class="linenos">117</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill-118"><a href="#Drill-118"><span class="linenos">118</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Drill-119"><a href="#Drill-119"><span class="linenos">119</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"drill"</span><span class="p">),</span> +</span><span id="Drill-120"><a href="#Drill-120"><span class="linenos">120</span></a> <span class="p">}</span> +</span><span id="Drill-121"><a href="#Drill-121"><span class="linenos">121</span></a> +</span><span id="Drill-122"><a href="#Drill-122"><span class="linenos">122</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Drill-123"><a href="#Drill-123"><span class="linenos">123</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill-124"><a href="#Drill-124"><span class="linenos">124</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill-125"><a href="#Drill-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Drill-126"><a href="#Drill-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Drill-127"><a href="#Drill-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Drill-128"><a href="#Drill-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="Drill-129"><a href="#Drill-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Drill-130"><a href="#Drill-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Drill-131"><a href="#Drill-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill-132"><a href="#Drill-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill-133"><a href="#Drill-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill-134"><a href="#Drill-134"><span class="linenos">134</span></a> <span class="p">}</span> +</span><span id="Drill-135"><a href="#Drill-135"><span class="linenos">135</span></a> +</span><span id="Drill-136"><a href="#Drill-136"><span class="linenos">136</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill-137"><a href="#Drill-137"><span class="linenos">137</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill-138"><a href="#Drill-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Drill-139"><a href="#Drill-139"><span class="linenos">139</span></a> <span class="p">}</span> +</span><span id="Drill-140"><a href="#Drill-140"><span class="linenos">140</span></a> +</span><span id="Drill-141"><a href="#Drill-141"><span class="linenos">141</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill-142"><a href="#Drill-142"><span class="linenos">142</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill-143"><a href="#Drill-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill-144"><a href="#Drill-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REPEATED_CONTAINS"</span><span class="p">),</span> +</span><span id="Drill-145"><a href="#Drill-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REPEATED_COUNT"</span><span class="p">),</span> +</span><span id="Drill-146"><a href="#Drill-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="Drill-147"><a href="#Drill-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="Drill-148"><a href="#Drill-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="Drill-149"><a href="#Drill-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="Drill-150"><a href="#Drill-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(TO_DATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Drill</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Drill-151"><a href="#Drill-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Drill</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill-152"><a href="#Drill-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="Drill-153"><a href="#Drill-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> `ILIKE` </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-154"><a href="#Drill-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="Drill-155"><a href="#Drill-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill-156"><a href="#Drill-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="Drill-157"><a href="#Drill-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_MATCHES"</span><span class="p">),</span> +</span><span id="Drill-158"><a href="#Drill-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="Drill-159"><a href="#Drill-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="Drill-160"><a href="#Drill-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill-161"><a href="#Drill-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="Drill-162"><a href="#Drill-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Drill-163"><a href="#Drill-163"><span class="linenos">163</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Drill-164"><a href="#Drill-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill-165"><a href="#Drill-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Drill-166"><a href="#Drill-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="Drill-167"><a href="#Drill-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s1">'DAY'</span><span class="p">)))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill-168"><a href="#Drill-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="Drill-169"><a href="#Drill-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Drill-170"><a href="#Drill-170"><span class="linenos">170</span></a> <span class="p">}</span> +</span><span id="Drill-171"><a href="#Drill-171"><span class="linenos">171</span></a> +</span><span id="Drill-172"><a href="#Drill-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Drill-173"><a href="#Drill-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="n">name</span> <span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SAFE_IDENTIFIER_RE</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">"`</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">`"</span> +</span></pre></div> + + + + + <div id="Drill.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Drill</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Drill.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Drill.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Drill.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Drill.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Drill.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Drill.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Drill.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Drill.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Drill.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Drill.Tokenizer"> + <input id="Drill.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Drill.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Drill.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Drill.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Drill.Tokenizer-107"><a href="#Drill.Tokenizer-107"><span class="linenos">107</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Drill.Tokenizer-108"><a href="#Drill.Tokenizer-108"><span class="linenos">108</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="Drill.Tokenizer-109"><a href="#Drill.Tokenizer-109"><span class="linenos">109</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="Drill.Tokenizer-110"><a href="#Drill.Tokenizer-110"><span class="linenos">110</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Drill.Tokenizer-111"><a href="#Drill.Tokenizer-111"><span class="linenos">111</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="s2">"utf-8"</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Drill.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Drill.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Drill.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Drill.Parser"> + <input id="Drill.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Drill.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Drill.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Drill.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Drill.Parser-113"><a href="#Drill.Parser-113"><span class="linenos">113</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Drill.Parser-114"><a href="#Drill.Parser-114"><span class="linenos">114</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Drill.Parser-115"><a href="#Drill.Parser-115"><span class="linenos">115</span></a> +</span><span id="Drill.Parser-116"><a href="#Drill.Parser-116"><span class="linenos">116</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill.Parser-117"><a href="#Drill.Parser-117"><span class="linenos">117</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill.Parser-118"><a href="#Drill.Parser-118"><span class="linenos">118</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Drill.Parser-119"><a href="#Drill.Parser-119"><span class="linenos">119</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"drill"</span><span class="p">),</span> +</span><span id="Drill.Parser-120"><a href="#Drill.Parser-120"><span class="linenos">120</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Drill.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Drill.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Drill.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Drill.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Drill.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Drill.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Drill.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Drill.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Drill.Generator"> + <input id="Drill.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Drill.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Drill.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Drill.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Drill.Generator-122"><a href="#Drill.Generator-122"><span class="linenos">122</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Drill.Generator-123"><a href="#Drill.Generator-123"><span class="linenos">123</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill.Generator-124"><a href="#Drill.Generator-124"><span class="linenos">124</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill.Generator-125"><a href="#Drill.Generator-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Drill.Generator-126"><a href="#Drill.Generator-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Drill.Generator-127"><a href="#Drill.Generator-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Drill.Generator-128"><a href="#Drill.Generator-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="Drill.Generator-129"><a href="#Drill.Generator-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Drill.Generator-130"><a href="#Drill.Generator-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Drill.Generator-131"><a href="#Drill.Generator-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill.Generator-132"><a href="#Drill.Generator-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill.Generator-133"><a href="#Drill.Generator-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill.Generator-134"><a href="#Drill.Generator-134"><span class="linenos">134</span></a> <span class="p">}</span> +</span><span id="Drill.Generator-135"><a href="#Drill.Generator-135"><span class="linenos">135</span></a> +</span><span id="Drill.Generator-136"><a href="#Drill.Generator-136"><span class="linenos">136</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill.Generator-137"><a href="#Drill.Generator-137"><span class="linenos">137</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill.Generator-138"><a href="#Drill.Generator-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Drill.Generator-139"><a href="#Drill.Generator-139"><span class="linenos">139</span></a> <span class="p">}</span> +</span><span id="Drill.Generator-140"><a href="#Drill.Generator-140"><span class="linenos">140</span></a> +</span><span id="Drill.Generator-141"><a href="#Drill.Generator-141"><span class="linenos">141</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drill.Generator-142"><a href="#Drill.Generator-142"><span class="linenos">142</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Drill.Generator-143"><a href="#Drill.Generator-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Drill.Generator-144"><a href="#Drill.Generator-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REPEATED_CONTAINS"</span><span class="p">),</span> +</span><span id="Drill.Generator-145"><a href="#Drill.Generator-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REPEATED_COUNT"</span><span class="p">),</span> +</span><span id="Drill.Generator-146"><a href="#Drill.Generator-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-147"><a href="#Drill.Generator-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="Drill.Generator-148"><a href="#Drill.Generator-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-149"><a href="#Drill.Generator-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="Drill.Generator-150"><a href="#Drill.Generator-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(TO_DATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Drill</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Drill.Generator-151"><a href="#Drill.Generator-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Drill</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill.Generator-152"><a href="#Drill.Generator-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-153"><a href="#Drill.Generator-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> `ILIKE` </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill.Generator-154"><a href="#Drill.Generator-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="Drill.Generator-155"><a href="#Drill.Generator-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Drill.Generator-156"><a href="#Drill.Generator-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-157"><a href="#Drill.Generator-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_MATCHES"</span><span class="p">),</span> +</span><span id="Drill.Generator-158"><a href="#Drill.Generator-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-159"><a href="#Drill.Generator-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="Drill.Generator-160"><a href="#Drill.Generator-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill.Generator-161"><a href="#Drill.Generator-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="Drill.Generator-162"><a href="#Drill.Generator-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-163"><a href="#Drill.Generator-163"><span class="linenos">163</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Drill.Generator-164"><a href="#Drill.Generator-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill.Generator-165"><a href="#Drill.Generator-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Drill.Generator-166"><a href="#Drill.Generator-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-167"><a href="#Drill.Generator-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s1">'DAY'</span><span class="p">)))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Drill.Generator-168"><a href="#Drill.Generator-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="Drill.Generator-169"><a href="#Drill.Generator-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Drill.Generator-170"><a href="#Drill.Generator-170"><span class="linenos">170</span></a> <span class="p">}</span> +</span><span id="Drill.Generator-171"><a href="#Drill.Generator-171"><span class="linenos">171</span></a> +</span><span id="Drill.Generator-172"><a href="#Drill.Generator-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Drill.Generator-173"><a href="#Drill.Generator-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="n">name</span> <span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SAFE_IDENTIFIER_RE</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">"`</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">`"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Drill.Generator.normalize_func" class="classattr"> + <input id="Drill.Generator.normalize_func-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">normalize_func</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">name</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Drill.Generator.normalize_func-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Drill.Generator.normalize_func"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Drill.Generator.normalize_func-172"><a href="#Drill.Generator.normalize_func-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Drill.Generator.normalize_func-173"><a href="#Drill.Generator.normalize_func-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="n">name</span> <span class="k">if</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SAFE_IDENTIFIER_RE</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">"`</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">`"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Drill.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Drill.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Drill.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Drill.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Drill.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Drill.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Drill.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Drill.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Drill.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Drill.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Drill.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Drill.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Drill.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Drill.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Drill.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Drill.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Drill.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Drill.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Drill.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Drill.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Drill.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Drill.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Drill.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Drill.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Drill.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Drill.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Drill.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Drill.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Drill.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Drill.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Drill.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Drill.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Drill.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Drill.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Drill.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Drill.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Drill.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Drill.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Drill.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Drill.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Drill.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Drill.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Drill.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Drill.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Drill.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Drill.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Drill.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Drill.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Drill.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Drill.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Drill.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Drill.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Drill.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Drill.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Drill.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Drill.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Drill.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Drill.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Drill.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Drill.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Drill.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Drill.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Drill.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Drill.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Drill.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Drill.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Drill.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Drill.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Drill.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Drill.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Drill.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Drill.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Drill.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Drill.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Drill.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Drill.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Drill.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Drill.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Drill.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Drill.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Drill.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Drill.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Drill.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Drill.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Drill.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Drill.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Drill.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Drill.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Drill.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Drill.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Drill.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Drill.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Drill.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Drill.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Drill.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Drill.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Drill.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Drill.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Drill.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Drill.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Drill.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Drill.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Drill.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Drill.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Drill.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Drill.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Drill.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Drill.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Drill.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Drill.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Drill.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Drill.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Drill.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Drill.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Drill.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Drill.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Drill.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Drill.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Drill.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Drill.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Drill.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Drill.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Drill.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Drill.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Drill.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Drill.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Drill.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Drill.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Drill.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Drill.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Drill.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Drill.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Drill.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Drill.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Drill.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Drill.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Drill.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Drill.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Drill.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Drill.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Drill.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Drill.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Drill.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Drill.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Drill.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Drill.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Drill.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Drill.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Drill.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Drill.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Drill.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Drill.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Drill.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Drill.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Drill.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Drill.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Drill.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Drill.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Drill.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Drill.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Drill.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Drill.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Drill.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Drill.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Drill.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Drill.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Drill.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Drill.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Drill.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Drill.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Drill.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Drill.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Drill.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Drill.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Drill.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Drill.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Drill.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Drill.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Drill.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Drill.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Drill.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Drill.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Drill.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Drill.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Drill.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Drill.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Drill.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Drill.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Drill.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Drill.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Drill.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Drill.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Drill.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Drill.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Drill.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Drill.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Drill.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Drill.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Drill.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Drill.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/duckdb.html b/docs/sqlglot/dialects/duckdb.html new file mode 100644 index 0000000..8aa1a1b --- /dev/null +++ b/docs/sqlglot/dialects/duckdb.html @@ -0,0 +1,1028 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.duckdb API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#DuckDB">DuckDB</a> + <ul class="memberlist"> + <li> + <a class="function" href="#DuckDB.__init__">DuckDB</a> + </li> + <li> + <a class="class" href="#DuckDB.Tokenizer">DuckDB.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DuckDB.Parser">DuckDB.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DuckDB.Generator">DuckDB.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/duckdb.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.duckdb </h1> + + + <input id="mod-duckdb-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-duckdb-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">format_time_lambda</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">no_properties_sql</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="p">)</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="k">def</span> <span class="nf">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRPTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="k">def</span> <span class="nf">_ts_or_ds_add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">(</span><span class="s2">"'"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AS DATE) + </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="k">def</span> <span class="nf">_ts_or_ds_to_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="ow">and</span> <span class="n">time_format</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">time_format</span><span class="p">,</span> <span class="n">DuckDB</span><span class="o">.</span><span class="n">date_format</span><span class="p">):</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="k">def</span> <span class="nf">_date_add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">(</span><span class="s2">"'"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"DAY"</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> + </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="k">def</span> <span class="nf">_array_sort_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"DUCKDB ARRAY_SORT does not support a comparator"</span><span class="p">)</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY_SORT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="k">def</span> <span class="nf">_sort_array_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"asc"</span><span class="p">)</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">():</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY_REVERSE_SORT(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY_SORT(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="k">def</span> <span class="nf">_sort_array_reverse</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">asc</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">())</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="k">def</span> <span class="nf">_struct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">': </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="p">]</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="se">{{</span><span class="si">{</span><span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="se">}}</span><span class="s2">"</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a><span class="k">def</span> <span class="nf">_datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">:</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">[]"</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="k">class</span> <span class="nc">DuckDB</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="s2">":="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="s2">"CHARACTER VARYING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="p">}</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="s2">"ARRAY_LENGTH"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="s2">"ARRAY_SORT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="s2">"ARRAY_REVERSE_SORT"</span><span class="p">:</span> <span class="n">_sort_array_reverse</span><span class="p">,</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="s2">"EPOCH"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="s2">"EPOCH_MS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">(</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">(</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1000</span><span class="p">),</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="p">),</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="s2">"LIST_SORT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="s2">"LIST_REVERSE_SORT"</span><span class="p">:</span> <span class="n">_sort_array_reverse</span><span class="p">,</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="s2">"LIST_VALUE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="s2">"REGEXP_MATCHES"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="s2">"STRFTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"duckdb"</span><span class="p">),</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="s2">"STRPTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"duckdb"</span><span class="p">),</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="s2">"STR_SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="s2">"STRING_SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="s2">"STRING_TO_ARRAY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="s2">"STR_SPLIT_REGEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="s2">"STRING_SPLIT_REGEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="s2">"STRUCT_PACK"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="s2">"UNNEST"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="p">}</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">else</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LIST_VALUE"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_LENGTH"</span><span class="p">),</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">:</span> <span class="n">_array_sort_sql</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LIST_SUM"</span><span class="p">),</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(STRFTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(STRPTIME(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TEXT), </span><span class="si">{</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNNEST"</span><span class="p">),</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">:</span> <span class="n">no_properties_sql</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_MATCHES"</span><span class="p">),</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STR_SPLIT_REGEX"</span><span class="p">),</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STR_SPLIT"</span><span class="p">),</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_sort_array_sql</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EPOCH(STRPTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">:</span> <span class="n">_struct_sql</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EPOCH(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP))"</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STRFTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"EPOCH"</span><span class="p">),</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TEXT), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STRFTIME(TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_TIMESTAMP"</span><span class="p">),</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS TEXT)"</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="p">}</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="p">}</span> +</span></pre></div> + + + </section> + <section id="DuckDB"> + <input id="DuckDB-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DuckDB</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="DuckDB-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DuckDB"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DuckDB-77"><a href="#DuckDB-77"><span class="linenos"> 77</span></a><span class="k">class</span> <span class="nc">DuckDB</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="DuckDB-78"><a href="#DuckDB-78"><span class="linenos"> 78</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="DuckDB-79"><a href="#DuckDB-79"><span class="linenos"> 79</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB-80"><a href="#DuckDB-80"><span class="linenos"> 80</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="DuckDB-81"><a href="#DuckDB-81"><span class="linenos"> 81</span></a> <span class="s2">":="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="DuckDB-82"><a href="#DuckDB-82"><span class="linenos"> 82</span></a> <span class="s2">"CHARACTER VARYING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="DuckDB-83"><a href="#DuckDB-83"><span class="linenos"> 83</span></a> <span class="p">}</span> +</span><span id="DuckDB-84"><a href="#DuckDB-84"><span class="linenos"> 84</span></a> +</span><span id="DuckDB-85"><a href="#DuckDB-85"><span class="linenos"> 85</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="DuckDB-86"><a href="#DuckDB-86"><span class="linenos"> 86</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB-87"><a href="#DuckDB-87"><span class="linenos"> 87</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="DuckDB-88"><a href="#DuckDB-88"><span class="linenos"> 88</span></a> <span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-89"><a href="#DuckDB-89"><span class="linenos"> 89</span></a> <span class="s2">"ARRAY_LENGTH"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-90"><a href="#DuckDB-90"><span class="linenos"> 90</span></a> <span class="s2">"ARRAY_SORT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-91"><a href="#DuckDB-91"><span class="linenos"> 91</span></a> <span class="s2">"ARRAY_REVERSE_SORT"</span><span class="p">:</span> <span class="n">_sort_array_reverse</span><span class="p">,</span> +</span><span id="DuckDB-92"><a href="#DuckDB-92"><span class="linenos"> 92</span></a> <span class="s2">"EPOCH"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-93"><a href="#DuckDB-93"><span class="linenos"> 93</span></a> <span class="s2">"EPOCH_MS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">(</span> +</span><span id="DuckDB-94"><a href="#DuckDB-94"><span class="linenos"> 94</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">(</span> +</span><span id="DuckDB-95"><a href="#DuckDB-95"><span class="linenos"> 95</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="DuckDB-96"><a href="#DuckDB-96"><span class="linenos"> 96</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1000</span><span class="p">),</span> +</span><span id="DuckDB-97"><a href="#DuckDB-97"><span class="linenos"> 97</span></a> <span class="p">)</span> +</span><span id="DuckDB-98"><a href="#DuckDB-98"><span class="linenos"> 98</span></a> <span class="p">),</span> +</span><span id="DuckDB-99"><a href="#DuckDB-99"><span class="linenos"> 99</span></a> <span class="s2">"LIST_SORT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-100"><a href="#DuckDB-100"><span class="linenos">100</span></a> <span class="s2">"LIST_REVERSE_SORT"</span><span class="p">:</span> <span class="n">_sort_array_reverse</span><span class="p">,</span> +</span><span id="DuckDB-101"><a href="#DuckDB-101"><span class="linenos">101</span></a> <span class="s2">"LIST_VALUE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-102"><a href="#DuckDB-102"><span class="linenos">102</span></a> <span class="s2">"REGEXP_MATCHES"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-103"><a href="#DuckDB-103"><span class="linenos">103</span></a> <span class="s2">"STRFTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"duckdb"</span><span class="p">),</span> +</span><span id="DuckDB-104"><a href="#DuckDB-104"><span class="linenos">104</span></a> <span class="s2">"STRPTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"duckdb"</span><span class="p">),</span> +</span><span id="DuckDB-105"><a href="#DuckDB-105"><span class="linenos">105</span></a> <span class="s2">"STR_SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-106"><a href="#DuckDB-106"><span class="linenos">106</span></a> <span class="s2">"STRING_SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-107"><a href="#DuckDB-107"><span class="linenos">107</span></a> <span class="s2">"STRING_TO_ARRAY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-108"><a href="#DuckDB-108"><span class="linenos">108</span></a> <span class="s2">"STR_SPLIT_REGEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-109"><a href="#DuckDB-109"><span class="linenos">109</span></a> <span class="s2">"STRING_SPLIT_REGEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-110"><a href="#DuckDB-110"><span class="linenos">110</span></a> <span class="s2">"STRUCT_PACK"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-111"><a href="#DuckDB-111"><span class="linenos">111</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-112"><a href="#DuckDB-112"><span class="linenos">112</span></a> <span class="s2">"UNNEST"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB-113"><a href="#DuckDB-113"><span class="linenos">113</span></a> <span class="p">}</span> +</span><span id="DuckDB-114"><a href="#DuckDB-114"><span class="linenos">114</span></a> +</span><span id="DuckDB-115"><a href="#DuckDB-115"><span class="linenos">115</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="DuckDB-116"><a href="#DuckDB-116"><span class="linenos">116</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="DuckDB-117"><a href="#DuckDB-117"><span class="linenos">117</span></a> +</span><span id="DuckDB-118"><a href="#DuckDB-118"><span class="linenos">118</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB-119"><a href="#DuckDB-119"><span class="linenos">119</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="DuckDB-120"><a href="#DuckDB-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="DuckDB-121"><a href="#DuckDB-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="DuckDB-122"><a href="#DuckDB-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="DuckDB-123"><a href="#DuckDB-123"><span class="linenos">123</span></a> <span class="k">else</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LIST_VALUE"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">),</span> +</span><span id="DuckDB-124"><a href="#DuckDB-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_LENGTH"</span><span class="p">),</span> +</span><span id="DuckDB-125"><a href="#DuckDB-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">:</span> <span class="n">_array_sort_sql</span><span class="p">,</span> +</span><span id="DuckDB-126"><a href="#DuckDB-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LIST_SUM"</span><span class="p">),</span> +</span><span id="DuckDB-127"><a href="#DuckDB-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="DuckDB-128"><a href="#DuckDB-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">,</span> +</span><span id="DuckDB-129"><a href="#DuckDB-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="DuckDB-130"><a href="#DuckDB-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="DuckDB-131"><a href="#DuckDB-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(STRFTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="DuckDB-132"><a href="#DuckDB-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(STRPTIME(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TEXT), </span><span class="si">{</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="DuckDB-133"><a href="#DuckDB-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNNEST"</span><span class="p">),</span> +</span><span id="DuckDB-134"><a href="#DuckDB-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="DuckDB-135"><a href="#DuckDB-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="DuckDB-136"><a href="#DuckDB-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="DuckDB-137"><a href="#DuckDB-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="DuckDB-138"><a href="#DuckDB-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="DuckDB-139"><a href="#DuckDB-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="DuckDB-140"><a href="#DuckDB-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">:</span> <span class="n">no_properties_sql</span><span class="p">,</span> +</span><span id="DuckDB-141"><a href="#DuckDB-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_MATCHES"</span><span class="p">),</span> +</span><span id="DuckDB-142"><a href="#DuckDB-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STR_SPLIT_REGEX"</span><span class="p">),</span> +</span><span id="DuckDB-143"><a href="#DuckDB-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="DuckDB-144"><a href="#DuckDB-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STR_SPLIT"</span><span class="p">),</span> +</span><span id="DuckDB-145"><a href="#DuckDB-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_sort_array_sql</span><span class="p">,</span> +</span><span id="DuckDB-146"><a href="#DuckDB-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="DuckDB-147"><a href="#DuckDB-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="DuckDB-148"><a href="#DuckDB-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="DuckDB-149"><a href="#DuckDB-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EPOCH(STRPTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="DuckDB-150"><a href="#DuckDB-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">:</span> <span class="n">_struct_sql</span><span class="p">,</span> +</span><span id="DuckDB-151"><a href="#DuckDB-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="DuckDB-152"><a href="#DuckDB-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="DuckDB-153"><a href="#DuckDB-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="DuckDB-154"><a href="#DuckDB-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EPOCH(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP))"</span><span class="p">,</span> +</span><span id="DuckDB-155"><a href="#DuckDB-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STRFTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="DuckDB-156"><a href="#DuckDB-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"EPOCH"</span><span class="p">),</span> +</span><span id="DuckDB-157"><a href="#DuckDB-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TEXT), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="DuckDB-158"><a href="#DuckDB-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add</span><span class="p">,</span> +</span><span id="DuckDB-159"><a href="#DuckDB-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="DuckDB-160"><a href="#DuckDB-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STRFTIME(TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="DuckDB-161"><a href="#DuckDB-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_TIMESTAMP"</span><span class="p">),</span> +</span><span id="DuckDB-162"><a href="#DuckDB-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS TEXT)"</span><span class="p">,</span> +</span><span id="DuckDB-163"><a href="#DuckDB-163"><span class="linenos">163</span></a> <span class="p">}</span> +</span><span id="DuckDB-164"><a href="#DuckDB-164"><span class="linenos">164</span></a> +</span><span id="DuckDB-165"><a href="#DuckDB-165"><span class="linenos">165</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB-166"><a href="#DuckDB-166"><span class="linenos">166</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="DuckDB-167"><a href="#DuckDB-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="DuckDB-168"><a href="#DuckDB-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="DuckDB-169"><a href="#DuckDB-169"><span class="linenos">169</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div id="DuckDB.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">DuckDB</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#DuckDB.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="DuckDB.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="DuckDB.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="DuckDB.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="DuckDB.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="DuckDB.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="DuckDB.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="DuckDB.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="DuckDB.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DuckDB.Tokenizer"> + <input id="DuckDB.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DuckDB.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="DuckDB.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DuckDB.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DuckDB.Tokenizer-78"><a href="#DuckDB.Tokenizer-78"><span class="linenos">78</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="DuckDB.Tokenizer-79"><a href="#DuckDB.Tokenizer-79"><span class="linenos">79</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB.Tokenizer-80"><a href="#DuckDB.Tokenizer-80"><span class="linenos">80</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="DuckDB.Tokenizer-81"><a href="#DuckDB.Tokenizer-81"><span class="linenos">81</span></a> <span class="s2">":="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="DuckDB.Tokenizer-82"><a href="#DuckDB.Tokenizer-82"><span class="linenos">82</span></a> <span class="s2">"CHARACTER VARYING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="DuckDB.Tokenizer-83"><a href="#DuckDB.Tokenizer-83"><span class="linenos">83</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="DuckDB.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="DuckDB.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="DuckDB.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DuckDB.Parser"> + <input id="DuckDB.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DuckDB.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="DuckDB.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DuckDB.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DuckDB.Parser-85"><a href="#DuckDB.Parser-85"><span class="linenos"> 85</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="DuckDB.Parser-86"><a href="#DuckDB.Parser-86"><span class="linenos"> 86</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB.Parser-87"><a href="#DuckDB.Parser-87"><span class="linenos"> 87</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="DuckDB.Parser-88"><a href="#DuckDB.Parser-88"><span class="linenos"> 88</span></a> <span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-89"><a href="#DuckDB.Parser-89"><span class="linenos"> 89</span></a> <span class="s2">"ARRAY_LENGTH"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-90"><a href="#DuckDB.Parser-90"><span class="linenos"> 90</span></a> <span class="s2">"ARRAY_SORT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-91"><a href="#DuckDB.Parser-91"><span class="linenos"> 91</span></a> <span class="s2">"ARRAY_REVERSE_SORT"</span><span class="p">:</span> <span class="n">_sort_array_reverse</span><span class="p">,</span> +</span><span id="DuckDB.Parser-92"><a href="#DuckDB.Parser-92"><span class="linenos"> 92</span></a> <span class="s2">"EPOCH"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-93"><a href="#DuckDB.Parser-93"><span class="linenos"> 93</span></a> <span class="s2">"EPOCH_MS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">(</span> +</span><span id="DuckDB.Parser-94"><a href="#DuckDB.Parser-94"><span class="linenos"> 94</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">(</span> +</span><span id="DuckDB.Parser-95"><a href="#DuckDB.Parser-95"><span class="linenos"> 95</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="DuckDB.Parser-96"><a href="#DuckDB.Parser-96"><span class="linenos"> 96</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1000</span><span class="p">),</span> +</span><span id="DuckDB.Parser-97"><a href="#DuckDB.Parser-97"><span class="linenos"> 97</span></a> <span class="p">)</span> +</span><span id="DuckDB.Parser-98"><a href="#DuckDB.Parser-98"><span class="linenos"> 98</span></a> <span class="p">),</span> +</span><span id="DuckDB.Parser-99"><a href="#DuckDB.Parser-99"><span class="linenos"> 99</span></a> <span class="s2">"LIST_SORT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-100"><a href="#DuckDB.Parser-100"><span class="linenos">100</span></a> <span class="s2">"LIST_REVERSE_SORT"</span><span class="p">:</span> <span class="n">_sort_array_reverse</span><span class="p">,</span> +</span><span id="DuckDB.Parser-101"><a href="#DuckDB.Parser-101"><span class="linenos">101</span></a> <span class="s2">"LIST_VALUE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-102"><a href="#DuckDB.Parser-102"><span class="linenos">102</span></a> <span class="s2">"REGEXP_MATCHES"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-103"><a href="#DuckDB.Parser-103"><span class="linenos">103</span></a> <span class="s2">"STRFTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"duckdb"</span><span class="p">),</span> +</span><span id="DuckDB.Parser-104"><a href="#DuckDB.Parser-104"><span class="linenos">104</span></a> <span class="s2">"STRPTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"duckdb"</span><span class="p">),</span> +</span><span id="DuckDB.Parser-105"><a href="#DuckDB.Parser-105"><span class="linenos">105</span></a> <span class="s2">"STR_SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-106"><a href="#DuckDB.Parser-106"><span class="linenos">106</span></a> <span class="s2">"STRING_SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-107"><a href="#DuckDB.Parser-107"><span class="linenos">107</span></a> <span class="s2">"STRING_TO_ARRAY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-108"><a href="#DuckDB.Parser-108"><span class="linenos">108</span></a> <span class="s2">"STR_SPLIT_REGEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-109"><a href="#DuckDB.Parser-109"><span class="linenos">109</span></a> <span class="s2">"STRING_SPLIT_REGEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-110"><a href="#DuckDB.Parser-110"><span class="linenos">110</span></a> <span class="s2">"STRUCT_PACK"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-111"><a href="#DuckDB.Parser-111"><span class="linenos">111</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-112"><a href="#DuckDB.Parser-112"><span class="linenos">112</span></a> <span class="s2">"UNNEST"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="DuckDB.Parser-113"><a href="#DuckDB.Parser-113"><span class="linenos">113</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="DuckDB.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="DuckDB.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="DuckDB.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="DuckDB.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="DuckDB.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="DuckDB.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="DuckDB.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="DuckDB.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DuckDB.Generator"> + <input id="DuckDB.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DuckDB.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="DuckDB.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DuckDB.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DuckDB.Generator-115"><a href="#DuckDB.Generator-115"><span class="linenos">115</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="DuckDB.Generator-116"><a href="#DuckDB.Generator-116"><span class="linenos">116</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="DuckDB.Generator-117"><a href="#DuckDB.Generator-117"><span class="linenos">117</span></a> +</span><span id="DuckDB.Generator-118"><a href="#DuckDB.Generator-118"><span class="linenos">118</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB.Generator-119"><a href="#DuckDB.Generator-119"><span class="linenos">119</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="DuckDB.Generator-120"><a href="#DuckDB.Generator-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-121"><a href="#DuckDB.Generator-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="DuckDB.Generator-122"><a href="#DuckDB.Generator-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="DuckDB.Generator-123"><a href="#DuckDB.Generator-123"><span class="linenos">123</span></a> <span class="k">else</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LIST_VALUE"</span><span class="p">)(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">),</span> +</span><span id="DuckDB.Generator-124"><a href="#DuckDB.Generator-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_LENGTH"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-125"><a href="#DuckDB.Generator-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">:</span> <span class="n">_array_sort_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-126"><a href="#DuckDB.Generator-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LIST_SUM"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-127"><a href="#DuckDB.Generator-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-128"><a href="#DuckDB.Generator-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">,</span> +</span><span id="DuckDB.Generator-129"><a href="#DuckDB.Generator-129"><span class="linenos">129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="DuckDB.Generator-130"><a href="#DuckDB.Generator-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-131"><a href="#DuckDB.Generator-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(STRFTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-132"><a href="#DuckDB.Generator-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(STRPTIME(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TEXT), </span><span class="si">{</span><span class="n">DuckDB</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-133"><a href="#DuckDB.Generator-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNNEST"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-134"><a href="#DuckDB.Generator-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-135"><a href="#DuckDB.Generator-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-136"><a href="#DuckDB.Generator-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-137"><a href="#DuckDB.Generator-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-138"><a href="#DuckDB.Generator-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-139"><a href="#DuckDB.Generator-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">:</span> <span class="n">no_pivot_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-140"><a href="#DuckDB.Generator-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">:</span> <span class="n">no_properties_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-141"><a href="#DuckDB.Generator-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"REGEXP_MATCHES"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-142"><a href="#DuckDB.Generator-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STR_SPLIT_REGEX"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-143"><a href="#DuckDB.Generator-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-144"><a href="#DuckDB.Generator-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STR_SPLIT"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-145"><a href="#DuckDB.Generator-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_sort_array_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-146"><a href="#DuckDB.Generator-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-147"><a href="#DuckDB.Generator-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-148"><a href="#DuckDB.Generator-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-149"><a href="#DuckDB.Generator-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EPOCH(STRPTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-150"><a href="#DuckDB.Generator-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">:</span> <span class="n">_struct_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-151"><a href="#DuckDB.Generator-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-152"><a href="#DuckDB.Generator-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-153"><a href="#DuckDB.Generator-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-154"><a href="#DuckDB.Generator-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EPOCH(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP))"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-155"><a href="#DuckDB.Generator-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STRFTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-156"><a href="#DuckDB.Generator-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"EPOCH"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-157"><a href="#DuckDB.Generator-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TEXT), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-158"><a href="#DuckDB.Generator-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add</span><span class="p">,</span> +</span><span id="DuckDB.Generator-159"><a href="#DuckDB.Generator-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="DuckDB.Generator-160"><a href="#DuckDB.Generator-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STRFTIME(TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-161"><a href="#DuckDB.Generator-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_TIMESTAMP"</span><span class="p">),</span> +</span><span id="DuckDB.Generator-162"><a href="#DuckDB.Generator-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS TEXT)"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-163"><a href="#DuckDB.Generator-163"><span class="linenos">163</span></a> <span class="p">}</span> +</span><span id="DuckDB.Generator-164"><a href="#DuckDB.Generator-164"><span class="linenos">164</span></a> +</span><span id="DuckDB.Generator-165"><a href="#DuckDB.Generator-165"><span class="linenos">165</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DuckDB.Generator-166"><a href="#DuckDB.Generator-166"><span class="linenos">166</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="DuckDB.Generator-167"><a href="#DuckDB.Generator-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-168"><a href="#DuckDB.Generator-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="DuckDB.Generator-169"><a href="#DuckDB.Generator-169"><span class="linenos">169</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="DuckDB.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="DuckDB.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="DuckDB.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="DuckDB.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="DuckDB.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="DuckDB.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="DuckDB.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="DuckDB.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="DuckDB.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="DuckDB.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="DuckDB.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="DuckDB.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="DuckDB.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="DuckDB.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="DuckDB.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="DuckDB.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="DuckDB.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="DuckDB.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="DuckDB.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="DuckDB.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="DuckDB.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="DuckDB.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="DuckDB.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="DuckDB.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="DuckDB.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="DuckDB.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="DuckDB.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="DuckDB.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="DuckDB.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="DuckDB.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="DuckDB.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="DuckDB.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="DuckDB.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="DuckDB.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="DuckDB.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="DuckDB.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="DuckDB.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="DuckDB.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="DuckDB.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="DuckDB.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="DuckDB.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="DuckDB.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="DuckDB.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="DuckDB.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="DuckDB.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="DuckDB.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="DuckDB.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="DuckDB.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="DuckDB.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="DuckDB.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="DuckDB.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="DuckDB.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="DuckDB.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="DuckDB.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="DuckDB.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="DuckDB.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="DuckDB.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="DuckDB.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="DuckDB.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="DuckDB.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="DuckDB.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="DuckDB.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="DuckDB.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="DuckDB.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="DuckDB.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="DuckDB.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="DuckDB.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="DuckDB.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="DuckDB.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="DuckDB.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="DuckDB.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="DuckDB.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="DuckDB.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="DuckDB.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="DuckDB.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="DuckDB.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="DuckDB.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="DuckDB.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="DuckDB.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="DuckDB.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="DuckDB.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="DuckDB.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="DuckDB.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="DuckDB.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="DuckDB.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="DuckDB.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="DuckDB.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="DuckDB.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="DuckDB.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="DuckDB.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="DuckDB.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="DuckDB.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="DuckDB.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="DuckDB.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="DuckDB.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="DuckDB.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="DuckDB.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="DuckDB.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="DuckDB.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="DuckDB.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="DuckDB.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="DuckDB.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="DuckDB.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="DuckDB.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="DuckDB.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="DuckDB.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="DuckDB.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="DuckDB.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="DuckDB.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="DuckDB.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="DuckDB.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="DuckDB.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="DuckDB.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="DuckDB.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="DuckDB.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="DuckDB.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="DuckDB.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="DuckDB.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="DuckDB.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="DuckDB.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="DuckDB.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="DuckDB.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="DuckDB.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="DuckDB.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="DuckDB.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="DuckDB.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="DuckDB.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="DuckDB.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="DuckDB.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="DuckDB.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="DuckDB.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="DuckDB.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="DuckDB.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="DuckDB.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="DuckDB.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="DuckDB.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="DuckDB.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="DuckDB.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="DuckDB.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="DuckDB.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="DuckDB.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="DuckDB.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="DuckDB.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="DuckDB.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="DuckDB.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="DuckDB.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="DuckDB.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="DuckDB.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="DuckDB.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="DuckDB.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="DuckDB.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="DuckDB.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="DuckDB.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="DuckDB.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="DuckDB.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="DuckDB.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="DuckDB.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="DuckDB.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="DuckDB.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="DuckDB.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="DuckDB.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="DuckDB.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="DuckDB.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="DuckDB.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="DuckDB.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="DuckDB.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="DuckDB.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="DuckDB.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="DuckDB.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="DuckDB.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="DuckDB.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="DuckDB.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="DuckDB.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="DuckDB.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="DuckDB.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="DuckDB.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="DuckDB.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="DuckDB.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="DuckDB.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="DuckDB.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="DuckDB.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="DuckDB.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="DuckDB.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="DuckDB.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="DuckDB.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="DuckDB.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="DuckDB.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="DuckDB.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="DuckDB.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="DuckDB.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="DuckDB.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="DuckDB.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="DuckDB.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="DuckDB.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="DuckDB.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="DuckDB.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="DuckDB.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="DuckDB.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="DuckDB.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="DuckDB.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/hive.html b/docs/sqlglot/dialects/hive.html new file mode 100644 index 0000000..19511f2 --- /dev/null +++ b/docs/sqlglot/dialects/hive.html @@ -0,0 +1,1461 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.hive API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Hive">Hive</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Hive.__init__">Hive</a> + </li> + <li> + <a class="class" href="#Hive.Tokenizer">Hive.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Hive.Parser">Hive.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Hive.Generator">Hive.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Hive.Generator.with_properties">with_properties</a> + </li> + <li> + <a class="function" href="#Hive.Generator.datatype_sql">datatype_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/hive.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.hive </h1> + + + <input id="mod-hive-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-hive-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span><span class="p">,</span> <span class="n">transforms</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">format_time_lambda</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">no_recursive_cte_sql</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="p">)</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="kn">from</span> <span class="nn">sqlglot.parser</span> <span class="kn">import</span> <span class="n">parse_var_map</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="c1"># (FuncType, Multiplier)</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="n">DATE_DELTA_INTERVAL</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="s2">"YEAR"</span><span class="p">:</span> <span class="p">(</span><span class="s2">"ADD_MONTHS"</span><span class="p">,</span> <span class="mi">12</span><span class="p">),</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="s2">"MONTH"</span><span class="p">:</span> <span class="p">(</span><span class="s2">"ADD_MONTHS"</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="s2">"QUARTER"</span><span class="p">:</span> <span class="p">(</span><span class="s2">"ADD_MONTHS"</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="s2">"WEEK"</span><span class="p">:</span> <span class="p">(</span><span class="s2">"DATE_ADD"</span><span class="p">,</span> <span class="mi">7</span><span class="p">),</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="p">(</span><span class="s2">"DATE_ADD"</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="p">}</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="n">DIFF_MONTH_SWITCH</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"YEAR"</span><span class="p">,</span> <span class="s2">"QUARTER"</span><span class="p">,</span> <span class="s2">"MONTH"</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="k">def</span> <span class="nf">_add_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">func</span><span class="p">,</span> <span class="n">multiplier</span> <span class="o">=</span> <span class="n">DATE_DELTA_INTERVAL</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="s2">"DATE_ADD"</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">modified_increment</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="nb">int</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">))</span> <span class="o">*</span> <span class="n">multiplier</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">is_number</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">else</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="p">)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">modified_increment</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">modified_increment</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">modified_increment</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="k">def</span> <span class="nf">_date_diff_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">sql_func</span> <span class="o">=</span> <span class="s2">"MONTHS_BETWEEN"</span> <span class="k">if</span> <span class="n">unit</span> <span class="ow">in</span> <span class="n">DIFF_MONTH_SWITCH</span> <span class="k">else</span> <span class="s2">"DATEDIFF"</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">_</span><span class="p">,</span> <span class="n">multiplier</span> <span class="o">=</span> <span class="n">DATE_DELTA_INTERVAL</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">multiplier_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" / </span><span class="si">{</span><span class="n">multiplier</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">multiplier</span> <span class="o">></span> <span class="mi">1</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">diff_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sql_func</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">diff_sql</span><span class="si">}{</span><span class="n">multiplier_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="k">def</span> <span class="nf">_array_sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Hive SORT_ARRAY does not support a comparator"</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SORT_ARRAY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a><span class="k">def</span> <span class="nf">_property_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">'=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="k">def</span> <span class="nf">_str_to_unix</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNIX_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">_time_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="k">def</span> <span class="nf">_str_to_date</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">time_format</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">date_format</span><span class="p">):</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(UNIX_TIMESTAMP(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">time_format</span><span class="si">}</span><span class="s2">))"</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="k">def</span> <span class="nf">_str_to_time</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">time_format</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">date_format</span><span class="p">):</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(UNIX_TIMESTAMP(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">time_format</span><span class="si">}</span><span class="s2">))"</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a><span class="k">def</span> <span class="nf">_time_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="o">==</span> <span class="n">Hive</span><span class="o">.</span><span class="n">time_format</span><span class="p">:</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">return</span> <span class="n">time_format</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a><span class="k">def</span> <span class="nf">_time_to_str</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">time_format</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a><span class="k">def</span> <span class="nf">_to_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="ow">and</span> <span class="n">time_format</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">time_format</span><span class="p">,</span> <span class="n">Hive</span><span class="o">.</span><span class="n">date_format</span><span class="p">):</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_DATE(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">time_format</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_DATE(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="k">def</span> <span class="nf">_unnest_to_explode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unnest</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">):</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">unnest</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">udtf</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Posexplode</span> <span class="k">if</span> <span class="n">unnest</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"ordinality"</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">(</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">this</span><span class="o">=</span><span class="n">udtf</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">),</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">view</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="n">column</span><span class="p">]),</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="p">)</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="p">)</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">unnest</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">alias</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="p">[])</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="p">)</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">join_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a><span class="k">def</span> <span class="nf">_index_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">)</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"columns"</span><span class="p">)</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> ON TABLE </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a><span class="k">class</span> <span class="nc">Hive</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"MMM"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"hh"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="s2">"SSSSSS"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="s2">"a"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"E"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"EE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="s2">"EEE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="s2">"EEEE"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="p">}</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd'"</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">dateint_format</span> <span class="o">=</span> <span class="s2">"'yyyyMMdd'"</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd HH:mm:ss'"</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="s2">"utf-8"</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="s2">"ADD ARCHIVE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="s2">"ADD ARCHIVES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="s2">"ADD FILE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="s2">"ADD FILES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="s2">"ADD JAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="s2">"ADD JARS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="s2">"MSCK REPAIR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERDE_PROPERTIES</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="p">}</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">NUMERIC_LITERALS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="s2">"L"</span><span class="p">:</span> <span class="s2">"BIGINT"</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="s2">"S"</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"TINYINT"</span><span class="p">,</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"DOUBLE"</span><span class="p">,</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="s2">"F"</span><span class="p">:</span> <span class="s2">"FLOAT"</span><span class="p">,</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="s2">"BD"</span><span class="p">:</span> <span class="s2">"DECIMAL"</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="p">}</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"COLLECT_LIST"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="p">),</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="p">),</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">(</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="p">),</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="p">),</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">)(</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="p">[</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="p">]</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="p">),</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Day</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))),</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">,</span> <span class="kc">True</span><span class="p">),</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"GET_JSON_OBJECT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"LOCATE"</span><span class="p">:</span> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"LOG"</span><span class="p">:</span> <span class="p">(</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Log</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ln</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="p">),</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="s2">"MONTH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Month</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="s2">"PERCENTILE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="s2">"PERCENTILE_APPROX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="s2">"COLLECT_SET"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SetAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="s2">"SIZE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"TO_DATE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">),</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"UNIX_TIMESTAMP"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">,</span> <span class="kc">True</span><span class="p">),</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"YEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Year</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="p">}</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">(</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">)</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="p">),</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="p">}</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BINARY"</span><span class="p">,</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="p">}</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> <span class="n">_property_sql</span><span class="p">,</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"COLLECT_LIST"</span><span class="p">),</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SIZE"</span><span class="p">),</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">:</span> <span class="n">_array_sort</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">no_recursive_cte_sql</span><span class="p">,</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_add_date_sql</span><span class="p">,</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">_date_diff_sql</span><span class="p">,</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Hive</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS STRING), </span><span class="si">{</span><span class="n">Hive</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STORED AS </span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">:</span> <span class="n">_index_sql</span><span class="p">,</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">:</span> <span class="n">_unnest_to_explode_sql</span><span class="p">,</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GET_JSON_OBJECT"</span><span class="p">),</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GET_JSON_OBJECT"</span><span class="p">),</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"PERCENTILE"</span><span class="p">),</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"PERCENTILE_APPROX"</span><span class="p">),</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"RLIKE"</span><span class="p">),</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT"</span><span class="p">),</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"COLLECT_SET"</span><span class="p">),</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"SPLIT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, CONCAT('</span><span class="se">\\\\</span><span class="s2">Q', </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time</span><span class="p">,</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="n">_str_to_unix</span><span class="p">,</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="n">_time_to_str</span><span class="p">,</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS STRING), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_to_date_sql</span><span class="p">,</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">_time_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITIONED BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ROW FORMAT SERDE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">),</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FORMAT_NUMBER"</span><span class="p">),</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDateOfMonth</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LAST_DAY"</span><span class="p">),</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="p">}</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="p">}</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">):</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="n">properties</span><span class="p">,</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"TBLPROPERTIES"</span><span class="p">),</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="p">)</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">)</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="p">):</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"text"</span><span class="p">)</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEMPORAL_TYPES</span><span class="p">:</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="Hive"> + <input id="Hive-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Hive</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Hive-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hive"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hive-135"><a href="#Hive-135"><span class="linenos">135</span></a><span class="k">class</span> <span class="nc">Hive</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Hive-136"><a href="#Hive-136"><span class="linenos">136</span></a> <span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Hive-137"><a href="#Hive-137"><span class="linenos">137</span></a> +</span><span id="Hive-138"><a href="#Hive-138"><span class="linenos">138</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-139"><a href="#Hive-139"><span class="linenos">139</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Hive-140"><a href="#Hive-140"><span class="linenos">140</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Hive-141"><a href="#Hive-141"><span class="linenos">141</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Hive-142"><a href="#Hive-142"><span class="linenos">142</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Hive-143"><a href="#Hive-143"><span class="linenos">143</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="Hive-144"><a href="#Hive-144"><span class="linenos">144</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="Hive-145"><a href="#Hive-145"><span class="linenos">145</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="Hive-146"><a href="#Hive-146"><span class="linenos">146</span></a> <span class="s2">"MMM"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="Hive-147"><a href="#Hive-147"><span class="linenos">147</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="Hive-148"><a href="#Hive-148"><span class="linenos">148</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="Hive-149"><a href="#Hive-149"><span class="linenos">149</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-150"><a href="#Hive-150"><span class="linenos">150</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-151"><a href="#Hive-151"><span class="linenos">151</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="Hive-152"><a href="#Hive-152"><span class="linenos">152</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="Hive-153"><a href="#Hive-153"><span class="linenos">153</span></a> <span class="s2">"hh"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="Hive-154"><a href="#Hive-154"><span class="linenos">154</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="Hive-155"><a href="#Hive-155"><span class="linenos">155</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="Hive-156"><a href="#Hive-156"><span class="linenos">156</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="Hive-157"><a href="#Hive-157"><span class="linenos">157</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="Hive-158"><a href="#Hive-158"><span class="linenos">158</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="Hive-159"><a href="#Hive-159"><span class="linenos">159</span></a> <span class="s2">"SSSSSS"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-160"><a href="#Hive-160"><span class="linenos">160</span></a> <span class="s2">"a"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="Hive-161"><a href="#Hive-161"><span class="linenos">161</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> +</span><span id="Hive-162"><a href="#Hive-162"><span class="linenos">162</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> +</span><span id="Hive-163"><a href="#Hive-163"><span class="linenos">163</span></a> <span class="s2">"E"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-164"><a href="#Hive-164"><span class="linenos">164</span></a> <span class="s2">"EE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-165"><a href="#Hive-165"><span class="linenos">165</span></a> <span class="s2">"EEE"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-166"><a href="#Hive-166"><span class="linenos">166</span></a> <span class="s2">"EEEE"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="Hive-167"><a href="#Hive-167"><span class="linenos">167</span></a> <span class="p">}</span> +</span><span id="Hive-168"><a href="#Hive-168"><span class="linenos">168</span></a> +</span><span id="Hive-169"><a href="#Hive-169"><span class="linenos">169</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd'"</span> +</span><span id="Hive-170"><a href="#Hive-170"><span class="linenos">170</span></a> <span class="n">dateint_format</span> <span class="o">=</span> <span class="s2">"'yyyyMMdd'"</span> +</span><span id="Hive-171"><a href="#Hive-171"><span class="linenos">171</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-MM-dd HH:mm:ss'"</span> +</span><span id="Hive-172"><a href="#Hive-172"><span class="linenos">172</span></a> +</span><span id="Hive-173"><a href="#Hive-173"><span class="linenos">173</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Hive-174"><a href="#Hive-174"><span class="linenos">174</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="Hive-175"><a href="#Hive-175"><span class="linenos">175</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="Hive-176"><a href="#Hive-176"><span class="linenos">176</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Hive-177"><a href="#Hive-177"><span class="linenos">177</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="s2">"utf-8"</span> +</span><span id="Hive-178"><a href="#Hive-178"><span class="linenos">178</span></a> +</span><span id="Hive-179"><a href="#Hive-179"><span class="linenos">179</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-180"><a href="#Hive-180"><span class="linenos">180</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Hive-181"><a href="#Hive-181"><span class="linenos">181</span></a> <span class="s2">"ADD ARCHIVE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-182"><a href="#Hive-182"><span class="linenos">182</span></a> <span class="s2">"ADD ARCHIVES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-183"><a href="#Hive-183"><span class="linenos">183</span></a> <span class="s2">"ADD FILE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-184"><a href="#Hive-184"><span class="linenos">184</span></a> <span class="s2">"ADD FILES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-185"><a href="#Hive-185"><span class="linenos">185</span></a> <span class="s2">"ADD JAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-186"><a href="#Hive-186"><span class="linenos">186</span></a> <span class="s2">"ADD JARS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-187"><a href="#Hive-187"><span class="linenos">187</span></a> <span class="s2">"MSCK REPAIR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive-188"><a href="#Hive-188"><span class="linenos">188</span></a> <span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERDE_PROPERTIES</span><span class="p">,</span> +</span><span id="Hive-189"><a href="#Hive-189"><span class="linenos">189</span></a> <span class="p">}</span> +</span><span id="Hive-190"><a href="#Hive-190"><span class="linenos">190</span></a> +</span><span id="Hive-191"><a href="#Hive-191"><span class="linenos">191</span></a> <span class="n">NUMERIC_LITERALS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-192"><a href="#Hive-192"><span class="linenos">192</span></a> <span class="s2">"L"</span><span class="p">:</span> <span class="s2">"BIGINT"</span><span class="p">,</span> +</span><span id="Hive-193"><a href="#Hive-193"><span class="linenos">193</span></a> <span class="s2">"S"</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">,</span> +</span><span id="Hive-194"><a href="#Hive-194"><span class="linenos">194</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"TINYINT"</span><span class="p">,</span> +</span><span id="Hive-195"><a href="#Hive-195"><span class="linenos">195</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"DOUBLE"</span><span class="p">,</span> +</span><span id="Hive-196"><a href="#Hive-196"><span class="linenos">196</span></a> <span class="s2">"F"</span><span class="p">:</span> <span class="s2">"FLOAT"</span><span class="p">,</span> +</span><span id="Hive-197"><a href="#Hive-197"><span class="linenos">197</span></a> <span class="s2">"BD"</span><span class="p">:</span> <span class="s2">"DECIMAL"</span><span class="p">,</span> +</span><span id="Hive-198"><a href="#Hive-198"><span class="linenos">198</span></a> <span class="p">}</span> +</span><span id="Hive-199"><a href="#Hive-199"><span class="linenos">199</span></a> +</span><span id="Hive-200"><a href="#Hive-200"><span class="linenos">200</span></a> <span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Hive-201"><a href="#Hive-201"><span class="linenos">201</span></a> +</span><span id="Hive-202"><a href="#Hive-202"><span class="linenos">202</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Hive-203"><a href="#Hive-203"><span class="linenos">203</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Hive-204"><a href="#Hive-204"><span class="linenos">204</span></a> +</span><span id="Hive-205"><a href="#Hive-205"><span class="linenos">205</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-206"><a href="#Hive-206"><span class="linenos">206</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive-207"><a href="#Hive-207"><span class="linenos">207</span></a> <span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-208"><a href="#Hive-208"><span class="linenos">208</span></a> <span class="s2">"COLLECT_LIST"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-209"><a href="#Hive-209"><span class="linenos">209</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="Hive-210"><a href="#Hive-210"><span class="linenos">210</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Hive-211"><a href="#Hive-211"><span class="linenos">211</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Hive-212"><a href="#Hive-212"><span class="linenos">212</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Hive-213"><a href="#Hive-213"><span class="linenos">213</span></a> <span class="p">),</span> +</span><span id="Hive-214"><a href="#Hive-214"><span class="linenos">214</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="Hive-215"><a href="#Hive-215"><span class="linenos">215</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Hive-216"><a href="#Hive-216"><span class="linenos">216</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> +</span><span id="Hive-217"><a href="#Hive-217"><span class="linenos">217</span></a> <span class="p">),</span> +</span><span id="Hive-218"><a href="#Hive-218"><span class="linenos">218</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="Hive-219"><a href="#Hive-219"><span class="linenos">219</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Hive-220"><a href="#Hive-220"><span class="linenos">220</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">(</span> +</span><span id="Hive-221"><a href="#Hive-221"><span class="linenos">221</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Hive-222"><a href="#Hive-222"><span class="linenos">222</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Hive-223"><a href="#Hive-223"><span class="linenos">223</span></a> <span class="p">),</span> +</span><span id="Hive-224"><a href="#Hive-224"><span class="linenos">224</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Hive-225"><a href="#Hive-225"><span class="linenos">225</span></a> <span class="p">),</span> +</span><span id="Hive-226"><a href="#Hive-226"><span class="linenos">226</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">)(</span> +</span><span id="Hive-227"><a href="#Hive-227"><span class="linenos">227</span></a> <span class="p">[</span> +</span><span id="Hive-228"><a href="#Hive-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Hive-229"><a href="#Hive-229"><span class="linenos">229</span></a> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Hive-230"><a href="#Hive-230"><span class="linenos">230</span></a> <span class="p">]</span> +</span><span id="Hive-231"><a href="#Hive-231"><span class="linenos">231</span></a> <span class="p">),</span> +</span><span id="Hive-232"><a href="#Hive-232"><span class="linenos">232</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Day</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))),</span> +</span><span id="Hive-233"><a href="#Hive-233"><span class="linenos">233</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">,</span> <span class="kc">True</span><span class="p">),</span> +</span><span id="Hive-234"><a href="#Hive-234"><span class="linenos">234</span></a> <span class="s2">"GET_JSON_OBJECT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-235"><a href="#Hive-235"><span class="linenos">235</span></a> <span class="s2">"LOCATE"</span><span class="p">:</span> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="Hive-236"><a href="#Hive-236"><span class="linenos">236</span></a> <span class="s2">"LOG"</span><span class="p">:</span> <span class="p">(</span> +</span><span id="Hive-237"><a href="#Hive-237"><span class="linenos">237</span></a> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Log</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Hive-238"><a href="#Hive-238"><span class="linenos">238</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span> +</span><span id="Hive-239"><a href="#Hive-239"><span class="linenos">239</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ln</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Hive-240"><a href="#Hive-240"><span class="linenos">240</span></a> <span class="p">),</span> +</span><span id="Hive-241"><a href="#Hive-241"><span class="linenos">241</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="Hive-242"><a href="#Hive-242"><span class="linenos">242</span></a> <span class="s2">"MONTH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Month</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Hive-243"><a href="#Hive-243"><span class="linenos">243</span></a> <span class="s2">"PERCENTILE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-244"><a href="#Hive-244"><span class="linenos">244</span></a> <span class="s2">"PERCENTILE_APPROX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-245"><a href="#Hive-245"><span class="linenos">245</span></a> <span class="s2">"COLLECT_SET"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SetAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-246"><a href="#Hive-246"><span class="linenos">246</span></a> <span class="s2">"SIZE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-247"><a href="#Hive-247"><span class="linenos">247</span></a> <span class="s2">"SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive-248"><a href="#Hive-248"><span class="linenos">248</span></a> <span class="s2">"TO_DATE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">),</span> +</span><span id="Hive-249"><a href="#Hive-249"><span class="linenos">249</span></a> <span class="s2">"UNIX_TIMESTAMP"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">,</span> <span class="kc">True</span><span class="p">),</span> +</span><span id="Hive-250"><a href="#Hive-250"><span class="linenos">250</span></a> <span class="s2">"YEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Year</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Hive-251"><a href="#Hive-251"><span class="linenos">251</span></a> <span class="p">}</span> +</span><span id="Hive-252"><a href="#Hive-252"><span class="linenos">252</span></a> +</span><span id="Hive-253"><a href="#Hive-253"><span class="linenos">253</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-254"><a href="#Hive-254"><span class="linenos">254</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive-255"><a href="#Hive-255"><span class="linenos">255</span></a> <span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">(</span> +</span><span id="Hive-256"><a href="#Hive-256"><span class="linenos">256</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">)</span> +</span><span id="Hive-257"><a href="#Hive-257"><span class="linenos">257</span></a> <span class="p">),</span> +</span><span id="Hive-258"><a href="#Hive-258"><span class="linenos">258</span></a> <span class="p">}</span> +</span><span id="Hive-259"><a href="#Hive-259"><span class="linenos">259</span></a> +</span><span id="Hive-260"><a href="#Hive-260"><span class="linenos">260</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Hive-261"><a href="#Hive-261"><span class="linenos">261</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-262"><a href="#Hive-262"><span class="linenos">262</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive-263"><a href="#Hive-263"><span class="linenos">263</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="Hive-264"><a href="#Hive-264"><span class="linenos">264</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Hive-265"><a href="#Hive-265"><span class="linenos">265</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BINARY"</span><span class="p">,</span> +</span><span id="Hive-266"><a href="#Hive-266"><span class="linenos">266</span></a> <span class="p">}</span> +</span><span id="Hive-267"><a href="#Hive-267"><span class="linenos">267</span></a> +</span><span id="Hive-268"><a href="#Hive-268"><span class="linenos">268</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-269"><a href="#Hive-269"><span class="linenos">269</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive-270"><a href="#Hive-270"><span class="linenos">270</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive-271"><a href="#Hive-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> <span class="n">_property_sql</span><span class="p">,</span> +</span><span id="Hive-272"><a href="#Hive-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="Hive-273"><a href="#Hive-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"COLLECT_LIST"</span><span class="p">),</span> +</span><span id="Hive-274"><a href="#Hive-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="Hive-275"><a href="#Hive-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SIZE"</span><span class="p">),</span> +</span><span id="Hive-276"><a href="#Hive-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">:</span> <span class="n">_array_sort</span><span class="p">,</span> +</span><span id="Hive-277"><a href="#Hive-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">no_recursive_cte_sql</span><span class="p">,</span> +</span><span id="Hive-278"><a href="#Hive-278"><span class="linenos">278</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_add_date_sql</span><span class="p">,</span> +</span><span id="Hive-279"><a href="#Hive-279"><span class="linenos">279</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">_date_diff_sql</span><span class="p">,</span> +</span><span id="Hive-280"><a href="#Hive-280"><span class="linenos">280</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="Hive-281"><a href="#Hive-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Hive</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Hive-282"><a href="#Hive-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS STRING), </span><span class="si">{</span><span class="n">Hive</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Hive-283"><a href="#Hive-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STORED AS </span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-284"><a href="#Hive-284"><span class="linenos">284</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="Hive-285"><a href="#Hive-285"><span class="linenos">285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">:</span> <span class="n">_index_sql</span><span class="p">,</span> +</span><span id="Hive-286"><a href="#Hive-286"><span class="linenos">286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Hive-287"><a href="#Hive-287"><span class="linenos">287</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">:</span> <span class="n">_unnest_to_explode_sql</span><span class="p">,</span> +</span><span id="Hive-288"><a href="#Hive-288"><span class="linenos">288</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GET_JSON_OBJECT"</span><span class="p">),</span> +</span><span id="Hive-289"><a href="#Hive-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GET_JSON_OBJECT"</span><span class="p">),</span> +</span><span id="Hive-290"><a href="#Hive-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="Hive-291"><a href="#Hive-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="Hive-292"><a href="#Hive-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="Hive-293"><a href="#Hive-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"PERCENTILE"</span><span class="p">),</span> +</span><span id="Hive-294"><a href="#Hive-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"PERCENTILE_APPROX"</span><span class="p">),</span> +</span><span id="Hive-295"><a href="#Hive-295"><span class="linenos">295</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"RLIKE"</span><span class="p">),</span> +</span><span id="Hive-296"><a href="#Hive-296"><span class="linenos">296</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT"</span><span class="p">),</span> +</span><span id="Hive-297"><a href="#Hive-297"><span class="linenos">297</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="Hive-298"><a href="#Hive-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Hive-299"><a href="#Hive-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"COLLECT_SET"</span><span class="p">),</span> +</span><span id="Hive-300"><a href="#Hive-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"SPLIT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, CONCAT('</span><span class="se">\\\\</span><span class="s2">Q', </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Hive-301"><a href="#Hive-301"><span class="linenos">301</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="Hive-302"><a href="#Hive-302"><span class="linenos">302</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="Hive-303"><a href="#Hive-303"><span class="linenos">303</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time</span><span class="p">,</span> +</span><span id="Hive-304"><a href="#Hive-304"><span class="linenos">304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="n">_str_to_unix</span><span class="p">,</span> +</span><span id="Hive-305"><a href="#Hive-305"><span class="linenos">305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="Hive-306"><a href="#Hive-306"><span class="linenos">306</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-307"><a href="#Hive-307"><span class="linenos">307</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="Hive-308"><a href="#Hive-308"><span class="linenos">308</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Hive-309"><a href="#Hive-309"><span class="linenos">309</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Hive-310"><a href="#Hive-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="n">_time_to_str</span><span class="p">,</span> +</span><span id="Hive-311"><a href="#Hive-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Hive-312"><a href="#Hive-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS STRING), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Hive-313"><a href="#Hive-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Hive-314"><a href="#Hive-314"><span class="linenos">314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_to_date_sql</span><span class="p">,</span> +</span><span id="Hive-315"><a href="#Hive-315"><span class="linenos">315</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="Hive-316"><a href="#Hive-316"><span class="linenos">316</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">_time_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Hive-317"><a href="#Hive-317"><span class="linenos">317</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="Hive-318"><a href="#Hive-318"><span class="linenos">318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="Hive-319"><a href="#Hive-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITIONED BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-320"><a href="#Hive-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ROW FORMAT SERDE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive-321"><a href="#Hive-321"><span class="linenos">321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">),</span> +</span><span id="Hive-322"><a href="#Hive-322"><span class="linenos">322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FORMAT_NUMBER"</span><span class="p">),</span> +</span><span id="Hive-323"><a href="#Hive-323"><span class="linenos">323</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDateOfMonth</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LAST_DAY"</span><span class="p">),</span> +</span><span id="Hive-324"><a href="#Hive-324"><span class="linenos">324</span></a> <span class="p">}</span> +</span><span id="Hive-325"><a href="#Hive-325"><span class="linenos">325</span></a> +</span><span id="Hive-326"><a href="#Hive-326"><span class="linenos">326</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive-327"><a href="#Hive-327"><span class="linenos">327</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive-328"><a href="#Hive-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Hive-329"><a href="#Hive-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Hive-330"><a href="#Hive-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Hive-331"><a href="#Hive-331"><span class="linenos">331</span></a> <span class="p">}</span> +</span><span id="Hive-332"><a href="#Hive-332"><span class="linenos">332</span></a> +</span><span id="Hive-333"><a href="#Hive-333"><span class="linenos">333</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">):</span> +</span><span id="Hive-334"><a href="#Hive-334"><span class="linenos">334</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Hive-335"><a href="#Hive-335"><span class="linenos">335</span></a> <span class="n">properties</span><span class="p">,</span> +</span><span id="Hive-336"><a href="#Hive-336"><span class="linenos">336</span></a> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"TBLPROPERTIES"</span><span class="p">),</span> +</span><span id="Hive-337"><a href="#Hive-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="Hive-338"><a href="#Hive-338"><span class="linenos">338</span></a> +</span><span id="Hive-339"><a href="#Hive-339"><span class="linenos">339</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Hive-340"><a href="#Hive-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Hive-341"><a href="#Hive-341"><span class="linenos">341</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">)</span> +</span><span id="Hive-342"><a href="#Hive-342"><span class="linenos">342</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Hive-343"><a href="#Hive-343"><span class="linenos">343</span></a> <span class="p">):</span> +</span><span id="Hive-344"><a href="#Hive-344"><span class="linenos">344</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"text"</span><span class="p">)</span> +</span><span id="Hive-345"><a href="#Hive-345"><span class="linenos">345</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEMPORAL_TYPES</span><span class="p">:</span> +</span><span id="Hive-346"><a href="#Hive-346"><span class="linenos">346</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="Hive-347"><a href="#Hive-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Hive.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Hive</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Hive.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Hive.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Hive.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Hive.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Hive.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Hive.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Hive.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Hive.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Hive.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Hive.Tokenizer"> + <input id="Hive.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Hive.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Hive.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hive.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hive.Tokenizer-173"><a href="#Hive.Tokenizer-173"><span class="linenos">173</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Hive.Tokenizer-174"><a href="#Hive.Tokenizer-174"><span class="linenos">174</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="Hive.Tokenizer-175"><a href="#Hive.Tokenizer-175"><span class="linenos">175</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="Hive.Tokenizer-176"><a href="#Hive.Tokenizer-176"><span class="linenos">176</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Hive.Tokenizer-177"><a href="#Hive.Tokenizer-177"><span class="linenos">177</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="s2">"utf-8"</span> +</span><span id="Hive.Tokenizer-178"><a href="#Hive.Tokenizer-178"><span class="linenos">178</span></a> +</span><span id="Hive.Tokenizer-179"><a href="#Hive.Tokenizer-179"><span class="linenos">179</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Tokenizer-180"><a href="#Hive.Tokenizer-180"><span class="linenos">180</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-181"><a href="#Hive.Tokenizer-181"><span class="linenos">181</span></a> <span class="s2">"ADD ARCHIVE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-182"><a href="#Hive.Tokenizer-182"><span class="linenos">182</span></a> <span class="s2">"ADD ARCHIVES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-183"><a href="#Hive.Tokenizer-183"><span class="linenos">183</span></a> <span class="s2">"ADD FILE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-184"><a href="#Hive.Tokenizer-184"><span class="linenos">184</span></a> <span class="s2">"ADD FILES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-185"><a href="#Hive.Tokenizer-185"><span class="linenos">185</span></a> <span class="s2">"ADD JAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-186"><a href="#Hive.Tokenizer-186"><span class="linenos">186</span></a> <span class="s2">"ADD JARS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-187"><a href="#Hive.Tokenizer-187"><span class="linenos">187</span></a> <span class="s2">"MSCK REPAIR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-188"><a href="#Hive.Tokenizer-188"><span class="linenos">188</span></a> <span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERDE_PROPERTIES</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-189"><a href="#Hive.Tokenizer-189"><span class="linenos">189</span></a> <span class="p">}</span> +</span><span id="Hive.Tokenizer-190"><a href="#Hive.Tokenizer-190"><span class="linenos">190</span></a> +</span><span id="Hive.Tokenizer-191"><a href="#Hive.Tokenizer-191"><span class="linenos">191</span></a> <span class="n">NUMERIC_LITERALS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Tokenizer-192"><a href="#Hive.Tokenizer-192"><span class="linenos">192</span></a> <span class="s2">"L"</span><span class="p">:</span> <span class="s2">"BIGINT"</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-193"><a href="#Hive.Tokenizer-193"><span class="linenos">193</span></a> <span class="s2">"S"</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-194"><a href="#Hive.Tokenizer-194"><span class="linenos">194</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"TINYINT"</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-195"><a href="#Hive.Tokenizer-195"><span class="linenos">195</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"DOUBLE"</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-196"><a href="#Hive.Tokenizer-196"><span class="linenos">196</span></a> <span class="s2">"F"</span><span class="p">:</span> <span class="s2">"FLOAT"</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-197"><a href="#Hive.Tokenizer-197"><span class="linenos">197</span></a> <span class="s2">"BD"</span><span class="p">:</span> <span class="s2">"DECIMAL"</span><span class="p">,</span> +</span><span id="Hive.Tokenizer-198"><a href="#Hive.Tokenizer-198"><span class="linenos">198</span></a> <span class="p">}</span> +</span><span id="Hive.Tokenizer-199"><a href="#Hive.Tokenizer-199"><span class="linenos">199</span></a> +</span><span id="Hive.Tokenizer-200"><a href="#Hive.Tokenizer-200"><span class="linenos">200</span></a> <span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Hive.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Hive.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Hive.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Hive.Parser"> + <input id="Hive.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Hive.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Hive.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hive.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hive.Parser-202"><a href="#Hive.Parser-202"><span class="linenos">202</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Hive.Parser-203"><a href="#Hive.Parser-203"><span class="linenos">203</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Hive.Parser-204"><a href="#Hive.Parser-204"><span class="linenos">204</span></a> +</span><span id="Hive.Parser-205"><a href="#Hive.Parser-205"><span class="linenos">205</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Parser-206"><a href="#Hive.Parser-206"><span class="linenos">206</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive.Parser-207"><a href="#Hive.Parser-207"><span class="linenos">207</span></a> <span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-208"><a href="#Hive.Parser-208"><span class="linenos">208</span></a> <span class="s2">"COLLECT_LIST"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-209"><a href="#Hive.Parser-209"><span class="linenos">209</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="Hive.Parser-210"><a href="#Hive.Parser-210"><span class="linenos">210</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Hive.Parser-211"><a href="#Hive.Parser-211"><span class="linenos">211</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Hive.Parser-212"><a href="#Hive.Parser-212"><span class="linenos">212</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Hive.Parser-213"><a href="#Hive.Parser-213"><span class="linenos">213</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-214"><a href="#Hive.Parser-214"><span class="linenos">214</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="Hive.Parser-215"><a href="#Hive.Parser-215"><span class="linenos">215</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Hive.Parser-216"><a href="#Hive.Parser-216"><span class="linenos">216</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)),</span> +</span><span id="Hive.Parser-217"><a href="#Hive.Parser-217"><span class="linenos">217</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-218"><a href="#Hive.Parser-218"><span class="linenos">218</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="Hive.Parser-219"><a href="#Hive.Parser-219"><span class="linenos">219</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Hive.Parser-220"><a href="#Hive.Parser-220"><span class="linenos">220</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">(</span> +</span><span id="Hive.Parser-221"><a href="#Hive.Parser-221"><span class="linenos">221</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Hive.Parser-222"><a href="#Hive.Parser-222"><span class="linenos">222</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Hive.Parser-223"><a href="#Hive.Parser-223"><span class="linenos">223</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-224"><a href="#Hive.Parser-224"><span class="linenos">224</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"DAY"</span><span class="p">),</span> +</span><span id="Hive.Parser-225"><a href="#Hive.Parser-225"><span class="linenos">225</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-226"><a href="#Hive.Parser-226"><span class="linenos">226</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">)(</span> +</span><span id="Hive.Parser-227"><a href="#Hive.Parser-227"><span class="linenos">227</span></a> <span class="p">[</span> +</span><span id="Hive.Parser-228"><a href="#Hive.Parser-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Hive.Parser-229"><a href="#Hive.Parser-229"><span class="linenos">229</span></a> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Hive.Parser-230"><a href="#Hive.Parser-230"><span class="linenos">230</span></a> <span class="p">]</span> +</span><span id="Hive.Parser-231"><a href="#Hive.Parser-231"><span class="linenos">231</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-232"><a href="#Hive.Parser-232"><span class="linenos">232</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Day</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))),</span> +</span><span id="Hive.Parser-233"><a href="#Hive.Parser-233"><span class="linenos">233</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">,</span> <span class="kc">True</span><span class="p">),</span> +</span><span id="Hive.Parser-234"><a href="#Hive.Parser-234"><span class="linenos">234</span></a> <span class="s2">"GET_JSON_OBJECT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-235"><a href="#Hive.Parser-235"><span class="linenos">235</span></a> <span class="s2">"LOCATE"</span><span class="p">:</span> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="Hive.Parser-236"><a href="#Hive.Parser-236"><span class="linenos">236</span></a> <span class="s2">"LOG"</span><span class="p">:</span> <span class="p">(</span> +</span><span id="Hive.Parser-237"><a href="#Hive.Parser-237"><span class="linenos">237</span></a> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Log</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Hive.Parser-238"><a href="#Hive.Parser-238"><span class="linenos">238</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span> +</span><span id="Hive.Parser-239"><a href="#Hive.Parser-239"><span class="linenos">239</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ln</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Hive.Parser-240"><a href="#Hive.Parser-240"><span class="linenos">240</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-241"><a href="#Hive.Parser-241"><span class="linenos">241</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="Hive.Parser-242"><a href="#Hive.Parser-242"><span class="linenos">242</span></a> <span class="s2">"MONTH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Month</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Hive.Parser-243"><a href="#Hive.Parser-243"><span class="linenos">243</span></a> <span class="s2">"PERCENTILE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-244"><a href="#Hive.Parser-244"><span class="linenos">244</span></a> <span class="s2">"PERCENTILE_APPROX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-245"><a href="#Hive.Parser-245"><span class="linenos">245</span></a> <span class="s2">"COLLECT_SET"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SetAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-246"><a href="#Hive.Parser-246"><span class="linenos">246</span></a> <span class="s2">"SIZE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-247"><a href="#Hive.Parser-247"><span class="linenos">247</span></a> <span class="s2">"SPLIT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Hive.Parser-248"><a href="#Hive.Parser-248"><span class="linenos">248</span></a> <span class="s2">"TO_DATE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">),</span> +</span><span id="Hive.Parser-249"><a href="#Hive.Parser-249"><span class="linenos">249</span></a> <span class="s2">"UNIX_TIMESTAMP"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">,</span> <span class="s2">"hive"</span><span class="p">,</span> <span class="kc">True</span><span class="p">),</span> +</span><span id="Hive.Parser-250"><a href="#Hive.Parser-250"><span class="linenos">250</span></a> <span class="s2">"YEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Year</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Hive.Parser-251"><a href="#Hive.Parser-251"><span class="linenos">251</span></a> <span class="p">}</span> +</span><span id="Hive.Parser-252"><a href="#Hive.Parser-252"><span class="linenos">252</span></a> +</span><span id="Hive.Parser-253"><a href="#Hive.Parser-253"><span class="linenos">253</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Parser-254"><a href="#Hive.Parser-254"><span class="linenos">254</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive.Parser-255"><a href="#Hive.Parser-255"><span class="linenos">255</span></a> <span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">(</span> +</span><span id="Hive.Parser-256"><a href="#Hive.Parser-256"><span class="linenos">256</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">)</span> +</span><span id="Hive.Parser-257"><a href="#Hive.Parser-257"><span class="linenos">257</span></a> <span class="p">),</span> +</span><span id="Hive.Parser-258"><a href="#Hive.Parser-258"><span class="linenos">258</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Hive.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Hive.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Hive.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Hive.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Hive.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Hive.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Hive.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Hive.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Hive.Generator"> + <input id="Hive.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Hive.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Hive.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hive.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hive.Generator-260"><a href="#Hive.Generator-260"><span class="linenos">260</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Hive.Generator-261"><a href="#Hive.Generator-261"><span class="linenos">261</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Generator-262"><a href="#Hive.Generator-262"><span class="linenos">262</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive.Generator-263"><a href="#Hive.Generator-263"><span class="linenos">263</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="Hive.Generator-264"><a href="#Hive.Generator-264"><span class="linenos">264</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Hive.Generator-265"><a href="#Hive.Generator-265"><span class="linenos">265</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BINARY"</span><span class="p">,</span> +</span><span id="Hive.Generator-266"><a href="#Hive.Generator-266"><span class="linenos">266</span></a> <span class="p">}</span> +</span><span id="Hive.Generator-267"><a href="#Hive.Generator-267"><span class="linenos">267</span></a> +</span><span id="Hive.Generator-268"><a href="#Hive.Generator-268"><span class="linenos">268</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Generator-269"><a href="#Hive.Generator-269"><span class="linenos">269</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive.Generator-270"><a href="#Hive.Generator-270"><span class="linenos">270</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive.Generator-271"><a href="#Hive.Generator-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> <span class="n">_property_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-272"><a href="#Hive.Generator-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">approx_count_distinct_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-273"><a href="#Hive.Generator-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"COLLECT_LIST"</span><span class="p">),</span> +</span><span id="Hive.Generator-274"><a href="#Hive.Generator-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="Hive.Generator-275"><a href="#Hive.Generator-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SIZE"</span><span class="p">),</span> +</span><span id="Hive.Generator-276"><a href="#Hive.Generator-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">:</span> <span class="n">_array_sort</span><span class="p">,</span> +</span><span id="Hive.Generator-277"><a href="#Hive.Generator-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="n">no_recursive_cte_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-278"><a href="#Hive.Generator-278"><span class="linenos">278</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_add_date_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-279"><a href="#Hive.Generator-279"><span class="linenos">279</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">_date_diff_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-280"><a href="#Hive.Generator-280"><span class="linenos">280</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="Hive.Generator-281"><a href="#Hive.Generator-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Hive</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Hive.Generator-282"><a href="#Hive.Generator-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS STRING), </span><span class="si">{</span><span class="n">Hive</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Hive.Generator-283"><a href="#Hive.Generator-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"STORED AS </span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive.Generator-284"><a href="#Hive.Generator-284"><span class="linenos">284</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-285"><a href="#Hive.Generator-285"><span class="linenos">285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">:</span> <span class="n">_index_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-286"><a href="#Hive.Generator-286"><span class="linenos">286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-287"><a href="#Hive.Generator-287"><span class="linenos">287</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">:</span> <span class="n">_unnest_to_explode_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-288"><a href="#Hive.Generator-288"><span class="linenos">288</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GET_JSON_OBJECT"</span><span class="p">),</span> +</span><span id="Hive.Generator-289"><a href="#Hive.Generator-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GET_JSON_OBJECT"</span><span class="p">),</span> +</span><span id="Hive.Generator-290"><a href="#Hive.Generator-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-291"><a href="#Hive.Generator-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-292"><a href="#Hive.Generator-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-293"><a href="#Hive.Generator-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"PERCENTILE"</span><span class="p">),</span> +</span><span id="Hive.Generator-294"><a href="#Hive.Generator-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"PERCENTILE_APPROX"</span><span class="p">),</span> +</span><span id="Hive.Generator-295"><a href="#Hive.Generator-295"><span class="linenos">295</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"RLIKE"</span><span class="p">),</span> +</span><span id="Hive.Generator-296"><a href="#Hive.Generator-296"><span class="linenos">296</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpSplit</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SPLIT"</span><span class="p">),</span> +</span><span id="Hive.Generator-297"><a href="#Hive.Generator-297"><span class="linenos">297</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-298"><a href="#Hive.Generator-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Hive.Generator-299"><a href="#Hive.Generator-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetAgg</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"COLLECT_SET"</span><span class="p">),</span> +</span><span id="Hive.Generator-300"><a href="#Hive.Generator-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Split</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"SPLIT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, CONCAT('</span><span class="se">\\\\</span><span class="s2">Q', </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Hive.Generator-301"><a href="#Hive.Generator-301"><span class="linenos">301</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-302"><a href="#Hive.Generator-302"><span class="linenos">302</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="Hive.Generator-303"><a href="#Hive.Generator-303"><span class="linenos">303</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time</span><span class="p">,</span> +</span><span id="Hive.Generator-304"><a href="#Hive.Generator-304"><span class="linenos">304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="n">_str_to_unix</span><span class="p">,</span> +</span><span id="Hive.Generator-305"><a href="#Hive.Generator-305"><span class="linenos">305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-306"><a href="#Hive.Generator-306"><span class="linenos">306</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive.Generator-307"><a href="#Hive.Generator-307"><span class="linenos">307</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="Hive.Generator-308"><a href="#Hive.Generator-308"><span class="linenos">308</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-309"><a href="#Hive.Generator-309"><span class="linenos">309</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Hive.Generator-310"><a href="#Hive.Generator-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="n">_time_to_str</span><span class="p">,</span> +</span><span id="Hive.Generator-311"><a href="#Hive.Generator-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"UNIX_TIMESTAMP"</span><span class="p">),</span> +</span><span id="Hive.Generator-312"><a href="#Hive.Generator-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS STRING), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Hive.Generator-313"><a href="#Hive.Generator-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Hive.Generator-314"><a href="#Hive.Generator-314"><span class="linenos">314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_to_date_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-315"><a href="#Hive.Generator-315"><span class="linenos">315</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="Hive.Generator-316"><a href="#Hive.Generator-316"><span class="linenos">316</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">_time_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Hive.Generator-317"><a href="#Hive.Generator-317"><span class="linenos">317</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="Hive.Generator-318"><a href="#Hive.Generator-318"><span class="linenos">318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="Hive.Generator-319"><a href="#Hive.Generator-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITIONED BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive.Generator-320"><a href="#Hive.Generator-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ROW FORMAT SERDE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Hive.Generator-321"><a href="#Hive.Generator-321"><span class="linenos">321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WITH SERDEPROPERTIES"</span><span class="p">),</span> +</span><span id="Hive.Generator-322"><a href="#Hive.Generator-322"><span class="linenos">322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FORMAT_NUMBER"</span><span class="p">),</span> +</span><span id="Hive.Generator-323"><a href="#Hive.Generator-323"><span class="linenos">323</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LastDateOfMonth</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LAST_DAY"</span><span class="p">),</span> +</span><span id="Hive.Generator-324"><a href="#Hive.Generator-324"><span class="linenos">324</span></a> <span class="p">}</span> +</span><span id="Hive.Generator-325"><a href="#Hive.Generator-325"><span class="linenos">325</span></a> +</span><span id="Hive.Generator-326"><a href="#Hive.Generator-326"><span class="linenos">326</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Hive.Generator-327"><a href="#Hive.Generator-327"><span class="linenos">327</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Hive.Generator-328"><a href="#Hive.Generator-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Hive.Generator-329"><a href="#Hive.Generator-329"><span class="linenos">329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Hive.Generator-330"><a href="#Hive.Generator-330"><span class="linenos">330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Hive.Generator-331"><a href="#Hive.Generator-331"><span class="linenos">331</span></a> <span class="p">}</span> +</span><span id="Hive.Generator-332"><a href="#Hive.Generator-332"><span class="linenos">332</span></a> +</span><span id="Hive.Generator-333"><a href="#Hive.Generator-333"><span class="linenos">333</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">):</span> +</span><span id="Hive.Generator-334"><a href="#Hive.Generator-334"><span class="linenos">334</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Hive.Generator-335"><a href="#Hive.Generator-335"><span class="linenos">335</span></a> <span class="n">properties</span><span class="p">,</span> +</span><span id="Hive.Generator-336"><a href="#Hive.Generator-336"><span class="linenos">336</span></a> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"TBLPROPERTIES"</span><span class="p">),</span> +</span><span id="Hive.Generator-337"><a href="#Hive.Generator-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="Hive.Generator-338"><a href="#Hive.Generator-338"><span class="linenos">338</span></a> +</span><span id="Hive.Generator-339"><a href="#Hive.Generator-339"><span class="linenos">339</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Hive.Generator-340"><a href="#Hive.Generator-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Hive.Generator-341"><a href="#Hive.Generator-341"><span class="linenos">341</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">)</span> +</span><span id="Hive.Generator-342"><a href="#Hive.Generator-342"><span class="linenos">342</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Hive.Generator-343"><a href="#Hive.Generator-343"><span class="linenos">343</span></a> <span class="p">):</span> +</span><span id="Hive.Generator-344"><a href="#Hive.Generator-344"><span class="linenos">344</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"text"</span><span class="p">)</span> +</span><span id="Hive.Generator-345"><a href="#Hive.Generator-345"><span class="linenos">345</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEMPORAL_TYPES</span><span class="p">:</span> +</span><span id="Hive.Generator-346"><a href="#Hive.Generator-346"><span class="linenos">346</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="Hive.Generator-347"><a href="#Hive.Generator-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Hive.Generator.with_properties" class="classattr"> + <input id="Hive.Generator.with_properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">with_properties</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">properties</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Hive.Generator.with_properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hive.Generator.with_properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hive.Generator.with_properties-333"><a href="#Hive.Generator.with_properties-333"><span class="linenos">333</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">):</span> +</span><span id="Hive.Generator.with_properties-334"><a href="#Hive.Generator.with_properties-334"><span class="linenos">334</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Hive.Generator.with_properties-335"><a href="#Hive.Generator.with_properties-335"><span class="linenos">335</span></a> <span class="n">properties</span><span class="p">,</span> +</span><span id="Hive.Generator.with_properties-336"><a href="#Hive.Generator.with_properties-336"><span class="linenos">336</span></a> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"TBLPROPERTIES"</span><span class="p">),</span> +</span><span id="Hive.Generator.with_properties-337"><a href="#Hive.Generator.with_properties-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Hive.Generator.datatype_sql" class="classattr"> + <input id="Hive.Generator.datatype_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">datatype_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Hive.Generator.datatype_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hive.Generator.datatype_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hive.Generator.datatype_sql-339"><a href="#Hive.Generator.datatype_sql-339"><span class="linenos">339</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Hive.Generator.datatype_sql-340"><a href="#Hive.Generator.datatype_sql-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Hive.Generator.datatype_sql-341"><a href="#Hive.Generator.datatype_sql-341"><span class="linenos">341</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">)</span> +</span><span id="Hive.Generator.datatype_sql-342"><a href="#Hive.Generator.datatype_sql-342"><span class="linenos">342</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Hive.Generator.datatype_sql-343"><a href="#Hive.Generator.datatype_sql-343"><span class="linenos">343</span></a> <span class="p">):</span> +</span><span id="Hive.Generator.datatype_sql-344"><a href="#Hive.Generator.datatype_sql-344"><span class="linenos">344</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"text"</span><span class="p">)</span> +</span><span id="Hive.Generator.datatype_sql-345"><a href="#Hive.Generator.datatype_sql-345"><span class="linenos">345</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEMPORAL_TYPES</span><span class="p">:</span> +</span><span id="Hive.Generator.datatype_sql-346"><a href="#Hive.Generator.datatype_sql-346"><span class="linenos">346</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="Hive.Generator.datatype_sql-347"><a href="#Hive.Generator.datatype_sql-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Hive.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Hive.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Hive.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Hive.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Hive.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Hive.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Hive.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Hive.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Hive.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Hive.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Hive.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Hive.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Hive.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Hive.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Hive.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Hive.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Hive.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Hive.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Hive.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Hive.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Hive.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Hive.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Hive.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Hive.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Hive.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Hive.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Hive.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Hive.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Hive.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Hive.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Hive.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Hive.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Hive.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Hive.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Hive.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Hive.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Hive.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Hive.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Hive.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Hive.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Hive.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Hive.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Hive.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Hive.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Hive.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Hive.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Hive.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Hive.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Hive.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Hive.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Hive.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Hive.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Hive.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Hive.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Hive.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Hive.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Hive.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Hive.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Hive.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Hive.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Hive.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Hive.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Hive.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Hive.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Hive.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Hive.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Hive.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Hive.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Hive.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Hive.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Hive.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Hive.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Hive.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Hive.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Hive.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Hive.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Hive.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Hive.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Hive.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Hive.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Hive.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Hive.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Hive.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Hive.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Hive.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Hive.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Hive.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Hive.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Hive.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Hive.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Hive.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Hive.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Hive.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Hive.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Hive.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Hive.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Hive.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Hive.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Hive.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Hive.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Hive.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Hive.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Hive.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Hive.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Hive.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Hive.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Hive.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Hive.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Hive.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Hive.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Hive.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Hive.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Hive.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Hive.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Hive.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Hive.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Hive.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Hive.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Hive.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Hive.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Hive.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Hive.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Hive.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Hive.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Hive.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Hive.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Hive.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Hive.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Hive.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Hive.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Hive.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Hive.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Hive.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Hive.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Hive.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Hive.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Hive.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Hive.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Hive.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Hive.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Hive.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Hive.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Hive.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Hive.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Hive.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Hive.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Hive.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Hive.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Hive.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Hive.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Hive.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Hive.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Hive.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Hive.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Hive.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Hive.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Hive.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Hive.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Hive.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Hive.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Hive.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Hive.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Hive.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Hive.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Hive.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Hive.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Hive.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Hive.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Hive.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Hive.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Hive.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Hive.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Hive.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Hive.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Hive.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Hive.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Hive.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Hive.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Hive.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Hive.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Hive.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Hive.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Hive.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Hive.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Hive.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Hive.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Hive.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Hive.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Hive.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Hive.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Hive.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Hive.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Hive.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Hive.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Hive.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Hive.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Hive.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Hive.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Hive.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/mysql.html b/docs/sqlglot/dialects/mysql.html new file mode 100644 index 0000000..06ba4de --- /dev/null +++ b/docs/sqlglot/dialects/mysql.html @@ -0,0 +1,2149 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.mysql API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#MySQL">MySQL</a> + <ul class="memberlist"> + <li> + <a class="function" href="#MySQL.__init__">MySQL</a> + </li> + <li> + <a class="class" href="#MySQL.Tokenizer">MySQL.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#MySQL.Parser">MySQL.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#MySQL.Generator">MySQL.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#MySQL.Generator.show_sql">show_sql</a> + </li> + <li> + <a class="function" href="#MySQL.Generator.setitem_sql">setitem_sql</a> + </li> + <li> + <a class="function" href="#MySQL.Generator.set_sql">set_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/mysql.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.mysql </h1> + + + <input id="mod-mysql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-mysql-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="p">)</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="k">def</span> <span class="nf">_show_parser</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="k">def</span> <span class="nf">_parse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_show_mysql</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">return</span> <span class="n">_parse</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="k">def</span> <span class="nf">_date_trunc_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">expr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"day"</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATE(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"week"</span><span class="p">:</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">concat</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CONCAT(YEAR(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">), ' ', WEEK(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">, 1), ' 1')"</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"%Y </span><span class="si">%u</span><span class="s2"> %w"</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">elif</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"month"</span><span class="p">:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">concat</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CONCAT(YEAR(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">), ' ', MONTH(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">), ' 1')"</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"%Y </span><span class="si">%c</span><span class="s2"> </span><span class="si">%e</span><span class="s2">"</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">elif</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"quarter"</span><span class="p">:</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">concat</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CONCAT(YEAR(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">), ' ', QUARTER(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">) * 3 - 2, ' 1')"</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"%Y </span><span class="si">%c</span><span class="s2"> </span><span class="si">%e</span><span class="s2">"</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">elif</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"year"</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">concat</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CONCAT(YEAR(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">), ' 1 1')"</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="s2">"%Y </span><span class="si">%c</span><span class="s2"> </span><span class="si">%e</span><span class="s2">"</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Unexpected interval unit: </span><span class="si">{unit}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATE(</span><span class="si">{</span><span class="n">expr</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STR_TO_DATE(</span><span class="si">{</span><span class="n">concat</span><span class="si">}</span><span class="s2">, '</span><span class="si">{</span><span class="n">date_format</span><span class="si">}</span><span class="s2">')"</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="k">def</span> <span class="nf">_str_to_date</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="nb">format</span><span class="o">=</span><span class="n">date_format</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="k">def</span> <span class="nf">_str_to_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">date_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STR_TO_DATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">date_format</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a><span class="k">def</span> <span class="nf">_trim_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">remove_chars</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="c1"># Use TRIM/LTRIM/RTRIM syntax if the expression isn't mysql-specific</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">remove_chars</span><span class="p">:</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">trim_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">trim_type</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">trim_type</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">remove_chars</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">remove_chars</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">remove_chars</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">from_part</span> <span class="o">=</span> <span class="s2">"FROM "</span> <span class="k">if</span> <span class="n">trim_type</span> <span class="ow">or</span> <span class="n">remove_chars</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="n">trim_type</span><span class="si">}{</span><span class="n">remove_chars</span><span class="si">}{</span><span class="n">from_part</span><span class="si">}{</span><span class="n">target</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="k">def</span> <span class="nf">_date_add</span><span class="p">(</span><span class="n">expression_class</span><span class="p">):</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">interval</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="n">expression_class</span><span class="p">(</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">interval</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">interval</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()),</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="p">)</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">return</span> <span class="n">func</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a><span class="k">def</span> <span class="nf">_date_add_sql</span><span class="p">(</span><span class="n">kind</span><span class="p">):</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">or</span> <span class="s2">"DAY"</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="sa">f</span><span class="s2">"DATE_</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="p">)</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">return</span> <span class="n">func</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a><span class="k">class</span> <span class="nc">MySQL</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'%Y-%m-</span><span class="si">%d</span><span class="s2"> %T'"</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="c1"># https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="s2">"%M"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="s2">"</span><span class="si">%c</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="s2">"</span><span class="si">%e</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="s2">"%h"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="s2">"</span><span class="si">%i</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="s2">"</span><span class="si">%s</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="s2">"%S"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="s2">"</span><span class="si">%u</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="s2">"%k"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="s2">"%l"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="s2">"%T"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="p">}</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"b'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"B'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0b"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="s2">"MEDIUMTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="s2">"LONGTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="s2">"MEDIUMBLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="s2">"LONGBLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="s2">"SEPARATOR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEPARATOR</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="s2">"_ARMSCII8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="s2">"_ASCII"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="s2">"_BIG5"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="s2">"_BINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="s2">"_CP1250"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="s2">"_CP1251"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="s2">"_CP1256"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="s2">"_CP1257"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="s2">"_CP850"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="s2">"_CP852"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="s2">"_CP866"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="s2">"_CP932"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"_DEC8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="s2">"_EUCJPMS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="s2">"_EUCKR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="s2">"_GB18030"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="s2">"_GB2312"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="s2">"_GBK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"_GEOSTD8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"_GREEK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="s2">"_HEBREW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"_HP8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="s2">"_KEYBCS2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="s2">"_KOI8R"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="s2">"_KOI8U"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="s2">"_LATIN1"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="s2">"_LATIN2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="s2">"_LATIN5"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="s2">"_LATIN7"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"_MACCE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"_MACROMAN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="s2">"_SJIS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="s2">"_SWE7"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="s2">"_TIS620"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="s2">"_UCS2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="s2">"_UJIS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/string-literals.html</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="s2">"_UTF8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="s2">"_UTF16"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="s2">"_UTF16LE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="s2">"_UTF32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="s2">"_UTF8MB3"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="s2">"_UTF8MB4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="s2">"@@"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SESSION_PARAMETER</span><span class="p">,</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="p">}</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">COMMANDS</span> <span class="o">=</span> <span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">COMMANDS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">}</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">),</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="s2">"STR_TO_DATE"</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="s2">"LOCATE"</span><span class="p">:</span> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="s2">"INSTR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span><span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="p">),</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="p">}</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="s2">"GROUP_CONCAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">(),</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">separator</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEPARATOR</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(),</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="p">),</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="p">}</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">),</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="p">}</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_show</span><span class="p">(),</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set</span><span class="p">(),</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="p">}</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="n">SHOW_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="s2">"BINARY LOGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINARY LOGS"</span><span class="p">),</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="s2">"MASTER LOGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINARY LOGS"</span><span class="p">),</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="s2">"BINLOG EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINLOG EVENTS"</span><span class="p">),</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="s2">"CHARSET"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="s2">"COLLATION"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLLATION"</span><span class="p">),</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="s2">"FULL COLUMNS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="s2">"COLUMNS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">),</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"CREATE DATABASE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE DATABASE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="s2">"CREATE EVENT"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE EVENT"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="s2">"CREATE FUNCTION"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE FUNCTION"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="s2">"CREATE PROCEDURE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE PROCEDURE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="s2">"CREATE TABLE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE TABLE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="s2">"CREATE TRIGGER"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE TRIGGER"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"CREATE VIEW"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE VIEW"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"DATABASES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"DATABASES"</span><span class="p">),</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"STORAGE ENGINES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINES"</span><span class="p">),</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"ENGINES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINES"</span><span class="p">),</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"ERRORS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ERRORS"</span><span class="p">),</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="s2">"EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"EVENTS"</span><span class="p">),</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="s2">"FUNCTION CODE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"FUNCTION CODE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="s2">"FUNCTION STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"FUNCTION STATUS"</span><span class="p">),</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="s2">"GRANTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"GRANTS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FOR"</span><span class="p">),</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="s2">"INDEX"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"INDEX"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">),</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="s2">"MASTER STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"MASTER STATUS"</span><span class="p">),</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="s2">"OPEN TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"OPEN TABLES"</span><span class="p">),</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="s2">"PLUGINS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PLUGINS"</span><span class="p">),</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="s2">"PROCEDURE CODE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCEDURE CODE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"PROCEDURE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCEDURE STATUS"</span><span class="p">),</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"PRIVILEGES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PRIVILEGES"</span><span class="p">),</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"FULL PROCESSLIST"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCESSLIST"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"PROCESSLIST"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCESSLIST"</span><span class="p">),</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="s2">"PROFILE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROFILE"</span><span class="p">),</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="s2">"PROFILES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROFILES"</span><span class="p">),</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"RELAYLOG EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"RELAYLOG EVENTS"</span><span class="p">),</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"REPLICAS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICAS"</span><span class="p">),</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"SLAVE HOSTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICAS"</span><span class="p">),</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="s2">"REPLICA STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICA STATUS"</span><span class="p">),</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="s2">"SLAVE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICA STATUS"</span><span class="p">),</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="s2">"GLOBAL STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="s2">"SESSION STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">),</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="s2">"STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">),</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="s2">"TABLE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLE STATUS"</span><span class="p">),</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="s2">"FULL TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLES"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="s2">"TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLES"</span><span class="p">),</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="s2">"TRIGGERS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TRIGGERS"</span><span class="p">),</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="s2">"GLOBAL VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="s2">"SESSION VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">),</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="s2">"VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">),</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="s2">"WARNINGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"WARNINGS"</span><span class="p">),</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="p">}</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">SET_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="s2">"GLOBAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"GLOBAL"</span><span class="p">),</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="s2">"PERSIST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"PERSIST"</span><span class="p">),</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="s2">"PERSIST_ONLY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"PERSIST_ONLY"</span><span class="p">),</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="s2">"SESSION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"SESSION"</span><span class="p">),</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"LOCAL"</span><span class="p">),</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_charset</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="s2">"CHARSET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_charset</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="s2">"NAMES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_names</span><span class="p">(),</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="s2">"TRANSACTION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_transaction</span><span class="p">(),</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="p">}</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">PROFILE_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="s2">"ALL"</span><span class="p">,</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="s2">"BLOCK IO"</span><span class="p">,</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="s2">"CONTEXT SWITCHES"</span><span class="p">,</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="s2">"CPU"</span><span class="p">,</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="s2">"IPC"</span><span class="p">,</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="s2">"MEMORY"</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="s2">"PAGE FAULTS"</span><span class="p">,</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="s2">"SOURCE"</span><span class="p">,</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="s2">"SWAPS"</span><span class="p">,</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="p">}</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="n">TRANSACTION_CHARACTERISTICS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="s2">"ISOLATION LEVEL REPEATABLE READ"</span><span class="p">,</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="s2">"ISOLATION LEVEL READ COMMITTED"</span><span class="p">,</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="s2">"ISOLATION LEVEL READ UNCOMMITTED"</span><span class="p">,</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="s2">"ISOLATION LEVEL SERIALIZABLE"</span><span class="p">,</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="s2">"READ WRITE"</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="s2">"READ ONLY"</span><span class="p">,</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="p">}</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="k">def</span> <span class="nf">_parse_show_mysql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="k">if</span> <span class="n">target</span><span class="p">:</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="n">target</span><span class="p">)</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="n">target_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="n">target_id</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"BINLOG EVENTS"</span><span class="p">,</span> <span class="s2">"RELAYLOG EVENTS"</span><span class="p">}:</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="n">db</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="n">position</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"CHANNEL"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">()</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="k">if</span> <span class="n">this</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PROFILE_TYPES</span><span class="p">))</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"QUERY"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">types</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_oldstyle_limit</span><span class="p">()</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="n">mutex</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MUTEX"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="n">mutex</span> <span class="o">=</span> <span class="kc">False</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">)</span> <span class="k">else</span> <span class="n">mutex</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Show</span><span class="p">,</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="n">target</span><span class="o">=</span><span class="n">target_id</span><span class="p">,</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="n">full</span><span class="o">=</span><span class="n">full</span><span class="p">,</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="n">log</span><span class="o">=</span><span class="n">log</span><span class="p">,</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">position</span><span class="o">=</span><span class="n">position</span><span class="p">,</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="n">channel</span><span class="o">=</span><span class="n">channel</span><span class="p">,</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="n">like</span><span class="o">=</span><span class="n">like</span><span class="p">,</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="n">where</span><span class="o">=</span><span class="n">where</span><span class="p">,</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="n">types</span><span class="o">=</span><span class="n">types</span><span class="p">,</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="n">query</span><span class="o">=</span><span class="n">query</span><span class="p">,</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="n">mutex</span><span class="o">=</span><span class="n">mutex</span><span class="p">,</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"global"</span><span class="p">:</span> <span class="n">global_</span><span class="p">},</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="p">)</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="k">def</span> <span class="nf">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">options</span><span class="p">):</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="k">for</span> <span class="n">option</span> <span class="ow">in</span> <span class="n">options</span><span class="p">:</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="o">*</span><span class="n">option</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)):</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">option</span><span class="p">)</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="k">def</span> <span class="nf">_parse_oldstyle_limit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">):</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">)</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="k">return</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="k">def</span> <span class="nf">_default_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_assignment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"GLOBAL"</span><span class="p">,</span> <span class="s2">"SESSION"</span><span class="p">}</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSACTION"</span><span class="p">):</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_transaction</span><span class="p">(</span><span class="n">global_</span><span class="o">=</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"GLOBAL"</span><span class="p">)</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="n">left</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected ="</span><span class="p">)</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="n">right</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="p">)</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="p">)</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_charset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="p">)</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> <span class="n">charset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"COLLATE"</span><span class="p">):</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> <span class="n">this</span><span class="o">=</span><span class="n">charset</span><span class="p">,</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="n">collate</span><span class="o">=</span><span class="n">collate</span><span class="p">,</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"NAMES"</span><span class="p">,</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="p">)</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="k">def</span> <span class="nf">_parse_set_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSACTION"</span><span class="p">)</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="n">characteristics</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRANSACTION_CHARACTERISTICS</span><span class="p">)</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> <span class="p">)</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">characteristics</span><span class="p">,</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"global"</span><span class="p">:</span> <span class="n">global_</span><span class="p">},</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="p">)</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</span></a> <span class="n">NULL_ORDERING_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> +</span><span id="L-436"><a href="#L-436"><span class="linenos">436</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-437"><a href="#L-437"><span class="linenos">437</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-438"><a href="#L-438"><span class="linenos">438</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos">439</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos">440</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos">441</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="L-445"><a href="#L-445"><span class="linenos">445</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">:</span> <span class="n">_date_trunc_sql</span><span class="p">,</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""GROUP_CONCAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s2">"this"</span><span class="p">)</span><span class="si">}</span><span class="s2"> SEPARATOR </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s2">"separator"</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"','"</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date_sql</span><span class="p">,</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_date_sql</span><span class="p">,</span> +</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">_trim_sql</span><span class="p">,</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos">450</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"<=>"</span><span class="p">),</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">not_sql</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"<=>"</span><span class="p">)),</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos">452</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a> <span class="p">}</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos">454</span></a> +</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">)</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">)</span> +</span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">)</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos">459</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">)</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a> +</span><span id="L-461"><a href="#L-461"><span class="linenos">461</span></a> <span class="k">def</span> <span class="nf">show_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos">462</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos">463</span></a> <span class="n">full</span> <span class="o">=</span> <span class="s2">" FULL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"full"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-464"><a href="#L-464"><span class="linenos">464</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-465"><a href="#L-465"><span class="linenos">465</span></a> +</span><span id="L-466"><a href="#L-466"><span class="linenos">466</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"target"</span><span class="p">)</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos">467</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">target</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-468"><a href="#L-468"><span class="linenos">468</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="s2">"INDEX"</span><span class="p">}:</span> +</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos">470</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"GRANTS"</span><span class="p">:</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos">471</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FOR</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos">472</span></a> +</span><span id="L-473"><a href="#L-473"><span class="linenos">473</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">)</span> +</span><span id="L-474"><a href="#L-474"><span class="linenos">474</span></a> +</span><span id="L-475"><a href="#L-475"><span class="linenos">475</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"like"</span><span class="p">)</span> +</span><span id="L-476"><a href="#L-476"><span class="linenos">476</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-477"><a href="#L-477"><span class="linenos">477</span></a> +</span><span id="L-478"><a href="#L-478"><span class="linenos">478</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"types"</span><span class="p">)</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos">479</span></a> <span class="n">types</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">types</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">types</span> <span class="k">else</span> <span class="n">types</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos">480</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR QUERY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"query"</span><span class="p">)</span> +</span><span id="L-481"><a href="#L-481"><span class="linenos">481</span></a> +</span><span id="L-482"><a href="#L-482"><span class="linenos">482</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos">483</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos">484</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos">485</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos">486</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-487"><a href="#L-487"><span class="linenos">487</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_oldstyle_limit_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos">488</span></a> +</span><span id="L-489"><a href="#L-489"><span class="linenos">489</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"log"</span><span class="p">)</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos">490</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="L-491"><a href="#L-491"><span class="linenos">491</span></a> +</span><span id="L-492"><a href="#L-492"><span class="linenos">492</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR CHANNEL"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"channel"</span><span class="p">)</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos">493</span></a> +</span><span id="L-494"><a href="#L-494"><span class="linenos">494</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"ENGINE"</span><span class="p">:</span> +</span><span id="L-495"><a href="#L-495"><span class="linenos">495</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">" MUTEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"mutex"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" STATUS"</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos">496</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-497"><a href="#L-497"><span class="linenos">497</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-498"><a href="#L-498"><span class="linenos">498</span></a> +</span><span id="L-499"><a href="#L-499"><span class="linenos">499</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SHOW</span><span class="si">{</span><span class="n">full</span><span class="si">}{</span><span class="n">global_</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">target</span><span class="si">}{</span><span class="n">types</span><span class="si">}{</span><span class="n">db</span><span class="si">}{</span><span class="n">query</span><span class="si">}{</span><span class="n">log</span><span class="si">}{</span><span class="n">position</span><span class="si">}{</span><span class="n">channel</span><span class="si">}{</span><span class="n">mutex_or_status</span><span class="si">}{</span><span class="n">like</span><span class="si">}{</span><span class="n">where</span><span class="si">}{</span><span class="n">offset</span><span class="si">}{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-500"><a href="#L-500"><span class="linenos">500</span></a> +</span><span id="L-501"><a href="#L-501"><span class="linenos">501</span></a> <span class="k">def</span> <span class="nf">_prefixed_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">arg</span><span class="p">):</span> +</span><span id="L-502"><a href="#L-502"><span class="linenos">502</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">arg</span><span class="p">)</span> +</span><span id="L-503"><a href="#L-503"><span class="linenos">503</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">sql</span><span class="p">:</span> +</span><span id="L-504"><a href="#L-504"><span class="linenos">504</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-505"><a href="#L-505"><span class="linenos">505</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">prefix</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-506"><a href="#L-506"><span class="linenos">506</span></a> +</span><span id="L-507"><a href="#L-507"><span class="linenos">507</span></a> <span class="k">def</span> <span class="nf">_oldstyle_limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-508"><a href="#L-508"><span class="linenos">508</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="L-509"><a href="#L-509"><span class="linenos">509</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="L-510"><a href="#L-510"><span class="linenos">510</span></a> <span class="k">if</span> <span class="n">limit</span><span class="p">:</span> +</span><span id="L-511"><a href="#L-511"><span class="linenos">511</span></a> <span class="n">limit_offset</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">offset</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">offset</span> <span class="k">else</span> <span class="n">limit</span> +</span><span id="L-512"><a href="#L-512"><span class="linenos">512</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">" LIMIT </span><span class="si">{</span><span class="n">limit_offset</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-513"><a href="#L-513"><span class="linenos">513</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-514"><a href="#L-514"><span class="linenos">514</span></a> +</span><span id="L-515"><a href="#L-515"><span class="linenos">515</span></a> <span class="k">def</span> <span class="nf">setitem_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-516"><a href="#L-516"><span class="linenos">516</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-517"><a href="#L-517"><span class="linenos">517</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-518"><a href="#L-518"><span class="linenos">518</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-519"><a href="#L-519"><span class="linenos">519</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-520"><a href="#L-520"><span class="linenos">520</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="L-521"><a href="#L-521"><span class="linenos">521</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-522"><a href="#L-522"><span class="linenos">522</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">"GLOBAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-523"><a href="#L-523"><span class="linenos">523</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">global_</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-524"><a href="#L-524"><span class="linenos">524</span></a> +</span><span id="L-525"><a href="#L-525"><span class="linenos">525</span></a> <span class="k">def</span> <span class="nf">set_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-526"><a href="#L-526"><span class="linenos">526</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + </section> + <section id="MySQL"> + <input id="MySQL-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MySQL</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="MySQL-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL-100"><a href="#MySQL-100"><span class="linenos">100</span></a><span class="k">class</span> <span class="nc">MySQL</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="MySQL-101"><a href="#MySQL-101"><span class="linenos">101</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'%Y-%m-</span><span class="si">%d</span><span class="s2"> %T'"</span> +</span><span id="MySQL-102"><a href="#MySQL-102"><span class="linenos">102</span></a> +</span><span id="MySQL-103"><a href="#MySQL-103"><span class="linenos">103</span></a> <span class="c1"># https://prestodb.io/docs/current/functions/datetime.html#mysql-date-functions</span> +</span><span id="MySQL-104"><a href="#MySQL-104"><span class="linenos">104</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-105"><a href="#MySQL-105"><span class="linenos">105</span></a> <span class="s2">"%M"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="MySQL-106"><a href="#MySQL-106"><span class="linenos">106</span></a> <span class="s2">"</span><span class="si">%c</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="MySQL-107"><a href="#MySQL-107"><span class="linenos">107</span></a> <span class="s2">"</span><span class="si">%e</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="MySQL-108"><a href="#MySQL-108"><span class="linenos">108</span></a> <span class="s2">"%h"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="MySQL-109"><a href="#MySQL-109"><span class="linenos">109</span></a> <span class="s2">"</span><span class="si">%i</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="MySQL-110"><a href="#MySQL-110"><span class="linenos">110</span></a> <span class="s2">"</span><span class="si">%s</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="MySQL-111"><a href="#MySQL-111"><span class="linenos">111</span></a> <span class="s2">"%S"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="MySQL-112"><a href="#MySQL-112"><span class="linenos">112</span></a> <span class="s2">"</span><span class="si">%u</span><span class="s2">"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="MySQL-113"><a href="#MySQL-113"><span class="linenos">113</span></a> <span class="s2">"%k"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="MySQL-114"><a href="#MySQL-114"><span class="linenos">114</span></a> <span class="s2">"%l"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="MySQL-115"><a href="#MySQL-115"><span class="linenos">115</span></a> <span class="s2">"%T"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="MySQL-116"><a href="#MySQL-116"><span class="linenos">116</span></a> <span class="p">}</span> +</span><span id="MySQL-117"><a href="#MySQL-117"><span class="linenos">117</span></a> +</span><span id="MySQL-118"><a href="#MySQL-118"><span class="linenos">118</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="MySQL-119"><a href="#MySQL-119"><span class="linenos">119</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="MySQL-120"><a href="#MySQL-120"><span class="linenos">120</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="MySQL-121"><a href="#MySQL-121"><span class="linenos">121</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="MySQL-122"><a href="#MySQL-122"><span class="linenos">122</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="MySQL-123"><a href="#MySQL-123"><span class="linenos">123</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"b'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"B'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0b"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="MySQL-124"><a href="#MySQL-124"><span class="linenos">124</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="MySQL-125"><a href="#MySQL-125"><span class="linenos">125</span></a> +</span><span id="MySQL-126"><a href="#MySQL-126"><span class="linenos">126</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-127"><a href="#MySQL-127"><span class="linenos">127</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="MySQL-128"><a href="#MySQL-128"><span class="linenos">128</span></a> <span class="s2">"MEDIUMTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">,</span> +</span><span id="MySQL-129"><a href="#MySQL-129"><span class="linenos">129</span></a> <span class="s2">"LONGTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">,</span> +</span><span id="MySQL-130"><a href="#MySQL-130"><span class="linenos">130</span></a> <span class="s2">"MEDIUMBLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">,</span> +</span><span id="MySQL-131"><a href="#MySQL-131"><span class="linenos">131</span></a> <span class="s2">"LONGBLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">,</span> +</span><span id="MySQL-132"><a href="#MySQL-132"><span class="linenos">132</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="MySQL-133"><a href="#MySQL-133"><span class="linenos">133</span></a> <span class="s2">"SEPARATOR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEPARATOR</span><span class="p">,</span> +</span><span id="MySQL-134"><a href="#MySQL-134"><span class="linenos">134</span></a> <span class="s2">"_ARMSCII8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-135"><a href="#MySQL-135"><span class="linenos">135</span></a> <span class="s2">"_ASCII"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-136"><a href="#MySQL-136"><span class="linenos">136</span></a> <span class="s2">"_BIG5"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-137"><a href="#MySQL-137"><span class="linenos">137</span></a> <span class="s2">"_BINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-138"><a href="#MySQL-138"><span class="linenos">138</span></a> <span class="s2">"_CP1250"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-139"><a href="#MySQL-139"><span class="linenos">139</span></a> <span class="s2">"_CP1251"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-140"><a href="#MySQL-140"><span class="linenos">140</span></a> <span class="s2">"_CP1256"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-141"><a href="#MySQL-141"><span class="linenos">141</span></a> <span class="s2">"_CP1257"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-142"><a href="#MySQL-142"><span class="linenos">142</span></a> <span class="s2">"_CP850"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-143"><a href="#MySQL-143"><span class="linenos">143</span></a> <span class="s2">"_CP852"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-144"><a href="#MySQL-144"><span class="linenos">144</span></a> <span class="s2">"_CP866"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-145"><a href="#MySQL-145"><span class="linenos">145</span></a> <span class="s2">"_CP932"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-146"><a href="#MySQL-146"><span class="linenos">146</span></a> <span class="s2">"_DEC8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-147"><a href="#MySQL-147"><span class="linenos">147</span></a> <span class="s2">"_EUCJPMS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-148"><a href="#MySQL-148"><span class="linenos">148</span></a> <span class="s2">"_EUCKR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-149"><a href="#MySQL-149"><span class="linenos">149</span></a> <span class="s2">"_GB18030"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-150"><a href="#MySQL-150"><span class="linenos">150</span></a> <span class="s2">"_GB2312"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-151"><a href="#MySQL-151"><span class="linenos">151</span></a> <span class="s2">"_GBK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-152"><a href="#MySQL-152"><span class="linenos">152</span></a> <span class="s2">"_GEOSTD8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-153"><a href="#MySQL-153"><span class="linenos">153</span></a> <span class="s2">"_GREEK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-154"><a href="#MySQL-154"><span class="linenos">154</span></a> <span class="s2">"_HEBREW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-155"><a href="#MySQL-155"><span class="linenos">155</span></a> <span class="s2">"_HP8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-156"><a href="#MySQL-156"><span class="linenos">156</span></a> <span class="s2">"_KEYBCS2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-157"><a href="#MySQL-157"><span class="linenos">157</span></a> <span class="s2">"_KOI8R"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-158"><a href="#MySQL-158"><span class="linenos">158</span></a> <span class="s2">"_KOI8U"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-159"><a href="#MySQL-159"><span class="linenos">159</span></a> <span class="s2">"_LATIN1"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-160"><a href="#MySQL-160"><span class="linenos">160</span></a> <span class="s2">"_LATIN2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-161"><a href="#MySQL-161"><span class="linenos">161</span></a> <span class="s2">"_LATIN5"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-162"><a href="#MySQL-162"><span class="linenos">162</span></a> <span class="s2">"_LATIN7"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-163"><a href="#MySQL-163"><span class="linenos">163</span></a> <span class="s2">"_MACCE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-164"><a href="#MySQL-164"><span class="linenos">164</span></a> <span class="s2">"_MACROMAN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-165"><a href="#MySQL-165"><span class="linenos">165</span></a> <span class="s2">"_SJIS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-166"><a href="#MySQL-166"><span class="linenos">166</span></a> <span class="s2">"_SWE7"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-167"><a href="#MySQL-167"><span class="linenos">167</span></a> <span class="s2">"_TIS620"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-168"><a href="#MySQL-168"><span class="linenos">168</span></a> <span class="s2">"_UCS2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-169"><a href="#MySQL-169"><span class="linenos">169</span></a> <span class="s2">"_UJIS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-170"><a href="#MySQL-170"><span class="linenos">170</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/string-literals.html</span> +</span><span id="MySQL-171"><a href="#MySQL-171"><span class="linenos">171</span></a> <span class="s2">"_UTF8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-172"><a href="#MySQL-172"><span class="linenos">172</span></a> <span class="s2">"_UTF16"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-173"><a href="#MySQL-173"><span class="linenos">173</span></a> <span class="s2">"_UTF16LE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-174"><a href="#MySQL-174"><span class="linenos">174</span></a> <span class="s2">"_UTF32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-175"><a href="#MySQL-175"><span class="linenos">175</span></a> <span class="s2">"_UTF8MB3"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-176"><a href="#MySQL-176"><span class="linenos">176</span></a> <span class="s2">"_UTF8MB4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL-177"><a href="#MySQL-177"><span class="linenos">177</span></a> <span class="s2">"@@"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SESSION_PARAMETER</span><span class="p">,</span> +</span><span id="MySQL-178"><a href="#MySQL-178"><span class="linenos">178</span></a> <span class="p">}</span> +</span><span id="MySQL-179"><a href="#MySQL-179"><span class="linenos">179</span></a> +</span><span id="MySQL-180"><a href="#MySQL-180"><span class="linenos">180</span></a> <span class="n">COMMANDS</span> <span class="o">=</span> <span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">COMMANDS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">}</span> +</span><span id="MySQL-181"><a href="#MySQL-181"><span class="linenos">181</span></a> +</span><span id="MySQL-182"><a href="#MySQL-182"><span class="linenos">182</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="MySQL-183"><a href="#MySQL-183"><span class="linenos">183</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL-184"><a href="#MySQL-184"><span class="linenos">184</span></a> +</span><span id="MySQL-185"><a href="#MySQL-185"><span class="linenos">185</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-186"><a href="#MySQL-186"><span class="linenos">186</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL-187"><a href="#MySQL-187"><span class="linenos">187</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="MySQL-188"><a href="#MySQL-188"><span class="linenos">188</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">),</span> +</span><span id="MySQL-189"><a href="#MySQL-189"><span class="linenos">189</span></a> <span class="s2">"STR_TO_DATE"</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="MySQL-190"><a href="#MySQL-190"><span class="linenos">190</span></a> <span class="s2">"LOCATE"</span><span class="p">:</span> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="MySQL-191"><a href="#MySQL-191"><span class="linenos">191</span></a> <span class="s2">"INSTR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span><span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="MySQL-192"><a href="#MySQL-192"><span class="linenos">192</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="MySQL-193"><a href="#MySQL-193"><span class="linenos">193</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="MySQL-194"><a href="#MySQL-194"><span class="linenos">194</span></a> <span class="p">),</span> +</span><span id="MySQL-195"><a href="#MySQL-195"><span class="linenos">195</span></a> <span class="p">}</span> +</span><span id="MySQL-196"><a href="#MySQL-196"><span class="linenos">196</span></a> +</span><span id="MySQL-197"><a href="#MySQL-197"><span class="linenos">197</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-198"><a href="#MySQL-198"><span class="linenos">198</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL-199"><a href="#MySQL-199"><span class="linenos">199</span></a> <span class="s2">"GROUP_CONCAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-200"><a href="#MySQL-200"><span class="linenos">200</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> +</span><span id="MySQL-201"><a href="#MySQL-201"><span class="linenos">201</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">(),</span> +</span><span id="MySQL-202"><a href="#MySQL-202"><span class="linenos">202</span></a> <span class="n">separator</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEPARATOR</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(),</span> +</span><span id="MySQL-203"><a href="#MySQL-203"><span class="linenos">203</span></a> <span class="p">),</span> +</span><span id="MySQL-204"><a href="#MySQL-204"><span class="linenos">204</span></a> <span class="p">}</span> +</span><span id="MySQL-205"><a href="#MySQL-205"><span class="linenos">205</span></a> +</span><span id="MySQL-206"><a href="#MySQL-206"><span class="linenos">206</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-207"><a href="#MySQL-207"><span class="linenos">207</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL-208"><a href="#MySQL-208"><span class="linenos">208</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">),</span> +</span><span id="MySQL-209"><a href="#MySQL-209"><span class="linenos">209</span></a> <span class="p">}</span> +</span><span id="MySQL-210"><a href="#MySQL-210"><span class="linenos">210</span></a> +</span><span id="MySQL-211"><a href="#MySQL-211"><span class="linenos">211</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-212"><a href="#MySQL-212"><span class="linenos">212</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL-213"><a href="#MySQL-213"><span class="linenos">213</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_show</span><span class="p">(),</span> +</span><span id="MySQL-214"><a href="#MySQL-214"><span class="linenos">214</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set</span><span class="p">(),</span> +</span><span id="MySQL-215"><a href="#MySQL-215"><span class="linenos">215</span></a> <span class="p">}</span> +</span><span id="MySQL-216"><a href="#MySQL-216"><span class="linenos">216</span></a> +</span><span id="MySQL-217"><a href="#MySQL-217"><span class="linenos">217</span></a> <span class="n">SHOW_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-218"><a href="#MySQL-218"><span class="linenos">218</span></a> <span class="s2">"BINARY LOGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINARY LOGS"</span><span class="p">),</span> +</span><span id="MySQL-219"><a href="#MySQL-219"><span class="linenos">219</span></a> <span class="s2">"MASTER LOGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINARY LOGS"</span><span class="p">),</span> +</span><span id="MySQL-220"><a href="#MySQL-220"><span class="linenos">220</span></a> <span class="s2">"BINLOG EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINLOG EVENTS"</span><span class="p">),</span> +</span><span id="MySQL-221"><a href="#MySQL-221"><span class="linenos">221</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL-222"><a href="#MySQL-222"><span class="linenos">222</span></a> <span class="s2">"CHARSET"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL-223"><a href="#MySQL-223"><span class="linenos">223</span></a> <span class="s2">"COLLATION"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLLATION"</span><span class="p">),</span> +</span><span id="MySQL-224"><a href="#MySQL-224"><span class="linenos">224</span></a> <span class="s2">"FULL COLUMNS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-225"><a href="#MySQL-225"><span class="linenos">225</span></a> <span class="s2">"COLUMNS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">),</span> +</span><span id="MySQL-226"><a href="#MySQL-226"><span class="linenos">226</span></a> <span class="s2">"CREATE DATABASE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE DATABASE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-227"><a href="#MySQL-227"><span class="linenos">227</span></a> <span class="s2">"CREATE EVENT"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE EVENT"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-228"><a href="#MySQL-228"><span class="linenos">228</span></a> <span class="s2">"CREATE FUNCTION"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE FUNCTION"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-229"><a href="#MySQL-229"><span class="linenos">229</span></a> <span class="s2">"CREATE PROCEDURE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE PROCEDURE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-230"><a href="#MySQL-230"><span class="linenos">230</span></a> <span class="s2">"CREATE TABLE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE TABLE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-231"><a href="#MySQL-231"><span class="linenos">231</span></a> <span class="s2">"CREATE TRIGGER"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE TRIGGER"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-232"><a href="#MySQL-232"><span class="linenos">232</span></a> <span class="s2">"CREATE VIEW"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE VIEW"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-233"><a href="#MySQL-233"><span class="linenos">233</span></a> <span class="s2">"DATABASES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"DATABASES"</span><span class="p">),</span> +</span><span id="MySQL-234"><a href="#MySQL-234"><span class="linenos">234</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-235"><a href="#MySQL-235"><span class="linenos">235</span></a> <span class="s2">"STORAGE ENGINES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINES"</span><span class="p">),</span> +</span><span id="MySQL-236"><a href="#MySQL-236"><span class="linenos">236</span></a> <span class="s2">"ENGINES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINES"</span><span class="p">),</span> +</span><span id="MySQL-237"><a href="#MySQL-237"><span class="linenos">237</span></a> <span class="s2">"ERRORS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ERRORS"</span><span class="p">),</span> +</span><span id="MySQL-238"><a href="#MySQL-238"><span class="linenos">238</span></a> <span class="s2">"EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"EVENTS"</span><span class="p">),</span> +</span><span id="MySQL-239"><a href="#MySQL-239"><span class="linenos">239</span></a> <span class="s2">"FUNCTION CODE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"FUNCTION CODE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-240"><a href="#MySQL-240"><span class="linenos">240</span></a> <span class="s2">"FUNCTION STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"FUNCTION STATUS"</span><span class="p">),</span> +</span><span id="MySQL-241"><a href="#MySQL-241"><span class="linenos">241</span></a> <span class="s2">"GRANTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"GRANTS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FOR"</span><span class="p">),</span> +</span><span id="MySQL-242"><a href="#MySQL-242"><span class="linenos">242</span></a> <span class="s2">"INDEX"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"INDEX"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">),</span> +</span><span id="MySQL-243"><a href="#MySQL-243"><span class="linenos">243</span></a> <span class="s2">"MASTER STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"MASTER STATUS"</span><span class="p">),</span> +</span><span id="MySQL-244"><a href="#MySQL-244"><span class="linenos">244</span></a> <span class="s2">"OPEN TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"OPEN TABLES"</span><span class="p">),</span> +</span><span id="MySQL-245"><a href="#MySQL-245"><span class="linenos">245</span></a> <span class="s2">"PLUGINS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PLUGINS"</span><span class="p">),</span> +</span><span id="MySQL-246"><a href="#MySQL-246"><span class="linenos">246</span></a> <span class="s2">"PROCEDURE CODE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCEDURE CODE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-247"><a href="#MySQL-247"><span class="linenos">247</span></a> <span class="s2">"PROCEDURE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCEDURE STATUS"</span><span class="p">),</span> +</span><span id="MySQL-248"><a href="#MySQL-248"><span class="linenos">248</span></a> <span class="s2">"PRIVILEGES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PRIVILEGES"</span><span class="p">),</span> +</span><span id="MySQL-249"><a href="#MySQL-249"><span class="linenos">249</span></a> <span class="s2">"FULL PROCESSLIST"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCESSLIST"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-250"><a href="#MySQL-250"><span class="linenos">250</span></a> <span class="s2">"PROCESSLIST"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCESSLIST"</span><span class="p">),</span> +</span><span id="MySQL-251"><a href="#MySQL-251"><span class="linenos">251</span></a> <span class="s2">"PROFILE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROFILE"</span><span class="p">),</span> +</span><span id="MySQL-252"><a href="#MySQL-252"><span class="linenos">252</span></a> <span class="s2">"PROFILES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROFILES"</span><span class="p">),</span> +</span><span id="MySQL-253"><a href="#MySQL-253"><span class="linenos">253</span></a> <span class="s2">"RELAYLOG EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"RELAYLOG EVENTS"</span><span class="p">),</span> +</span><span id="MySQL-254"><a href="#MySQL-254"><span class="linenos">254</span></a> <span class="s2">"REPLICAS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICAS"</span><span class="p">),</span> +</span><span id="MySQL-255"><a href="#MySQL-255"><span class="linenos">255</span></a> <span class="s2">"SLAVE HOSTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICAS"</span><span class="p">),</span> +</span><span id="MySQL-256"><a href="#MySQL-256"><span class="linenos">256</span></a> <span class="s2">"REPLICA STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICA STATUS"</span><span class="p">),</span> +</span><span id="MySQL-257"><a href="#MySQL-257"><span class="linenos">257</span></a> <span class="s2">"SLAVE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICA STATUS"</span><span class="p">),</span> +</span><span id="MySQL-258"><a href="#MySQL-258"><span class="linenos">258</span></a> <span class="s2">"GLOBAL STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-259"><a href="#MySQL-259"><span class="linenos">259</span></a> <span class="s2">"SESSION STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">),</span> +</span><span id="MySQL-260"><a href="#MySQL-260"><span class="linenos">260</span></a> <span class="s2">"STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">),</span> +</span><span id="MySQL-261"><a href="#MySQL-261"><span class="linenos">261</span></a> <span class="s2">"TABLE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLE STATUS"</span><span class="p">),</span> +</span><span id="MySQL-262"><a href="#MySQL-262"><span class="linenos">262</span></a> <span class="s2">"FULL TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLES"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-263"><a href="#MySQL-263"><span class="linenos">263</span></a> <span class="s2">"TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLES"</span><span class="p">),</span> +</span><span id="MySQL-264"><a href="#MySQL-264"><span class="linenos">264</span></a> <span class="s2">"TRIGGERS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TRIGGERS"</span><span class="p">),</span> +</span><span id="MySQL-265"><a href="#MySQL-265"><span class="linenos">265</span></a> <span class="s2">"GLOBAL VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL-266"><a href="#MySQL-266"><span class="linenos">266</span></a> <span class="s2">"SESSION VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">),</span> +</span><span id="MySQL-267"><a href="#MySQL-267"><span class="linenos">267</span></a> <span class="s2">"VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">),</span> +</span><span id="MySQL-268"><a href="#MySQL-268"><span class="linenos">268</span></a> <span class="s2">"WARNINGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"WARNINGS"</span><span class="p">),</span> +</span><span id="MySQL-269"><a href="#MySQL-269"><span class="linenos">269</span></a> <span class="p">}</span> +</span><span id="MySQL-270"><a href="#MySQL-270"><span class="linenos">270</span></a> +</span><span id="MySQL-271"><a href="#MySQL-271"><span class="linenos">271</span></a> <span class="n">SET_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-272"><a href="#MySQL-272"><span class="linenos">272</span></a> <span class="s2">"GLOBAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"GLOBAL"</span><span class="p">),</span> +</span><span id="MySQL-273"><a href="#MySQL-273"><span class="linenos">273</span></a> <span class="s2">"PERSIST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"PERSIST"</span><span class="p">),</span> +</span><span id="MySQL-274"><a href="#MySQL-274"><span class="linenos">274</span></a> <span class="s2">"PERSIST_ONLY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"PERSIST_ONLY"</span><span class="p">),</span> +</span><span id="MySQL-275"><a href="#MySQL-275"><span class="linenos">275</span></a> <span class="s2">"SESSION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"SESSION"</span><span class="p">),</span> +</span><span id="MySQL-276"><a href="#MySQL-276"><span class="linenos">276</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"LOCAL"</span><span class="p">),</span> +</span><span id="MySQL-277"><a href="#MySQL-277"><span class="linenos">277</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_charset</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL-278"><a href="#MySQL-278"><span class="linenos">278</span></a> <span class="s2">"CHARSET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_charset</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL-279"><a href="#MySQL-279"><span class="linenos">279</span></a> <span class="s2">"NAMES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_names</span><span class="p">(),</span> +</span><span id="MySQL-280"><a href="#MySQL-280"><span class="linenos">280</span></a> <span class="s2">"TRANSACTION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_transaction</span><span class="p">(),</span> +</span><span id="MySQL-281"><a href="#MySQL-281"><span class="linenos">281</span></a> <span class="p">}</span> +</span><span id="MySQL-282"><a href="#MySQL-282"><span class="linenos">282</span></a> +</span><span id="MySQL-283"><a href="#MySQL-283"><span class="linenos">283</span></a> <span class="n">PROFILE_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-284"><a href="#MySQL-284"><span class="linenos">284</span></a> <span class="s2">"ALL"</span><span class="p">,</span> +</span><span id="MySQL-285"><a href="#MySQL-285"><span class="linenos">285</span></a> <span class="s2">"BLOCK IO"</span><span class="p">,</span> +</span><span id="MySQL-286"><a href="#MySQL-286"><span class="linenos">286</span></a> <span class="s2">"CONTEXT SWITCHES"</span><span class="p">,</span> +</span><span id="MySQL-287"><a href="#MySQL-287"><span class="linenos">287</span></a> <span class="s2">"CPU"</span><span class="p">,</span> +</span><span id="MySQL-288"><a href="#MySQL-288"><span class="linenos">288</span></a> <span class="s2">"IPC"</span><span class="p">,</span> +</span><span id="MySQL-289"><a href="#MySQL-289"><span class="linenos">289</span></a> <span class="s2">"MEMORY"</span><span class="p">,</span> +</span><span id="MySQL-290"><a href="#MySQL-290"><span class="linenos">290</span></a> <span class="s2">"PAGE FAULTS"</span><span class="p">,</span> +</span><span id="MySQL-291"><a href="#MySQL-291"><span class="linenos">291</span></a> <span class="s2">"SOURCE"</span><span class="p">,</span> +</span><span id="MySQL-292"><a href="#MySQL-292"><span class="linenos">292</span></a> <span class="s2">"SWAPS"</span><span class="p">,</span> +</span><span id="MySQL-293"><a href="#MySQL-293"><span class="linenos">293</span></a> <span class="p">}</span> +</span><span id="MySQL-294"><a href="#MySQL-294"><span class="linenos">294</span></a> +</span><span id="MySQL-295"><a href="#MySQL-295"><span class="linenos">295</span></a> <span class="n">TRANSACTION_CHARACTERISTICS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-296"><a href="#MySQL-296"><span class="linenos">296</span></a> <span class="s2">"ISOLATION LEVEL REPEATABLE READ"</span><span class="p">,</span> +</span><span id="MySQL-297"><a href="#MySQL-297"><span class="linenos">297</span></a> <span class="s2">"ISOLATION LEVEL READ COMMITTED"</span><span class="p">,</span> +</span><span id="MySQL-298"><a href="#MySQL-298"><span class="linenos">298</span></a> <span class="s2">"ISOLATION LEVEL READ UNCOMMITTED"</span><span class="p">,</span> +</span><span id="MySQL-299"><a href="#MySQL-299"><span class="linenos">299</span></a> <span class="s2">"ISOLATION LEVEL SERIALIZABLE"</span><span class="p">,</span> +</span><span id="MySQL-300"><a href="#MySQL-300"><span class="linenos">300</span></a> <span class="s2">"READ WRITE"</span><span class="p">,</span> +</span><span id="MySQL-301"><a href="#MySQL-301"><span class="linenos">301</span></a> <span class="s2">"READ ONLY"</span><span class="p">,</span> +</span><span id="MySQL-302"><a href="#MySQL-302"><span class="linenos">302</span></a> <span class="p">}</span> +</span><span id="MySQL-303"><a href="#MySQL-303"><span class="linenos">303</span></a> +</span><span id="MySQL-304"><a href="#MySQL-304"><span class="linenos">304</span></a> <span class="k">def</span> <span class="nf">_parse_show_mysql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="MySQL-305"><a href="#MySQL-305"><span class="linenos">305</span></a> <span class="k">if</span> <span class="n">target</span><span class="p">:</span> +</span><span id="MySQL-306"><a href="#MySQL-306"><span class="linenos">306</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="MySQL-307"><a href="#MySQL-307"><span class="linenos">307</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="n">target</span><span class="p">)</span> +</span><span id="MySQL-308"><a href="#MySQL-308"><span class="linenos">308</span></a> <span class="n">target_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL-309"><a href="#MySQL-309"><span class="linenos">309</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL-310"><a href="#MySQL-310"><span class="linenos">310</span></a> <span class="n">target_id</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL-311"><a href="#MySQL-311"><span class="linenos">311</span></a> +</span><span id="MySQL-312"><a href="#MySQL-312"><span class="linenos">312</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-313"><a href="#MySQL-313"><span class="linenos">313</span></a> +</span><span id="MySQL-314"><a href="#MySQL-314"><span class="linenos">314</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"BINLOG EVENTS"</span><span class="p">,</span> <span class="s2">"RELAYLOG EVENTS"</span><span class="p">}:</span> +</span><span id="MySQL-315"><a href="#MySQL-315"><span class="linenos">315</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-316"><a href="#MySQL-316"><span class="linenos">316</span></a> <span class="n">db</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL-317"><a href="#MySQL-317"><span class="linenos">317</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL-318"><a href="#MySQL-318"><span class="linenos">318</span></a> <span class="n">position</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL-319"><a href="#MySQL-319"><span class="linenos">319</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-320"><a href="#MySQL-320"><span class="linenos">320</span></a> +</span><span id="MySQL-321"><a href="#MySQL-321"><span class="linenos">321</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"CHANNEL"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-322"><a href="#MySQL-322"><span class="linenos">322</span></a> +</span><span id="MySQL-323"><a href="#MySQL-323"><span class="linenos">323</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-324"><a href="#MySQL-324"><span class="linenos">324</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">()</span> +</span><span id="MySQL-325"><a href="#MySQL-325"><span class="linenos">325</span></a> +</span><span id="MySQL-326"><a href="#MySQL-326"><span class="linenos">326</span></a> <span class="k">if</span> <span class="n">this</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="MySQL-327"><a href="#MySQL-327"><span class="linenos">327</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PROFILE_TYPES</span><span class="p">))</span> +</span><span id="MySQL-328"><a href="#MySQL-328"><span class="linenos">328</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"QUERY"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-329"><a href="#MySQL-329"><span class="linenos">329</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-330"><a href="#MySQL-330"><span class="linenos">330</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-331"><a href="#MySQL-331"><span class="linenos">331</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL-332"><a href="#MySQL-332"><span class="linenos">332</span></a> <span class="n">types</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span> +</span><span id="MySQL-333"><a href="#MySQL-333"><span class="linenos">333</span></a> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_oldstyle_limit</span><span class="p">()</span> +</span><span id="MySQL-334"><a href="#MySQL-334"><span class="linenos">334</span></a> +</span><span id="MySQL-335"><a href="#MySQL-335"><span class="linenos">335</span></a> <span class="n">mutex</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MUTEX"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL-336"><a href="#MySQL-336"><span class="linenos">336</span></a> <span class="n">mutex</span> <span class="o">=</span> <span class="kc">False</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">)</span> <span class="k">else</span> <span class="n">mutex</span> +</span><span id="MySQL-337"><a href="#MySQL-337"><span class="linenos">337</span></a> +</span><span id="MySQL-338"><a href="#MySQL-338"><span class="linenos">338</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-339"><a href="#MySQL-339"><span class="linenos">339</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Show</span><span class="p">,</span> +</span><span id="MySQL-340"><a href="#MySQL-340"><span class="linenos">340</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="MySQL-341"><a href="#MySQL-341"><span class="linenos">341</span></a> <span class="n">target</span><span class="o">=</span><span class="n">target_id</span><span class="p">,</span> +</span><span id="MySQL-342"><a href="#MySQL-342"><span class="linenos">342</span></a> <span class="n">full</span><span class="o">=</span><span class="n">full</span><span class="p">,</span> +</span><span id="MySQL-343"><a href="#MySQL-343"><span class="linenos">343</span></a> <span class="n">log</span><span class="o">=</span><span class="n">log</span><span class="p">,</span> +</span><span id="MySQL-344"><a href="#MySQL-344"><span class="linenos">344</span></a> <span class="n">position</span><span class="o">=</span><span class="n">position</span><span class="p">,</span> +</span><span id="MySQL-345"><a href="#MySQL-345"><span class="linenos">345</span></a> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> +</span><span id="MySQL-346"><a href="#MySQL-346"><span class="linenos">346</span></a> <span class="n">channel</span><span class="o">=</span><span class="n">channel</span><span class="p">,</span> +</span><span id="MySQL-347"><a href="#MySQL-347"><span class="linenos">347</span></a> <span class="n">like</span><span class="o">=</span><span class="n">like</span><span class="p">,</span> +</span><span id="MySQL-348"><a href="#MySQL-348"><span class="linenos">348</span></a> <span class="n">where</span><span class="o">=</span><span class="n">where</span><span class="p">,</span> +</span><span id="MySQL-349"><a href="#MySQL-349"><span class="linenos">349</span></a> <span class="n">types</span><span class="o">=</span><span class="n">types</span><span class="p">,</span> +</span><span id="MySQL-350"><a href="#MySQL-350"><span class="linenos">350</span></a> <span class="n">query</span><span class="o">=</span><span class="n">query</span><span class="p">,</span> +</span><span id="MySQL-351"><a href="#MySQL-351"><span class="linenos">351</span></a> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> +</span><span id="MySQL-352"><a href="#MySQL-352"><span class="linenos">352</span></a> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> +</span><span id="MySQL-353"><a href="#MySQL-353"><span class="linenos">353</span></a> <span class="n">mutex</span><span class="o">=</span><span class="n">mutex</span><span class="p">,</span> +</span><span id="MySQL-354"><a href="#MySQL-354"><span class="linenos">354</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"global"</span><span class="p">:</span> <span class="n">global_</span><span class="p">},</span> +</span><span id="MySQL-355"><a href="#MySQL-355"><span class="linenos">355</span></a> <span class="p">)</span> +</span><span id="MySQL-356"><a href="#MySQL-356"><span class="linenos">356</span></a> +</span><span id="MySQL-357"><a href="#MySQL-357"><span class="linenos">357</span></a> <span class="k">def</span> <span class="nf">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">options</span><span class="p">):</span> +</span><span id="MySQL-358"><a href="#MySQL-358"><span class="linenos">358</span></a> <span class="k">for</span> <span class="n">option</span> <span class="ow">in</span> <span class="n">options</span><span class="p">:</span> +</span><span id="MySQL-359"><a href="#MySQL-359"><span class="linenos">359</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="o">*</span><span class="n">option</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)):</span> +</span><span id="MySQL-360"><a href="#MySQL-360"><span class="linenos">360</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">option</span><span class="p">)</span> +</span><span id="MySQL-361"><a href="#MySQL-361"><span class="linenos">361</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="MySQL-362"><a href="#MySQL-362"><span class="linenos">362</span></a> +</span><span id="MySQL-363"><a href="#MySQL-363"><span class="linenos">363</span></a> <span class="k">def</span> <span class="nf">_parse_oldstyle_limit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="MySQL-364"><a href="#MySQL-364"><span class="linenos">364</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL-365"><a href="#MySQL-365"><span class="linenos">365</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL-366"><a href="#MySQL-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">):</span> +</span><span id="MySQL-367"><a href="#MySQL-367"><span class="linenos">367</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">)</span> +</span><span id="MySQL-368"><a href="#MySQL-368"><span class="linenos">368</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="MySQL-369"><a href="#MySQL-369"><span class="linenos">369</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="MySQL-370"><a href="#MySQL-370"><span class="linenos">370</span></a> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="MySQL-371"><a href="#MySQL-371"><span class="linenos">371</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> +</span><span id="MySQL-372"><a href="#MySQL-372"><span class="linenos">372</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="MySQL-373"><a href="#MySQL-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span> +</span><span id="MySQL-374"><a href="#MySQL-374"><span class="linenos">374</span></a> +</span><span id="MySQL-375"><a href="#MySQL-375"><span class="linenos">375</span></a> <span class="k">def</span> <span class="nf">_default_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="MySQL-376"><a href="#MySQL-376"><span class="linenos">376</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> +</span><span id="MySQL-377"><a href="#MySQL-377"><span class="linenos">377</span></a> +</span><span id="MySQL-378"><a href="#MySQL-378"><span class="linenos">378</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_assignment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="MySQL-379"><a href="#MySQL-379"><span class="linenos">379</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"GLOBAL"</span><span class="p">,</span> <span class="s2">"SESSION"</span><span class="p">}</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSACTION"</span><span class="p">):</span> +</span><span id="MySQL-380"><a href="#MySQL-380"><span class="linenos">380</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_transaction</span><span class="p">(</span><span class="n">global_</span><span class="o">=</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"GLOBAL"</span><span class="p">)</span> +</span><span id="MySQL-381"><a href="#MySQL-381"><span class="linenos">381</span></a> +</span><span id="MySQL-382"><a href="#MySQL-382"><span class="linenos">382</span></a> <span class="n">left</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL-383"><a href="#MySQL-383"><span class="linenos">383</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="MySQL-384"><a href="#MySQL-384"><span class="linenos">384</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected ="</span><span class="p">)</span> +</span><span id="MySQL-385"><a href="#MySQL-385"><span class="linenos">385</span></a> <span class="n">right</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL-386"><a href="#MySQL-386"><span class="linenos">386</span></a> +</span><span id="MySQL-387"><a href="#MySQL-387"><span class="linenos">387</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-388"><a href="#MySQL-388"><span class="linenos">388</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="MySQL-389"><a href="#MySQL-389"><span class="linenos">389</span></a> <span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> +</span><span id="MySQL-390"><a href="#MySQL-390"><span class="linenos">390</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> +</span><span id="MySQL-391"><a href="#MySQL-391"><span class="linenos">391</span></a> <span class="p">)</span> +</span><span id="MySQL-392"><a href="#MySQL-392"><span class="linenos">392</span></a> +</span><span id="MySQL-393"><a href="#MySQL-393"><span class="linenos">393</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-394"><a href="#MySQL-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL-395"><a href="#MySQL-395"><span class="linenos">395</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="MySQL-396"><a href="#MySQL-396"><span class="linenos">396</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="MySQL-397"><a href="#MySQL-397"><span class="linenos">397</span></a> <span class="p">)</span> +</span><span id="MySQL-398"><a href="#MySQL-398"><span class="linenos">398</span></a> +</span><span id="MySQL-399"><a href="#MySQL-399"><span class="linenos">399</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_charset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="MySQL-400"><a href="#MySQL-400"><span class="linenos">400</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL-401"><a href="#MySQL-401"><span class="linenos">401</span></a> +</span><span id="MySQL-402"><a href="#MySQL-402"><span class="linenos">402</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-403"><a href="#MySQL-403"><span class="linenos">403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL-404"><a href="#MySQL-404"><span class="linenos">404</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="MySQL-405"><a href="#MySQL-405"><span class="linenos">405</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="MySQL-406"><a href="#MySQL-406"><span class="linenos">406</span></a> <span class="p">)</span> +</span><span id="MySQL-407"><a href="#MySQL-407"><span class="linenos">407</span></a> +</span><span id="MySQL-408"><a href="#MySQL-408"><span class="linenos">408</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="MySQL-409"><a href="#MySQL-409"><span class="linenos">409</span></a> <span class="n">charset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL-410"><a href="#MySQL-410"><span class="linenos">410</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"COLLATE"</span><span class="p">):</span> +</span><span id="MySQL-411"><a href="#MySQL-411"><span class="linenos">411</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL-412"><a href="#MySQL-412"><span class="linenos">412</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL-413"><a href="#MySQL-413"><span class="linenos">413</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL-414"><a href="#MySQL-414"><span class="linenos">414</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-415"><a href="#MySQL-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL-416"><a href="#MySQL-416"><span class="linenos">416</span></a> <span class="n">this</span><span class="o">=</span><span class="n">charset</span><span class="p">,</span> +</span><span id="MySQL-417"><a href="#MySQL-417"><span class="linenos">417</span></a> <span class="n">collate</span><span class="o">=</span><span class="n">collate</span><span class="p">,</span> +</span><span id="MySQL-418"><a href="#MySQL-418"><span class="linenos">418</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"NAMES"</span><span class="p">,</span> +</span><span id="MySQL-419"><a href="#MySQL-419"><span class="linenos">419</span></a> <span class="p">)</span> +</span><span id="MySQL-420"><a href="#MySQL-420"><span class="linenos">420</span></a> +</span><span id="MySQL-421"><a href="#MySQL-421"><span class="linenos">421</span></a> <span class="k">def</span> <span class="nf">_parse_set_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="MySQL-422"><a href="#MySQL-422"><span class="linenos">422</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSACTION"</span><span class="p">)</span> +</span><span id="MySQL-423"><a href="#MySQL-423"><span class="linenos">423</span></a> <span class="n">characteristics</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="MySQL-424"><a href="#MySQL-424"><span class="linenos">424</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRANSACTION_CHARACTERISTICS</span><span class="p">)</span> +</span><span id="MySQL-425"><a href="#MySQL-425"><span class="linenos">425</span></a> <span class="p">)</span> +</span><span id="MySQL-426"><a href="#MySQL-426"><span class="linenos">426</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL-427"><a href="#MySQL-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL-428"><a href="#MySQL-428"><span class="linenos">428</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">characteristics</span><span class="p">,</span> +</span><span id="MySQL-429"><a href="#MySQL-429"><span class="linenos">429</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> +</span><span id="MySQL-430"><a href="#MySQL-430"><span class="linenos">430</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"global"</span><span class="p">:</span> <span class="n">global_</span><span class="p">},</span> +</span><span id="MySQL-431"><a href="#MySQL-431"><span class="linenos">431</span></a> <span class="p">)</span> +</span><span id="MySQL-432"><a href="#MySQL-432"><span class="linenos">432</span></a> +</span><span id="MySQL-433"><a href="#MySQL-433"><span class="linenos">433</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="MySQL-434"><a href="#MySQL-434"><span class="linenos">434</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="MySQL-435"><a href="#MySQL-435"><span class="linenos">435</span></a> <span class="n">NULL_ORDERING_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="MySQL-436"><a href="#MySQL-436"><span class="linenos">436</span></a> +</span><span id="MySQL-437"><a href="#MySQL-437"><span class="linenos">437</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL-438"><a href="#MySQL-438"><span class="linenos">438</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL-439"><a href="#MySQL-439"><span class="linenos">439</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="MySQL-440"><a href="#MySQL-440"><span class="linenos">440</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="MySQL-441"><a href="#MySQL-441"><span class="linenos">441</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="MySQL-442"><a href="#MySQL-442"><span class="linenos">442</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="MySQL-443"><a href="#MySQL-443"><span class="linenos">443</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="MySQL-444"><a href="#MySQL-444"><span class="linenos">444</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="MySQL-445"><a href="#MySQL-445"><span class="linenos">445</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="MySQL-446"><a href="#MySQL-446"><span class="linenos">446</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">:</span> <span class="n">_date_trunc_sql</span><span class="p">,</span> +</span><span id="MySQL-447"><a href="#MySQL-447"><span class="linenos">447</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""GROUP_CONCAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s2">"this"</span><span class="p">)</span><span class="si">}</span><span class="s2"> SEPARATOR </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s2">"separator"</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"','"</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="MySQL-448"><a href="#MySQL-448"><span class="linenos">448</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date_sql</span><span class="p">,</span> +</span><span id="MySQL-449"><a href="#MySQL-449"><span class="linenos">449</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_date_sql</span><span class="p">,</span> +</span><span id="MySQL-450"><a href="#MySQL-450"><span class="linenos">450</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">_trim_sql</span><span class="p">,</span> +</span><span id="MySQL-451"><a href="#MySQL-451"><span class="linenos">451</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"<=>"</span><span class="p">),</span> +</span><span id="MySQL-452"><a href="#MySQL-452"><span class="linenos">452</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">not_sql</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"<=>"</span><span class="p">)),</span> +</span><span id="MySQL-453"><a href="#MySQL-453"><span class="linenos">453</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="MySQL-454"><a href="#MySQL-454"><span class="linenos">454</span></a> <span class="p">}</span> +</span><span id="MySQL-455"><a href="#MySQL-455"><span class="linenos">455</span></a> +</span><span id="MySQL-456"><a href="#MySQL-456"><span class="linenos">456</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="MySQL-457"><a href="#MySQL-457"><span class="linenos">457</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">)</span> +</span><span id="MySQL-458"><a href="#MySQL-458"><span class="linenos">458</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">)</span> +</span><span id="MySQL-459"><a href="#MySQL-459"><span class="linenos">459</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">)</span> +</span><span id="MySQL-460"><a href="#MySQL-460"><span class="linenos">460</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">)</span> +</span><span id="MySQL-461"><a href="#MySQL-461"><span class="linenos">461</span></a> +</span><span id="MySQL-462"><a href="#MySQL-462"><span class="linenos">462</span></a> <span class="k">def</span> <span class="nf">show_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL-463"><a href="#MySQL-463"><span class="linenos">463</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-464"><a href="#MySQL-464"><span class="linenos">464</span></a> <span class="n">full</span> <span class="o">=</span> <span class="s2">" FULL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"full"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL-465"><a href="#MySQL-465"><span class="linenos">465</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL-466"><a href="#MySQL-466"><span class="linenos">466</span></a> +</span><span id="MySQL-467"><a href="#MySQL-467"><span class="linenos">467</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"target"</span><span class="p">)</span> +</span><span id="MySQL-468"><a href="#MySQL-468"><span class="linenos">468</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">target</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL-469"><a href="#MySQL-469"><span class="linenos">469</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="s2">"INDEX"</span><span class="p">}:</span> +</span><span id="MySQL-470"><a href="#MySQL-470"><span class="linenos">470</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-471"><a href="#MySQL-471"><span class="linenos">471</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"GRANTS"</span><span class="p">:</span> +</span><span id="MySQL-472"><a href="#MySQL-472"><span class="linenos">472</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FOR</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-473"><a href="#MySQL-473"><span class="linenos">473</span></a> +</span><span id="MySQL-474"><a href="#MySQL-474"><span class="linenos">474</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">)</span> +</span><span id="MySQL-475"><a href="#MySQL-475"><span class="linenos">475</span></a> +</span><span id="MySQL-476"><a href="#MySQL-476"><span class="linenos">476</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"like"</span><span class="p">)</span> +</span><span id="MySQL-477"><a href="#MySQL-477"><span class="linenos">477</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="MySQL-478"><a href="#MySQL-478"><span class="linenos">478</span></a> +</span><span id="MySQL-479"><a href="#MySQL-479"><span class="linenos">479</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"types"</span><span class="p">)</span> +</span><span id="MySQL-480"><a href="#MySQL-480"><span class="linenos">480</span></a> <span class="n">types</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">types</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">types</span> <span class="k">else</span> <span class="n">types</span> +</span><span id="MySQL-481"><a href="#MySQL-481"><span class="linenos">481</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR QUERY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"query"</span><span class="p">)</span> +</span><span id="MySQL-482"><a href="#MySQL-482"><span class="linenos">482</span></a> +</span><span id="MySQL-483"><a href="#MySQL-483"><span class="linenos">483</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="MySQL-484"><a href="#MySQL-484"><span class="linenos">484</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="MySQL-485"><a href="#MySQL-485"><span class="linenos">485</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="MySQL-486"><a href="#MySQL-486"><span class="linenos">486</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL-487"><a href="#MySQL-487"><span class="linenos">487</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="MySQL-488"><a href="#MySQL-488"><span class="linenos">488</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_oldstyle_limit_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="MySQL-489"><a href="#MySQL-489"><span class="linenos">489</span></a> +</span><span id="MySQL-490"><a href="#MySQL-490"><span class="linenos">490</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"log"</span><span class="p">)</span> +</span><span id="MySQL-491"><a href="#MySQL-491"><span class="linenos">491</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="MySQL-492"><a href="#MySQL-492"><span class="linenos">492</span></a> +</span><span id="MySQL-493"><a href="#MySQL-493"><span class="linenos">493</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR CHANNEL"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"channel"</span><span class="p">)</span> +</span><span id="MySQL-494"><a href="#MySQL-494"><span class="linenos">494</span></a> +</span><span id="MySQL-495"><a href="#MySQL-495"><span class="linenos">495</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"ENGINE"</span><span class="p">:</span> +</span><span id="MySQL-496"><a href="#MySQL-496"><span class="linenos">496</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">" MUTEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"mutex"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" STATUS"</span> +</span><span id="MySQL-497"><a href="#MySQL-497"><span class="linenos">497</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL-498"><a href="#MySQL-498"><span class="linenos">498</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="MySQL-499"><a href="#MySQL-499"><span class="linenos">499</span></a> +</span><span id="MySQL-500"><a href="#MySQL-500"><span class="linenos">500</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SHOW</span><span class="si">{</span><span class="n">full</span><span class="si">}{</span><span class="n">global_</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">target</span><span class="si">}{</span><span class="n">types</span><span class="si">}{</span><span class="n">db</span><span class="si">}{</span><span class="n">query</span><span class="si">}{</span><span class="n">log</span><span class="si">}{</span><span class="n">position</span><span class="si">}{</span><span class="n">channel</span><span class="si">}{</span><span class="n">mutex_or_status</span><span class="si">}{</span><span class="n">like</span><span class="si">}{</span><span class="n">where</span><span class="si">}{</span><span class="n">offset</span><span class="si">}{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-501"><a href="#MySQL-501"><span class="linenos">501</span></a> +</span><span id="MySQL-502"><a href="#MySQL-502"><span class="linenos">502</span></a> <span class="k">def</span> <span class="nf">_prefixed_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">arg</span><span class="p">):</span> +</span><span id="MySQL-503"><a href="#MySQL-503"><span class="linenos">503</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">arg</span><span class="p">)</span> +</span><span id="MySQL-504"><a href="#MySQL-504"><span class="linenos">504</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">sql</span><span class="p">:</span> +</span><span id="MySQL-505"><a href="#MySQL-505"><span class="linenos">505</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="MySQL-506"><a href="#MySQL-506"><span class="linenos">506</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">prefix</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-507"><a href="#MySQL-507"><span class="linenos">507</span></a> +</span><span id="MySQL-508"><a href="#MySQL-508"><span class="linenos">508</span></a> <span class="k">def</span> <span class="nf">_oldstyle_limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL-509"><a href="#MySQL-509"><span class="linenos">509</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="MySQL-510"><a href="#MySQL-510"><span class="linenos">510</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="MySQL-511"><a href="#MySQL-511"><span class="linenos">511</span></a> <span class="k">if</span> <span class="n">limit</span><span class="p">:</span> +</span><span id="MySQL-512"><a href="#MySQL-512"><span class="linenos">512</span></a> <span class="n">limit_offset</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">offset</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">offset</span> <span class="k">else</span> <span class="n">limit</span> +</span><span id="MySQL-513"><a href="#MySQL-513"><span class="linenos">513</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">" LIMIT </span><span class="si">{</span><span class="n">limit_offset</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-514"><a href="#MySQL-514"><span class="linenos">514</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="MySQL-515"><a href="#MySQL-515"><span class="linenos">515</span></a> +</span><span id="MySQL-516"><a href="#MySQL-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">setitem_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL-517"><a href="#MySQL-517"><span class="linenos">517</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="MySQL-518"><a href="#MySQL-518"><span class="linenos">518</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL-519"><a href="#MySQL-519"><span class="linenos">519</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="MySQL-520"><a href="#MySQL-520"><span class="linenos">520</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="MySQL-521"><a href="#MySQL-521"><span class="linenos">521</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="MySQL-522"><a href="#MySQL-522"><span class="linenos">522</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL-523"><a href="#MySQL-523"><span class="linenos">523</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">"GLOBAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL-524"><a href="#MySQL-524"><span class="linenos">524</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">global_</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL-525"><a href="#MySQL-525"><span class="linenos">525</span></a> +</span><span id="MySQL-526"><a href="#MySQL-526"><span class="linenos">526</span></a> <span class="k">def</span> <span class="nf">set_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL-527"><a href="#MySQL-527"><span class="linenos">527</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + <div id="MySQL.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">MySQL</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#MySQL.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="MySQL.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="MySQL.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="MySQL.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="MySQL.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="MySQL.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="MySQL.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="MySQL.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="MySQL.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="MySQL.Tokenizer"> + <input id="MySQL.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MySQL.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="MySQL.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL.Tokenizer-118"><a href="#MySQL.Tokenizer-118"><span class="linenos">118</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="MySQL.Tokenizer-119"><a href="#MySQL.Tokenizer-119"><span class="linenos">119</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="MySQL.Tokenizer-120"><a href="#MySQL.Tokenizer-120"><span class="linenos">120</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="MySQL.Tokenizer-121"><a href="#MySQL.Tokenizer-121"><span class="linenos">121</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"`"</span><span class="p">]</span> +</span><span id="MySQL.Tokenizer-122"><a href="#MySQL.Tokenizer-122"><span class="linenos">122</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="MySQL.Tokenizer-123"><a href="#MySQL.Tokenizer-123"><span class="linenos">123</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"b'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"B'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0b"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="MySQL.Tokenizer-124"><a href="#MySQL.Tokenizer-124"><span class="linenos">124</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="MySQL.Tokenizer-125"><a href="#MySQL.Tokenizer-125"><span class="linenos">125</span></a> +</span><span id="MySQL.Tokenizer-126"><a href="#MySQL.Tokenizer-126"><span class="linenos">126</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Tokenizer-127"><a href="#MySQL.Tokenizer-127"><span class="linenos">127</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-128"><a href="#MySQL.Tokenizer-128"><span class="linenos">128</span></a> <span class="s2">"MEDIUMTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-129"><a href="#MySQL.Tokenizer-129"><span class="linenos">129</span></a> <span class="s2">"LONGTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-130"><a href="#MySQL.Tokenizer-130"><span class="linenos">130</span></a> <span class="s2">"MEDIUMBLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-131"><a href="#MySQL.Tokenizer-131"><span class="linenos">131</span></a> <span class="s2">"LONGBLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-132"><a href="#MySQL.Tokenizer-132"><span class="linenos">132</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-133"><a href="#MySQL.Tokenizer-133"><span class="linenos">133</span></a> <span class="s2">"SEPARATOR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEPARATOR</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-134"><a href="#MySQL.Tokenizer-134"><span class="linenos">134</span></a> <span class="s2">"_ARMSCII8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-135"><a href="#MySQL.Tokenizer-135"><span class="linenos">135</span></a> <span class="s2">"_ASCII"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-136"><a href="#MySQL.Tokenizer-136"><span class="linenos">136</span></a> <span class="s2">"_BIG5"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-137"><a href="#MySQL.Tokenizer-137"><span class="linenos">137</span></a> <span class="s2">"_BINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-138"><a href="#MySQL.Tokenizer-138"><span class="linenos">138</span></a> <span class="s2">"_CP1250"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-139"><a href="#MySQL.Tokenizer-139"><span class="linenos">139</span></a> <span class="s2">"_CP1251"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-140"><a href="#MySQL.Tokenizer-140"><span class="linenos">140</span></a> <span class="s2">"_CP1256"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-141"><a href="#MySQL.Tokenizer-141"><span class="linenos">141</span></a> <span class="s2">"_CP1257"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-142"><a href="#MySQL.Tokenizer-142"><span class="linenos">142</span></a> <span class="s2">"_CP850"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-143"><a href="#MySQL.Tokenizer-143"><span class="linenos">143</span></a> <span class="s2">"_CP852"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-144"><a href="#MySQL.Tokenizer-144"><span class="linenos">144</span></a> <span class="s2">"_CP866"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-145"><a href="#MySQL.Tokenizer-145"><span class="linenos">145</span></a> <span class="s2">"_CP932"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-146"><a href="#MySQL.Tokenizer-146"><span class="linenos">146</span></a> <span class="s2">"_DEC8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-147"><a href="#MySQL.Tokenizer-147"><span class="linenos">147</span></a> <span class="s2">"_EUCJPMS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-148"><a href="#MySQL.Tokenizer-148"><span class="linenos">148</span></a> <span class="s2">"_EUCKR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-149"><a href="#MySQL.Tokenizer-149"><span class="linenos">149</span></a> <span class="s2">"_GB18030"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-150"><a href="#MySQL.Tokenizer-150"><span class="linenos">150</span></a> <span class="s2">"_GB2312"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-151"><a href="#MySQL.Tokenizer-151"><span class="linenos">151</span></a> <span class="s2">"_GBK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-152"><a href="#MySQL.Tokenizer-152"><span class="linenos">152</span></a> <span class="s2">"_GEOSTD8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-153"><a href="#MySQL.Tokenizer-153"><span class="linenos">153</span></a> <span class="s2">"_GREEK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-154"><a href="#MySQL.Tokenizer-154"><span class="linenos">154</span></a> <span class="s2">"_HEBREW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-155"><a href="#MySQL.Tokenizer-155"><span class="linenos">155</span></a> <span class="s2">"_HP8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-156"><a href="#MySQL.Tokenizer-156"><span class="linenos">156</span></a> <span class="s2">"_KEYBCS2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-157"><a href="#MySQL.Tokenizer-157"><span class="linenos">157</span></a> <span class="s2">"_KOI8R"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-158"><a href="#MySQL.Tokenizer-158"><span class="linenos">158</span></a> <span class="s2">"_KOI8U"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-159"><a href="#MySQL.Tokenizer-159"><span class="linenos">159</span></a> <span class="s2">"_LATIN1"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-160"><a href="#MySQL.Tokenizer-160"><span class="linenos">160</span></a> <span class="s2">"_LATIN2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-161"><a href="#MySQL.Tokenizer-161"><span class="linenos">161</span></a> <span class="s2">"_LATIN5"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-162"><a href="#MySQL.Tokenizer-162"><span class="linenos">162</span></a> <span class="s2">"_LATIN7"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-163"><a href="#MySQL.Tokenizer-163"><span class="linenos">163</span></a> <span class="s2">"_MACCE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-164"><a href="#MySQL.Tokenizer-164"><span class="linenos">164</span></a> <span class="s2">"_MACROMAN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-165"><a href="#MySQL.Tokenizer-165"><span class="linenos">165</span></a> <span class="s2">"_SJIS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-166"><a href="#MySQL.Tokenizer-166"><span class="linenos">166</span></a> <span class="s2">"_SWE7"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-167"><a href="#MySQL.Tokenizer-167"><span class="linenos">167</span></a> <span class="s2">"_TIS620"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-168"><a href="#MySQL.Tokenizer-168"><span class="linenos">168</span></a> <span class="s2">"_UCS2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-169"><a href="#MySQL.Tokenizer-169"><span class="linenos">169</span></a> <span class="s2">"_UJIS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-170"><a href="#MySQL.Tokenizer-170"><span class="linenos">170</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/string-literals.html</span> +</span><span id="MySQL.Tokenizer-171"><a href="#MySQL.Tokenizer-171"><span class="linenos">171</span></a> <span class="s2">"_UTF8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-172"><a href="#MySQL.Tokenizer-172"><span class="linenos">172</span></a> <span class="s2">"_UTF16"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-173"><a href="#MySQL.Tokenizer-173"><span class="linenos">173</span></a> <span class="s2">"_UTF16LE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-174"><a href="#MySQL.Tokenizer-174"><span class="linenos">174</span></a> <span class="s2">"_UTF32"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-175"><a href="#MySQL.Tokenizer-175"><span class="linenos">175</span></a> <span class="s2">"_UTF8MB3"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-176"><a href="#MySQL.Tokenizer-176"><span class="linenos">176</span></a> <span class="s2">"_UTF8MB4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-177"><a href="#MySQL.Tokenizer-177"><span class="linenos">177</span></a> <span class="s2">"@@"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SESSION_PARAMETER</span><span class="p">,</span> +</span><span id="MySQL.Tokenizer-178"><a href="#MySQL.Tokenizer-178"><span class="linenos">178</span></a> <span class="p">}</span> +</span><span id="MySQL.Tokenizer-179"><a href="#MySQL.Tokenizer-179"><span class="linenos">179</span></a> +</span><span id="MySQL.Tokenizer-180"><a href="#MySQL.Tokenizer-180"><span class="linenos">180</span></a> <span class="n">COMMANDS</span> <span class="o">=</span> <span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">COMMANDS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="MySQL.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="MySQL.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="MySQL.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="MySQL.Parser"> + <input id="MySQL.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MySQL.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="MySQL.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL.Parser-182"><a href="#MySQL.Parser-182"><span class="linenos">182</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="MySQL.Parser-183"><a href="#MySQL.Parser-183"><span class="linenos">183</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL.Parser-184"><a href="#MySQL.Parser-184"><span class="linenos">184</span></a> +</span><span id="MySQL.Parser-185"><a href="#MySQL.Parser-185"><span class="linenos">185</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-186"><a href="#MySQL.Parser-186"><span class="linenos">186</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL.Parser-187"><a href="#MySQL.Parser-187"><span class="linenos">187</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">),</span> +</span><span id="MySQL.Parser-188"><a href="#MySQL.Parser-188"><span class="linenos">188</span></a> <span class="s2">"DATE_SUB"</span><span class="p">:</span> <span class="n">_date_add</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">),</span> +</span><span id="MySQL.Parser-189"><a href="#MySQL.Parser-189"><span class="linenos">189</span></a> <span class="s2">"STR_TO_DATE"</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="MySQL.Parser-190"><a href="#MySQL.Parser-190"><span class="linenos">190</span></a> <span class="s2">"LOCATE"</span><span class="p">:</span> <span class="n">locate_to_strposition</span><span class="p">,</span> +</span><span id="MySQL.Parser-191"><a href="#MySQL.Parser-191"><span class="linenos">191</span></a> <span class="s2">"INSTR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span><span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="MySQL.Parser-192"><a href="#MySQL.Parser-192"><span class="linenos">192</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="MySQL.Parser-193"><a href="#MySQL.Parser-193"><span class="linenos">193</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="MySQL.Parser-194"><a href="#MySQL.Parser-194"><span class="linenos">194</span></a> <span class="p">),</span> +</span><span id="MySQL.Parser-195"><a href="#MySQL.Parser-195"><span class="linenos">195</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-196"><a href="#MySQL.Parser-196"><span class="linenos">196</span></a> +</span><span id="MySQL.Parser-197"><a href="#MySQL.Parser-197"><span class="linenos">197</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-198"><a href="#MySQL.Parser-198"><span class="linenos">198</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL.Parser-199"><a href="#MySQL.Parser-199"><span class="linenos">199</span></a> <span class="s2">"GROUP_CONCAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-200"><a href="#MySQL.Parser-200"><span class="linenos">200</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> +</span><span id="MySQL.Parser-201"><a href="#MySQL.Parser-201"><span class="linenos">201</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">(),</span> +</span><span id="MySQL.Parser-202"><a href="#MySQL.Parser-202"><span class="linenos">202</span></a> <span class="n">separator</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEPARATOR</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(),</span> +</span><span id="MySQL.Parser-203"><a href="#MySQL.Parser-203"><span class="linenos">203</span></a> <span class="p">),</span> +</span><span id="MySQL.Parser-204"><a href="#MySQL.Parser-204"><span class="linenos">204</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-205"><a href="#MySQL.Parser-205"><span class="linenos">205</span></a> +</span><span id="MySQL.Parser-206"><a href="#MySQL.Parser-206"><span class="linenos">206</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-207"><a href="#MySQL.Parser-207"><span class="linenos">207</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL.Parser-208"><a href="#MySQL.Parser-208"><span class="linenos">208</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">),</span> +</span><span id="MySQL.Parser-209"><a href="#MySQL.Parser-209"><span class="linenos">209</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-210"><a href="#MySQL.Parser-210"><span class="linenos">210</span></a> +</span><span id="MySQL.Parser-211"><a href="#MySQL.Parser-211"><span class="linenos">211</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-212"><a href="#MySQL.Parser-212"><span class="linenos">212</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL.Parser-213"><a href="#MySQL.Parser-213"><span class="linenos">213</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_show</span><span class="p">(),</span> +</span><span id="MySQL.Parser-214"><a href="#MySQL.Parser-214"><span class="linenos">214</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set</span><span class="p">(),</span> +</span><span id="MySQL.Parser-215"><a href="#MySQL.Parser-215"><span class="linenos">215</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-216"><a href="#MySQL.Parser-216"><span class="linenos">216</span></a> +</span><span id="MySQL.Parser-217"><a href="#MySQL.Parser-217"><span class="linenos">217</span></a> <span class="n">SHOW_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-218"><a href="#MySQL.Parser-218"><span class="linenos">218</span></a> <span class="s2">"BINARY LOGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINARY LOGS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-219"><a href="#MySQL.Parser-219"><span class="linenos">219</span></a> <span class="s2">"MASTER LOGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINARY LOGS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-220"><a href="#MySQL.Parser-220"><span class="linenos">220</span></a> <span class="s2">"BINLOG EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"BINLOG EVENTS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-221"><a href="#MySQL.Parser-221"><span class="linenos">221</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL.Parser-222"><a href="#MySQL.Parser-222"><span class="linenos">222</span></a> <span class="s2">"CHARSET"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL.Parser-223"><a href="#MySQL.Parser-223"><span class="linenos">223</span></a> <span class="s2">"COLLATION"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLLATION"</span><span class="p">),</span> +</span><span id="MySQL.Parser-224"><a href="#MySQL.Parser-224"><span class="linenos">224</span></a> <span class="s2">"FULL COLUMNS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-225"><a href="#MySQL.Parser-225"><span class="linenos">225</span></a> <span class="s2">"COLUMNS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">),</span> +</span><span id="MySQL.Parser-226"><a href="#MySQL.Parser-226"><span class="linenos">226</span></a> <span class="s2">"CREATE DATABASE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE DATABASE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-227"><a href="#MySQL.Parser-227"><span class="linenos">227</span></a> <span class="s2">"CREATE EVENT"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE EVENT"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-228"><a href="#MySQL.Parser-228"><span class="linenos">228</span></a> <span class="s2">"CREATE FUNCTION"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE FUNCTION"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-229"><a href="#MySQL.Parser-229"><span class="linenos">229</span></a> <span class="s2">"CREATE PROCEDURE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE PROCEDURE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-230"><a href="#MySQL.Parser-230"><span class="linenos">230</span></a> <span class="s2">"CREATE TABLE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE TABLE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-231"><a href="#MySQL.Parser-231"><span class="linenos">231</span></a> <span class="s2">"CREATE TRIGGER"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE TRIGGER"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-232"><a href="#MySQL.Parser-232"><span class="linenos">232</span></a> <span class="s2">"CREATE VIEW"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"CREATE VIEW"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-233"><a href="#MySQL.Parser-233"><span class="linenos">233</span></a> <span class="s2">"DATABASES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"DATABASES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-234"><a href="#MySQL.Parser-234"><span class="linenos">234</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-235"><a href="#MySQL.Parser-235"><span class="linenos">235</span></a> <span class="s2">"STORAGE ENGINES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-236"><a href="#MySQL.Parser-236"><span class="linenos">236</span></a> <span class="s2">"ENGINES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ENGINES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-237"><a href="#MySQL.Parser-237"><span class="linenos">237</span></a> <span class="s2">"ERRORS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"ERRORS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-238"><a href="#MySQL.Parser-238"><span class="linenos">238</span></a> <span class="s2">"EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"EVENTS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-239"><a href="#MySQL.Parser-239"><span class="linenos">239</span></a> <span class="s2">"FUNCTION CODE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"FUNCTION CODE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-240"><a href="#MySQL.Parser-240"><span class="linenos">240</span></a> <span class="s2">"FUNCTION STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"FUNCTION STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-241"><a href="#MySQL.Parser-241"><span class="linenos">241</span></a> <span class="s2">"GRANTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"GRANTS"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FOR"</span><span class="p">),</span> +</span><span id="MySQL.Parser-242"><a href="#MySQL.Parser-242"><span class="linenos">242</span></a> <span class="s2">"INDEX"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"INDEX"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">),</span> +</span><span id="MySQL.Parser-243"><a href="#MySQL.Parser-243"><span class="linenos">243</span></a> <span class="s2">"MASTER STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"MASTER STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-244"><a href="#MySQL.Parser-244"><span class="linenos">244</span></a> <span class="s2">"OPEN TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"OPEN TABLES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-245"><a href="#MySQL.Parser-245"><span class="linenos">245</span></a> <span class="s2">"PLUGINS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PLUGINS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-246"><a href="#MySQL.Parser-246"><span class="linenos">246</span></a> <span class="s2">"PROCEDURE CODE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCEDURE CODE"</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-247"><a href="#MySQL.Parser-247"><span class="linenos">247</span></a> <span class="s2">"PROCEDURE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCEDURE STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-248"><a href="#MySQL.Parser-248"><span class="linenos">248</span></a> <span class="s2">"PRIVILEGES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PRIVILEGES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-249"><a href="#MySQL.Parser-249"><span class="linenos">249</span></a> <span class="s2">"FULL PROCESSLIST"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCESSLIST"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-250"><a href="#MySQL.Parser-250"><span class="linenos">250</span></a> <span class="s2">"PROCESSLIST"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROCESSLIST"</span><span class="p">),</span> +</span><span id="MySQL.Parser-251"><a href="#MySQL.Parser-251"><span class="linenos">251</span></a> <span class="s2">"PROFILE"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROFILE"</span><span class="p">),</span> +</span><span id="MySQL.Parser-252"><a href="#MySQL.Parser-252"><span class="linenos">252</span></a> <span class="s2">"PROFILES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"PROFILES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-253"><a href="#MySQL.Parser-253"><span class="linenos">253</span></a> <span class="s2">"RELAYLOG EVENTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"RELAYLOG EVENTS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-254"><a href="#MySQL.Parser-254"><span class="linenos">254</span></a> <span class="s2">"REPLICAS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICAS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-255"><a href="#MySQL.Parser-255"><span class="linenos">255</span></a> <span class="s2">"SLAVE HOSTS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICAS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-256"><a href="#MySQL.Parser-256"><span class="linenos">256</span></a> <span class="s2">"REPLICA STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICA STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-257"><a href="#MySQL.Parser-257"><span class="linenos">257</span></a> <span class="s2">"SLAVE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"REPLICA STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-258"><a href="#MySQL.Parser-258"><span class="linenos">258</span></a> <span class="s2">"GLOBAL STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-259"><a href="#MySQL.Parser-259"><span class="linenos">259</span></a> <span class="s2">"SESSION STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-260"><a href="#MySQL.Parser-260"><span class="linenos">260</span></a> <span class="s2">"STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-261"><a href="#MySQL.Parser-261"><span class="linenos">261</span></a> <span class="s2">"TABLE STATUS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLE STATUS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-262"><a href="#MySQL.Parser-262"><span class="linenos">262</span></a> <span class="s2">"FULL TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLES"</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-263"><a href="#MySQL.Parser-263"><span class="linenos">263</span></a> <span class="s2">"TABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TABLES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-264"><a href="#MySQL.Parser-264"><span class="linenos">264</span></a> <span class="s2">"TRIGGERS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"TRIGGERS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-265"><a href="#MySQL.Parser-265"><span class="linenos">265</span></a> <span class="s2">"GLOBAL VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="MySQL.Parser-266"><a href="#MySQL.Parser-266"><span class="linenos">266</span></a> <span class="s2">"SESSION VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-267"><a href="#MySQL.Parser-267"><span class="linenos">267</span></a> <span class="s2">"VARIABLES"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"VARIABLES"</span><span class="p">),</span> +</span><span id="MySQL.Parser-268"><a href="#MySQL.Parser-268"><span class="linenos">268</span></a> <span class="s2">"WARNINGS"</span><span class="p">:</span> <span class="n">_show_parser</span><span class="p">(</span><span class="s2">"WARNINGS"</span><span class="p">),</span> +</span><span id="MySQL.Parser-269"><a href="#MySQL.Parser-269"><span class="linenos">269</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-270"><a href="#MySQL.Parser-270"><span class="linenos">270</span></a> +</span><span id="MySQL.Parser-271"><a href="#MySQL.Parser-271"><span class="linenos">271</span></a> <span class="n">SET_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-272"><a href="#MySQL.Parser-272"><span class="linenos">272</span></a> <span class="s2">"GLOBAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"GLOBAL"</span><span class="p">),</span> +</span><span id="MySQL.Parser-273"><a href="#MySQL.Parser-273"><span class="linenos">273</span></a> <span class="s2">"PERSIST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"PERSIST"</span><span class="p">),</span> +</span><span id="MySQL.Parser-274"><a href="#MySQL.Parser-274"><span class="linenos">274</span></a> <span class="s2">"PERSIST_ONLY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"PERSIST_ONLY"</span><span class="p">),</span> +</span><span id="MySQL.Parser-275"><a href="#MySQL.Parser-275"><span class="linenos">275</span></a> <span class="s2">"SESSION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"SESSION"</span><span class="p">),</span> +</span><span id="MySQL.Parser-276"><a href="#MySQL.Parser-276"><span class="linenos">276</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="s2">"LOCAL"</span><span class="p">),</span> +</span><span id="MySQL.Parser-277"><a href="#MySQL.Parser-277"><span class="linenos">277</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_charset</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL.Parser-278"><a href="#MySQL.Parser-278"><span class="linenos">278</span></a> <span class="s2">"CHARSET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_charset</span><span class="p">(</span><span class="s2">"CHARACTER SET"</span><span class="p">),</span> +</span><span id="MySQL.Parser-279"><a href="#MySQL.Parser-279"><span class="linenos">279</span></a> <span class="s2">"NAMES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_names</span><span class="p">(),</span> +</span><span id="MySQL.Parser-280"><a href="#MySQL.Parser-280"><span class="linenos">280</span></a> <span class="s2">"TRANSACTION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_transaction</span><span class="p">(),</span> +</span><span id="MySQL.Parser-281"><a href="#MySQL.Parser-281"><span class="linenos">281</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-282"><a href="#MySQL.Parser-282"><span class="linenos">282</span></a> +</span><span id="MySQL.Parser-283"><a href="#MySQL.Parser-283"><span class="linenos">283</span></a> <span class="n">PROFILE_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-284"><a href="#MySQL.Parser-284"><span class="linenos">284</span></a> <span class="s2">"ALL"</span><span class="p">,</span> +</span><span id="MySQL.Parser-285"><a href="#MySQL.Parser-285"><span class="linenos">285</span></a> <span class="s2">"BLOCK IO"</span><span class="p">,</span> +</span><span id="MySQL.Parser-286"><a href="#MySQL.Parser-286"><span class="linenos">286</span></a> <span class="s2">"CONTEXT SWITCHES"</span><span class="p">,</span> +</span><span id="MySQL.Parser-287"><a href="#MySQL.Parser-287"><span class="linenos">287</span></a> <span class="s2">"CPU"</span><span class="p">,</span> +</span><span id="MySQL.Parser-288"><a href="#MySQL.Parser-288"><span class="linenos">288</span></a> <span class="s2">"IPC"</span><span class="p">,</span> +</span><span id="MySQL.Parser-289"><a href="#MySQL.Parser-289"><span class="linenos">289</span></a> <span class="s2">"MEMORY"</span><span class="p">,</span> +</span><span id="MySQL.Parser-290"><a href="#MySQL.Parser-290"><span class="linenos">290</span></a> <span class="s2">"PAGE FAULTS"</span><span class="p">,</span> +</span><span id="MySQL.Parser-291"><a href="#MySQL.Parser-291"><span class="linenos">291</span></a> <span class="s2">"SOURCE"</span><span class="p">,</span> +</span><span id="MySQL.Parser-292"><a href="#MySQL.Parser-292"><span class="linenos">292</span></a> <span class="s2">"SWAPS"</span><span class="p">,</span> +</span><span id="MySQL.Parser-293"><a href="#MySQL.Parser-293"><span class="linenos">293</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-294"><a href="#MySQL.Parser-294"><span class="linenos">294</span></a> +</span><span id="MySQL.Parser-295"><a href="#MySQL.Parser-295"><span class="linenos">295</span></a> <span class="n">TRANSACTION_CHARACTERISTICS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Parser-296"><a href="#MySQL.Parser-296"><span class="linenos">296</span></a> <span class="s2">"ISOLATION LEVEL REPEATABLE READ"</span><span class="p">,</span> +</span><span id="MySQL.Parser-297"><a href="#MySQL.Parser-297"><span class="linenos">297</span></a> <span class="s2">"ISOLATION LEVEL READ COMMITTED"</span><span class="p">,</span> +</span><span id="MySQL.Parser-298"><a href="#MySQL.Parser-298"><span class="linenos">298</span></a> <span class="s2">"ISOLATION LEVEL READ UNCOMMITTED"</span><span class="p">,</span> +</span><span id="MySQL.Parser-299"><a href="#MySQL.Parser-299"><span class="linenos">299</span></a> <span class="s2">"ISOLATION LEVEL SERIALIZABLE"</span><span class="p">,</span> +</span><span id="MySQL.Parser-300"><a href="#MySQL.Parser-300"><span class="linenos">300</span></a> <span class="s2">"READ WRITE"</span><span class="p">,</span> +</span><span id="MySQL.Parser-301"><a href="#MySQL.Parser-301"><span class="linenos">301</span></a> <span class="s2">"READ ONLY"</span><span class="p">,</span> +</span><span id="MySQL.Parser-302"><a href="#MySQL.Parser-302"><span class="linenos">302</span></a> <span class="p">}</span> +</span><span id="MySQL.Parser-303"><a href="#MySQL.Parser-303"><span class="linenos">303</span></a> +</span><span id="MySQL.Parser-304"><a href="#MySQL.Parser-304"><span class="linenos">304</span></a> <span class="k">def</span> <span class="nf">_parse_show_mysql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">full</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="MySQL.Parser-305"><a href="#MySQL.Parser-305"><span class="linenos">305</span></a> <span class="k">if</span> <span class="n">target</span><span class="p">:</span> +</span><span id="MySQL.Parser-306"><a href="#MySQL.Parser-306"><span class="linenos">306</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="MySQL.Parser-307"><a href="#MySQL.Parser-307"><span class="linenos">307</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="n">target</span><span class="p">)</span> +</span><span id="MySQL.Parser-308"><a href="#MySQL.Parser-308"><span class="linenos">308</span></a> <span class="n">target_id</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL.Parser-309"><a href="#MySQL.Parser-309"><span class="linenos">309</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Parser-310"><a href="#MySQL.Parser-310"><span class="linenos">310</span></a> <span class="n">target_id</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-311"><a href="#MySQL.Parser-311"><span class="linenos">311</span></a> +</span><span id="MySQL.Parser-312"><a href="#MySQL.Parser-312"><span class="linenos">312</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-313"><a href="#MySQL.Parser-313"><span class="linenos">313</span></a> +</span><span id="MySQL.Parser-314"><a href="#MySQL.Parser-314"><span class="linenos">314</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"BINLOG EVENTS"</span><span class="p">,</span> <span class="s2">"RELAYLOG EVENTS"</span><span class="p">}:</span> +</span><span id="MySQL.Parser-315"><a href="#MySQL.Parser-315"><span class="linenos">315</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-316"><a href="#MySQL.Parser-316"><span class="linenos">316</span></a> <span class="n">db</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-317"><a href="#MySQL.Parser-317"><span class="linenos">317</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Parser-318"><a href="#MySQL.Parser-318"><span class="linenos">318</span></a> <span class="n">position</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-319"><a href="#MySQL.Parser-319"><span class="linenos">319</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-320"><a href="#MySQL.Parser-320"><span class="linenos">320</span></a> +</span><span id="MySQL.Parser-321"><a href="#MySQL.Parser-321"><span class="linenos">321</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"CHANNEL"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-322"><a href="#MySQL.Parser-322"><span class="linenos">322</span></a> +</span><span id="MySQL.Parser-323"><a href="#MySQL.Parser-323"><span class="linenos">323</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-324"><a href="#MySQL.Parser-324"><span class="linenos">324</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">()</span> +</span><span id="MySQL.Parser-325"><a href="#MySQL.Parser-325"><span class="linenos">325</span></a> +</span><span id="MySQL.Parser-326"><a href="#MySQL.Parser-326"><span class="linenos">326</span></a> <span class="k">if</span> <span class="n">this</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="MySQL.Parser-327"><a href="#MySQL.Parser-327"><span class="linenos">327</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PROFILE_TYPES</span><span class="p">))</span> +</span><span id="MySQL.Parser-328"><a href="#MySQL.Parser-328"><span class="linenos">328</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"QUERY"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-329"><a href="#MySQL.Parser-329"><span class="linenos">329</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-330"><a href="#MySQL.Parser-330"><span class="linenos">330</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-331"><a href="#MySQL.Parser-331"><span class="linenos">331</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Parser-332"><a href="#MySQL.Parser-332"><span class="linenos">332</span></a> <span class="n">types</span><span class="p">,</span> <span class="n">query</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-333"><a href="#MySQL.Parser-333"><span class="linenos">333</span></a> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_oldstyle_limit</span><span class="p">()</span> +</span><span id="MySQL.Parser-334"><a href="#MySQL.Parser-334"><span class="linenos">334</span></a> +</span><span id="MySQL.Parser-335"><a href="#MySQL.Parser-335"><span class="linenos">335</span></a> <span class="n">mutex</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MUTEX"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-336"><a href="#MySQL.Parser-336"><span class="linenos">336</span></a> <span class="n">mutex</span> <span class="o">=</span> <span class="kc">False</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"STATUS"</span><span class="p">)</span> <span class="k">else</span> <span class="n">mutex</span> +</span><span id="MySQL.Parser-337"><a href="#MySQL.Parser-337"><span class="linenos">337</span></a> +</span><span id="MySQL.Parser-338"><a href="#MySQL.Parser-338"><span class="linenos">338</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-339"><a href="#MySQL.Parser-339"><span class="linenos">339</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Show</span><span class="p">,</span> +</span><span id="MySQL.Parser-340"><a href="#MySQL.Parser-340"><span class="linenos">340</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="MySQL.Parser-341"><a href="#MySQL.Parser-341"><span class="linenos">341</span></a> <span class="n">target</span><span class="o">=</span><span class="n">target_id</span><span class="p">,</span> +</span><span id="MySQL.Parser-342"><a href="#MySQL.Parser-342"><span class="linenos">342</span></a> <span class="n">full</span><span class="o">=</span><span class="n">full</span><span class="p">,</span> +</span><span id="MySQL.Parser-343"><a href="#MySQL.Parser-343"><span class="linenos">343</span></a> <span class="n">log</span><span class="o">=</span><span class="n">log</span><span class="p">,</span> +</span><span id="MySQL.Parser-344"><a href="#MySQL.Parser-344"><span class="linenos">344</span></a> <span class="n">position</span><span class="o">=</span><span class="n">position</span><span class="p">,</span> +</span><span id="MySQL.Parser-345"><a href="#MySQL.Parser-345"><span class="linenos">345</span></a> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> +</span><span id="MySQL.Parser-346"><a href="#MySQL.Parser-346"><span class="linenos">346</span></a> <span class="n">channel</span><span class="o">=</span><span class="n">channel</span><span class="p">,</span> +</span><span id="MySQL.Parser-347"><a href="#MySQL.Parser-347"><span class="linenos">347</span></a> <span class="n">like</span><span class="o">=</span><span class="n">like</span><span class="p">,</span> +</span><span id="MySQL.Parser-348"><a href="#MySQL.Parser-348"><span class="linenos">348</span></a> <span class="n">where</span><span class="o">=</span><span class="n">where</span><span class="p">,</span> +</span><span id="MySQL.Parser-349"><a href="#MySQL.Parser-349"><span class="linenos">349</span></a> <span class="n">types</span><span class="o">=</span><span class="n">types</span><span class="p">,</span> +</span><span id="MySQL.Parser-350"><a href="#MySQL.Parser-350"><span class="linenos">350</span></a> <span class="n">query</span><span class="o">=</span><span class="n">query</span><span class="p">,</span> +</span><span id="MySQL.Parser-351"><a href="#MySQL.Parser-351"><span class="linenos">351</span></a> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> +</span><span id="MySQL.Parser-352"><a href="#MySQL.Parser-352"><span class="linenos">352</span></a> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> +</span><span id="MySQL.Parser-353"><a href="#MySQL.Parser-353"><span class="linenos">353</span></a> <span class="n">mutex</span><span class="o">=</span><span class="n">mutex</span><span class="p">,</span> +</span><span id="MySQL.Parser-354"><a href="#MySQL.Parser-354"><span class="linenos">354</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"global"</span><span class="p">:</span> <span class="n">global_</span><span class="p">},</span> +</span><span id="MySQL.Parser-355"><a href="#MySQL.Parser-355"><span class="linenos">355</span></a> <span class="p">)</span> +</span><span id="MySQL.Parser-356"><a href="#MySQL.Parser-356"><span class="linenos">356</span></a> +</span><span id="MySQL.Parser-357"><a href="#MySQL.Parser-357"><span class="linenos">357</span></a> <span class="k">def</span> <span class="nf">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">options</span><span class="p">):</span> +</span><span id="MySQL.Parser-358"><a href="#MySQL.Parser-358"><span class="linenos">358</span></a> <span class="k">for</span> <span class="n">option</span> <span class="ow">in</span> <span class="n">options</span><span class="p">:</span> +</span><span id="MySQL.Parser-359"><a href="#MySQL.Parser-359"><span class="linenos">359</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="o">*</span><span class="n">option</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)):</span> +</span><span id="MySQL.Parser-360"><a href="#MySQL.Parser-360"><span class="linenos">360</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">option</span><span class="p">)</span> +</span><span id="MySQL.Parser-361"><a href="#MySQL.Parser-361"><span class="linenos">361</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-362"><a href="#MySQL.Parser-362"><span class="linenos">362</span></a> +</span><span id="MySQL.Parser-363"><a href="#MySQL.Parser-363"><span class="linenos">363</span></a> <span class="k">def</span> <span class="nf">_parse_oldstyle_limit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="MySQL.Parser-364"><a href="#MySQL.Parser-364"><span class="linenos">364</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-365"><a href="#MySQL.Parser-365"><span class="linenos">365</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-366"><a href="#MySQL.Parser-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">):</span> +</span><span id="MySQL.Parser-367"><a href="#MySQL.Parser-367"><span class="linenos">367</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">)</span> +</span><span id="MySQL.Parser-368"><a href="#MySQL.Parser-368"><span class="linenos">368</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="MySQL.Parser-369"><a href="#MySQL.Parser-369"><span class="linenos">369</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="MySQL.Parser-370"><a href="#MySQL.Parser-370"><span class="linenos">370</span></a> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="MySQL.Parser-371"><a href="#MySQL.Parser-371"><span class="linenos">371</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> +</span><span id="MySQL.Parser-372"><a href="#MySQL.Parser-372"><span class="linenos">372</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="n">parts</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="MySQL.Parser-373"><a href="#MySQL.Parser-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="n">offset</span><span class="p">,</span> <span class="n">limit</span> +</span><span id="MySQL.Parser-374"><a href="#MySQL.Parser-374"><span class="linenos">374</span></a> +</span><span id="MySQL.Parser-375"><a href="#MySQL.Parser-375"><span class="linenos">375</span></a> <span class="k">def</span> <span class="nf">_default_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="MySQL.Parser-376"><a href="#MySQL.Parser-376"><span class="linenos">376</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item_assignment</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> +</span><span id="MySQL.Parser-377"><a href="#MySQL.Parser-377"><span class="linenos">377</span></a> +</span><span id="MySQL.Parser-378"><a href="#MySQL.Parser-378"><span class="linenos">378</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_assignment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="MySQL.Parser-379"><a href="#MySQL.Parser-379"><span class="linenos">379</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"GLOBAL"</span><span class="p">,</span> <span class="s2">"SESSION"</span><span class="p">}</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSACTION"</span><span class="p">):</span> +</span><span id="MySQL.Parser-380"><a href="#MySQL.Parser-380"><span class="linenos">380</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_transaction</span><span class="p">(</span><span class="n">global_</span><span class="o">=</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"GLOBAL"</span><span class="p">)</span> +</span><span id="MySQL.Parser-381"><a href="#MySQL.Parser-381"><span class="linenos">381</span></a> +</span><span id="MySQL.Parser-382"><a href="#MySQL.Parser-382"><span class="linenos">382</span></a> <span class="n">left</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL.Parser-383"><a href="#MySQL.Parser-383"><span class="linenos">383</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="MySQL.Parser-384"><a href="#MySQL.Parser-384"><span class="linenos">384</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected ="</span><span class="p">)</span> +</span><span id="MySQL.Parser-385"><a href="#MySQL.Parser-385"><span class="linenos">385</span></a> <span class="n">right</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL.Parser-386"><a href="#MySQL.Parser-386"><span class="linenos">386</span></a> +</span><span id="MySQL.Parser-387"><a href="#MySQL.Parser-387"><span class="linenos">387</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-388"><a href="#MySQL.Parser-388"><span class="linenos">388</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="MySQL.Parser-389"><a href="#MySQL.Parser-389"><span class="linenos">389</span></a> <span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> +</span><span id="MySQL.Parser-390"><a href="#MySQL.Parser-390"><span class="linenos">390</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> +</span><span id="MySQL.Parser-391"><a href="#MySQL.Parser-391"><span class="linenos">391</span></a> <span class="p">)</span> +</span><span id="MySQL.Parser-392"><a href="#MySQL.Parser-392"><span class="linenos">392</span></a> +</span><span id="MySQL.Parser-393"><a href="#MySQL.Parser-393"><span class="linenos">393</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-394"><a href="#MySQL.Parser-394"><span class="linenos">394</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL.Parser-395"><a href="#MySQL.Parser-395"><span class="linenos">395</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="MySQL.Parser-396"><a href="#MySQL.Parser-396"><span class="linenos">396</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="MySQL.Parser-397"><a href="#MySQL.Parser-397"><span class="linenos">397</span></a> <span class="p">)</span> +</span><span id="MySQL.Parser-398"><a href="#MySQL.Parser-398"><span class="linenos">398</span></a> +</span><span id="MySQL.Parser-399"><a href="#MySQL.Parser-399"><span class="linenos">399</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_charset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="MySQL.Parser-400"><a href="#MySQL.Parser-400"><span class="linenos">400</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL.Parser-401"><a href="#MySQL.Parser-401"><span class="linenos">401</span></a> +</span><span id="MySQL.Parser-402"><a href="#MySQL.Parser-402"><span class="linenos">402</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-403"><a href="#MySQL.Parser-403"><span class="linenos">403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL.Parser-404"><a href="#MySQL.Parser-404"><span class="linenos">404</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="MySQL.Parser-405"><a href="#MySQL.Parser-405"><span class="linenos">405</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="MySQL.Parser-406"><a href="#MySQL.Parser-406"><span class="linenos">406</span></a> <span class="p">)</span> +</span><span id="MySQL.Parser-407"><a href="#MySQL.Parser-407"><span class="linenos">407</span></a> +</span><span id="MySQL.Parser-408"><a href="#MySQL.Parser-408"><span class="linenos">408</span></a> <span class="k">def</span> <span class="nf">_parse_set_item_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="MySQL.Parser-409"><a href="#MySQL.Parser-409"><span class="linenos">409</span></a> <span class="n">charset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL.Parser-410"><a href="#MySQL.Parser-410"><span class="linenos">410</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"COLLATE"</span><span class="p">):</span> +</span><span id="MySQL.Parser-411"><a href="#MySQL.Parser-411"><span class="linenos">411</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="MySQL.Parser-412"><a href="#MySQL.Parser-412"><span class="linenos">412</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Parser-413"><a href="#MySQL.Parser-413"><span class="linenos">413</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MySQL.Parser-414"><a href="#MySQL.Parser-414"><span class="linenos">414</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-415"><a href="#MySQL.Parser-415"><span class="linenos">415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL.Parser-416"><a href="#MySQL.Parser-416"><span class="linenos">416</span></a> <span class="n">this</span><span class="o">=</span><span class="n">charset</span><span class="p">,</span> +</span><span id="MySQL.Parser-417"><a href="#MySQL.Parser-417"><span class="linenos">417</span></a> <span class="n">collate</span><span class="o">=</span><span class="n">collate</span><span class="p">,</span> +</span><span id="MySQL.Parser-418"><a href="#MySQL.Parser-418"><span class="linenos">418</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"NAMES"</span><span class="p">,</span> +</span><span id="MySQL.Parser-419"><a href="#MySQL.Parser-419"><span class="linenos">419</span></a> <span class="p">)</span> +</span><span id="MySQL.Parser-420"><a href="#MySQL.Parser-420"><span class="linenos">420</span></a> +</span><span id="MySQL.Parser-421"><a href="#MySQL.Parser-421"><span class="linenos">421</span></a> <span class="k">def</span> <span class="nf">_parse_set_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">global_</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="MySQL.Parser-422"><a href="#MySQL.Parser-422"><span class="linenos">422</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSACTION"</span><span class="p">)</span> +</span><span id="MySQL.Parser-423"><a href="#MySQL.Parser-423"><span class="linenos">423</span></a> <span class="n">characteristics</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="MySQL.Parser-424"><a href="#MySQL.Parser-424"><span class="linenos">424</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_from_options</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRANSACTION_CHARACTERISTICS</span><span class="p">)</span> +</span><span id="MySQL.Parser-425"><a href="#MySQL.Parser-425"><span class="linenos">425</span></a> <span class="p">)</span> +</span><span id="MySQL.Parser-426"><a href="#MySQL.Parser-426"><span class="linenos">426</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="MySQL.Parser-427"><a href="#MySQL.Parser-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="MySQL.Parser-428"><a href="#MySQL.Parser-428"><span class="linenos">428</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">characteristics</span><span class="p">,</span> +</span><span id="MySQL.Parser-429"><a href="#MySQL.Parser-429"><span class="linenos">429</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> +</span><span id="MySQL.Parser-430"><a href="#MySQL.Parser-430"><span class="linenos">430</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"global"</span><span class="p">:</span> <span class="n">global_</span><span class="p">},</span> +</span><span id="MySQL.Parser-431"><a href="#MySQL.Parser-431"><span class="linenos">431</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="MySQL.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="MySQL.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="MySQL.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="MySQL.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="MySQL.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="MySQL.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="MySQL.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="MySQL.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="MySQL.Generator"> + <input id="MySQL.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MySQL.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="MySQL.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL.Generator-433"><a href="#MySQL.Generator-433"><span class="linenos">433</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="MySQL.Generator-434"><a href="#MySQL.Generator-434"><span class="linenos">434</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="MySQL.Generator-435"><a href="#MySQL.Generator-435"><span class="linenos">435</span></a> <span class="n">NULL_ORDERING_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="MySQL.Generator-436"><a href="#MySQL.Generator-436"><span class="linenos">436</span></a> +</span><span id="MySQL.Generator-437"><a href="#MySQL.Generator-437"><span class="linenos">437</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MySQL.Generator-438"><a href="#MySQL.Generator-438"><span class="linenos">438</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="MySQL.Generator-439"><a href="#MySQL.Generator-439"><span class="linenos">439</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-440"><a href="#MySQL.Generator-440"><span class="linenos">440</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="MySQL.Generator-441"><a href="#MySQL.Generator-441"><span class="linenos">441</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-442"><a href="#MySQL.Generator-442"><span class="linenos">442</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-443"><a href="#MySQL.Generator-443"><span class="linenos">443</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-444"><a href="#MySQL.Generator-444"><span class="linenos">444</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">),</span> +</span><span id="MySQL.Generator-445"><a href="#MySQL.Generator-445"><span class="linenos">445</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"SUB"</span><span class="p">),</span> +</span><span id="MySQL.Generator-446"><a href="#MySQL.Generator-446"><span class="linenos">446</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">:</span> <span class="n">_date_trunc_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-447"><a href="#MySQL.Generator-447"><span class="linenos">447</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""GROUP_CONCAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s2">"this"</span><span class="p">)</span><span class="si">}</span><span class="s2"> SEPARATOR </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s2">"separator"</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"','"</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="MySQL.Generator-448"><a href="#MySQL.Generator-448"><span class="linenos">448</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-449"><a href="#MySQL.Generator-449"><span class="linenos">449</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_date_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-450"><a href="#MySQL.Generator-450"><span class="linenos">450</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">_trim_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-451"><a href="#MySQL.Generator-451"><span class="linenos">451</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"<=>"</span><span class="p">),</span> +</span><span id="MySQL.Generator-452"><a href="#MySQL.Generator-452"><span class="linenos">452</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">not_sql</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"<=>"</span><span class="p">)),</span> +</span><span id="MySQL.Generator-453"><a href="#MySQL.Generator-453"><span class="linenos">453</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">strposition_to_locate_sql</span><span class="p">,</span> +</span><span id="MySQL.Generator-454"><a href="#MySQL.Generator-454"><span class="linenos">454</span></a> <span class="p">}</span> +</span><span id="MySQL.Generator-455"><a href="#MySQL.Generator-455"><span class="linenos">455</span></a> +</span><span id="MySQL.Generator-456"><a href="#MySQL.Generator-456"><span class="linenos">456</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="MySQL.Generator-457"><a href="#MySQL.Generator-457"><span class="linenos">457</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">)</span> +</span><span id="MySQL.Generator-458"><a href="#MySQL.Generator-458"><span class="linenos">458</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">)</span> +</span><span id="MySQL.Generator-459"><a href="#MySQL.Generator-459"><span class="linenos">459</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">)</span> +</span><span id="MySQL.Generator-460"><a href="#MySQL.Generator-460"><span class="linenos">460</span></a> <span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">)</span> +</span><span id="MySQL.Generator-461"><a href="#MySQL.Generator-461"><span class="linenos">461</span></a> +</span><span id="MySQL.Generator-462"><a href="#MySQL.Generator-462"><span class="linenos">462</span></a> <span class="k">def</span> <span class="nf">show_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator-463"><a href="#MySQL.Generator-463"><span class="linenos">463</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-464"><a href="#MySQL.Generator-464"><span class="linenos">464</span></a> <span class="n">full</span> <span class="o">=</span> <span class="s2">" FULL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"full"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-465"><a href="#MySQL.Generator-465"><span class="linenos">465</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-466"><a href="#MySQL.Generator-466"><span class="linenos">466</span></a> +</span><span id="MySQL.Generator-467"><a href="#MySQL.Generator-467"><span class="linenos">467</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"target"</span><span class="p">)</span> +</span><span id="MySQL.Generator-468"><a href="#MySQL.Generator-468"><span class="linenos">468</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">target</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-469"><a href="#MySQL.Generator-469"><span class="linenos">469</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="s2">"INDEX"</span><span class="p">}:</span> +</span><span id="MySQL.Generator-470"><a href="#MySQL.Generator-470"><span class="linenos">470</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-471"><a href="#MySQL.Generator-471"><span class="linenos">471</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"GRANTS"</span><span class="p">:</span> +</span><span id="MySQL.Generator-472"><a href="#MySQL.Generator-472"><span class="linenos">472</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FOR</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-473"><a href="#MySQL.Generator-473"><span class="linenos">473</span></a> +</span><span id="MySQL.Generator-474"><a href="#MySQL.Generator-474"><span class="linenos">474</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">)</span> +</span><span id="MySQL.Generator-475"><a href="#MySQL.Generator-475"><span class="linenos">475</span></a> +</span><span id="MySQL.Generator-476"><a href="#MySQL.Generator-476"><span class="linenos">476</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"like"</span><span class="p">)</span> +</span><span id="MySQL.Generator-477"><a href="#MySQL.Generator-477"><span class="linenos">477</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="MySQL.Generator-478"><a href="#MySQL.Generator-478"><span class="linenos">478</span></a> +</span><span id="MySQL.Generator-479"><a href="#MySQL.Generator-479"><span class="linenos">479</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"types"</span><span class="p">)</span> +</span><span id="MySQL.Generator-480"><a href="#MySQL.Generator-480"><span class="linenos">480</span></a> <span class="n">types</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">types</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">types</span> <span class="k">else</span> <span class="n">types</span> +</span><span id="MySQL.Generator-481"><a href="#MySQL.Generator-481"><span class="linenos">481</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR QUERY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"query"</span><span class="p">)</span> +</span><span id="MySQL.Generator-482"><a href="#MySQL.Generator-482"><span class="linenos">482</span></a> +</span><span id="MySQL.Generator-483"><a href="#MySQL.Generator-483"><span class="linenos">483</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="MySQL.Generator-484"><a href="#MySQL.Generator-484"><span class="linenos">484</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="MySQL.Generator-485"><a href="#MySQL.Generator-485"><span class="linenos">485</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="MySQL.Generator-486"><a href="#MySQL.Generator-486"><span class="linenos">486</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Generator-487"><a href="#MySQL.Generator-487"><span class="linenos">487</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-488"><a href="#MySQL.Generator-488"><span class="linenos">488</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_oldstyle_limit_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="MySQL.Generator-489"><a href="#MySQL.Generator-489"><span class="linenos">489</span></a> +</span><span id="MySQL.Generator-490"><a href="#MySQL.Generator-490"><span class="linenos">490</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"log"</span><span class="p">)</span> +</span><span id="MySQL.Generator-491"><a href="#MySQL.Generator-491"><span class="linenos">491</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="MySQL.Generator-492"><a href="#MySQL.Generator-492"><span class="linenos">492</span></a> +</span><span id="MySQL.Generator-493"><a href="#MySQL.Generator-493"><span class="linenos">493</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR CHANNEL"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"channel"</span><span class="p">)</span> +</span><span id="MySQL.Generator-494"><a href="#MySQL.Generator-494"><span class="linenos">494</span></a> +</span><span id="MySQL.Generator-495"><a href="#MySQL.Generator-495"><span class="linenos">495</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"ENGINE"</span><span class="p">:</span> +</span><span id="MySQL.Generator-496"><a href="#MySQL.Generator-496"><span class="linenos">496</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">" MUTEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"mutex"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" STATUS"</span> +</span><span id="MySQL.Generator-497"><a href="#MySQL.Generator-497"><span class="linenos">497</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Generator-498"><a href="#MySQL.Generator-498"><span class="linenos">498</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-499"><a href="#MySQL.Generator-499"><span class="linenos">499</span></a> +</span><span id="MySQL.Generator-500"><a href="#MySQL.Generator-500"><span class="linenos">500</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SHOW</span><span class="si">{</span><span class="n">full</span><span class="si">}{</span><span class="n">global_</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">target</span><span class="si">}{</span><span class="n">types</span><span class="si">}{</span><span class="n">db</span><span class="si">}{</span><span class="n">query</span><span class="si">}{</span><span class="n">log</span><span class="si">}{</span><span class="n">position</span><span class="si">}{</span><span class="n">channel</span><span class="si">}{</span><span class="n">mutex_or_status</span><span class="si">}{</span><span class="n">like</span><span class="si">}{</span><span class="n">where</span><span class="si">}{</span><span class="n">offset</span><span class="si">}{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-501"><a href="#MySQL.Generator-501"><span class="linenos">501</span></a> +</span><span id="MySQL.Generator-502"><a href="#MySQL.Generator-502"><span class="linenos">502</span></a> <span class="k">def</span> <span class="nf">_prefixed_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prefix</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">arg</span><span class="p">):</span> +</span><span id="MySQL.Generator-503"><a href="#MySQL.Generator-503"><span class="linenos">503</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">arg</span><span class="p">)</span> +</span><span id="MySQL.Generator-504"><a href="#MySQL.Generator-504"><span class="linenos">504</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">sql</span><span class="p">:</span> +</span><span id="MySQL.Generator-505"><a href="#MySQL.Generator-505"><span class="linenos">505</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-506"><a href="#MySQL.Generator-506"><span class="linenos">506</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">prefix</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-507"><a href="#MySQL.Generator-507"><span class="linenos">507</span></a> +</span><span id="MySQL.Generator-508"><a href="#MySQL.Generator-508"><span class="linenos">508</span></a> <span class="k">def</span> <span class="nf">_oldstyle_limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator-509"><a href="#MySQL.Generator-509"><span class="linenos">509</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="MySQL.Generator-510"><a href="#MySQL.Generator-510"><span class="linenos">510</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="MySQL.Generator-511"><a href="#MySQL.Generator-511"><span class="linenos">511</span></a> <span class="k">if</span> <span class="n">limit</span><span class="p">:</span> +</span><span id="MySQL.Generator-512"><a href="#MySQL.Generator-512"><span class="linenos">512</span></a> <span class="n">limit_offset</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">offset</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">offset</span> <span class="k">else</span> <span class="n">limit</span> +</span><span id="MySQL.Generator-513"><a href="#MySQL.Generator-513"><span class="linenos">513</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">" LIMIT </span><span class="si">{</span><span class="n">limit_offset</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-514"><a href="#MySQL.Generator-514"><span class="linenos">514</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-515"><a href="#MySQL.Generator-515"><span class="linenos">515</span></a> +</span><span id="MySQL.Generator-516"><a href="#MySQL.Generator-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">setitem_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator-517"><a href="#MySQL.Generator-517"><span class="linenos">517</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="MySQL.Generator-518"><a href="#MySQL.Generator-518"><span class="linenos">518</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-519"><a href="#MySQL.Generator-519"><span class="linenos">519</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="MySQL.Generator-520"><a href="#MySQL.Generator-520"><span class="linenos">520</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="MySQL.Generator-521"><a href="#MySQL.Generator-521"><span class="linenos">521</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="MySQL.Generator-522"><a href="#MySQL.Generator-522"><span class="linenos">522</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-523"><a href="#MySQL.Generator-523"><span class="linenos">523</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">"GLOBAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator-524"><a href="#MySQL.Generator-524"><span class="linenos">524</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">global_</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator-525"><a href="#MySQL.Generator-525"><span class="linenos">525</span></a> +</span><span id="MySQL.Generator-526"><a href="#MySQL.Generator-526"><span class="linenos">526</span></a> <span class="k">def</span> <span class="nf">set_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator-527"><a href="#MySQL.Generator-527"><span class="linenos">527</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="MySQL.Generator.show_sql" class="classattr"> + <input id="MySQL.Generator.show_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">show_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="MySQL.Generator.show_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL.Generator.show_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL.Generator.show_sql-462"><a href="#MySQL.Generator.show_sql-462"><span class="linenos">462</span></a> <span class="k">def</span> <span class="nf">show_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator.show_sql-463"><a href="#MySQL.Generator.show_sql-463"><span class="linenos">463</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator.show_sql-464"><a href="#MySQL.Generator.show_sql-464"><span class="linenos">464</span></a> <span class="n">full</span> <span class="o">=</span> <span class="s2">" FULL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"full"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.show_sql-465"><a href="#MySQL.Generator.show_sql-465"><span class="linenos">465</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.show_sql-466"><a href="#MySQL.Generator.show_sql-466"><span class="linenos">466</span></a> +</span><span id="MySQL.Generator.show_sql-467"><a href="#MySQL.Generator.show_sql-467"><span class="linenos">467</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"target"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-468"><a href="#MySQL.Generator.show_sql-468"><span class="linenos">468</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">target</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.show_sql-469"><a href="#MySQL.Generator.show_sql-469"><span class="linenos">469</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"COLUMNS"</span><span class="p">,</span> <span class="s2">"INDEX"</span><span class="p">}:</span> +</span><span id="MySQL.Generator.show_sql-470"><a href="#MySQL.Generator.show_sql-470"><span class="linenos">470</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator.show_sql-471"><a href="#MySQL.Generator.show_sql-471"><span class="linenos">471</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"GRANTS"</span><span class="p">:</span> +</span><span id="MySQL.Generator.show_sql-472"><a href="#MySQL.Generator.show_sql-472"><span class="linenos">472</span></a> <span class="n">target</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FOR</span><span class="si">{</span><span class="n">target</span><span class="si">}</span><span class="s2">"</span> +</span><span id="MySQL.Generator.show_sql-473"><a href="#MySQL.Generator.show_sql-473"><span class="linenos">473</span></a> +</span><span id="MySQL.Generator.show_sql-474"><a href="#MySQL.Generator.show_sql-474"><span class="linenos">474</span></a> <span class="n">db</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-475"><a href="#MySQL.Generator.show_sql-475"><span class="linenos">475</span></a> +</span><span id="MySQL.Generator.show_sql-476"><a href="#MySQL.Generator.show_sql-476"><span class="linenos">476</span></a> <span class="n">like</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIKE"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"like"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-477"><a href="#MySQL.Generator.show_sql-477"><span class="linenos">477</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-478"><a href="#MySQL.Generator.show_sql-478"><span class="linenos">478</span></a> +</span><span id="MySQL.Generator.show_sql-479"><a href="#MySQL.Generator.show_sql-479"><span class="linenos">479</span></a> <span class="n">types</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"types"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-480"><a href="#MySQL.Generator.show_sql-480"><span class="linenos">480</span></a> <span class="n">types</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">types</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">types</span> <span class="k">else</span> <span class="n">types</span> +</span><span id="MySQL.Generator.show_sql-481"><a href="#MySQL.Generator.show_sql-481"><span class="linenos">481</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR QUERY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"query"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-482"><a href="#MySQL.Generator.show_sql-482"><span class="linenos">482</span></a> +</span><span id="MySQL.Generator.show_sql-483"><a href="#MySQL.Generator.show_sql-483"><span class="linenos">483</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"PROFILE"</span><span class="p">:</span> +</span><span id="MySQL.Generator.show_sql-484"><a href="#MySQL.Generator.show_sql-484"><span class="linenos">484</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"OFFSET"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-485"><a href="#MySQL.Generator.show_sql-485"><span class="linenos">485</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"LIMIT"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-486"><a href="#MySQL.Generator.show_sql-486"><span class="linenos">486</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Generator.show_sql-487"><a href="#MySQL.Generator.show_sql-487"><span class="linenos">487</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.show_sql-488"><a href="#MySQL.Generator.show_sql-488"><span class="linenos">488</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_oldstyle_limit_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-489"><a href="#MySQL.Generator.show_sql-489"><span class="linenos">489</span></a> +</span><span id="MySQL.Generator.show_sql-490"><a href="#MySQL.Generator.show_sql-490"><span class="linenos">490</span></a> <span class="n">log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"IN"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"log"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-491"><a href="#MySQL.Generator.show_sql-491"><span class="linenos">491</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-492"><a href="#MySQL.Generator.show_sql-492"><span class="linenos">492</span></a> +</span><span id="MySQL.Generator.show_sql-493"><a href="#MySQL.Generator.show_sql-493"><span class="linenos">493</span></a> <span class="n">channel</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prefixed_sql</span><span class="p">(</span><span class="s2">"FOR CHANNEL"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="s2">"channel"</span><span class="p">)</span> +</span><span id="MySQL.Generator.show_sql-494"><a href="#MySQL.Generator.show_sql-494"><span class="linenos">494</span></a> +</span><span id="MySQL.Generator.show_sql-495"><a href="#MySQL.Generator.show_sql-495"><span class="linenos">495</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"ENGINE"</span><span class="p">:</span> +</span><span id="MySQL.Generator.show_sql-496"><a href="#MySQL.Generator.show_sql-496"><span class="linenos">496</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">" MUTEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"mutex"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" STATUS"</span> +</span><span id="MySQL.Generator.show_sql-497"><a href="#MySQL.Generator.show_sql-497"><span class="linenos">497</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="MySQL.Generator.show_sql-498"><a href="#MySQL.Generator.show_sql-498"><span class="linenos">498</span></a> <span class="n">mutex_or_status</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.show_sql-499"><a href="#MySQL.Generator.show_sql-499"><span class="linenos">499</span></a> +</span><span id="MySQL.Generator.show_sql-500"><a href="#MySQL.Generator.show_sql-500"><span class="linenos">500</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SHOW</span><span class="si">{</span><span class="n">full</span><span class="si">}{</span><span class="n">global_</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">target</span><span class="si">}{</span><span class="n">types</span><span class="si">}{</span><span class="n">db</span><span class="si">}{</span><span class="n">query</span><span class="si">}{</span><span class="n">log</span><span class="si">}{</span><span class="n">position</span><span class="si">}{</span><span class="n">channel</span><span class="si">}{</span><span class="n">mutex_or_status</span><span class="si">}{</span><span class="n">like</span><span class="si">}{</span><span class="n">where</span><span class="si">}{</span><span class="n">offset</span><span class="si">}{</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="MySQL.Generator.setitem_sql" class="classattr"> + <input id="MySQL.Generator.setitem_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">setitem_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="MySQL.Generator.setitem_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL.Generator.setitem_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL.Generator.setitem_sql-516"><a href="#MySQL.Generator.setitem_sql-516"><span class="linenos">516</span></a> <span class="k">def</span> <span class="nf">setitem_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator.setitem_sql-517"><a href="#MySQL.Generator.setitem_sql-517"><span class="linenos">517</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="MySQL.Generator.setitem_sql-518"><a href="#MySQL.Generator.setitem_sql-518"><span class="linenos">518</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.setitem_sql-519"><a href="#MySQL.Generator.setitem_sql-519"><span class="linenos">519</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="MySQL.Generator.setitem_sql-520"><a href="#MySQL.Generator.setitem_sql-520"><span class="linenos">520</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="MySQL.Generator.setitem_sql-521"><a href="#MySQL.Generator.setitem_sql-521"><span class="linenos">521</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="MySQL.Generator.setitem_sql-522"><a href="#MySQL.Generator.setitem_sql-522"><span class="linenos">522</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.setitem_sql-523"><a href="#MySQL.Generator.setitem_sql-523"><span class="linenos">523</span></a> <span class="n">global_</span> <span class="o">=</span> <span class="s2">"GLOBAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="MySQL.Generator.setitem_sql-524"><a href="#MySQL.Generator.setitem_sql-524"><span class="linenos">524</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">global_</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="MySQL.Generator.set_sql" class="classattr"> + <input id="MySQL.Generator.set_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="MySQL.Generator.set_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MySQL.Generator.set_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MySQL.Generator.set_sql-526"><a href="#MySQL.Generator.set_sql-526"><span class="linenos">526</span></a> <span class="k">def</span> <span class="nf">set_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="MySQL.Generator.set_sql-527"><a href="#MySQL.Generator.set_sql-527"><span class="linenos">527</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="MySQL.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="MySQL.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="MySQL.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="MySQL.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="MySQL.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="MySQL.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="MySQL.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="MySQL.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="MySQL.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="MySQL.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="MySQL.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="MySQL.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="MySQL.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="MySQL.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="MySQL.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="MySQL.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="MySQL.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="MySQL.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="MySQL.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="MySQL.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="MySQL.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="MySQL.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="MySQL.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="MySQL.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="MySQL.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="MySQL.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="MySQL.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="MySQL.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="MySQL.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="MySQL.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="MySQL.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="MySQL.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="MySQL.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="MySQL.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="MySQL.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="MySQL.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="MySQL.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="MySQL.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="MySQL.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="MySQL.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="MySQL.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="MySQL.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="MySQL.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="MySQL.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="MySQL.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="MySQL.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="MySQL.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="MySQL.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="MySQL.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="MySQL.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="MySQL.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="MySQL.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="MySQL.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="MySQL.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="MySQL.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="MySQL.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="MySQL.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="MySQL.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="MySQL.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="MySQL.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="MySQL.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="MySQL.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="MySQL.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="MySQL.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="MySQL.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="MySQL.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="MySQL.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="MySQL.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="MySQL.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="MySQL.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="MySQL.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="MySQL.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="MySQL.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="MySQL.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="MySQL.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="MySQL.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="MySQL.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="MySQL.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="MySQL.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="MySQL.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="MySQL.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="MySQL.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="MySQL.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="MySQL.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="MySQL.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="MySQL.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="MySQL.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="MySQL.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="MySQL.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="MySQL.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="MySQL.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="MySQL.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="MySQL.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="MySQL.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="MySQL.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="MySQL.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="MySQL.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="MySQL.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="MySQL.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="MySQL.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="MySQL.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="MySQL.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="MySQL.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="MySQL.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="MySQL.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="MySQL.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="MySQL.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="MySQL.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="MySQL.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="MySQL.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="MySQL.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="MySQL.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="MySQL.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="MySQL.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="MySQL.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="MySQL.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="MySQL.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="MySQL.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="MySQL.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="MySQL.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="MySQL.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="MySQL.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="MySQL.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="MySQL.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="MySQL.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="MySQL.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="MySQL.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="MySQL.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="MySQL.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="MySQL.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="MySQL.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="MySQL.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="MySQL.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="MySQL.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="MySQL.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="MySQL.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="MySQL.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="MySQL.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="MySQL.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="MySQL.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="MySQL.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="MySQL.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="MySQL.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="MySQL.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="MySQL.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="MySQL.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="MySQL.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="MySQL.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="MySQL.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="MySQL.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="MySQL.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="MySQL.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="MySQL.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="MySQL.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="MySQL.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="MySQL.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="MySQL.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="MySQL.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="MySQL.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="MySQL.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="MySQL.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="MySQL.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="MySQL.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="MySQL.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="MySQL.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="MySQL.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="MySQL.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="MySQL.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="MySQL.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="MySQL.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="MySQL.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="MySQL.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="MySQL.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="MySQL.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="MySQL.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="MySQL.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="MySQL.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="MySQL.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="MySQL.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="MySQL.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="MySQL.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="MySQL.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="MySQL.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="MySQL.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="MySQL.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="MySQL.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="MySQL.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="MySQL.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="MySQL.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="MySQL.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="MySQL.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="MySQL.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="MySQL.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="MySQL.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="MySQL.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="MySQL.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="MySQL.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="MySQL.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="MySQL.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="MySQL.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="MySQL.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/oracle.html b/docs/sqlglot/dialects/oracle.html new file mode 100644 index 0000000..4934245 --- /dev/null +++ b/docs/sqlglot/dialects/oracle.html @@ -0,0 +1,1052 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.oracle API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Oracle">Oracle</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Oracle.__init__">Oracle</a> + </li> + <li> + <a class="class" href="#Oracle.Parser">Oracle.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Oracle.Generator">Oracle.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Oracle.Generator.query_modifiers">query_modifiers</a> + </li> + <li> + <a class="function" href="#Oracle.Generator.offset_sql">offset_sql</a> + </li> + <li> + <a class="function" href="#Oracle.Generator.table_sql">table_sql</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Oracle.Tokenizer">Oracle.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/oracle.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.oracle </h1> + + + <input id="mod-oracle-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-oracle-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span><span class="p">,</span> <span class="n">transforms</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">no_ilike_sql</span><span class="p">,</span> <span class="n">rename_func</span><span class="p">,</span> <span class="n">trim_sql</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">csv</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">_limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">fetch_sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">(</span><span class="n">direction</span><span class="o">=</span><span class="s2">"FIRST"</span><span class="p">,</span> <span class="n">count</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">))</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="k">class</span> <span class="nc">Oracle</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="c1"># https://docs.oracle.com/database/121/SQLRF/sql_elements004.htm#SQLRF00212</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="c1"># https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="s2">"AM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="s2">"A.M."</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="s2">"PM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="s2">"P.M."</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%u</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># Day of week (1-7)</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> <span class="c1"># name of day</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># day of month (1-31)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="s2">"DDD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> <span class="c1"># day of year (1-366)</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="s2">"DY"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># abbreviated name of day</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> <span class="c1"># Hour of day (1-12)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="s2">"HH12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> <span class="c1"># alias for HH</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="s2">"HH24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> <span class="c1"># Hour of day (0-23)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="s2">"IW"</span><span class="p">:</span> <span class="s2">"%V"</span><span class="p">,</span> <span class="c1"># Calendar week of year (1-52 or 1-53), as defined by the ISO 8601 standard</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="s2">"MI"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> <span class="c1"># Minute (0-59)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> <span class="c1"># Month (01-12; January = 01)</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> <span class="c1"># Abbreviated name of month</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="s2">"MONTH"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> <span class="c1"># Name of month</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="s2">"SS"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> <span class="c1"># Second (0-59)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="s2">"WW"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> <span class="c1"># Week of year (1-53)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> <span class="c1"># 15</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> <span class="c1"># 2015</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="p">}</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="p">}</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"DOUBLE PRECISION"</span><span class="p">,</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR2"</span><span class="p">,</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"NVARCHAR2"</span><span class="p">,</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"CLOB"</span><span class="p">,</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="p">}</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">:</span> <span class="n">_limit_sql</span><span class="p">,</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE('1970-01-01','YYYY-MM-DD') + (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> / 86400)"</span><span class="p">,</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SUBSTR"</span><span class="p">),</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="p">}</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> <span class="c1"># offset before limit in oracle</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">offset_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> ROWS"</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">table_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="s2">"MINUS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="s2">"VARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="s2">"NVARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="p">}</span> +</span></pre></div> + + + </section> + <section id="Oracle"> + <input id="Oracle-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Oracle</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Oracle-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle-14"><a href="#Oracle-14"><span class="linenos"> 14</span></a><span class="k">class</span> <span class="nc">Oracle</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Oracle-15"><a href="#Oracle-15"><span class="linenos"> 15</span></a> <span class="c1"># https://docs.oracle.com/database/121/SQLRF/sql_elements004.htm#SQLRF00212</span> +</span><span id="Oracle-16"><a href="#Oracle-16"><span class="linenos"> 16</span></a> <span class="c1"># https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes</span> +</span><span id="Oracle-17"><a href="#Oracle-17"><span class="linenos"> 17</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle-18"><a href="#Oracle-18"><span class="linenos"> 18</span></a> <span class="s2">"AM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="Oracle-19"><a href="#Oracle-19"><span class="linenos"> 19</span></a> <span class="s2">"A.M."</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="Oracle-20"><a href="#Oracle-20"><span class="linenos"> 20</span></a> <span class="s2">"PM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="Oracle-21"><a href="#Oracle-21"><span class="linenos"> 21</span></a> <span class="s2">"P.M."</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> <span class="c1"># Meridian indicator with or without periods</span> +</span><span id="Oracle-22"><a href="#Oracle-22"><span class="linenos"> 22</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%u</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># Day of week (1-7)</span> +</span><span id="Oracle-23"><a href="#Oracle-23"><span class="linenos"> 23</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> <span class="c1"># name of day</span> +</span><span id="Oracle-24"><a href="#Oracle-24"><span class="linenos"> 24</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># day of month (1-31)</span> +</span><span id="Oracle-25"><a href="#Oracle-25"><span class="linenos"> 25</span></a> <span class="s2">"DDD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> <span class="c1"># day of year (1-366)</span> +</span><span id="Oracle-26"><a href="#Oracle-26"><span class="linenos"> 26</span></a> <span class="s2">"DY"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># abbreviated name of day</span> +</span><span id="Oracle-27"><a href="#Oracle-27"><span class="linenos"> 27</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> <span class="c1"># Hour of day (1-12)</span> +</span><span id="Oracle-28"><a href="#Oracle-28"><span class="linenos"> 28</span></a> <span class="s2">"HH12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> <span class="c1"># alias for HH</span> +</span><span id="Oracle-29"><a href="#Oracle-29"><span class="linenos"> 29</span></a> <span class="s2">"HH24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> <span class="c1"># Hour of day (0-23)</span> +</span><span id="Oracle-30"><a href="#Oracle-30"><span class="linenos"> 30</span></a> <span class="s2">"IW"</span><span class="p">:</span> <span class="s2">"%V"</span><span class="p">,</span> <span class="c1"># Calendar week of year (1-52 or 1-53), as defined by the ISO 8601 standard</span> +</span><span id="Oracle-31"><a href="#Oracle-31"><span class="linenos"> 31</span></a> <span class="s2">"MI"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> <span class="c1"># Minute (0-59)</span> +</span><span id="Oracle-32"><a href="#Oracle-32"><span class="linenos"> 32</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> <span class="c1"># Month (01-12; January = 01)</span> +</span><span id="Oracle-33"><a href="#Oracle-33"><span class="linenos"> 33</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> <span class="c1"># Abbreviated name of month</span> +</span><span id="Oracle-34"><a href="#Oracle-34"><span class="linenos"> 34</span></a> <span class="s2">"MONTH"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> <span class="c1"># Name of month</span> +</span><span id="Oracle-35"><a href="#Oracle-35"><span class="linenos"> 35</span></a> <span class="s2">"SS"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> <span class="c1"># Second (0-59)</span> +</span><span id="Oracle-36"><a href="#Oracle-36"><span class="linenos"> 36</span></a> <span class="s2">"WW"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> <span class="c1"># Week of year (1-53)</span> +</span><span id="Oracle-37"><a href="#Oracle-37"><span class="linenos"> 37</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> <span class="c1"># 15</span> +</span><span id="Oracle-38"><a href="#Oracle-38"><span class="linenos"> 38</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> <span class="c1"># 2015</span> +</span><span id="Oracle-39"><a href="#Oracle-39"><span class="linenos"> 39</span></a> <span class="p">}</span> +</span><span id="Oracle-40"><a href="#Oracle-40"><span class="linenos"> 40</span></a> +</span><span id="Oracle-41"><a href="#Oracle-41"><span class="linenos"> 41</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Oracle-42"><a href="#Oracle-42"><span class="linenos"> 42</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle-43"><a href="#Oracle-43"><span class="linenos"> 43</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle-44"><a href="#Oracle-44"><span class="linenos"> 44</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Oracle-45"><a href="#Oracle-45"><span class="linenos"> 45</span></a> <span class="p">}</span> +</span><span id="Oracle-46"><a href="#Oracle-46"><span class="linenos"> 46</span></a> +</span><span id="Oracle-47"><a href="#Oracle-47"><span class="linenos"> 47</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Oracle-48"><a href="#Oracle-48"><span class="linenos"> 48</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Oracle-49"><a href="#Oracle-49"><span class="linenos"> 49</span></a> +</span><span id="Oracle-50"><a href="#Oracle-50"><span class="linenos"> 50</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle-51"><a href="#Oracle-51"><span class="linenos"> 51</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle-52"><a href="#Oracle-52"><span class="linenos"> 52</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle-53"><a href="#Oracle-53"><span class="linenos"> 53</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle-54"><a href="#Oracle-54"><span class="linenos"> 54</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle-55"><a href="#Oracle-55"><span class="linenos"> 55</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle-56"><a href="#Oracle-56"><span class="linenos"> 56</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle-57"><a href="#Oracle-57"><span class="linenos"> 57</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"DOUBLE PRECISION"</span><span class="p">,</span> +</span><span id="Oracle-58"><a href="#Oracle-58"><span class="linenos"> 58</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR2"</span><span class="p">,</span> +</span><span id="Oracle-59"><a href="#Oracle-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"NVARCHAR2"</span><span class="p">,</span> +</span><span id="Oracle-60"><a href="#Oracle-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"CLOB"</span><span class="p">,</span> +</span><span id="Oracle-61"><a href="#Oracle-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="Oracle-62"><a href="#Oracle-62"><span class="linenos"> 62</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="Oracle-63"><a href="#Oracle-63"><span class="linenos"> 63</span></a> <span class="p">}</span> +</span><span id="Oracle-64"><a href="#Oracle-64"><span class="linenos"> 64</span></a> +</span><span id="Oracle-65"><a href="#Oracle-65"><span class="linenos"> 65</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle-66"><a href="#Oracle-66"><span class="linenos"> 66</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle-67"><a href="#Oracle-67"><span class="linenos"> 67</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle-68"><a href="#Oracle-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Oracle-69"><a href="#Oracle-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">:</span> <span class="n">_limit_sql</span><span class="p">,</span> +</span><span id="Oracle-70"><a href="#Oracle-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="Oracle-71"><a href="#Oracle-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="Oracle-72"><a href="#Oracle-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Oracle-73"><a href="#Oracle-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Oracle-74"><a href="#Oracle-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE('1970-01-01','YYYY-MM-DD') + (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> / 86400)"</span><span class="p">,</span> +</span><span id="Oracle-75"><a href="#Oracle-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SUBSTR"</span><span class="p">),</span> +</span><span id="Oracle-76"><a href="#Oracle-76"><span class="linenos"> 76</span></a> <span class="p">}</span> +</span><span id="Oracle-77"><a href="#Oracle-77"><span class="linenos"> 77</span></a> +</span><span id="Oracle-78"><a href="#Oracle-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">):</span> +</span><span id="Oracle-79"><a href="#Oracle-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="Oracle-80"><a href="#Oracle-80"><span class="linenos"> 80</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="Oracle-81"><a href="#Oracle-81"><span class="linenos"> 81</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Oracle-82"><a href="#Oracle-82"><span class="linenos"> 82</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="Oracle-83"><a href="#Oracle-83"><span class="linenos"> 83</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Oracle-84"><a href="#Oracle-84"><span class="linenos"> 84</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="Oracle-85"><a href="#Oracle-85"><span class="linenos"> 85</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="Oracle-86"><a href="#Oracle-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="Oracle-87"><a href="#Oracle-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="Oracle-88"><a href="#Oracle-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Oracle-89"><a href="#Oracle-89"><span class="linenos"> 89</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="Oracle-90"><a href="#Oracle-90"><span class="linenos"> 90</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Oracle-91"><a href="#Oracle-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="Oracle-92"><a href="#Oracle-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="Oracle-93"><a href="#Oracle-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="Oracle-94"><a href="#Oracle-94"><span class="linenos"> 94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="Oracle-95"><a href="#Oracle-95"><span class="linenos"> 95</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> <span class="c1"># offset before limit in oracle</span> +</span><span id="Oracle-96"><a href="#Oracle-96"><span class="linenos"> 96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="Oracle-97"><a href="#Oracle-97"><span class="linenos"> 97</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="Oracle-98"><a href="#Oracle-98"><span class="linenos"> 98</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="Oracle-99"><a href="#Oracle-99"><span class="linenos"> 99</span></a> <span class="p">)</span> +</span><span id="Oracle-100"><a href="#Oracle-100"><span class="linenos">100</span></a> +</span><span id="Oracle-101"><a href="#Oracle-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Oracle-102"><a href="#Oracle-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">offset_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> ROWS"</span> +</span><span id="Oracle-103"><a href="#Oracle-103"><span class="linenos">103</span></a> +</span><span id="Oracle-104"><a href="#Oracle-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Oracle-105"><a href="#Oracle-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">table_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Oracle-106"><a href="#Oracle-106"><span class="linenos">106</span></a> +</span><span id="Oracle-107"><a href="#Oracle-107"><span class="linenos">107</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Oracle-108"><a href="#Oracle-108"><span class="linenos">108</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle-109"><a href="#Oracle-109"><span class="linenos">109</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Oracle-110"><a href="#Oracle-110"><span class="linenos">110</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="Oracle-111"><a href="#Oracle-111"><span class="linenos">111</span></a> <span class="s2">"MINUS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Oracle-112"><a href="#Oracle-112"><span class="linenos">112</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Oracle-113"><a href="#Oracle-113"><span class="linenos">113</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="Oracle-114"><a href="#Oracle-114"><span class="linenos">114</span></a> <span class="s2">"VARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Oracle-115"><a href="#Oracle-115"><span class="linenos">115</span></a> <span class="s2">"NVARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="Oracle-116"><a href="#Oracle-116"><span class="linenos">116</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div id="Oracle.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Oracle</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Oracle.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Oracle.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Oracle.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Oracle.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Oracle.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Oracle.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Oracle.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Oracle.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Oracle.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Oracle.Parser"> + <input id="Oracle.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Oracle.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Oracle.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle.Parser-41"><a href="#Oracle.Parser-41"><span class="linenos">41</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Oracle.Parser-42"><a href="#Oracle.Parser-42"><span class="linenos">42</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle.Parser-43"><a href="#Oracle.Parser-43"><span class="linenos">43</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle.Parser-44"><a href="#Oracle.Parser-44"><span class="linenos">44</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Oracle.Parser-45"><a href="#Oracle.Parser-45"><span class="linenos">45</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Oracle.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Oracle.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Oracle.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Oracle.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Oracle.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Oracle.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Oracle.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Oracle.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Oracle.Generator"> + <input id="Oracle.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Oracle.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Oracle.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle.Generator-47"><a href="#Oracle.Generator-47"><span class="linenos"> 47</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Oracle.Generator-48"><a href="#Oracle.Generator-48"><span class="linenos"> 48</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Oracle.Generator-49"><a href="#Oracle.Generator-49"><span class="linenos"> 49</span></a> +</span><span id="Oracle.Generator-50"><a href="#Oracle.Generator-50"><span class="linenos"> 50</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle.Generator-51"><a href="#Oracle.Generator-51"><span class="linenos"> 51</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle.Generator-52"><a href="#Oracle.Generator-52"><span class="linenos"> 52</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle.Generator-53"><a href="#Oracle.Generator-53"><span class="linenos"> 53</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle.Generator-54"><a href="#Oracle.Generator-54"><span class="linenos"> 54</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle.Generator-55"><a href="#Oracle.Generator-55"><span class="linenos"> 55</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle.Generator-56"><a href="#Oracle.Generator-56"><span class="linenos"> 56</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMBER"</span><span class="p">,</span> +</span><span id="Oracle.Generator-57"><a href="#Oracle.Generator-57"><span class="linenos"> 57</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"DOUBLE PRECISION"</span><span class="p">,</span> +</span><span id="Oracle.Generator-58"><a href="#Oracle.Generator-58"><span class="linenos"> 58</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR2"</span><span class="p">,</span> +</span><span id="Oracle.Generator-59"><a href="#Oracle.Generator-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"NVARCHAR2"</span><span class="p">,</span> +</span><span id="Oracle.Generator-60"><a href="#Oracle.Generator-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"CLOB"</span><span class="p">,</span> +</span><span id="Oracle.Generator-61"><a href="#Oracle.Generator-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="Oracle.Generator-62"><a href="#Oracle.Generator-62"><span class="linenos"> 62</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="Oracle.Generator-63"><a href="#Oracle.Generator-63"><span class="linenos"> 63</span></a> <span class="p">}</span> +</span><span id="Oracle.Generator-64"><a href="#Oracle.Generator-64"><span class="linenos"> 64</span></a> +</span><span id="Oracle.Generator-65"><a href="#Oracle.Generator-65"><span class="linenos"> 65</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle.Generator-66"><a href="#Oracle.Generator-66"><span class="linenos"> 66</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle.Generator-67"><a href="#Oracle.Generator-67"><span class="linenos"> 67</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Oracle.Generator-68"><a href="#Oracle.Generator-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Oracle.Generator-69"><a href="#Oracle.Generator-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">:</span> <span class="n">_limit_sql</span><span class="p">,</span> +</span><span id="Oracle.Generator-70"><a href="#Oracle.Generator-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="Oracle.Generator-71"><a href="#Oracle.Generator-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="Oracle.Generator-72"><a href="#Oracle.Generator-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Oracle.Generator-73"><a href="#Oracle.Generator-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Oracle.Generator-74"><a href="#Oracle.Generator-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_DATE('1970-01-01','YYYY-MM-DD') + (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> / 86400)"</span><span class="p">,</span> +</span><span id="Oracle.Generator-75"><a href="#Oracle.Generator-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SUBSTR"</span><span class="p">),</span> +</span><span id="Oracle.Generator-76"><a href="#Oracle.Generator-76"><span class="linenos"> 76</span></a> <span class="p">}</span> +</span><span id="Oracle.Generator-77"><a href="#Oracle.Generator-77"><span class="linenos"> 77</span></a> +</span><span id="Oracle.Generator-78"><a href="#Oracle.Generator-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">):</span> +</span><span id="Oracle.Generator-79"><a href="#Oracle.Generator-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="Oracle.Generator-80"><a href="#Oracle.Generator-80"><span class="linenos"> 80</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="Oracle.Generator-81"><a href="#Oracle.Generator-81"><span class="linenos"> 81</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Oracle.Generator-82"><a href="#Oracle.Generator-82"><span class="linenos"> 82</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="Oracle.Generator-83"><a href="#Oracle.Generator-83"><span class="linenos"> 83</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Oracle.Generator-84"><a href="#Oracle.Generator-84"><span class="linenos"> 84</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="Oracle.Generator-85"><a href="#Oracle.Generator-85"><span class="linenos"> 85</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="Oracle.Generator-86"><a href="#Oracle.Generator-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="Oracle.Generator-87"><a href="#Oracle.Generator-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="Oracle.Generator-88"><a href="#Oracle.Generator-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Oracle.Generator-89"><a href="#Oracle.Generator-89"><span class="linenos"> 89</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="Oracle.Generator-90"><a href="#Oracle.Generator-90"><span class="linenos"> 90</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Oracle.Generator-91"><a href="#Oracle.Generator-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="Oracle.Generator-92"><a href="#Oracle.Generator-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="Oracle.Generator-93"><a href="#Oracle.Generator-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="Oracle.Generator-94"><a href="#Oracle.Generator-94"><span class="linenos"> 94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="Oracle.Generator-95"><a href="#Oracle.Generator-95"><span class="linenos"> 95</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> <span class="c1"># offset before limit in oracle</span> +</span><span id="Oracle.Generator-96"><a href="#Oracle.Generator-96"><span class="linenos"> 96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="Oracle.Generator-97"><a href="#Oracle.Generator-97"><span class="linenos"> 97</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="Oracle.Generator-98"><a href="#Oracle.Generator-98"><span class="linenos"> 98</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="Oracle.Generator-99"><a href="#Oracle.Generator-99"><span class="linenos"> 99</span></a> <span class="p">)</span> +</span><span id="Oracle.Generator-100"><a href="#Oracle.Generator-100"><span class="linenos">100</span></a> +</span><span id="Oracle.Generator-101"><a href="#Oracle.Generator-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Oracle.Generator-102"><a href="#Oracle.Generator-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">offset_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> ROWS"</span> +</span><span id="Oracle.Generator-103"><a href="#Oracle.Generator-103"><span class="linenos">103</span></a> +</span><span id="Oracle.Generator-104"><a href="#Oracle.Generator-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Oracle.Generator-105"><a href="#Oracle.Generator-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">table_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Oracle.Generator.query_modifiers" class="classattr"> + <input id="Oracle.Generator.query_modifiers-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">query_modifiers</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span>, </span><span class="param"><span class="o">*</span><span class="n">sqls</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Oracle.Generator.query_modifiers-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle.Generator.query_modifiers"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle.Generator.query_modifiers-78"><a href="#Oracle.Generator.query_modifiers-78"><span class="linenos">78</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">):</span> +</span><span id="Oracle.Generator.query_modifiers-79"><a href="#Oracle.Generator.query_modifiers-79"><span class="linenos">79</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="Oracle.Generator.query_modifiers-80"><a href="#Oracle.Generator.query_modifiers-80"><span class="linenos">80</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="Oracle.Generator.query_modifiers-81"><a href="#Oracle.Generator.query_modifiers-81"><span class="linenos">81</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Oracle.Generator.query_modifiers-82"><a href="#Oracle.Generator.query_modifiers-82"><span class="linenos">82</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-83"><a href="#Oracle.Generator.query_modifiers-83"><span class="linenos">83</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Oracle.Generator.query_modifiers-84"><a href="#Oracle.Generator.query_modifiers-84"><span class="linenos">84</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-85"><a href="#Oracle.Generator.query_modifiers-85"><span class="linenos">85</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-86"><a href="#Oracle.Generator.query_modifiers-86"><span class="linenos">86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-87"><a href="#Oracle.Generator.query_modifiers-87"><span class="linenos">87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-88"><a href="#Oracle.Generator.query_modifiers-88"><span class="linenos">88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Oracle.Generator.query_modifiers-89"><a href="#Oracle.Generator.query_modifiers-89"><span class="linenos">89</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="Oracle.Generator.query_modifiers-90"><a href="#Oracle.Generator.query_modifiers-90"><span class="linenos">90</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Oracle.Generator.query_modifiers-91"><a href="#Oracle.Generator.query_modifiers-91"><span class="linenos">91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-92"><a href="#Oracle.Generator.query_modifiers-92"><span class="linenos">92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-93"><a href="#Oracle.Generator.query_modifiers-93"><span class="linenos">93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-94"><a href="#Oracle.Generator.query_modifiers-94"><span class="linenos">94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-95"><a href="#Oracle.Generator.query_modifiers-95"><span class="linenos">95</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> <span class="c1"># offset before limit in oracle</span> +</span><span id="Oracle.Generator.query_modifiers-96"><a href="#Oracle.Generator.query_modifiers-96"><span class="linenos">96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-97"><a href="#Oracle.Generator.query_modifiers-97"><span class="linenos">97</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="Oracle.Generator.query_modifiers-98"><a href="#Oracle.Generator.query_modifiers-98"><span class="linenos">98</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="Oracle.Generator.query_modifiers-99"><a href="#Oracle.Generator.query_modifiers-99"><span class="linenos">99</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Oracle.Generator.offset_sql" class="classattr"> + <input id="Oracle.Generator.offset_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">offset_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Oracle.Generator.offset_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle.Generator.offset_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle.Generator.offset_sql-101"><a href="#Oracle.Generator.offset_sql-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Oracle.Generator.offset_sql-102"><a href="#Oracle.Generator.offset_sql-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">offset_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> ROWS"</span> +</span></pre></div> + + + + + </div> + <div id="Oracle.Generator.table_sql" class="classattr"> + <input id="Oracle.Generator.table_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Oracle.Generator.table_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle.Generator.table_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle.Generator.table_sql-104"><a href="#Oracle.Generator.table_sql-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Oracle.Generator.table_sql-105"><a href="#Oracle.Generator.table_sql-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">table_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Oracle.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Oracle.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Oracle.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Oracle.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Oracle.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Oracle.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Oracle.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Oracle.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Oracle.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Oracle.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Oracle.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Oracle.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Oracle.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Oracle.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Oracle.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Oracle.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Oracle.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Oracle.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Oracle.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Oracle.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Oracle.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Oracle.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Oracle.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Oracle.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Oracle.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Oracle.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Oracle.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Oracle.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Oracle.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Oracle.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Oracle.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Oracle.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Oracle.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Oracle.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Oracle.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Oracle.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Oracle.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Oracle.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Oracle.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Oracle.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Oracle.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Oracle.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Oracle.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Oracle.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Oracle.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Oracle.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Oracle.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Oracle.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Oracle.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Oracle.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Oracle.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Oracle.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Oracle.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Oracle.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Oracle.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Oracle.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Oracle.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Oracle.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Oracle.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Oracle.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Oracle.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Oracle.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Oracle.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Oracle.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Oracle.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Oracle.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Oracle.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Oracle.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Oracle.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Oracle.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Oracle.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Oracle.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Oracle.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Oracle.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Oracle.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Oracle.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Oracle.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Oracle.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Oracle.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Oracle.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Oracle.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Oracle.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Oracle.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Oracle.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Oracle.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Oracle.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Oracle.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Oracle.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Oracle.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Oracle.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Oracle.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Oracle.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Oracle.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Oracle.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Oracle.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Oracle.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Oracle.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Oracle.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Oracle.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Oracle.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Oracle.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Oracle.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Oracle.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Oracle.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Oracle.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Oracle.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Oracle.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Oracle.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Oracle.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Oracle.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Oracle.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Oracle.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Oracle.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Oracle.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Oracle.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Oracle.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Oracle.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Oracle.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Oracle.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Oracle.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Oracle.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Oracle.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Oracle.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Oracle.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Oracle.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Oracle.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Oracle.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Oracle.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Oracle.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Oracle.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Oracle.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Oracle.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Oracle.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Oracle.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Oracle.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Oracle.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Oracle.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Oracle.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Oracle.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Oracle.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Oracle.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Oracle.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Oracle.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Oracle.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Oracle.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Oracle.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Oracle.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Oracle.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Oracle.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Oracle.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Oracle.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Oracle.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Oracle.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Oracle.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Oracle.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Oracle.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Oracle.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Oracle.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Oracle.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Oracle.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Oracle.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Oracle.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Oracle.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Oracle.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Oracle.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Oracle.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Oracle.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Oracle.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Oracle.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Oracle.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Oracle.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Oracle.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Oracle.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Oracle.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Oracle.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Oracle.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Oracle.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Oracle.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Oracle.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Oracle.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Oracle.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Oracle.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Oracle.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Oracle.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Oracle.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Oracle.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Oracle.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Oracle.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Oracle.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Oracle.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Oracle.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Oracle.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Oracle.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Oracle.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Oracle.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Oracle.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Oracle.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Oracle.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Oracle.Tokenizer"> + <input id="Oracle.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Oracle.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Oracle.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Oracle.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Oracle.Tokenizer-107"><a href="#Oracle.Tokenizer-107"><span class="linenos">107</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Oracle.Tokenizer-108"><a href="#Oracle.Tokenizer-108"><span class="linenos">108</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Oracle.Tokenizer-109"><a href="#Oracle.Tokenizer-109"><span class="linenos">109</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-110"><a href="#Oracle.Tokenizer-110"><span class="linenos">110</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-111"><a href="#Oracle.Tokenizer-111"><span class="linenos">111</span></a> <span class="s2">"MINUS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-112"><a href="#Oracle.Tokenizer-112"><span class="linenos">112</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-113"><a href="#Oracle.Tokenizer-113"><span class="linenos">113</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-114"><a href="#Oracle.Tokenizer-114"><span class="linenos">114</span></a> <span class="s2">"VARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-115"><a href="#Oracle.Tokenizer-115"><span class="linenos">115</span></a> <span class="s2">"NVARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="Oracle.Tokenizer-116"><a href="#Oracle.Tokenizer-116"><span class="linenos">116</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Oracle.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Oracle.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Oracle.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/postgres.html b/docs/sqlglot/dialects/postgres.html new file mode 100644 index 0000000..4dcc846 --- /dev/null +++ b/docs/sqlglot/dialects/postgres.html @@ -0,0 +1,1245 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.postgres API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Postgres">Postgres</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Postgres.__init__">Postgres</a> + </li> + <li> + <a class="class" href="#Postgres.Tokenizer">Postgres.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Postgres.Parser">Postgres.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Postgres.Generator">Postgres.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/postgres.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.postgres </h1> + + + <input id="mod-postgres-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-postgres-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">format_time_lambda</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="p">)</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="kn">from</span> <span class="nn">sqlglot.transforms</span> <span class="kn">import</span> <span class="n">delegate</span><span class="p">,</span> <span class="n">preprocess</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="n">DATE_DIFF_FACTOR</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="s2">"MICROSECOND"</span><span class="p">:</span> <span class="s2">" * 1000000"</span><span class="p">,</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="s2">"MILLISECOND"</span><span class="p">:</span> <span class="s2">" * 1000"</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="s2">"SECOND"</span><span class="p">:</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="s2">"MINUTE"</span><span class="p">:</span> <span class="s2">" / 60"</span><span class="p">,</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="s2">"HOUR"</span><span class="p">:</span> <span class="s2">" / 3600"</span><span class="p">,</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="s2">"DAY"</span><span class="p">:</span> <span class="s2">" / 86400"</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="p">}</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a><span class="k">def</span> <span class="nf">_date_add_sql</span><span class="p">(</span><span class="n">kind</span><span class="p">):</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">simplify</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expression"</span><span class="p">])</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">):</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Cannot add non literal"</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">))</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">return</span> <span class="n">func</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="k">def</span> <span class="nf">_date_diff_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">factor</span> <span class="o">=</span> <span class="n">DATE_DIFF_FACTOR</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">unit</span><span class="p">)</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">end</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">if</span> <span class="n">factor</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(EXTRACT(epoch FROM </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">factor</span><span class="si">}</span><span class="s2"> AS BIGINT)"</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">age</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"AGE(</span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"WEEK"</span><span class="p">:</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">extract</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"EXTRACT(year FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">) * 48 + EXTRACT(month FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">) * 4 + EXTRACT(day FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">) / 7"</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">elif</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"MONTH"</span><span class="p">:</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">extract</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"EXTRACT(year FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">) * 12 + EXTRACT(month FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">elif</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"QUARTER"</span><span class="p">:</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">extract</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"EXTRACT(year FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">) * 4 + EXTRACT(month FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">) / 3"</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">elif</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"YEAR"</span><span class="p">:</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">extract</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"EXTRACT(year FROM </span><span class="si">{</span><span class="n">age</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported DATEDIFF unit </span><span class="si">{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">extract</span><span class="si">}</span><span class="s2"> AS BIGINT)"</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="k">def</span> <span class="nf">_substring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"length"</span><span class="p">)</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">from_part</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">for_part</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FOR </span><span class="si">{</span><span class="n">length</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">length</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SUBSTRING(</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_part</span><span class="si">}{</span><span class="n">for_part</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="k">def</span> <span class="nf">_string_agg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">separator</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"separator"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">","</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">order</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">):</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">this</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="c1"># Order has a leading space</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRING_AGG(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">separator</span><span class="p">)</span><span class="si">}{</span><span class="n">order</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a><span class="k">def</span> <span class="nf">_datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">:</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">[]"</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a><span class="k">def</span> <span class="nf">_auto_increment_to_serial</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">auto</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementColumnConstraint</span><span class="p">)</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="n">auto</span><span class="p">:</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"constraints"</span><span class="p">]</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">auto</span><span class="o">.</span><span class="n">parent</span><span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">if</span> <span class="n">kind</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">))</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">elif</span> <span class="n">kind</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">))</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="k">elif</span> <span class="n">kind</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">))</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a><span class="k">def</span> <span class="nf">_serial_to_generated</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="n">kind</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">)</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">elif</span> <span class="n">kind</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">:</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">)</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">elif</span> <span class="n">kind</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">:</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">)</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="n">data_type</span><span class="p">:</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">data_type</span><span class="p">)</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"constraints"</span><span class="p">]</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">generated</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">notnull</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">())</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="k">if</span> <span class="n">notnull</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">constraints</span><span class="p">:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">constraints</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">notnull</span><span class="p">)</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="n">generated</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">constraints</span><span class="p">:</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">constraints</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">generated</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a><span class="k">def</span> <span class="nf">_generate_series</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="c1"># The goal is to convert step values like '1 day' or INTERVAL '1 day' into INTERVAL '1' day</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="k">if</span> <span class="n">step</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="c1"># Postgres allows calls with just two arguments -- the "step" argument defaults to 1</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">if</span> <span class="n">step</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_interval</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">step</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">):</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_interval</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a><span class="k">def</span> <span class="nf">_to_timestamp</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="c1"># TO_TIMESTAMP accepts either a single double argument or (text, text)</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="c1"># https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TABLE</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="c1"># https://www.postgresql.org/docs/current/functions-formatting.html</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"postgres"</span><span class="p">)(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a><span class="k">class</span> <span class="nc">Postgres</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_large"</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH24:MI:SS'"</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="s2">"AM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="s2">"PM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%u</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># 1-based day of week</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># day of month</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="s2">"DDD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> <span class="c1"># zero padded day of year</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="s2">"FMDD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># - is no leading zero for Python; same for FM in postgres</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="s2">"FMDDD"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> <span class="c1"># day of year</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="s2">"FMHH12"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> <span class="c1"># 9</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"FMHH24"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> <span class="c1"># 9</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="s2">"FMMI"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> <span class="c1"># Minute</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="s2">"FMMM"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> <span class="c1"># 1</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="s2">"FMSS"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> <span class="c1"># Second</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="s2">"HH12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> <span class="c1"># 09</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="s2">"HH24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> <span class="c1"># 09</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="s2">"MI"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> <span class="c1"># zero padded minute</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> <span class="c1"># 01</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="s2">"OF"</span><span class="p">:</span> <span class="s2">"%z"</span><span class="p">,</span> <span class="c1"># utc offset</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="s2">"SS"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> <span class="c1"># zero padded second</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="s2">"TMDay"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> <span class="c1"># TM is locale dependent</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="s2">"TMDy"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="s2">"TMMon"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> <span class="c1"># Sep</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="s2">"TMMonth"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> <span class="c1"># September</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="s2">"TZ"</span><span class="p">:</span> <span class="s2">"%Z"</span><span class="p">,</span> <span class="c1"># uppercase timezone name</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="s2">"US"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># zero padded microsecond</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="s2">"WW"</span><span class="p">:</span> <span class="s2">"%U"</span><span class="p">,</span> <span class="c1"># 1-based week of year</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> <span class="c1"># 15</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> <span class="c1"># 2015</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="p">}</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"b'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"B'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">BYTE_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"e'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"E'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="s2">"~~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="s2">"~~*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="s2">"~*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IRLIKE</span><span class="p">,</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="s2">"~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="s2">"BEGIN TRANSACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="s2">"BIGSERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="s2">"CHARACTER VARYING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="s2">"COMMENT ON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"DO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="s2">"GRANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="s2">"HSTORE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HSTORE</span><span class="p">,</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="s2">"JSONB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSONB</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="s2">"REFRESH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="s2">"REINDEX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"RESET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"REVOKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"SERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"SMALLSERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"TEMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"UUID"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UUID</span><span class="p">,</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="s2">"CSTRING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">,</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="p">}</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"$$"</span><span class="p">]</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">,</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="s2">"$"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="p">}</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">_to_timestamp</span><span class="p">,</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"postgres"</span><span class="p">),</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"GENERATE_SERIES"</span><span class="p">:</span> <span class="n">_generate_series</span><span class="p">,</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="p">}</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">BITWISE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">,</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="p">}</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">FACTOR</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FACTOR</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">,</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="p">}</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">,</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"DOUBLE PRECISION"</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BYTEA"</span><span class="p">,</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BYTEA"</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="p">}</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">),</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">:</span> <span class="n">preprocess</span><span class="p">(</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="p">[</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="n">_auto_increment_to_serial</span><span class="p">,</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">_serial_to_generated</span><span class="p">,</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="p">],</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">delegate</span><span class="p">(</span><span class="s2">"columndef_sql"</span><span class="p">),</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="p">),</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#>"</span><span class="p">),</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#>>"</span><span class="p">),</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBContains</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"?"</span><span class="p">),</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"^"</span><span class="p">),</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"+"</span><span class="p">),</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"-"</span><span class="p">),</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">_date_diff_sql</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"~"</span><span class="p">),</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpILike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"~*"</span><span class="p">),</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="n">_substring_sql</span><span class="p">,</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span><span class="p">,</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_string_agg_sql</span><span class="p">,</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="p">}</span> +</span></pre></div> + + + </section> + <section id="Postgres"> + <input id="Postgres-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Postgres</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Postgres-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Postgres"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Postgres-176"><a href="#Postgres-176"><span class="linenos">176</span></a><span class="k">class</span> <span class="nc">Postgres</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Postgres-177"><a href="#Postgres-177"><span class="linenos">177</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_large"</span> +</span><span id="Postgres-178"><a href="#Postgres-178"><span class="linenos">178</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH24:MI:SS'"</span> +</span><span id="Postgres-179"><a href="#Postgres-179"><span class="linenos">179</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-180"><a href="#Postgres-180"><span class="linenos">180</span></a> <span class="s2">"AM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="Postgres-181"><a href="#Postgres-181"><span class="linenos">181</span></a> <span class="s2">"PM"</span><span class="p">:</span> <span class="s2">"%p"</span><span class="p">,</span> +</span><span id="Postgres-182"><a href="#Postgres-182"><span class="linenos">182</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%u</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># 1-based day of week</span> +</span><span id="Postgres-183"><a href="#Postgres-183"><span class="linenos">183</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># day of month</span> +</span><span id="Postgres-184"><a href="#Postgres-184"><span class="linenos">184</span></a> <span class="s2">"DDD"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> <span class="c1"># zero padded day of year</span> +</span><span id="Postgres-185"><a href="#Postgres-185"><span class="linenos">185</span></a> <span class="s2">"FMDD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># - is no leading zero for Python; same for FM in postgres</span> +</span><span id="Postgres-186"><a href="#Postgres-186"><span class="linenos">186</span></a> <span class="s2">"FMDDD"</span><span class="p">:</span> <span class="s2">"%-j"</span><span class="p">,</span> <span class="c1"># day of year</span> +</span><span id="Postgres-187"><a href="#Postgres-187"><span class="linenos">187</span></a> <span class="s2">"FMHH12"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> <span class="c1"># 9</span> +</span><span id="Postgres-188"><a href="#Postgres-188"><span class="linenos">188</span></a> <span class="s2">"FMHH24"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> <span class="c1"># 9</span> +</span><span id="Postgres-189"><a href="#Postgres-189"><span class="linenos">189</span></a> <span class="s2">"FMMI"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> <span class="c1"># Minute</span> +</span><span id="Postgres-190"><a href="#Postgres-190"><span class="linenos">190</span></a> <span class="s2">"FMMM"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> <span class="c1"># 1</span> +</span><span id="Postgres-191"><a href="#Postgres-191"><span class="linenos">191</span></a> <span class="s2">"FMSS"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> <span class="c1"># Second</span> +</span><span id="Postgres-192"><a href="#Postgres-192"><span class="linenos">192</span></a> <span class="s2">"HH12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> <span class="c1"># 09</span> +</span><span id="Postgres-193"><a href="#Postgres-193"><span class="linenos">193</span></a> <span class="s2">"HH24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> <span class="c1"># 09</span> +</span><span id="Postgres-194"><a href="#Postgres-194"><span class="linenos">194</span></a> <span class="s2">"MI"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> <span class="c1"># zero padded minute</span> +</span><span id="Postgres-195"><a href="#Postgres-195"><span class="linenos">195</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> <span class="c1"># 01</span> +</span><span id="Postgres-196"><a href="#Postgres-196"><span class="linenos">196</span></a> <span class="s2">"OF"</span><span class="p">:</span> <span class="s2">"%z"</span><span class="p">,</span> <span class="c1"># utc offset</span> +</span><span id="Postgres-197"><a href="#Postgres-197"><span class="linenos">197</span></a> <span class="s2">"SS"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> <span class="c1"># zero padded second</span> +</span><span id="Postgres-198"><a href="#Postgres-198"><span class="linenos">198</span></a> <span class="s2">"TMDay"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> <span class="c1"># TM is locale dependent</span> +</span><span id="Postgres-199"><a href="#Postgres-199"><span class="linenos">199</span></a> <span class="s2">"TMDy"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Postgres-200"><a href="#Postgres-200"><span class="linenos">200</span></a> <span class="s2">"TMMon"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> <span class="c1"># Sep</span> +</span><span id="Postgres-201"><a href="#Postgres-201"><span class="linenos">201</span></a> <span class="s2">"TMMonth"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> <span class="c1"># September</span> +</span><span id="Postgres-202"><a href="#Postgres-202"><span class="linenos">202</span></a> <span class="s2">"TZ"</span><span class="p">:</span> <span class="s2">"%Z"</span><span class="p">,</span> <span class="c1"># uppercase timezone name</span> +</span><span id="Postgres-203"><a href="#Postgres-203"><span class="linenos">203</span></a> <span class="s2">"US"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> <span class="c1"># zero padded microsecond</span> +</span><span id="Postgres-204"><a href="#Postgres-204"><span class="linenos">204</span></a> <span class="s2">"WW"</span><span class="p">:</span> <span class="s2">"%U"</span><span class="p">,</span> <span class="c1"># 1-based week of year</span> +</span><span id="Postgres-205"><a href="#Postgres-205"><span class="linenos">205</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> <span class="c1"># 15</span> +</span><span id="Postgres-206"><a href="#Postgres-206"><span class="linenos">206</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> <span class="c1"># 2015</span> +</span><span id="Postgres-207"><a href="#Postgres-207"><span class="linenos">207</span></a> <span class="p">}</span> +</span><span id="Postgres-208"><a href="#Postgres-208"><span class="linenos">208</span></a> +</span><span id="Postgres-209"><a href="#Postgres-209"><span class="linenos">209</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Postgres-210"><a href="#Postgres-210"><span class="linenos">210</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"b'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"B'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="Postgres-211"><a href="#Postgres-211"><span class="linenos">211</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="Postgres-212"><a href="#Postgres-212"><span class="linenos">212</span></a> <span class="n">BYTE_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"e'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"E'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="Postgres-213"><a href="#Postgres-213"><span class="linenos">213</span></a> +</span><span id="Postgres-214"><a href="#Postgres-214"><span class="linenos">214</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-215"><a href="#Postgres-215"><span class="linenos">215</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Postgres-216"><a href="#Postgres-216"><span class="linenos">216</span></a> <span class="s2">"~~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="Postgres-217"><a href="#Postgres-217"><span class="linenos">217</span></a> <span class="s2">"~~*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="Postgres-218"><a href="#Postgres-218"><span class="linenos">218</span></a> <span class="s2">"~*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IRLIKE</span><span class="p">,</span> +</span><span id="Postgres-219"><a href="#Postgres-219"><span class="linenos">219</span></a> <span class="s2">"~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="Postgres-220"><a href="#Postgres-220"><span class="linenos">220</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-221"><a href="#Postgres-221"><span class="linenos">221</span></a> <span class="s2">"BEGIN TRANSACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Postgres-222"><a href="#Postgres-222"><span class="linenos">222</span></a> <span class="s2">"BIGSERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">,</span> +</span><span id="Postgres-223"><a href="#Postgres-223"><span class="linenos">223</span></a> <span class="s2">"CHARACTER VARYING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Postgres-224"><a href="#Postgres-224"><span class="linenos">224</span></a> <span class="s2">"COMMENT ON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-225"><a href="#Postgres-225"><span class="linenos">225</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-226"><a href="#Postgres-226"><span class="linenos">226</span></a> <span class="s2">"DO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-227"><a href="#Postgres-227"><span class="linenos">227</span></a> <span class="s2">"GRANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-228"><a href="#Postgres-228"><span class="linenos">228</span></a> <span class="s2">"HSTORE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HSTORE</span><span class="p">,</span> +</span><span id="Postgres-229"><a href="#Postgres-229"><span class="linenos">229</span></a> <span class="s2">"JSONB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSONB</span><span class="p">,</span> +</span><span id="Postgres-230"><a href="#Postgres-230"><span class="linenos">230</span></a> <span class="s2">"REFRESH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-231"><a href="#Postgres-231"><span class="linenos">231</span></a> <span class="s2">"REINDEX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-232"><a href="#Postgres-232"><span class="linenos">232</span></a> <span class="s2">"RESET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-233"><a href="#Postgres-233"><span class="linenos">233</span></a> <span class="s2">"REVOKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres-234"><a href="#Postgres-234"><span class="linenos">234</span></a> <span class="s2">"SERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">,</span> +</span><span id="Postgres-235"><a href="#Postgres-235"><span class="linenos">235</span></a> <span class="s2">"SMALLSERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">,</span> +</span><span id="Postgres-236"><a href="#Postgres-236"><span class="linenos">236</span></a> <span class="s2">"TEMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="Postgres-237"><a href="#Postgres-237"><span class="linenos">237</span></a> <span class="s2">"UUID"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UUID</span><span class="p">,</span> +</span><span id="Postgres-238"><a href="#Postgres-238"><span class="linenos">238</span></a> <span class="s2">"CSTRING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">,</span> +</span><span id="Postgres-239"><a href="#Postgres-239"><span class="linenos">239</span></a> <span class="p">}</span> +</span><span id="Postgres-240"><a href="#Postgres-240"><span class="linenos">240</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"$$"</span><span class="p">]</span> +</span><span id="Postgres-241"><a href="#Postgres-241"><span class="linenos">241</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-242"><a href="#Postgres-242"><span class="linenos">242</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">,</span> +</span><span id="Postgres-243"><a href="#Postgres-243"><span class="linenos">243</span></a> <span class="s2">"$"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="Postgres-244"><a href="#Postgres-244"><span class="linenos">244</span></a> <span class="p">}</span> +</span><span id="Postgres-245"><a href="#Postgres-245"><span class="linenos">245</span></a> +</span><span id="Postgres-246"><a href="#Postgres-246"><span class="linenos">246</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Postgres-247"><a href="#Postgres-247"><span class="linenos">247</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Postgres-248"><a href="#Postgres-248"><span class="linenos">248</span></a> +</span><span id="Postgres-249"><a href="#Postgres-249"><span class="linenos">249</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-250"><a href="#Postgres-250"><span class="linenos">250</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres-251"><a href="#Postgres-251"><span class="linenos">251</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Postgres-252"><a href="#Postgres-252"><span class="linenos">252</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">_to_timestamp</span><span class="p">,</span> +</span><span id="Postgres-253"><a href="#Postgres-253"><span class="linenos">253</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"postgres"</span><span class="p">),</span> +</span><span id="Postgres-254"><a href="#Postgres-254"><span class="linenos">254</span></a> <span class="s2">"GENERATE_SERIES"</span><span class="p">:</span> <span class="n">_generate_series</span><span class="p">,</span> +</span><span id="Postgres-255"><a href="#Postgres-255"><span class="linenos">255</span></a> <span class="p">}</span> +</span><span id="Postgres-256"><a href="#Postgres-256"><span class="linenos">256</span></a> +</span><span id="Postgres-257"><a href="#Postgres-257"><span class="linenos">257</span></a> <span class="n">BITWISE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-258"><a href="#Postgres-258"><span class="linenos">258</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres-259"><a href="#Postgres-259"><span class="linenos">259</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">,</span> +</span><span id="Postgres-260"><a href="#Postgres-260"><span class="linenos">260</span></a> <span class="p">}</span> +</span><span id="Postgres-261"><a href="#Postgres-261"><span class="linenos">261</span></a> +</span><span id="Postgres-262"><a href="#Postgres-262"><span class="linenos">262</span></a> <span class="n">FACTOR</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-263"><a href="#Postgres-263"><span class="linenos">263</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FACTOR</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres-264"><a href="#Postgres-264"><span class="linenos">264</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">,</span> +</span><span id="Postgres-265"><a href="#Postgres-265"><span class="linenos">265</span></a> <span class="p">}</span> +</span><span id="Postgres-266"><a href="#Postgres-266"><span class="linenos">266</span></a> +</span><span id="Postgres-267"><a href="#Postgres-267"><span class="linenos">267</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Postgres-268"><a href="#Postgres-268"><span class="linenos">268</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Postgres-269"><a href="#Postgres-269"><span class="linenos">269</span></a> +</span><span id="Postgres-270"><a href="#Postgres-270"><span class="linenos">270</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-271"><a href="#Postgres-271"><span class="linenos">271</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres-272"><a href="#Postgres-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">,</span> +</span><span id="Postgres-273"><a href="#Postgres-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="Postgres-274"><a href="#Postgres-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"DOUBLE PRECISION"</span><span class="p">,</span> +</span><span id="Postgres-275"><a href="#Postgres-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BYTEA"</span><span class="p">,</span> +</span><span id="Postgres-276"><a href="#Postgres-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BYTEA"</span><span class="p">,</span> +</span><span id="Postgres-277"><a href="#Postgres-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Postgres-278"><a href="#Postgres-278"><span class="linenos">278</span></a> <span class="p">}</span> +</span><span id="Postgres-279"><a href="#Postgres-279"><span class="linenos">279</span></a> +</span><span id="Postgres-280"><a href="#Postgres-280"><span class="linenos">280</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres-281"><a href="#Postgres-281"><span class="linenos">281</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres-282"><a href="#Postgres-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">),</span> +</span><span id="Postgres-283"><a href="#Postgres-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">:</span> <span class="n">preprocess</span><span class="p">(</span> +</span><span id="Postgres-284"><a href="#Postgres-284"><span class="linenos">284</span></a> <span class="p">[</span> +</span><span id="Postgres-285"><a href="#Postgres-285"><span class="linenos">285</span></a> <span class="n">_auto_increment_to_serial</span><span class="p">,</span> +</span><span id="Postgres-286"><a href="#Postgres-286"><span class="linenos">286</span></a> <span class="n">_serial_to_generated</span><span class="p">,</span> +</span><span id="Postgres-287"><a href="#Postgres-287"><span class="linenos">287</span></a> <span class="p">],</span> +</span><span id="Postgres-288"><a href="#Postgres-288"><span class="linenos">288</span></a> <span class="n">delegate</span><span class="p">(</span><span class="s2">"columndef_sql"</span><span class="p">),</span> +</span><span id="Postgres-289"><a href="#Postgres-289"><span class="linenos">289</span></a> <span class="p">),</span> +</span><span id="Postgres-290"><a href="#Postgres-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="Postgres-291"><a href="#Postgres-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="Postgres-292"><a href="#Postgres-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#>"</span><span class="p">),</span> +</span><span id="Postgres-293"><a href="#Postgres-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#>>"</span><span class="p">),</span> +</span><span id="Postgres-294"><a href="#Postgres-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBContains</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"?"</span><span class="p">),</span> +</span><span id="Postgres-295"><a href="#Postgres-295"><span class="linenos">295</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"^"</span><span class="p">),</span> +</span><span id="Postgres-296"><a href="#Postgres-296"><span class="linenos">296</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="Postgres-297"><a href="#Postgres-297"><span class="linenos">297</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Postgres-298"><a href="#Postgres-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"+"</span><span class="p">),</span> +</span><span id="Postgres-299"><a href="#Postgres-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"-"</span><span class="p">),</span> +</span><span id="Postgres-300"><a href="#Postgres-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">_date_diff_sql</span><span class="p">,</span> +</span><span id="Postgres-301"><a href="#Postgres-301"><span class="linenos">301</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Postgres-302"><a href="#Postgres-302"><span class="linenos">302</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"~"</span><span class="p">),</span> +</span><span id="Postgres-303"><a href="#Postgres-303"><span class="linenos">303</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpILike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"~*"</span><span class="p">),</span> +</span><span id="Postgres-304"><a href="#Postgres-304"><span class="linenos">304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="Postgres-305"><a href="#Postgres-305"><span class="linenos">305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Postgres-306"><a href="#Postgres-306"><span class="linenos">306</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="n">_substring_sql</span><span class="p">,</span> +</span><span id="Postgres-307"><a href="#Postgres-307"><span class="linenos">307</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span><span class="p">,</span> +</span><span id="Postgres-308"><a href="#Postgres-308"><span class="linenos">308</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Postgres-309"><a href="#Postgres-309"><span class="linenos">309</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="Postgres-310"><a href="#Postgres-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="Postgres-311"><a href="#Postgres-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="Postgres-312"><a href="#Postgres-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Postgres-313"><a href="#Postgres-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="Postgres-314"><a href="#Postgres-314"><span class="linenos">314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_string_agg_sql</span><span class="p">,</span> +</span><span id="Postgres-315"><a href="#Postgres-315"><span class="linenos">315</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Postgres-316"><a href="#Postgres-316"><span class="linenos">316</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="Postgres-317"><a href="#Postgres-317"><span class="linenos">317</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Postgres-318"><a href="#Postgres-318"><span class="linenos">318</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div id="Postgres.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Postgres</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Postgres.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Postgres.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Postgres.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Postgres.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Postgres.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Postgres.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Postgres.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Postgres.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Postgres.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Postgres.Tokenizer"> + <input id="Postgres.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Postgres.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Postgres.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Postgres.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Postgres.Tokenizer-209"><a href="#Postgres.Tokenizer-209"><span class="linenos">209</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Postgres.Tokenizer-210"><a href="#Postgres.Tokenizer-210"><span class="linenos">210</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"b'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"B'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="Postgres.Tokenizer-211"><a href="#Postgres.Tokenizer-211"><span class="linenos">211</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="Postgres.Tokenizer-212"><a href="#Postgres.Tokenizer-212"><span class="linenos">212</span></a> <span class="n">BYTE_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"e'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"E'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span><span id="Postgres.Tokenizer-213"><a href="#Postgres.Tokenizer-213"><span class="linenos">213</span></a> +</span><span id="Postgres.Tokenizer-214"><a href="#Postgres.Tokenizer-214"><span class="linenos">214</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Tokenizer-215"><a href="#Postgres.Tokenizer-215"><span class="linenos">215</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-216"><a href="#Postgres.Tokenizer-216"><span class="linenos">216</span></a> <span class="s2">"~~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-217"><a href="#Postgres.Tokenizer-217"><span class="linenos">217</span></a> <span class="s2">"~~*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-218"><a href="#Postgres.Tokenizer-218"><span class="linenos">218</span></a> <span class="s2">"~*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IRLIKE</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-219"><a href="#Postgres.Tokenizer-219"><span class="linenos">219</span></a> <span class="s2">"~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-220"><a href="#Postgres.Tokenizer-220"><span class="linenos">220</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-221"><a href="#Postgres.Tokenizer-221"><span class="linenos">221</span></a> <span class="s2">"BEGIN TRANSACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-222"><a href="#Postgres.Tokenizer-222"><span class="linenos">222</span></a> <span class="s2">"BIGSERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-223"><a href="#Postgres.Tokenizer-223"><span class="linenos">223</span></a> <span class="s2">"CHARACTER VARYING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-224"><a href="#Postgres.Tokenizer-224"><span class="linenos">224</span></a> <span class="s2">"COMMENT ON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-225"><a href="#Postgres.Tokenizer-225"><span class="linenos">225</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-226"><a href="#Postgres.Tokenizer-226"><span class="linenos">226</span></a> <span class="s2">"DO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-227"><a href="#Postgres.Tokenizer-227"><span class="linenos">227</span></a> <span class="s2">"GRANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-228"><a href="#Postgres.Tokenizer-228"><span class="linenos">228</span></a> <span class="s2">"HSTORE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HSTORE</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-229"><a href="#Postgres.Tokenizer-229"><span class="linenos">229</span></a> <span class="s2">"JSONB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSONB</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-230"><a href="#Postgres.Tokenizer-230"><span class="linenos">230</span></a> <span class="s2">"REFRESH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-231"><a href="#Postgres.Tokenizer-231"><span class="linenos">231</span></a> <span class="s2">"REINDEX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-232"><a href="#Postgres.Tokenizer-232"><span class="linenos">232</span></a> <span class="s2">"RESET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-233"><a href="#Postgres.Tokenizer-233"><span class="linenos">233</span></a> <span class="s2">"REVOKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-234"><a href="#Postgres.Tokenizer-234"><span class="linenos">234</span></a> <span class="s2">"SERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-235"><a href="#Postgres.Tokenizer-235"><span class="linenos">235</span></a> <span class="s2">"SMALLSERIAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-236"><a href="#Postgres.Tokenizer-236"><span class="linenos">236</span></a> <span class="s2">"TEMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-237"><a href="#Postgres.Tokenizer-237"><span class="linenos">237</span></a> <span class="s2">"UUID"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UUID</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-238"><a href="#Postgres.Tokenizer-238"><span class="linenos">238</span></a> <span class="s2">"CSTRING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-239"><a href="#Postgres.Tokenizer-239"><span class="linenos">239</span></a> <span class="p">}</span> +</span><span id="Postgres.Tokenizer-240"><a href="#Postgres.Tokenizer-240"><span class="linenos">240</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"$$"</span><span class="p">]</span> +</span><span id="Postgres.Tokenizer-241"><a href="#Postgres.Tokenizer-241"><span class="linenos">241</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Tokenizer-242"><a href="#Postgres.Tokenizer-242"><span class="linenos">242</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-243"><a href="#Postgres.Tokenizer-243"><span class="linenos">243</span></a> <span class="s2">"$"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="Postgres.Tokenizer-244"><a href="#Postgres.Tokenizer-244"><span class="linenos">244</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Postgres.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Postgres.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Postgres.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Postgres.Parser"> + <input id="Postgres.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Postgres.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Postgres.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Postgres.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Postgres.Parser-246"><a href="#Postgres.Parser-246"><span class="linenos">246</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Postgres.Parser-247"><a href="#Postgres.Parser-247"><span class="linenos">247</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Postgres.Parser-248"><a href="#Postgres.Parser-248"><span class="linenos">248</span></a> +</span><span id="Postgres.Parser-249"><a href="#Postgres.Parser-249"><span class="linenos">249</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Parser-250"><a href="#Postgres.Parser-250"><span class="linenos">250</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres.Parser-251"><a href="#Postgres.Parser-251"><span class="linenos">251</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Postgres.Parser-252"><a href="#Postgres.Parser-252"><span class="linenos">252</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">_to_timestamp</span><span class="p">,</span> +</span><span id="Postgres.Parser-253"><a href="#Postgres.Parser-253"><span class="linenos">253</span></a> <span class="s2">"TO_CHAR"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"postgres"</span><span class="p">),</span> +</span><span id="Postgres.Parser-254"><a href="#Postgres.Parser-254"><span class="linenos">254</span></a> <span class="s2">"GENERATE_SERIES"</span><span class="p">:</span> <span class="n">_generate_series</span><span class="p">,</span> +</span><span id="Postgres.Parser-255"><a href="#Postgres.Parser-255"><span class="linenos">255</span></a> <span class="p">}</span> +</span><span id="Postgres.Parser-256"><a href="#Postgres.Parser-256"><span class="linenos">256</span></a> +</span><span id="Postgres.Parser-257"><a href="#Postgres.Parser-257"><span class="linenos">257</span></a> <span class="n">BITWISE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Parser-258"><a href="#Postgres.Parser-258"><span class="linenos">258</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres.Parser-259"><a href="#Postgres.Parser-259"><span class="linenos">259</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">,</span> +</span><span id="Postgres.Parser-260"><a href="#Postgres.Parser-260"><span class="linenos">260</span></a> <span class="p">}</span> +</span><span id="Postgres.Parser-261"><a href="#Postgres.Parser-261"><span class="linenos">261</span></a> +</span><span id="Postgres.Parser-262"><a href="#Postgres.Parser-262"><span class="linenos">262</span></a> <span class="n">FACTOR</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Parser-263"><a href="#Postgres.Parser-263"><span class="linenos">263</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FACTOR</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres.Parser-264"><a href="#Postgres.Parser-264"><span class="linenos">264</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">,</span> +</span><span id="Postgres.Parser-265"><a href="#Postgres.Parser-265"><span class="linenos">265</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Postgres.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Postgres.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Postgres.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Postgres.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Postgres.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Postgres.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Postgres.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Postgres.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Postgres.Generator"> + <input id="Postgres.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Postgres.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Postgres.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Postgres.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Postgres.Generator-267"><a href="#Postgres.Generator-267"><span class="linenos">267</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Postgres.Generator-268"><a href="#Postgres.Generator-268"><span class="linenos">268</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Postgres.Generator-269"><a href="#Postgres.Generator-269"><span class="linenos">269</span></a> +</span><span id="Postgres.Generator-270"><a href="#Postgres.Generator-270"><span class="linenos">270</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Generator-271"><a href="#Postgres.Generator-271"><span class="linenos">271</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres.Generator-272"><a href="#Postgres.Generator-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">,</span> +</span><span id="Postgres.Generator-273"><a href="#Postgres.Generator-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="Postgres.Generator-274"><a href="#Postgres.Generator-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"DOUBLE PRECISION"</span><span class="p">,</span> +</span><span id="Postgres.Generator-275"><a href="#Postgres.Generator-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BYTEA"</span><span class="p">,</span> +</span><span id="Postgres.Generator-276"><a href="#Postgres.Generator-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BYTEA"</span><span class="p">,</span> +</span><span id="Postgres.Generator-277"><a href="#Postgres.Generator-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Postgres.Generator-278"><a href="#Postgres.Generator-278"><span class="linenos">278</span></a> <span class="p">}</span> +</span><span id="Postgres.Generator-279"><a href="#Postgres.Generator-279"><span class="linenos">279</span></a> +</span><span id="Postgres.Generator-280"><a href="#Postgres.Generator-280"><span class="linenos">280</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Postgres.Generator-281"><a href="#Postgres.Generator-281"><span class="linenos">281</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Postgres.Generator-282"><a href="#Postgres.Generator-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#"</span><span class="p">),</span> +</span><span id="Postgres.Generator-283"><a href="#Postgres.Generator-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">:</span> <span class="n">preprocess</span><span class="p">(</span> +</span><span id="Postgres.Generator-284"><a href="#Postgres.Generator-284"><span class="linenos">284</span></a> <span class="p">[</span> +</span><span id="Postgres.Generator-285"><a href="#Postgres.Generator-285"><span class="linenos">285</span></a> <span class="n">_auto_increment_to_serial</span><span class="p">,</span> +</span><span id="Postgres.Generator-286"><a href="#Postgres.Generator-286"><span class="linenos">286</span></a> <span class="n">_serial_to_generated</span><span class="p">,</span> +</span><span id="Postgres.Generator-287"><a href="#Postgres.Generator-287"><span class="linenos">287</span></a> <span class="p">],</span> +</span><span id="Postgres.Generator-288"><a href="#Postgres.Generator-288"><span class="linenos">288</span></a> <span class="n">delegate</span><span class="p">(</span><span class="s2">"columndef_sql"</span><span class="p">),</span> +</span><span id="Postgres.Generator-289"><a href="#Postgres.Generator-289"><span class="linenos">289</span></a> <span class="p">),</span> +</span><span id="Postgres.Generator-290"><a href="#Postgres.Generator-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-291"><a href="#Postgres.Generator-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-292"><a href="#Postgres.Generator-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#>"</span><span class="p">),</span> +</span><span id="Postgres.Generator-293"><a href="#Postgres.Generator-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"#>>"</span><span class="p">),</span> +</span><span id="Postgres.Generator-294"><a href="#Postgres.Generator-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBContains</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"?"</span><span class="p">),</span> +</span><span id="Postgres.Generator-295"><a href="#Postgres.Generator-295"><span class="linenos">295</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"^"</span><span class="p">),</span> +</span><span id="Postgres.Generator-296"><a href="#Postgres.Generator-296"><span class="linenos">296</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">no_paren_current_date_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-297"><a href="#Postgres.Generator-297"><span class="linenos">297</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Postgres.Generator-298"><a href="#Postgres.Generator-298"><span class="linenos">298</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"+"</span><span class="p">),</span> +</span><span id="Postgres.Generator-299"><a href="#Postgres.Generator-299"><span class="linenos">299</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">(</span><span class="s2">"-"</span><span class="p">),</span> +</span><span id="Postgres.Generator-300"><a href="#Postgres.Generator-300"><span class="linenos">300</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">_date_diff_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-301"><a href="#Postgres.Generator-301"><span class="linenos">301</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Postgres.Generator-302"><a href="#Postgres.Generator-302"><span class="linenos">302</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"~"</span><span class="p">),</span> +</span><span id="Postgres.Generator-303"><a href="#Postgres.Generator-303"><span class="linenos">303</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpILike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"~*"</span><span class="p">),</span> +</span><span id="Postgres.Generator-304"><a href="#Postgres.Generator-304"><span class="linenos">304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">str_position_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-305"><a href="#Postgres.Generator-305"><span class="linenos">305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Postgres.Generator-306"><a href="#Postgres.Generator-306"><span class="linenos">306</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="n">_substring_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-307"><a href="#Postgres.Generator-307"><span class="linenos">307</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS TIMESTAMP)"</span><span class="p">,</span> +</span><span id="Postgres.Generator-308"><a href="#Postgres.Generator-308"><span class="linenos">308</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_CHAR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Postgres.Generator-309"><a href="#Postgres.Generator-309"><span class="linenos">309</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-310"><a href="#Postgres.Generator-310"><span class="linenos">310</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-311"><a href="#Postgres.Generator-311"><span class="linenos">311</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-312"><a href="#Postgres.Generator-312"><span class="linenos">312</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Postgres.Generator-313"><a href="#Postgres.Generator-313"><span class="linenos">313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-314"><a href="#Postgres.Generator-314"><span class="linenos">314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_string_agg_sql</span><span class="p">,</span> +</span><span id="Postgres.Generator-315"><a href="#Postgres.Generator-315"><span class="linenos">315</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Postgres.Generator-316"><a href="#Postgres.Generator-316"><span class="linenos">316</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">seq_get</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="Postgres.Generator-317"><a href="#Postgres.Generator-317"><span class="linenos">317</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'ARRAY'</span><span class="p">)</span><span class="si">}</span><span class="s2">[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Postgres.Generator-318"><a href="#Postgres.Generator-318"><span class="linenos">318</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Postgres.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Postgres.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Postgres.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Postgres.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Postgres.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Postgres.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Postgres.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Postgres.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Postgres.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Postgres.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Postgres.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Postgres.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Postgres.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Postgres.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Postgres.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Postgres.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Postgres.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Postgres.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Postgres.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Postgres.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Postgres.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Postgres.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Postgres.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Postgres.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Postgres.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Postgres.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Postgres.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Postgres.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Postgres.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Postgres.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Postgres.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Postgres.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Postgres.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Postgres.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Postgres.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Postgres.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Postgres.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Postgres.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Postgres.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Postgres.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Postgres.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Postgres.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Postgres.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Postgres.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Postgres.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Postgres.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Postgres.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Postgres.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Postgres.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Postgres.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Postgres.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Postgres.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Postgres.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Postgres.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Postgres.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Postgres.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Postgres.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Postgres.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Postgres.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Postgres.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Postgres.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Postgres.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Postgres.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Postgres.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Postgres.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Postgres.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Postgres.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Postgres.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Postgres.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Postgres.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Postgres.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Postgres.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Postgres.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Postgres.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Postgres.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Postgres.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Postgres.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Postgres.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Postgres.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Postgres.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Postgres.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Postgres.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Postgres.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Postgres.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Postgres.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Postgres.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Postgres.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Postgres.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Postgres.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Postgres.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Postgres.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Postgres.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Postgres.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Postgres.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Postgres.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Postgres.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Postgres.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Postgres.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Postgres.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Postgres.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Postgres.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Postgres.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Postgres.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Postgres.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Postgres.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Postgres.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Postgres.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Postgres.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Postgres.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Postgres.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Postgres.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Postgres.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Postgres.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Postgres.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Postgres.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Postgres.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Postgres.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Postgres.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Postgres.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Postgres.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Postgres.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Postgres.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Postgres.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Postgres.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Postgres.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Postgres.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Postgres.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Postgres.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Postgres.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Postgres.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Postgres.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Postgres.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Postgres.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Postgres.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Postgres.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Postgres.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Postgres.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Postgres.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Postgres.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Postgres.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Postgres.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Postgres.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Postgres.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Postgres.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Postgres.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Postgres.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Postgres.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Postgres.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Postgres.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Postgres.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Postgres.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Postgres.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Postgres.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Postgres.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Postgres.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Postgres.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Postgres.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Postgres.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Postgres.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Postgres.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Postgres.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Postgres.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Postgres.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Postgres.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Postgres.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Postgres.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Postgres.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Postgres.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Postgres.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Postgres.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Postgres.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Postgres.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Postgres.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Postgres.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Postgres.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Postgres.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Postgres.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Postgres.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Postgres.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Postgres.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Postgres.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Postgres.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Postgres.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Postgres.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Postgres.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Postgres.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Postgres.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Postgres.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Postgres.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Postgres.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Postgres.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Postgres.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Postgres.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Postgres.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Postgres.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Postgres.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Postgres.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Postgres.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Postgres.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Postgres.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Postgres.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/presto.html b/docs/sqlglot/dialects/presto.html new file mode 100644 index 0000000..6be49f5 --- /dev/null +++ b/docs/sqlglot/dialects/presto.html @@ -0,0 +1,1255 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.presto API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Presto">Presto</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Presto.__init__">Presto</a> + </li> + <li> + <a class="class" href="#Presto.Tokenizer">Presto.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Presto.Parser">Presto.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Presto.Generator">Presto.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Presto.Generator.transaction_sql">transaction_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/presto.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.presto </h1> + + + <input id="mod-presto-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-presto-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span><span class="p">,</span> <span class="n">transforms</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">format_time_lambda</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="p">)</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.mysql</span> <span class="kn">import</span> <span class="n">MySQL</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">UnsupportedError</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="k">def</span> <span class="nf">_approx_distinct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="n">accuracy</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"accuracy"</span><span class="p">)</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">accuracy</span> <span class="o">=</span> <span class="s2">", "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">accuracy</span><span class="p">)</span> <span class="k">if</span> <span class="n">accuracy</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"APPROX_DISTINCT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">accuracy</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="k">def</span> <span class="nf">_datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2"> WITH TIME ZONE"</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="k">def</span> <span class="nf">_explode_to_unnest_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Posexplode</span><span class="p">)):</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">(</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">(</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">],</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">ordinality</span><span class="o">=</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Posexplode</span><span class="p">),</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="p">),</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"cross"</span><span class="p">,</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="p">)</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="p">)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">lateral_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="k">def</span> <span class="nf">_initcap_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">regex</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">"(\w)(\w*)"</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"REGEXP_REPLACE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, '</span><span class="si">{</span><span class="n">regex</span><span class="si">}</span><span class="s2">', x -> UPPER(x[1]) || LOWER(x[2]))"</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="k">def</span> <span class="nf">_decode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">_ensure_utf8</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"charset"</span><span class="p">))</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_UTF8(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'replace'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="k">def</span> <span class="nf">_encode_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">_ensure_utf8</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"charset"</span><span class="p">))</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_UTF8(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="k">def</span> <span class="nf">_no_sort_array</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"asc"</span><span class="p">)</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">():</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">comparator</span> <span class="o">=</span> <span class="s2">"(a, b) -> CASE WHEN a < b THEN 1 WHEN a > b THEN -1 ELSE 0 END"</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">comparator</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">comparator</span><span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY_SORT(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="k">def</span> <span class="nf">_schema_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">'"</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">]"</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">for</span> <span class="n">schema</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">schema</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="k">def</span> <span class="nf">_quantile_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Presto does not support exact quantiles"</span><span class="p">)</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"APPROX_PERCENTILE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'quantile'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a><span class="k">def</span> <span class="nf">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a><span class="k">def</span> <span class="nf">_ts_or_ds_to_date_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="ow">and</span> <span class="n">time_format</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">time_format</span><span class="p">,</span> <span class="n">Presto</span><span class="o">.</span><span class="n">date_format</span><span class="p">):</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), 1, 10) AS DATE)"</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a><span class="k">def</span> <span class="nf">_ts_or_ds_add_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">e</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"'day'"</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATE_ADD(</span><span class="si">{</span><span class="n">unit</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">, DATE_PARSE(SUBSTR(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, 1, 10), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">date_format</span><span class="si">}</span><span class="s2">))"</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a><span class="k">def</span> <span class="nf">_sequence_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"start"</span><span class="p">]</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"end"</span><span class="p">]</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"step"</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># Postgres defaults to 1 for generate_series</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">end</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">target_type</span> <span class="o">=</span> <span class="n">end</span><span class="o">.</span><span class="n">to</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">and</span> <span class="n">target_type</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">to</span> <span class="o">=</span> <span class="n">target_type</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">if</span> <span class="n">target_type</span> <span class="ow">is</span> <span class="n">start</span><span class="o">.</span><span class="n">to</span><span class="p">:</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">end</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">start</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SEQUENCE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">start</span><span class="p">,</span><span class="w"> </span><span class="n">end</span><span class="p">,</span><span class="w"> </span><span class="n">step</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a><span class="k">def</span> <span class="nf">_ensure_utf8</span><span class="p">(</span><span class="n">charset</span><span class="p">):</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">if</span> <span class="n">charset</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">!=</span> <span class="s2">"utf-8"</span><span class="p">:</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported charset </span><span class="si">{</span><span class="n">charset</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a><span class="k">def</span> <span class="nf">_approx_percentile</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">4</span><span class="p">:</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">(</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">weight</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">quantile</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">accuracy</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="p">)</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">(</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">quantile</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">accuracy</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="p">)</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a><span class="k">def</span> <span class="nf">_from_unixtime</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">(</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">hours</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">minutes</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="p">)</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">(</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="n">zone</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="p">)</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a><span class="k">class</span> <span class="nc">Presto</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">index_offset</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">time_format</span> <span class="c1"># type: ignore</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">time_mapping</span> <span class="c1"># type: ignore</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="p">}</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="p">),</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="p">),</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="p">),</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="p">),</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="p">),</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="p">}</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="p">}</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="p">}</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">date_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="n">_decode_sql</span><span class="p">,</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="n">_encode_sql</span><span class="p">,</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">:</span> <span class="n">_sequence_sql</span><span class="p">,</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TABLE_FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">time_format</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="p">}</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"modes"</span><span class="p">)</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + </section> + <section id="Presto"> + <input id="Presto-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Presto</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Presto-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Presto"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto-169"><a href="#Presto-169"><span class="linenos">169</span></a><span class="k">class</span> <span class="nc">Presto</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Presto-170"><a href="#Presto-170"><span class="linenos">170</span></a> <span class="n">index_offset</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Presto-171"><a href="#Presto-171"><span class="linenos">171</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="Presto-172"><a href="#Presto-172"><span class="linenos">172</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">time_format</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-173"><a href="#Presto-173"><span class="linenos">173</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="n">MySQL</span><span class="o">.</span><span class="n">time_mapping</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-174"><a href="#Presto-174"><span class="linenos">174</span></a> +</span><span id="Presto-175"><a href="#Presto-175"><span class="linenos">175</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Presto-176"><a href="#Presto-176"><span class="linenos">176</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-177"><a href="#Presto-177"><span class="linenos">177</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Presto-178"><a href="#Presto-178"><span class="linenos">178</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Presto-179"><a href="#Presto-179"><span class="linenos">179</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="Presto-180"><a href="#Presto-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span><span id="Presto-181"><a href="#Presto-181"><span class="linenos">181</span></a> +</span><span id="Presto-182"><a href="#Presto-182"><span class="linenos">182</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Presto-183"><a href="#Presto-183"><span class="linenos">183</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-184"><a href="#Presto-184"><span class="linenos">184</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-185"><a href="#Presto-185"><span class="linenos">185</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-186"><a href="#Presto-186"><span class="linenos">186</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-187"><a href="#Presto-187"><span class="linenos">187</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-188"><a href="#Presto-188"><span class="linenos">188</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> +</span><span id="Presto-189"><a href="#Presto-189"><span class="linenos">189</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="Presto-190"><a href="#Presto-190"><span class="linenos">190</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto-191"><a href="#Presto-191"><span class="linenos">191</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto-192"><a href="#Presto-192"><span class="linenos">192</span></a> <span class="p">),</span> +</span><span id="Presto-193"><a href="#Presto-193"><span class="linenos">193</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="Presto-194"><a href="#Presto-194"><span class="linenos">194</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="Presto-195"><a href="#Presto-195"><span class="linenos">195</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto-196"><a href="#Presto-196"><span class="linenos">196</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto-197"><a href="#Presto-197"><span class="linenos">197</span></a> <span class="p">),</span> +</span><span id="Presto-198"><a href="#Presto-198"><span class="linenos">198</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto-199"><a href="#Presto-199"><span class="linenos">199</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto-200"><a href="#Presto-200"><span class="linenos">200</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> +</span><span id="Presto-201"><a href="#Presto-201"><span class="linenos">201</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-202"><a href="#Presto-202"><span class="linenos">202</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="Presto-203"><a href="#Presto-203"><span class="linenos">203</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto-204"><a href="#Presto-204"><span class="linenos">204</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto-205"><a href="#Presto-205"><span class="linenos">205</span></a> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="Presto-206"><a href="#Presto-206"><span class="linenos">206</span></a> <span class="p">),</span> +</span><span id="Presto-207"><a href="#Presto-207"><span class="linenos">207</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-208"><a href="#Presto-208"><span class="linenos">208</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> +</span><span id="Presto-209"><a href="#Presto-209"><span class="linenos">209</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-210"><a href="#Presto-210"><span class="linenos">210</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto-211"><a href="#Presto-211"><span class="linenos">211</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> +</span><span id="Presto-212"><a href="#Presto-212"><span class="linenos">212</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="Presto-213"><a href="#Presto-213"><span class="linenos">213</span></a> <span class="p">),</span> +</span><span id="Presto-214"><a href="#Presto-214"><span class="linenos">214</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> +</span><span id="Presto-215"><a href="#Presto-215"><span class="linenos">215</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="Presto-216"><a href="#Presto-216"><span class="linenos">216</span></a> <span class="p">),</span> +</span><span id="Presto-217"><a href="#Presto-217"><span class="linenos">217</span></a> <span class="p">}</span> +</span><span id="Presto-218"><a href="#Presto-218"><span class="linenos">218</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Presto-219"><a href="#Presto-219"><span class="linenos">219</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="Presto-220"><a href="#Presto-220"><span class="linenos">220</span></a> +</span><span id="Presto-221"><a href="#Presto-221"><span class="linenos">221</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Presto-222"><a href="#Presto-222"><span class="linenos">222</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="Presto-223"><a href="#Presto-223"><span class="linenos">223</span></a> +</span><span id="Presto-224"><a href="#Presto-224"><span class="linenos">224</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-225"><a href="#Presto-225"><span class="linenos">225</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-226"><a href="#Presto-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Presto-227"><a href="#Presto-227"><span class="linenos">227</span></a> <span class="p">}</span> +</span><span id="Presto-228"><a href="#Presto-228"><span class="linenos">228</span></a> +</span><span id="Presto-229"><a href="#Presto-229"><span class="linenos">229</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-230"><a href="#Presto-230"><span class="linenos">230</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-231"><a href="#Presto-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Presto-232"><a href="#Presto-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="Presto-233"><a href="#Presto-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="Presto-234"><a href="#Presto-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Presto-235"><a href="#Presto-235"><span class="linenos">235</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto-236"><a href="#Presto-236"><span class="linenos">236</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> +</span><span id="Presto-237"><a href="#Presto-237"><span class="linenos">237</span></a> <span class="p">}</span> +</span><span id="Presto-238"><a href="#Presto-238"><span class="linenos">238</span></a> +</span><span id="Presto-239"><a href="#Presto-239"><span class="linenos">239</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto-240"><a href="#Presto-240"><span class="linenos">240</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-241"><a href="#Presto-241"><span class="linenos">241</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto-242"><a href="#Presto-242"><span class="linenos">242</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> +</span><span id="Presto-243"><a href="#Presto-243"><span class="linenos">243</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Presto-244"><a href="#Presto-244"><span class="linenos">244</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="Presto-245"><a href="#Presto-245"><span class="linenos">245</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> +</span><span id="Presto-246"><a href="#Presto-246"><span class="linenos">246</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> +</span><span id="Presto-247"><a href="#Presto-247"><span class="linenos">247</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-248"><a href="#Presto-248"><span class="linenos">248</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-249"><a href="#Presto-249"><span class="linenos">249</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-250"><a href="#Presto-250"><span class="linenos">250</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-251"><a href="#Presto-251"><span class="linenos">251</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-252"><a href="#Presto-252"><span class="linenos">252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-253"><a href="#Presto-253"><span class="linenos">253</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto-254"><a href="#Presto-254"><span class="linenos">254</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="Presto-255"><a href="#Presto-255"><span class="linenos">255</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="Presto-256"><a href="#Presto-256"><span class="linenos">256</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="Presto-257"><a href="#Presto-257"><span class="linenos">257</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">date_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="Presto-258"><a href="#Presto-258"><span class="linenos">258</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Presto-259"><a href="#Presto-259"><span class="linenos">259</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="n">_decode_sql</span><span class="p">,</span> +</span><span id="Presto-260"><a href="#Presto-260"><span class="linenos">260</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="Presto-261"><a href="#Presto-261"><span class="linenos">261</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="n">_encode_sql</span><span class="p">,</span> +</span><span id="Presto-262"><a href="#Presto-262"><span class="linenos">262</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">:</span> <span class="n">_sequence_sql</span><span class="p">,</span> +</span><span id="Presto-263"><a href="#Presto-263"><span class="linenos">263</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> +</span><span id="Presto-264"><a href="#Presto-264"><span class="linenos">264</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="Presto-265"><a href="#Presto-265"><span class="linenos">265</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Presto-266"><a href="#Presto-266"><span class="linenos">266</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> +</span><span id="Presto-267"><a href="#Presto-267"><span class="linenos">267</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> +</span><span id="Presto-268"><a href="#Presto-268"><span class="linenos">268</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="Presto-269"><a href="#Presto-269"><span class="linenos">269</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Presto-270"><a href="#Presto-270"><span class="linenos">270</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> +</span><span id="Presto-271"><a href="#Presto-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> +</span><span id="Presto-272"><a href="#Presto-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="Presto-273"><a href="#Presto-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> +</span><span id="Presto-274"><a href="#Presto-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> +</span><span id="Presto-275"><a href="#Presto-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> +</span><span id="Presto-276"><a href="#Presto-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="Presto-277"><a href="#Presto-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="Presto-278"><a href="#Presto-278"><span class="linenos">278</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto-279"><a href="#Presto-279"><span class="linenos">279</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="Presto-280"><a href="#Presto-280"><span class="linenos">280</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TABLE_FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="Presto-281"><a href="#Presto-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="Presto-282"><a href="#Presto-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto-283"><a href="#Presto-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto-284"><a href="#Presto-284"><span class="linenos">284</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">time_format</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto-285"><a href="#Presto-285"><span class="linenos">285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-286"><a href="#Presto-286"><span class="linenos">286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> +</span><span id="Presto-287"><a href="#Presto-287"><span class="linenos">287</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Presto-288"><a href="#Presto-288"><span class="linenos">288</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> +</span><span id="Presto-289"><a href="#Presto-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="Presto-290"><a href="#Presto-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> +</span><span id="Presto-291"><a href="#Presto-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto-292"><a href="#Presto-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="Presto-293"><a href="#Presto-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> +</span><span id="Presto-294"><a href="#Presto-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="Presto-295"><a href="#Presto-295"><span class="linenos">295</span></a> <span class="p">}</span> +</span><span id="Presto-296"><a href="#Presto-296"><span class="linenos">296</span></a> +</span><span id="Presto-297"><a href="#Presto-297"><span class="linenos">297</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Presto-298"><a href="#Presto-298"><span class="linenos">298</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"modes"</span><span class="p">)</span> +</span><span id="Presto-299"><a href="#Presto-299"><span class="linenos">299</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Presto-300"><a href="#Presto-300"><span class="linenos">300</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + <div id="Presto.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Presto</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Presto.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Presto.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Presto.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Presto.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Presto.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Presto.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Presto.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Presto.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Presto.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Presto.Tokenizer"> + <input id="Presto.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Presto.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Presto.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Presto.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Tokenizer-175"><a href="#Presto.Tokenizer-175"><span class="linenos">175</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Presto.Tokenizer-176"><a href="#Presto.Tokenizer-176"><span class="linenos">176</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Tokenizer-177"><a href="#Presto.Tokenizer-177"><span class="linenos">177</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-178"><a href="#Presto.Tokenizer-178"><span class="linenos">178</span></a> <span class="s2">"START"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-179"><a href="#Presto.Tokenizer-179"><span class="linenos">179</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="Presto.Tokenizer-180"><a href="#Presto.Tokenizer-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Presto.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Presto.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Presto.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Presto.Parser"> + <input id="Presto.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Presto.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Presto.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Presto.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Parser-182"><a href="#Presto.Parser-182"><span class="linenos">182</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Presto.Parser-183"><a href="#Presto.Parser-183"><span class="linenos">183</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Parser-184"><a href="#Presto.Parser-184"><span class="linenos">184</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto.Parser-185"><a href="#Presto.Parser-185"><span class="linenos">185</span></a> <span class="s2">"APPROX_DISTINCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-186"><a href="#Presto.Parser-186"><span class="linenos">186</span></a> <span class="s2">"CARDINALITY"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-187"><a href="#Presto.Parser-187"><span class="linenos">187</span></a> <span class="s2">"CONTAINS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-188"><a href="#Presto.Parser-188"><span class="linenos">188</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span> +</span><span id="Presto.Parser-189"><a href="#Presto.Parser-189"><span class="linenos">189</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="Presto.Parser-190"><a href="#Presto.Parser-190"><span class="linenos">190</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto.Parser-191"><a href="#Presto.Parser-191"><span class="linenos">191</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto.Parser-192"><a href="#Presto.Parser-192"><span class="linenos">192</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-193"><a href="#Presto.Parser-193"><span class="linenos">193</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">(</span> +</span><span id="Presto.Parser-194"><a href="#Presto.Parser-194"><span class="linenos">194</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="Presto.Parser-195"><a href="#Presto.Parser-195"><span class="linenos">195</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto.Parser-196"><a href="#Presto.Parser-196"><span class="linenos">196</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto.Parser-197"><a href="#Presto.Parser-197"><span class="linenos">197</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-198"><a href="#Presto.Parser-198"><span class="linenos">198</span></a> <span class="s2">"DATE_FORMAT"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto.Parser-199"><a href="#Presto.Parser-199"><span class="linenos">199</span></a> <span class="s2">"DATE_PARSE"</span><span class="p">:</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"presto"</span><span class="p">),</span> +</span><span id="Presto.Parser-200"><a href="#Presto.Parser-200"><span class="linenos">200</span></a> <span class="s2">"FROM_UNIXTIME"</span><span class="p">:</span> <span class="n">_from_unixtime</span><span class="p">,</span> +</span><span id="Presto.Parser-201"><a href="#Presto.Parser-201"><span class="linenos">201</span></a> <span class="s2">"NOW"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-202"><a href="#Presto.Parser-202"><span class="linenos">202</span></a> <span class="s2">"STRPOS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="Presto.Parser-203"><a href="#Presto.Parser-203"><span class="linenos">203</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Presto.Parser-204"><a href="#Presto.Parser-204"><span class="linenos">204</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Presto.Parser-205"><a href="#Presto.Parser-205"><span class="linenos">205</span></a> <span class="n">instance</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="Presto.Parser-206"><a href="#Presto.Parser-206"><span class="linenos">206</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-207"><a href="#Presto.Parser-207"><span class="linenos">207</span></a> <span class="s2">"TO_UNIXTIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-208"><a href="#Presto.Parser-208"><span class="linenos">208</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">_approx_percentile</span><span class="p">,</span> +</span><span id="Presto.Parser-209"><a href="#Presto.Parser-209"><span class="linenos">209</span></a> <span class="s2">"FROM_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-210"><a href="#Presto.Parser-210"><span class="linenos">210</span></a> <span class="s2">"TO_HEX"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Presto.Parser-211"><a href="#Presto.Parser-211"><span class="linenos">211</span></a> <span class="s2">"TO_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">(</span> +</span><span id="Presto.Parser-212"><a href="#Presto.Parser-212"><span class="linenos">212</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="Presto.Parser-213"><a href="#Presto.Parser-213"><span class="linenos">213</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-214"><a href="#Presto.Parser-214"><span class="linenos">214</span></a> <span class="s2">"FROM_UTF8"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">(</span> +</span><span id="Presto.Parser-215"><a href="#Presto.Parser-215"><span class="linenos">215</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">replace</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">charset</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"utf-8"</span><span class="p">)</span> +</span><span id="Presto.Parser-216"><a href="#Presto.Parser-216"><span class="linenos">216</span></a> <span class="p">),</span> +</span><span id="Presto.Parser-217"><a href="#Presto.Parser-217"><span class="linenos">217</span></a> <span class="p">}</span> +</span><span id="Presto.Parser-218"><a href="#Presto.Parser-218"><span class="linenos">218</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Presto.Parser-219"><a href="#Presto.Parser-219"><span class="linenos">219</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Presto.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Presto.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Presto.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Presto.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Presto.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Presto.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Presto.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Presto.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Presto.Generator"> + <input id="Presto.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Presto.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Presto.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Presto.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator-221"><a href="#Presto.Generator-221"><span class="linenos">221</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Presto.Generator-222"><a href="#Presto.Generator-222"><span class="linenos">222</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="Presto.Generator-223"><a href="#Presto.Generator-223"><span class="linenos">223</span></a> +</span><span id="Presto.Generator-224"><a href="#Presto.Generator-224"><span class="linenos">224</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Generator-225"><a href="#Presto.Generator-225"><span class="linenos">225</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto.Generator-226"><a href="#Presto.Generator-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Presto.Generator-227"><a href="#Presto.Generator-227"><span class="linenos">227</span></a> <span class="p">}</span> +</span><span id="Presto.Generator-228"><a href="#Presto.Generator-228"><span class="linenos">228</span></a> +</span><span id="Presto.Generator-229"><a href="#Presto.Generator-229"><span class="linenos">229</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Generator-230"><a href="#Presto.Generator-230"><span class="linenos">230</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto.Generator-231"><a href="#Presto.Generator-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Presto.Generator-232"><a href="#Presto.Generator-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="Presto.Generator-233"><a href="#Presto.Generator-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBINARY"</span><span class="p">,</span> +</span><span id="Presto.Generator-234"><a href="#Presto.Generator-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Presto.Generator-235"><a href="#Presto.Generator-235"><span class="linenos">235</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto.Generator-236"><a href="#Presto.Generator-236"><span class="linenos">236</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">:</span> <span class="s2">"ROW"</span><span class="p">,</span> +</span><span id="Presto.Generator-237"><a href="#Presto.Generator-237"><span class="linenos">237</span></a> <span class="p">}</span> +</span><span id="Presto.Generator-238"><a href="#Presto.Generator-238"><span class="linenos">238</span></a> +</span><span id="Presto.Generator-239"><a href="#Presto.Generator-239"><span class="linenos">239</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Presto.Generator-240"><a href="#Presto.Generator-240"><span class="linenos">240</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto.Generator-241"><a href="#Presto.Generator-241"><span class="linenos">241</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">UNALIAS_GROUP</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Presto.Generator-242"><a href="#Presto.Generator-242"><span class="linenos">242</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">_approx_distinct_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-243"><a href="#Presto.Generator-243"><span class="linenos">243</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"ARRAY[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Presto.Generator-244"><a href="#Presto.Generator-244"><span class="linenos">244</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONCAT"</span><span class="p">),</span> +</span><span id="Presto.Generator-245"><a href="#Presto.Generator-245"><span class="linenos">245</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayContains</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CONTAINS"</span><span class="p">),</span> +</span><span id="Presto.Generator-246"><a href="#Presto.Generator-246"><span class="linenos">246</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySize</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"CARDINALITY"</span><span class="p">),</span> +</span><span id="Presto.Generator-247"><a href="#Presto.Generator-247"><span class="linenos">247</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_AND(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-248"><a href="#Presto.Generator-248"><span class="linenos">248</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_LEFT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-249"><a href="#Presto.Generator-249"><span class="linenos">249</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_NOT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-250"><a href="#Presto.Generator-250"><span class="linenos">250</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_OR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-251"><a href="#Presto.Generator-251"><span class="linenos">251</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_ARITHMETIC_SHIFT_RIGHT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-252"><a href="#Presto.Generator-252"><span class="linenos">252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"BITWISE_XOR(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-253"><a href="#Presto.Generator-253"><span class="linenos">253</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">,</span> +</span><span id="Presto.Generator-254"><a href="#Presto.Generator-254"><span class="linenos">254</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-255"><a href="#Presto.Generator-255"><span class="linenos">255</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="Presto.Generator-256"><a href="#Presto.Generator-256"><span class="linenos">256</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"""DATE_DIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s2">"'day'"</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"""</span><span class="p">,</span> +</span><span id="Presto.Generator-257"><a href="#Presto.Generator-257"><span class="linenos">257</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">date_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="Presto.Generator-258"><a href="#Presto.Generator-258"><span class="linenos">258</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS INT)"</span><span class="p">,</span> +</span><span id="Presto.Generator-259"><a href="#Presto.Generator-259"><span class="linenos">259</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Decode</span><span class="p">:</span> <span class="n">_decode_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-260"><a href="#Presto.Generator-260"><span class="linenos">260</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(DATE_PARSE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">dateint_format</span><span class="si">}</span><span class="s2">) AS DATE)"</span><span class="p">,</span> +</span><span id="Presto.Generator-261"><a href="#Presto.Generator-261"><span class="linenos">261</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Encode</span><span class="p">:</span> <span class="n">_encode_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-262"><a href="#Presto.Generator-262"><span class="linenos">262</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GenerateSeries</span><span class="p">:</span> <span class="n">_sequence_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-263"><a href="#Presto.Generator-263"><span class="linenos">263</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">),</span> +</span><span id="Presto.Generator-264"><a href="#Presto.Generator-264"><span class="linenos">264</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">if_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-265"><a href="#Presto.Generator-265"><span class="linenos">265</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-266"><a href="#Presto.Generator-266"><span class="linenos">266</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="n">_initcap_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-267"><a href="#Presto.Generator-267"><span class="linenos">267</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="n">_explode_to_unnest_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-268"><a href="#Presto.Generator-268"><span class="linenos">268</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LEVENSHTEIN_DISTANCE"</span><span class="p">),</span> +</span><span id="Presto.Generator-269"><a href="#Presto.Generator-269"><span class="linenos">269</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Presto.Generator-270"><a href="#Presto.Generator-270"><span class="linenos">270</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="n">_quantile_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-271"><a href="#Presto.Generator-271"><span class="linenos">271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_PERCENTILE"</span><span class="p">),</span> +</span><span id="Presto.Generator-272"><a href="#Presto.Generator-272"><span class="linenos">272</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="n">no_safe_divide_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-273"><a href="#Presto.Generator-273"><span class="linenos">273</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">:</span> <span class="n">_schema_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-274"><a href="#Presto.Generator-274"><span class="linenos">274</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortArray</span><span class="p">:</span> <span class="n">_no_sort_array</span><span class="p">,</span> +</span><span id="Presto.Generator-275"><a href="#Presto.Generator-275"><span class="linenos">275</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRPOS"</span><span class="p">),</span> +</span><span id="Presto.Generator-276"><a href="#Presto.Generator-276"><span class="linenos">276</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="n">_str_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE)"</span><span class="p">,</span> +</span><span id="Presto.Generator-277"><a href="#Presto.Generator-277"><span class="linenos">277</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="n">_str_to_time_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-278"><a href="#Presto.Generator-278"><span class="linenos">278</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto.Generator-279"><a href="#Presto.Generator-279"><span class="linenos">279</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructExtract</span><span class="p">:</span> <span class="n">struct_extract_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-280"><a href="#Presto.Generator-280"><span class="linenos">280</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TABLE_FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="Presto.Generator-281"><a href="#Presto.Generator-281"><span class="linenos">281</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FORMAT='</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">'"</span><span class="p">,</span> +</span><span id="Presto.Generator-282"><a href="#Presto.Generator-282"><span class="linenos">282</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-283"><a href="#Presto.Generator-283"><span class="linenos">283</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-284"><a href="#Presto.Generator-284"><span class="linenos">284</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_UNIXTIME(DATE_PARSE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">Presto</span><span class="o">.</span><span class="n">time_format</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="Presto.Generator-285"><a href="#Presto.Generator-285"><span class="linenos">285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-286"><a href="#Presto.Generator-286"><span class="linenos">286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_UNIXTIME"</span><span class="p">),</span> +</span><span id="Presto.Generator-287"><a href="#Presto.Generator-287"><span class="linenos">287</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(SUBSTR(REPLACE(CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS VARCHAR), '-', ''), 1, 8) AS INT)"</span><span class="p">,</span> +</span><span id="Presto.Generator-288"><a href="#Presto.Generator-288"><span class="linenos">288</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">_ts_or_ds_add_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-289"><a href="#Presto.Generator-289"><span class="linenos">289</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="n">_ts_or_ds_to_date_sql</span><span class="p">,</span> +</span><span id="Presto.Generator-290"><a href="#Presto.Generator-290"><span class="linenos">290</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unhex</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_HEX"</span><span class="p">),</span> +</span><span id="Presto.Generator-291"><a href="#Presto.Generator-291"><span class="linenos">291</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_FORMAT(FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">), </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Presto.Generator-292"><a href="#Presto.Generator-292"><span class="linenos">292</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="Presto.Generator-293"><a href="#Presto.Generator-293"><span class="linenos">293</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">) AS VARCHAR)"</span><span class="p">,</span> +</span><span id="Presto.Generator-294"><a href="#Presto.Generator-294"><span class="linenos">294</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="Presto.Generator-295"><a href="#Presto.Generator-295"><span class="linenos">295</span></a> <span class="p">}</span> +</span><span id="Presto.Generator-296"><a href="#Presto.Generator-296"><span class="linenos">296</span></a> +</span><span id="Presto.Generator-297"><a href="#Presto.Generator-297"><span class="linenos">297</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Presto.Generator-298"><a href="#Presto.Generator-298"><span class="linenos">298</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"modes"</span><span class="p">)</span> +</span><span id="Presto.Generator-299"><a href="#Presto.Generator-299"><span class="linenos">299</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Presto.Generator-300"><a href="#Presto.Generator-300"><span class="linenos">300</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Presto.Generator.transaction_sql" class="classattr"> + <input id="Presto.Generator.transaction_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transaction_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Presto.Generator.transaction_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Presto.Generator.transaction_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Presto.Generator.transaction_sql-297"><a href="#Presto.Generator.transaction_sql-297"><span class="linenos">297</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Presto.Generator.transaction_sql-298"><a href="#Presto.Generator.transaction_sql-298"><span class="linenos">298</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"modes"</span><span class="p">)</span> +</span><span id="Presto.Generator.transaction_sql-299"><a href="#Presto.Generator.transaction_sql-299"><span class="linenos">299</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="s1">', '</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">modes</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">modes</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Presto.Generator.transaction_sql-300"><a href="#Presto.Generator.transaction_sql-300"><span class="linenos">300</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"START TRANSACTION</span><span class="si">{</span><span class="n">modes</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Presto.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Presto.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Presto.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Presto.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Presto.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Presto.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Presto.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Presto.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Presto.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Presto.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Presto.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Presto.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Presto.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Presto.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Presto.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Presto.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Presto.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Presto.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Presto.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Presto.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Presto.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Presto.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Presto.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Presto.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Presto.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Presto.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Presto.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Presto.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Presto.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Presto.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Presto.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Presto.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Presto.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Presto.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Presto.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Presto.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Presto.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Presto.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Presto.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Presto.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Presto.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Presto.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Presto.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Presto.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Presto.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Presto.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Presto.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Presto.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Presto.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Presto.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Presto.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Presto.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Presto.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Presto.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Presto.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Presto.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Presto.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Presto.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Presto.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Presto.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Presto.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Presto.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Presto.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Presto.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Presto.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Presto.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Presto.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Presto.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Presto.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Presto.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Presto.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Presto.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Presto.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Presto.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Presto.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Presto.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Presto.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Presto.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Presto.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Presto.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Presto.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Presto.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Presto.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Presto.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Presto.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Presto.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Presto.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Presto.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Presto.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Presto.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Presto.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Presto.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Presto.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Presto.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Presto.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Presto.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Presto.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Presto.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Presto.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Presto.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Presto.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Presto.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Presto.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Presto.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Presto.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Presto.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Presto.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Presto.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Presto.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Presto.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Presto.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Presto.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Presto.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Presto.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Presto.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Presto.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Presto.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Presto.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Presto.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Presto.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Presto.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Presto.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Presto.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Presto.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Presto.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Presto.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Presto.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Presto.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Presto.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Presto.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Presto.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Presto.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Presto.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Presto.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Presto.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Presto.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Presto.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Presto.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Presto.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Presto.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Presto.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Presto.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Presto.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Presto.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Presto.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Presto.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Presto.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Presto.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Presto.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Presto.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Presto.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Presto.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Presto.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Presto.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Presto.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Presto.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Presto.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Presto.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Presto.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Presto.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Presto.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Presto.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Presto.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Presto.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Presto.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Presto.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Presto.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Presto.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Presto.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Presto.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Presto.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Presto.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Presto.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Presto.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Presto.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Presto.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Presto.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Presto.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Presto.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Presto.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Presto.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Presto.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Presto.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Presto.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Presto.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Presto.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Presto.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Presto.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Presto.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Presto.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Presto.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Presto.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Presto.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Presto.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Presto.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Presto.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Presto.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Presto.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Presto.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Presto.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/redshift.html b/docs/sqlglot/dialects/redshift.html new file mode 100644 index 0000000..649bb3c --- /dev/null +++ b/docs/sqlglot/dialects/redshift.html @@ -0,0 +1,1175 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.redshift API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Redshift">Redshift</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Redshift.__init__">Redshift</a> + </li> + <li> + <a class="class" href="#Redshift.Parser">Redshift.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Redshift.Tokenizer">Redshift.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Redshift.Generator">Redshift.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Redshift.Generator.values_sql">values_sql</a> + </li> + <li> + <a class="function" href="#Redshift.Generator.with_properties">with_properties</a> + </li> + <li> + <a class="function" href="#Redshift.Generator.renametable_sql">renametable_sql</a> + </li> + <li> + <a class="function" href="#Redshift.Generator.datatype_sql">datatype_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/redshift.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.redshift </h1> + + + <input id="mod-redshift-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-redshift-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">transforms</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">rename_func</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.postgres</span> <span class="kn">import</span> <span class="n">Postgres</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="k">class</span> <span class="nc">Redshift</span><span class="p">(</span><span class="n">Postgres</span><span class="p">):</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH:MI:SS'"</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="p">}</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="s2">"NVL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="p">}</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="k">def</span> <span class="nf">_parse_types</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">check_func</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(</span><span class="n">check_func</span><span class="o">=</span><span class="n">check_func</span><span class="p">)</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="p">):</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">)])</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="s2">"ENCODE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">,</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="s2">"GEOMETRY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="s2">"GEOGRAPHY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="s2">"TIMETZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="p">}</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="p">}</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="p">}</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">ELIMINATE_DISTINCT_ON</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DISTKEY(</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="p">}</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="sd"> Converts `VALUES...` expression into a series of unions.</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a><span class="sd"> Note: If you have a lot of unions then this will result in a large number of recursive statements to</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="sd"> evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a><span class="sd"> very slow.</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="sd"> """</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">tuple_exp</span><span class="o">.</span><span class="n">expressions</span> <span class="k">for</span> <span class="n">tuple_exp</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">]</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">rows</span><span class="p">):</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">row</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">for</span> <span class="n">value</span><span class="p">,</span> <span class="n">column_name</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"columns"</span><span class="p">])</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="p">]</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">selects</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">row</span><span class="p">))</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">selects</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="n">subquery_expression</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_sql</span><span class="p">(</span><span class="n">subquery_expression</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">))</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="w"> </span><span class="sd">"""Redshift only supports defining the table name itself (not the db) when renaming tables"""</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">target_table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">target_table</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="n">arg</span> <span class="o">!=</span> <span class="s2">"this"</span><span class="p">:</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">target_table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a><span class="sd"> """</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">)</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">precision</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="Redshift"> + <input id="Redshift-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Redshift</span><wbr>(<span class="base"><a href="postgres.html#Postgres">sqlglot.dialects.postgres.Postgres</a></span>): + + <label class="view-source-button" for="Redshift-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift-12"><a href="#Redshift-12"><span class="linenos"> 12</span></a><span class="k">class</span> <span class="nc">Redshift</span><span class="p">(</span><span class="n">Postgres</span><span class="p">):</span> +</span><span id="Redshift-13"><a href="#Redshift-13"><span class="linenos"> 13</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH:MI:SS'"</span> +</span><span id="Redshift-14"><a href="#Redshift-14"><span class="linenos"> 14</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-15"><a href="#Redshift-15"><span class="linenos"> 15</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-16"><a href="#Redshift-16"><span class="linenos"> 16</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="Redshift-17"><a href="#Redshift-17"><span class="linenos"> 17</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="Redshift-18"><a href="#Redshift-18"><span class="linenos"> 18</span></a> <span class="p">}</span> +</span><span id="Redshift-19"><a href="#Redshift-19"><span class="linenos"> 19</span></a> +</span><span id="Redshift-20"><a href="#Redshift-20"><span class="linenos"> 20</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Redshift-21"><a href="#Redshift-21"><span class="linenos"> 21</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-22"><a href="#Redshift-22"><span class="linenos"> 22</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-23"><a href="#Redshift-23"><span class="linenos"> 23</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift-24"><a href="#Redshift-24"><span class="linenos"> 24</span></a> <span class="s2">"NVL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift-25"><a href="#Redshift-25"><span class="linenos"> 25</span></a> <span class="p">}</span> +</span><span id="Redshift-26"><a href="#Redshift-26"><span class="linenos"> 26</span></a> +</span><span id="Redshift-27"><a href="#Redshift-27"><span class="linenos"> 27</span></a> <span class="k">def</span> <span class="nf">_parse_types</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">check_func</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Redshift-28"><a href="#Redshift-28"><span class="linenos"> 28</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(</span><span class="n">check_func</span><span class="o">=</span><span class="n">check_func</span><span class="p">)</span> +</span><span id="Redshift-29"><a href="#Redshift-29"><span class="linenos"> 29</span></a> +</span><span id="Redshift-30"><a href="#Redshift-30"><span class="linenos"> 30</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Redshift-31"><a href="#Redshift-31"><span class="linenos"> 31</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="Redshift-32"><a href="#Redshift-32"><span class="linenos"> 32</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="Redshift-33"><a href="#Redshift-33"><span class="linenos"> 33</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Redshift-34"><a href="#Redshift-34"><span class="linenos"> 34</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">)</span> +</span><span id="Redshift-35"><a href="#Redshift-35"><span class="linenos"> 35</span></a> <span class="p">):</span> +</span><span id="Redshift-36"><a href="#Redshift-36"><span class="linenos"> 36</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">)])</span> +</span><span id="Redshift-37"><a href="#Redshift-37"><span class="linenos"> 37</span></a> +</span><span id="Redshift-38"><a href="#Redshift-38"><span class="linenos"> 38</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Redshift-39"><a href="#Redshift-39"><span class="linenos"> 39</span></a> +</span><span id="Redshift-40"><a href="#Redshift-40"><span class="linenos"> 40</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Redshift-41"><a href="#Redshift-41"><span class="linenos"> 41</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Redshift-42"><a href="#Redshift-42"><span class="linenos"> 42</span></a> +</span><span id="Redshift-43"><a href="#Redshift-43"><span class="linenos"> 43</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-44"><a href="#Redshift-44"><span class="linenos"> 44</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-45"><a href="#Redshift-45"><span class="linenos"> 45</span></a> <span class="s2">"ENCODE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">,</span> +</span><span id="Redshift-46"><a href="#Redshift-46"><span class="linenos"> 46</span></a> <span class="s2">"GEOMETRY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span> +</span><span id="Redshift-47"><a href="#Redshift-47"><span class="linenos"> 47</span></a> <span class="s2">"GEOGRAPHY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="Redshift-48"><a href="#Redshift-48"><span class="linenos"> 48</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="Redshift-49"><a href="#Redshift-49"><span class="linenos"> 49</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="Redshift-50"><a href="#Redshift-50"><span class="linenos"> 50</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Redshift-51"><a href="#Redshift-51"><span class="linenos"> 51</span></a> <span class="s2">"TIMETZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Redshift-52"><a href="#Redshift-52"><span class="linenos"> 52</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Redshift-53"><a href="#Redshift-53"><span class="linenos"> 53</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Redshift-54"><a href="#Redshift-54"><span class="linenos"> 54</span></a> <span class="p">}</span> +</span><span id="Redshift-55"><a href="#Redshift-55"><span class="linenos"> 55</span></a> +</span><span id="Redshift-56"><a href="#Redshift-56"><span class="linenos"> 56</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Redshift-57"><a href="#Redshift-57"><span class="linenos"> 57</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-58"><a href="#Redshift-58"><span class="linenos"> 58</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-59"><a href="#Redshift-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift-60"><a href="#Redshift-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift-61"><a href="#Redshift-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Redshift-62"><a href="#Redshift-62"><span class="linenos"> 62</span></a> <span class="p">}</span> +</span><span id="Redshift-63"><a href="#Redshift-63"><span class="linenos"> 63</span></a> +</span><span id="Redshift-64"><a href="#Redshift-64"><span class="linenos"> 64</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-65"><a href="#Redshift-65"><span class="linenos"> 65</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-66"><a href="#Redshift-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="Redshift-67"><a href="#Redshift-67"><span class="linenos"> 67</span></a> <span class="p">}</span> +</span><span id="Redshift-68"><a href="#Redshift-68"><span class="linenos"> 68</span></a> +</span><span id="Redshift-69"><a href="#Redshift-69"><span class="linenos"> 69</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-70"><a href="#Redshift-70"><span class="linenos"> 70</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-71"><a href="#Redshift-71"><span class="linenos"> 71</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">ELIMINATE_DISTINCT_ON</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift-72"><a href="#Redshift-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DISTKEY(</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift-73"><a href="#Redshift-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift-74"><a href="#Redshift-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Redshift-75"><a href="#Redshift-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="Redshift-76"><a href="#Redshift-76"><span class="linenos"> 76</span></a> <span class="p">}</span> +</span><span id="Redshift-77"><a href="#Redshift-77"><span class="linenos"> 77</span></a> +</span><span id="Redshift-78"><a href="#Redshift-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-79"><a href="#Redshift-79"><span class="linenos"> 79</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift-80"><a href="#Redshift-80"><span class="linenos"> 80</span></a><span class="sd"> Converts `VALUES...` expression into a series of unions.</span> +</span><span id="Redshift-81"><a href="#Redshift-81"><span class="linenos"> 81</span></a> +</span><span id="Redshift-82"><a href="#Redshift-82"><span class="linenos"> 82</span></a><span class="sd"> Note: If you have a lot of unions then this will result in a large number of recursive statements to</span> +</span><span id="Redshift-83"><a href="#Redshift-83"><span class="linenos"> 83</span></a><span class="sd"> evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be</span> +</span><span id="Redshift-84"><a href="#Redshift-84"><span class="linenos"> 84</span></a><span class="sd"> very slow.</span> +</span><span id="Redshift-85"><a href="#Redshift-85"><span class="linenos"> 85</span></a><span class="sd"> """</span> +</span><span id="Redshift-86"><a href="#Redshift-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="Redshift-87"><a href="#Redshift-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Redshift-88"><a href="#Redshift-88"><span class="linenos"> 88</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">tuple_exp</span><span class="o">.</span><span class="n">expressions</span> <span class="k">for</span> <span class="n">tuple_exp</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">]</span> +</span><span id="Redshift-89"><a href="#Redshift-89"><span class="linenos"> 89</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift-90"><a href="#Redshift-90"><span class="linenos"> 90</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">rows</span><span class="p">):</span> +</span><span id="Redshift-91"><a href="#Redshift-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="Redshift-92"><a href="#Redshift-92"><span class="linenos"> 92</span></a> <span class="n">row</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Redshift-93"><a href="#Redshift-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="Redshift-94"><a href="#Redshift-94"><span class="linenos"> 94</span></a> <span class="k">for</span> <span class="n">value</span><span class="p">,</span> <span class="n">column_name</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"columns"</span><span class="p">])</span> +</span><span id="Redshift-95"><a href="#Redshift-95"><span class="linenos"> 95</span></a> <span class="p">]</span> +</span><span id="Redshift-96"><a href="#Redshift-96"><span class="linenos"> 96</span></a> <span class="n">selects</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">row</span><span class="p">))</span> +</span><span id="Redshift-97"><a href="#Redshift-97"><span class="linenos"> 97</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="Redshift-98"><a href="#Redshift-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">selects</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Redshift-99"><a href="#Redshift-99"><span class="linenos"> 99</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="Redshift-100"><a href="#Redshift-100"><span class="linenos">100</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="n">subquery_expression</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Redshift-101"><a href="#Redshift-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_sql</span><span class="p">(</span><span class="n">subquery_expression</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">))</span> +</span><span id="Redshift-102"><a href="#Redshift-102"><span class="linenos">102</span></a> +</span><span id="Redshift-103"><a href="#Redshift-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-104"><a href="#Redshift-104"><span class="linenos">104</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="Redshift-105"><a href="#Redshift-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Redshift-106"><a href="#Redshift-106"><span class="linenos">106</span></a> +</span><span id="Redshift-107"><a href="#Redshift-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-108"><a href="#Redshift-108"><span class="linenos">108</span></a><span class="w"> </span><span class="sd">"""Redshift only supports defining the table name itself (not the db) when renaming tables"""</span> +</span><span id="Redshift-109"><a href="#Redshift-109"><span class="linenos">109</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift-110"><a href="#Redshift-110"><span class="linenos">110</span></a> <span class="n">target_table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Redshift-111"><a href="#Redshift-111"><span class="linenos">111</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">target_table</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Redshift-112"><a href="#Redshift-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="n">arg</span> <span class="o">!=</span> <span class="s2">"this"</span><span class="p">:</span> +</span><span id="Redshift-113"><a href="#Redshift-113"><span class="linenos">113</span></a> <span class="n">target_table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Redshift-114"><a href="#Redshift-114"><span class="linenos">114</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Redshift-115"><a href="#Redshift-115"><span class="linenos">115</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Redshift-116"><a href="#Redshift-116"><span class="linenos">116</span></a> +</span><span id="Redshift-117"><a href="#Redshift-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-118"><a href="#Redshift-118"><span class="linenos">118</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift-119"><a href="#Redshift-119"><span class="linenos">119</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="Redshift-120"><a href="#Redshift-120"><span class="linenos">120</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="Redshift-121"><a href="#Redshift-121"><span class="linenos">121</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="Redshift-122"><a href="#Redshift-122"><span class="linenos">122</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="Redshift-123"><a href="#Redshift-123"><span class="linenos">123</span></a><span class="sd"> """</span> +</span><span id="Redshift-124"><a href="#Redshift-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="Redshift-125"><a href="#Redshift-125"><span class="linenos">125</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift-126"><a href="#Redshift-126"><span class="linenos">126</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">)</span> +</span><span id="Redshift-127"><a href="#Redshift-127"><span class="linenos">127</span></a> <span class="n">precision</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Redshift-128"><a href="#Redshift-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="Redshift-129"><a href="#Redshift-129"><span class="linenos">129</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift-130"><a href="#Redshift-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Redshift.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Redshift</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Redshift.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Redshift.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Redshift.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Redshift.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Redshift.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Redshift.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Redshift.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Redshift.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Redshift.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Redshift.Parser"> + <input id="Redshift.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Redshift.Parser</span><wbr>(<span class="base"><a href="postgres.html#Postgres.Parser">sqlglot.dialects.postgres.Postgres.Parser</a></span>): + + <label class="view-source-button" for="Redshift.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Parser-20"><a href="#Redshift.Parser-20"><span class="linenos">20</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Redshift.Parser-21"><a href="#Redshift.Parser-21"><span class="linenos">21</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Parser-22"><a href="#Redshift.Parser-22"><span class="linenos">22</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift.Parser-23"><a href="#Redshift.Parser-23"><span class="linenos">23</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift.Parser-24"><a href="#Redshift.Parser-24"><span class="linenos">24</span></a> <span class="s2">"NVL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift.Parser-25"><a href="#Redshift.Parser-25"><span class="linenos">25</span></a> <span class="p">}</span> +</span><span id="Redshift.Parser-26"><a href="#Redshift.Parser-26"><span class="linenos">26</span></a> +</span><span id="Redshift.Parser-27"><a href="#Redshift.Parser-27"><span class="linenos">27</span></a> <span class="k">def</span> <span class="nf">_parse_types</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">check_func</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Redshift.Parser-28"><a href="#Redshift.Parser-28"><span class="linenos">28</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(</span><span class="n">check_func</span><span class="o">=</span><span class="n">check_func</span><span class="p">)</span> +</span><span id="Redshift.Parser-29"><a href="#Redshift.Parser-29"><span class="linenos">29</span></a> +</span><span id="Redshift.Parser-30"><a href="#Redshift.Parser-30"><span class="linenos">30</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Redshift.Parser-31"><a href="#Redshift.Parser-31"><span class="linenos">31</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="Redshift.Parser-32"><a href="#Redshift.Parser-32"><span class="linenos">32</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="Redshift.Parser-33"><a href="#Redshift.Parser-33"><span class="linenos">33</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Redshift.Parser-34"><a href="#Redshift.Parser-34"><span class="linenos">34</span></a> <span class="ow">and</span> <span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">)</span> +</span><span id="Redshift.Parser-35"><a href="#Redshift.Parser-35"><span class="linenos">35</span></a> <span class="p">):</span> +</span><span id="Redshift.Parser-36"><a href="#Redshift.Parser-36"><span class="linenos">36</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">)])</span> +</span><span id="Redshift.Parser-37"><a href="#Redshift.Parser-37"><span class="linenos">37</span></a> +</span><span id="Redshift.Parser-38"><a href="#Redshift.Parser-38"><span class="linenos">38</span></a> <span class="k">return</span> <span class="n">this</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Redshift.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Redshift.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Redshift.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Redshift.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Redshift.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Redshift.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Redshift.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Redshift.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Redshift.Tokenizer"> + <input id="Redshift.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Redshift.Tokenizer</span><wbr>(<span class="base"><a href="postgres.html#Postgres.Tokenizer">sqlglot.dialects.postgres.Postgres.Tokenizer</a></span>): + + <label class="view-source-button" for="Redshift.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Tokenizer-40"><a href="#Redshift.Tokenizer-40"><span class="linenos">40</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Redshift.Tokenizer-41"><a href="#Redshift.Tokenizer-41"><span class="linenos">41</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Redshift.Tokenizer-42"><a href="#Redshift.Tokenizer-42"><span class="linenos">42</span></a> +</span><span id="Redshift.Tokenizer-43"><a href="#Redshift.Tokenizer-43"><span class="linenos">43</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Tokenizer-44"><a href="#Redshift.Tokenizer-44"><span class="linenos">44</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift.Tokenizer-45"><a href="#Redshift.Tokenizer-45"><span class="linenos">45</span></a> <span class="s2">"ENCODE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-46"><a href="#Redshift.Tokenizer-46"><span class="linenos">46</span></a> <span class="s2">"GEOMETRY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-47"><a href="#Redshift.Tokenizer-47"><span class="linenos">47</span></a> <span class="s2">"GEOGRAPHY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-48"><a href="#Redshift.Tokenizer-48"><span class="linenos">48</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-49"><a href="#Redshift.Tokenizer-49"><span class="linenos">49</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-50"><a href="#Redshift.Tokenizer-50"><span class="linenos">50</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-51"><a href="#Redshift.Tokenizer-51"><span class="linenos">51</span></a> <span class="s2">"TIMETZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-52"><a href="#Redshift.Tokenizer-52"><span class="linenos">52</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-53"><a href="#Redshift.Tokenizer-53"><span class="linenos">53</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-54"><a href="#Redshift.Tokenizer-54"><span class="linenos">54</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Redshift.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Redshift.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Redshift.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Redshift.Generator"> + <input id="Redshift.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Redshift.Generator</span><wbr>(<span class="base"><a href="postgres.html#Postgres.Generator">sqlglot.dialects.postgres.Postgres.Generator</a></span>): + + <label class="view-source-button" for="Redshift.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator-56"><a href="#Redshift.Generator-56"><span class="linenos"> 56</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Redshift.Generator-57"><a href="#Redshift.Generator-57"><span class="linenos"> 57</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Generator-58"><a href="#Redshift.Generator-58"><span class="linenos"> 58</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift.Generator-59"><a href="#Redshift.Generator-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift.Generator-60"><a href="#Redshift.Generator-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift.Generator-61"><a href="#Redshift.Generator-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Redshift.Generator-62"><a href="#Redshift.Generator-62"><span class="linenos"> 62</span></a> <span class="p">}</span> +</span><span id="Redshift.Generator-63"><a href="#Redshift.Generator-63"><span class="linenos"> 63</span></a> +</span><span id="Redshift.Generator-64"><a href="#Redshift.Generator-64"><span class="linenos"> 64</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Generator-65"><a href="#Redshift.Generator-65"><span class="linenos"> 65</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift.Generator-66"><a href="#Redshift.Generator-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="Redshift.Generator-67"><a href="#Redshift.Generator-67"><span class="linenos"> 67</span></a> <span class="p">}</span> +</span><span id="Redshift.Generator-68"><a href="#Redshift.Generator-68"><span class="linenos"> 68</span></a> +</span><span id="Redshift.Generator-69"><a href="#Redshift.Generator-69"><span class="linenos"> 69</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Generator-70"><a href="#Redshift.Generator-70"><span class="linenos"> 70</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift.Generator-71"><a href="#Redshift.Generator-71"><span class="linenos"> 71</span></a> <span class="o">**</span><span class="n">transforms</span><span class="o">.</span><span class="n">ELIMINATE_DISTINCT_ON</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Redshift.Generator-72"><a href="#Redshift.Generator-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DISTKEY(</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift.Generator-73"><a href="#Redshift.Generator-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift.Generator-74"><a href="#Redshift.Generator-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Redshift.Generator-75"><a href="#Redshift.Generator-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="Redshift.Generator-76"><a href="#Redshift.Generator-76"><span class="linenos"> 76</span></a> <span class="p">}</span> +</span><span id="Redshift.Generator-77"><a href="#Redshift.Generator-77"><span class="linenos"> 77</span></a> +</span><span id="Redshift.Generator-78"><a href="#Redshift.Generator-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-79"><a href="#Redshift.Generator-79"><span class="linenos"> 79</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift.Generator-80"><a href="#Redshift.Generator-80"><span class="linenos"> 80</span></a><span class="sd"> Converts `VALUES...` expression into a series of unions.</span> +</span><span id="Redshift.Generator-81"><a href="#Redshift.Generator-81"><span class="linenos"> 81</span></a> +</span><span id="Redshift.Generator-82"><a href="#Redshift.Generator-82"><span class="linenos"> 82</span></a><span class="sd"> Note: If you have a lot of unions then this will result in a large number of recursive statements to</span> +</span><span id="Redshift.Generator-83"><a href="#Redshift.Generator-83"><span class="linenos"> 83</span></a><span class="sd"> evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be</span> +</span><span id="Redshift.Generator-84"><a href="#Redshift.Generator-84"><span class="linenos"> 84</span></a><span class="sd"> very slow.</span> +</span><span id="Redshift.Generator-85"><a href="#Redshift.Generator-85"><span class="linenos"> 85</span></a><span class="sd"> """</span> +</span><span id="Redshift.Generator-86"><a href="#Redshift.Generator-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="Redshift.Generator-87"><a href="#Redshift.Generator-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Redshift.Generator-88"><a href="#Redshift.Generator-88"><span class="linenos"> 88</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">tuple_exp</span><span class="o">.</span><span class="n">expressions</span> <span class="k">for</span> <span class="n">tuple_exp</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">]</span> +</span><span id="Redshift.Generator-89"><a href="#Redshift.Generator-89"><span class="linenos"> 89</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift.Generator-90"><a href="#Redshift.Generator-90"><span class="linenos"> 90</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">rows</span><span class="p">):</span> +</span><span id="Redshift.Generator-91"><a href="#Redshift.Generator-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="Redshift.Generator-92"><a href="#Redshift.Generator-92"><span class="linenos"> 92</span></a> <span class="n">row</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Redshift.Generator-93"><a href="#Redshift.Generator-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="Redshift.Generator-94"><a href="#Redshift.Generator-94"><span class="linenos"> 94</span></a> <span class="k">for</span> <span class="n">value</span><span class="p">,</span> <span class="n">column_name</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"columns"</span><span class="p">])</span> +</span><span id="Redshift.Generator-95"><a href="#Redshift.Generator-95"><span class="linenos"> 95</span></a> <span class="p">]</span> +</span><span id="Redshift.Generator-96"><a href="#Redshift.Generator-96"><span class="linenos"> 96</span></a> <span class="n">selects</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">row</span><span class="p">))</span> +</span><span id="Redshift.Generator-97"><a href="#Redshift.Generator-97"><span class="linenos"> 97</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="Redshift.Generator-98"><a href="#Redshift.Generator-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">selects</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Redshift.Generator-99"><a href="#Redshift.Generator-99"><span class="linenos"> 99</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="Redshift.Generator-100"><a href="#Redshift.Generator-100"><span class="linenos">100</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="n">subquery_expression</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Redshift.Generator-101"><a href="#Redshift.Generator-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_sql</span><span class="p">(</span><span class="n">subquery_expression</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">))</span> +</span><span id="Redshift.Generator-102"><a href="#Redshift.Generator-102"><span class="linenos">102</span></a> +</span><span id="Redshift.Generator-103"><a href="#Redshift.Generator-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-104"><a href="#Redshift.Generator-104"><span class="linenos">104</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="Redshift.Generator-105"><a href="#Redshift.Generator-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Redshift.Generator-106"><a href="#Redshift.Generator-106"><span class="linenos">106</span></a> +</span><span id="Redshift.Generator-107"><a href="#Redshift.Generator-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-108"><a href="#Redshift.Generator-108"><span class="linenos">108</span></a><span class="w"> </span><span class="sd">"""Redshift only supports defining the table name itself (not the db) when renaming tables"""</span> +</span><span id="Redshift.Generator-109"><a href="#Redshift.Generator-109"><span class="linenos">109</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift.Generator-110"><a href="#Redshift.Generator-110"><span class="linenos">110</span></a> <span class="n">target_table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Redshift.Generator-111"><a href="#Redshift.Generator-111"><span class="linenos">111</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">target_table</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Redshift.Generator-112"><a href="#Redshift.Generator-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="n">arg</span> <span class="o">!=</span> <span class="s2">"this"</span><span class="p">:</span> +</span><span id="Redshift.Generator-113"><a href="#Redshift.Generator-113"><span class="linenos">113</span></a> <span class="n">target_table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Redshift.Generator-114"><a href="#Redshift.Generator-114"><span class="linenos">114</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Redshift.Generator-115"><a href="#Redshift.Generator-115"><span class="linenos">115</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Redshift.Generator-116"><a href="#Redshift.Generator-116"><span class="linenos">116</span></a> +</span><span id="Redshift.Generator-117"><a href="#Redshift.Generator-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-118"><a href="#Redshift.Generator-118"><span class="linenos">118</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift.Generator-119"><a href="#Redshift.Generator-119"><span class="linenos">119</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="Redshift.Generator-120"><a href="#Redshift.Generator-120"><span class="linenos">120</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="Redshift.Generator-121"><a href="#Redshift.Generator-121"><span class="linenos">121</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="Redshift.Generator-122"><a href="#Redshift.Generator-122"><span class="linenos">122</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="Redshift.Generator-123"><a href="#Redshift.Generator-123"><span class="linenos">123</span></a><span class="sd"> """</span> +</span><span id="Redshift.Generator-124"><a href="#Redshift.Generator-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="Redshift.Generator-125"><a href="#Redshift.Generator-125"><span class="linenos">125</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift.Generator-126"><a href="#Redshift.Generator-126"><span class="linenos">126</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">)</span> +</span><span id="Redshift.Generator-127"><a href="#Redshift.Generator-127"><span class="linenos">127</span></a> <span class="n">precision</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Redshift.Generator-128"><a href="#Redshift.Generator-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="Redshift.Generator-129"><a href="#Redshift.Generator-129"><span class="linenos">129</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift.Generator-130"><a href="#Redshift.Generator-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Redshift.Generator.values_sql" class="classattr"> + <input id="Redshift.Generator.values_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">values_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Values">sqlglot.expressions.Values</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Redshift.Generator.values_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Generator.values_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.values_sql-78"><a href="#Redshift.Generator.values_sql-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.values_sql-79"><a href="#Redshift.Generator.values_sql-79"><span class="linenos"> 79</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift.Generator.values_sql-80"><a href="#Redshift.Generator.values_sql-80"><span class="linenos"> 80</span></a><span class="sd"> Converts `VALUES...` expression into a series of unions.</span> +</span><span id="Redshift.Generator.values_sql-81"><a href="#Redshift.Generator.values_sql-81"><span class="linenos"> 81</span></a> +</span><span id="Redshift.Generator.values_sql-82"><a href="#Redshift.Generator.values_sql-82"><span class="linenos"> 82</span></a><span class="sd"> Note: If you have a lot of unions then this will result in a large number of recursive statements to</span> +</span><span id="Redshift.Generator.values_sql-83"><a href="#Redshift.Generator.values_sql-83"><span class="linenos"> 83</span></a><span class="sd"> evaluate the expression. You may need to increase `sys.setrecursionlimit` to run and it can also be</span> +</span><span id="Redshift.Generator.values_sql-84"><a href="#Redshift.Generator.values_sql-84"><span class="linenos"> 84</span></a><span class="sd"> very slow.</span> +</span><span id="Redshift.Generator.values_sql-85"><a href="#Redshift.Generator.values_sql-85"><span class="linenos"> 85</span></a><span class="sd"> """</span> +</span><span id="Redshift.Generator.values_sql-86"><a href="#Redshift.Generator.values_sql-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="Redshift.Generator.values_sql-87"><a href="#Redshift.Generator.values_sql-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Redshift.Generator.values_sql-88"><a href="#Redshift.Generator.values_sql-88"><span class="linenos"> 88</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">tuple_exp</span><span class="o">.</span><span class="n">expressions</span> <span class="k">for</span> <span class="n">tuple_exp</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">]</span> +</span><span id="Redshift.Generator.values_sql-89"><a href="#Redshift.Generator.values_sql-89"><span class="linenos"> 89</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift.Generator.values_sql-90"><a href="#Redshift.Generator.values_sql-90"><span class="linenos"> 90</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">rows</span><span class="p">):</span> +</span><span id="Redshift.Generator.values_sql-91"><a href="#Redshift.Generator.values_sql-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="Redshift.Generator.values_sql-92"><a href="#Redshift.Generator.values_sql-92"><span class="linenos"> 92</span></a> <span class="n">row</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Redshift.Generator.values_sql-93"><a href="#Redshift.Generator.values_sql-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="Redshift.Generator.values_sql-94"><a href="#Redshift.Generator.values_sql-94"><span class="linenos"> 94</span></a> <span class="k">for</span> <span class="n">value</span><span class="p">,</span> <span class="n">column_name</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"columns"</span><span class="p">])</span> +</span><span id="Redshift.Generator.values_sql-95"><a href="#Redshift.Generator.values_sql-95"><span class="linenos"> 95</span></a> <span class="p">]</span> +</span><span id="Redshift.Generator.values_sql-96"><a href="#Redshift.Generator.values_sql-96"><span class="linenos"> 96</span></a> <span class="n">selects</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">row</span><span class="p">))</span> +</span><span id="Redshift.Generator.values_sql-97"><a href="#Redshift.Generator.values_sql-97"><span class="linenos"> 97</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="Redshift.Generator.values_sql-98"><a href="#Redshift.Generator.values_sql-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">selects</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Redshift.Generator.values_sql-99"><a href="#Redshift.Generator.values_sql-99"><span class="linenos"> 99</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="Redshift.Generator.values_sql-100"><a href="#Redshift.Generator.values_sql-100"><span class="linenos">100</span></a> <span class="n">subquery_expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="n">subquery_expression</span><span class="p">,</span> <span class="n">select</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Redshift.Generator.values_sql-101"><a href="#Redshift.Generator.values_sql-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_sql</span><span class="p">(</span><span class="n">subquery_expression</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">alias</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Converts <code>VALUES...</code> expression into a series of unions.</p> + +<p>Note: If you have a lot of unions then this will result in a large number of recursive statements to +evaluate the expression. You may need to increase <code>sys.setrecursionlimit</code> to run and it can also be +very slow.</p> +</div> + + + </div> + <div id="Redshift.Generator.with_properties" class="classattr"> + <input id="Redshift.Generator.with_properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">with_properties</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">properties</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Properties">sqlglot.expressions.Properties</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Redshift.Generator.with_properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Generator.with_properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.with_properties-103"><a href="#Redshift.Generator.with_properties-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.with_properties-104"><a href="#Redshift.Generator.with_properties-104"><span class="linenos">104</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="Redshift.Generator.with_properties-105"><a href="#Redshift.Generator.with_properties-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Redshift doesn't have <code>WITH</code> as part of their with_properties so we remove it</p> +</div> + + + </div> + <div id="Redshift.Generator.renametable_sql" class="classattr"> + <input id="Redshift.Generator.renametable_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">renametable_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#RenameTable">sqlglot.expressions.RenameTable</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Redshift.Generator.renametable_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Generator.renametable_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.renametable_sql-107"><a href="#Redshift.Generator.renametable_sql-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.renametable_sql-108"><a href="#Redshift.Generator.renametable_sql-108"><span class="linenos">108</span></a><span class="w"> </span><span class="sd">"""Redshift only supports defining the table name itself (not the db) when renaming tables"""</span> +</span><span id="Redshift.Generator.renametable_sql-109"><a href="#Redshift.Generator.renametable_sql-109"><span class="linenos">109</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift.Generator.renametable_sql-110"><a href="#Redshift.Generator.renametable_sql-110"><span class="linenos">110</span></a> <span class="n">target_table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Redshift.Generator.renametable_sql-111"><a href="#Redshift.Generator.renametable_sql-111"><span class="linenos">111</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">target_table</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Redshift.Generator.renametable_sql-112"><a href="#Redshift.Generator.renametable_sql-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="n">arg</span> <span class="o">!=</span> <span class="s2">"this"</span><span class="p">:</span> +</span><span id="Redshift.Generator.renametable_sql-113"><a href="#Redshift.Generator.renametable_sql-113"><span class="linenos">113</span></a> <span class="n">target_table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Redshift.Generator.renametable_sql-114"><a href="#Redshift.Generator.renametable_sql-114"><span class="linenos">114</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Redshift.Generator.renametable_sql-115"><a href="#Redshift.Generator.renametable_sql-115"><span class="linenos">115</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Redshift only supports defining the table name itself (not the db) when renaming tables</p> +</div> + + + </div> + <div id="Redshift.Generator.datatype_sql" class="classattr"> + <input id="Redshift.Generator.datatype_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">datatype_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#DataType">sqlglot.expressions.DataType</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Redshift.Generator.datatype_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Redshift.Generator.datatype_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.datatype_sql-117"><a href="#Redshift.Generator.datatype_sql-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.datatype_sql-118"><a href="#Redshift.Generator.datatype_sql-118"><span class="linenos">118</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift.Generator.datatype_sql-119"><a href="#Redshift.Generator.datatype_sql-119"><span class="linenos">119</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="Redshift.Generator.datatype_sql-120"><a href="#Redshift.Generator.datatype_sql-120"><span class="linenos">120</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="Redshift.Generator.datatype_sql-121"><a href="#Redshift.Generator.datatype_sql-121"><span class="linenos">121</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="Redshift.Generator.datatype_sql-122"><a href="#Redshift.Generator.datatype_sql-122"><span class="linenos">122</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="Redshift.Generator.datatype_sql-123"><a href="#Redshift.Generator.datatype_sql-123"><span class="linenos">123</span></a><span class="sd"> """</span> +</span><span id="Redshift.Generator.datatype_sql-124"><a href="#Redshift.Generator.datatype_sql-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="Redshift.Generator.datatype_sql-125"><a href="#Redshift.Generator.datatype_sql-125"><span class="linenos">125</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift.Generator.datatype_sql-126"><a href="#Redshift.Generator.datatype_sql-126"><span class="linenos">126</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">)</span> +</span><span id="Redshift.Generator.datatype_sql-127"><a href="#Redshift.Generator.datatype_sql-127"><span class="linenos">127</span></a> <span class="n">precision</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Redshift.Generator.datatype_sql-128"><a href="#Redshift.Generator.datatype_sql-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="Redshift.Generator.datatype_sql-129"><a href="#Redshift.Generator.datatype_sql-129"><span class="linenos">129</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift.Generator.datatype_sql-130"><a href="#Redshift.Generator.datatype_sql-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Redshift converts the <code>TEXT</code> data type to <code>VARCHAR(255)</code> by default when people more generally mean +VARCHAR of max length which is <code>VARCHAR(max)</code> in Redshift. Therefore if we get a <code>TEXT</code> data type +without precision we convert it to <code>VARCHAR(max)</code> and if it does have precision then we just convert +<code>TEXT</code> to <code>VARCHAR</code>.</p> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Redshift.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Redshift.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Redshift.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Redshift.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Redshift.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Redshift.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Redshift.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Redshift.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Redshift.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Redshift.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Redshift.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Redshift.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Redshift.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Redshift.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Redshift.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Redshift.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Redshift.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Redshift.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Redshift.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Redshift.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Redshift.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Redshift.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Redshift.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Redshift.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Redshift.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Redshift.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Redshift.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Redshift.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Redshift.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Redshift.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Redshift.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Redshift.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Redshift.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Redshift.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Redshift.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Redshift.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Redshift.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Redshift.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Redshift.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Redshift.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Redshift.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Redshift.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Redshift.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Redshift.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Redshift.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Redshift.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Redshift.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Redshift.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Redshift.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Redshift.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Redshift.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Redshift.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Redshift.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Redshift.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Redshift.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Redshift.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Redshift.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Redshift.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Redshift.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Redshift.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Redshift.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Redshift.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Redshift.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Redshift.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Redshift.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Redshift.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Redshift.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Redshift.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Redshift.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Redshift.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Redshift.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Redshift.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Redshift.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Redshift.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Redshift.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Redshift.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Redshift.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Redshift.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Redshift.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Redshift.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Redshift.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Redshift.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Redshift.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Redshift.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Redshift.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Redshift.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Redshift.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Redshift.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Redshift.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Redshift.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Redshift.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Redshift.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Redshift.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Redshift.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Redshift.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Redshift.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Redshift.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Redshift.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Redshift.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Redshift.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Redshift.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Redshift.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Redshift.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Redshift.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Redshift.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Redshift.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Redshift.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Redshift.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Redshift.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Redshift.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Redshift.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Redshift.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Redshift.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Redshift.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Redshift.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Redshift.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Redshift.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Redshift.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Redshift.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Redshift.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Redshift.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Redshift.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Redshift.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Redshift.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Redshift.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Redshift.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Redshift.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Redshift.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Redshift.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Redshift.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Redshift.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Redshift.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Redshift.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Redshift.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Redshift.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Redshift.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Redshift.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Redshift.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Redshift.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Redshift.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Redshift.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Redshift.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Redshift.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Redshift.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Redshift.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Redshift.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Redshift.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Redshift.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Redshift.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Redshift.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Redshift.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Redshift.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Redshift.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Redshift.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Redshift.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Redshift.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Redshift.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Redshift.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Redshift.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Redshift.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Redshift.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Redshift.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Redshift.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Redshift.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Redshift.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Redshift.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Redshift.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Redshift.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Redshift.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Redshift.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Redshift.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Redshift.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Redshift.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Redshift.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Redshift.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Redshift.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Redshift.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Redshift.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Redshift.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Redshift.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Redshift.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Redshift.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Redshift.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Redshift.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Redshift.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Redshift.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Redshift.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Redshift.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Redshift.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Redshift.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Redshift.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Redshift.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Redshift.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Redshift.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Redshift.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Redshift.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Redshift.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/snowflake.html b/docs/sqlglot/dialects/snowflake.html new file mode 100644 index 0000000..c39b31e --- /dev/null +++ b/docs/sqlglot/dialects/snowflake.html @@ -0,0 +1,1528 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.snowflake API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Snowflake">Snowflake</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Snowflake.__init__">Snowflake</a> + </li> + <li> + <a class="class" href="#Snowflake.Parser">Snowflake.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Snowflake.Tokenizer">Snowflake.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Snowflake.Generator">Snowflake.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Snowflake.Generator.except_op">except_op</a> + </li> + <li> + <a class="function" href="#Snowflake.Generator.intersect_op">intersect_op</a> + </li> + <li> + <a class="function" href="#Snowflake.Generator.values_sql">values_sql</a> + </li> + <li> + <a class="function" href="#Snowflake.Generator.select_sql">select_sql</a> + </li> + <li> + <a class="function" href="#Snowflake.Generator.describe_sql">describe_sql</a> + </li> + <li> + <a class="function" href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/snowflake.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.snowflake </h1> + + + <input id="mod-snowflake-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-snowflake-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">format_time_lambda</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">var_map_sql</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="p">)</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">Literal</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">flatten</span><span class="p">,</span> <span class="n">seq_get</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="k">def</span> <span class="nf">_check_int</span><span class="p">(</span><span class="n">s</span><span class="p">):</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="k">if</span> <span class="n">s</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"-"</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">):</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="k">return</span> <span class="n">s</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span><span class="o">.</span><span class="n">isdigit</span><span class="p">()</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">return</span> <span class="n">s</span><span class="o">.</span><span class="n">isdigit</span><span class="p">()</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="c1"># from https://docs.snowflake.com/en/sql-reference/functions/to_timestamp.html</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="k">def</span> <span class="nf">_snowflake_to_timestamp</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">first_arg</span><span class="p">,</span> <span class="n">second_arg</span> <span class="o">=</span> <span class="n">args</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">if</span> <span class="n">second_arg</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="c1"># case: <string_expr> [ , <format> ]</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"snowflake"</span><span class="p">)(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="c1"># case: <numeric_expr> [ , <scale> ]</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="k">if</span> <span class="n">second_arg</span><span class="o">.</span><span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"0"</span><span class="p">,</span> <span class="s2">"3"</span><span class="p">,</span> <span class="s2">"9"</span><span class="p">]:</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="sa">f</span><span class="s2">"Scale for snowflake numeric timestamp is </span><span class="si">{</span><span class="n">second_arg</span><span class="si">}</span><span class="s2">, but should be 0, 3, or 9"</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">if</span> <span class="n">second_arg</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"0"</span><span class="p">:</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">timescale</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">SECONDS</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="k">elif</span> <span class="n">second_arg</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"3"</span><span class="p">:</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">timescale</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MILLIS</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">elif</span> <span class="n">second_arg</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s2">"9"</span><span class="p">:</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">timescale</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MICROS</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">first_arg</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="n">timescale</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">first_arg</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">first_arg</span><span class="p">,</span> <span class="n">Literal</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="c1"># case: <variant_expr></span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"snowflake"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">True</span><span class="p">)(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">if</span> <span class="n">first_arg</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="k">if</span> <span class="n">_check_int</span><span class="p">(</span><span class="n">first_arg</span><span class="o">.</span><span class="n">this</span><span class="p">):</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="c1"># case: <integer></span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="c1"># case: <date_expr></span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="s2">"snowflake"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">True</span><span class="p">)(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="c1"># case: <numeric_expr></span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a><span class="k">def</span> <span class="nf">_unix_to_time_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">scale</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"scale"</span><span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">timestamp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="ow">in</span> <span class="p">[</span><span class="kc">None</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">SECONDS</span><span class="p">]:</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MILLIS</span><span class="p">:</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">, 3)"</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MICROS</span><span class="p">:</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">, 9)"</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Improper scale for timestamp"</span><span class="p">)</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="c1"># https://docs.snowflake.com/en/sql-reference/functions/date_part.html</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="c1"># https://docs.snowflake.com/en/sql-reference/functions-date-time.html#label-supported-date-time-parts</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="k">def</span> <span class="nf">_parse_date_part</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_type</span><span class="p">()</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"EPOCH"</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"EPOCH_MILLISECOND"</span><span class="p">):</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">scale</span> <span class="o">=</span> <span class="mi">10</span><span class="o">**</span><span class="mi">3</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">elif</span> <span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"EPOCH_MICROSECOND"</span><span class="p">):</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">scale</span> <span class="o">=</span> <span class="mi">10</span><span class="o">**</span><span class="mi">6</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">elif</span> <span class="n">name</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"EPOCH_NANOSECOND"</span><span class="p">):</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">scale</span> <span class="o">=</span> <span class="mi">10</span><span class="o">**</span><span class="mi">9</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">scale</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">ts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">))</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">to_unix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">ts</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="n">scale</span><span class="p">:</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">to_unix</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_unix</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">scale</span><span class="p">))</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="n">to_unix</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a><span class="k">def</span> <span class="nf">_datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="s2">"ARRAY"</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MAP</span><span class="p">:</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">return</span> <span class="s2">"OBJECT"</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a><span class="k">class</span> <span class="nc">Snowflake</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_large"</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-mm-dd hh24:mi:ss'"</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="s2">"mmmm"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="s2">"mon"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="s2">"DY"</span><span class="p">:</span> <span class="s2">"%w"</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="s2">"dy"</span><span class="p">:</span> <span class="s2">"%w"</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="s2">"HH24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="s2">"hh24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="s2">"HH12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="s2">"hh12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="s2">"MI"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="s2">"mi"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="s2">"SS"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="s2">"FF"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="s2">"ff"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="s2">"FF6"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"ff6"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="p">}</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"ARRAYAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"IFF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">_snowflake_to_timestamp</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"ARRAY_CONSTRUCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="s2">"RLIKE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">:</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="p">}</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"DATE_PART"</span><span class="p">:</span> <span class="n">_parse_date_part</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="p">}</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="p">}</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">COLUMN_OPERATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">,</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">path</span><span class="p">],</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="p">),</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="p">}</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"$$"</span><span class="p">]</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"$"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="p">}</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="s2">"EXCLUDE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="s2">"PUT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="s2">"RENAME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="s2">"TIMESTAMP_LTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="s2">"TIMESTAMP_NTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="s2">"TIMESTAMP_TZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="s2">"TIMESTAMPNTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="s2">"MINUS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="s2">"SAMPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">,</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="p">}</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">CREATE_TRANSIENT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_CAT"</span><span class="p">),</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IFF"</span><span class="p">),</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">),</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">),</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"$</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'POSITION'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'substr'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EXTRACT(epoch_second FROM </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFWEEK"</span><span class="p">),</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="p">}</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="s2">"TIMESTAMPNTZ"</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="p">}</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="n">STAR_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"except"</span><span class="p">:</span> <span class="s2">"EXCLUDE"</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="s2">"RENAME"</span><span class="p">,</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="p">}</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted.</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a><span class="sd"> We also want to make sure that after we find matches where we need to unquote a column that we prevent users</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a><span class="sd"> from adding quotes to the column by using the `identify` argument when generating the SQL.</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a><span class="sd"> """</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">):</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">==</span> <span class="s2">"columns"</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="p">)</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted and also</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a><span class="sd"> that all columns in a SELECT are unquoted. We also want to make sure that after we find matches where we need</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a><span class="sd"> to unquote a column that we prevent users from adding quotes to the column by using the `identify` argument when</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a><span class="sd"> generating the SQL.</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a><span class="sd"> Note: We make an assumption that any columns referenced in a VALUES expression should be unquoted throughout the</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a><span class="sd"> expression. This might not be true in a case where the same column name can be sourced from another table that can</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a><span class="sd"> properly quote but should be true in most cases.</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a><span class="sd"> """</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">values_expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">values_identifiers</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">flatten</span><span class="p">(</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="n">v</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">values_expressions</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="p">)</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="p">)</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">if</span> <span class="n">values_identifiers</span><span class="p">:</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">values_identifiers</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="p">)</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="c1"># Default to table if kind is unknown</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="n">kind_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"TABLE"</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind_value</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind_value</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" START </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INCREMENT </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"AUTOINCREMENT</span><span class="si">{</span><span class="n">start</span><span class="si">}{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + </section> + <section id="Snowflake"> + <input id="Snowflake-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Snowflake</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Snowflake-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake-115"><a href="#Snowflake-115"><span class="linenos">115</span></a><span class="k">class</span> <span class="nc">Snowflake</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Snowflake-116"><a href="#Snowflake-116"><span class="linenos">116</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_large"</span> +</span><span id="Snowflake-117"><a href="#Snowflake-117"><span class="linenos">117</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-mm-dd hh24:mi:ss'"</span> +</span><span id="Snowflake-118"><a href="#Snowflake-118"><span class="linenos">118</span></a> +</span><span id="Snowflake-119"><a href="#Snowflake-119"><span class="linenos">119</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-120"><a href="#Snowflake-120"><span class="linenos">120</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Snowflake-121"><a href="#Snowflake-121"><span class="linenos">121</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="Snowflake-122"><a href="#Snowflake-122"><span class="linenos">122</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="Snowflake-123"><a href="#Snowflake-123"><span class="linenos">123</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="Snowflake-124"><a href="#Snowflake-124"><span class="linenos">124</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="Snowflake-125"><a href="#Snowflake-125"><span class="linenos">125</span></a> <span class="s2">"mmmm"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="Snowflake-126"><a href="#Snowflake-126"><span class="linenos">126</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="Snowflake-127"><a href="#Snowflake-127"><span class="linenos">127</span></a> <span class="s2">"mon"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="Snowflake-128"><a href="#Snowflake-128"><span class="linenos">128</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="Snowflake-129"><a href="#Snowflake-129"><span class="linenos">129</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="Snowflake-130"><a href="#Snowflake-130"><span class="linenos">130</span></a> <span class="s2">"DD"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-131"><a href="#Snowflake-131"><span class="linenos">131</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-132"><a href="#Snowflake-132"><span class="linenos">132</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-133"><a href="#Snowflake-133"><span class="linenos">133</span></a> <span class="s2">"DY"</span><span class="p">:</span> <span class="s2">"%w"</span><span class="p">,</span> +</span><span id="Snowflake-134"><a href="#Snowflake-134"><span class="linenos">134</span></a> <span class="s2">"dy"</span><span class="p">:</span> <span class="s2">"%w"</span><span class="p">,</span> +</span><span id="Snowflake-135"><a href="#Snowflake-135"><span class="linenos">135</span></a> <span class="s2">"HH24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="Snowflake-136"><a href="#Snowflake-136"><span class="linenos">136</span></a> <span class="s2">"hh24"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="Snowflake-137"><a href="#Snowflake-137"><span class="linenos">137</span></a> <span class="s2">"HH12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="Snowflake-138"><a href="#Snowflake-138"><span class="linenos">138</span></a> <span class="s2">"hh12"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="Snowflake-139"><a href="#Snowflake-139"><span class="linenos">139</span></a> <span class="s2">"MI"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="Snowflake-140"><a href="#Snowflake-140"><span class="linenos">140</span></a> <span class="s2">"mi"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="Snowflake-141"><a href="#Snowflake-141"><span class="linenos">141</span></a> <span class="s2">"SS"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="Snowflake-142"><a href="#Snowflake-142"><span class="linenos">142</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="Snowflake-143"><a href="#Snowflake-143"><span class="linenos">143</span></a> <span class="s2">"FF"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-144"><a href="#Snowflake-144"><span class="linenos">144</span></a> <span class="s2">"ff"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-145"><a href="#Snowflake-145"><span class="linenos">145</span></a> <span class="s2">"FF6"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-146"><a href="#Snowflake-146"><span class="linenos">146</span></a> <span class="s2">"ff6"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-147"><a href="#Snowflake-147"><span class="linenos">147</span></a> <span class="p">}</span> +</span><span id="Snowflake-148"><a href="#Snowflake-148"><span class="linenos">148</span></a> +</span><span id="Snowflake-149"><a href="#Snowflake-149"><span class="linenos">149</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Snowflake-150"><a href="#Snowflake-150"><span class="linenos">150</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-151"><a href="#Snowflake-151"><span class="linenos">151</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Snowflake-152"><a href="#Snowflake-152"><span class="linenos">152</span></a> <span class="s2">"ARRAYAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake-153"><a href="#Snowflake-153"><span class="linenos">153</span></a> <span class="s2">"IFF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake-154"><a href="#Snowflake-154"><span class="linenos">154</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">_snowflake_to_timestamp</span><span class="p">,</span> +</span><span id="Snowflake-155"><a href="#Snowflake-155"><span class="linenos">155</span></a> <span class="s2">"ARRAY_CONSTRUCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake-156"><a href="#Snowflake-156"><span class="linenos">156</span></a> <span class="s2">"RLIKE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake-157"><a href="#Snowflake-157"><span class="linenos">157</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake-158"><a href="#Snowflake-158"><span class="linenos">158</span></a> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">:</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="Snowflake-159"><a href="#Snowflake-159"><span class="linenos">159</span></a> <span class="p">}</span> +</span><span id="Snowflake-160"><a href="#Snowflake-160"><span class="linenos">160</span></a> +</span><span id="Snowflake-161"><a href="#Snowflake-161"><span class="linenos">161</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-162"><a href="#Snowflake-162"><span class="linenos">162</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> +</span><span id="Snowflake-163"><a href="#Snowflake-163"><span class="linenos">163</span></a> <span class="s2">"DATE_PART"</span><span class="p">:</span> <span class="n">_parse_date_part</span><span class="p">,</span> +</span><span id="Snowflake-164"><a href="#Snowflake-164"><span class="linenos">164</span></a> <span class="p">}</span> +</span><span id="Snowflake-165"><a href="#Snowflake-165"><span class="linenos">165</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="Snowflake-166"><a href="#Snowflake-166"><span class="linenos">166</span></a> +</span><span id="Snowflake-167"><a href="#Snowflake-167"><span class="linenos">167</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-168"><a href="#Snowflake-168"><span class="linenos">168</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">,</span> +</span><span id="Snowflake-169"><a href="#Snowflake-169"><span class="linenos">169</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="Snowflake-170"><a href="#Snowflake-170"><span class="linenos">170</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Snowflake-171"><a href="#Snowflake-171"><span class="linenos">171</span></a> <span class="p">}</span> +</span><span id="Snowflake-172"><a href="#Snowflake-172"><span class="linenos">172</span></a> +</span><span id="Snowflake-173"><a href="#Snowflake-173"><span class="linenos">173</span></a> <span class="n">COLUMN_OPERATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-174"><a href="#Snowflake-174"><span class="linenos">174</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Snowflake-175"><a href="#Snowflake-175"><span class="linenos">175</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Snowflake-176"><a href="#Snowflake-176"><span class="linenos">176</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">,</span> +</span><span id="Snowflake-177"><a href="#Snowflake-177"><span class="linenos">177</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Snowflake-178"><a href="#Snowflake-178"><span class="linenos">178</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">path</span><span class="p">],</span> +</span><span id="Snowflake-179"><a href="#Snowflake-179"><span class="linenos">179</span></a> <span class="p">),</span> +</span><span id="Snowflake-180"><a href="#Snowflake-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span><span id="Snowflake-181"><a href="#Snowflake-181"><span class="linenos">181</span></a> +</span><span id="Snowflake-182"><a href="#Snowflake-182"><span class="linenos">182</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Snowflake-183"><a href="#Snowflake-183"><span class="linenos">183</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"$$"</span><span class="p">]</span> +</span><span id="Snowflake-184"><a href="#Snowflake-184"><span class="linenos">184</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> +</span><span id="Snowflake-185"><a href="#Snowflake-185"><span class="linenos">185</span></a> +</span><span id="Snowflake-186"><a href="#Snowflake-186"><span class="linenos">186</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-187"><a href="#Snowflake-187"><span class="linenos">187</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">,</span> +</span><span id="Snowflake-188"><a href="#Snowflake-188"><span class="linenos">188</span></a> <span class="s2">"$"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="Snowflake-189"><a href="#Snowflake-189"><span class="linenos">189</span></a> <span class="p">}</span> +</span><span id="Snowflake-190"><a href="#Snowflake-190"><span class="linenos">190</span></a> +</span><span id="Snowflake-191"><a href="#Snowflake-191"><span class="linenos">191</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-192"><a href="#Snowflake-192"><span class="linenos">192</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Snowflake-193"><a href="#Snowflake-193"><span class="linenos">193</span></a> <span class="s2">"EXCLUDE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Snowflake-194"><a href="#Snowflake-194"><span class="linenos">194</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="Snowflake-195"><a href="#Snowflake-195"><span class="linenos">195</span></a> <span class="s2">"PUT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Snowflake-196"><a href="#Snowflake-196"><span class="linenos">196</span></a> <span class="s2">"RENAME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="Snowflake-197"><a href="#Snowflake-197"><span class="linenos">197</span></a> <span class="s2">"TIMESTAMP_LTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="Snowflake-198"><a href="#Snowflake-198"><span class="linenos">198</span></a> <span class="s2">"TIMESTAMP_NTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Snowflake-199"><a href="#Snowflake-199"><span class="linenos">199</span></a> <span class="s2">"TIMESTAMP_TZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Snowflake-200"><a href="#Snowflake-200"><span class="linenos">200</span></a> <span class="s2">"TIMESTAMPNTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Snowflake-201"><a href="#Snowflake-201"><span class="linenos">201</span></a> <span class="s2">"MINUS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Snowflake-202"><a href="#Snowflake-202"><span class="linenos">202</span></a> <span class="s2">"SAMPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">,</span> +</span><span id="Snowflake-203"><a href="#Snowflake-203"><span class="linenos">203</span></a> <span class="p">}</span> +</span><span id="Snowflake-204"><a href="#Snowflake-204"><span class="linenos">204</span></a> +</span><span id="Snowflake-205"><a href="#Snowflake-205"><span class="linenos">205</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Snowflake-206"><a href="#Snowflake-206"><span class="linenos">206</span></a> <span class="n">CREATE_TRANSIENT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Snowflake-207"><a href="#Snowflake-207"><span class="linenos">207</span></a> +</span><span id="Snowflake-208"><a href="#Snowflake-208"><span class="linenos">208</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-209"><a href="#Snowflake-209"><span class="linenos">209</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Snowflake-210"><a href="#Snowflake-210"><span class="linenos">210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="Snowflake-211"><a href="#Snowflake-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_CAT"</span><span class="p">),</span> +</span><span id="Snowflake-212"><a href="#Snowflake-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="Snowflake-213"><a href="#Snowflake-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="Snowflake-214"><a href="#Snowflake-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="Snowflake-215"><a href="#Snowflake-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IFF"</span><span class="p">),</span> +</span><span id="Snowflake-216"><a href="#Snowflake-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">),</span> +</span><span id="Snowflake-217"><a href="#Snowflake-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">),</span> +</span><span id="Snowflake-218"><a href="#Snowflake-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"$</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-219"><a href="#Snowflake-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake-220"><a href="#Snowflake-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="Snowflake-221"><a href="#Snowflake-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'POSITION'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'substr'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake-222"><a href="#Snowflake-222"><span class="linenos">222</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake-223"><a href="#Snowflake-223"><span class="linenos">223</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Snowflake-224"><a href="#Snowflake-224"><span class="linenos">224</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EXTRACT(epoch_second FROM </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake-225"><a href="#Snowflake-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake-226"><a href="#Snowflake-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> +</span><span id="Snowflake-227"><a href="#Snowflake-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFWEEK"</span><span class="p">),</span> +</span><span id="Snowflake-228"><a href="#Snowflake-228"><span class="linenos">228</span></a> <span class="p">}</span> +</span><span id="Snowflake-229"><a href="#Snowflake-229"><span class="linenos">229</span></a> +</span><span id="Snowflake-230"><a href="#Snowflake-230"><span class="linenos">230</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-231"><a href="#Snowflake-231"><span class="linenos">231</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Snowflake-232"><a href="#Snowflake-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="s2">"TIMESTAMPNTZ"</span><span class="p">,</span> +</span><span id="Snowflake-233"><a href="#Snowflake-233"><span class="linenos">233</span></a> <span class="p">}</span> +</span><span id="Snowflake-234"><a href="#Snowflake-234"><span class="linenos">234</span></a> +</span><span id="Snowflake-235"><a href="#Snowflake-235"><span class="linenos">235</span></a> <span class="n">STAR_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake-236"><a href="#Snowflake-236"><span class="linenos">236</span></a> <span class="s2">"except"</span><span class="p">:</span> <span class="s2">"EXCLUDE"</span><span class="p">,</span> +</span><span id="Snowflake-237"><a href="#Snowflake-237"><span class="linenos">237</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="s2">"RENAME"</span><span class="p">,</span> +</span><span id="Snowflake-238"><a href="#Snowflake-238"><span class="linenos">238</span></a> <span class="p">}</span> +</span><span id="Snowflake-239"><a href="#Snowflake-239"><span class="linenos">239</span></a> +</span><span id="Snowflake-240"><a href="#Snowflake-240"><span class="linenos">240</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Snowflake-241"><a href="#Snowflake-241"><span class="linenos">241</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="Snowflake-242"><a href="#Snowflake-242"><span class="linenos">242</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="Snowflake-243"><a href="#Snowflake-243"><span class="linenos">243</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake-244"><a href="#Snowflake-244"><span class="linenos">244</span></a> +</span><span id="Snowflake-245"><a href="#Snowflake-245"><span class="linenos">245</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Snowflake-246"><a href="#Snowflake-246"><span class="linenos">246</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="Snowflake-247"><a href="#Snowflake-247"><span class="linenos">247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="Snowflake-248"><a href="#Snowflake-248"><span class="linenos">248</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake-249"><a href="#Snowflake-249"><span class="linenos">249</span></a> +</span><span id="Snowflake-250"><a href="#Snowflake-250"><span class="linenos">250</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake-251"><a href="#Snowflake-251"><span class="linenos">251</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted.</span> +</span><span id="Snowflake-252"><a href="#Snowflake-252"><span class="linenos">252</span></a> +</span><span id="Snowflake-253"><a href="#Snowflake-253"><span class="linenos">253</span></a><span class="sd"> We also want to make sure that after we find matches where we need to unquote a column that we prevent users</span> +</span><span id="Snowflake-254"><a href="#Snowflake-254"><span class="linenos">254</span></a><span class="sd"> from adding quotes to the column by using the `identify` argument when generating the SQL.</span> +</span><span id="Snowflake-255"><a href="#Snowflake-255"><span class="linenos">255</span></a><span class="sd"> """</span> +</span><span id="Snowflake-256"><a href="#Snowflake-256"><span class="linenos">256</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Snowflake-257"><a href="#Snowflake-257"><span class="linenos">257</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">):</span> +</span><span id="Snowflake-258"><a href="#Snowflake-258"><span class="linenos">258</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Snowflake-259"><a href="#Snowflake-259"><span class="linenos">259</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="Snowflake-260"><a href="#Snowflake-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="Snowflake-261"><a href="#Snowflake-261"><span class="linenos">261</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> +</span><span id="Snowflake-262"><a href="#Snowflake-262"><span class="linenos">262</span></a> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">==</span> <span class="s2">"columns"</span> +</span><span id="Snowflake-263"><a href="#Snowflake-263"><span class="linenos">263</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="Snowflake-264"><a href="#Snowflake-264"><span class="linenos">264</span></a> <span class="p">)</span> +</span><span id="Snowflake-265"><a href="#Snowflake-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Snowflake-266"><a href="#Snowflake-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake-267"><a href="#Snowflake-267"><span class="linenos">267</span></a> +</span><span id="Snowflake-268"><a href="#Snowflake-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake-269"><a href="#Snowflake-269"><span class="linenos">269</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted and also</span> +</span><span id="Snowflake-270"><a href="#Snowflake-270"><span class="linenos">270</span></a><span class="sd"> that all columns in a SELECT are unquoted. We also want to make sure that after we find matches where we need</span> +</span><span id="Snowflake-271"><a href="#Snowflake-271"><span class="linenos">271</span></a><span class="sd"> to unquote a column that we prevent users from adding quotes to the column by using the `identify` argument when</span> +</span><span id="Snowflake-272"><a href="#Snowflake-272"><span class="linenos">272</span></a><span class="sd"> generating the SQL.</span> +</span><span id="Snowflake-273"><a href="#Snowflake-273"><span class="linenos">273</span></a> +</span><span id="Snowflake-274"><a href="#Snowflake-274"><span class="linenos">274</span></a><span class="sd"> Note: We make an assumption that any columns referenced in a VALUES expression should be unquoted throughout the</span> +</span><span id="Snowflake-275"><a href="#Snowflake-275"><span class="linenos">275</span></a><span class="sd"> expression. This might not be true in a case where the same column name can be sourced from another table that can</span> +</span><span id="Snowflake-276"><a href="#Snowflake-276"><span class="linenos">276</span></a><span class="sd"> properly quote but should be true in most cases.</span> +</span><span id="Snowflake-277"><a href="#Snowflake-277"><span class="linenos">277</span></a><span class="sd"> """</span> +</span><span id="Snowflake-278"><a href="#Snowflake-278"><span class="linenos">278</span></a> <span class="n">values_expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> +</span><span id="Snowflake-279"><a href="#Snowflake-279"><span class="linenos">279</span></a> <span class="n">values_identifiers</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span> +</span><span id="Snowflake-280"><a href="#Snowflake-280"><span class="linenos">280</span></a> <span class="n">flatten</span><span class="p">(</span> +</span><span id="Snowflake-281"><a href="#Snowflake-281"><span class="linenos">281</span></a> <span class="n">v</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="Snowflake-282"><a href="#Snowflake-282"><span class="linenos">282</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">values_expressions</span> +</span><span id="Snowflake-283"><a href="#Snowflake-283"><span class="linenos">283</span></a> <span class="p">)</span> +</span><span id="Snowflake-284"><a href="#Snowflake-284"><span class="linenos">284</span></a> <span class="p">)</span> +</span><span id="Snowflake-285"><a href="#Snowflake-285"><span class="linenos">285</span></a> <span class="k">if</span> <span class="n">values_identifiers</span><span class="p">:</span> +</span><span id="Snowflake-286"><a href="#Snowflake-286"><span class="linenos">286</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Snowflake-287"><a href="#Snowflake-287"><span class="linenos">287</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="Snowflake-288"><a href="#Snowflake-288"><span class="linenos">288</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">values_identifiers</span> +</span><span id="Snowflake-289"><a href="#Snowflake-289"><span class="linenos">289</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="Snowflake-290"><a href="#Snowflake-290"><span class="linenos">290</span></a> <span class="p">)</span> +</span><span id="Snowflake-291"><a href="#Snowflake-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Snowflake-292"><a href="#Snowflake-292"><span class="linenos">292</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake-293"><a href="#Snowflake-293"><span class="linenos">293</span></a> +</span><span id="Snowflake-294"><a href="#Snowflake-294"><span class="linenos">294</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake-295"><a href="#Snowflake-295"><span class="linenos">295</span></a> <span class="c1"># Default to table if kind is unknown</span> +</span><span id="Snowflake-296"><a href="#Snowflake-296"><span class="linenos">296</span></a> <span class="n">kind_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"TABLE"</span> +</span><span id="Snowflake-297"><a href="#Snowflake-297"><span class="linenos">297</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind_value</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind_value</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake-298"><a href="#Snowflake-298"><span class="linenos">298</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Snowflake-299"><a href="#Snowflake-299"><span class="linenos">299</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Snowflake-300"><a href="#Snowflake-300"><span class="linenos">300</span></a> +</span><span id="Snowflake-301"><a href="#Snowflake-301"><span class="linenos">301</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="Snowflake-302"><a href="#Snowflake-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="Snowflake-303"><a href="#Snowflake-303"><span class="linenos">303</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake-304"><a href="#Snowflake-304"><span class="linenos">304</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="Snowflake-305"><a href="#Snowflake-305"><span class="linenos">305</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" START </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake-306"><a href="#Snowflake-306"><span class="linenos">306</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="Snowflake-307"><a href="#Snowflake-307"><span class="linenos">307</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INCREMENT </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake-308"><a href="#Snowflake-308"><span class="linenos">308</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"AUTOINCREMENT</span><span class="si">{</span><span class="n">start</span><span class="si">}{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + <div id="Snowflake.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Snowflake</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Snowflake.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Snowflake.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Snowflake.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Snowflake.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Snowflake.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Snowflake.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Snowflake.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Snowflake.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Snowflake.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Snowflake.Parser"> + <input id="Snowflake.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Snowflake.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Snowflake.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Parser-149"><a href="#Snowflake.Parser-149"><span class="linenos">149</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Snowflake.Parser-150"><a href="#Snowflake.Parser-150"><span class="linenos">150</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Parser-151"><a href="#Snowflake.Parser-151"><span class="linenos">151</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Snowflake.Parser-152"><a href="#Snowflake.Parser-152"><span class="linenos">152</span></a> <span class="s2">"ARRAYAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake.Parser-153"><a href="#Snowflake.Parser-153"><span class="linenos">153</span></a> <span class="s2">"IFF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake.Parser-154"><a href="#Snowflake.Parser-154"><span class="linenos">154</span></a> <span class="s2">"TO_TIMESTAMP"</span><span class="p">:</span> <span class="n">_snowflake_to_timestamp</span><span class="p">,</span> +</span><span id="Snowflake.Parser-155"><a href="#Snowflake.Parser-155"><span class="linenos">155</span></a> <span class="s2">"ARRAY_CONSTRUCT"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake.Parser-156"><a href="#Snowflake.Parser-156"><span class="linenos">156</span></a> <span class="s2">"RLIKE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake.Parser-157"><a href="#Snowflake.Parser-157"><span class="linenos">157</span></a> <span class="s2">"DECODE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Snowflake.Parser-158"><a href="#Snowflake.Parser-158"><span class="linenos">158</span></a> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">:</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="Snowflake.Parser-159"><a href="#Snowflake.Parser-159"><span class="linenos">159</span></a> <span class="p">}</span> +</span><span id="Snowflake.Parser-160"><a href="#Snowflake.Parser-160"><span class="linenos">160</span></a> +</span><span id="Snowflake.Parser-161"><a href="#Snowflake.Parser-161"><span class="linenos">161</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Parser-162"><a href="#Snowflake.Parser-162"><span class="linenos">162</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> +</span><span id="Snowflake.Parser-163"><a href="#Snowflake.Parser-163"><span class="linenos">163</span></a> <span class="s2">"DATE_PART"</span><span class="p">:</span> <span class="n">_parse_date_part</span><span class="p">,</span> +</span><span id="Snowflake.Parser-164"><a href="#Snowflake.Parser-164"><span class="linenos">164</span></a> <span class="p">}</span> +</span><span id="Snowflake.Parser-165"><a href="#Snowflake.Parser-165"><span class="linenos">165</span></a> <span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"TRIM"</span><span class="p">)</span> +</span><span id="Snowflake.Parser-166"><a href="#Snowflake.Parser-166"><span class="linenos">166</span></a> +</span><span id="Snowflake.Parser-167"><a href="#Snowflake.Parser-167"><span class="linenos">167</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Parser-168"><a href="#Snowflake.Parser-168"><span class="linenos">168</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">,</span> +</span><span id="Snowflake.Parser-169"><a href="#Snowflake.Parser-169"><span class="linenos">169</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="Snowflake.Parser-170"><a href="#Snowflake.Parser-170"><span class="linenos">170</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Snowflake.Parser-171"><a href="#Snowflake.Parser-171"><span class="linenos">171</span></a> <span class="p">}</span> +</span><span id="Snowflake.Parser-172"><a href="#Snowflake.Parser-172"><span class="linenos">172</span></a> +</span><span id="Snowflake.Parser-173"><a href="#Snowflake.Parser-173"><span class="linenos">173</span></a> <span class="n">COLUMN_OPERATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Parser-174"><a href="#Snowflake.Parser-174"><span class="linenos">174</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Snowflake.Parser-175"><a href="#Snowflake.Parser-175"><span class="linenos">175</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Snowflake.Parser-176"><a href="#Snowflake.Parser-176"><span class="linenos">176</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">,</span> +</span><span id="Snowflake.Parser-177"><a href="#Snowflake.Parser-177"><span class="linenos">177</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Snowflake.Parser-178"><a href="#Snowflake.Parser-178"><span class="linenos">178</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">path</span><span class="p">],</span> +</span><span id="Snowflake.Parser-179"><a href="#Snowflake.Parser-179"><span class="linenos">179</span></a> <span class="p">),</span> +</span><span id="Snowflake.Parser-180"><a href="#Snowflake.Parser-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Snowflake.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Snowflake.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Snowflake.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Snowflake.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Snowflake.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Snowflake.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Snowflake.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Snowflake.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Snowflake.Tokenizer"> + <input id="Snowflake.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Snowflake.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Snowflake.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Tokenizer-182"><a href="#Snowflake.Tokenizer-182"><span class="linenos">182</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Snowflake.Tokenizer-183"><a href="#Snowflake.Tokenizer-183"><span class="linenos">183</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s2">"$$"</span><span class="p">]</span> +</span><span id="Snowflake.Tokenizer-184"><a href="#Snowflake.Tokenizer-184"><span class="linenos">184</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> +</span><span id="Snowflake.Tokenizer-185"><a href="#Snowflake.Tokenizer-185"><span class="linenos">185</span></a> +</span><span id="Snowflake.Tokenizer-186"><a href="#Snowflake.Tokenizer-186"><span class="linenos">186</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Tokenizer-187"><a href="#Snowflake.Tokenizer-187"><span class="linenos">187</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-188"><a href="#Snowflake.Tokenizer-188"><span class="linenos">188</span></a> <span class="s2">"$"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-189"><a href="#Snowflake.Tokenizer-189"><span class="linenos">189</span></a> <span class="p">}</span> +</span><span id="Snowflake.Tokenizer-190"><a href="#Snowflake.Tokenizer-190"><span class="linenos">190</span></a> +</span><span id="Snowflake.Tokenizer-191"><a href="#Snowflake.Tokenizer-191"><span class="linenos">191</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Tokenizer-192"><a href="#Snowflake.Tokenizer-192"><span class="linenos">192</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-193"><a href="#Snowflake.Tokenizer-193"><span class="linenos">193</span></a> <span class="s2">"EXCLUDE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-194"><a href="#Snowflake.Tokenizer-194"><span class="linenos">194</span></a> <span class="s2">"MATCH_RECOGNIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-195"><a href="#Snowflake.Tokenizer-195"><span class="linenos">195</span></a> <span class="s2">"PUT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-196"><a href="#Snowflake.Tokenizer-196"><span class="linenos">196</span></a> <span class="s2">"RENAME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-197"><a href="#Snowflake.Tokenizer-197"><span class="linenos">197</span></a> <span class="s2">"TIMESTAMP_LTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-198"><a href="#Snowflake.Tokenizer-198"><span class="linenos">198</span></a> <span class="s2">"TIMESTAMP_NTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-199"><a href="#Snowflake.Tokenizer-199"><span class="linenos">199</span></a> <span class="s2">"TIMESTAMP_TZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-200"><a href="#Snowflake.Tokenizer-200"><span class="linenos">200</span></a> <span class="s2">"TIMESTAMPNTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-201"><a href="#Snowflake.Tokenizer-201"><span class="linenos">201</span></a> <span class="s2">"MINUS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-202"><a href="#Snowflake.Tokenizer-202"><span class="linenos">202</span></a> <span class="s2">"SAMPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">,</span> +</span><span id="Snowflake.Tokenizer-203"><a href="#Snowflake.Tokenizer-203"><span class="linenos">203</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Snowflake.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Snowflake.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Snowflake.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Snowflake.Generator"> + <input id="Snowflake.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Snowflake.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Snowflake.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator-205"><a href="#Snowflake.Generator-205"><span class="linenos">205</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Snowflake.Generator-206"><a href="#Snowflake.Generator-206"><span class="linenos">206</span></a> <span class="n">CREATE_TRANSIENT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Snowflake.Generator-207"><a href="#Snowflake.Generator-207"><span class="linenos">207</span></a> +</span><span id="Snowflake.Generator-208"><a href="#Snowflake.Generator-208"><span class="linenos">208</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Generator-209"><a href="#Snowflake.Generator-209"><span class="linenos">209</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Snowflake.Generator-210"><a href="#Snowflake.Generator-210"><span class="linenos">210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="Snowflake.Generator-211"><a href="#Snowflake.Generator-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"ARRAY_CAT"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-212"><a href="#Snowflake.Generator-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-213"><a href="#Snowflake.Generator-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="n">datestrtodate_sql</span><span class="p">,</span> +</span><span id="Snowflake.Generator-214"><a href="#Snowflake.Generator-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="n">_datatype_sql</span><span class="p">,</span> +</span><span id="Snowflake.Generator-215"><a href="#Snowflake.Generator-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IFF"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-216"><a href="#Snowflake.Generator-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-217"><a href="#Snowflake.Generator-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">var_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">,</span> <span class="s2">"OBJECT_CONSTRUCT"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-218"><a href="#Snowflake.Generator-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"$</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-219"><a href="#Snowflake.Generator-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-220"><a href="#Snowflake.Generator-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Matches</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DECODE"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-221"><a href="#Snowflake.Generator-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'POSITION'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'substr'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'position'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-222"><a href="#Snowflake.Generator-222"><span class="linenos">222</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-223"><a href="#Snowflake.Generator-223"><span class="linenos">223</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="n">timestrtotime_sql</span><span class="p">,</span> +</span><span id="Snowflake.Generator-224"><a href="#Snowflake.Generator-224"><span class="linenos">224</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EXTRACT(epoch_second FROM </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-225"><a href="#Snowflake.Generator-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TRIM(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-226"><a href="#Snowflake.Generator-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time_sql</span><span class="p">,</span> +</span><span id="Snowflake.Generator-227"><a href="#Snowflake.Generator-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFWEEK"</span><span class="p">),</span> +</span><span id="Snowflake.Generator-228"><a href="#Snowflake.Generator-228"><span class="linenos">228</span></a> <span class="p">}</span> +</span><span id="Snowflake.Generator-229"><a href="#Snowflake.Generator-229"><span class="linenos">229</span></a> +</span><span id="Snowflake.Generator-230"><a href="#Snowflake.Generator-230"><span class="linenos">230</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Generator-231"><a href="#Snowflake.Generator-231"><span class="linenos">231</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Snowflake.Generator-232"><a href="#Snowflake.Generator-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="s2">"TIMESTAMPNTZ"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-233"><a href="#Snowflake.Generator-233"><span class="linenos">233</span></a> <span class="p">}</span> +</span><span id="Snowflake.Generator-234"><a href="#Snowflake.Generator-234"><span class="linenos">234</span></a> +</span><span id="Snowflake.Generator-235"><a href="#Snowflake.Generator-235"><span class="linenos">235</span></a> <span class="n">STAR_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Snowflake.Generator-236"><a href="#Snowflake.Generator-236"><span class="linenos">236</span></a> <span class="s2">"except"</span><span class="p">:</span> <span class="s2">"EXCLUDE"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-237"><a href="#Snowflake.Generator-237"><span class="linenos">237</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="s2">"RENAME"</span><span class="p">,</span> +</span><span id="Snowflake.Generator-238"><a href="#Snowflake.Generator-238"><span class="linenos">238</span></a> <span class="p">}</span> +</span><span id="Snowflake.Generator-239"><a href="#Snowflake.Generator-239"><span class="linenos">239</span></a> +</span><span id="Snowflake.Generator-240"><a href="#Snowflake.Generator-240"><span class="linenos">240</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Snowflake.Generator-241"><a href="#Snowflake.Generator-241"><span class="linenos">241</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="Snowflake.Generator-242"><a href="#Snowflake.Generator-242"><span class="linenos">242</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="Snowflake.Generator-243"><a href="#Snowflake.Generator-243"><span class="linenos">243</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake.Generator-244"><a href="#Snowflake.Generator-244"><span class="linenos">244</span></a> +</span><span id="Snowflake.Generator-245"><a href="#Snowflake.Generator-245"><span class="linenos">245</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Snowflake.Generator-246"><a href="#Snowflake.Generator-246"><span class="linenos">246</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="Snowflake.Generator-247"><a href="#Snowflake.Generator-247"><span class="linenos">247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="Snowflake.Generator-248"><a href="#Snowflake.Generator-248"><span class="linenos">248</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake.Generator-249"><a href="#Snowflake.Generator-249"><span class="linenos">249</span></a> +</span><span id="Snowflake.Generator-250"><a href="#Snowflake.Generator-250"><span class="linenos">250</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator-251"><a href="#Snowflake.Generator-251"><span class="linenos">251</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted.</span> +</span><span id="Snowflake.Generator-252"><a href="#Snowflake.Generator-252"><span class="linenos">252</span></a> +</span><span id="Snowflake.Generator-253"><a href="#Snowflake.Generator-253"><span class="linenos">253</span></a><span class="sd"> We also want to make sure that after we find matches where we need to unquote a column that we prevent users</span> +</span><span id="Snowflake.Generator-254"><a href="#Snowflake.Generator-254"><span class="linenos">254</span></a><span class="sd"> from adding quotes to the column by using the `identify` argument when generating the SQL.</span> +</span><span id="Snowflake.Generator-255"><a href="#Snowflake.Generator-255"><span class="linenos">255</span></a><span class="sd"> """</span> +</span><span id="Snowflake.Generator-256"><a href="#Snowflake.Generator-256"><span class="linenos">256</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Snowflake.Generator-257"><a href="#Snowflake.Generator-257"><span class="linenos">257</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">):</span> +</span><span id="Snowflake.Generator-258"><a href="#Snowflake.Generator-258"><span class="linenos">258</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Snowflake.Generator-259"><a href="#Snowflake.Generator-259"><span class="linenos">259</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="Snowflake.Generator-260"><a href="#Snowflake.Generator-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="Snowflake.Generator-261"><a href="#Snowflake.Generator-261"><span class="linenos">261</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> +</span><span id="Snowflake.Generator-262"><a href="#Snowflake.Generator-262"><span class="linenos">262</span></a> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">==</span> <span class="s2">"columns"</span> +</span><span id="Snowflake.Generator-263"><a href="#Snowflake.Generator-263"><span class="linenos">263</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="Snowflake.Generator-264"><a href="#Snowflake.Generator-264"><span class="linenos">264</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator-265"><a href="#Snowflake.Generator-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Snowflake.Generator-266"><a href="#Snowflake.Generator-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake.Generator-267"><a href="#Snowflake.Generator-267"><span class="linenos">267</span></a> +</span><span id="Snowflake.Generator-268"><a href="#Snowflake.Generator-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator-269"><a href="#Snowflake.Generator-269"><span class="linenos">269</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted and also</span> +</span><span id="Snowflake.Generator-270"><a href="#Snowflake.Generator-270"><span class="linenos">270</span></a><span class="sd"> that all columns in a SELECT are unquoted. We also want to make sure that after we find matches where we need</span> +</span><span id="Snowflake.Generator-271"><a href="#Snowflake.Generator-271"><span class="linenos">271</span></a><span class="sd"> to unquote a column that we prevent users from adding quotes to the column by using the `identify` argument when</span> +</span><span id="Snowflake.Generator-272"><a href="#Snowflake.Generator-272"><span class="linenos">272</span></a><span class="sd"> generating the SQL.</span> +</span><span id="Snowflake.Generator-273"><a href="#Snowflake.Generator-273"><span class="linenos">273</span></a> +</span><span id="Snowflake.Generator-274"><a href="#Snowflake.Generator-274"><span class="linenos">274</span></a><span class="sd"> Note: We make an assumption that any columns referenced in a VALUES expression should be unquoted throughout the</span> +</span><span id="Snowflake.Generator-275"><a href="#Snowflake.Generator-275"><span class="linenos">275</span></a><span class="sd"> expression. This might not be true in a case where the same column name can be sourced from another table that can</span> +</span><span id="Snowflake.Generator-276"><a href="#Snowflake.Generator-276"><span class="linenos">276</span></a><span class="sd"> properly quote but should be true in most cases.</span> +</span><span id="Snowflake.Generator-277"><a href="#Snowflake.Generator-277"><span class="linenos">277</span></a><span class="sd"> """</span> +</span><span id="Snowflake.Generator-278"><a href="#Snowflake.Generator-278"><span class="linenos">278</span></a> <span class="n">values_expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> +</span><span id="Snowflake.Generator-279"><a href="#Snowflake.Generator-279"><span class="linenos">279</span></a> <span class="n">values_identifiers</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span> +</span><span id="Snowflake.Generator-280"><a href="#Snowflake.Generator-280"><span class="linenos">280</span></a> <span class="n">flatten</span><span class="p">(</span> +</span><span id="Snowflake.Generator-281"><a href="#Snowflake.Generator-281"><span class="linenos">281</span></a> <span class="n">v</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="Snowflake.Generator-282"><a href="#Snowflake.Generator-282"><span class="linenos">282</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">values_expressions</span> +</span><span id="Snowflake.Generator-283"><a href="#Snowflake.Generator-283"><span class="linenos">283</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator-284"><a href="#Snowflake.Generator-284"><span class="linenos">284</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator-285"><a href="#Snowflake.Generator-285"><span class="linenos">285</span></a> <span class="k">if</span> <span class="n">values_identifiers</span><span class="p">:</span> +</span><span id="Snowflake.Generator-286"><a href="#Snowflake.Generator-286"><span class="linenos">286</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Snowflake.Generator-287"><a href="#Snowflake.Generator-287"><span class="linenos">287</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="Snowflake.Generator-288"><a href="#Snowflake.Generator-288"><span class="linenos">288</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">values_identifiers</span> +</span><span id="Snowflake.Generator-289"><a href="#Snowflake.Generator-289"><span class="linenos">289</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="Snowflake.Generator-290"><a href="#Snowflake.Generator-290"><span class="linenos">290</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator-291"><a href="#Snowflake.Generator-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Snowflake.Generator-292"><a href="#Snowflake.Generator-292"><span class="linenos">292</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Snowflake.Generator-293"><a href="#Snowflake.Generator-293"><span class="linenos">293</span></a> +</span><span id="Snowflake.Generator-294"><a href="#Snowflake.Generator-294"><span class="linenos">294</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator-295"><a href="#Snowflake.Generator-295"><span class="linenos">295</span></a> <span class="c1"># Default to table if kind is unknown</span> +</span><span id="Snowflake.Generator-296"><a href="#Snowflake.Generator-296"><span class="linenos">296</span></a> <span class="n">kind_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"TABLE"</span> +</span><span id="Snowflake.Generator-297"><a href="#Snowflake.Generator-297"><span class="linenos">297</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind_value</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind_value</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake.Generator-298"><a href="#Snowflake.Generator-298"><span class="linenos">298</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Snowflake.Generator-299"><a href="#Snowflake.Generator-299"><span class="linenos">299</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Snowflake.Generator-300"><a href="#Snowflake.Generator-300"><span class="linenos">300</span></a> +</span><span id="Snowflake.Generator-301"><a href="#Snowflake.Generator-301"><span class="linenos">301</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="Snowflake.Generator-302"><a href="#Snowflake.Generator-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="Snowflake.Generator-303"><a href="#Snowflake.Generator-303"><span class="linenos">303</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator-304"><a href="#Snowflake.Generator-304"><span class="linenos">304</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="Snowflake.Generator-305"><a href="#Snowflake.Generator-305"><span class="linenos">305</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" START </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake.Generator-306"><a href="#Snowflake.Generator-306"><span class="linenos">306</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="Snowflake.Generator-307"><a href="#Snowflake.Generator-307"><span class="linenos">307</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INCREMENT </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake.Generator-308"><a href="#Snowflake.Generator-308"><span class="linenos">308</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"AUTOINCREMENT</span><span class="si">{</span><span class="n">start</span><span class="si">}{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Snowflake.Generator.except_op" class="classattr"> + <input id="Snowflake.Generator.except_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">except_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Snowflake.Generator.except_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator.except_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator.except_op-240"><a href="#Snowflake.Generator.except_op-240"><span class="linenos">240</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Snowflake.Generator.except_op-241"><a href="#Snowflake.Generator.except_op-241"><span class="linenos">241</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="Snowflake.Generator.except_op-242"><a href="#Snowflake.Generator.except_op-242"><span class="linenos">242</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"EXCEPT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="Snowflake.Generator.except_op-243"><a href="#Snowflake.Generator.except_op-243"><span class="linenos">243</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Snowflake.Generator.intersect_op" class="classattr"> + <input id="Snowflake.Generator.intersect_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intersect_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Snowflake.Generator.intersect_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator.intersect_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator.intersect_op-245"><a href="#Snowflake.Generator.intersect_op-245"><span class="linenos">245</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Snowflake.Generator.intersect_op-246"><a href="#Snowflake.Generator.intersect_op-246"><span class="linenos">246</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span> +</span><span id="Snowflake.Generator.intersect_op-247"><a href="#Snowflake.Generator.intersect_op-247"><span class="linenos">247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"INTERSECT with All is not supported in Snowflake"</span><span class="p">)</span> +</span><span id="Snowflake.Generator.intersect_op-248"><a href="#Snowflake.Generator.intersect_op-248"><span class="linenos">248</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Snowflake.Generator.values_sql" class="classattr"> + <input id="Snowflake.Generator.values_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">values_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Values">sqlglot.expressions.Values</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Snowflake.Generator.values_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator.values_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator.values_sql-250"><a href="#Snowflake.Generator.values_sql-250"><span class="linenos">250</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator.values_sql-251"><a href="#Snowflake.Generator.values_sql-251"><span class="linenos">251</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted.</span> +</span><span id="Snowflake.Generator.values_sql-252"><a href="#Snowflake.Generator.values_sql-252"><span class="linenos">252</span></a> +</span><span id="Snowflake.Generator.values_sql-253"><a href="#Snowflake.Generator.values_sql-253"><span class="linenos">253</span></a><span class="sd"> We also want to make sure that after we find matches where we need to unquote a column that we prevent users</span> +</span><span id="Snowflake.Generator.values_sql-254"><a href="#Snowflake.Generator.values_sql-254"><span class="linenos">254</span></a><span class="sd"> from adding quotes to the column by using the `identify` argument when generating the SQL.</span> +</span><span id="Snowflake.Generator.values_sql-255"><a href="#Snowflake.Generator.values_sql-255"><span class="linenos">255</span></a><span class="sd"> """</span> +</span><span id="Snowflake.Generator.values_sql-256"><a href="#Snowflake.Generator.values_sql-256"><span class="linenos">256</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Snowflake.Generator.values_sql-257"><a href="#Snowflake.Generator.values_sql-257"><span class="linenos">257</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">):</span> +</span><span id="Snowflake.Generator.values_sql-258"><a href="#Snowflake.Generator.values_sql-258"><span class="linenos">258</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Snowflake.Generator.values_sql-259"><a href="#Snowflake.Generator.values_sql-259"><span class="linenos">259</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="Snowflake.Generator.values_sql-260"><a href="#Snowflake.Generator.values_sql-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="Snowflake.Generator.values_sql-261"><a href="#Snowflake.Generator.values_sql-261"><span class="linenos">261</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> +</span><span id="Snowflake.Generator.values_sql-262"><a href="#Snowflake.Generator.values_sql-262"><span class="linenos">262</span></a> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">==</span> <span class="s2">"columns"</span> +</span><span id="Snowflake.Generator.values_sql-263"><a href="#Snowflake.Generator.values_sql-263"><span class="linenos">263</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="Snowflake.Generator.values_sql-264"><a href="#Snowflake.Generator.values_sql-264"><span class="linenos">264</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator.values_sql-265"><a href="#Snowflake.Generator.values_sql-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Snowflake.Generator.values_sql-266"><a href="#Snowflake.Generator.values_sql-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">values_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted.</p> + +<p>We also want to make sure that after we find matches where we need to unquote a column that we prevent users +from adding quotes to the column by using the <code>identify</code> argument when generating the SQL.</p> +</div> + + + </div> + <div id="Snowflake.Generator.select_sql" class="classattr"> + <input id="Snowflake.Generator.select_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">select_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Select">sqlglot.expressions.Select</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Snowflake.Generator.select_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator.select_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator.select_sql-268"><a href="#Snowflake.Generator.select_sql-268"><span class="linenos">268</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator.select_sql-269"><a href="#Snowflake.Generator.select_sql-269"><span class="linenos">269</span></a><span class="w"> </span><span class="sd">"""Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted and also</span> +</span><span id="Snowflake.Generator.select_sql-270"><a href="#Snowflake.Generator.select_sql-270"><span class="linenos">270</span></a><span class="sd"> that all columns in a SELECT are unquoted. We also want to make sure that after we find matches where we need</span> +</span><span id="Snowflake.Generator.select_sql-271"><a href="#Snowflake.Generator.select_sql-271"><span class="linenos">271</span></a><span class="sd"> to unquote a column that we prevent users from adding quotes to the column by using the `identify` argument when</span> +</span><span id="Snowflake.Generator.select_sql-272"><a href="#Snowflake.Generator.select_sql-272"><span class="linenos">272</span></a><span class="sd"> generating the SQL.</span> +</span><span id="Snowflake.Generator.select_sql-273"><a href="#Snowflake.Generator.select_sql-273"><span class="linenos">273</span></a> +</span><span id="Snowflake.Generator.select_sql-274"><a href="#Snowflake.Generator.select_sql-274"><span class="linenos">274</span></a><span class="sd"> Note: We make an assumption that any columns referenced in a VALUES expression should be unquoted throughout the</span> +</span><span id="Snowflake.Generator.select_sql-275"><a href="#Snowflake.Generator.select_sql-275"><span class="linenos">275</span></a><span class="sd"> expression. This might not be true in a case where the same column name can be sourced from another table that can</span> +</span><span id="Snowflake.Generator.select_sql-276"><a href="#Snowflake.Generator.select_sql-276"><span class="linenos">276</span></a><span class="sd"> properly quote but should be true in most cases.</span> +</span><span id="Snowflake.Generator.select_sql-277"><a href="#Snowflake.Generator.select_sql-277"><span class="linenos">277</span></a><span class="sd"> """</span> +</span><span id="Snowflake.Generator.select_sql-278"><a href="#Snowflake.Generator.select_sql-278"><span class="linenos">278</span></a> <span class="n">values_expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> +</span><span id="Snowflake.Generator.select_sql-279"><a href="#Snowflake.Generator.select_sql-279"><span class="linenos">279</span></a> <span class="n">values_identifiers</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span> +</span><span id="Snowflake.Generator.select_sql-280"><a href="#Snowflake.Generator.select_sql-280"><span class="linenos">280</span></a> <span class="n">flatten</span><span class="p">(</span> +</span><span id="Snowflake.Generator.select_sql-281"><a href="#Snowflake.Generator.select_sql-281"><span class="linenos">281</span></a> <span class="n">v</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">())</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="Snowflake.Generator.select_sql-282"><a href="#Snowflake.Generator.select_sql-282"><span class="linenos">282</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">values_expressions</span> +</span><span id="Snowflake.Generator.select_sql-283"><a href="#Snowflake.Generator.select_sql-283"><span class="linenos">283</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator.select_sql-284"><a href="#Snowflake.Generator.select_sql-284"><span class="linenos">284</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator.select_sql-285"><a href="#Snowflake.Generator.select_sql-285"><span class="linenos">285</span></a> <span class="k">if</span> <span class="n">values_identifiers</span><span class="p">:</span> +</span><span id="Snowflake.Generator.select_sql-286"><a href="#Snowflake.Generator.select_sql-286"><span class="linenos">286</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Snowflake.Generator.select_sql-287"><a href="#Snowflake.Generator.select_sql-287"><span class="linenos">287</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">})</span> +</span><span id="Snowflake.Generator.select_sql-288"><a href="#Snowflake.Generator.select_sql-288"><span class="linenos">288</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">values_identifiers</span> +</span><span id="Snowflake.Generator.select_sql-289"><a href="#Snowflake.Generator.select_sql-289"><span class="linenos">289</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="Snowflake.Generator.select_sql-290"><a href="#Snowflake.Generator.select_sql-290"><span class="linenos">290</span></a> <span class="p">)</span> +</span><span id="Snowflake.Generator.select_sql-291"><a href="#Snowflake.Generator.select_sql-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="nb">super</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="Snowflake.Generator.select_sql-292"><a href="#Snowflake.Generator.select_sql-292"><span class="linenos">292</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">select_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Due to a bug in Snowflake we want to make sure that all columns in a VALUES table alias are unquoted and also +that all columns in a SELECT are unquoted. We also want to make sure that after we find matches where we need +to unquote a column that we prevent users from adding quotes to the column by using the <code>identify</code> argument when +generating the SQL.</p> + +<p>Note: We make an assumption that any columns referenced in a VALUES expression should be unquoted throughout the +expression. This might not be true in a case where the same column name can be sourced from another table that can +properly quote but should be true in most cases.</p> +</div> + + + </div> + <div id="Snowflake.Generator.describe_sql" class="classattr"> + <input id="Snowflake.Generator.describe_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">describe_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Describe">sqlglot.expressions.Describe</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Snowflake.Generator.describe_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator.describe_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator.describe_sql-294"><a href="#Snowflake.Generator.describe_sql-294"><span class="linenos">294</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator.describe_sql-295"><a href="#Snowflake.Generator.describe_sql-295"><span class="linenos">295</span></a> <span class="c1"># Default to table if kind is unknown</span> +</span><span id="Snowflake.Generator.describe_sql-296"><a href="#Snowflake.Generator.describe_sql-296"><span class="linenos">296</span></a> <span class="n">kind_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"TABLE"</span> +</span><span id="Snowflake.Generator.describe_sql-297"><a href="#Snowflake.Generator.describe_sql-297"><span class="linenos">297</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind_value</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind_value</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake.Generator.describe_sql-298"><a href="#Snowflake.Generator.describe_sql-298"><span class="linenos">298</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Snowflake.Generator.describe_sql-299"><a href="#Snowflake.Generator.describe_sql-299"><span class="linenos">299</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql" class="classattr"> + <input id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generatedasidentitycolumnconstraint_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#GeneratedAsIdentityColumnConstraint">sqlglot.expressions.GeneratedAsIdentityColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-301"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-301"><span class="linenos">301</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-302"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-303"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-303"><span class="linenos">303</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-304"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-304"><span class="linenos">304</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-305"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-305"><span class="linenos">305</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" START </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-306"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-306"><span class="linenos">306</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-307"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-307"><span class="linenos">307</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INCREMENT </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Snowflake.Generator.generatedasidentitycolumnconstraint_sql-308"><a href="#Snowflake.Generator.generatedasidentitycolumnconstraint_sql-308"><span class="linenos">308</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"AUTOINCREMENT</span><span class="si">{</span><span class="n">start</span><span class="si">}{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Snowflake.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Snowflake.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Snowflake.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Snowflake.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Snowflake.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Snowflake.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Snowflake.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Snowflake.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Snowflake.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Snowflake.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Snowflake.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Snowflake.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Snowflake.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Snowflake.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Snowflake.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Snowflake.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Snowflake.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Snowflake.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Snowflake.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Snowflake.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Snowflake.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Snowflake.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Snowflake.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Snowflake.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Snowflake.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Snowflake.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Snowflake.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Snowflake.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Snowflake.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Snowflake.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Snowflake.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Snowflake.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Snowflake.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Snowflake.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Snowflake.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Snowflake.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Snowflake.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Snowflake.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Snowflake.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Snowflake.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Snowflake.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Snowflake.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Snowflake.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Snowflake.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Snowflake.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Snowflake.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Snowflake.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Snowflake.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Snowflake.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Snowflake.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Snowflake.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Snowflake.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Snowflake.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Snowflake.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Snowflake.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Snowflake.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Snowflake.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Snowflake.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Snowflake.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Snowflake.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Snowflake.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Snowflake.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Snowflake.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Snowflake.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Snowflake.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Snowflake.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Snowflake.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Snowflake.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Snowflake.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Snowflake.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Snowflake.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Snowflake.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Snowflake.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Snowflake.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Snowflake.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Snowflake.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Snowflake.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Snowflake.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Snowflake.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Snowflake.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Snowflake.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Snowflake.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Snowflake.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Snowflake.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Snowflake.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Snowflake.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Snowflake.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Snowflake.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Snowflake.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Snowflake.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Snowflake.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Snowflake.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Snowflake.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Snowflake.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Snowflake.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Snowflake.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Snowflake.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Snowflake.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Snowflake.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Snowflake.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Snowflake.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Snowflake.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Snowflake.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Snowflake.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Snowflake.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Snowflake.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Snowflake.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Snowflake.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Snowflake.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Snowflake.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Snowflake.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Snowflake.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Snowflake.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Snowflake.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Snowflake.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Snowflake.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Snowflake.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Snowflake.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Snowflake.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Snowflake.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Snowflake.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Snowflake.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Snowflake.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Snowflake.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Snowflake.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Snowflake.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Snowflake.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Snowflake.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Snowflake.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Snowflake.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Snowflake.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Snowflake.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Snowflake.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Snowflake.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Snowflake.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Snowflake.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Snowflake.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Snowflake.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Snowflake.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Snowflake.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Snowflake.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Snowflake.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Snowflake.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Snowflake.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Snowflake.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Snowflake.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Snowflake.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Snowflake.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Snowflake.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Snowflake.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Snowflake.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Snowflake.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Snowflake.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Snowflake.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Snowflake.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Snowflake.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Snowflake.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Snowflake.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Snowflake.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Snowflake.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Snowflake.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Snowflake.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Snowflake.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Snowflake.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Snowflake.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Snowflake.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Snowflake.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Snowflake.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Snowflake.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Snowflake.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Snowflake.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Snowflake.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Snowflake.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Snowflake.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Snowflake.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Snowflake.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Snowflake.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Snowflake.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Snowflake.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Snowflake.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Snowflake.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Snowflake.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Snowflake.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Snowflake.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Snowflake.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Snowflake.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Snowflake.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Snowflake.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Snowflake.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Snowflake.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Snowflake.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Snowflake.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Snowflake.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Snowflake.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Snowflake.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/spark.html b/docs/sqlglot/dialects/spark.html new file mode 100644 index 0000000..75d5ac4 --- /dev/null +++ b/docs/sqlglot/dialects/spark.html @@ -0,0 +1,1136 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.spark API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Spark">Spark</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Spark.__init__">Spark</a> + </li> + <li> + <a class="class" href="#Spark.Parser">Spark.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Spark.Generator">Spark.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Spark.Generator.cast_sql">cast_sql</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Spark.Tokenizer">Spark.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/spark.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.spark </h1> + + + <input id="mod-spark-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-spark-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">parser</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">create_with_partitions_sql</span><span class="p">,</span> <span class="n">rename_func</span><span class="p">,</span> <span class="n">trim_sql</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.hive</span> <span class="kn">import</span> <span class="n">Hive</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">_create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="k">if</span> <span class="n">kind</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"TABLE"</span> <span class="ow">and</span> <span class="n">temporary</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CREATE TEMPORARY VIEW </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="k">return</span> <span class="n">create_with_partitions_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="k">def</span> <span class="nf">_map_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"keys"</span><span class="p">])</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="n">values</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"values"</span><span class="p">])</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MAP_FROM_ARRAYS(</span><span class="si">{</span><span class="n">keys</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="k">def</span> <span class="nf">_str_to_date</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">if</span> <span class="n">time_format</span> <span class="o">==</span> <span class="n">Hive</span><span class="o">.</span><span class="n">date_format</span><span class="p">:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_DATE(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_DATE(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">time_format</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="k">def</span> <span class="nf">_unix_to_time</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">scale</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"scale"</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">timestamp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">SECONDS</span><span class="p">:</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TIMESTAMP_SECONDS(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MILLIS</span><span class="p">:</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TIMESTAMP_MILLIS(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">if</span> <span class="n">scale</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="o">.</span><span class="n">MICROS</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TIMESTAMP_MICROS(</span><span class="si">{</span><span class="n">timestamp</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Improper scale for timestamp"</span><span class="p">)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="k">class</span> <span class="nc">Spark</span><span class="p">(</span><span class="n">Hive</span><span class="p">):</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="s2">"MAP_FROM_ARRAYS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="s2">"TO_UNIX_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="p">),</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="s2">"SHIFTLEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">(</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="p">),</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="s2">"SHIFTRIGHT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">(</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="p">),</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="s2">"RIGHT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">(</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="p">),</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="p">),</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="s2">"IIF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="s2">"AGGREGATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Reduce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="s2">"DAYOFWEEK"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">(</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="p">),</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="s2">"DAYOFMONTH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfMonth</span><span class="p">(</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="p">),</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="s2">"DAYOFYEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfYear</span><span class="p">(</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="p">),</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="s2">"WEEKOFYEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WeekOfYear</span><span class="p">(</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="p">),</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="p">}</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="s2">"BROADCAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"BROADCAST"</span><span class="p">),</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="s2">"BROADCASTJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"BROADCASTJOIN"</span><span class="p">),</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="s2">"MAPJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MAPJOIN"</span><span class="p">),</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="s2">"MERGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MERGE"</span><span class="p">),</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="s2">"SHUFFLEMERGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLEMERGE"</span><span class="p">),</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="s2">"MERGEJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MERGEJOIN"</span><span class="p">),</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="s2">"SHUFFLE_HASH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLE_HASH"</span><span class="p">),</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">),</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="p">}</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">_parse_add_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">,</span> <span class="s2">"COLUMNS"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">_parse_drop_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DROP"</span><span class="p">,</span> <span class="s2">"COLUMNS"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">,</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(),</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"COLUMNS"</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"BYTE"</span><span class="p">,</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"SHORT"</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"LONG"</span><span class="p">,</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="p">}</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="p">}</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">),</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"AGGREGATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, 0, (acc, x) -> acc + x, acc -> acc)"</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SHIFTLEFT"</span><span class="p">),</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SHIFTRIGHT"</span><span class="p">),</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TRUNC"</span><span class="p">),</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">" /*+ </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2"> */"</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">_create_sql</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="n">_map_sql</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Reduce</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"AGGREGATE"</span><span class="p">),</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_TRUNC(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateFromParts</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAKE_DATE"</span><span class="p">),</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFWEEK"</span><span class="p">),</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfMonth</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFMONTH"</span><span class="p">),</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfYear</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFYEAR"</span><span class="p">),</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WeekOfYear</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"WEEKOFYEAR"</span><span class="p">),</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UTC_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'zone'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="p">}</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">)</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">WRAP_DERIVED_VALUES</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">CREATE_FUNCTION_AS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="p">):</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">'"</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">),</span><span class="w"> </span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span><span class="p">):</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span></pre></div> + + + </section> + <section id="Spark"> + <input id="Spark-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Spark</span><wbr>(<span class="base"><a href="hive.html#Hive">sqlglot.dialects.hive.Hive</a></span>): + + <label class="view-source-button" for="Spark-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Spark"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Spark-48"><a href="#Spark-48"><span class="linenos"> 48</span></a><span class="k">class</span> <span class="nc">Spark</span><span class="p">(</span><span class="n">Hive</span><span class="p">):</span> +</span><span id="Spark-49"><a href="#Spark-49"><span class="linenos"> 49</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Spark-50"><a href="#Spark-50"><span class="linenos"> 50</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark-51"><a href="#Spark-51"><span class="linenos"> 51</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark-52"><a href="#Spark-52"><span class="linenos"> 52</span></a> <span class="s2">"MAP_FROM_ARRAYS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark-53"><a href="#Spark-53"><span class="linenos"> 53</span></a> <span class="s2">"TO_UNIX_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark-54"><a href="#Spark-54"><span class="linenos"> 54</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="Spark-55"><a href="#Spark-55"><span class="linenos"> 55</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark-56"><a href="#Spark-56"><span class="linenos"> 56</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Spark-57"><a href="#Spark-57"><span class="linenos"> 57</span></a> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark-58"><a href="#Spark-58"><span class="linenos"> 58</span></a> <span class="p">),</span> +</span><span id="Spark-59"><a href="#Spark-59"><span class="linenos"> 59</span></a> <span class="s2">"SHIFTLEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">(</span> +</span><span id="Spark-60"><a href="#Spark-60"><span class="linenos"> 60</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark-61"><a href="#Spark-61"><span class="linenos"> 61</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark-62"><a href="#Spark-62"><span class="linenos"> 62</span></a> <span class="p">),</span> +</span><span id="Spark-63"><a href="#Spark-63"><span class="linenos"> 63</span></a> <span class="s2">"SHIFTRIGHT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">(</span> +</span><span id="Spark-64"><a href="#Spark-64"><span class="linenos"> 64</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark-65"><a href="#Spark-65"><span class="linenos"> 65</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark-66"><a href="#Spark-66"><span class="linenos"> 66</span></a> <span class="p">),</span> +</span><span id="Spark-67"><a href="#Spark-67"><span class="linenos"> 67</span></a> <span class="s2">"RIGHT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="Spark-68"><a href="#Spark-68"><span class="linenos"> 68</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark-69"><a href="#Spark-69"><span class="linenos"> 69</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">(</span> +</span><span id="Spark-70"><a href="#Spark-70"><span class="linenos"> 70</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark-71"><a href="#Spark-71"><span class="linenos"> 71</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span> +</span><span id="Spark-72"><a href="#Spark-72"><span class="linenos"> 72</span></a> <span class="p">),</span> +</span><span id="Spark-73"><a href="#Spark-73"><span class="linenos"> 73</span></a> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark-74"><a href="#Spark-74"><span class="linenos"> 74</span></a> <span class="p">),</span> +</span><span id="Spark-75"><a href="#Spark-75"><span class="linenos"> 75</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark-76"><a href="#Spark-76"><span class="linenos"> 76</span></a> <span class="s2">"IIF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark-77"><a href="#Spark-77"><span class="linenos"> 77</span></a> <span class="s2">"AGGREGATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Reduce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark-78"><a href="#Spark-78"><span class="linenos"> 78</span></a> <span class="s2">"DAYOFWEEK"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">(</span> +</span><span id="Spark-79"><a href="#Spark-79"><span class="linenos"> 79</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark-80"><a href="#Spark-80"><span class="linenos"> 80</span></a> <span class="p">),</span> +</span><span id="Spark-81"><a href="#Spark-81"><span class="linenos"> 81</span></a> <span class="s2">"DAYOFMONTH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfMonth</span><span class="p">(</span> +</span><span id="Spark-82"><a href="#Spark-82"><span class="linenos"> 82</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark-83"><a href="#Spark-83"><span class="linenos"> 83</span></a> <span class="p">),</span> +</span><span id="Spark-84"><a href="#Spark-84"><span class="linenos"> 84</span></a> <span class="s2">"DAYOFYEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfYear</span><span class="p">(</span> +</span><span id="Spark-85"><a href="#Spark-85"><span class="linenos"> 85</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark-86"><a href="#Spark-86"><span class="linenos"> 86</span></a> <span class="p">),</span> +</span><span id="Spark-87"><a href="#Spark-87"><span class="linenos"> 87</span></a> <span class="s2">"WEEKOFYEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WeekOfYear</span><span class="p">(</span> +</span><span id="Spark-88"><a href="#Spark-88"><span class="linenos"> 88</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark-89"><a href="#Spark-89"><span class="linenos"> 89</span></a> <span class="p">),</span> +</span><span id="Spark-90"><a href="#Spark-90"><span class="linenos"> 90</span></a> <span class="p">}</span> +</span><span id="Spark-91"><a href="#Spark-91"><span class="linenos"> 91</span></a> +</span><span id="Spark-92"><a href="#Spark-92"><span class="linenos"> 92</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark-93"><a href="#Spark-93"><span class="linenos"> 93</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark-94"><a href="#Spark-94"><span class="linenos"> 94</span></a> <span class="s2">"BROADCAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"BROADCAST"</span><span class="p">),</span> +</span><span id="Spark-95"><a href="#Spark-95"><span class="linenos"> 95</span></a> <span class="s2">"BROADCASTJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"BROADCASTJOIN"</span><span class="p">),</span> +</span><span id="Spark-96"><a href="#Spark-96"><span class="linenos"> 96</span></a> <span class="s2">"MAPJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MAPJOIN"</span><span class="p">),</span> +</span><span id="Spark-97"><a href="#Spark-97"><span class="linenos"> 97</span></a> <span class="s2">"MERGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MERGE"</span><span class="p">),</span> +</span><span id="Spark-98"><a href="#Spark-98"><span class="linenos"> 98</span></a> <span class="s2">"SHUFFLEMERGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLEMERGE"</span><span class="p">),</span> +</span><span id="Spark-99"><a href="#Spark-99"><span class="linenos"> 99</span></a> <span class="s2">"MERGEJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MERGEJOIN"</span><span class="p">),</span> +</span><span id="Spark-100"><a href="#Spark-100"><span class="linenos">100</span></a> <span class="s2">"SHUFFLE_HASH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLE_HASH"</span><span class="p">),</span> +</span><span id="Spark-101"><a href="#Spark-101"><span class="linenos">101</span></a> <span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">),</span> +</span><span id="Spark-102"><a href="#Spark-102"><span class="linenos">102</span></a> <span class="p">}</span> +</span><span id="Spark-103"><a href="#Spark-103"><span class="linenos">103</span></a> +</span><span id="Spark-104"><a href="#Spark-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="nf">_parse_add_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Spark-105"><a href="#Spark-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">,</span> <span class="s2">"COLUMNS"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> +</span><span id="Spark-106"><a href="#Spark-106"><span class="linenos">106</span></a> +</span><span id="Spark-107"><a href="#Spark-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">_parse_drop_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Spark-108"><a href="#Spark-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DROP"</span><span class="p">,</span> <span class="s2">"COLUMNS"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Spark-109"><a href="#Spark-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">,</span> +</span><span id="Spark-110"><a href="#Spark-110"><span class="linenos">110</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(),</span> +</span><span id="Spark-111"><a href="#Spark-111"><span class="linenos">111</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"COLUMNS"</span><span class="p">,</span> +</span><span id="Spark-112"><a href="#Spark-112"><span class="linenos">112</span></a> <span class="p">)</span> +</span><span id="Spark-113"><a href="#Spark-113"><span class="linenos">113</span></a> +</span><span id="Spark-114"><a href="#Spark-114"><span class="linenos">114</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Spark-115"><a href="#Spark-115"><span class="linenos">115</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark-116"><a href="#Spark-116"><span class="linenos">116</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark-117"><a href="#Spark-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"BYTE"</span><span class="p">,</span> +</span><span id="Spark-118"><a href="#Spark-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"SHORT"</span><span class="p">,</span> +</span><span id="Spark-119"><a href="#Spark-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"LONG"</span><span class="p">,</span> +</span><span id="Spark-120"><a href="#Spark-120"><span class="linenos">120</span></a> <span class="p">}</span> +</span><span id="Spark-121"><a href="#Spark-121"><span class="linenos">121</span></a> +</span><span id="Spark-122"><a href="#Spark-122"><span class="linenos">122</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark-123"><a href="#Spark-123"><span class="linenos">123</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark-124"><a href="#Spark-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark-125"><a href="#Spark-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark-126"><a href="#Spark-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark-127"><a href="#Spark-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark-128"><a href="#Spark-128"><span class="linenos">128</span></a> <span class="p">}</span> +</span><span id="Spark-129"><a href="#Spark-129"><span class="linenos">129</span></a> +</span><span id="Spark-130"><a href="#Spark-130"><span class="linenos">130</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark-131"><a href="#Spark-131"><span class="linenos">131</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark-132"><a href="#Spark-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">),</span> +</span><span id="Spark-133"><a href="#Spark-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Spark-134"><a href="#Spark-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"AGGREGATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, 0, (acc, x) -> acc + x, acc -> acc)"</span><span class="p">,</span> +</span><span id="Spark-135"><a href="#Spark-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SHIFTLEFT"</span><span class="p">),</span> +</span><span id="Spark-136"><a href="#Spark-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SHIFTRIGHT"</span><span class="p">),</span> +</span><span id="Spark-137"><a href="#Spark-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TRUNC"</span><span class="p">),</span> +</span><span id="Spark-138"><a href="#Spark-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">" /*+ </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2"> */"</span><span class="p">,</span> +</span><span id="Spark-139"><a href="#Spark-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="Spark-140"><a href="#Spark-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Spark-141"><a href="#Spark-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time</span><span class="p">,</span> +</span><span id="Spark-142"><a href="#Spark-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">_create_sql</span><span class="p">,</span> +</span><span id="Spark-143"><a href="#Spark-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="n">_map_sql</span><span class="p">,</span> +</span><span id="Spark-144"><a href="#Spark-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Reduce</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"AGGREGATE"</span><span class="p">),</span> +</span><span id="Spark-145"><a href="#Spark-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Spark-146"><a href="#Spark-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_TRUNC(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Spark-147"><a href="#Spark-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="Spark-148"><a href="#Spark-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="Spark-149"><a href="#Spark-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateFromParts</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAKE_DATE"</span><span class="p">),</span> +</span><span id="Spark-150"><a href="#Spark-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Spark-151"><a href="#Spark-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFWEEK"</span><span class="p">),</span> +</span><span id="Spark-152"><a href="#Spark-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfMonth</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFMONTH"</span><span class="p">),</span> +</span><span id="Spark-153"><a href="#Spark-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfYear</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFYEAR"</span><span class="p">),</span> +</span><span id="Spark-154"><a href="#Spark-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WeekOfYear</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"WEEKOFYEAR"</span><span class="p">),</span> +</span><span id="Spark-155"><a href="#Spark-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UTC_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'zone'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Spark-156"><a href="#Spark-156"><span class="linenos">156</span></a> <span class="p">}</span> +</span><span id="Spark-157"><a href="#Spark-157"><span class="linenos">157</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">)</span> +</span><span id="Spark-158"><a href="#Spark-158"><span class="linenos">158</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> +</span><span id="Spark-159"><a href="#Spark-159"><span class="linenos">159</span></a> +</span><span id="Spark-160"><a href="#Spark-160"><span class="linenos">160</span></a> <span class="n">WRAP_DERIVED_VALUES</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Spark-161"><a href="#Spark-161"><span class="linenos">161</span></a> <span class="n">CREATE_FUNCTION_AS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Spark-162"><a href="#Spark-162"><span class="linenos">162</span></a> +</span><span id="Spark-163"><a href="#Spark-163"><span class="linenos">163</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Spark-164"><a href="#Spark-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span> +</span><span id="Spark-165"><a href="#Spark-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span> +</span><span id="Spark-166"><a href="#Spark-166"><span class="linenos">166</span></a> <span class="p">):</span> +</span><span id="Spark-167"><a href="#Spark-167"><span class="linenos">167</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">'"</span> +</span><span id="Spark-168"><a href="#Spark-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">),</span><span class="w"> </span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Spark-169"><a href="#Spark-169"><span class="linenos">169</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span><span class="p">):</span> +</span><span id="Spark-170"><a href="#Spark-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Spark-171"><a href="#Spark-171"><span class="linenos">171</span></a> +</span><span id="Spark-172"><a href="#Spark-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Spark-173"><a href="#Spark-173"><span class="linenos">173</span></a> +</span><span id="Spark-174"><a href="#Spark-174"><span class="linenos">174</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Spark-175"><a href="#Spark-175"><span class="linenos">175</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span></pre></div> + + + + + <div id="Spark.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Spark</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Spark.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Spark.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Spark.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Spark.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Spark.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Spark.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Spark.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Spark.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Spark.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Spark.Parser"> + <input id="Spark.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Spark.Parser</span><wbr>(<span class="base"><a href="hive.html#Hive.Parser">sqlglot.dialects.hive.Hive.Parser</a></span>): + + <label class="view-source-button" for="Spark.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Spark.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Spark.Parser-49"><a href="#Spark.Parser-49"><span class="linenos"> 49</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Spark.Parser-50"><a href="#Spark.Parser-50"><span class="linenos"> 50</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark.Parser-51"><a href="#Spark.Parser-51"><span class="linenos"> 51</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark.Parser-52"><a href="#Spark.Parser-52"><span class="linenos"> 52</span></a> <span class="s2">"MAP_FROM_ARRAYS"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark.Parser-53"><a href="#Spark.Parser-53"><span class="linenos"> 53</span></a> <span class="s2">"TO_UNIX_TIMESTAMP"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark.Parser-54"><a href="#Spark.Parser-54"><span class="linenos"> 54</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="Spark.Parser-55"><a href="#Spark.Parser-55"><span class="linenos"> 55</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark.Parser-56"><a href="#Spark.Parser-56"><span class="linenos"> 56</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Spark.Parser-57"><a href="#Spark.Parser-57"><span class="linenos"> 57</span></a> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark.Parser-58"><a href="#Spark.Parser-58"><span class="linenos"> 58</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-59"><a href="#Spark.Parser-59"><span class="linenos"> 59</span></a> <span class="s2">"SHIFTLEFT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">(</span> +</span><span id="Spark.Parser-60"><a href="#Spark.Parser-60"><span class="linenos"> 60</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark.Parser-61"><a href="#Spark.Parser-61"><span class="linenos"> 61</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark.Parser-62"><a href="#Spark.Parser-62"><span class="linenos"> 62</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-63"><a href="#Spark.Parser-63"><span class="linenos"> 63</span></a> <span class="s2">"SHIFTRIGHT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">(</span> +</span><span id="Spark.Parser-64"><a href="#Spark.Parser-64"><span class="linenos"> 64</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark.Parser-65"><a href="#Spark.Parser-65"><span class="linenos"> 65</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark.Parser-66"><a href="#Spark.Parser-66"><span class="linenos"> 66</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-67"><a href="#Spark.Parser-67"><span class="linenos"> 67</span></a> <span class="s2">"RIGHT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="Spark.Parser-68"><a href="#Spark.Parser-68"><span class="linenos"> 68</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Spark.Parser-69"><a href="#Spark.Parser-69"><span class="linenos"> 69</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">(</span> +</span><span id="Spark.Parser-70"><a href="#Spark.Parser-70"><span class="linenos"> 70</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark.Parser-71"><a href="#Spark.Parser-71"><span class="linenos"> 71</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span> +</span><span id="Spark.Parser-72"><a href="#Spark.Parser-72"><span class="linenos"> 72</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-73"><a href="#Spark.Parser-73"><span class="linenos"> 73</span></a> <span class="n">length</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Spark.Parser-74"><a href="#Spark.Parser-74"><span class="linenos"> 74</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-75"><a href="#Spark.Parser-75"><span class="linenos"> 75</span></a> <span class="s2">"APPROX_PERCENTILE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark.Parser-76"><a href="#Spark.Parser-76"><span class="linenos"> 76</span></a> <span class="s2">"IIF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark.Parser-77"><a href="#Spark.Parser-77"><span class="linenos"> 77</span></a> <span class="s2">"AGGREGATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Reduce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Spark.Parser-78"><a href="#Spark.Parser-78"><span class="linenos"> 78</span></a> <span class="s2">"DAYOFWEEK"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">(</span> +</span><span id="Spark.Parser-79"><a href="#Spark.Parser-79"><span class="linenos"> 79</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark.Parser-80"><a href="#Spark.Parser-80"><span class="linenos"> 80</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-81"><a href="#Spark.Parser-81"><span class="linenos"> 81</span></a> <span class="s2">"DAYOFMONTH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfMonth</span><span class="p">(</span> +</span><span id="Spark.Parser-82"><a href="#Spark.Parser-82"><span class="linenos"> 82</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark.Parser-83"><a href="#Spark.Parser-83"><span class="linenos"> 83</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-84"><a href="#Spark.Parser-84"><span class="linenos"> 84</span></a> <span class="s2">"DAYOFYEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfYear</span><span class="p">(</span> +</span><span id="Spark.Parser-85"><a href="#Spark.Parser-85"><span class="linenos"> 85</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark.Parser-86"><a href="#Spark.Parser-86"><span class="linenos"> 86</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-87"><a href="#Spark.Parser-87"><span class="linenos"> 87</span></a> <span class="s2">"WEEKOFYEAR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WeekOfYear</span><span class="p">(</span> +</span><span id="Spark.Parser-88"><a href="#Spark.Parser-88"><span class="linenos"> 88</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)),</span> +</span><span id="Spark.Parser-89"><a href="#Spark.Parser-89"><span class="linenos"> 89</span></a> <span class="p">),</span> +</span><span id="Spark.Parser-90"><a href="#Spark.Parser-90"><span class="linenos"> 90</span></a> <span class="p">}</span> +</span><span id="Spark.Parser-91"><a href="#Spark.Parser-91"><span class="linenos"> 91</span></a> +</span><span id="Spark.Parser-92"><a href="#Spark.Parser-92"><span class="linenos"> 92</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark.Parser-93"><a href="#Spark.Parser-93"><span class="linenos"> 93</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark.Parser-94"><a href="#Spark.Parser-94"><span class="linenos"> 94</span></a> <span class="s2">"BROADCAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"BROADCAST"</span><span class="p">),</span> +</span><span id="Spark.Parser-95"><a href="#Spark.Parser-95"><span class="linenos"> 95</span></a> <span class="s2">"BROADCASTJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"BROADCASTJOIN"</span><span class="p">),</span> +</span><span id="Spark.Parser-96"><a href="#Spark.Parser-96"><span class="linenos"> 96</span></a> <span class="s2">"MAPJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MAPJOIN"</span><span class="p">),</span> +</span><span id="Spark.Parser-97"><a href="#Spark.Parser-97"><span class="linenos"> 97</span></a> <span class="s2">"MERGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MERGE"</span><span class="p">),</span> +</span><span id="Spark.Parser-98"><a href="#Spark.Parser-98"><span class="linenos"> 98</span></a> <span class="s2">"SHUFFLEMERGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLEMERGE"</span><span class="p">),</span> +</span><span id="Spark.Parser-99"><a href="#Spark.Parser-99"><span class="linenos"> 99</span></a> <span class="s2">"MERGEJOIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"MERGEJOIN"</span><span class="p">),</span> +</span><span id="Spark.Parser-100"><a href="#Spark.Parser-100"><span class="linenos">100</span></a> <span class="s2">"SHUFFLE_HASH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLE_HASH"</span><span class="p">),</span> +</span><span id="Spark.Parser-101"><a href="#Spark.Parser-101"><span class="linenos">101</span></a> <span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_hint</span><span class="p">(</span><span class="s2">"SHUFFLE_REPLICATE_NL"</span><span class="p">),</span> +</span><span id="Spark.Parser-102"><a href="#Spark.Parser-102"><span class="linenos">102</span></a> <span class="p">}</span> +</span><span id="Spark.Parser-103"><a href="#Spark.Parser-103"><span class="linenos">103</span></a> +</span><span id="Spark.Parser-104"><a href="#Spark.Parser-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="nf">_parse_add_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Spark.Parser-105"><a href="#Spark.Parser-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">,</span> <span class="s2">"COLUMNS"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> +</span><span id="Spark.Parser-106"><a href="#Spark.Parser-106"><span class="linenos">106</span></a> +</span><span id="Spark.Parser-107"><a href="#Spark.Parser-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">_parse_drop_column</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Spark.Parser-108"><a href="#Spark.Parser-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DROP"</span><span class="p">,</span> <span class="s2">"COLUMNS"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Spark.Parser-109"><a href="#Spark.Parser-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">,</span> +</span><span id="Spark.Parser-110"><a href="#Spark.Parser-110"><span class="linenos">110</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(),</span> +</span><span id="Spark.Parser-111"><a href="#Spark.Parser-111"><span class="linenos">111</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"COLUMNS"</span><span class="p">,</span> +</span><span id="Spark.Parser-112"><a href="#Spark.Parser-112"><span class="linenos">112</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Spark.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Spark.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Spark.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Spark.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Spark.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Spark.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Spark.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Spark.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Spark.Generator"> + <input id="Spark.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Spark.Generator</span><wbr>(<span class="base"><a href="hive.html#Hive.Generator">sqlglot.dialects.hive.Hive.Generator</a></span>): + + <label class="view-source-button" for="Spark.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Spark.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Spark.Generator-114"><a href="#Spark.Generator-114"><span class="linenos">114</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Spark.Generator-115"><a href="#Spark.Generator-115"><span class="linenos">115</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark.Generator-116"><a href="#Spark.Generator-116"><span class="linenos">116</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark.Generator-117"><a href="#Spark.Generator-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"BYTE"</span><span class="p">,</span> +</span><span id="Spark.Generator-118"><a href="#Spark.Generator-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"SHORT"</span><span class="p">,</span> +</span><span id="Spark.Generator-119"><a href="#Spark.Generator-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"LONG"</span><span class="p">,</span> +</span><span id="Spark.Generator-120"><a href="#Spark.Generator-120"><span class="linenos">120</span></a> <span class="p">}</span> +</span><span id="Spark.Generator-121"><a href="#Spark.Generator-121"><span class="linenos">121</span></a> +</span><span id="Spark.Generator-122"><a href="#Spark.Generator-122"><span class="linenos">122</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark.Generator-123"><a href="#Spark.Generator-123"><span class="linenos">123</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark.Generator-124"><a href="#Spark.Generator-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark.Generator-125"><a href="#Spark.Generator-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark.Generator-126"><a href="#Spark.Generator-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark.Generator-127"><a href="#Spark.Generator-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Spark.Generator-128"><a href="#Spark.Generator-128"><span class="linenos">128</span></a> <span class="p">}</span> +</span><span id="Spark.Generator-129"><a href="#Spark.Generator-129"><span class="linenos">129</span></a> +</span><span id="Spark.Generator-130"><a href="#Spark.Generator-130"><span class="linenos">130</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Spark.Generator-131"><a href="#Spark.Generator-131"><span class="linenos">131</span></a> <span class="o">**</span><span class="n">Hive</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Spark.Generator-132"><a href="#Spark.Generator-132"><span class="linenos">132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"APPROX_COUNT_DISTINCT"</span><span class="p">),</span> +</span><span id="Spark.Generator-133"><a href="#Spark.Generator-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Spark.Generator-134"><a href="#Spark.Generator-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"AGGREGATE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, 0, (acc, x) -> acc + x, acc -> acc)"</span><span class="p">,</span> +</span><span id="Spark.Generator-135"><a href="#Spark.Generator-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SHIFTLEFT"</span><span class="p">),</span> +</span><span id="Spark.Generator-136"><a href="#Spark.Generator-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"SHIFTRIGHT"</span><span class="p">),</span> +</span><span id="Spark.Generator-137"><a href="#Spark.Generator-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TRUNC"</span><span class="p">),</span> +</span><span id="Spark.Generator-138"><a href="#Spark.Generator-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">" /*+ </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2"> */"</span><span class="p">,</span> +</span><span id="Spark.Generator-139"><a href="#Spark.Generator-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="n">_str_to_date</span><span class="p">,</span> +</span><span id="Spark.Generator-140"><a href="#Spark.Generator-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TO_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Spark.Generator-141"><a href="#Spark.Generator-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">_unix_to_time</span><span class="p">,</span> +</span><span id="Spark.Generator-142"><a href="#Spark.Generator-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">:</span> <span class="n">_create_sql</span><span class="p">,</span> +</span><span id="Spark.Generator-143"><a href="#Spark.Generator-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Map</span><span class="p">:</span> <span class="n">_map_sql</span><span class="p">,</span> +</span><span id="Spark.Generator-144"><a href="#Spark.Generator-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Reduce</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"AGGREGATE"</span><span class="p">),</span> +</span><span id="Spark.Generator-145"><a href="#Spark.Generator-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Spark.Generator-146"><a href="#Spark.Generator-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampTrunc</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_TRUNC(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'unit'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Spark.Generator-147"><a href="#Spark.Generator-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="n">trim_sql</span><span class="p">,</span> +</span><span id="Spark.Generator-148"><a href="#Spark.Generator-148"><span class="linenos">148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"VAR_POP"</span><span class="p">),</span> +</span><span id="Spark.Generator-149"><a href="#Spark.Generator-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateFromParts</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"MAKE_DATE"</span><span class="p">),</span> +</span><span id="Spark.Generator-150"><a href="#Spark.Generator-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogicalOr</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"BOOL_OR"</span><span class="p">),</span> +</span><span id="Spark.Generator-151"><a href="#Spark.Generator-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfWeek</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFWEEK"</span><span class="p">),</span> +</span><span id="Spark.Generator-152"><a href="#Spark.Generator-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfMonth</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFMONTH"</span><span class="p">),</span> +</span><span id="Spark.Generator-153"><a href="#Spark.Generator-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DayOfYear</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DAYOFYEAR"</span><span class="p">),</span> +</span><span id="Spark.Generator-154"><a href="#Spark.Generator-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WeekOfYear</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"WEEKOFYEAR"</span><span class="p">),</span> +</span><span id="Spark.Generator-155"><a href="#Spark.Generator-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UTC_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'zone'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Spark.Generator-156"><a href="#Spark.Generator-156"><span class="linenos">156</span></a> <span class="p">}</span> +</span><span id="Spark.Generator-157"><a href="#Spark.Generator-157"><span class="linenos">157</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ArraySort</span><span class="p">)</span> +</span><span id="Spark.Generator-158"><a href="#Spark.Generator-158"><span class="linenos">158</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> +</span><span id="Spark.Generator-159"><a href="#Spark.Generator-159"><span class="linenos">159</span></a> +</span><span id="Spark.Generator-160"><a href="#Spark.Generator-160"><span class="linenos">160</span></a> <span class="n">WRAP_DERIVED_VALUES</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Spark.Generator-161"><a href="#Spark.Generator-161"><span class="linenos">161</span></a> <span class="n">CREATE_FUNCTION_AS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Spark.Generator-162"><a href="#Spark.Generator-162"><span class="linenos">162</span></a> +</span><span id="Spark.Generator-163"><a href="#Spark.Generator-163"><span class="linenos">163</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Spark.Generator-164"><a href="#Spark.Generator-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span> +</span><span id="Spark.Generator-165"><a href="#Spark.Generator-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span> +</span><span id="Spark.Generator-166"><a href="#Spark.Generator-166"><span class="linenos">166</span></a> <span class="p">):</span> +</span><span id="Spark.Generator-167"><a href="#Spark.Generator-167"><span class="linenos">167</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">'"</span> +</span><span id="Spark.Generator-168"><a href="#Spark.Generator-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">),</span><span class="w"> </span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Spark.Generator-169"><a href="#Spark.Generator-169"><span class="linenos">169</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span><span class="p">):</span> +</span><span id="Spark.Generator-170"><a href="#Spark.Generator-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Spark.Generator-171"><a href="#Spark.Generator-171"><span class="linenos">171</span></a> +</span><span id="Spark.Generator-172"><a href="#Spark.Generator-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Spark.Generator.cast_sql" class="classattr"> + <input id="Spark.Generator.cast_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cast_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Cast">sqlglot.expressions.Cast</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Spark.Generator.cast_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Spark.Generator.cast_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Spark.Generator.cast_sql-163"><a href="#Spark.Generator.cast_sql-163"><span class="linenos">163</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Spark.Generator.cast_sql-164"><a href="#Spark.Generator.cast_sql-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span> +</span><span id="Spark.Generator.cast_sql-165"><a href="#Spark.Generator.cast_sql-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span> +</span><span id="Spark.Generator.cast_sql-166"><a href="#Spark.Generator.cast_sql-166"><span class="linenos">166</span></a> <span class="p">):</span> +</span><span id="Spark.Generator.cast_sql-167"><a href="#Spark.Generator.cast_sql-167"><span class="linenos">167</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">'"</span> +</span><span id="Spark.Generator.cast_sql-168"><a href="#Spark.Generator.cast_sql-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FROM_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">),</span><span class="w"> </span><span class="n">schema</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Spark.Generator.cast_sql-169"><a href="#Spark.Generator.cast_sql-169"><span class="linenos">169</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">JSON</span><span class="p">):</span> +</span><span id="Spark.Generator.cast_sql-170"><a href="#Spark.Generator.cast_sql-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TO_JSON(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Spark.Generator.cast_sql-171"><a href="#Spark.Generator.cast_sql-171"><span class="linenos">171</span></a> +</span><span id="Spark.Generator.cast_sql-172"><a href="#Spark.Generator.cast_sql-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">(</span><span class="n">Spark</span><span class="o">.</span><span class="n">Generator</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Spark.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Spark.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Spark.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Spark.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Spark.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Spark.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Spark.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Spark.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Spark.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Spark.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Spark.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Spark.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Spark.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Spark.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Spark.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Spark.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Spark.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Spark.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Spark.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Spark.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Spark.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Spark.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Spark.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Spark.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Spark.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Spark.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Spark.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Spark.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Spark.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Spark.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Spark.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Spark.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Spark.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Spark.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Spark.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Spark.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Spark.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Spark.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Spark.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Spark.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Spark.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Spark.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Spark.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Spark.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Spark.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Spark.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Spark.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Spark.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Spark.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Spark.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Spark.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Spark.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Spark.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Spark.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Spark.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Spark.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Spark.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Spark.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Spark.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Spark.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Spark.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Spark.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Spark.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Spark.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Spark.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Spark.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Spark.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Spark.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Spark.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Spark.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Spark.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Spark.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Spark.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Spark.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Spark.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Spark.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Spark.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Spark.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Spark.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Spark.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Spark.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Spark.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Spark.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Spark.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Spark.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Spark.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Spark.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Spark.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Spark.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Spark.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Spark.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Spark.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Spark.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Spark.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Spark.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Spark.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Spark.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Spark.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Spark.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Spark.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Spark.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Spark.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Spark.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Spark.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Spark.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Spark.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Spark.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Spark.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Spark.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Spark.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Spark.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Spark.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Spark.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Spark.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Spark.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Spark.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Spark.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Spark.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Spark.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Spark.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Spark.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Spark.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Spark.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Spark.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Spark.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Spark.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Spark.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Spark.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Spark.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Spark.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Spark.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Spark.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Spark.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Spark.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Spark.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Spark.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Spark.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Spark.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Spark.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Spark.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Spark.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Spark.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Spark.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Spark.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Spark.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Spark.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Spark.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Spark.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Spark.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Spark.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Spark.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Spark.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Spark.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Spark.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Spark.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Spark.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Spark.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Spark.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Spark.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Spark.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Spark.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Spark.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Spark.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Spark.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Spark.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Spark.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Spark.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Spark.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Spark.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Spark.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Spark.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Spark.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Spark.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Spark.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Spark.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Spark.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Spark.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Spark.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Spark.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Spark.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Spark.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Spark.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Spark.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Spark.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Spark.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Spark.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Spark.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Spark.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Spark.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Spark.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Spark.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Spark.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Spark.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Spark.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Spark.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Spark.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Spark.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Spark.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + <div><dt><a href="hive.html#Hive.Generator">sqlglot.dialects.hive.Hive.Generator</a></dt> + <dd id="Spark.Generator.with_properties" class="function"><a href="hive.html#Hive.Generator.with_properties">with_properties</a></dd> + <dd id="Spark.Generator.datatype_sql" class="function"><a href="hive.html#Hive.Generator.datatype_sql">datatype_sql</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Spark.Tokenizer"> + <input id="Spark.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Spark.Tokenizer</span><wbr>(<span class="base"><a href="hive.html#Hive.Tokenizer">sqlglot.dialects.hive.Hive.Tokenizer</a></span>): + + <label class="view-source-button" for="Spark.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Spark.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Spark.Tokenizer-174"><a href="#Spark.Tokenizer-174"><span class="linenos">174</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Hive</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Spark.Tokenizer-175"><a href="#Spark.Tokenizer-175"><span class="linenos">175</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Spark.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Spark.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Spark.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/sqlite.html b/docs/sqlglot/dialects/sqlite.html new file mode 100644 index 0000000..20314c5 --- /dev/null +++ b/docs/sqlglot/dialects/sqlite.html @@ -0,0 +1,918 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.sqlite API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#SQLite">SQLite</a> + <ul class="memberlist"> + <li> + <a class="function" href="#SQLite.__init__">SQLite</a> + </li> + <li> + <a class="class" href="#SQLite.Tokenizer">SQLite.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SQLite.Parser">SQLite.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SQLite.Generator">SQLite.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#SQLite.Generator.transaction_sql">transaction_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/sqlite.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.sqlite </h1> + + + <input id="mod-sqlite-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-sqlite-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> <span class="n">Dialect</span><span class="p">,</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">rename_func</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="p">)</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="k">def</span> <span class="nf">_fetch_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">limit_sql</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"count"</span><span class="p">)))</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="c1"># https://www.sqlite.org/lang_aggfunc.html#group_concat</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="k">def</span> <span class="nf">_group_concat_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="k">if</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">distinct</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="s2">"DISTINCT "</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">):</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"SQLite GROUP_CONCAT doesn't support ORDER BY."</span><span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">separator</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"separator"</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"GROUP_CONCAT(</span><span class="si">{</span><span class="n">distinct</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">separator</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="k">def</span> <span class="nf">_date_add_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">modifier</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">modifier</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">modifier</span><span class="o">.</span><span class="n">is_string</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">modifier</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">modifier</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="n">modifier</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">'"</span> <span class="k">if</span> <span class="n">unit</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">"'</span><span class="si">{</span><span class="n">modifier</span><span class="si">}</span><span class="s2">'"</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'DATE'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">modifier</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="k">class</span> <span class="nc">SQLite</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">),</span> <span class="s2">"`"</span><span class="p">]</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0X"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="p">}</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="s2">"EDITDIST3"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="p">}</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="p">}</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">TOKEN_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">:</span> <span class="s2">"AUTOINCREMENT"</span><span class="p">,</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="p">}</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">,</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"EDITDIST3"</span><span class="p">),</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_group_concat_sql</span><span class="p">,</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">:</span> <span class="n">_fetch_sql</span><span class="p">,</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="p">}</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BEGIN</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TRANSACTION"</span> +</span></pre></div> + + + </section> + <section id="SQLite"> + <input id="SQLite-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SQLite</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="SQLite-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SQLite"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SQLite-46"><a href="#SQLite-46"><span class="linenos"> 46</span></a><span class="k">class</span> <span class="nc">SQLite</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="SQLite-47"><a href="#SQLite-47"><span class="linenos"> 47</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="SQLite-48"><a href="#SQLite-48"><span class="linenos"> 48</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">),</span> <span class="s2">"`"</span><span class="p">]</span> +</span><span id="SQLite-49"><a href="#SQLite-49"><span class="linenos"> 49</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0X"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="SQLite-50"><a href="#SQLite-50"><span class="linenos"> 50</span></a> +</span><span id="SQLite-51"><a href="#SQLite-51"><span class="linenos"> 51</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite-52"><a href="#SQLite-52"><span class="linenos"> 52</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="SQLite-53"><a href="#SQLite-53"><span class="linenos"> 53</span></a> <span class="p">}</span> +</span><span id="SQLite-54"><a href="#SQLite-54"><span class="linenos"> 54</span></a> +</span><span id="SQLite-55"><a href="#SQLite-55"><span class="linenos"> 55</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="SQLite-56"><a href="#SQLite-56"><span class="linenos"> 56</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite-57"><a href="#SQLite-57"><span class="linenos"> 57</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="SQLite-58"><a href="#SQLite-58"><span class="linenos"> 58</span></a> <span class="s2">"EDITDIST3"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="SQLite-59"><a href="#SQLite-59"><span class="linenos"> 59</span></a> <span class="p">}</span> +</span><span id="SQLite-60"><a href="#SQLite-60"><span class="linenos"> 60</span></a> +</span><span id="SQLite-61"><a href="#SQLite-61"><span class="linenos"> 61</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="SQLite-62"><a href="#SQLite-62"><span class="linenos"> 62</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite-63"><a href="#SQLite-63"><span class="linenos"> 63</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="SQLite-64"><a href="#SQLite-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite-65"><a href="#SQLite-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite-66"><a href="#SQLite-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite-67"><a href="#SQLite-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite-68"><a href="#SQLite-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite-69"><a href="#SQLite-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="SQLite-70"><a href="#SQLite-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="SQLite-71"><a href="#SQLite-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="SQLite-72"><a href="#SQLite-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite-73"><a href="#SQLite-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite-74"><a href="#SQLite-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite-75"><a href="#SQLite-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite-76"><a href="#SQLite-76"><span class="linenos"> 76</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="SQLite-77"><a href="#SQLite-77"><span class="linenos"> 77</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="SQLite-78"><a href="#SQLite-78"><span class="linenos"> 78</span></a> <span class="p">}</span> +</span><span id="SQLite-79"><a href="#SQLite-79"><span class="linenos"> 79</span></a> +</span><span id="SQLite-80"><a href="#SQLite-80"><span class="linenos"> 80</span></a> <span class="n">TOKEN_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite-81"><a href="#SQLite-81"><span class="linenos"> 81</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">:</span> <span class="s2">"AUTOINCREMENT"</span><span class="p">,</span> +</span><span id="SQLite-82"><a href="#SQLite-82"><span class="linenos"> 82</span></a> <span class="p">}</span> +</span><span id="SQLite-83"><a href="#SQLite-83"><span class="linenos"> 83</span></a> +</span><span id="SQLite-84"><a href="#SQLite-84"><span class="linenos"> 84</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite-85"><a href="#SQLite-85"><span class="linenos"> 85</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="SQLite-86"><a href="#SQLite-86"><span class="linenos"> 86</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">,</span> +</span><span id="SQLite-87"><a href="#SQLite-87"><span class="linenos"> 87</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="SQLite-88"><a href="#SQLite-88"><span class="linenos"> 88</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="SQLite-89"><a href="#SQLite-89"><span class="linenos"> 89</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="SQLite-90"><a href="#SQLite-90"><span class="linenos"> 90</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="SQLite-91"><a href="#SQLite-91"><span class="linenos"> 91</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="SQLite-92"><a href="#SQLite-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"EDITDIST3"</span><span class="p">),</span> +</span><span id="SQLite-93"><a href="#SQLite-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="SQLite-94"><a href="#SQLite-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="SQLite-95"><a href="#SQLite-95"><span class="linenos"> 95</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="SQLite-96"><a href="#SQLite-96"><span class="linenos"> 96</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="SQLite-97"><a href="#SQLite-97"><span class="linenos"> 97</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_group_concat_sql</span><span class="p">,</span> +</span><span id="SQLite-98"><a href="#SQLite-98"><span class="linenos"> 98</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">:</span> <span class="n">_fetch_sql</span><span class="p">,</span> +</span><span id="SQLite-99"><a href="#SQLite-99"><span class="linenos"> 99</span></a> <span class="p">}</span> +</span><span id="SQLite-100"><a href="#SQLite-100"><span class="linenos">100</span></a> +</span><span id="SQLite-101"><a href="#SQLite-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="SQLite-102"><a href="#SQLite-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="SQLite-103"><a href="#SQLite-103"><span class="linenos">103</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="SQLite-104"><a href="#SQLite-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BEGIN</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TRANSACTION"</span> +</span></pre></div> + + + + + <div id="SQLite.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">SQLite</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#SQLite.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="SQLite.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="SQLite.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="SQLite.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="SQLite.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="SQLite.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="SQLite.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="SQLite.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="SQLite.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SQLite.Tokenizer"> + <input id="SQLite.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SQLite.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="SQLite.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SQLite.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SQLite.Tokenizer-47"><a href="#SQLite.Tokenizer-47"><span class="linenos">47</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="SQLite.Tokenizer-48"><a href="#SQLite.Tokenizer-48"><span class="linenos">48</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">),</span> <span class="s2">"`"</span><span class="p">]</span> +</span><span id="SQLite.Tokenizer-49"><a href="#SQLite.Tokenizer-49"><span class="linenos">49</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"x'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0x"</span><span class="p">,</span> <span class="s2">""</span><span class="p">),</span> <span class="p">(</span><span class="s2">"0X"</span><span class="p">,</span> <span class="s2">""</span><span class="p">)]</span> +</span><span id="SQLite.Tokenizer-50"><a href="#SQLite.Tokenizer-50"><span class="linenos">50</span></a> +</span><span id="SQLite.Tokenizer-51"><a href="#SQLite.Tokenizer-51"><span class="linenos">51</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite.Tokenizer-52"><a href="#SQLite.Tokenizer-52"><span class="linenos">52</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="SQLite.Tokenizer-53"><a href="#SQLite.Tokenizer-53"><span class="linenos">53</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="SQLite.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="SQLite.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="SQLite.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SQLite.Parser"> + <input id="SQLite.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SQLite.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="SQLite.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SQLite.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SQLite.Parser-55"><a href="#SQLite.Parser-55"><span class="linenos">55</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="SQLite.Parser-56"><a href="#SQLite.Parser-56"><span class="linenos">56</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite.Parser-57"><a href="#SQLite.Parser-57"><span class="linenos">57</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="SQLite.Parser-58"><a href="#SQLite.Parser-58"><span class="linenos">58</span></a> <span class="s2">"EDITDIST3"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="SQLite.Parser-59"><a href="#SQLite.Parser-59"><span class="linenos">59</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="SQLite.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="SQLite.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="SQLite.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="SQLite.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="SQLite.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="SQLite.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="SQLite.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="SQLite.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SQLite.Generator"> + <input id="SQLite.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SQLite.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="SQLite.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SQLite.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SQLite.Generator-61"><a href="#SQLite.Generator-61"><span class="linenos"> 61</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="SQLite.Generator-62"><a href="#SQLite.Generator-62"><span class="linenos"> 62</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite.Generator-63"><a href="#SQLite.Generator-63"><span class="linenos"> 63</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="SQLite.Generator-64"><a href="#SQLite.Generator-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite.Generator-65"><a href="#SQLite.Generator-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite.Generator-66"><a href="#SQLite.Generator-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite.Generator-67"><a href="#SQLite.Generator-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite.Generator-68"><a href="#SQLite.Generator-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="SQLite.Generator-69"><a href="#SQLite.Generator-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="SQLite.Generator-70"><a href="#SQLite.Generator-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="SQLite.Generator-71"><a href="#SQLite.Generator-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"REAL"</span><span class="p">,</span> +</span><span id="SQLite.Generator-72"><a href="#SQLite.Generator-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite.Generator-73"><a href="#SQLite.Generator-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite.Generator-74"><a href="#SQLite.Generator-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite.Generator-75"><a href="#SQLite.Generator-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="SQLite.Generator-76"><a href="#SQLite.Generator-76"><span class="linenos"> 76</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="SQLite.Generator-77"><a href="#SQLite.Generator-77"><span class="linenos"> 77</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="SQLite.Generator-78"><a href="#SQLite.Generator-78"><span class="linenos"> 78</span></a> <span class="p">}</span> +</span><span id="SQLite.Generator-79"><a href="#SQLite.Generator-79"><span class="linenos"> 79</span></a> +</span><span id="SQLite.Generator-80"><a href="#SQLite.Generator-80"><span class="linenos"> 80</span></a> <span class="n">TOKEN_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite.Generator-81"><a href="#SQLite.Generator-81"><span class="linenos"> 81</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">:</span> <span class="s2">"AUTOINCREMENT"</span><span class="p">,</span> +</span><span id="SQLite.Generator-82"><a href="#SQLite.Generator-82"><span class="linenos"> 82</span></a> <span class="p">}</span> +</span><span id="SQLite.Generator-83"><a href="#SQLite.Generator-83"><span class="linenos"> 83</span></a> +</span><span id="SQLite.Generator-84"><a href="#SQLite.Generator-84"><span class="linenos"> 84</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SQLite.Generator-85"><a href="#SQLite.Generator-85"><span class="linenos"> 85</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="SQLite.Generator-86"><a href="#SQLite.Generator-86"><span class="linenos"> 86</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">_date_add_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-87"><a href="#SQLite.Generator-87"><span class="linenos"> 87</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">:</span> <span class="n">no_ilike_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-88"><a href="#SQLite.Generator-88"><span class="linenos"> 88</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-89"><a href="#SQLite.Generator-89"><span class="linenos"> 89</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-90"><a href="#SQLite.Generator-90"><span class="linenos"> 90</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-91"><a href="#SQLite.Generator-91"><span class="linenos"> 91</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_scalar_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-92"><a href="#SQLite.Generator-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"EDITDIST3"</span><span class="p">),</span> +</span><span id="SQLite.Generator-93"><a href="#SQLite.Generator-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-94"><a href="#SQLite.Generator-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="SQLite.Generator-95"><a href="#SQLite.Generator-95"><span class="linenos"> 95</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="SQLite.Generator-96"><a href="#SQLite.Generator-96"><span class="linenos"> 96</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="n">no_trycast_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-97"><a href="#SQLite.Generator-97"><span class="linenos"> 97</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_group_concat_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-98"><a href="#SQLite.Generator-98"><span class="linenos"> 98</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">:</span> <span class="n">_fetch_sql</span><span class="p">,</span> +</span><span id="SQLite.Generator-99"><a href="#SQLite.Generator-99"><span class="linenos"> 99</span></a> <span class="p">}</span> +</span><span id="SQLite.Generator-100"><a href="#SQLite.Generator-100"><span class="linenos">100</span></a> +</span><span id="SQLite.Generator-101"><a href="#SQLite.Generator-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="SQLite.Generator-102"><a href="#SQLite.Generator-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="SQLite.Generator-103"><a href="#SQLite.Generator-103"><span class="linenos">103</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="SQLite.Generator-104"><a href="#SQLite.Generator-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BEGIN</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TRANSACTION"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="SQLite.Generator.transaction_sql" class="classattr"> + <input id="SQLite.Generator.transaction_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transaction_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="SQLite.Generator.transaction_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SQLite.Generator.transaction_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SQLite.Generator.transaction_sql-101"><a href="#SQLite.Generator.transaction_sql-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="SQLite.Generator.transaction_sql-102"><a href="#SQLite.Generator.transaction_sql-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="SQLite.Generator.transaction_sql-103"><a href="#SQLite.Generator.transaction_sql-103"><span class="linenos">103</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="SQLite.Generator.transaction_sql-104"><a href="#SQLite.Generator.transaction_sql-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BEGIN</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TRANSACTION"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="SQLite.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="SQLite.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="SQLite.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="SQLite.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="SQLite.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="SQLite.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="SQLite.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="SQLite.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="SQLite.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="SQLite.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="SQLite.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="SQLite.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="SQLite.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="SQLite.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="SQLite.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="SQLite.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="SQLite.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="SQLite.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="SQLite.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="SQLite.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="SQLite.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="SQLite.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="SQLite.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="SQLite.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="SQLite.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="SQLite.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="SQLite.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="SQLite.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="SQLite.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="SQLite.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="SQLite.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="SQLite.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="SQLite.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="SQLite.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="SQLite.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="SQLite.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="SQLite.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="SQLite.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="SQLite.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="SQLite.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="SQLite.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="SQLite.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="SQLite.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="SQLite.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="SQLite.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="SQLite.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="SQLite.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="SQLite.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="SQLite.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="SQLite.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="SQLite.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="SQLite.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="SQLite.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="SQLite.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="SQLite.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="SQLite.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="SQLite.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="SQLite.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="SQLite.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="SQLite.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="SQLite.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="SQLite.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="SQLite.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="SQLite.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="SQLite.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="SQLite.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="SQLite.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="SQLite.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="SQLite.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="SQLite.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="SQLite.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="SQLite.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="SQLite.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="SQLite.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="SQLite.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="SQLite.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="SQLite.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="SQLite.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="SQLite.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="SQLite.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="SQLite.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="SQLite.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="SQLite.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="SQLite.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="SQLite.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="SQLite.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="SQLite.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="SQLite.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="SQLite.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="SQLite.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="SQLite.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="SQLite.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="SQLite.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="SQLite.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="SQLite.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="SQLite.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="SQLite.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="SQLite.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="SQLite.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="SQLite.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="SQLite.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="SQLite.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="SQLite.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="SQLite.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="SQLite.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="SQLite.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="SQLite.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="SQLite.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="SQLite.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="SQLite.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="SQLite.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="SQLite.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="SQLite.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="SQLite.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="SQLite.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="SQLite.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="SQLite.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="SQLite.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="SQLite.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="SQLite.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="SQLite.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="SQLite.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="SQLite.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="SQLite.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="SQLite.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="SQLite.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="SQLite.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="SQLite.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="SQLite.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="SQLite.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="SQLite.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="SQLite.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="SQLite.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="SQLite.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="SQLite.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="SQLite.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="SQLite.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="SQLite.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="SQLite.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="SQLite.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="SQLite.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="SQLite.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="SQLite.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="SQLite.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="SQLite.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="SQLite.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="SQLite.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="SQLite.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="SQLite.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="SQLite.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="SQLite.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="SQLite.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="SQLite.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="SQLite.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="SQLite.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="SQLite.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="SQLite.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="SQLite.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="SQLite.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="SQLite.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="SQLite.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="SQLite.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="SQLite.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="SQLite.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="SQLite.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="SQLite.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="SQLite.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="SQLite.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="SQLite.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="SQLite.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="SQLite.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="SQLite.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="SQLite.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="SQLite.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="SQLite.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="SQLite.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="SQLite.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="SQLite.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="SQLite.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="SQLite.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="SQLite.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="SQLite.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="SQLite.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="SQLite.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="SQLite.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="SQLite.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="SQLite.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="SQLite.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="SQLite.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="SQLite.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="SQLite.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="SQLite.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="SQLite.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="SQLite.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="SQLite.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="SQLite.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="SQLite.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="SQLite.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="SQLite.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="SQLite.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/starrocks.html b/docs/sqlglot/dialects/starrocks.html new file mode 100644 index 0000000..208c6dc --- /dev/null +++ b/docs/sqlglot/dialects/starrocks.html @@ -0,0 +1,658 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.starrocks API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#StarRocks">StarRocks</a> + <ul class="memberlist"> + <li> + <a class="function" href="#StarRocks.__init__">StarRocks</a> + </li> + <li> + <a class="class" href="#StarRocks.Generator">StarRocks.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/starrocks.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.starrocks </h1> + + + <input id="mod-starrocks-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-starrocks-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> <span class="n">rename_func</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.mysql</span> <span class="kn">import</span> <span class="n">MySQL</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">class</span> <span class="nc">StarRocks</span><span class="p">(</span><span class="n">MySQL</span><span class="p">):</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> <span class="c1"># type: ignore</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="o">**</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="s2">"DATETIME"</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"DATETIME"</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="p">}</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="o">**</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"UNIX_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="p">}</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="StarRocks"> + <input id="StarRocks-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StarRocks</span><wbr>(<span class="base"><a href="mysql.html#MySQL">sqlglot.dialects.mysql.MySQL</a></span>): + + <label class="view-source-button" for="StarRocks-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StarRocks"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StarRocks-9"><a href="#StarRocks-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">StarRocks</span><span class="p">(</span><span class="n">MySQL</span><span class="p">):</span> +</span><span id="StarRocks-10"><a href="#StarRocks-10"><span class="linenos">10</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> <span class="c1"># type: ignore</span> +</span><span id="StarRocks-11"><a href="#StarRocks-11"><span class="linenos">11</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="StarRocks-12"><a href="#StarRocks-12"><span class="linenos">12</span></a> <span class="o">**</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="StarRocks-13"><a href="#StarRocks-13"><span class="linenos">13</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="StarRocks-14"><a href="#StarRocks-14"><span class="linenos">14</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="s2">"DATETIME"</span><span class="p">,</span> +</span><span id="StarRocks-15"><a href="#StarRocks-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"DATETIME"</span><span class="p">,</span> +</span><span id="StarRocks-16"><a href="#StarRocks-16"><span class="linenos">16</span></a> <span class="p">}</span> +</span><span id="StarRocks-17"><a href="#StarRocks-17"><span class="linenos">17</span></a> +</span><span id="StarRocks-18"><a href="#StarRocks-18"><span class="linenos">18</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="StarRocks-19"><a href="#StarRocks-19"><span class="linenos">19</span></a> <span class="o">**</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="StarRocks-20"><a href="#StarRocks-20"><span class="linenos">20</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="StarRocks-21"><a href="#StarRocks-21"><span class="linenos">21</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="StarRocks-22"><a href="#StarRocks-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="StarRocks-23"><a href="#StarRocks-23"><span class="linenos">23</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"UNIX_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="StarRocks-24"><a href="#StarRocks-24"><span class="linenos">24</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="StarRocks-25"><a href="#StarRocks-25"><span class="linenos">25</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="StarRocks-26"><a href="#StarRocks-26"><span class="linenos">26</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="StarRocks-27"><a href="#StarRocks-27"><span class="linenos">27</span></a> <span class="p">}</span> +</span><span id="StarRocks-28"><a href="#StarRocks-28"><span class="linenos">28</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="StarRocks.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">StarRocks</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#StarRocks.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="mysql.html#MySQL">sqlglot.dialects.mysql.MySQL</a></dt> + <dd id="StarRocks.Tokenizer" class="class"><a href="mysql.html#MySQL.Tokenizer">Tokenizer</a></dd> + <dd id="StarRocks.Parser" class="class"><a href="mysql.html#MySQL.Parser">Parser</a></dd> + + </div> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="StarRocks.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="StarRocks.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="StarRocks.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="StarRocks.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="StarRocks.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="StarRocks.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="StarRocks.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="StarRocks.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StarRocks.Generator"> + <input id="StarRocks.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StarRocks.Generator</span><wbr>(<span class="base"><a href="mysql.html#MySQL.Generator">sqlglot.dialects.mysql.MySQL.Generator</a></span>): + + <label class="view-source-button" for="StarRocks.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StarRocks.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StarRocks.Generator-10"><a href="#StarRocks.Generator-10"><span class="linenos">10</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> <span class="c1"># type: ignore</span> +</span><span id="StarRocks.Generator-11"><a href="#StarRocks.Generator-11"><span class="linenos">11</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="StarRocks.Generator-12"><a href="#StarRocks.Generator-12"><span class="linenos">12</span></a> <span class="o">**</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="StarRocks.Generator-13"><a href="#StarRocks.Generator-13"><span class="linenos">13</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="s2">"STRING"</span><span class="p">,</span> +</span><span id="StarRocks.Generator-14"><a href="#StarRocks.Generator-14"><span class="linenos">14</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="s2">"DATETIME"</span><span class="p">,</span> +</span><span id="StarRocks.Generator-15"><a href="#StarRocks.Generator-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"DATETIME"</span><span class="p">,</span> +</span><span id="StarRocks.Generator-16"><a href="#StarRocks.Generator-16"><span class="linenos">16</span></a> <span class="p">}</span> +</span><span id="StarRocks.Generator-17"><a href="#StarRocks.Generator-17"><span class="linenos">17</span></a> +</span><span id="StarRocks.Generator-18"><a href="#StarRocks.Generator-18"><span class="linenos">18</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="StarRocks.Generator-19"><a href="#StarRocks.Generator-19"><span class="linenos">19</span></a> <span class="o">**</span><span class="n">MySQL</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="StarRocks.Generator-20"><a href="#StarRocks.Generator-20"><span class="linenos">20</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="StarRocks.Generator-21"><a href="#StarRocks.Generator-21"><span class="linenos">21</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">arrow_json_extract_sql</span><span class="p">,</span> +</span><span id="StarRocks.Generator-22"><a href="#StarRocks.Generator-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="StarRocks.Generator-23"><a href="#StarRocks.Generator-23"><span class="linenos">23</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToUnix</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"UNIX_TIMESTAMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="StarRocks.Generator-24"><a href="#StarRocks.Generator-24"><span class="linenos">24</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"TO_DATE"</span><span class="p">),</span> +</span><span id="StarRocks.Generator-25"><a href="#StarRocks.Generator-25"><span class="linenos">25</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"FROM_UNIXTIME(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="StarRocks.Generator-26"><a href="#StarRocks.Generator-26"><span class="linenos">26</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"FROM_UNIXTIME"</span><span class="p">),</span> +</span><span id="StarRocks.Generator-27"><a href="#StarRocks.Generator-27"><span class="linenos">27</span></a> <span class="p">}</span> +</span><span id="StarRocks.Generator-28"><a href="#StarRocks.Generator-28"><span class="linenos">28</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateTrunc</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="StarRocks.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="StarRocks.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="StarRocks.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="StarRocks.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="StarRocks.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="StarRocks.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="StarRocks.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="StarRocks.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="StarRocks.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="StarRocks.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="StarRocks.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="StarRocks.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="StarRocks.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="StarRocks.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="StarRocks.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="StarRocks.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="StarRocks.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="StarRocks.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="StarRocks.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="StarRocks.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="StarRocks.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="StarRocks.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="StarRocks.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="StarRocks.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="StarRocks.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="StarRocks.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="StarRocks.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="StarRocks.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="StarRocks.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="StarRocks.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="StarRocks.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="StarRocks.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="StarRocks.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="StarRocks.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="StarRocks.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="StarRocks.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="StarRocks.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="StarRocks.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="StarRocks.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="StarRocks.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="StarRocks.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="StarRocks.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="StarRocks.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="StarRocks.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="StarRocks.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="StarRocks.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="StarRocks.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="StarRocks.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="StarRocks.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="StarRocks.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="StarRocks.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="StarRocks.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="StarRocks.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="StarRocks.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="StarRocks.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="StarRocks.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="StarRocks.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="StarRocks.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="StarRocks.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="StarRocks.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="StarRocks.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="StarRocks.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="StarRocks.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="StarRocks.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="StarRocks.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="StarRocks.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="StarRocks.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="StarRocks.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="StarRocks.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="StarRocks.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="StarRocks.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="StarRocks.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="StarRocks.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="StarRocks.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="StarRocks.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="StarRocks.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="StarRocks.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="StarRocks.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="StarRocks.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="StarRocks.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="StarRocks.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="StarRocks.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="StarRocks.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="StarRocks.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="StarRocks.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="StarRocks.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="StarRocks.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="StarRocks.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="StarRocks.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="StarRocks.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="StarRocks.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="StarRocks.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="StarRocks.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="StarRocks.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="StarRocks.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="StarRocks.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="StarRocks.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="StarRocks.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="StarRocks.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="StarRocks.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="StarRocks.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="StarRocks.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="StarRocks.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="StarRocks.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="StarRocks.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="StarRocks.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="StarRocks.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="StarRocks.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="StarRocks.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="StarRocks.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="StarRocks.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="StarRocks.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="StarRocks.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="StarRocks.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="StarRocks.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="StarRocks.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="StarRocks.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="StarRocks.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="StarRocks.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="StarRocks.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="StarRocks.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="StarRocks.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="StarRocks.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="StarRocks.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="StarRocks.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="StarRocks.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="StarRocks.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="StarRocks.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="StarRocks.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="StarRocks.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="StarRocks.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="StarRocks.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="StarRocks.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="StarRocks.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="StarRocks.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="StarRocks.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="StarRocks.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="StarRocks.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="StarRocks.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="StarRocks.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="StarRocks.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="StarRocks.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="StarRocks.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="StarRocks.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="StarRocks.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="StarRocks.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="StarRocks.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="StarRocks.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="StarRocks.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="StarRocks.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="StarRocks.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="StarRocks.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="StarRocks.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="StarRocks.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="StarRocks.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="StarRocks.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="StarRocks.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="StarRocks.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="StarRocks.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="StarRocks.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="StarRocks.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="StarRocks.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="StarRocks.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="StarRocks.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="StarRocks.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="StarRocks.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="StarRocks.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="StarRocks.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="StarRocks.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="StarRocks.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="StarRocks.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="StarRocks.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="StarRocks.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="StarRocks.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="StarRocks.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="StarRocks.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="StarRocks.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="StarRocks.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="StarRocks.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="StarRocks.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="StarRocks.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="StarRocks.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="StarRocks.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="StarRocks.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="StarRocks.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="StarRocks.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="StarRocks.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="StarRocks.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="StarRocks.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="StarRocks.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="StarRocks.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="StarRocks.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="StarRocks.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="StarRocks.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="StarRocks.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="StarRocks.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="StarRocks.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="StarRocks.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="StarRocks.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="StarRocks.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + <div><dt><a href="mysql.html#MySQL.Generator">sqlglot.dialects.mysql.MySQL.Generator</a></dt> + <dd id="StarRocks.Generator.show_sql" class="function"><a href="mysql.html#MySQL.Generator.show_sql">show_sql</a></dd> + <dd id="StarRocks.Generator.setitem_sql" class="function"><a href="mysql.html#MySQL.Generator.setitem_sql">setitem_sql</a></dd> + <dd id="StarRocks.Generator.set_sql" class="function"><a href="mysql.html#MySQL.Generator.set_sql">set_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/tableau.html b/docs/sqlglot/dialects/tableau.html new file mode 100644 index 0000000..ce9359e --- /dev/null +++ b/docs/sqlglot/dialects/tableau.html @@ -0,0 +1,704 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.tableau API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Tableau">Tableau</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Tableau.__init__">Tableau</a> + </li> + <li> + <a class="class" href="#Tableau.Generator">Tableau.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Tableau.Parser">Tableau.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/tableau.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.tableau </h1> + + + <input id="mod-tableau-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-tableau-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">_if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'true'</span><span class="p">)</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'false'</span><span class="p">)</span><span class="si">}</span><span class="s2"> END"</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="k">def</span> <span class="nf">_coalesce_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IFNULL(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="k">def</span> <span class="nf">_count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a><span class="k">class</span> <span class="nc">Tableau</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">_if_sql</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">_coalesce_sql</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="n">_count_sql</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="p">}</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="p">}</span> +</span></pre></div> + + + </section> + <section id="Tableau"> + <input id="Tableau-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tableau</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Tableau-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tableau"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau-23"><a href="#Tableau-23"><span class="linenos">23</span></a><span class="k">class</span> <span class="nc">Tableau</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Tableau-24"><a href="#Tableau-24"><span class="linenos">24</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Tableau-25"><a href="#Tableau-25"><span class="linenos">25</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau-26"><a href="#Tableau-26"><span class="linenos">26</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Tableau-27"><a href="#Tableau-27"><span class="linenos">27</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">_if_sql</span><span class="p">,</span> +</span><span id="Tableau-28"><a href="#Tableau-28"><span class="linenos">28</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">_coalesce_sql</span><span class="p">,</span> +</span><span id="Tableau-29"><a href="#Tableau-29"><span class="linenos">29</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="n">_count_sql</span><span class="p">,</span> +</span><span id="Tableau-30"><a href="#Tableau-30"><span class="linenos">30</span></a> <span class="p">}</span> +</span><span id="Tableau-31"><a href="#Tableau-31"><span class="linenos">31</span></a> +</span><span id="Tableau-32"><a href="#Tableau-32"><span class="linenos">32</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Tableau-33"><a href="#Tableau-33"><span class="linenos">33</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau-34"><a href="#Tableau-34"><span class="linenos">34</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Tableau-35"><a href="#Tableau-35"><span class="linenos">35</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Tableau-36"><a href="#Tableau-36"><span class="linenos">36</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div id="Tableau.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Tableau</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Tableau.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Tableau.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Tableau.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Tableau.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Tableau.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Tableau.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Tableau.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Tableau.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Tableau.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Tableau.Generator"> + <input id="Tableau.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tableau.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Tableau.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tableau.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator-24"><a href="#Tableau.Generator-24"><span class="linenos">24</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Tableau.Generator-25"><a href="#Tableau.Generator-25"><span class="linenos">25</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau.Generator-26"><a href="#Tableau.Generator-26"><span class="linenos">26</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Tableau.Generator-27"><a href="#Tableau.Generator-27"><span class="linenos">27</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">_if_sql</span><span class="p">,</span> +</span><span id="Tableau.Generator-28"><a href="#Tableau.Generator-28"><span class="linenos">28</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">_coalesce_sql</span><span class="p">,</span> +</span><span id="Tableau.Generator-29"><a href="#Tableau.Generator-29"><span class="linenos">29</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="n">_count_sql</span><span class="p">,</span> +</span><span id="Tableau.Generator-30"><a href="#Tableau.Generator-30"><span class="linenos">30</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Tableau.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Tableau.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Tableau.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Tableau.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Tableau.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Tableau.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Tableau.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Tableau.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Tableau.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Tableau.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Tableau.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Tableau.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Tableau.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Tableau.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Tableau.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Tableau.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Tableau.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Tableau.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Tableau.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Tableau.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Tableau.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Tableau.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Tableau.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Tableau.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Tableau.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Tableau.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Tableau.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Tableau.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Tableau.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Tableau.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Tableau.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Tableau.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Tableau.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Tableau.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Tableau.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Tableau.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Tableau.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Tableau.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Tableau.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Tableau.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Tableau.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Tableau.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Tableau.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Tableau.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Tableau.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Tableau.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Tableau.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Tableau.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Tableau.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Tableau.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Tableau.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Tableau.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Tableau.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Tableau.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Tableau.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Tableau.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Tableau.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Tableau.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Tableau.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Tableau.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Tableau.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Tableau.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Tableau.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Tableau.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Tableau.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Tableau.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Tableau.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Tableau.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Tableau.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Tableau.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Tableau.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Tableau.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Tableau.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Tableau.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Tableau.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Tableau.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Tableau.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Tableau.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Tableau.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Tableau.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Tableau.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Tableau.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Tableau.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Tableau.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Tableau.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Tableau.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Tableau.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Tableau.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Tableau.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Tableau.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Tableau.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Tableau.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Tableau.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Tableau.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Tableau.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Tableau.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Tableau.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Tableau.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Tableau.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Tableau.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Tableau.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Tableau.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Tableau.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Tableau.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Tableau.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Tableau.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Tableau.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Tableau.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Tableau.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Tableau.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Tableau.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Tableau.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Tableau.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Tableau.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Tableau.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Tableau.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Tableau.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Tableau.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Tableau.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Tableau.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Tableau.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Tableau.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Tableau.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Tableau.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Tableau.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Tableau.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Tableau.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Tableau.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Tableau.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Tableau.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Tableau.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Tableau.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Tableau.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Tableau.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Tableau.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Tableau.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Tableau.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Tableau.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Tableau.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Tableau.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Tableau.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Tableau.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Tableau.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Tableau.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Tableau.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Tableau.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Tableau.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Tableau.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Tableau.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Tableau.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Tableau.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Tableau.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Tableau.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Tableau.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Tableau.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Tableau.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Tableau.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Tableau.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Tableau.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Tableau.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Tableau.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Tableau.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Tableau.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Tableau.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Tableau.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Tableau.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Tableau.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Tableau.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Tableau.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Tableau.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Tableau.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Tableau.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Tableau.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Tableau.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Tableau.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Tableau.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Tableau.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Tableau.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Tableau.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Tableau.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Tableau.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Tableau.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Tableau.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Tableau.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Tableau.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Tableau.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Tableau.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Tableau.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Tableau.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Tableau.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Tableau.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Tableau.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Tableau.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Tableau.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Tableau.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Tableau.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Tableau.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Tableau.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Tableau.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Tableau.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Tableau.Parser"> + <input id="Tableau.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tableau.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Tableau.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tableau.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Parser-32"><a href="#Tableau.Parser-32"><span class="linenos">32</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Tableau.Parser-33"><a href="#Tableau.Parser-33"><span class="linenos">33</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau.Parser-34"><a href="#Tableau.Parser-34"><span class="linenos">34</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Tableau.Parser-35"><a href="#Tableau.Parser-35"><span class="linenos">35</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Tableau.Parser-36"><a href="#Tableau.Parser-36"><span class="linenos">36</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Tableau.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Tableau.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Tableau.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Tableau.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Tableau.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Tableau.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Tableau.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Tableau.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/teradata.html b/docs/sqlglot/dialects/teradata.html new file mode 100644 index 0000000..ab5dfd2 --- /dev/null +++ b/docs/sqlglot/dialects/teradata.html @@ -0,0 +1,960 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.teradata API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Teradata">Teradata</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Teradata.__init__">Teradata</a> + </li> + <li> + <a class="class" href="#Teradata.Parser">Teradata.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Teradata.Generator">Teradata.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Teradata.Generator.partitionedbyproperty_sql">partitionedbyproperty_sql</a> + </li> + <li> + <a class="function" href="#Teradata.Generator.update_sql">update_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/teradata.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.teradata </h1> + + + <input id="mod-teradata-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-teradata-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">class</span> <span class="nc">Teradata</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="s2">"GRAPHIC_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="s2">"GRAPHIC_TO_LATIN"</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="s2">"GRAPHIC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="s2">"GRAPHIC_TO_UNICODE_PadSpace"</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="s2">"KANJI1_KanjiEBCDIC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="s2">"KANJI1_KanjiEUC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="s2">"KANJI1_KANJISJIS_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="s2">"KANJI1_SBC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="s2">"KANJISJIS_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="s2">"KANJISJIS_TO_LATIN"</span><span class="p">,</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="s2">"KANJISJIS_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="s2">"LATIN_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="s2">"LATIN_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="s2">"LATIN_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="s2">"LOCALE_TO_UNICODE"</span><span class="p">,</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="s2">"UNICODE_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="s2">"UNICODE_TO_GRAPHIC_PadGraphic"</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="s2">"UNICODE_TO_GRAPHIC_VarGraphic"</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="s2">"UNICODE_TO_KANJI1_KanjiEBCDIC"</span><span class="p">,</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="s2">"UNICODE_TO_KANJI1_KanjiEUC"</span><span class="p">,</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="s2">"UNICODE_TO_KANJI1_KANJISJIS"</span><span class="p">,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="s2">"UNICODE_TO_KANJI1_SBC"</span><span class="p">,</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="s2">"UNICODE_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="s2">"UNICODE_TO_LATIN"</span><span class="p">,</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="s2">"UNICODE_TO_LOCALE"</span><span class="p">,</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="s2">"UNICODE_TO_UNICODE_FoldSpace"</span><span class="p">,</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="s2">"UNICODE_TO_UNICODE_Fullwidth"</span><span class="p">,</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="s2">"UNICODE_TO_UNICODE_Halfwidth"</span><span class="p">,</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFC"</span><span class="p">,</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFD"</span><span class="p">,</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFKC"</span><span class="p">,</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFKD"</span><span class="p">,</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> <span class="p">}</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> <span class="s2">"TRANSLATE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="p">}</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected USING in TRANSLATE"</span><span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"_TO_"</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected a character set translator after USING in TRANSLATE"</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a> <span class="p">},</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a> <span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos">77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos">78</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos">79</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos">80</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos">81</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos">82</span></a> <span class="p">}</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos">83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos">84</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos">85</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos">86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos">87</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos">88</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos">89</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos">90</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos">91</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos">92</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos">93</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos">94</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos">95</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="Teradata"> + <input id="Teradata-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Teradata</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Teradata-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Teradata"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata-9"><a href="#Teradata-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">Teradata</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Teradata-10"><a href="#Teradata-10"><span class="linenos">10</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Teradata-11"><a href="#Teradata-11"><span class="linenos">11</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Teradata-12"><a href="#Teradata-12"><span class="linenos">12</span></a> <span class="s2">"GRAPHIC_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata-13"><a href="#Teradata-13"><span class="linenos">13</span></a> <span class="s2">"GRAPHIC_TO_LATIN"</span><span class="p">,</span> +</span><span id="Teradata-14"><a href="#Teradata-14"><span class="linenos">14</span></a> <span class="s2">"GRAPHIC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-15"><a href="#Teradata-15"><span class="linenos">15</span></a> <span class="s2">"GRAPHIC_TO_UNICODE_PadSpace"</span><span class="p">,</span> +</span><span id="Teradata-16"><a href="#Teradata-16"><span class="linenos">16</span></a> <span class="s2">"KANJI1_KanjiEBCDIC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-17"><a href="#Teradata-17"><span class="linenos">17</span></a> <span class="s2">"KANJI1_KanjiEUC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-18"><a href="#Teradata-18"><span class="linenos">18</span></a> <span class="s2">"KANJI1_KANJISJIS_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-19"><a href="#Teradata-19"><span class="linenos">19</span></a> <span class="s2">"KANJI1_SBC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-20"><a href="#Teradata-20"><span class="linenos">20</span></a> <span class="s2">"KANJISJIS_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="Teradata-21"><a href="#Teradata-21"><span class="linenos">21</span></a> <span class="s2">"KANJISJIS_TO_LATIN"</span><span class="p">,</span> +</span><span id="Teradata-22"><a href="#Teradata-22"><span class="linenos">22</span></a> <span class="s2">"KANJISJIS_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-23"><a href="#Teradata-23"><span class="linenos">23</span></a> <span class="s2">"LATIN_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="Teradata-24"><a href="#Teradata-24"><span class="linenos">24</span></a> <span class="s2">"LATIN_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata-25"><a href="#Teradata-25"><span class="linenos">25</span></a> <span class="s2">"LATIN_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-26"><a href="#Teradata-26"><span class="linenos">26</span></a> <span class="s2">"LOCALE_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata-27"><a href="#Teradata-27"><span class="linenos">27</span></a> <span class="s2">"UNICODE_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="Teradata-28"><a href="#Teradata-28"><span class="linenos">28</span></a> <span class="s2">"UNICODE_TO_GRAPHIC_PadGraphic"</span><span class="p">,</span> +</span><span id="Teradata-29"><a href="#Teradata-29"><span class="linenos">29</span></a> <span class="s2">"UNICODE_TO_GRAPHIC_VarGraphic"</span><span class="p">,</span> +</span><span id="Teradata-30"><a href="#Teradata-30"><span class="linenos">30</span></a> <span class="s2">"UNICODE_TO_KANJI1_KanjiEBCDIC"</span><span class="p">,</span> +</span><span id="Teradata-31"><a href="#Teradata-31"><span class="linenos">31</span></a> <span class="s2">"UNICODE_TO_KANJI1_KanjiEUC"</span><span class="p">,</span> +</span><span id="Teradata-32"><a href="#Teradata-32"><span class="linenos">32</span></a> <span class="s2">"UNICODE_TO_KANJI1_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata-33"><a href="#Teradata-33"><span class="linenos">33</span></a> <span class="s2">"UNICODE_TO_KANJI1_SBC"</span><span class="p">,</span> +</span><span id="Teradata-34"><a href="#Teradata-34"><span class="linenos">34</span></a> <span class="s2">"UNICODE_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata-35"><a href="#Teradata-35"><span class="linenos">35</span></a> <span class="s2">"UNICODE_TO_LATIN"</span><span class="p">,</span> +</span><span id="Teradata-36"><a href="#Teradata-36"><span class="linenos">36</span></a> <span class="s2">"UNICODE_TO_LOCALE"</span><span class="p">,</span> +</span><span id="Teradata-37"><a href="#Teradata-37"><span class="linenos">37</span></a> <span class="s2">"UNICODE_TO_UNICODE_FoldSpace"</span><span class="p">,</span> +</span><span id="Teradata-38"><a href="#Teradata-38"><span class="linenos">38</span></a> <span class="s2">"UNICODE_TO_UNICODE_Fullwidth"</span><span class="p">,</span> +</span><span id="Teradata-39"><a href="#Teradata-39"><span class="linenos">39</span></a> <span class="s2">"UNICODE_TO_UNICODE_Halfwidth"</span><span class="p">,</span> +</span><span id="Teradata-40"><a href="#Teradata-40"><span class="linenos">40</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFC"</span><span class="p">,</span> +</span><span id="Teradata-41"><a href="#Teradata-41"><span class="linenos">41</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFD"</span><span class="p">,</span> +</span><span id="Teradata-42"><a href="#Teradata-42"><span class="linenos">42</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFKC"</span><span class="p">,</span> +</span><span id="Teradata-43"><a href="#Teradata-43"><span class="linenos">43</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFKD"</span><span class="p">,</span> +</span><span id="Teradata-44"><a href="#Teradata-44"><span class="linenos">44</span></a> <span class="p">}</span> +</span><span id="Teradata-45"><a href="#Teradata-45"><span class="linenos">45</span></a> +</span><span id="Teradata-46"><a href="#Teradata-46"><span class="linenos">46</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Teradata-47"><a href="#Teradata-47"><span class="linenos">47</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Teradata-48"><a href="#Teradata-48"><span class="linenos">48</span></a> <span class="s2">"TRANSLATE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="Teradata-49"><a href="#Teradata-49"><span class="linenos">49</span></a> <span class="p">}</span> +</span><span id="Teradata-50"><a href="#Teradata-50"><span class="linenos">50</span></a> +</span><span id="Teradata-51"><a href="#Teradata-51"><span class="linenos">51</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Teradata-52"><a href="#Teradata-52"><span class="linenos">52</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Teradata-53"><a href="#Teradata-53"><span class="linenos">53</span></a> +</span><span id="Teradata-54"><a href="#Teradata-54"><span class="linenos">54</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="Teradata-55"><a href="#Teradata-55"><span class="linenos">55</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected USING in TRANSLATE"</span><span class="p">)</span> +</span><span id="Teradata-56"><a href="#Teradata-56"><span class="linenos">56</span></a> +</span><span id="Teradata-57"><a href="#Teradata-57"><span class="linenos">57</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span> +</span><span id="Teradata-58"><a href="#Teradata-58"><span class="linenos">58</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"_TO_"</span><span class="p">)</span> +</span><span id="Teradata-59"><a href="#Teradata-59"><span class="linenos">59</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> +</span><span id="Teradata-60"><a href="#Teradata-60"><span class="linenos">60</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Teradata-61"><a href="#Teradata-61"><span class="linenos">61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected a character set translator after USING in TRANSLATE"</span><span class="p">)</span> +</span><span id="Teradata-62"><a href="#Teradata-62"><span class="linenos">62</span></a> +</span><span id="Teradata-63"><a href="#Teradata-63"><span class="linenos">63</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="Teradata-64"><a href="#Teradata-64"><span class="linenos">64</span></a> +</span><span id="Teradata-65"><a href="#Teradata-65"><span class="linenos">65</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="Teradata-66"><a href="#Teradata-66"><span class="linenos">66</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span> +</span><span id="Teradata-67"><a href="#Teradata-67"><span class="linenos">67</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Teradata-68"><a href="#Teradata-68"><span class="linenos">68</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Teradata-69"><a href="#Teradata-69"><span class="linenos">69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="Teradata-70"><a href="#Teradata-70"><span class="linenos">70</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="Teradata-71"><a href="#Teradata-71"><span class="linenos">71</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span> +</span><span id="Teradata-72"><a href="#Teradata-72"><span class="linenos">72</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="Teradata-73"><a href="#Teradata-73"><span class="linenos">73</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> +</span><span id="Teradata-74"><a href="#Teradata-74"><span class="linenos">74</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="Teradata-75"><a href="#Teradata-75"><span class="linenos">75</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="Teradata-76"><a href="#Teradata-76"><span class="linenos">76</span></a> <span class="p">},</span> +</span><span id="Teradata-77"><a href="#Teradata-77"><span class="linenos">77</span></a> <span class="p">)</span> +</span><span id="Teradata-78"><a href="#Teradata-78"><span class="linenos">78</span></a> +</span><span id="Teradata-79"><a href="#Teradata-79"><span class="linenos">79</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Teradata-80"><a href="#Teradata-80"><span class="linenos">80</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Teradata-81"><a href="#Teradata-81"><span class="linenos">81</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Teradata-82"><a href="#Teradata-82"><span class="linenos">82</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">,</span> +</span><span id="Teradata-83"><a href="#Teradata-83"><span class="linenos">83</span></a> <span class="p">}</span> +</span><span id="Teradata-84"><a href="#Teradata-84"><span class="linenos">84</span></a> +</span><span id="Teradata-85"><a href="#Teradata-85"><span class="linenos">85</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-86"><a href="#Teradata-86"><span class="linenos">86</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata-87"><a href="#Teradata-87"><span class="linenos">87</span></a> +</span><span id="Teradata-88"><a href="#Teradata-88"><span class="linenos">88</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="Teradata-89"><a href="#Teradata-89"><span class="linenos">89</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span> +</span><span id="Teradata-90"><a href="#Teradata-90"><span class="linenos">90</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-91"><a href="#Teradata-91"><span class="linenos">91</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata-92"><a href="#Teradata-92"><span class="linenos">92</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="Teradata-93"><a href="#Teradata-93"><span class="linenos">93</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Teradata-94"><a href="#Teradata-94"><span class="linenos">94</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Teradata-95"><a href="#Teradata-95"><span class="linenos">95</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata-96"><a href="#Teradata-96"><span class="linenos">96</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Teradata.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Teradata</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Teradata.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Teradata.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Teradata.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Teradata.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Teradata.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Teradata.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Teradata.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Teradata.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Teradata.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Teradata.Parser"> + <input id="Teradata.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Teradata.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="Teradata.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Teradata.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Parser-10"><a href="#Teradata.Parser-10"><span class="linenos">10</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Teradata.Parser-11"><a href="#Teradata.Parser-11"><span class="linenos">11</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Teradata.Parser-12"><a href="#Teradata.Parser-12"><span class="linenos">12</span></a> <span class="s2">"GRAPHIC_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata.Parser-13"><a href="#Teradata.Parser-13"><span class="linenos">13</span></a> <span class="s2">"GRAPHIC_TO_LATIN"</span><span class="p">,</span> +</span><span id="Teradata.Parser-14"><a href="#Teradata.Parser-14"><span class="linenos">14</span></a> <span class="s2">"GRAPHIC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-15"><a href="#Teradata.Parser-15"><span class="linenos">15</span></a> <span class="s2">"GRAPHIC_TO_UNICODE_PadSpace"</span><span class="p">,</span> +</span><span id="Teradata.Parser-16"><a href="#Teradata.Parser-16"><span class="linenos">16</span></a> <span class="s2">"KANJI1_KanjiEBCDIC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-17"><a href="#Teradata.Parser-17"><span class="linenos">17</span></a> <span class="s2">"KANJI1_KanjiEUC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-18"><a href="#Teradata.Parser-18"><span class="linenos">18</span></a> <span class="s2">"KANJI1_KANJISJIS_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-19"><a href="#Teradata.Parser-19"><span class="linenos">19</span></a> <span class="s2">"KANJI1_SBC_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-20"><a href="#Teradata.Parser-20"><span class="linenos">20</span></a> <span class="s2">"KANJISJIS_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-21"><a href="#Teradata.Parser-21"><span class="linenos">21</span></a> <span class="s2">"KANJISJIS_TO_LATIN"</span><span class="p">,</span> +</span><span id="Teradata.Parser-22"><a href="#Teradata.Parser-22"><span class="linenos">22</span></a> <span class="s2">"KANJISJIS_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-23"><a href="#Teradata.Parser-23"><span class="linenos">23</span></a> <span class="s2">"LATIN_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-24"><a href="#Teradata.Parser-24"><span class="linenos">24</span></a> <span class="s2">"LATIN_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata.Parser-25"><a href="#Teradata.Parser-25"><span class="linenos">25</span></a> <span class="s2">"LATIN_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-26"><a href="#Teradata.Parser-26"><span class="linenos">26</span></a> <span class="s2">"LOCALE_TO_UNICODE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-27"><a href="#Teradata.Parser-27"><span class="linenos">27</span></a> <span class="s2">"UNICODE_TO_GRAPHIC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-28"><a href="#Teradata.Parser-28"><span class="linenos">28</span></a> <span class="s2">"UNICODE_TO_GRAPHIC_PadGraphic"</span><span class="p">,</span> +</span><span id="Teradata.Parser-29"><a href="#Teradata.Parser-29"><span class="linenos">29</span></a> <span class="s2">"UNICODE_TO_GRAPHIC_VarGraphic"</span><span class="p">,</span> +</span><span id="Teradata.Parser-30"><a href="#Teradata.Parser-30"><span class="linenos">30</span></a> <span class="s2">"UNICODE_TO_KANJI1_KanjiEBCDIC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-31"><a href="#Teradata.Parser-31"><span class="linenos">31</span></a> <span class="s2">"UNICODE_TO_KANJI1_KanjiEUC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-32"><a href="#Teradata.Parser-32"><span class="linenos">32</span></a> <span class="s2">"UNICODE_TO_KANJI1_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata.Parser-33"><a href="#Teradata.Parser-33"><span class="linenos">33</span></a> <span class="s2">"UNICODE_TO_KANJI1_SBC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-34"><a href="#Teradata.Parser-34"><span class="linenos">34</span></a> <span class="s2">"UNICODE_TO_KANJISJIS"</span><span class="p">,</span> +</span><span id="Teradata.Parser-35"><a href="#Teradata.Parser-35"><span class="linenos">35</span></a> <span class="s2">"UNICODE_TO_LATIN"</span><span class="p">,</span> +</span><span id="Teradata.Parser-36"><a href="#Teradata.Parser-36"><span class="linenos">36</span></a> <span class="s2">"UNICODE_TO_LOCALE"</span><span class="p">,</span> +</span><span id="Teradata.Parser-37"><a href="#Teradata.Parser-37"><span class="linenos">37</span></a> <span class="s2">"UNICODE_TO_UNICODE_FoldSpace"</span><span class="p">,</span> +</span><span id="Teradata.Parser-38"><a href="#Teradata.Parser-38"><span class="linenos">38</span></a> <span class="s2">"UNICODE_TO_UNICODE_Fullwidth"</span><span class="p">,</span> +</span><span id="Teradata.Parser-39"><a href="#Teradata.Parser-39"><span class="linenos">39</span></a> <span class="s2">"UNICODE_TO_UNICODE_Halfwidth"</span><span class="p">,</span> +</span><span id="Teradata.Parser-40"><a href="#Teradata.Parser-40"><span class="linenos">40</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-41"><a href="#Teradata.Parser-41"><span class="linenos">41</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFD"</span><span class="p">,</span> +</span><span id="Teradata.Parser-42"><a href="#Teradata.Parser-42"><span class="linenos">42</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFKC"</span><span class="p">,</span> +</span><span id="Teradata.Parser-43"><a href="#Teradata.Parser-43"><span class="linenos">43</span></a> <span class="s2">"UNICODE_TO_UNICODE_NFKD"</span><span class="p">,</span> +</span><span id="Teradata.Parser-44"><a href="#Teradata.Parser-44"><span class="linenos">44</span></a> <span class="p">}</span> +</span><span id="Teradata.Parser-45"><a href="#Teradata.Parser-45"><span class="linenos">45</span></a> +</span><span id="Teradata.Parser-46"><a href="#Teradata.Parser-46"><span class="linenos">46</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Teradata.Parser-47"><a href="#Teradata.Parser-47"><span class="linenos">47</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Teradata.Parser-48"><a href="#Teradata.Parser-48"><span class="linenos">48</span></a> <span class="s2">"TRANSLATE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="Teradata.Parser-49"><a href="#Teradata.Parser-49"><span class="linenos">49</span></a> <span class="p">}</span> +</span><span id="Teradata.Parser-50"><a href="#Teradata.Parser-50"><span class="linenos">50</span></a> +</span><span id="Teradata.Parser-51"><a href="#Teradata.Parser-51"><span class="linenos">51</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Teradata.Parser-52"><a href="#Teradata.Parser-52"><span class="linenos">52</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Teradata.Parser-53"><a href="#Teradata.Parser-53"><span class="linenos">53</span></a> +</span><span id="Teradata.Parser-54"><a href="#Teradata.Parser-54"><span class="linenos">54</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="Teradata.Parser-55"><a href="#Teradata.Parser-55"><span class="linenos">55</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected USING in TRANSLATE"</span><span class="p">)</span> +</span><span id="Teradata.Parser-56"><a href="#Teradata.Parser-56"><span class="linenos">56</span></a> +</span><span id="Teradata.Parser-57"><a href="#Teradata.Parser-57"><span class="linenos">57</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span> +</span><span id="Teradata.Parser-58"><a href="#Teradata.Parser-58"><span class="linenos">58</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"_TO_"</span><span class="p">)</span> +</span><span id="Teradata.Parser-59"><a href="#Teradata.Parser-59"><span class="linenos">59</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> +</span><span id="Teradata.Parser-60"><a href="#Teradata.Parser-60"><span class="linenos">60</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Teradata.Parser-61"><a href="#Teradata.Parser-61"><span class="linenos">61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected a character set translator after USING in TRANSLATE"</span><span class="p">)</span> +</span><span id="Teradata.Parser-62"><a href="#Teradata.Parser-62"><span class="linenos">62</span></a> +</span><span id="Teradata.Parser-63"><a href="#Teradata.Parser-63"><span class="linenos">63</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="Teradata.Parser-64"><a href="#Teradata.Parser-64"><span class="linenos">64</span></a> +</span><span id="Teradata.Parser-65"><a href="#Teradata.Parser-65"><span class="linenos">65</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="Teradata.Parser-66"><a href="#Teradata.Parser-66"><span class="linenos">66</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span> +</span><span id="Teradata.Parser-67"><a href="#Teradata.Parser-67"><span class="linenos">67</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Teradata.Parser-68"><a href="#Teradata.Parser-68"><span class="linenos">68</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Teradata.Parser-69"><a href="#Teradata.Parser-69"><span class="linenos">69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="Teradata.Parser-70"><a href="#Teradata.Parser-70"><span class="linenos">70</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="Teradata.Parser-71"><a href="#Teradata.Parser-71"><span class="linenos">71</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span> +</span><span id="Teradata.Parser-72"><a href="#Teradata.Parser-72"><span class="linenos">72</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="Teradata.Parser-73"><a href="#Teradata.Parser-73"><span class="linenos">73</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> +</span><span id="Teradata.Parser-74"><a href="#Teradata.Parser-74"><span class="linenos">74</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="Teradata.Parser-75"><a href="#Teradata.Parser-75"><span class="linenos">75</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="Teradata.Parser-76"><a href="#Teradata.Parser-76"><span class="linenos">76</span></a> <span class="p">},</span> +</span><span id="Teradata.Parser-77"><a href="#Teradata.Parser-77"><span class="linenos">77</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="Teradata.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="Teradata.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="Teradata.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="Teradata.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="Teradata.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="Teradata.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="Teradata.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="Teradata.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Teradata.Generator"> + <input id="Teradata.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Teradata.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Teradata.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Teradata.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator-79"><a href="#Teradata.Generator-79"><span class="linenos">79</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Teradata.Generator-80"><a href="#Teradata.Generator-80"><span class="linenos">80</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Teradata.Generator-81"><a href="#Teradata.Generator-81"><span class="linenos">81</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Teradata.Generator-82"><a href="#Teradata.Generator-82"><span class="linenos">82</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">,</span> +</span><span id="Teradata.Generator-83"><a href="#Teradata.Generator-83"><span class="linenos">83</span></a> <span class="p">}</span> +</span><span id="Teradata.Generator-84"><a href="#Teradata.Generator-84"><span class="linenos">84</span></a> +</span><span id="Teradata.Generator-85"><a href="#Teradata.Generator-85"><span class="linenos">85</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator-86"><a href="#Teradata.Generator-86"><span class="linenos">86</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata.Generator-87"><a href="#Teradata.Generator-87"><span class="linenos">87</span></a> +</span><span id="Teradata.Generator-88"><a href="#Teradata.Generator-88"><span class="linenos">88</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="Teradata.Generator-89"><a href="#Teradata.Generator-89"><span class="linenos">89</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span> +</span><span id="Teradata.Generator-90"><a href="#Teradata.Generator-90"><span class="linenos">90</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator-91"><a href="#Teradata.Generator-91"><span class="linenos">91</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata.Generator-92"><a href="#Teradata.Generator-92"><span class="linenos">92</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="Teradata.Generator-93"><a href="#Teradata.Generator-93"><span class="linenos">93</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Teradata.Generator-94"><a href="#Teradata.Generator-94"><span class="linenos">94</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Teradata.Generator-95"><a href="#Teradata.Generator-95"><span class="linenos">95</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata.Generator-96"><a href="#Teradata.Generator-96"><span class="linenos">96</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Teradata.Generator.partitionedbyproperty_sql" class="classattr"> + <input id="Teradata.Generator.partitionedbyproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">partitionedbyproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#PartitionedByProperty">sqlglot.expressions.PartitionedByProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Teradata.Generator.partitionedbyproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Teradata.Generator.partitionedbyproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.partitionedbyproperty_sql-85"><a href="#Teradata.Generator.partitionedbyproperty_sql-85"><span class="linenos">85</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.partitionedbyproperty_sql-86"><a href="#Teradata.Generator.partitionedbyproperty_sql-86"><span class="linenos">86</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Teradata.Generator.update_sql" class="classattr"> + <input id="Teradata.Generator.update_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">update_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Update">sqlglot.expressions.Update</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Teradata.Generator.update_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Teradata.Generator.update_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.update_sql-90"><a href="#Teradata.Generator.update_sql-90"><span class="linenos">90</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.update_sql-91"><a href="#Teradata.Generator.update_sql-91"><span class="linenos">91</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-92"><a href="#Teradata.Generator.update_sql-92"><span class="linenos">92</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-93"><a href="#Teradata.Generator.update_sql-93"><span class="linenos">93</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-94"><a href="#Teradata.Generator.update_sql-94"><span class="linenos">94</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-95"><a href="#Teradata.Generator.update_sql-95"><span class="linenos">95</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata.Generator.update_sql-96"><a href="#Teradata.Generator.update_sql-96"><span class="linenos">96</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Teradata.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Teradata.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Teradata.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Teradata.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Teradata.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Teradata.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Teradata.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Teradata.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Teradata.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Teradata.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Teradata.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Teradata.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Teradata.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Teradata.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Teradata.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Teradata.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Teradata.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Teradata.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Teradata.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Teradata.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Teradata.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Teradata.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Teradata.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Teradata.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Teradata.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Teradata.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Teradata.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Teradata.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Teradata.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Teradata.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Teradata.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Teradata.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Teradata.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Teradata.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Teradata.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Teradata.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Teradata.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Teradata.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Teradata.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Teradata.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Teradata.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Teradata.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Teradata.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Teradata.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Teradata.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Teradata.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Teradata.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Teradata.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Teradata.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Teradata.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Teradata.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Teradata.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Teradata.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Teradata.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Teradata.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Teradata.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Teradata.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Teradata.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Teradata.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Teradata.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Teradata.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Teradata.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Teradata.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Teradata.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Teradata.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Teradata.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Teradata.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Teradata.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Teradata.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Teradata.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Teradata.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Teradata.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Teradata.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Teradata.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Teradata.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Teradata.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Teradata.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Teradata.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Teradata.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Teradata.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Teradata.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Teradata.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Teradata.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Teradata.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Teradata.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Teradata.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Teradata.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Teradata.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Teradata.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Teradata.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Teradata.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Teradata.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Teradata.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Teradata.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Teradata.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Teradata.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Teradata.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Teradata.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Teradata.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Teradata.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Teradata.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Teradata.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Teradata.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Teradata.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Teradata.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Teradata.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Teradata.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Teradata.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Teradata.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Teradata.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Teradata.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Teradata.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Teradata.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Teradata.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Teradata.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Teradata.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Teradata.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Teradata.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Teradata.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Teradata.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Teradata.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Teradata.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Teradata.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Teradata.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Teradata.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Teradata.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Teradata.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Teradata.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Teradata.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Teradata.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Teradata.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Teradata.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Teradata.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Teradata.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Teradata.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Teradata.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Teradata.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Teradata.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Teradata.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Teradata.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Teradata.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Teradata.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Teradata.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Teradata.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Teradata.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Teradata.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Teradata.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Teradata.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Teradata.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Teradata.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Teradata.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Teradata.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Teradata.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Teradata.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Teradata.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Teradata.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Teradata.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Teradata.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Teradata.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Teradata.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Teradata.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Teradata.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Teradata.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Teradata.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Teradata.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Teradata.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Teradata.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Teradata.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Teradata.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Teradata.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Teradata.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Teradata.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Teradata.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Teradata.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Teradata.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Teradata.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Teradata.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Teradata.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Teradata.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Teradata.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Teradata.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Teradata.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Teradata.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Teradata.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Teradata.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Teradata.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Teradata.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Teradata.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Teradata.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Teradata.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Teradata.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Teradata.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Teradata.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Teradata.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Teradata.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Teradata.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Teradata.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Teradata.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Teradata.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Teradata.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/trino.html b/docs/sqlglot/dialects/trino.html new file mode 100644 index 0000000..2584557 --- /dev/null +++ b/docs/sqlglot/dialects/trino.html @@ -0,0 +1,653 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.trino API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Trino">Trino</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Trino.__init__">Trino</a> + </li> + <li> + <a class="class" href="#Trino.Generator">Trino.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Trino.Tokenizer">Trino.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/trino.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.trino </h1> + + + <input id="mod-trino-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-trino-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.presto</span> <span class="kn">import</span> <span class="n">Presto</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">class</span> <span class="nc">Trino</span><span class="p">(</span><span class="n">Presto</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="o">**</span><span class="n">Presto</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"REDUCE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, 0, (acc, x) -> acc + x, acc -> acc)"</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="p">}</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span></pre></div> + + + </section> + <section id="Trino"> + <input id="Trino-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Trino</span><wbr>(<span class="base"><a href="presto.html#Presto">sqlglot.dialects.presto.Presto</a></span>): + + <label class="view-source-button" for="Trino-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Trino"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Trino-8"><a href="#Trino-8"><span class="linenos"> 8</span></a><span class="k">class</span> <span class="nc">Trino</span><span class="p">(</span><span class="n">Presto</span><span class="p">):</span> +</span><span id="Trino-9"><a href="#Trino-9"><span class="linenos"> 9</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Trino-10"><a href="#Trino-10"><span class="linenos">10</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Trino-11"><a href="#Trino-11"><span class="linenos">11</span></a> <span class="o">**</span><span class="n">Presto</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Trino-12"><a href="#Trino-12"><span class="linenos">12</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"REDUCE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, 0, (acc, x) -> acc + x, acc -> acc)"</span><span class="p">,</span> +</span><span id="Trino-13"><a href="#Trino-13"><span class="linenos">13</span></a> <span class="p">}</span> +</span><span id="Trino-14"><a href="#Trino-14"><span class="linenos">14</span></a> +</span><span id="Trino-15"><a href="#Trino-15"><span class="linenos">15</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Trino-16"><a href="#Trino-16"><span class="linenos">16</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span></pre></div> + + + + + <div id="Trino.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Trino</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Trino.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="presto.html#Presto">sqlglot.dialects.presto.Presto</a></dt> + <dd id="Trino.Parser" class="class"><a href="presto.html#Presto.Parser">Parser</a></dd> + + </div> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Trino.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Trino.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Trino.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="Trino.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Trino.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="Trino.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Trino.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="Trino.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Trino.Generator"> + <input id="Trino.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Trino.Generator</span><wbr>(<span class="base"><a href="presto.html#Presto.Generator">sqlglot.dialects.presto.Presto.Generator</a></span>): + + <label class="view-source-button" for="Trino.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Trino.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Trino.Generator-9"><a href="#Trino.Generator-9"><span class="linenos"> 9</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Trino.Generator-10"><a href="#Trino.Generator-10"><span class="linenos">10</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Trino.Generator-11"><a href="#Trino.Generator-11"><span class="linenos">11</span></a> <span class="o">**</span><span class="n">Presto</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="Trino.Generator-12"><a href="#Trino.Generator-12"><span class="linenos">12</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArraySum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"REDUCE(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, 0, (acc, x) -> acc + x, acc -> acc)"</span><span class="p">,</span> +</span><span id="Trino.Generator-13"><a href="#Trino.Generator-13"><span class="linenos">13</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Trino.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Trino.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Trino.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Trino.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Trino.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Trino.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Trino.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Trino.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Trino.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Trino.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Trino.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Trino.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Trino.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Trino.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Trino.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Trino.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Trino.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Trino.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Trino.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Trino.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Trino.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Trino.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Trino.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Trino.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Trino.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Trino.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Trino.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Trino.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Trino.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Trino.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Trino.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Trino.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Trino.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Trino.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Trino.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Trino.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Trino.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Trino.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Trino.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Trino.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Trino.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Trino.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Trino.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Trino.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Trino.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Trino.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Trino.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Trino.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Trino.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Trino.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Trino.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Trino.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Trino.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Trino.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Trino.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Trino.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Trino.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Trino.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Trino.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Trino.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Trino.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Trino.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Trino.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Trino.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Trino.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Trino.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Trino.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Trino.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Trino.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Trino.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Trino.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Trino.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Trino.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Trino.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Trino.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Trino.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Trino.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Trino.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Trino.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Trino.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Trino.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Trino.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Trino.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Trino.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Trino.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Trino.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Trino.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Trino.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Trino.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Trino.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Trino.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Trino.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Trino.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Trino.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Trino.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Trino.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Trino.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Trino.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Trino.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Trino.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Trino.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Trino.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Trino.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Trino.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Trino.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Trino.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Trino.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Trino.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Trino.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Trino.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Trino.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Trino.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Trino.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Trino.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Trino.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Trino.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Trino.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Trino.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Trino.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Trino.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Trino.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Trino.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Trino.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Trino.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Trino.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Trino.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Trino.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Trino.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Trino.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Trino.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Trino.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Trino.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Trino.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Trino.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Trino.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Trino.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Trino.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Trino.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Trino.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Trino.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Trino.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Trino.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Trino.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Trino.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Trino.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Trino.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Trino.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Trino.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Trino.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Trino.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Trino.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Trino.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Trino.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Trino.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Trino.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Trino.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Trino.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Trino.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Trino.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Trino.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Trino.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Trino.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Trino.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Trino.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Trino.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Trino.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Trino.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Trino.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Trino.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Trino.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Trino.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Trino.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Trino.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Trino.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Trino.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Trino.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Trino.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Trino.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Trino.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Trino.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Trino.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Trino.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Trino.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Trino.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Trino.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Trino.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Trino.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Trino.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Trino.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Trino.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Trino.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Trino.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Trino.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Trino.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Trino.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Trino.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Trino.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Trino.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Trino.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Trino.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + <div><dt><a href="presto.html#Presto.Generator">sqlglot.dialects.presto.Presto.Generator</a></dt> + <dd id="Trino.Generator.transaction_sql" class="function"><a href="presto.html#Presto.Generator.transaction_sql">transaction_sql</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Trino.Tokenizer"> + <input id="Trino.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Trino.Tokenizer</span><wbr>(<span class="base"><a href="presto.html#Presto.Tokenizer">sqlglot.dialects.presto.Presto.Tokenizer</a></span>): + + <label class="view-source-button" for="Trino.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Trino.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Trino.Tokenizer-15"><a href="#Trino.Tokenizer-15"><span class="linenos">15</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Presto</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Trino.Tokenizer-16"><a href="#Trino.Tokenizer-16"><span class="linenos">16</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[(</span><span class="s2">"X'"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">)]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Trino.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Trino.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Trino.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/dialects/tsql.html b/docs/sqlglot/dialects/tsql.html new file mode 100644 index 0000000..40e29e6 --- /dev/null +++ b/docs/sqlglot/dialects/tsql.html @@ -0,0 +1,1772 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.dialects.tsql API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../dialects.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.dialects</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#generate_date_delta_with_unit_sql">generate_date_delta_with_unit_sql</a> + </li> + <li> + <a class="class" href="#TSQL">TSQL</a> + <ul class="memberlist"> + <li> + <a class="function" href="#TSQL.__init__">TSQL</a> + </li> + <li> + <a class="class" href="#TSQL.Tokenizer">TSQL.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TSQL.Parser">TSQL.Parser</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TSQL.Generator">TSQL.Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#TSQL.Generator.systemtime_sql">systemtime_sql</a> + </li> + <li> + <a class="function" href="#TSQL.Generator.returnsproperty_sql">returnsproperty_sql</a> + </li> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/dialects/tsql.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../dialects.html">dialects</a><wbr>.tsql </h1> + + + <input id="mod-tsql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-tsql-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">re</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">parse_date_delta</span><span class="p">,</span> <span class="n">rename_func</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">DataType</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">seq_get</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.time</span> <span class="kn">import</span> <span class="n">format_time</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="n">FULL_FORMAT_TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="s2">"weekday"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="s2">"dw"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="s2">"w"</span><span class="p">:</span> <span class="s2">"%A"</span><span class="p">,</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="s2">"month"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="p">}</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="n">DATE_DELTA_INTERVAL</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="s2">"year"</span><span class="p">:</span> <span class="s2">"year"</span><span class="p">,</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"year"</span><span class="p">,</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"year"</span><span class="p">,</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="s2">"quarter"</span><span class="p">:</span> <span class="s2">"quarter"</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="s2">"qq"</span><span class="p">:</span> <span class="s2">"quarter"</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="s2">"q"</span><span class="p">:</span> <span class="s2">"quarter"</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="s2">"month"</span><span class="p">:</span> <span class="s2">"month"</span><span class="p">,</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"month"</span><span class="p">,</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"month"</span><span class="p">,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="s2">"week"</span><span class="p">:</span> <span class="s2">"week"</span><span class="p">,</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="s2">"ww"</span><span class="p">:</span> <span class="s2">"week"</span><span class="p">,</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="s2">"wk"</span><span class="p">:</span> <span class="s2">"week"</span><span class="p">,</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="s2">"day"</span><span class="p">:</span> <span class="s2">"day"</span><span class="p">,</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"day"</span><span class="p">,</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"day"</span><span class="p">,</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a><span class="p">}</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="n">DATE_FMT_RE</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s2">"([dD]{1,2})|([mM]{1,2})|([yY]{1,4})|([hH]{1,2})|([sS]{1,2})"</span><span class="p">)</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="c1"># N = Numeric, C=Currency</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="n">TRANSPILE_SAFE_NUMBER_FMT</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"N"</span><span class="p">,</span> <span class="s2">"C"</span><span class="p">}</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="k">def</span> <span class="nf">_format_time_lambda</span><span class="p">(</span><span class="n">exp_class</span><span class="p">,</span> <span class="n">full_format_mapping</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">def</span> <span class="nf">_format_time</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">return</span> <span class="n">exp_class</span><span class="p">(</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="nb">format</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">format_time</span><span class="p">(</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="p">(</span><span class="n">TSQL</span><span class="o">.</span><span class="n">time_format</span> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="kc">True</span> <span class="k">else</span> <span class="n">default</span><span class="p">),</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="p">{</span><span class="o">**</span><span class="n">TSQL</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> <span class="o">**</span><span class="n">FULL_FORMAT_TIME_MAPPING</span><span class="p">}</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">if</span> <span class="n">full_format_mapping</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">else</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="p">),</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">return</span> <span class="n">_format_time</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a><span class="k">def</span> <span class="nf">_parse_format</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">fmt</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">number_fmt</span> <span class="o">=</span> <span class="n">fmt</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">TRANSPILE_SAFE_NUMBER_FMT</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">DATE_FMT_RE</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">fmt</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">if</span> <span class="n">number_fmt</span><span class="p">:</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="nb">format</span><span class="o">=</span><span class="n">fmt</span><span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">(</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="nb">format</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">format_time</span><span class="p">(</span><span class="n">fmt</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">format_time_mapping</span><span class="p">)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">fmt</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">else</span> <span class="n">format_time</span><span class="p">(</span><span class="n">fmt</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">)</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="p">),</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="k">def</span> <span class="nf">_parse_eomonth</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">date</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">month_lag</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">DATE_DELTA_INTERVAL</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"month"</span><span class="p">)</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="n">month_lag</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">LastDateOfMonth</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">date</span><span class="p">)</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="c1"># Remove month lag argument in parser as its compared with the number of arguments of the resulting class</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">args</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">month_lag</span><span class="p">)</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">LastDateOfMonth</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">date</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">month_lag</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="n">unit</span><span class="p">))</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a><span class="k">def</span> <span class="nf">generate_date_delta_with_unit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">):</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">func</span> <span class="o">=</span> <span class="s2">"DATEADD"</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"DATEDIFF"</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a><span class="k">def</span> <span class="nf">_format_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">):</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">fmt</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"format"</span><span class="p">]</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">)</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"format"</span><span class="p">),</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">inverse_time_mapping</span><span class="p">))</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FORMAT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">fmt</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="k">def</span> <span class="nf">_string_agg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">):</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">e</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="c1"># exp.Distinct can appear below an exp.Order or an exp.GroupConcat expression</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"T-SQL STRING_AGG doesn't support DISTINCT."</span><span class="p">)</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">distinct</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">order</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">):</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">order</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITHIN GROUP (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span><span class="si">}</span><span class="s2">)"</span> <span class="c1"># Order has a leading space</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">separator</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"separator"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">","</span><span class="p">)</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"STRING_AGG(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">separator</span><span class="p">)</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">order</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a><span class="k">class</span> <span class="nc">TSQL</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_small"</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-mm-dd hh:mm:ss'"</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="s2">"year"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="s2">"qq"</span><span class="p">:</span> <span class="s2">"%q"</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="s2">"q"</span><span class="p">:</span> <span class="s2">"%q"</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="s2">"quarter"</span><span class="p">:</span> <span class="s2">"%q"</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="s2">"dayofyear"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="s2">"day"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="s2">"dy"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="s2">"week"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="s2">"ww"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="s2">"wk"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"hour"</span><span class="p">:</span> <span class="s2">"%h"</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="s2">"hh"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="s2">"minute"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="s2">"mi"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="s2">"n"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="s2">"second"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="s2">"millisecond"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"ms"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="s2">"weekday"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="s2">"dw"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="s2">"month"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="s2">"MMM"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="s2">"S"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="p">}</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">convert_format_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="s2">"0"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M%p"</span><span class="p">,</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="s2">"1"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%y"</span><span class="p">,</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="s2">"2"</span><span class="p">:</span> <span class="s2">"%y.%m.</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="s2">"3"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">/%m/%y"</span><span class="p">,</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="s2">"4"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">.%m.%y"</span><span class="p">,</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="s2">"5"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">-%m-%y"</span><span class="p">,</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="s2">"6"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %y"</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="s2">"7"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2">, %y"</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="s2">"8"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="s2">"9"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M:%S:</span><span class="si">%f</span><span class="s2">%p"</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="s2">"10"</span><span class="p">:</span> <span class="s2">"mm-dd-yy"</span><span class="p">,</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="s2">"11"</span><span class="p">:</span> <span class="s2">"yy/mm/dd"</span><span class="p">,</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="s2">"12"</span><span class="p">:</span> <span class="s2">"yymmdd"</span><span class="p">,</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="s2">"13"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %Y %H:%M:ss:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="s2">"14"</span><span class="p">:</span> <span class="s2">"%H:%M:%S:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="s2">"20"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S"</span><span class="p">,</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="s2">"21"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S.</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="s2">"22"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%y %-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="s2">"23"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="s2">"24"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="s2">"25"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S.</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="s2">"100"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M%p"</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="s2">"101"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y"</span><span class="p">,</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="s2">"102"</span><span class="p">:</span> <span class="s2">"%Y.%m.</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="s2">"103"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">/%m/%Y"</span><span class="p">,</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="s2">"104"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">.%m.%Y"</span><span class="p">,</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="s2">"105"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">-%m-%Y"</span><span class="p">,</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="s2">"106"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %Y"</span><span class="p">,</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="s2">"107"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2">, %Y"</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"108"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="s2">"109"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M:%S:</span><span class="si">%f</span><span class="s2">%p"</span><span class="p">,</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="s2">"110"</span><span class="p">:</span> <span class="s2">"%m-</span><span class="si">%d</span><span class="s2">-%Y"</span><span class="p">,</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="s2">"111"</span><span class="p">:</span> <span class="s2">"%Y/%m/</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="s2">"112"</span><span class="p">:</span> <span class="s2">"%Y%m</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="s2">"113"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %Y %H:%M:%S:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="s2">"114"</span><span class="p">:</span> <span class="s2">"%H:%M:%S:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="s2">"120"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S"</span><span class="p">,</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="s2">"121"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S.</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="p">}</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="c1"># not sure if complete</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">format_time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%B %Y"</span><span class="p">,</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y"</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S"</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"%A,%B,%Y"</span><span class="p">,</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"f"</span><span class="p">:</span> <span class="s2">"%A,%B,%Y %-I:%M %p"</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="s2">"F"</span><span class="p">:</span> <span class="s2">"%A,%B,%Y %-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="s2">"g"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y %-I:%M %p"</span><span class="p">,</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="s2">"G"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y %-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%B </span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%B </span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"O"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">T%H:%M:%S"</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"u"</span><span class="p">:</span> <span class="s2">"%Y-%M-%D %H:%M:%S%z"</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"U"</span><span class="p">:</span> <span class="s2">"%A, %B %D, %Y %H:%M:%S%z"</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"T"</span><span class="p">:</span> <span class="s2">"%-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"t"</span><span class="p">:</span> <span class="s2">"%-I:%M"</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2"> %Y"</span><span class="p">,</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="p">}</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">)]</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"BIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"DATETIME2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"DATETIMEOFFSET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="s2">"IMAGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IMAGE</span><span class="p">,</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="s2">"MONEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MONEY</span><span class="p">,</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"NTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"NVARCHAR(MAX)"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"PRINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="s2">"PROC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="s2">"REAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="s2">"ROWVERSION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">,</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="s2">"SMALLDATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="s2">"SMALLMONEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLMONEY</span><span class="p">,</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="s2">"SQL_VARIANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="s2">"UNIQUEIDENTIFIER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUEIDENTIFIER</span><span class="p">,</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="s2">"VARCHAR(MAX)"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="s2">"XML"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">XML</span><span class="p">,</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="p">}</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="c1"># TSQL allows @, # to appear as a variable/identifier prefix</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"@"</span><span class="p">)</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="s2">"CHARINDEX"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="p">),</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="s2">"ISNULL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">,</span> <span class="n">unit_mapping</span><span class="o">=</span><span class="n">DATE_DELTA_INTERVAL</span><span class="p">),</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">,</span> <span class="n">unit_mapping</span><span class="o">=</span><span class="n">DATE_DELTA_INTERVAL</span><span class="p">),</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="s2">"DATENAME"</span><span class="p">:</span> <span class="n">_format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">full_format_mapping</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="s2">"DATEPART"</span><span class="p">:</span> <span class="n">_format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">),</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="s2">"SYSDATETIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="s2">"IIF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="s2">"LEN"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="s2">"REPLICATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Repeat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="s2">"JSON_VALUE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">_parse_format</span><span class="p">,</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="s2">"EOMONTH"</span><span class="p">:</span> <span class="n">_parse_eomonth</span><span class="p">,</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="p">}</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">VAR_LENGTH_DATATYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="p">}</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="n">RETURNS_TABLE_TOKENS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="p">}</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_command</span><span class="p">(),</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="p">}</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">def</span> <span class="nf">_parse_system_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"SYSTEM_TIME"</span><span class="p">):</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AS"</span><span class="p">,</span> <span class="s2">"OF"</span><span class="p">):</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"AS OF"</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="p">)</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)):</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"AND"</span><span class="p">))</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="p">)</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CONTAINED"</span><span class="p">,</span> <span class="s2">"IN"</span><span class="p">):</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"CONTAINED IN"</span><span class="p">,</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="p">)</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">):</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"ALL"</span><span class="p">)</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Unable to parse FOR SYSTEM_TIME clause"</span><span class="p">)</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="k">return</span> <span class="n">system_time</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="k">def</span> <span class="nf">_parse_table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="n">table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"system_time"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_system_time</span><span class="p">())</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="k">def</span> <span class="nf">_parse_returns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">RETURNS_TABLE_TOKENS</span><span class="p">)</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="n">returns</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_returns</span><span class="p">()</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="n">returns</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">table</span><span class="p">)</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="k">return</span> <span class="n">returns</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">to</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="c1"># Retrieve length of datatype and override to default if not specified</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">if</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">to</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">VAR_LENGTH_DATATYPES</span><span class="p">:</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">to</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">to</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">30</span><span class="p">)],</span> <span class="n">nested</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="c1"># Check whether a conversion with format is applicable</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">format_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">format_val_name</span> <span class="o">=</span> <span class="n">format_val</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">format_val</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="k">if</span> <span class="n">format_val_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">convert_format_mapping</span><span class="p">:</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="sa">f</span><span class="s2">"CONVERT function at T-SQL does not support format style </span><span class="si">{</span><span class="n">format_val_name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="p">)</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="n">format_norm</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">TSQL</span><span class="o">.</span><span class="n">convert_format_mapping</span><span class="p">[</span><span class="n">format_val_name</span><span class="p">])</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="c1"># Check whether the convert entails a string to date format</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="k">if</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="c1"># Check whether the convert entails a string to datetime format</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="c1"># Check whether the convert entails a date to string format</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">VAR_LENGTH_DATATYPES</span><span class="p">:</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">,</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">),</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="p">)</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="c1"># Entails a simple cast without any format requirement</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="k">def</span> <span class="nf">_parse_user_defined_function</span><span class="p">(</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_user_defined_function</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">)</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> <span class="p">):</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_udf_kwarg</span><span class="p">)</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BIT"</span><span class="p">,</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"DATETIME2"</span><span class="p">,</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">:</span> <span class="s2">"SQL_VARIANT"</span><span class="p">,</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> <span class="p">}</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GETDATE"</span><span class="p">),</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GETDATE"</span><span class="p">),</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IIF"</span><span class="p">),</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">:</span> <span class="n">_format_sql</span><span class="p">,</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="n">_format_sql</span><span class="p">,</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_string_agg_sql</span><span class="p">,</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos">436</span></a> <span class="p">}</span> +</span><span id="L-437"><a href="#L-437"><span class="linenos">437</span></a> +</span><span id="L-438"><a href="#L-438"><span class="linenos">438</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos">439</span></a> +</span><span id="L-440"><a href="#L-440"><span class="linenos">440</span></a> <span class="k">def</span> <span class="nf">systemtime_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos">441</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"ALL"</span><span class="p">:</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a> <span class="k">return</span> <span class="s2">"FOR SYSTEM_TIME ALL"</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> +</span><span id="L-445"><a href="#L-445"><span class="linenos">445</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"AS OF"</span><span class="p">:</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME AS OF </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> +</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos">450</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"FROM"</span><span class="p">:</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME FROM </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> TO </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos">452</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"BETWEEN"</span><span class="p">:</span> +</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos">454</span></a> +</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME CONTAINED IN (</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> +</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> <span class="k">def</span> <span class="nf">returnsproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos">459</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURNS </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + </section> + <section id="generate_date_delta_with_unit_sql"> + <input id="generate_date_delta_with_unit_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generate_date_delta_with_unit_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">e</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="generate_date_delta_with_unit_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#generate_date_delta_with_unit_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="generate_date_delta_with_unit_sql-94"><a href="#generate_date_delta_with_unit_sql-94"><span class="linenos">94</span></a><span class="k">def</span> <span class="nf">generate_date_delta_with_unit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">):</span> +</span><span id="generate_date_delta_with_unit_sql-95"><a href="#generate_date_delta_with_unit_sql-95"><span class="linenos">95</span></a> <span class="n">func</span> <span class="o">=</span> <span class="s2">"DATEADD"</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"DATEDIFF"</span> +</span><span id="generate_date_delta_with_unit_sql-96"><a href="#generate_date_delta_with_unit_sql-96"><span class="linenos">96</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">func</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">),</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </section> + <section id="TSQL"> + <input id="TSQL-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TSQL</span><wbr>(<span class="base"><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="TSQL-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TSQL"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TSQL-130"><a href="#TSQL-130"><span class="linenos">130</span></a><span class="k">class</span> <span class="nc">TSQL</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="TSQL-131"><a href="#TSQL-131"><span class="linenos">131</span></a> <span class="n">null_ordering</span> <span class="o">=</span> <span class="s2">"nulls_are_small"</span> +</span><span id="TSQL-132"><a href="#TSQL-132"><span class="linenos">132</span></a> <span class="n">time_format</span> <span class="o">=</span> <span class="s2">"'yyyy-mm-dd hh:mm:ss'"</span> +</span><span id="TSQL-133"><a href="#TSQL-133"><span class="linenos">133</span></a> +</span><span id="TSQL-134"><a href="#TSQL-134"><span class="linenos">134</span></a> <span class="n">time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-135"><a href="#TSQL-135"><span class="linenos">135</span></a> <span class="s2">"year"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="TSQL-136"><a href="#TSQL-136"><span class="linenos">136</span></a> <span class="s2">"qq"</span><span class="p">:</span> <span class="s2">"%q"</span><span class="p">,</span> +</span><span id="TSQL-137"><a href="#TSQL-137"><span class="linenos">137</span></a> <span class="s2">"q"</span><span class="p">:</span> <span class="s2">"%q"</span><span class="p">,</span> +</span><span id="TSQL-138"><a href="#TSQL-138"><span class="linenos">138</span></a> <span class="s2">"quarter"</span><span class="p">:</span> <span class="s2">"%q"</span><span class="p">,</span> +</span><span id="TSQL-139"><a href="#TSQL-139"><span class="linenos">139</span></a> <span class="s2">"dayofyear"</span><span class="p">:</span> <span class="s2">"%j"</span><span class="p">,</span> +</span><span id="TSQL-140"><a href="#TSQL-140"><span class="linenos">140</span></a> <span class="s2">"day"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-141"><a href="#TSQL-141"><span class="linenos">141</span></a> <span class="s2">"dy"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-142"><a href="#TSQL-142"><span class="linenos">142</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="TSQL-143"><a href="#TSQL-143"><span class="linenos">143</span></a> <span class="s2">"week"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="TSQL-144"><a href="#TSQL-144"><span class="linenos">144</span></a> <span class="s2">"ww"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="TSQL-145"><a href="#TSQL-145"><span class="linenos">145</span></a> <span class="s2">"wk"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="TSQL-146"><a href="#TSQL-146"><span class="linenos">146</span></a> <span class="s2">"hour"</span><span class="p">:</span> <span class="s2">"%h"</span><span class="p">,</span> +</span><span id="TSQL-147"><a href="#TSQL-147"><span class="linenos">147</span></a> <span class="s2">"hh"</span><span class="p">:</span> <span class="s2">"%I"</span><span class="p">,</span> +</span><span id="TSQL-148"><a href="#TSQL-148"><span class="linenos">148</span></a> <span class="s2">"minute"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="TSQL-149"><a href="#TSQL-149"><span class="linenos">149</span></a> <span class="s2">"mi"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="TSQL-150"><a href="#TSQL-150"><span class="linenos">150</span></a> <span class="s2">"n"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="TSQL-151"><a href="#TSQL-151"><span class="linenos">151</span></a> <span class="s2">"second"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="TSQL-152"><a href="#TSQL-152"><span class="linenos">152</span></a> <span class="s2">"ss"</span><span class="p">:</span> <span class="s2">"%S"</span><span class="p">,</span> +</span><span id="TSQL-153"><a href="#TSQL-153"><span class="linenos">153</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%-S"</span><span class="p">,</span> +</span><span id="TSQL-154"><a href="#TSQL-154"><span class="linenos">154</span></a> <span class="s2">"millisecond"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-155"><a href="#TSQL-155"><span class="linenos">155</span></a> <span class="s2">"ms"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-156"><a href="#TSQL-156"><span class="linenos">156</span></a> <span class="s2">"weekday"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="TSQL-157"><a href="#TSQL-157"><span class="linenos">157</span></a> <span class="s2">"dw"</span><span class="p">:</span> <span class="s2">"%W"</span><span class="p">,</span> +</span><span id="TSQL-158"><a href="#TSQL-158"><span class="linenos">158</span></a> <span class="s2">"month"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="TSQL-159"><a href="#TSQL-159"><span class="linenos">159</span></a> <span class="s2">"mm"</span><span class="p">:</span> <span class="s2">"%M"</span><span class="p">,</span> +</span><span id="TSQL-160"><a href="#TSQL-160"><span class="linenos">160</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%-M"</span><span class="p">,</span> +</span><span id="TSQL-161"><a href="#TSQL-161"><span class="linenos">161</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="TSQL-162"><a href="#TSQL-162"><span class="linenos">162</span></a> <span class="s2">"YYYY"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="TSQL-163"><a href="#TSQL-163"><span class="linenos">163</span></a> <span class="s2">"YY"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="TSQL-164"><a href="#TSQL-164"><span class="linenos">164</span></a> <span class="s2">"MMMM"</span><span class="p">:</span> <span class="s2">"%B"</span><span class="p">,</span> +</span><span id="TSQL-165"><a href="#TSQL-165"><span class="linenos">165</span></a> <span class="s2">"MMM"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="TSQL-166"><a href="#TSQL-166"><span class="linenos">166</span></a> <span class="s2">"MM"</span><span class="p">:</span> <span class="s2">"%m"</span><span class="p">,</span> +</span><span id="TSQL-167"><a href="#TSQL-167"><span class="linenos">167</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%-m"</span><span class="p">,</span> +</span><span id="TSQL-168"><a href="#TSQL-168"><span class="linenos">168</span></a> <span class="s2">"dd"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-169"><a href="#TSQL-169"><span class="linenos">169</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-170"><a href="#TSQL-170"><span class="linenos">170</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="TSQL-171"><a href="#TSQL-171"><span class="linenos">171</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="TSQL-172"><a href="#TSQL-172"><span class="linenos">172</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="TSQL-173"><a href="#TSQL-173"><span class="linenos">173</span></a> <span class="s2">"S"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-174"><a href="#TSQL-174"><span class="linenos">174</span></a> <span class="s2">"yyyy"</span><span class="p">:</span> <span class="s2">"%Y"</span><span class="p">,</span> +</span><span id="TSQL-175"><a href="#TSQL-175"><span class="linenos">175</span></a> <span class="s2">"yy"</span><span class="p">:</span> <span class="s2">"%y"</span><span class="p">,</span> +</span><span id="TSQL-176"><a href="#TSQL-176"><span class="linenos">176</span></a> <span class="p">}</span> +</span><span id="TSQL-177"><a href="#TSQL-177"><span class="linenos">177</span></a> +</span><span id="TSQL-178"><a href="#TSQL-178"><span class="linenos">178</span></a> <span class="n">convert_format_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-179"><a href="#TSQL-179"><span class="linenos">179</span></a> <span class="s2">"0"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M%p"</span><span class="p">,</span> +</span><span id="TSQL-180"><a href="#TSQL-180"><span class="linenos">180</span></a> <span class="s2">"1"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%y"</span><span class="p">,</span> +</span><span id="TSQL-181"><a href="#TSQL-181"><span class="linenos">181</span></a> <span class="s2">"2"</span><span class="p">:</span> <span class="s2">"%y.%m.</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-182"><a href="#TSQL-182"><span class="linenos">182</span></a> <span class="s2">"3"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">/%m/%y"</span><span class="p">,</span> +</span><span id="TSQL-183"><a href="#TSQL-183"><span class="linenos">183</span></a> <span class="s2">"4"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">.%m.%y"</span><span class="p">,</span> +</span><span id="TSQL-184"><a href="#TSQL-184"><span class="linenos">184</span></a> <span class="s2">"5"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">-%m-%y"</span><span class="p">,</span> +</span><span id="TSQL-185"><a href="#TSQL-185"><span class="linenos">185</span></a> <span class="s2">"6"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %y"</span><span class="p">,</span> +</span><span id="TSQL-186"><a href="#TSQL-186"><span class="linenos">186</span></a> <span class="s2">"7"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2">, %y"</span><span class="p">,</span> +</span><span id="TSQL-187"><a href="#TSQL-187"><span class="linenos">187</span></a> <span class="s2">"8"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-188"><a href="#TSQL-188"><span class="linenos">188</span></a> <span class="s2">"9"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M:%S:</span><span class="si">%f</span><span class="s2">%p"</span><span class="p">,</span> +</span><span id="TSQL-189"><a href="#TSQL-189"><span class="linenos">189</span></a> <span class="s2">"10"</span><span class="p">:</span> <span class="s2">"mm-dd-yy"</span><span class="p">,</span> +</span><span id="TSQL-190"><a href="#TSQL-190"><span class="linenos">190</span></a> <span class="s2">"11"</span><span class="p">:</span> <span class="s2">"yy/mm/dd"</span><span class="p">,</span> +</span><span id="TSQL-191"><a href="#TSQL-191"><span class="linenos">191</span></a> <span class="s2">"12"</span><span class="p">:</span> <span class="s2">"yymmdd"</span><span class="p">,</span> +</span><span id="TSQL-192"><a href="#TSQL-192"><span class="linenos">192</span></a> <span class="s2">"13"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %Y %H:%M:ss:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-193"><a href="#TSQL-193"><span class="linenos">193</span></a> <span class="s2">"14"</span><span class="p">:</span> <span class="s2">"%H:%M:%S:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-194"><a href="#TSQL-194"><span class="linenos">194</span></a> <span class="s2">"20"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-195"><a href="#TSQL-195"><span class="linenos">195</span></a> <span class="s2">"21"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S.</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-196"><a href="#TSQL-196"><span class="linenos">196</span></a> <span class="s2">"22"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%y %-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="TSQL-197"><a href="#TSQL-197"><span class="linenos">197</span></a> <span class="s2">"23"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-198"><a href="#TSQL-198"><span class="linenos">198</span></a> <span class="s2">"24"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-199"><a href="#TSQL-199"><span class="linenos">199</span></a> <span class="s2">"25"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S.</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-200"><a href="#TSQL-200"><span class="linenos">200</span></a> <span class="s2">"100"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M%p"</span><span class="p">,</span> +</span><span id="TSQL-201"><a href="#TSQL-201"><span class="linenos">201</span></a> <span class="s2">"101"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y"</span><span class="p">,</span> +</span><span id="TSQL-202"><a href="#TSQL-202"><span class="linenos">202</span></a> <span class="s2">"102"</span><span class="p">:</span> <span class="s2">"%Y.%m.</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-203"><a href="#TSQL-203"><span class="linenos">203</span></a> <span class="s2">"103"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">/%m/%Y"</span><span class="p">,</span> +</span><span id="TSQL-204"><a href="#TSQL-204"><span class="linenos">204</span></a> <span class="s2">"104"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">.%m.%Y"</span><span class="p">,</span> +</span><span id="TSQL-205"><a href="#TSQL-205"><span class="linenos">205</span></a> <span class="s2">"105"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2">-%m-%Y"</span><span class="p">,</span> +</span><span id="TSQL-206"><a href="#TSQL-206"><span class="linenos">206</span></a> <span class="s2">"106"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %Y"</span><span class="p">,</span> +</span><span id="TSQL-207"><a href="#TSQL-207"><span class="linenos">207</span></a> <span class="s2">"107"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2">, %Y"</span><span class="p">,</span> +</span><span id="TSQL-208"><a href="#TSQL-208"><span class="linenos">208</span></a> <span class="s2">"108"</span><span class="p">:</span> <span class="s2">"%H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-209"><a href="#TSQL-209"><span class="linenos">209</span></a> <span class="s2">"109"</span><span class="p">:</span> <span class="s2">"%b </span><span class="si">%d</span><span class="s2"> %Y %-I:%M:%S:</span><span class="si">%f</span><span class="s2">%p"</span><span class="p">,</span> +</span><span id="TSQL-210"><a href="#TSQL-210"><span class="linenos">210</span></a> <span class="s2">"110"</span><span class="p">:</span> <span class="s2">"%m-</span><span class="si">%d</span><span class="s2">-%Y"</span><span class="p">,</span> +</span><span id="TSQL-211"><a href="#TSQL-211"><span class="linenos">211</span></a> <span class="s2">"111"</span><span class="p">:</span> <span class="s2">"%Y/%m/</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-212"><a href="#TSQL-212"><span class="linenos">212</span></a> <span class="s2">"112"</span><span class="p">:</span> <span class="s2">"%Y%m</span><span class="si">%d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-213"><a href="#TSQL-213"><span class="linenos">213</span></a> <span class="s2">"113"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%d</span><span class="s2"> %b %Y %H:%M:%S:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-214"><a href="#TSQL-214"><span class="linenos">214</span></a> <span class="s2">"114"</span><span class="p">:</span> <span class="s2">"%H:%M:%S:</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-215"><a href="#TSQL-215"><span class="linenos">215</span></a> <span class="s2">"120"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-216"><a href="#TSQL-216"><span class="linenos">216</span></a> <span class="s2">"121"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S.</span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-217"><a href="#TSQL-217"><span class="linenos">217</span></a> <span class="p">}</span> +</span><span id="TSQL-218"><a href="#TSQL-218"><span class="linenos">218</span></a> <span class="c1"># not sure if complete</span> +</span><span id="TSQL-219"><a href="#TSQL-219"><span class="linenos">219</span></a> <span class="n">format_time_mapping</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-220"><a href="#TSQL-220"><span class="linenos">220</span></a> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"%B %Y"</span><span class="p">,</span> +</span><span id="TSQL-221"><a href="#TSQL-221"><span class="linenos">221</span></a> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y"</span><span class="p">,</span> +</span><span id="TSQL-222"><a href="#TSQL-222"><span class="linenos">222</span></a> <span class="s2">"H"</span><span class="p">:</span> <span class="s2">"%-H"</span><span class="p">,</span> +</span><span id="TSQL-223"><a href="#TSQL-223"><span class="linenos">223</span></a> <span class="s2">"h"</span><span class="p">:</span> <span class="s2">"%-I"</span><span class="p">,</span> +</span><span id="TSQL-224"><a href="#TSQL-224"><span class="linenos">224</span></a> <span class="s2">"s"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2"> %H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-225"><a href="#TSQL-225"><span class="linenos">225</span></a> <span class="s2">"D"</span><span class="p">:</span> <span class="s2">"%A,%B,%Y"</span><span class="p">,</span> +</span><span id="TSQL-226"><a href="#TSQL-226"><span class="linenos">226</span></a> <span class="s2">"f"</span><span class="p">:</span> <span class="s2">"%A,%B,%Y %-I:%M %p"</span><span class="p">,</span> +</span><span id="TSQL-227"><a href="#TSQL-227"><span class="linenos">227</span></a> <span class="s2">"F"</span><span class="p">:</span> <span class="s2">"%A,%B,%Y %-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="TSQL-228"><a href="#TSQL-228"><span class="linenos">228</span></a> <span class="s2">"g"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y %-I:%M %p"</span><span class="p">,</span> +</span><span id="TSQL-229"><a href="#TSQL-229"><span class="linenos">229</span></a> <span class="s2">"G"</span><span class="p">:</span> <span class="s2">"%m/</span><span class="si">%d</span><span class="s2">/%Y %-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="TSQL-230"><a href="#TSQL-230"><span class="linenos">230</span></a> <span class="s2">"M"</span><span class="p">:</span> <span class="s2">"%B </span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-231"><a href="#TSQL-231"><span class="linenos">231</span></a> <span class="s2">"m"</span><span class="p">:</span> <span class="s2">"%B </span><span class="si">%-d</span><span class="s2">"</span><span class="p">,</span> +</span><span id="TSQL-232"><a href="#TSQL-232"><span class="linenos">232</span></a> <span class="s2">"O"</span><span class="p">:</span> <span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">T%H:%M:%S"</span><span class="p">,</span> +</span><span id="TSQL-233"><a href="#TSQL-233"><span class="linenos">233</span></a> <span class="s2">"u"</span><span class="p">:</span> <span class="s2">"%Y-%M-%D %H:%M:%S%z"</span><span class="p">,</span> +</span><span id="TSQL-234"><a href="#TSQL-234"><span class="linenos">234</span></a> <span class="s2">"U"</span><span class="p">:</span> <span class="s2">"%A, %B %D, %Y %H:%M:%S%z"</span><span class="p">,</span> +</span><span id="TSQL-235"><a href="#TSQL-235"><span class="linenos">235</span></a> <span class="s2">"T"</span><span class="p">:</span> <span class="s2">"%-I:%M:%S %p"</span><span class="p">,</span> +</span><span id="TSQL-236"><a href="#TSQL-236"><span class="linenos">236</span></a> <span class="s2">"t"</span><span class="p">:</span> <span class="s2">"%-I:%M"</span><span class="p">,</span> +</span><span id="TSQL-237"><a href="#TSQL-237"><span class="linenos">237</span></a> <span class="s2">"Y"</span><span class="p">:</span> <span class="s2">"</span><span class="si">%a</span><span class="s2"> %Y"</span><span class="p">,</span> +</span><span id="TSQL-238"><a href="#TSQL-238"><span class="linenos">238</span></a> <span class="p">}</span> +</span><span id="TSQL-239"><a href="#TSQL-239"><span class="linenos">239</span></a> +</span><span id="TSQL-240"><a href="#TSQL-240"><span class="linenos">240</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="TSQL-241"><a href="#TSQL-241"><span class="linenos">241</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">)]</span> +</span><span id="TSQL-242"><a href="#TSQL-242"><span class="linenos">242</span></a> +</span><span id="TSQL-243"><a href="#TSQL-243"><span class="linenos">243</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="TSQL-244"><a href="#TSQL-244"><span class="linenos">244</span></a> +</span><span id="TSQL-245"><a href="#TSQL-245"><span class="linenos">245</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-246"><a href="#TSQL-246"><span class="linenos">246</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="TSQL-247"><a href="#TSQL-247"><span class="linenos">247</span></a> <span class="s2">"BIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="TSQL-248"><a href="#TSQL-248"><span class="linenos">248</span></a> <span class="s2">"DATETIME2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="TSQL-249"><a href="#TSQL-249"><span class="linenos">249</span></a> <span class="s2">"DATETIMEOFFSET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="TSQL-250"><a href="#TSQL-250"><span class="linenos">250</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="TSQL-251"><a href="#TSQL-251"><span class="linenos">251</span></a> <span class="s2">"IMAGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IMAGE</span><span class="p">,</span> +</span><span id="TSQL-252"><a href="#TSQL-252"><span class="linenos">252</span></a> <span class="s2">"MONEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MONEY</span><span class="p">,</span> +</span><span id="TSQL-253"><a href="#TSQL-253"><span class="linenos">253</span></a> <span class="s2">"NTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TSQL-254"><a href="#TSQL-254"><span class="linenos">254</span></a> <span class="s2">"NVARCHAR(MAX)"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TSQL-255"><a href="#TSQL-255"><span class="linenos">255</span></a> <span class="s2">"PRINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="TSQL-256"><a href="#TSQL-256"><span class="linenos">256</span></a> <span class="s2">"PROC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="TSQL-257"><a href="#TSQL-257"><span class="linenos">257</span></a> <span class="s2">"REAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="TSQL-258"><a href="#TSQL-258"><span class="linenos">258</span></a> <span class="s2">"ROWVERSION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">,</span> +</span><span id="TSQL-259"><a href="#TSQL-259"><span class="linenos">259</span></a> <span class="s2">"SMALLDATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="TSQL-260"><a href="#TSQL-260"><span class="linenos">260</span></a> <span class="s2">"SMALLMONEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLMONEY</span><span class="p">,</span> +</span><span id="TSQL-261"><a href="#TSQL-261"><span class="linenos">261</span></a> <span class="s2">"SQL_VARIANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="TSQL-262"><a href="#TSQL-262"><span class="linenos">262</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="TSQL-263"><a href="#TSQL-263"><span class="linenos">263</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="TSQL-264"><a href="#TSQL-264"><span class="linenos">264</span></a> <span class="s2">"UNIQUEIDENTIFIER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUEIDENTIFIER</span><span class="p">,</span> +</span><span id="TSQL-265"><a href="#TSQL-265"><span class="linenos">265</span></a> <span class="s2">"VARCHAR(MAX)"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TSQL-266"><a href="#TSQL-266"><span class="linenos">266</span></a> <span class="s2">"XML"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">XML</span><span class="p">,</span> +</span><span id="TSQL-267"><a href="#TSQL-267"><span class="linenos">267</span></a> <span class="p">}</span> +</span><span id="TSQL-268"><a href="#TSQL-268"><span class="linenos">268</span></a> +</span><span id="TSQL-269"><a href="#TSQL-269"><span class="linenos">269</span></a> <span class="c1"># TSQL allows @, # to appear as a variable/identifier prefix</span> +</span><span id="TSQL-270"><a href="#TSQL-270"><span class="linenos">270</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="TSQL-271"><a href="#TSQL-271"><span class="linenos">271</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"@"</span><span class="p">)</span> +</span><span id="TSQL-272"><a href="#TSQL-272"><span class="linenos">272</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> +</span><span id="TSQL-273"><a href="#TSQL-273"><span class="linenos">273</span></a> +</span><span id="TSQL-274"><a href="#TSQL-274"><span class="linenos">274</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="TSQL-275"><a href="#TSQL-275"><span class="linenos">275</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-276"><a href="#TSQL-276"><span class="linenos">276</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL-277"><a href="#TSQL-277"><span class="linenos">277</span></a> <span class="s2">"CHARINDEX"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="TSQL-278"><a href="#TSQL-278"><span class="linenos">278</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="TSQL-279"><a href="#TSQL-279"><span class="linenos">279</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="TSQL-280"><a href="#TSQL-280"><span class="linenos">280</span></a> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="TSQL-281"><a href="#TSQL-281"><span class="linenos">281</span></a> <span class="p">),</span> +</span><span id="TSQL-282"><a href="#TSQL-282"><span class="linenos">282</span></a> <span class="s2">"ISNULL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-283"><a href="#TSQL-283"><span class="linenos">283</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">,</span> <span class="n">unit_mapping</span><span class="o">=</span><span class="n">DATE_DELTA_INTERVAL</span><span class="p">),</span> +</span><span id="TSQL-284"><a href="#TSQL-284"><span class="linenos">284</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">,</span> <span class="n">unit_mapping</span><span class="o">=</span><span class="n">DATE_DELTA_INTERVAL</span><span class="p">),</span> +</span><span id="TSQL-285"><a href="#TSQL-285"><span class="linenos">285</span></a> <span class="s2">"DATENAME"</span><span class="p">:</span> <span class="n">_format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">full_format_mapping</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="TSQL-286"><a href="#TSQL-286"><span class="linenos">286</span></a> <span class="s2">"DATEPART"</span><span class="p">:</span> <span class="n">_format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">),</span> +</span><span id="TSQL-287"><a href="#TSQL-287"><span class="linenos">287</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-288"><a href="#TSQL-288"><span class="linenos">288</span></a> <span class="s2">"SYSDATETIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-289"><a href="#TSQL-289"><span class="linenos">289</span></a> <span class="s2">"IIF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-290"><a href="#TSQL-290"><span class="linenos">290</span></a> <span class="s2">"LEN"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-291"><a href="#TSQL-291"><span class="linenos">291</span></a> <span class="s2">"REPLICATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Repeat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-292"><a href="#TSQL-292"><span class="linenos">292</span></a> <span class="s2">"JSON_VALUE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL-293"><a href="#TSQL-293"><span class="linenos">293</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">_parse_format</span><span class="p">,</span> +</span><span id="TSQL-294"><a href="#TSQL-294"><span class="linenos">294</span></a> <span class="s2">"EOMONTH"</span><span class="p">:</span> <span class="n">_parse_eomonth</span><span class="p">,</span> +</span><span id="TSQL-295"><a href="#TSQL-295"><span class="linenos">295</span></a> <span class="p">}</span> +</span><span id="TSQL-296"><a href="#TSQL-296"><span class="linenos">296</span></a> +</span><span id="TSQL-297"><a href="#TSQL-297"><span class="linenos">297</span></a> <span class="n">VAR_LENGTH_DATATYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-298"><a href="#TSQL-298"><span class="linenos">298</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="TSQL-299"><a href="#TSQL-299"><span class="linenos">299</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="TSQL-300"><a href="#TSQL-300"><span class="linenos">300</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="TSQL-301"><a href="#TSQL-301"><span class="linenos">301</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="TSQL-302"><a href="#TSQL-302"><span class="linenos">302</span></a> <span class="p">}</span> +</span><span id="TSQL-303"><a href="#TSQL-303"><span class="linenos">303</span></a> +</span><span id="TSQL-304"><a href="#TSQL-304"><span class="linenos">304</span></a> <span class="n">RETURNS_TABLE_TOKENS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL-305"><a href="#TSQL-305"><span class="linenos">305</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="TSQL-306"><a href="#TSQL-306"><span class="linenos">306</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL-307"><a href="#TSQL-307"><span class="linenos">307</span></a> <span class="p">}</span> +</span><span id="TSQL-308"><a href="#TSQL-308"><span class="linenos">308</span></a> +</span><span id="TSQL-309"><a href="#TSQL-309"><span class="linenos">309</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-310"><a href="#TSQL-310"><span class="linenos">310</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL-311"><a href="#TSQL-311"><span class="linenos">311</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_command</span><span class="p">(),</span> +</span><span id="TSQL-312"><a href="#TSQL-312"><span class="linenos">312</span></a> <span class="p">}</span> +</span><span id="TSQL-313"><a href="#TSQL-313"><span class="linenos">313</span></a> +</span><span id="TSQL-314"><a href="#TSQL-314"><span class="linenos">314</span></a> <span class="k">def</span> <span class="nf">_parse_system_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="TSQL-315"><a href="#TSQL-315"><span class="linenos">315</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"SYSTEM_TIME"</span><span class="p">):</span> +</span><span id="TSQL-316"><a href="#TSQL-316"><span class="linenos">316</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="TSQL-317"><a href="#TSQL-317"><span class="linenos">317</span></a> +</span><span id="TSQL-318"><a href="#TSQL-318"><span class="linenos">318</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AS"</span><span class="p">,</span> <span class="s2">"OF"</span><span class="p">):</span> +</span><span id="TSQL-319"><a href="#TSQL-319"><span class="linenos">319</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL-320"><a href="#TSQL-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"AS OF"</span> +</span><span id="TSQL-321"><a href="#TSQL-321"><span class="linenos">321</span></a> <span class="p">)</span> +</span><span id="TSQL-322"><a href="#TSQL-322"><span class="linenos">322</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)):</span> +</span><span id="TSQL-323"><a href="#TSQL-323"><span class="linenos">323</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="TSQL-324"><a href="#TSQL-324"><span class="linenos">324</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="TSQL-325"><a href="#TSQL-325"><span class="linenos">325</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"AND"</span><span class="p">))</span> +</span><span id="TSQL-326"><a href="#TSQL-326"><span class="linenos">326</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="TSQL-327"><a href="#TSQL-327"><span class="linenos">327</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL-328"><a href="#TSQL-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span> +</span><span id="TSQL-329"><a href="#TSQL-329"><span class="linenos">329</span></a> <span class="p">)</span> +</span><span id="TSQL-330"><a href="#TSQL-330"><span class="linenos">330</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CONTAINED"</span><span class="p">,</span> <span class="s2">"IN"</span><span class="p">):</span> +</span><span id="TSQL-331"><a href="#TSQL-331"><span class="linenos">331</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="TSQL-332"><a href="#TSQL-332"><span class="linenos">332</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL-333"><a href="#TSQL-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> +</span><span id="TSQL-334"><a href="#TSQL-334"><span class="linenos">334</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="TSQL-335"><a href="#TSQL-335"><span class="linenos">335</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="TSQL-336"><a href="#TSQL-336"><span class="linenos">336</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"CONTAINED IN"</span><span class="p">,</span> +</span><span id="TSQL-337"><a href="#TSQL-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="TSQL-338"><a href="#TSQL-338"><span class="linenos">338</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">):</span> +</span><span id="TSQL-339"><a href="#TSQL-339"><span class="linenos">339</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"ALL"</span><span class="p">)</span> +</span><span id="TSQL-340"><a href="#TSQL-340"><span class="linenos">340</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TSQL-341"><a href="#TSQL-341"><span class="linenos">341</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="TSQL-342"><a href="#TSQL-342"><span class="linenos">342</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Unable to parse FOR SYSTEM_TIME clause"</span><span class="p">)</span> +</span><span id="TSQL-343"><a href="#TSQL-343"><span class="linenos">343</span></a> +</span><span id="TSQL-344"><a href="#TSQL-344"><span class="linenos">344</span></a> <span class="k">return</span> <span class="n">system_time</span> +</span><span id="TSQL-345"><a href="#TSQL-345"><span class="linenos">345</span></a> +</span><span id="TSQL-346"><a href="#TSQL-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">_parse_table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="TSQL-347"><a href="#TSQL-347"><span class="linenos">347</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +</span><span id="TSQL-348"><a href="#TSQL-348"><span class="linenos">348</span></a> <span class="n">table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"system_time"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_system_time</span><span class="p">())</span> +</span><span id="TSQL-349"><a href="#TSQL-349"><span class="linenos">349</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="TSQL-350"><a href="#TSQL-350"><span class="linenos">350</span></a> +</span><span id="TSQL-351"><a href="#TSQL-351"><span class="linenos">351</span></a> <span class="k">def</span> <span class="nf">_parse_returns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="TSQL-352"><a href="#TSQL-352"><span class="linenos">352</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">RETURNS_TABLE_TOKENS</span><span class="p">)</span> +</span><span id="TSQL-353"><a href="#TSQL-353"><span class="linenos">353</span></a> <span class="n">returns</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_returns</span><span class="p">()</span> +</span><span id="TSQL-354"><a href="#TSQL-354"><span class="linenos">354</span></a> <span class="n">returns</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">table</span><span class="p">)</span> +</span><span id="TSQL-355"><a href="#TSQL-355"><span class="linenos">355</span></a> <span class="k">return</span> <span class="n">returns</span> +</span><span id="TSQL-356"><a href="#TSQL-356"><span class="linenos">356</span></a> +</span><span id="TSQL-357"><a href="#TSQL-357"><span class="linenos">357</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="TSQL-358"><a href="#TSQL-358"><span class="linenos">358</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="TSQL-359"><a href="#TSQL-359"><span class="linenos">359</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="TSQL-360"><a href="#TSQL-360"><span class="linenos">360</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="TSQL-361"><a href="#TSQL-361"><span class="linenos">361</span></a> +</span><span id="TSQL-362"><a href="#TSQL-362"><span class="linenos">362</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">to</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="TSQL-363"><a href="#TSQL-363"><span class="linenos">363</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="TSQL-364"><a href="#TSQL-364"><span class="linenos">364</span></a> +</span><span id="TSQL-365"><a href="#TSQL-365"><span class="linenos">365</span></a> <span class="c1"># Retrieve length of datatype and override to default if not specified</span> +</span><span id="TSQL-366"><a href="#TSQL-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">to</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">VAR_LENGTH_DATATYPES</span><span class="p">:</span> +</span><span id="TSQL-367"><a href="#TSQL-367"><span class="linenos">367</span></a> <span class="n">to</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">to</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">30</span><span class="p">)],</span> <span class="n">nested</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="TSQL-368"><a href="#TSQL-368"><span class="linenos">368</span></a> +</span><span id="TSQL-369"><a href="#TSQL-369"><span class="linenos">369</span></a> <span class="c1"># Check whether a conversion with format is applicable</span> +</span><span id="TSQL-370"><a href="#TSQL-370"><span class="linenos">370</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="TSQL-371"><a href="#TSQL-371"><span class="linenos">371</span></a> <span class="n">format_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="TSQL-372"><a href="#TSQL-372"><span class="linenos">372</span></a> <span class="n">format_val_name</span> <span class="o">=</span> <span class="n">format_val</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">format_val</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="TSQL-373"><a href="#TSQL-373"><span class="linenos">373</span></a> +</span><span id="TSQL-374"><a href="#TSQL-374"><span class="linenos">374</span></a> <span class="k">if</span> <span class="n">format_val_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">convert_format_mapping</span><span class="p">:</span> +</span><span id="TSQL-375"><a href="#TSQL-375"><span class="linenos">375</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span> +</span><span id="TSQL-376"><a href="#TSQL-376"><span class="linenos">376</span></a> <span class="sa">f</span><span class="s2">"CONVERT function at T-SQL does not support format style </span><span class="si">{</span><span class="n">format_val_name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL-377"><a href="#TSQL-377"><span class="linenos">377</span></a> <span class="p">)</span> +</span><span id="TSQL-378"><a href="#TSQL-378"><span class="linenos">378</span></a> +</span><span id="TSQL-379"><a href="#TSQL-379"><span class="linenos">379</span></a> <span class="n">format_norm</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">TSQL</span><span class="o">.</span><span class="n">convert_format_mapping</span><span class="p">[</span><span class="n">format_val_name</span><span class="p">])</span> +</span><span id="TSQL-380"><a href="#TSQL-380"><span class="linenos">380</span></a> +</span><span id="TSQL-381"><a href="#TSQL-381"><span class="linenos">381</span></a> <span class="c1"># Check whether the convert entails a string to date format</span> +</span><span id="TSQL-382"><a href="#TSQL-382"><span class="linenos">382</span></a> <span class="k">if</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="TSQL-383"><a href="#TSQL-383"><span class="linenos">383</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="TSQL-384"><a href="#TSQL-384"><span class="linenos">384</span></a> <span class="c1"># Check whether the convert entails a string to datetime format</span> +</span><span id="TSQL-385"><a href="#TSQL-385"><span class="linenos">385</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="TSQL-386"><a href="#TSQL-386"><span class="linenos">386</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="TSQL-387"><a href="#TSQL-387"><span class="linenos">387</span></a> <span class="c1"># Check whether the convert entails a date to string format</span> +</span><span id="TSQL-388"><a href="#TSQL-388"><span class="linenos">388</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">VAR_LENGTH_DATATYPES</span><span class="p">:</span> +</span><span id="TSQL-389"><a href="#TSQL-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL-390"><a href="#TSQL-390"><span class="linenos">390</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> +</span><span id="TSQL-391"><a href="#TSQL-391"><span class="linenos">391</span></a> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">,</span> +</span><span id="TSQL-392"><a href="#TSQL-392"><span class="linenos">392</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">),</span> +</span><span id="TSQL-393"><a href="#TSQL-393"><span class="linenos">393</span></a> <span class="p">)</span> +</span><span id="TSQL-394"><a href="#TSQL-394"><span class="linenos">394</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="TSQL-395"><a href="#TSQL-395"><span class="linenos">395</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="TSQL-396"><a href="#TSQL-396"><span class="linenos">396</span></a> +</span><span id="TSQL-397"><a href="#TSQL-397"><span class="linenos">397</span></a> <span class="c1"># Entails a simple cast without any format requirement</span> +</span><span id="TSQL-398"><a href="#TSQL-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="TSQL-399"><a href="#TSQL-399"><span class="linenos">399</span></a> +</span><span id="TSQL-400"><a href="#TSQL-400"><span class="linenos">400</span></a> <span class="k">def</span> <span class="nf">_parse_user_defined_function</span><span class="p">(</span> +</span><span id="TSQL-401"><a href="#TSQL-401"><span class="linenos">401</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="TSQL-402"><a href="#TSQL-402"><span class="linenos">402</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="TSQL-403"><a href="#TSQL-403"><span class="linenos">403</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_user_defined_function</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="TSQL-404"><a href="#TSQL-404"><span class="linenos">404</span></a> +</span><span id="TSQL-405"><a href="#TSQL-405"><span class="linenos">405</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="TSQL-406"><a href="#TSQL-406"><span class="linenos">406</span></a> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span> +</span><span id="TSQL-407"><a href="#TSQL-407"><span class="linenos">407</span></a> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">)</span> +</span><span id="TSQL-408"><a href="#TSQL-408"><span class="linenos">408</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="TSQL-409"><a href="#TSQL-409"><span class="linenos">409</span></a> <span class="p">):</span> +</span><span id="TSQL-410"><a href="#TSQL-410"><span class="linenos">410</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="TSQL-411"><a href="#TSQL-411"><span class="linenos">411</span></a> +</span><span id="TSQL-412"><a href="#TSQL-412"><span class="linenos">412</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_udf_kwarg</span><span class="p">)</span> +</span><span id="TSQL-413"><a href="#TSQL-413"><span class="linenos">413</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="TSQL-414"><a href="#TSQL-414"><span class="linenos">414</span></a> +</span><span id="TSQL-415"><a href="#TSQL-415"><span class="linenos">415</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="TSQL-416"><a href="#TSQL-416"><span class="linenos">416</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="TSQL-417"><a href="#TSQL-417"><span class="linenos">417</span></a> +</span><span id="TSQL-418"><a href="#TSQL-418"><span class="linenos">418</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-419"><a href="#TSQL-419"><span class="linenos">419</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL-420"><a href="#TSQL-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BIT"</span><span class="p">,</span> +</span><span id="TSQL-421"><a href="#TSQL-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="TSQL-422"><a href="#TSQL-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> +</span><span id="TSQL-423"><a href="#TSQL-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"DATETIME2"</span><span class="p">,</span> +</span><span id="TSQL-424"><a href="#TSQL-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">:</span> <span class="s2">"SQL_VARIANT"</span><span class="p">,</span> +</span><span id="TSQL-425"><a href="#TSQL-425"><span class="linenos">425</span></a> <span class="p">}</span> +</span><span id="TSQL-426"><a href="#TSQL-426"><span class="linenos">426</span></a> +</span><span id="TSQL-427"><a href="#TSQL-427"><span class="linenos">427</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL-428"><a href="#TSQL-428"><span class="linenos">428</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL-429"><a href="#TSQL-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="TSQL-430"><a href="#TSQL-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="TSQL-431"><a href="#TSQL-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GETDATE"</span><span class="p">),</span> +</span><span id="TSQL-432"><a href="#TSQL-432"><span class="linenos">432</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GETDATE"</span><span class="p">),</span> +</span><span id="TSQL-433"><a href="#TSQL-433"><span class="linenos">433</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IIF"</span><span class="p">),</span> +</span><span id="TSQL-434"><a href="#TSQL-434"><span class="linenos">434</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">:</span> <span class="n">_format_sql</span><span class="p">,</span> +</span><span id="TSQL-435"><a href="#TSQL-435"><span class="linenos">435</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="n">_format_sql</span><span class="p">,</span> +</span><span id="TSQL-436"><a href="#TSQL-436"><span class="linenos">436</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_string_agg_sql</span><span class="p">,</span> +</span><span id="TSQL-437"><a href="#TSQL-437"><span class="linenos">437</span></a> <span class="p">}</span> +</span><span id="TSQL-438"><a href="#TSQL-438"><span class="linenos">438</span></a> +</span><span id="TSQL-439"><a href="#TSQL-439"><span class="linenos">439</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> +</span><span id="TSQL-440"><a href="#TSQL-440"><span class="linenos">440</span></a> +</span><span id="TSQL-441"><a href="#TSQL-441"><span class="linenos">441</span></a> <span class="k">def</span> <span class="nf">systemtime_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="TSQL-442"><a href="#TSQL-442"><span class="linenos">442</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="TSQL-443"><a href="#TSQL-443"><span class="linenos">443</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"ALL"</span><span class="p">:</span> +</span><span id="TSQL-444"><a href="#TSQL-444"><span class="linenos">444</span></a> <span class="k">return</span> <span class="s2">"FOR SYSTEM_TIME ALL"</span> +</span><span id="TSQL-445"><a href="#TSQL-445"><span class="linenos">445</span></a> +</span><span id="TSQL-446"><a href="#TSQL-446"><span class="linenos">446</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="TSQL-447"><a href="#TSQL-447"><span class="linenos">447</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"AS OF"</span><span class="p">:</span> +</span><span id="TSQL-448"><a href="#TSQL-448"><span class="linenos">448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME AS OF </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL-449"><a href="#TSQL-449"><span class="linenos">449</span></a> +</span><span id="TSQL-450"><a href="#TSQL-450"><span class="linenos">450</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="TSQL-451"><a href="#TSQL-451"><span class="linenos">451</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"FROM"</span><span class="p">:</span> +</span><span id="TSQL-452"><a href="#TSQL-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME FROM </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> TO </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL-453"><a href="#TSQL-453"><span class="linenos">453</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"BETWEEN"</span><span class="p">:</span> +</span><span id="TSQL-454"><a href="#TSQL-454"><span class="linenos">454</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL-455"><a href="#TSQL-455"><span class="linenos">455</span></a> +</span><span id="TSQL-456"><a href="#TSQL-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME CONTAINED IN (</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="TSQL-457"><a href="#TSQL-457"><span class="linenos">457</span></a> +</span><span id="TSQL-458"><a href="#TSQL-458"><span class="linenos">458</span></a> <span class="k">def</span> <span class="nf">returnsproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="TSQL-459"><a href="#TSQL-459"><span class="linenos">459</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="TSQL-460"><a href="#TSQL-460"><span class="linenos">460</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="TSQL-461"><a href="#TSQL-461"><span class="linenos">461</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURNS </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + <div id="TSQL.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">TSQL</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#TSQL.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="TSQL.get_or_raise" class="function"><a href="dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="TSQL.format_time" class="function"><a href="dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="TSQL.parse" class="function"><a href="dialect.html#Dialect.parse">parse</a></dd> + <dd id="TSQL.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="TSQL.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> + <dd id="TSQL.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="TSQL.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> + <dd id="TSQL.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TSQL.Tokenizer"> + <input id="TSQL.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TSQL.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="TSQL.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TSQL.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TSQL.Tokenizer-240"><a href="#TSQL.Tokenizer-240"><span class="linenos">240</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="TSQL.Tokenizer-241"><a href="#TSQL.Tokenizer-241"><span class="linenos">241</span></a> <span class="n">IDENTIFIERS</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">,</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">)]</span> +</span><span id="TSQL.Tokenizer-242"><a href="#TSQL.Tokenizer-242"><span class="linenos">242</span></a> +</span><span id="TSQL.Tokenizer-243"><a href="#TSQL.Tokenizer-243"><span class="linenos">243</span></a> <span class="n">QUOTES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">,</span> <span class="s1">'"'</span><span class="p">]</span> +</span><span id="TSQL.Tokenizer-244"><a href="#TSQL.Tokenizer-244"><span class="linenos">244</span></a> +</span><span id="TSQL.Tokenizer-245"><a href="#TSQL.Tokenizer-245"><span class="linenos">245</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL.Tokenizer-246"><a href="#TSQL.Tokenizer-246"><span class="linenos">246</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-247"><a href="#TSQL.Tokenizer-247"><span class="linenos">247</span></a> <span class="s2">"BIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-248"><a href="#TSQL.Tokenizer-248"><span class="linenos">248</span></a> <span class="s2">"DATETIME2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-249"><a href="#TSQL.Tokenizer-249"><span class="linenos">249</span></a> <span class="s2">"DATETIMEOFFSET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-250"><a href="#TSQL.Tokenizer-250"><span class="linenos">250</span></a> <span class="s2">"DECLARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-251"><a href="#TSQL.Tokenizer-251"><span class="linenos">251</span></a> <span class="s2">"IMAGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IMAGE</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-252"><a href="#TSQL.Tokenizer-252"><span class="linenos">252</span></a> <span class="s2">"MONEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MONEY</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-253"><a href="#TSQL.Tokenizer-253"><span class="linenos">253</span></a> <span class="s2">"NTEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-254"><a href="#TSQL.Tokenizer-254"><span class="linenos">254</span></a> <span class="s2">"NVARCHAR(MAX)"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-255"><a href="#TSQL.Tokenizer-255"><span class="linenos">255</span></a> <span class="s2">"PRINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-256"><a href="#TSQL.Tokenizer-256"><span class="linenos">256</span></a> <span class="s2">"PROC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-257"><a href="#TSQL.Tokenizer-257"><span class="linenos">257</span></a> <span class="s2">"REAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-258"><a href="#TSQL.Tokenizer-258"><span class="linenos">258</span></a> <span class="s2">"ROWVERSION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-259"><a href="#TSQL.Tokenizer-259"><span class="linenos">259</span></a> <span class="s2">"SMALLDATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-260"><a href="#TSQL.Tokenizer-260"><span class="linenos">260</span></a> <span class="s2">"SMALLMONEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLMONEY</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-261"><a href="#TSQL.Tokenizer-261"><span class="linenos">261</span></a> <span class="s2">"SQL_VARIANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-262"><a href="#TSQL.Tokenizer-262"><span class="linenos">262</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-263"><a href="#TSQL.Tokenizer-263"><span class="linenos">263</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-264"><a href="#TSQL.Tokenizer-264"><span class="linenos">264</span></a> <span class="s2">"UNIQUEIDENTIFIER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUEIDENTIFIER</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-265"><a href="#TSQL.Tokenizer-265"><span class="linenos">265</span></a> <span class="s2">"VARCHAR(MAX)"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-266"><a href="#TSQL.Tokenizer-266"><span class="linenos">266</span></a> <span class="s2">"XML"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">XML</span><span class="p">,</span> +</span><span id="TSQL.Tokenizer-267"><a href="#TSQL.Tokenizer-267"><span class="linenos">267</span></a> <span class="p">}</span> +</span><span id="TSQL.Tokenizer-268"><a href="#TSQL.Tokenizer-268"><span class="linenos">268</span></a> +</span><span id="TSQL.Tokenizer-269"><a href="#TSQL.Tokenizer-269"><span class="linenos">269</span></a> <span class="c1"># TSQL allows @, # to appear as a variable/identifier prefix</span> +</span><span id="TSQL.Tokenizer-270"><a href="#TSQL.Tokenizer-270"><span class="linenos">270</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="TSQL.Tokenizer-271"><a href="#TSQL.Tokenizer-271"><span class="linenos">271</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"@"</span><span class="p">)</span> +</span><span id="TSQL.Tokenizer-272"><a href="#TSQL.Tokenizer-272"><span class="linenos">272</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="TSQL.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="TSQL.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="TSQL.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TSQL.Parser"> + <input id="TSQL.Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TSQL.Parser</span><wbr>(<span class="base"><a href="../parser.html#Parser">sqlglot.parser.Parser</a></span>): + + <label class="view-source-button" for="TSQL.Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TSQL.Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TSQL.Parser-274"><a href="#TSQL.Parser-274"><span class="linenos">274</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="TSQL.Parser-275"><a href="#TSQL.Parser-275"><span class="linenos">275</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL.Parser-276"><a href="#TSQL.Parser-276"><span class="linenos">276</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL.Parser-277"><a href="#TSQL.Parser-277"><span class="linenos">277</span></a> <span class="s2">"CHARINDEX"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span> +</span><span id="TSQL.Parser-278"><a href="#TSQL.Parser-278"><span class="linenos">278</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="TSQL.Parser-279"><a href="#TSQL.Parser-279"><span class="linenos">279</span></a> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="TSQL.Parser-280"><a href="#TSQL.Parser-280"><span class="linenos">280</span></a> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> +</span><span id="TSQL.Parser-281"><a href="#TSQL.Parser-281"><span class="linenos">281</span></a> <span class="p">),</span> +</span><span id="TSQL.Parser-282"><a href="#TSQL.Parser-282"><span class="linenos">282</span></a> <span class="s2">"ISNULL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-283"><a href="#TSQL.Parser-283"><span class="linenos">283</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">,</span> <span class="n">unit_mapping</span><span class="o">=</span><span class="n">DATE_DELTA_INTERVAL</span><span class="p">),</span> +</span><span id="TSQL.Parser-284"><a href="#TSQL.Parser-284"><span class="linenos">284</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">parse_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">,</span> <span class="n">unit_mapping</span><span class="o">=</span><span class="n">DATE_DELTA_INTERVAL</span><span class="p">),</span> +</span><span id="TSQL.Parser-285"><a href="#TSQL.Parser-285"><span class="linenos">285</span></a> <span class="s2">"DATENAME"</span><span class="p">:</span> <span class="n">_format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">full_format_mapping</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="TSQL.Parser-286"><a href="#TSQL.Parser-286"><span class="linenos">286</span></a> <span class="s2">"DATEPART"</span><span class="p">:</span> <span class="n">_format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">),</span> +</span><span id="TSQL.Parser-287"><a href="#TSQL.Parser-287"><span class="linenos">287</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-288"><a href="#TSQL.Parser-288"><span class="linenos">288</span></a> <span class="s2">"SYSDATETIME"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-289"><a href="#TSQL.Parser-289"><span class="linenos">289</span></a> <span class="s2">"IIF"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-290"><a href="#TSQL.Parser-290"><span class="linenos">290</span></a> <span class="s2">"LEN"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-291"><a href="#TSQL.Parser-291"><span class="linenos">291</span></a> <span class="s2">"REPLICATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Repeat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-292"><a href="#TSQL.Parser-292"><span class="linenos">292</span></a> <span class="s2">"JSON_VALUE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="TSQL.Parser-293"><a href="#TSQL.Parser-293"><span class="linenos">293</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">_parse_format</span><span class="p">,</span> +</span><span id="TSQL.Parser-294"><a href="#TSQL.Parser-294"><span class="linenos">294</span></a> <span class="s2">"EOMONTH"</span><span class="p">:</span> <span class="n">_parse_eomonth</span><span class="p">,</span> +</span><span id="TSQL.Parser-295"><a href="#TSQL.Parser-295"><span class="linenos">295</span></a> <span class="p">}</span> +</span><span id="TSQL.Parser-296"><a href="#TSQL.Parser-296"><span class="linenos">296</span></a> +</span><span id="TSQL.Parser-297"><a href="#TSQL.Parser-297"><span class="linenos">297</span></a> <span class="n">VAR_LENGTH_DATATYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL.Parser-298"><a href="#TSQL.Parser-298"><span class="linenos">298</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="TSQL.Parser-299"><a href="#TSQL.Parser-299"><span class="linenos">299</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="TSQL.Parser-300"><a href="#TSQL.Parser-300"><span class="linenos">300</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="TSQL.Parser-301"><a href="#TSQL.Parser-301"><span class="linenos">301</span></a> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="TSQL.Parser-302"><a href="#TSQL.Parser-302"><span class="linenos">302</span></a> <span class="p">}</span> +</span><span id="TSQL.Parser-303"><a href="#TSQL.Parser-303"><span class="linenos">303</span></a> +</span><span id="TSQL.Parser-304"><a href="#TSQL.Parser-304"><span class="linenos">304</span></a> <span class="n">RETURNS_TABLE_TOKENS</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL.Parser-305"><a href="#TSQL.Parser-305"><span class="linenos">305</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="TSQL.Parser-306"><a href="#TSQL.Parser-306"><span class="linenos">306</span></a> <span class="o">*</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL.Parser-307"><a href="#TSQL.Parser-307"><span class="linenos">307</span></a> <span class="p">}</span> +</span><span id="TSQL.Parser-308"><a href="#TSQL.Parser-308"><span class="linenos">308</span></a> +</span><span id="TSQL.Parser-309"><a href="#TSQL.Parser-309"><span class="linenos">309</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL.Parser-310"><a href="#TSQL.Parser-310"><span class="linenos">310</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL.Parser-311"><a href="#TSQL.Parser-311"><span class="linenos">311</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_command</span><span class="p">(),</span> +</span><span id="TSQL.Parser-312"><a href="#TSQL.Parser-312"><span class="linenos">312</span></a> <span class="p">}</span> +</span><span id="TSQL.Parser-313"><a href="#TSQL.Parser-313"><span class="linenos">313</span></a> +</span><span id="TSQL.Parser-314"><a href="#TSQL.Parser-314"><span class="linenos">314</span></a> <span class="k">def</span> <span class="nf">_parse_system_time</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="TSQL.Parser-315"><a href="#TSQL.Parser-315"><span class="linenos">315</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"SYSTEM_TIME"</span><span class="p">):</span> +</span><span id="TSQL.Parser-316"><a href="#TSQL.Parser-316"><span class="linenos">316</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="TSQL.Parser-317"><a href="#TSQL.Parser-317"><span class="linenos">317</span></a> +</span><span id="TSQL.Parser-318"><a href="#TSQL.Parser-318"><span class="linenos">318</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AS"</span><span class="p">,</span> <span class="s2">"OF"</span><span class="p">):</span> +</span><span id="TSQL.Parser-319"><a href="#TSQL.Parser-319"><span class="linenos">319</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL.Parser-320"><a href="#TSQL.Parser-320"><span class="linenos">320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"AS OF"</span> +</span><span id="TSQL.Parser-321"><a href="#TSQL.Parser-321"><span class="linenos">321</span></a> <span class="p">)</span> +</span><span id="TSQL.Parser-322"><a href="#TSQL.Parser-322"><span class="linenos">322</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)):</span> +</span><span id="TSQL.Parser-323"><a href="#TSQL.Parser-323"><span class="linenos">323</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="TSQL.Parser-324"><a href="#TSQL.Parser-324"><span class="linenos">324</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="TSQL.Parser-325"><a href="#TSQL.Parser-325"><span class="linenos">325</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"AND"</span><span class="p">))</span> +</span><span id="TSQL.Parser-326"><a href="#TSQL.Parser-326"><span class="linenos">326</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="TSQL.Parser-327"><a href="#TSQL.Parser-327"><span class="linenos">327</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL.Parser-328"><a href="#TSQL.Parser-328"><span class="linenos">328</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span> +</span><span id="TSQL.Parser-329"><a href="#TSQL.Parser-329"><span class="linenos">329</span></a> <span class="p">)</span> +</span><span id="TSQL.Parser-330"><a href="#TSQL.Parser-330"><span class="linenos">330</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CONTAINED"</span><span class="p">,</span> <span class="s2">"IN"</span><span class="p">):</span> +</span><span id="TSQL.Parser-331"><a href="#TSQL.Parser-331"><span class="linenos">331</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="TSQL.Parser-332"><a href="#TSQL.Parser-332"><span class="linenos">332</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL.Parser-333"><a href="#TSQL.Parser-333"><span class="linenos">333</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> +</span><span id="TSQL.Parser-334"><a href="#TSQL.Parser-334"><span class="linenos">334</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="TSQL.Parser-335"><a href="#TSQL.Parser-335"><span class="linenos">335</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="TSQL.Parser-336"><a href="#TSQL.Parser-336"><span class="linenos">336</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"CONTAINED IN"</span><span class="p">,</span> +</span><span id="TSQL.Parser-337"><a href="#TSQL.Parser-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="TSQL.Parser-338"><a href="#TSQL.Parser-338"><span class="linenos">338</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">):</span> +</span><span id="TSQL.Parser-339"><a href="#TSQL.Parser-339"><span class="linenos">339</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"ALL"</span><span class="p">)</span> +</span><span id="TSQL.Parser-340"><a href="#TSQL.Parser-340"><span class="linenos">340</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TSQL.Parser-341"><a href="#TSQL.Parser-341"><span class="linenos">341</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="TSQL.Parser-342"><a href="#TSQL.Parser-342"><span class="linenos">342</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Unable to parse FOR SYSTEM_TIME clause"</span><span class="p">)</span> +</span><span id="TSQL.Parser-343"><a href="#TSQL.Parser-343"><span class="linenos">343</span></a> +</span><span id="TSQL.Parser-344"><a href="#TSQL.Parser-344"><span class="linenos">344</span></a> <span class="k">return</span> <span class="n">system_time</span> +</span><span id="TSQL.Parser-345"><a href="#TSQL.Parser-345"><span class="linenos">345</span></a> +</span><span id="TSQL.Parser-346"><a href="#TSQL.Parser-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">_parse_table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="TSQL.Parser-347"><a href="#TSQL.Parser-347"><span class="linenos">347</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +</span><span id="TSQL.Parser-348"><a href="#TSQL.Parser-348"><span class="linenos">348</span></a> <span class="n">table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"system_time"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_system_time</span><span class="p">())</span> +</span><span id="TSQL.Parser-349"><a href="#TSQL.Parser-349"><span class="linenos">349</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="TSQL.Parser-350"><a href="#TSQL.Parser-350"><span class="linenos">350</span></a> +</span><span id="TSQL.Parser-351"><a href="#TSQL.Parser-351"><span class="linenos">351</span></a> <span class="k">def</span> <span class="nf">_parse_returns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="TSQL.Parser-352"><a href="#TSQL.Parser-352"><span class="linenos">352</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">RETURNS_TABLE_TOKENS</span><span class="p">)</span> +</span><span id="TSQL.Parser-353"><a href="#TSQL.Parser-353"><span class="linenos">353</span></a> <span class="n">returns</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_returns</span><span class="p">()</span> +</span><span id="TSQL.Parser-354"><a href="#TSQL.Parser-354"><span class="linenos">354</span></a> <span class="n">returns</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">table</span><span class="p">)</span> +</span><span id="TSQL.Parser-355"><a href="#TSQL.Parser-355"><span class="linenos">355</span></a> <span class="k">return</span> <span class="n">returns</span> +</span><span id="TSQL.Parser-356"><a href="#TSQL.Parser-356"><span class="linenos">356</span></a> +</span><span id="TSQL.Parser-357"><a href="#TSQL.Parser-357"><span class="linenos">357</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="TSQL.Parser-358"><a href="#TSQL.Parser-358"><span class="linenos">358</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="TSQL.Parser-359"><a href="#TSQL.Parser-359"><span class="linenos">359</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="TSQL.Parser-360"><a href="#TSQL.Parser-360"><span class="linenos">360</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="TSQL.Parser-361"><a href="#TSQL.Parser-361"><span class="linenos">361</span></a> +</span><span id="TSQL.Parser-362"><a href="#TSQL.Parser-362"><span class="linenos">362</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">to</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="TSQL.Parser-363"><a href="#TSQL.Parser-363"><span class="linenos">363</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="TSQL.Parser-364"><a href="#TSQL.Parser-364"><span class="linenos">364</span></a> +</span><span id="TSQL.Parser-365"><a href="#TSQL.Parser-365"><span class="linenos">365</span></a> <span class="c1"># Retrieve length of datatype and override to default if not specified</span> +</span><span id="TSQL.Parser-366"><a href="#TSQL.Parser-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">to</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">VAR_LENGTH_DATATYPES</span><span class="p">:</span> +</span><span id="TSQL.Parser-367"><a href="#TSQL.Parser-367"><span class="linenos">367</span></a> <span class="n">to</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">to</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">30</span><span class="p">)],</span> <span class="n">nested</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="TSQL.Parser-368"><a href="#TSQL.Parser-368"><span class="linenos">368</span></a> +</span><span id="TSQL.Parser-369"><a href="#TSQL.Parser-369"><span class="linenos">369</span></a> <span class="c1"># Check whether a conversion with format is applicable</span> +</span><span id="TSQL.Parser-370"><a href="#TSQL.Parser-370"><span class="linenos">370</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="TSQL.Parser-371"><a href="#TSQL.Parser-371"><span class="linenos">371</span></a> <span class="n">format_val</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="TSQL.Parser-372"><a href="#TSQL.Parser-372"><span class="linenos">372</span></a> <span class="n">format_val_name</span> <span class="o">=</span> <span class="n">format_val</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">format_val</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="TSQL.Parser-373"><a href="#TSQL.Parser-373"><span class="linenos">373</span></a> +</span><span id="TSQL.Parser-374"><a href="#TSQL.Parser-374"><span class="linenos">374</span></a> <span class="k">if</span> <span class="n">format_val_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">TSQL</span><span class="o">.</span><span class="n">convert_format_mapping</span><span class="p">:</span> +</span><span id="TSQL.Parser-375"><a href="#TSQL.Parser-375"><span class="linenos">375</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span> +</span><span id="TSQL.Parser-376"><a href="#TSQL.Parser-376"><span class="linenos">376</span></a> <span class="sa">f</span><span class="s2">"CONVERT function at T-SQL does not support format style </span><span class="si">{</span><span class="n">format_val_name</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Parser-377"><a href="#TSQL.Parser-377"><span class="linenos">377</span></a> <span class="p">)</span> +</span><span id="TSQL.Parser-378"><a href="#TSQL.Parser-378"><span class="linenos">378</span></a> +</span><span id="TSQL.Parser-379"><a href="#TSQL.Parser-379"><span class="linenos">379</span></a> <span class="n">format_norm</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">TSQL</span><span class="o">.</span><span class="n">convert_format_mapping</span><span class="p">[</span><span class="n">format_val_name</span><span class="p">])</span> +</span><span id="TSQL.Parser-380"><a href="#TSQL.Parser-380"><span class="linenos">380</span></a> +</span><span id="TSQL.Parser-381"><a href="#TSQL.Parser-381"><span class="linenos">381</span></a> <span class="c1"># Check whether the convert entails a string to date format</span> +</span><span id="TSQL.Parser-382"><a href="#TSQL.Parser-382"><span class="linenos">382</span></a> <span class="k">if</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="TSQL.Parser-383"><a href="#TSQL.Parser-383"><span class="linenos">383</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="TSQL.Parser-384"><a href="#TSQL.Parser-384"><span class="linenos">384</span></a> <span class="c1"># Check whether the convert entails a string to datetime format</span> +</span><span id="TSQL.Parser-385"><a href="#TSQL.Parser-385"><span class="linenos">385</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="TSQL.Parser-386"><a href="#TSQL.Parser-386"><span class="linenos">386</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="TSQL.Parser-387"><a href="#TSQL.Parser-387"><span class="linenos">387</span></a> <span class="c1"># Check whether the convert entails a date to string format</span> +</span><span id="TSQL.Parser-388"><a href="#TSQL.Parser-388"><span class="linenos">388</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">VAR_LENGTH_DATATYPES</span><span class="p">:</span> +</span><span id="TSQL.Parser-389"><a href="#TSQL.Parser-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="TSQL.Parser-390"><a href="#TSQL.Parser-390"><span class="linenos">390</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> +</span><span id="TSQL.Parser-391"><a href="#TSQL.Parser-391"><span class="linenos">391</span></a> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">,</span> +</span><span id="TSQL.Parser-392"><a href="#TSQL.Parser-392"><span class="linenos">392</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">),</span> +</span><span id="TSQL.Parser-393"><a href="#TSQL.Parser-393"><span class="linenos">393</span></a> <span class="p">)</span> +</span><span id="TSQL.Parser-394"><a href="#TSQL.Parser-394"><span class="linenos">394</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> +</span><span id="TSQL.Parser-395"><a href="#TSQL.Parser-395"><span class="linenos">395</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="n">format_norm</span><span class="p">)</span> +</span><span id="TSQL.Parser-396"><a href="#TSQL.Parser-396"><span class="linenos">396</span></a> +</span><span id="TSQL.Parser-397"><a href="#TSQL.Parser-397"><span class="linenos">397</span></a> <span class="c1"># Entails a simple cast without any format requirement</span> +</span><span id="TSQL.Parser-398"><a href="#TSQL.Parser-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="TSQL.Parser-399"><a href="#TSQL.Parser-399"><span class="linenos">399</span></a> +</span><span id="TSQL.Parser-400"><a href="#TSQL.Parser-400"><span class="linenos">400</span></a> <span class="k">def</span> <span class="nf">_parse_user_defined_function</span><span class="p">(</span> +</span><span id="TSQL.Parser-401"><a href="#TSQL.Parser-401"><span class="linenos">401</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="TSQL.Parser-402"><a href="#TSQL.Parser-402"><span class="linenos">402</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="TSQL.Parser-403"><a href="#TSQL.Parser-403"><span class="linenos">403</span></a> <span class="n">this</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_user_defined_function</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="TSQL.Parser-404"><a href="#TSQL.Parser-404"><span class="linenos">404</span></a> +</span><span id="TSQL.Parser-405"><a href="#TSQL.Parser-405"><span class="linenos">405</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="TSQL.Parser-406"><a href="#TSQL.Parser-406"><span class="linenos">406</span></a> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span> +</span><span id="TSQL.Parser-407"><a href="#TSQL.Parser-407"><span class="linenos">407</span></a> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">)</span> +</span><span id="TSQL.Parser-408"><a href="#TSQL.Parser-408"><span class="linenos">408</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="TSQL.Parser-409"><a href="#TSQL.Parser-409"><span class="linenos">409</span></a> <span class="p">):</span> +</span><span id="TSQL.Parser-410"><a href="#TSQL.Parser-410"><span class="linenos">410</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="TSQL.Parser-411"><a href="#TSQL.Parser-411"><span class="linenos">411</span></a> +</span><span id="TSQL.Parser-412"><a href="#TSQL.Parser-412"><span class="linenos">412</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_udf_kwarg</span><span class="p">)</span> +</span><span id="TSQL.Parser-413"><a href="#TSQL.Parser-413"><span class="linenos">413</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../parser.html#Parser">sqlglot.parser.Parser</a></dt> + <dd id="TSQL.Parser.__init__" class="function"><a href="../parser.html#Parser.__init__">Parser</a></dd> + <dd id="TSQL.Parser.reset" class="function"><a href="../parser.html#Parser.reset">reset</a></dd> + <dd id="TSQL.Parser.parse" class="function"><a href="../parser.html#Parser.parse">parse</a></dd> + <dd id="TSQL.Parser.parse_into" class="function"><a href="../parser.html#Parser.parse_into">parse_into</a></dd> + <dd id="TSQL.Parser.check_errors" class="function"><a href="../parser.html#Parser.check_errors">check_errors</a></dd> + <dd id="TSQL.Parser.raise_error" class="function"><a href="../parser.html#Parser.raise_error">raise_error</a></dd> + <dd id="TSQL.Parser.expression" class="function"><a href="../parser.html#Parser.expression">expression</a></dd> + <dd id="TSQL.Parser.validate_expression" class="function"><a href="../parser.html#Parser.validate_expression">validate_expression</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TSQL.Generator"> + <input id="TSQL.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TSQL.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="TSQL.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TSQL.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TSQL.Generator-415"><a href="#TSQL.Generator-415"><span class="linenos">415</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="TSQL.Generator-416"><a href="#TSQL.Generator-416"><span class="linenos">416</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="TSQL.Generator-417"><a href="#TSQL.Generator-417"><span class="linenos">417</span></a> +</span><span id="TSQL.Generator-418"><a href="#TSQL.Generator-418"><span class="linenos">418</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL.Generator-419"><a href="#TSQL.Generator-419"><span class="linenos">419</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL.Generator-420"><a href="#TSQL.Generator-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">:</span> <span class="s2">"BIT"</span><span class="p">,</span> +</span><span id="TSQL.Generator-421"><a href="#TSQL.Generator-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="TSQL.Generator-422"><a href="#TSQL.Generator-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="s2">"NUMERIC"</span><span class="p">,</span> +</span><span id="TSQL.Generator-423"><a href="#TSQL.Generator-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="s2">"DATETIME2"</span><span class="p">,</span> +</span><span id="TSQL.Generator-424"><a href="#TSQL.Generator-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">:</span> <span class="s2">"SQL_VARIANT"</span><span class="p">,</span> +</span><span id="TSQL.Generator-425"><a href="#TSQL.Generator-425"><span class="linenos">425</span></a> <span class="p">}</span> +</span><span id="TSQL.Generator-426"><a href="#TSQL.Generator-426"><span class="linenos">426</span></a> +</span><span id="TSQL.Generator-427"><a href="#TSQL.Generator-427"><span class="linenos">427</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TSQL.Generator-428"><a href="#TSQL.Generator-428"><span class="linenos">428</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> <span class="c1"># type: ignore</span> +</span><span id="TSQL.Generator-429"><a href="#TSQL.Generator-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="TSQL.Generator-430"><a href="#TSQL.Generator-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">generate_date_delta_with_unit_sql</span><span class="p">,</span> +</span><span id="TSQL.Generator-431"><a href="#TSQL.Generator-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GETDATE"</span><span class="p">),</span> +</span><span id="TSQL.Generator-432"><a href="#TSQL.Generator-432"><span class="linenos">432</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"GETDATE"</span><span class="p">),</span> +</span><span id="TSQL.Generator-433"><a href="#TSQL.Generator-433"><span class="linenos">433</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IIF"</span><span class="p">),</span> +</span><span id="TSQL.Generator-434"><a href="#TSQL.Generator-434"><span class="linenos">434</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NumberToStr</span><span class="p">:</span> <span class="n">_format_sql</span><span class="p">,</span> +</span><span id="TSQL.Generator-435"><a href="#TSQL.Generator-435"><span class="linenos">435</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="n">_format_sql</span><span class="p">,</span> +</span><span id="TSQL.Generator-436"><a href="#TSQL.Generator-436"><span class="linenos">436</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">_string_agg_sql</span><span class="p">,</span> +</span><span id="TSQL.Generator-437"><a href="#TSQL.Generator-437"><span class="linenos">437</span></a> <span class="p">}</span> +</span><span id="TSQL.Generator-438"><a href="#TSQL.Generator-438"><span class="linenos">438</span></a> +</span><span id="TSQL.Generator-439"><a href="#TSQL.Generator-439"><span class="linenos">439</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> +</span><span id="TSQL.Generator-440"><a href="#TSQL.Generator-440"><span class="linenos">440</span></a> +</span><span id="TSQL.Generator-441"><a href="#TSQL.Generator-441"><span class="linenos">441</span></a> <span class="k">def</span> <span class="nf">systemtime_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="TSQL.Generator-442"><a href="#TSQL.Generator-442"><span class="linenos">442</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="TSQL.Generator-443"><a href="#TSQL.Generator-443"><span class="linenos">443</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"ALL"</span><span class="p">:</span> +</span><span id="TSQL.Generator-444"><a href="#TSQL.Generator-444"><span class="linenos">444</span></a> <span class="k">return</span> <span class="s2">"FOR SYSTEM_TIME ALL"</span> +</span><span id="TSQL.Generator-445"><a href="#TSQL.Generator-445"><span class="linenos">445</span></a> +</span><span id="TSQL.Generator-446"><a href="#TSQL.Generator-446"><span class="linenos">446</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="TSQL.Generator-447"><a href="#TSQL.Generator-447"><span class="linenos">447</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"AS OF"</span><span class="p">:</span> +</span><span id="TSQL.Generator-448"><a href="#TSQL.Generator-448"><span class="linenos">448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME AS OF </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Generator-449"><a href="#TSQL.Generator-449"><span class="linenos">449</span></a> +</span><span id="TSQL.Generator-450"><a href="#TSQL.Generator-450"><span class="linenos">450</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="TSQL.Generator-451"><a href="#TSQL.Generator-451"><span class="linenos">451</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"FROM"</span><span class="p">:</span> +</span><span id="TSQL.Generator-452"><a href="#TSQL.Generator-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME FROM </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> TO </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Generator-453"><a href="#TSQL.Generator-453"><span class="linenos">453</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"BETWEEN"</span><span class="p">:</span> +</span><span id="TSQL.Generator-454"><a href="#TSQL.Generator-454"><span class="linenos">454</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Generator-455"><a href="#TSQL.Generator-455"><span class="linenos">455</span></a> +</span><span id="TSQL.Generator-456"><a href="#TSQL.Generator-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME CONTAINED IN (</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="TSQL.Generator-457"><a href="#TSQL.Generator-457"><span class="linenos">457</span></a> +</span><span id="TSQL.Generator-458"><a href="#TSQL.Generator-458"><span class="linenos">458</span></a> <span class="k">def</span> <span class="nf">returnsproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="TSQL.Generator-459"><a href="#TSQL.Generator-459"><span class="linenos">459</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="TSQL.Generator-460"><a href="#TSQL.Generator-460"><span class="linenos">460</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="TSQL.Generator-461"><a href="#TSQL.Generator-461"><span class="linenos">461</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURNS </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="TSQL.Generator.systemtime_sql" class="classattr"> + <input id="TSQL.Generator.systemtime_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">systemtime_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#SystemTime">sqlglot.expressions.SystemTime</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="TSQL.Generator.systemtime_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TSQL.Generator.systemtime_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TSQL.Generator.systemtime_sql-441"><a href="#TSQL.Generator.systemtime_sql-441"><span class="linenos">441</span></a> <span class="k">def</span> <span class="nf">systemtime_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SystemTime</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="TSQL.Generator.systemtime_sql-442"><a href="#TSQL.Generator.systemtime_sql-442"><span class="linenos">442</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="TSQL.Generator.systemtime_sql-443"><a href="#TSQL.Generator.systemtime_sql-443"><span class="linenos">443</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"ALL"</span><span class="p">:</span> +</span><span id="TSQL.Generator.systemtime_sql-444"><a href="#TSQL.Generator.systemtime_sql-444"><span class="linenos">444</span></a> <span class="k">return</span> <span class="s2">"FOR SYSTEM_TIME ALL"</span> +</span><span id="TSQL.Generator.systemtime_sql-445"><a href="#TSQL.Generator.systemtime_sql-445"><span class="linenos">445</span></a> +</span><span id="TSQL.Generator.systemtime_sql-446"><a href="#TSQL.Generator.systemtime_sql-446"><span class="linenos">446</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="TSQL.Generator.systemtime_sql-447"><a href="#TSQL.Generator.systemtime_sql-447"><span class="linenos">447</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"AS OF"</span><span class="p">:</span> +</span><span id="TSQL.Generator.systemtime_sql-448"><a href="#TSQL.Generator.systemtime_sql-448"><span class="linenos">448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME AS OF </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Generator.systemtime_sql-449"><a href="#TSQL.Generator.systemtime_sql-449"><span class="linenos">449</span></a> +</span><span id="TSQL.Generator.systemtime_sql-450"><a href="#TSQL.Generator.systemtime_sql-450"><span class="linenos">450</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="TSQL.Generator.systemtime_sql-451"><a href="#TSQL.Generator.systemtime_sql-451"><span class="linenos">451</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"FROM"</span><span class="p">:</span> +</span><span id="TSQL.Generator.systemtime_sql-452"><a href="#TSQL.Generator.systemtime_sql-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME FROM </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> TO </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Generator.systemtime_sql-453"><a href="#TSQL.Generator.systemtime_sql-453"><span class="linenos">453</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"BETWEEN"</span><span class="p">:</span> +</span><span id="TSQL.Generator.systemtime_sql-454"><a href="#TSQL.Generator.systemtime_sql-454"><span class="linenos">454</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="TSQL.Generator.systemtime_sql-455"><a href="#TSQL.Generator.systemtime_sql-455"><span class="linenos">455</span></a> +</span><span id="TSQL.Generator.systemtime_sql-456"><a href="#TSQL.Generator.systemtime_sql-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOR SYSTEM_TIME CONTAINED IN (</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="TSQL.Generator.returnsproperty_sql" class="classattr"> + <input id="TSQL.Generator.returnsproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">returnsproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="TSQL.Generator.returnsproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TSQL.Generator.returnsproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TSQL.Generator.returnsproperty_sql-458"><a href="#TSQL.Generator.returnsproperty_sql-458"><span class="linenos">458</span></a> <span class="k">def</span> <span class="nf">returnsproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="TSQL.Generator.returnsproperty_sql-459"><a href="#TSQL.Generator.returnsproperty_sql-459"><span class="linenos">459</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="TSQL.Generator.returnsproperty_sql-460"><a href="#TSQL.Generator.returnsproperty_sql-460"><span class="linenos">460</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="TSQL.Generator.returnsproperty_sql-461"><a href="#TSQL.Generator.returnsproperty_sql-461"><span class="linenos">461</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURNS </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="TSQL.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="TSQL.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="TSQL.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="TSQL.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="TSQL.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="TSQL.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="TSQL.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="TSQL.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="TSQL.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="TSQL.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="TSQL.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="TSQL.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="TSQL.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="TSQL.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="TSQL.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="TSQL.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="TSQL.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="TSQL.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="TSQL.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="TSQL.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="TSQL.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="TSQL.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="TSQL.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="TSQL.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="TSQL.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="TSQL.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="TSQL.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="TSQL.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="TSQL.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="TSQL.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="TSQL.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="TSQL.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="TSQL.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="TSQL.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="TSQL.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="TSQL.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="TSQL.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="TSQL.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="TSQL.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="TSQL.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="TSQL.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="TSQL.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="TSQL.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="TSQL.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="TSQL.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="TSQL.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="TSQL.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="TSQL.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="TSQL.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="TSQL.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="TSQL.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="TSQL.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="TSQL.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="TSQL.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="TSQL.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="TSQL.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="TSQL.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="TSQL.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="TSQL.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="TSQL.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="TSQL.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="TSQL.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="TSQL.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="TSQL.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="TSQL.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="TSQL.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="TSQL.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="TSQL.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="TSQL.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="TSQL.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="TSQL.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="TSQL.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="TSQL.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="TSQL.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="TSQL.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="TSQL.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="TSQL.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="TSQL.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="TSQL.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="TSQL.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="TSQL.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="TSQL.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="TSQL.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="TSQL.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="TSQL.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="TSQL.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="TSQL.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="TSQL.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="TSQL.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="TSQL.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="TSQL.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="TSQL.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="TSQL.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="TSQL.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="TSQL.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="TSQL.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="TSQL.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="TSQL.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="TSQL.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="TSQL.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="TSQL.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="TSQL.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="TSQL.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="TSQL.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="TSQL.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="TSQL.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="TSQL.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="TSQL.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="TSQL.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="TSQL.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="TSQL.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="TSQL.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="TSQL.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="TSQL.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="TSQL.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="TSQL.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="TSQL.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="TSQL.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="TSQL.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="TSQL.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="TSQL.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="TSQL.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="TSQL.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="TSQL.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="TSQL.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="TSQL.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="TSQL.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="TSQL.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="TSQL.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="TSQL.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="TSQL.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="TSQL.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="TSQL.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="TSQL.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="TSQL.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="TSQL.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="TSQL.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="TSQL.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="TSQL.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="TSQL.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="TSQL.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="TSQL.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="TSQL.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="TSQL.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="TSQL.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="TSQL.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="TSQL.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="TSQL.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="TSQL.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="TSQL.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="TSQL.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="TSQL.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="TSQL.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="TSQL.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="TSQL.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="TSQL.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="TSQL.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="TSQL.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="TSQL.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="TSQL.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="TSQL.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="TSQL.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="TSQL.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="TSQL.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="TSQL.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="TSQL.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="TSQL.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="TSQL.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="TSQL.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="TSQL.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="TSQL.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="TSQL.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="TSQL.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="TSQL.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="TSQL.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="TSQL.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="TSQL.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="TSQL.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="TSQL.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="TSQL.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="TSQL.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="TSQL.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="TSQL.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="TSQL.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="TSQL.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="TSQL.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="TSQL.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="TSQL.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="TSQL.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="TSQL.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="TSQL.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="TSQL.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="TSQL.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="TSQL.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="TSQL.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="TSQL.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="TSQL.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="TSQL.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="TSQL.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="TSQL.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="TSQL.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/diff.html b/docs/sqlglot/diff.html new file mode 100644 index 0000000..9c366b2 --- /dev/null +++ b/docs/sqlglot/diff.html @@ -0,0 +1,1560 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.diff API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + <h2>Contents</h2> + <ul> + <li><a href="#semantic-diff-for-sql">Semantic Diff for SQL</a> + <ul> + <li><a href="#motivation">Motivation</a></li> + <li><a href="#the-search-for-a-solution">The Search for a Solution</a></li> + <li><a href="#change-distiller">Change Distiller</a></li> + <li><a href="#alternative-solutions">Alternative Solutions</a></li> + <li><a href="#conclusion">Conclusion</a></li> + <li><a href="#references">References</a></li> + </ul></li> +</ul> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Insert">Insert</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Insert.__init__">Insert</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Remove">Remove</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Remove.__init__">Remove</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Move">Move</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Move.__init__">Move</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Update">Update</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Update.__init__">Update</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Keep">Keep</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Keep.__init__">Keep</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#diff">diff</a> + </li> + <li> + <a class="class" href="#ChangeDistiller">ChangeDistiller</a> + <ul class="memberlist"> + <li> + <a class="function" href="#ChangeDistiller.__init__">ChangeDistiller</a> + </li> + <li> + <a class="function" href="#ChangeDistiller.diff">diff</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/diff.py">Edit on GitHub</a> + + <div class="docstring"><h1 id="semantic-diff-for-sql">Semantic Diff for SQL</h1> + +<p><em>by <a href="https://github.com/izeigerman">Iaroslav Zeigerman</a></em></p> + +<h2 id="motivation">Motivation</h2> + +<p>Software is constantly changing and evolving, and identifying what has changed and reviewing those changes is an integral part of the development process. SQL code is no exception to this.</p> + +<p>Text-based diff tools such as <code>git diff</code>, when applied to a code base, have certain limitations. First, they can only detect insertions and deletions, not movements or updates of individual pieces of code. Second, such tools can only detect changes between lines of text, which is too coarse for something as granular and detailed as source code. Additionally, the outcome of such a diff is dependent on the underlying code formatting, and yields different results if the formatting should change.</p> + +<p>Consider the following diff generated by Git:</p> + +<p><img src="sql_diff_images/git_diff_output.png" alt="Git diff output" /></p> + +<p>Semantically the query hasn’t changed. The two arguments <code>b</code> and <code>c</code> have been swapped (moved), posing no impact on the output of the query. Yet Git replaced the whole affected expression alongside a bulk of unrelated elements.</p> + +<p>The alternative to text-based diffing is to compare Abstract Syntax Trees (AST) instead. The main advantage of ASTs are that they are a direct product of code parsing, which represents the underlying code structure at any desired level of granularity. Comparing ASTs may yield extremely precise diffs; changes such as code movements and updates can also be detected. Even more importantly, this approach facilitates additional use cases beyond eyeballing two versions of source code side by side.</p> + +<p>The use cases I had in mind for SQL when I decided to embark on this journey of semantic diffing were the following:</p> + +<ul> +<li><strong>Query similarity score.</strong> Identifying which parts the two queries have in common to automatically suggest opportunities for consolidation, creation of intermediate/staging tables, and so on.</li> +<li><strong>Differentiating between cosmetic / structural changes and functional ones.</strong> For example when a nested query is refactored into a common table expression (CTE), this kind of change doesn’t have any functional impact on either a query or its outcome.</li> +<li><strong>Automatic suggestions about the need to retroactively backfill data.</strong> This is especially important for pipelines that populate very large tables for which restatement is a runtime-intensive procedure. The ability to discern between simple code movements and actual modifications can help assess the impact of a change and make suggestions accordingly.</li> +</ul> + +<p>The implementation discussed in this post is now a part of the <a href="https://github.com/tobymao/sqlglot/">SQLGlot</a> library. You can find a complete source code in the <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/diff.py">diff.py</a> module. The choice of SQLglot was an obvious one due to its simple but powerful API, lack of external dependencies and, more importantly, extensive list of supported SQL dialects.</p> + +<h2 id="the-search-for-a-solution">The Search for a Solution</h2> + +<p>When it comes to any diffing tool (not just a semantic one), the primary challenge is to match as many elements of compared entities as possible. Once such a set of matching elements is available, deriving a sequence of changes becomes an easy task.</p> + +<p>If our elements have unique identifiers associated with them (for example, an element’s ID in DOM), the matching problem is trivial. However, the SQL syntax trees that we are comparing have neither unique keys nor object identifiers that can be used for the purposes of matching. So, how do we suppose to find pairs of nodes that are related?</p> + +<p>To better illustrate the problem, consider comparing the following SQL expressions: <code>SELECT a + b + c, d, e</code> and <code>SELECT a - b + c, e, f</code>. Matching individual nodes from respective syntax trees can be visualized as follows:</p> + +<p><img src="sql_diff_images/figure_1.png" alt="Figure 1: Example of node matching for two SQL expression trees" /> +<em>Figure 1: Example of node matching for two SQL expression trees.</em></p> + +<p>By looking at the figure of node matching for two SQL expression trees above, we conclude that the following changes should be captured by our solution:</p> + +<ul> +<li>Inserted nodes: <code>Sub</code> and <code>f</code>. These are the nodes from the target AST which do not have a matching node in the source AST.</li> +<li>Removed nodes: <code>Add</code> and <code>d</code>. These are the nodes from the source AST which do not have a counterpart in the target AST.</li> +<li>Remaining nodes must be identified as unchanged.</li> +</ul> + +<p>It should be clear at this point that if we manage to match nodes in the source tree with their counterparts in the target tree, then computing the diff becomes a trivial matter.</p> + +<h3 id="naive-brute-force">Naïve Brute-Force</h3> + +<p>The naïve solution would be to try all different permutations of node pair combinations, and see which set of pairs performs the best based on some type of heuristics. The runtime cost of such a solution quickly reaches the escape velocity; if both trees had only 10 nodes each, the number of such sets would approximately be 10! ^ 2 = 3.6M ^ 2 ~= 13 * 10^12. This is a very bad case of factorial complexity (to be precise, it’s actually much worse - O(n! ^ 2) - but I couldn’t come up with a name for it), so there is little need to explore this approach any further.</p> + +<h3 id="myers-algorithm">Myers Algorithm</h3> + +<p>After the naïve approach was proven to be infeasible, the next question I asked myself was “how does git diff work?”. This question led me to discover the Myers diff algorithm [1]. This algorithm has been designed to compare sequences of strings. At its core, it’s looking for the shortest path on a graph of possible edits that transform the first sequence into the second one, while heavily rewarding those paths that lead to longest subsequences of unchanged elements. There’s a lot of material out there describing this algorithm in greater detail. I found James Coglan’s series of <a href="https://blog.jcoglan.com/2017/02/12/the-myers-diff-algorithm-part-1/">blog posts</a> to be the most comprehensive.</p> + +<p>Therefore, I had this “brilliant” (actually not) idea to transform trees into sequences by traversing them in topological order, and then applying the Myers algorithm on resulting sequences while using a custom heuristics when checking the equality of two nodes. Unsurprisingly, comparing sequences of strings is quite different from comparing hierarchical tree structures, and by flattening trees into sequences, we lose a lot of relevant context. This resulted in a terrible performance of this algorithm on ASTs. It often matched completely unrelated nodes, even when the two trees were mostly the same, and produced extremely inaccurate lists of changes overall. After playing around with it a little and tweaking my equality heuristics to improve accuracy, I ultimately scrapped the whole implementation and went back to the drawing board.</p> + +<h2 id="change-distiller">Change Distiller</h2> + +<p>The algorithm I settled on at the end was Change Distiller, created by Fluri et al. [2], which in turn is an improvement over the core idea described by Chawathe et al. [3].</p> + +<p>The algorithm consists of two high-level steps:</p> + +<ol> +<li><strong>Finding appropriate matchings between pairs of nodes that are part of compared ASTs.</strong> Identifying what is meant by “appropriate” matching is also a part of this step.</li> +<li><strong>Generating the so-called “edit script” from the matching set built in the 1st step.</strong> The edit script is a sequence of edit operations (for example, insert, remove, update, etc.) on individual tree nodes, such that when applied as transformations on the source AST, it eventually becomes the target AST. In general, the shorter the sequence, the better. The length of the edit script can be used to compare the performance of different algorithms, though this is not the only metric that matters.</li> +</ol> + +<p>The rest of this section is dedicated to the Python implementation of the steps above using the AST implementation provided by the SQLGlot library.</p> + +<h3 id="building-the-matching-set">Building the Matching Set</h3> + +<h4 id="matching-leaves">Matching Leaves</h4> + +<p>We begin composing the matching set by matching the leaf nodes. Leaf nodes are the nodes that do not have any children nodes (such as literals, identifiers, etc.). In order to match them, we gather all the leaf nodes from the source tree and generate a cartesian product with all the leaves from the target tree, while comparing pairs created this way and assigning them a similarity score. During this stage, we also exclude pairs that don’t pass basic matching criteria. Then, we pick pairs that scored the highest while making sure that each node is matched no more than once.</p> + +<p>Using the example provided at the beginning of the post, the process of building an initial set of candidate matchings can be seen on Figure 2.</p> + +<p><img src="sql_diff_images/figure_2.gif" alt="Figure 2: Building a set of candidate matchings between leaf nodes. The third item in each triplet represents a similarity score between two nodes." /> +<em>Figure 2: Building a set of candidate matchings between leaf nodes. The third item in each triplet represents a similarity score between two nodes.</em></p> + +<p>First, let’s analyze the similarity score. Then, we’ll discuss matching criteria.</p> + +<p>The similarity score proposed by Fluri et al. [2] is a <a href="https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient">dice coefficient </a>applied to <a href="https://en.wikipedia.org/wiki/Bigram">bigrams</a> of respective node values. A bigram is a sequence of two adjacent elements from a string computed in a sliding window fashion:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">def</span> <span class="nf">bigram</span><span class="p">(</span><span class="n">string</span><span class="p">):</span> + <span class="n">count</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">string</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> + <span class="k">return</span> <span class="p">[</span><span class="n">string</span><span class="p">[</span><span class="n">i</span> <span class="p">:</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">2</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">count</span><span class="p">)]</span> +</code></pre> +</div> + +<p>For reasons that will become clear shortly, we actually need to compute bigram histograms rather than just sequences:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span> + +<span class="k">def</span> <span class="nf">bigram_histo</span><span class="p">(</span><span class="n">string</span><span class="p">):</span> + <span class="n">count</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">string</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> + <span class="n">bigram_histo</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">int</span><span class="p">)</span> + <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">count</span><span class="p">):</span> + <span class="n">bigram_histo</span><span class="p">[</span><span class="n">string</span><span class="p">[</span><span class="n">i</span> <span class="p">:</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">2</span><span class="p">]]</span> <span class="o">+=</span> <span class="mi">1</span> + <span class="k">return</span> <span class="n">bigram_histo</span> +</code></pre> +</div> + +<p>The dice coefficient formula looks like following:</p> + +<p><img src="sql_diff_images/dice_coef.png" alt="Dice Coefficient" /></p> + +<p>Where X is a bigram of the source node and Y is a bigram of the second one. What this essentially does is count the number of bigram elements the two nodes have in common, multiply it by 2, and then divide by the total number of elements in both bigrams. This is where bigram histograms come in handy:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">def</span> <span class="nf">dice_coefficient</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">target</span><span class="p">):</span> + <span class="n">source_histo</span> <span class="o">=</span> <span class="n">bigram_histo</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">sql</span><span class="p">())</span> + <span class="n">target_histo</span> <span class="o">=</span> <span class="n">bigram_histo</span><span class="p">(</span><span class="n">target</span><span class="o">.</span><span class="n">sql</span><span class="p">())</span> + + <span class="n">total_grams</span> <span class="o">=</span> <span class="p">(</span> + <span class="nb">sum</span><span class="p">(</span><span class="n">source_histo</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> <span class="o">+</span> <span class="nb">sum</span><span class="p">(</span><span class="n">target_histo</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> + <span class="p">)</span> + <span class="k">if</span> <span class="ow">not</span> <span class="n">total_grams</span><span class="p">:</span> + <span class="k">return</span> <span class="mf">1.0</span> <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="n">target</span> <span class="k">else</span> <span class="mf">0.0</span> + + <span class="n">overlap_len</span> <span class="o">=</span> <span class="mi">0</span> + <span class="n">overlapping_grams</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source_histo</span><span class="p">)</span> <span class="o">&</span> <span class="nb">set</span><span class="p">(</span><span class="n">target_histo</span><span class="p">)</span> + <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">overlapping_grams</span><span class="p">:</span> + <span class="n">overlap_len</span> <span class="o">+=</span> <span class="nb">min</span><span class="p">(</span><span class="n">source_histo</span><span class="p">[</span><span class="n">g</span><span class="p">],</span> <span class="n">target_histo</span><span class="p">[</span><span class="n">g</span><span class="p">])</span> + + <span class="k">return</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">overlap_len</span> <span class="o">/</span> <span class="n">total_grams</span> +</code></pre> +</div> + +<p>To compute a bigram given a tree node, we first transform the node into its canonical SQL representation,so that the <code>Literal(123)</code> node becomes just “123” and the <code>Identifier(“a”)</code> node becomes just “a”. We also handle a scenario when strings are too short to derive bigrams. In this case, we fallback to checking the two nodes for equality.</p> + +<p>Now when we know how to compute the similarity score, we can take care of the matching criteria for leaf nodes. In the original paper [2], the matching criteria is formalized as follows:</p> + +<p><img src="sql_diff_images/matching_criteria_1.png" alt="Matching criteria for leaf nodes" /></p> + +<p>The two nodes are matched if two conditions are met:</p> + +<ol> +<li>The node labels match (in our case labels are just node types).</li> +<li>The similarity score for node values is greater than or equal to some threshold “f”. The authors of the paper recommend setting the value of “f” to 0.6.</li> +</ol> + +<p>With building blocks in place, we can now build a matching set for leaf nodes. First, we generate a list of candidates for matching:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="kn">from</span> <span class="nn">heapq</span> <span class="kn">import</span> <span class="n">heappush</span><span class="p">,</span> <span class="n">heappop</span> + +<span class="n">candidate_matchings</span> <span class="o">=</span> <span class="p">[]</span> +<span class="n">source_leaves</span> <span class="o">=</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="p">)</span> +<span class="n">target_leaves</span> <span class="o">=</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="p">)</span> +<span class="k">for</span> <span class="n">source_leaf</span> <span class="ow">in</span> <span class="n">source_leaves</span><span class="p">:</span> + <span class="k">for</span> <span class="n">target_leaf</span> <span class="ow">in</span> <span class="n">target_leaves</span><span class="p">:</span> + <span class="k">if</span> <span class="n">_is_same_type</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span><span class="p">):</span> + <span class="n">similarity_score</span> <span class="o">=</span> <span class="n">dice_coefficient</span><span class="p">(</span> + <span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span> + <span class="p">)</span> + <span class="k">if</span> <span class="n">similarity_score</span> <span class="o">>=</span> <span class="mf">0.6</span><span class="p">:</span> + <span class="n">heappush</span><span class="p">(</span> + <span class="n">candidate_matchings</span><span class="p">,</span> + <span class="p">(</span> + <span class="o">-</span><span class="n">similarity_score</span><span class="p">,</span> + <span class="nb">len</span><span class="p">(</span><span class="n">candidate_matchings</span><span class="p">),</span> + <span class="n">source_leaf</span><span class="p">,</span> + <span class="n">target_leaf</span><span class="p">,</span> + <span class="p">),</span> + <span class="p">)</span> +</code></pre> +</div> + +<p>In the implementation above, we push each matching pair onto the heap to automatically maintain the correct order based on the assigned similarity score.</p> + +<p>Finally, we build the initial matching set by picking leaf pairs with the highest score:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">matching_set</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +<span class="k">while</span> <span class="n">candidate_matchings</span><span class="p">:</span> + <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span> <span class="o">=</span> <span class="n">heappop</span><span class="p">(</span><span class="n">candidate_matchings</span><span class="p">)</span> + <span class="k">if</span> <span class="p">(</span> + <span class="n">source_leaf</span> <span class="ow">in</span> <span class="n">unmatched_source_nodes</span> + <span class="ow">and</span> <span class="n">target_leaf</span> <span class="ow">in</span> <span class="n">unmatched_target_nodes</span> + <span class="p">):</span> + <span class="n">matching_set</span><span class="o">.</span><span class="n">add</span><span class="p">((</span><span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span><span class="p">))</span> + <span class="n">unmatched_source_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">)</span> + <span class="n">unmatched_target_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">)</span> +</code></pre> +</div> + +<p>To finalize the matching set, we should now proceed with matching inner nodes.</p> + +<h4 id="matching-inner-nodes">Matching Inner Nodes</h4> + +<p>Matching inner nodes is quite similar to matching leaf nodes, with the following two distinctions:</p> + +<ul> +<li>Rather than ranking a set of possible candidates, we pick the first node pair that passes the matching criteria.</li> +<li>The matching criteria itself has been extended to account for the number of leaf nodes the pair of inner nodes have in common.</li> +</ul> + +<p><img src="sql_diff_images/figure_3.gif" alt="Figure 3: Matching inner nodes based on their type as well as how many of their leaf nodes have been previously matched." /> +<em>Figure 3: Matching inner nodes based on their type as well as how many of their leaf nodes have been previously matched.</em></p> + +<p>Let’s start with the matching criteria. The criteria is formalized as follows:</p> + +<p><img src="sql_diff_images/matching_criteria_2.png" alt="Matching criteria for inner nodes" /></p> + +<p>Alongside already familiar similarity score and node type criteria, there is a new one in the middle: the ratio of leaf nodes that the two nodes have in common must exceed some threshold “t”. The recommended value for “t” is also 0.6. Counting the number of common leaf nodes is pretty straightforward, since we already have the complete matching set for leaves. All we need to do is count how many matching pairs do leaf nodes from the two compared inner nodes form.</p> + +<p>There are two additional heuristics associated with this matching criteria:</p> + +<ul> +<li>Inner node similarity weighting: if the similarity score between the node values doesn’t pass the threshold “f” but the ratio of common leaf nodes (“t”) is greater than or equal to 0.8, then the matching is considered successful.</li> +<li>The threshold “t” is reduced to 0.4 for inner nodes with the number of leaf nodes equal to 4 or less, in order to decrease the false negative rate for small subtrees.</li> +</ul> + +<p>We now only have to iterate through the remaining unmatched nodes and form matching pairs based on the outlined criteria:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">leaves_matching_set</span> <span class="o">=</span> <span class="n">matching_set</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> + +<span class="k">for</span> <span class="n">source_node</span> <span class="ow">in</span> <span class="n">unmatched_source_nodes</span><span class="o">.</span><span class="n">copy</span><span class="p">():</span> + <span class="k">for</span> <span class="n">target_node</span> <span class="ow">in</span> <span class="n">unmatched_target_nodes</span><span class="p">:</span> + <span class="k">if</span> <span class="n">_is_same_type</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">):</span> + <span class="n">source_leaves</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">_get_leaves</span><span class="p">(</span><span class="n">source_node</span><span class="p">))</span> + <span class="n">target_leaves</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">_get_leaves</span><span class="p">(</span><span class="n">target_node</span><span class="p">))</span> + + <span class="n">max_leaves_num</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_leaves</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">target_leaves</span><span class="p">))</span> + <span class="k">if</span> <span class="n">max_leaves_num</span><span class="p">:</span> + <span class="n">common_leaves_num</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span> + <span class="mi">1</span> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">source_leaves</span> <span class="ow">and</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">target_leaves</span> <span class="k">else</span> <span class="mi">0</span> + <span class="k">for</span> <span class="n">s</span><span class="p">,</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">leaves_matching_set</span> + <span class="p">)</span> + <span class="n">leaf_similarity_score</span> <span class="o">=</span> <span class="n">common_leaves_num</span> <span class="o">/</span> <span class="n">max_leaves_num</span> + <span class="k">else</span><span class="p">:</span> + <span class="n">leaf_similarity_score</span> <span class="o">=</span> <span class="mf">0.0</span> + + <span class="n">adjusted_t</span> <span class="o">=</span> <span class="p">(</span> + <span class="mf">0.6</span> + <span class="k">if</span> <span class="nb">min</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_leaves</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">target_leaves</span><span class="p">))</span> <span class="o">></span> <span class="mi">4</span> + <span class="k">else</span> <span class="mf">0.4</span> + <span class="p">)</span> + + <span class="k">if</span> <span class="n">leaf_similarity_score</span> <span class="o">>=</span> <span class="mf">0.8</span> <span class="ow">or</span> <span class="p">(</span> + <span class="n">leaf_similarity_score</span> <span class="o">>=</span> <span class="n">adjusted_t</span> + <span class="ow">and</span> <span class="n">dice_coefficient</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">)</span> <span class="o">>=</span> <span class="mf">0.6</span> + <span class="p">):</span> + <span class="n">matching_set</span><span class="o">.</span><span class="n">add</span><span class="p">((</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> + <span class="n">unmatched_source_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">source_node</span><span class="p">)</span> + <span class="n">unmatched_target_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">target_node</span><span class="p">)</span> + <span class="k">break</span> +</code></pre> +</div> + +<p>After the matching set is formed, we can proceed with generation of the edit script, which will be the algorithm’s output.</p> + +<h3 id="generating-the-edit-script">Generating the Edit Script</h3> + +<p>At this point, we should have the following 3 sets at our disposal:</p> + +<ul> +<li>The set of matched node pairs.</li> +<li>The set of remaining unmatched nodes from the source tree.</li> +<li>The set of remaining unmatched nodes from the target tree.</li> +</ul> + +<p>We can derive 3 kinds of edits from the matching set: either the node’s value was updated (<strong>Update</strong>), the node was moved to a different position within the tree (<strong>Move</strong>), or the node remained unchanged (<strong>Keep</strong>). Note that the <strong>Move</strong> case is not mutually exclusive with the other two. The node could have been updated or could have remained the same while at the same time its position within its parent node or the parent node itself could have changed. All unmatched nodes from the source tree are the ones that were removed (<strong>Remove</strong>), while unmatched nodes from the target tree are the ones that were inserted (<strong>Insert</strong>).</p> + +<p>The latter two cases are pretty straightforward to implement:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="n">edit_script</span> <span class="o">=</span> <span class="p">[]</span> + +<span class="k">for</span> <span class="n">removed_node</span> <span class="ow">in</span> <span class="n">unmatched_source_nodes</span><span class="p">:</span> + <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Remove</span><span class="p">(</span><span class="n">removed_node</span><span class="p">))</span> +<span class="k">for</span> <span class="n">inserted_node</span> <span class="ow">in</span> <span class="n">unmatched_target_nodes</span><span class="p">:</span> + <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Insert</span><span class="p">(</span><span class="n">inserted_node</span><span class="p">))</span> +</code></pre> +</div> + +<p>Traversing the matching set requires a little more thought:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">for</span> <span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span> <span class="ow">in</span> <span class="n">matching_set</span><span class="p">:</span> + <span class="k">if</span> <span class="p">(</span> + <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">LEAF_EXPRESSION_TYPES</span><span class="p">)</span> + <span class="ow">or</span> <span class="n">source_node</span> <span class="o">==</span> <span class="n">target_node</span> + <span class="p">):</span> + <span class="n">move_edits</span> <span class="o">=</span> <span class="n">generate_move_edits</span><span class="p">(</span> + <span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">,</span> <span class="n">matching_set</span> + <span class="p">)</span> + <span class="n">edit_script</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">move_edits</span><span class="p">)</span> + <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Keep</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> + <span class="k">else</span><span class="p">:</span> + <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Update</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> +</code></pre> +</div> + +<p>If a matching pair represents a pair of leaf nodes, we check if they are the same to decide whether an update took place. For inner node pairs, we also need to compare the positions of their respective children to detect node movements. Chawathe et al. [3] suggest applying the <a href="https://en.wikipedia.org/wiki/Longest_common_subsequence_problem">longest common subsequence </a>(LCS) algorithm which, no surprise here, was described by Myers himself [1]. There is a small catch, however: instead of checking the equality of two children nodes, we need to check whether the two nodes form a pair that is a part of our matching set.</p> + +<p>Now with this knowledge, the implementation becomes straightforward:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">def</span> <span class="nf">generate_move_edits</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">target</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">):</span> + <span class="n">source_children</span> <span class="o">=</span> <span class="n">_get_child_nodes</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> + <span class="n">target_children</span> <span class="o">=</span> <span class="n">_get_child_nodes</span><span class="p">(</span><span class="n">target</span><span class="p">)</span> + + <span class="n">lcs</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span> + <span class="n">_longest_common_subsequence</span><span class="p">(</span> + <span class="n">source_children</span><span class="p">,</span> + <span class="n">target_children</span><span class="p">,</span> + <span class="k">lambda</span> <span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">:</span> <span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> <span class="ow">in</span> <span class="n">matching_set</span> + <span class="p">)</span> + <span class="p">)</span> + + <span class="n">move_edits</span> <span class="o">=</span> <span class="p">[]</span> + <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">source_children</span><span class="p">:</span> + <span class="k">if</span> <span class="n">node</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">lcs</span> <span class="ow">and</span> <span class="n">node</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">unmatched_source_nodes</span><span class="p">:</span> + <span class="n">move_edits</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Move</span><span class="p">(</span><span class="n">node</span><span class="p">))</span> + + <span class="k">return</span> <span class="n">move_edits</span> +</code></pre> +</div> + +<p>I left out the implementation of the LCS algorithm itself here, but there are plenty of implementation choices out there that can be easily looked up.</p> + +<h3 id="output">Output</h3> + +<p>The implemented algorithm produces the output that resembles the following:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="o">>>></span> <span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span><span class="p">,</span> <span class="n">diff</span> +<span class="o">>>></span> <span class="n">diff</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a + b + c, d, e"</span><span class="p">),</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a - b + c, e, f"</span><span class="p">))</span> + +<span class="n">Remove</span><span class="p">(</span><span class="n">Add</span><span class="p">)</span> +<span class="n">Remove</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="n">d</span><span class="p">))</span> +<span class="n">Remove</span><span class="p">(</span><span class="n">Identifier</span><span class="p">(</span><span class="n">d</span><span class="p">))</span> +<span class="n">Insert</span><span class="p">(</span><span class="n">Sub</span><span class="p">)</span> +<span class="n">Insert</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="n">f</span><span class="p">))</span> +<span class="n">Insert</span><span class="p">(</span><span class="n">Identifier</span><span class="p">(</span><span class="n">f</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Select</span><span class="p">,</span> <span class="n">Select</span><span class="p">)</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Add</span><span class="p">,</span> <span class="n">Add</span><span class="p">)</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="n">a</span><span class="p">),</span> <span class="n">Column</span><span class="p">(</span><span class="n">a</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Identifier</span><span class="p">(</span><span class="n">a</span><span class="p">),</span> <span class="n">Identifier</span><span class="p">(</span><span class="n">a</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="n">b</span><span class="p">),</span> <span class="n">Column</span><span class="p">(</span><span class="n">b</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Identifier</span><span class="p">(</span><span class="n">b</span><span class="p">),</span> <span class="n">Identifier</span><span class="p">(</span><span class="n">b</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="n">c</span><span class="p">),</span> <span class="n">Column</span><span class="p">(</span><span class="n">c</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Identifier</span><span class="p">(</span><span class="n">c</span><span class="p">),</span> <span class="n">Identifier</span><span class="p">(</span><span class="n">c</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Column</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> <span class="n">Column</span><span class="p">(</span><span class="n">e</span><span class="p">))</span> +<span class="n">Keep</span><span class="p">(</span><span class="n">Identifier</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> <span class="n">Identifier</span><span class="p">(</span><span class="n">e</span><span class="p">))</span> +</code></pre> +</div> + +<p>Note that the output above is abbreviated. The string representation of actual AST nodes is significantly more verbose.</p> + +<p>The implementation works especially well when coupled with the SQLGlot’s query optimizer which can be used to produce canonical representations of compared queries:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="o">>>></span> <span class="n">schema</span><span class="o">=</span><span class="p">{</span><span class="s2">"t"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"a"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"b"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"c"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">,</span> <span class="s2">"d"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">}}</span> +<span class="o">>>></span> <span class="n">source</span> <span class="o">=</span> <span class="s2">"""</span> +<span class="s2">... SELECT 1 + 1 + a</span> +<span class="s2">... FROM t</span> +<span class="s2">... WHERE b = 1 OR (c = 2 AND d = 3)</span> +<span class="s2">... """</span> +<span class="o">>>></span> <span class="n">target</span> <span class="o">=</span> <span class="s2">"""</span> +<span class="s2">... SELECT 2 + a</span> +<span class="s2">... FROM t</span> +<span class="s2">... WHERE (b = 1 OR c = 2) AND (b = 1 OR d = 3)</span> +<span class="s2">... """</span> +<span class="o">>>></span> <span class="n">optimized_source</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="n">source</span><span class="p">),</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +<span class="o">>>></span> <span class="n">optimized_target</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="n">target</span><span class="p">),</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +<span class="o">>>></span> <span class="n">edit_script</span> <span class="o">=</span> <span class="n">diff</span><span class="p">(</span><span class="n">optimized_source</span><span class="p">,</span> <span class="n">optimized_target</span><span class="p">)</span> +<span class="o">>>></span> <span class="nb">sum</span><span class="p">(</span><span class="mi">0</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">Keep</span><span class="p">)</span> <span class="k">else</span> <span class="mi">1</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">edit_script</span><span class="p">)</span> +<span class="mi">0</span> +</code></pre> +</div> + +<h3 id="optimizations">Optimizations</h3> + +<p>The worst case runtime complexity of this algorithm is not exactly stellar: O(n^2 * log n^2). This is because of the leaf matching process, which involves ranking a cartesian product between all leaf nodes of compared trees. Unsurprisingly, the algorithm takes a considerable time to finish for bigger queries.</p> + +<p>There are still a few basic things we can do in our implementation to help improve performance:</p> + +<ul> +<li>Refer to individual node objects using their identifiers (Python’s <a href="https://docs.python.org/3/library/functions.html#id">id()</a>) instead of direct references in sets. This helps avoid costly recursive hash calculations and equality checks.</li> +<li>Cache bigram histograms to avoid computing them more than once for the same node.</li> +<li>Compute the canonical SQL string representation for each tree once while caching string representations of all inner nodes. This prevents redundant tree traversals when bigrams are computed.</li> +</ul> + +<p>At the time of writing only the first two optimizations have been implemented, so there is an opportunity to contribute for anyone who’s interested.</p> + +<h2 id="alternative-solutions">Alternative Solutions</h2> + +<p>This section is dedicated to solutions that I’ve investigated, but haven’t tried.</p> + +<p>First, this section wouldn’t be complete without Tristan Hume’s <a href="https://thume.ca/2017/06/17/tree-diffing/">blog post</a>. Tristan’s solution has a lot in common with the Myers algorithm plus heuristics that is much more clever than what I came up with. The implementation relies on a combination of <a href="https://en.wikipedia.org/wiki/Dynamic_programming">dynamic programming</a> and <a href="https://en.wikipedia.org/wiki/A*_search_algorithm">A* search algorithm</a> to explore the space of possible matchings and pick the best ones. It seemed to have worked well for Tistan’s specific use case, but after my negative experience with the Myers algorithm, I decided to try something different.</p> + +<p>Another notable approach is the Gumtree algorithm by Falleri et al. [4]. I discovered this paper after I’d already implemented the algorithm that is the main focus of this post. In sections 5.2 and 5.3 of their paper, the authors compare the two algorithms side by side and claim that Gumtree is significantly better in terms of both runtime performance and accuracy when evaluated on 12 792 pairs of Java source files. This doesn’t surprise me, as the algorithm takes the height of subtrees into account. In my tests, I definitely saw scenarios in which this context would have helped. On top of that, the authors promise O(n^2) runtime complexity in the worst case which, given the Change Distiller's O(n^2 * log n^2), looks particularly tempting. I hope to try this algorithm out at some point, and there is a good chance you see me writing about it in my future posts.</p> + +<h2 id="conclusion">Conclusion</h2> + +<p>The Change Distiller algorithm yielded quite satisfactory results in most of my tests. The scenarios in which it fell short mostly concerned identical (or very similar) subtrees located in different parts of the AST. In those cases, node mismatches were frequent and, as a result, edit scripts were somewhat suboptimal.</p> + +<p>Additionally, the runtime performance of the algorithm leaves a lot to be desired. On trees with 1000 leaf nodes each, the algorithm takes a little under 2 seconds to complete. My implementation still has room for improvement, but this should give you a rough idea of what to expect. It appears that the Gumtree algorithm [4] can help address both of these points. I hope to find bandwidth to work on it soon and then compare the two algorithms side-by-side to find out which one performs better on SQL specifically. In the meantime, Change Distiller definitely gets the job done, and I can now proceed with applying it to some of the use cases I mentioned at the beginning of this post.</p> + +<p>I’m also curious to learn whether other folks in the industry faced a similar problem, and how they approached it. If you did something similar, I’m interested to hear about your experience.</p> + +<h2 id="references">References</h2> + +<p>[1] Eugene W. Myers. <a href="http://www.xmailserver.org/diff2.pdf">An O(ND) Difference Algorithm and Its Variations</a>. Algorithmica 1(2): 251-266 (1986)</p> + +<p>[2] B. Fluri, M. Wursch, M. Pinzger, and H. Gall. <a href="https://www.researchgate.net/publication/3189787_Change_DistillingTree_Differencing_for_Fine-Grained_Source_Code_Change_Extraction">Change Distilling: Tree differencing for fine-grained source code change extraction</a>. IEEE Trans. Software Eng., 33(11):725–743, 2007.</p> + +<p>[3] S.S. Chawathe, A. Rajaraman, H. Garcia-Molina, and J. Widom. <a href="http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf">Change Detection in Hierarchically Structured Information</a>. Proc. ACM Sigmod Int’l Conf. Management of Data, pp. 493-504, June 1996</p> + +<p>[4] Jean-Rémy Falleri, Floréal Morandat, Xavier Blanc, Matias Martinez, Martin Monperrus. <a href="https://hal.archives-ouvertes.fr/hal-01054552/document">Fine-grained and Accurate Source Code Differencing</a>. Proceedings of the International Conference on Automated Software Engineering, 2014, Västeras, Sweden. pp.313-324, 10.1145/2642937.2642982. hal-01054552</p> + +<hr /> +</div> + + <input id="mod-diff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-diff-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">"""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="sd">.. include:: ../posts/sql_diff.md</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="sd">----</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="sd">"""</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="kn">from</span> <span class="nn">heapq</span> <span class="kn">import</span> <span class="n">heappop</span><span class="p">,</span> <span class="n">heappush</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">ensure_collection</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="k">class</span> <span class="nc">Insert</span><span class="p">:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="w"> </span><span class="sd">"""Indicates that a new node has been inserted"""</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="k">class</span> <span class="nc">Remove</span><span class="p">:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node has been removed"""</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="k">class</span> <span class="nc">Move</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node's position within the tree has changed"""</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="k">class</span> <span class="nc">Update</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node has been updated"""</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="k">class</span> <span class="nc">Keep</span><span class="p">:</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node hasn't been changed"""</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">T</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"T"</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">Edit</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">Insert</span><span class="p">,</span> <span class="n">Remove</span><span class="p">,</span> <span class="n">Move</span><span class="p">,</span> <span class="n">Update</span><span class="p">,</span> <span class="n">Keep</span><span class="p">]</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a><span class="k">def</span> <span class="nf">diff</span><span class="p">(</span><span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="sd"> Returns the list of changes between the source and the target expressions.</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a><span class="sd"> Examples:</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a><span class="sd"> >>> diff(parse_one("a + b"), parse_one("a + c"))</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="sd"> [</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="sd"> Remove(expression=(COLUMN this: (IDENTIFIER this: b, quoted: False))),</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="sd"> Insert(expression=(COLUMN this: (IDENTIFIER this: c, quoted: False))),</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a><span class="sd"> Keep(</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a><span class="sd"> source=(ADD this: ...),</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="sd"> target=(ADD this: ...)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a><span class="sd"> ),</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="sd"> Keep(</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a><span class="sd"> source=(COLUMN this: (IDENTIFIER this: a, quoted: False)),</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="sd"> target=(COLUMN this: (IDENTIFIER this: a, quoted: False))</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="sd"> ),</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="sd"> ]</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd"> Args:</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a><span class="sd"> source: the source expression.</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="sd"> target: the target expression against which the diff should be calculated.</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="sd"> Returns:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="sd"> the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a><span class="sd"> target expression trees. This list represents a sequence of steps needed to transform the source</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a><span class="sd"> expression tree into the target one.</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a><span class="sd"> """</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="n">ChangeDistiller</span><span class="p">()</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">target</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a><span class="n">LEAF_EXPRESSION_TYPES</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">,</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">,</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">,</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a><span class="k">class</span> <span class="nc">ChangeDistiller</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a><span class="sd"> The implementation of the Change Distiller algorithm described by Beat Fluri and Martin Pinzger in</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a><span class="sd"> their paper https://ieeexplore.ieee.org/document/4339230, which in turn is based on the algorithm by</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a><span class="sd"> Chawathe et al. described in http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf.</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a><span class="sd"> """</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span><span class="p">,</span> <span class="n">t</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">f</span> <span class="o">=</span> <span class="n">f</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">t</span> <span class="o">=</span> <span class="n">t</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_sql_generator</span> <span class="o">=</span> <span class="n">Dialect</span><span class="p">()</span><span class="o">.</span><span class="n">generator</span><span class="p">()</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">def</span> <span class="nf">diff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span> <span class="o">=</span> <span class="n">source</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span> <span class="o">=</span> <span class="n">target</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">bfs</span><span class="p">()}</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">target</span><span class="o">.</span><span class="n">bfs</span><span class="p">()}</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">)</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">)</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_compute_matching_set</span><span class="p">()</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_generate_edit_script</span><span class="p">(</span><span class="n">matching_set</span><span class="p">)</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">def</span> <span class="nf">_generate_edit_script</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">edit_script</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">for</span> <span class="n">removed_node_id</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="p">:</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Remove</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">removed_node_id</span><span class="p">]))</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">for</span> <span class="n">inserted_node_id</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span><span class="p">:</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Insert</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">[</span><span class="n">inserted_node_id</span><span class="p">]))</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="k">for</span> <span class="n">kept_source_node_id</span><span class="p">,</span> <span class="n">kept_target_node_id</span> <span class="ow">in</span> <span class="n">matching_set</span><span class="p">:</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">source_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">kept_source_node_id</span><span class="p">]</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">target_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">[</span><span class="n">kept_target_node_id</span><span class="p">]</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">LEAF_EXPRESSION_TYPES</span><span class="p">)</span> <span class="ow">or</span> <span class="n">source_node</span> <span class="o">==</span> <span class="n">target_node</span><span class="p">:</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_generate_move_edits</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">)</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="p">)</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Keep</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Update</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="k">return</span> <span class="n">edit_script</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="k">def</span> <span class="nf">_generate_move_edits</span><span class="p">(</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Move</span><span class="p">]:</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">source_args</span> <span class="o">=</span> <span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">_expression_only_args</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">target_args</span> <span class="o">=</span> <span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">_expression_only_args</span><span class="p">(</span><span class="n">target</span><span class="p">)]</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">args_lcs</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">_lcs</span><span class="p">(</span><span class="n">source_args</span><span class="p">,</span> <span class="n">target_args</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">:</span> <span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> <span class="ow">in</span> <span class="n">matching_set</span><span class="p">))</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">move_edits</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">source_args</span><span class="p">:</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="n">a</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">args_lcs</span> <span class="ow">and</span> <span class="n">a</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="p">:</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">move_edits</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Move</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">a</span><span class="p">]))</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="k">return</span> <span class="n">move_edits</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">def</span> <span class="nf">_compute_matching_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]:</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">leaves_matching_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_compute_leaf_matching_set</span><span class="p">()</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="n">leaves_matching_set</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="n">ordered_unmatched_source_nodes</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">bfs</span><span class="p">()</span> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="p">}</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">ordered_unmatched_target_nodes</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">bfs</span><span class="p">()</span> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="p">}</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="k">for</span> <span class="n">source_node_id</span> <span class="ow">in</span> <span class="n">ordered_unmatched_source_nodes</span><span class="p">:</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="k">for</span> <span class="n">target_node_id</span> <span class="ow">in</span> <span class="n">ordered_unmatched_target_nodes</span><span class="p">:</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">source_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">source_node_id</span><span class="p">]</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">target_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">[</span><span class="n">target_node_id</span><span class="p">]</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">if</span> <span class="n">_is_same_type</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">):</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">source_leaf_ids</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="n">source_node</span><span class="p">)}</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">target_leaf_ids</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="n">target_node</span><span class="p">)}</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">max_leaves_num</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_leaf_ids</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">target_leaf_ids</span><span class="p">))</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">if</span> <span class="n">max_leaves_num</span><span class="p">:</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">common_leaves_num</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="mi">1</span> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">source_leaf_ids</span> <span class="ow">and</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">target_leaf_ids</span> <span class="k">else</span> <span class="mi">0</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">for</span> <span class="n">s</span><span class="p">,</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">leaves_matching_set</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="p">)</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">leaf_similarity_score</span> <span class="o">=</span> <span class="n">common_leaves_num</span> <span class="o">/</span> <span class="n">max_leaves_num</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">leaf_similarity_score</span> <span class="o">=</span> <span class="mf">0.0</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">adjusted_t</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">t</span> <span class="k">if</span> <span class="nb">min</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_leaf_ids</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">target_leaf_ids</span><span class="p">))</span> <span class="o">></span> <span class="mi">4</span> <span class="k">else</span> <span class="mf">0.4</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="p">)</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="k">if</span> <span class="n">leaf_similarity_score</span> <span class="o">>=</span> <span class="mf">0.8</span> <span class="ow">or</span> <span class="p">(</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">leaf_similarity_score</span> <span class="o">>=</span> <span class="n">adjusted_t</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dice_coefficient</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">)</span> <span class="o">>=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="p">):</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="n">matching_set</span><span class="o">.</span><span class="n">add</span><span class="p">((</span><span class="n">source_node_id</span><span class="p">,</span> <span class="n">target_node_id</span><span class="p">))</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">source_node_id</span><span class="p">)</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">target_node_id</span><span class="p">)</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">ordered_unmatched_target_nodes</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">target_node_id</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="k">break</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="k">return</span> <span class="n">matching_set</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="k">def</span> <span class="nf">_compute_leaf_matching_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]:</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">candidate_matchings</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">source_leaves</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">_get_leaves</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="p">))</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="n">target_leaves</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">_get_leaves</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="p">))</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="k">for</span> <span class="n">source_leaf</span> <span class="ow">in</span> <span class="n">source_leaves</span><span class="p">:</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">for</span> <span class="n">target_leaf</span> <span class="ow">in</span> <span class="n">target_leaves</span><span class="p">:</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="n">_is_same_type</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span><span class="p">):</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">similarity_score</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dice_coefficient</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span><span class="p">)</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="k">if</span> <span class="n">similarity_score</span> <span class="o">>=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f</span><span class="p">:</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">heappush</span><span class="p">(</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">candidate_matchings</span><span class="p">,</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="p">(</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="o">-</span><span class="n">similarity_score</span><span class="p">,</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="nb">len</span><span class="p">(</span><span class="n">candidate_matchings</span><span class="p">),</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">source_leaf</span><span class="p">,</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">target_leaf</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="p">),</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="p">)</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="c1"># Pick best matchings based on the highest score</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="k">while</span> <span class="n">candidate_matchings</span><span class="p">:</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span> <span class="o">=</span> <span class="n">heappop</span><span class="p">(</span><span class="n">candidate_matchings</span><span class="p">)</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="nb">id</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="ow">and</span> <span class="nb">id</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="p">):</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="n">matching_set</span><span class="o">.</span><span class="n">add</span><span class="p">((</span><span class="nb">id</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">),</span> <span class="nb">id</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">)))</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">))</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">))</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="k">return</span> <span class="n">matching_set</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="k">def</span> <span class="nf">_dice_coefficient</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="nb">float</span><span class="p">:</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="n">source_histo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">target_histo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo</span><span class="p">(</span><span class="n">target</span><span class="p">)</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">total_grams</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="n">source_histo</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> <span class="o">+</span> <span class="nb">sum</span><span class="p">(</span><span class="n">target_histo</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">total_grams</span><span class="p">:</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="k">return</span> <span class="mf">1.0</span> <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="n">target</span> <span class="k">else</span> <span class="mf">0.0</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">overlap_len</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="n">overlapping_grams</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source_histo</span><span class="p">)</span> <span class="o">&</span> <span class="nb">set</span><span class="p">(</span><span class="n">target_histo</span><span class="p">)</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">overlapping_grams</span><span class="p">:</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="n">overlap_len</span> <span class="o">+=</span> <span class="nb">min</span><span class="p">(</span><span class="n">source_histo</span><span class="p">[</span><span class="n">g</span><span class="p">],</span> <span class="n">target_histo</span><span class="p">[</span><span class="n">g</span><span class="p">])</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="k">return</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">overlap_len</span> <span class="o">/</span> <span class="n">total_grams</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="k">def</span> <span class="nf">_bigram_histo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]:</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">:</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">expression</span><span class="p">)]</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">expression_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sql_generator</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">count</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression_str</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="n">bigram_histo</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">int</span><span class="p">)</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">count</span><span class="p">):</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">bigram_histo</span><span class="p">[</span><span class="n">expression_str</span><span class="p">[</span><span class="n">i</span> <span class="p">:</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">2</span><span class="p">]]</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">expression</span><span class="p">)]</span> <span class="o">=</span> <span class="n">bigram_histo</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">return</span> <span class="n">bigram_histo</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a><span class="k">def</span> <span class="nf">_get_leaves</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">has_child_exprs</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">a</span><span class="p">):</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">has_child_exprs</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="k">yield from</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">has_child_exprs</span><span class="p">:</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a><span class="k">def</span> <span class="nf">_is_same_type</span><span class="p">(</span><span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">type</span><span class="p">(</span><span class="n">target</span><span class="p">):</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="k">return</span> <span class="n">source</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="n">target</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">):</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">return</span> <span class="n">source</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">target</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a><span class="k">def</span> <span class="nf">_expression_only_args</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="k">if</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="n">args</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">a</span><span class="p">))</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">a</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)]</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a><span class="k">def</span> <span class="nf">_lcs</span><span class="p">(</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">seq_a</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">T</span><span class="p">],</span> <span class="n">seq_b</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">T</span><span class="p">],</span> <span class="n">equal</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">T</span><span class="p">,</span> <span class="n">T</span><span class="p">],</span> <span class="nb">bool</span><span class="p">]</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">T</span><span class="p">]]:</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a><span class="w"> </span><span class="sd">"""Calculates the longest common subsequence"""</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">len_a</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">seq_a</span><span class="p">)</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="n">len_b</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">seq_b</span><span class="p">)</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">lcs_result</span> <span class="o">=</span> <span class="p">[[</span><span class="kc">None</span><span class="p">]</span> <span class="o">*</span> <span class="p">(</span><span class="n">len_b</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">len_a</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)]</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">len_a</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">len_b</span> <span class="o">+</span> <span class="mi">1</span><span class="p">):</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">j</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># type: ignore</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="k">elif</span> <span class="n">equal</span><span class="p">(</span><span class="n">seq_a</span><span class="p">[</span><span class="n">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">seq_b</span><span class="p">[</span><span class="n">j</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]):</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="n">j</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="p">[</span><span class="n">seq_a</span><span class="p">[</span><span class="n">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]]</span> <span class="c1"># type: ignore</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="n">j</span><span class="p">]</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">][</span><span class="n">j</span><span class="p">])</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span> <span class="o">-</span> <span class="mi">1</span><span class="p">])</span> <span class="c1"># type: ignore</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="k">else</span> <span class="n">lcs_result</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">j</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="p">)</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="n">lcs_result</span><span class="p">[</span><span class="n">len_a</span><span class="p">][</span><span class="n">len_b</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span></pre></div> + + + </section> + <section id="Insert"> + <input id="Insert-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + <div class="decorator">@dataclass(frozen=True)</div> + + <span class="def">class</span> + <span class="name">Insert</span>: + + <label class="view-source-button" for="Insert-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Insert"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Insert-20"><a href="#Insert-20"><span class="linenos">20</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Insert-21"><a href="#Insert-21"><span class="linenos">21</span></a><span class="k">class</span> <span class="nc">Insert</span><span class="p">:</span> +</span><span id="Insert-22"><a href="#Insert-22"><span class="linenos">22</span></a><span class="w"> </span><span class="sd">"""Indicates that a new node has been inserted"""</span> +</span><span id="Insert-23"><a href="#Insert-23"><span class="linenos">23</span></a> +</span><span id="Insert-24"><a href="#Insert-24"><span class="linenos">24</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span></pre></div> + + + <div class="docstring"><p>Indicates that a new node has been inserted</p> +</div> + + + <div id="Insert.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Insert</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span>)</span> + + + </div> + <a class="headerlink" href="#Insert.__init__"></a> + + + + </div> + </section> + <section id="Remove"> + <input id="Remove-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + <div class="decorator">@dataclass(frozen=True)</div> + + <span class="def">class</span> + <span class="name">Remove</span>: + + <label class="view-source-button" for="Remove-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Remove"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Remove-27"><a href="#Remove-27"><span class="linenos">27</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Remove-28"><a href="#Remove-28"><span class="linenos">28</span></a><span class="k">class</span> <span class="nc">Remove</span><span class="p">:</span> +</span><span id="Remove-29"><a href="#Remove-29"><span class="linenos">29</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node has been removed"""</span> +</span><span id="Remove-30"><a href="#Remove-30"><span class="linenos">30</span></a> +</span><span id="Remove-31"><a href="#Remove-31"><span class="linenos">31</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span></pre></div> + + + <div class="docstring"><p>Indicates that an existing node has been removed</p> +</div> + + + <div id="Remove.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Remove</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span>)</span> + + + </div> + <a class="headerlink" href="#Remove.__init__"></a> + + + + </div> + </section> + <section id="Move"> + <input id="Move-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + <div class="decorator">@dataclass(frozen=True)</div> + + <span class="def">class</span> + <span class="name">Move</span>: + + <label class="view-source-button" for="Move-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Move"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Move-34"><a href="#Move-34"><span class="linenos">34</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Move-35"><a href="#Move-35"><span class="linenos">35</span></a><span class="k">class</span> <span class="nc">Move</span><span class="p">:</span> +</span><span id="Move-36"><a href="#Move-36"><span class="linenos">36</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node's position within the tree has changed"""</span> +</span><span id="Move-37"><a href="#Move-37"><span class="linenos">37</span></a> +</span><span id="Move-38"><a href="#Move-38"><span class="linenos">38</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span></pre></div> + + + <div class="docstring"><p>Indicates that an existing node's position within the tree has changed</p> +</div> + + + <div id="Move.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Move</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span>)</span> + + + </div> + <a class="headerlink" href="#Move.__init__"></a> + + + + </div> + </section> + <section id="Update"> + <input id="Update-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + <div class="decorator">@dataclass(frozen=True)</div> + + <span class="def">class</span> + <span class="name">Update</span>: + + <label class="view-source-button" for="Update-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Update"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Update-41"><a href="#Update-41"><span class="linenos">41</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Update-42"><a href="#Update-42"><span class="linenos">42</span></a><span class="k">class</span> <span class="nc">Update</span><span class="p">:</span> +</span><span id="Update-43"><a href="#Update-43"><span class="linenos">43</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node has been updated"""</span> +</span><span id="Update-44"><a href="#Update-44"><span class="linenos">44</span></a> +</span><span id="Update-45"><a href="#Update-45"><span class="linenos">45</span></a> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="Update-46"><a href="#Update-46"><span class="linenos">46</span></a> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span></pre></div> + + + <div class="docstring"><p>Indicates that an existing node has been updated</p> +</div> + + + <div id="Update.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Update</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">source</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">target</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span>)</span> + + + </div> + <a class="headerlink" href="#Update.__init__"></a> + + + + </div> + </section> + <section id="Keep"> + <input id="Keep-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + <div class="decorator">@dataclass(frozen=True)</div> + + <span class="def">class</span> + <span class="name">Keep</span>: + + <label class="view-source-button" for="Keep-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Keep"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Keep-49"><a href="#Keep-49"><span class="linenos">49</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Keep-50"><a href="#Keep-50"><span class="linenos">50</span></a><span class="k">class</span> <span class="nc">Keep</span><span class="p">:</span> +</span><span id="Keep-51"><a href="#Keep-51"><span class="linenos">51</span></a><span class="w"> </span><span class="sd">"""Indicates that an existing node hasn't been changed"""</span> +</span><span id="Keep-52"><a href="#Keep-52"><span class="linenos">52</span></a> +</span><span id="Keep-53"><a href="#Keep-53"><span class="linenos">53</span></a> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="Keep-54"><a href="#Keep-54"><span class="linenos">54</span></a> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span></pre></div> + + + <div class="docstring"><p>Indicates that an existing node hasn't been changed</p> +</div> + + + <div id="Keep.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Keep</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">source</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">target</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span>)</span> + + + </div> + <a class="headerlink" href="#Keep.__init__"></a> + + + + </div> + </section> + <section id="diff"> + <input id="diff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">diff</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">source</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">target</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="n"><a href="#Insert">sqlglot.diff.Insert</a></span><span class="p">,</span> <span class="n"><a href="#Remove">sqlglot.diff.Remove</a></span><span class="p">,</span> <span class="n"><a href="#Move">sqlglot.diff.Move</a></span><span class="p">,</span> <span class="n"><a href="#Update">sqlglot.diff.Update</a></span><span class="p">,</span> <span class="n"><a href="#Keep">sqlglot.diff.Keep</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="diff-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#diff"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="diff-62"><a href="#diff-62"><span class="linenos">62</span></a><span class="k">def</span> <span class="nf">diff</span><span class="p">(</span><span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="diff-63"><a href="#diff-63"><span class="linenos">63</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="diff-64"><a href="#diff-64"><span class="linenos">64</span></a><span class="sd"> Returns the list of changes between the source and the target expressions.</span> +</span><span id="diff-65"><a href="#diff-65"><span class="linenos">65</span></a> +</span><span id="diff-66"><a href="#diff-66"><span class="linenos">66</span></a><span class="sd"> Examples:</span> +</span><span id="diff-67"><a href="#diff-67"><span class="linenos">67</span></a><span class="sd"> >>> diff(parse_one("a + b"), parse_one("a + c"))</span> +</span><span id="diff-68"><a href="#diff-68"><span class="linenos">68</span></a><span class="sd"> [</span> +</span><span id="diff-69"><a href="#diff-69"><span class="linenos">69</span></a><span class="sd"> Remove(expression=(COLUMN this: (IDENTIFIER this: b, quoted: False))),</span> +</span><span id="diff-70"><a href="#diff-70"><span class="linenos">70</span></a><span class="sd"> Insert(expression=(COLUMN this: (IDENTIFIER this: c, quoted: False))),</span> +</span><span id="diff-71"><a href="#diff-71"><span class="linenos">71</span></a><span class="sd"> Keep(</span> +</span><span id="diff-72"><a href="#diff-72"><span class="linenos">72</span></a><span class="sd"> source=(ADD this: ...),</span> +</span><span id="diff-73"><a href="#diff-73"><span class="linenos">73</span></a><span class="sd"> target=(ADD this: ...)</span> +</span><span id="diff-74"><a href="#diff-74"><span class="linenos">74</span></a><span class="sd"> ),</span> +</span><span id="diff-75"><a href="#diff-75"><span class="linenos">75</span></a><span class="sd"> Keep(</span> +</span><span id="diff-76"><a href="#diff-76"><span class="linenos">76</span></a><span class="sd"> source=(COLUMN this: (IDENTIFIER this: a, quoted: False)),</span> +</span><span id="diff-77"><a href="#diff-77"><span class="linenos">77</span></a><span class="sd"> target=(COLUMN this: (IDENTIFIER this: a, quoted: False))</span> +</span><span id="diff-78"><a href="#diff-78"><span class="linenos">78</span></a><span class="sd"> ),</span> +</span><span id="diff-79"><a href="#diff-79"><span class="linenos">79</span></a><span class="sd"> ]</span> +</span><span id="diff-80"><a href="#diff-80"><span class="linenos">80</span></a> +</span><span id="diff-81"><a href="#diff-81"><span class="linenos">81</span></a><span class="sd"> Args:</span> +</span><span id="diff-82"><a href="#diff-82"><span class="linenos">82</span></a><span class="sd"> source: the source expression.</span> +</span><span id="diff-83"><a href="#diff-83"><span class="linenos">83</span></a><span class="sd"> target: the target expression against which the diff should be calculated.</span> +</span><span id="diff-84"><a href="#diff-84"><span class="linenos">84</span></a> +</span><span id="diff-85"><a href="#diff-85"><span class="linenos">85</span></a><span class="sd"> Returns:</span> +</span><span id="diff-86"><a href="#diff-86"><span class="linenos">86</span></a><span class="sd"> the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the</span> +</span><span id="diff-87"><a href="#diff-87"><span class="linenos">87</span></a><span class="sd"> target expression trees. This list represents a sequence of steps needed to transform the source</span> +</span><span id="diff-88"><a href="#diff-88"><span class="linenos">88</span></a><span class="sd"> expression tree into the target one.</span> +</span><span id="diff-89"><a href="#diff-89"><span class="linenos">89</span></a><span class="sd"> """</span> +</span><span id="diff-90"><a href="#diff-90"><span class="linenos">90</span></a> <span class="k">return</span> <span class="n">ChangeDistiller</span><span class="p">()</span><span class="o">.</span><span class="n">diff</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">target</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the list of changes between the source and the target expressions.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">diff</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"a + b"</span><span class="p">),</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"a + c"</span><span class="p">))</span> +<span class="go">[</span> +<span class="go"> Remove(expression=(COLUMN this: (IDENTIFIER this: b, quoted: False))),</span> +<span class="go"> Insert(expression=(COLUMN this: (IDENTIFIER this: c, quoted: False))),</span> +<span class="go"> Keep(</span> +<span class="go"> source=(ADD this: ...),</span> +<span class="go"> target=(ADD this: ...)</span> +<span class="go"> ),</span> +<span class="go"> Keep(</span> +<span class="go"> source=(COLUMN this: (IDENTIFIER this: a, quoted: False)),</span> +<span class="go"> target=(COLUMN this: (IDENTIFIER this: a, quoted: False))</span> +<span class="go"> ),</span> +<span class="go">]</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>source:</strong> the source expression.</li> +<li><strong>target:</strong> the target expression against which the diff should be calculated.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>the list of Insert, Remove, Move, Update and Keep objects for each node in the source and the + target expression trees. This list represents a sequence of steps needed to transform the source + expression tree into the target one.</p> +</blockquote> +</div> + + + </section> + <section id="ChangeDistiller"> + <input id="ChangeDistiller-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ChangeDistiller</span>: + + <label class="view-source-button" for="ChangeDistiller-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ChangeDistiller"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ChangeDistiller-101"><a href="#ChangeDistiller-101"><span class="linenos">101</span></a><span class="k">class</span> <span class="nc">ChangeDistiller</span><span class="p">:</span> +</span><span id="ChangeDistiller-102"><a href="#ChangeDistiller-102"><span class="linenos">102</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="ChangeDistiller-103"><a href="#ChangeDistiller-103"><span class="linenos">103</span></a><span class="sd"> The implementation of the Change Distiller algorithm described by Beat Fluri and Martin Pinzger in</span> +</span><span id="ChangeDistiller-104"><a href="#ChangeDistiller-104"><span class="linenos">104</span></a><span class="sd"> their paper https://ieeexplore.ieee.org/document/4339230, which in turn is based on the algorithm by</span> +</span><span id="ChangeDistiller-105"><a href="#ChangeDistiller-105"><span class="linenos">105</span></a><span class="sd"> Chawathe et al. described in http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf.</span> +</span><span id="ChangeDistiller-106"><a href="#ChangeDistiller-106"><span class="linenos">106</span></a><span class="sd"> """</span> +</span><span id="ChangeDistiller-107"><a href="#ChangeDistiller-107"><span class="linenos">107</span></a> +</span><span id="ChangeDistiller-108"><a href="#ChangeDistiller-108"><span class="linenos">108</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span><span class="p">,</span> <span class="n">t</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="ChangeDistiller-109"><a href="#ChangeDistiller-109"><span class="linenos">109</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">f</span> <span class="o">=</span> <span class="n">f</span> +</span><span id="ChangeDistiller-110"><a href="#ChangeDistiller-110"><span class="linenos">110</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">t</span> <span class="o">=</span> <span class="n">t</span> +</span><span id="ChangeDistiller-111"><a href="#ChangeDistiller-111"><span class="linenos">111</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_sql_generator</span> <span class="o">=</span> <span class="n">Dialect</span><span class="p">()</span><span class="o">.</span><span class="n">generator</span><span class="p">()</span> +</span><span id="ChangeDistiller-112"><a href="#ChangeDistiller-112"><span class="linenos">112</span></a> +</span><span id="ChangeDistiller-113"><a href="#ChangeDistiller-113"><span class="linenos">113</span></a> <span class="k">def</span> <span class="nf">diff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="ChangeDistiller-114"><a href="#ChangeDistiller-114"><span class="linenos">114</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span> <span class="o">=</span> <span class="n">source</span> +</span><span id="ChangeDistiller-115"><a href="#ChangeDistiller-115"><span class="linenos">115</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span> <span class="o">=</span> <span class="n">target</span> +</span><span id="ChangeDistiller-116"><a href="#ChangeDistiller-116"><span class="linenos">116</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">bfs</span><span class="p">()}</span> +</span><span id="ChangeDistiller-117"><a href="#ChangeDistiller-117"><span class="linenos">117</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">target</span><span class="o">.</span><span class="n">bfs</span><span class="p">()}</span> +</span><span id="ChangeDistiller-118"><a href="#ChangeDistiller-118"><span class="linenos">118</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">)</span> +</span><span id="ChangeDistiller-119"><a href="#ChangeDistiller-119"><span class="linenos">119</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">)</span> +</span><span id="ChangeDistiller-120"><a href="#ChangeDistiller-120"><span class="linenos">120</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="ChangeDistiller-121"><a href="#ChangeDistiller-121"><span class="linenos">121</span></a> +</span><span id="ChangeDistiller-122"><a href="#ChangeDistiller-122"><span class="linenos">122</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_compute_matching_set</span><span class="p">()</span> +</span><span id="ChangeDistiller-123"><a href="#ChangeDistiller-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_generate_edit_script</span><span class="p">(</span><span class="n">matching_set</span><span class="p">)</span> +</span><span id="ChangeDistiller-124"><a href="#ChangeDistiller-124"><span class="linenos">124</span></a> +</span><span id="ChangeDistiller-125"><a href="#ChangeDistiller-125"><span class="linenos">125</span></a> <span class="k">def</span> <span class="nf">_generate_edit_script</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="ChangeDistiller-126"><a href="#ChangeDistiller-126"><span class="linenos">126</span></a> <span class="n">edit_script</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="ChangeDistiller-127"><a href="#ChangeDistiller-127"><span class="linenos">127</span></a> <span class="k">for</span> <span class="n">removed_node_id</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="p">:</span> +</span><span id="ChangeDistiller-128"><a href="#ChangeDistiller-128"><span class="linenos">128</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Remove</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">removed_node_id</span><span class="p">]))</span> +</span><span id="ChangeDistiller-129"><a href="#ChangeDistiller-129"><span class="linenos">129</span></a> <span class="k">for</span> <span class="n">inserted_node_id</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span><span class="p">:</span> +</span><span id="ChangeDistiller-130"><a href="#ChangeDistiller-130"><span class="linenos">130</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Insert</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">[</span><span class="n">inserted_node_id</span><span class="p">]))</span> +</span><span id="ChangeDistiller-131"><a href="#ChangeDistiller-131"><span class="linenos">131</span></a> <span class="k">for</span> <span class="n">kept_source_node_id</span><span class="p">,</span> <span class="n">kept_target_node_id</span> <span class="ow">in</span> <span class="n">matching_set</span><span class="p">:</span> +</span><span id="ChangeDistiller-132"><a href="#ChangeDistiller-132"><span class="linenos">132</span></a> <span class="n">source_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">kept_source_node_id</span><span class="p">]</span> +</span><span id="ChangeDistiller-133"><a href="#ChangeDistiller-133"><span class="linenos">133</span></a> <span class="n">target_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">[</span><span class="n">kept_target_node_id</span><span class="p">]</span> +</span><span id="ChangeDistiller-134"><a href="#ChangeDistiller-134"><span class="linenos">134</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">LEAF_EXPRESSION_TYPES</span><span class="p">)</span> <span class="ow">or</span> <span class="n">source_node</span> <span class="o">==</span> <span class="n">target_node</span><span class="p">:</span> +</span><span id="ChangeDistiller-135"><a href="#ChangeDistiller-135"><span class="linenos">135</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span> +</span><span id="ChangeDistiller-136"><a href="#ChangeDistiller-136"><span class="linenos">136</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_generate_move_edits</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">)</span> +</span><span id="ChangeDistiller-137"><a href="#ChangeDistiller-137"><span class="linenos">137</span></a> <span class="p">)</span> +</span><span id="ChangeDistiller-138"><a href="#ChangeDistiller-138"><span class="linenos">138</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Keep</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> +</span><span id="ChangeDistiller-139"><a href="#ChangeDistiller-139"><span class="linenos">139</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="ChangeDistiller-140"><a href="#ChangeDistiller-140"><span class="linenos">140</span></a> <span class="n">edit_script</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Update</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">))</span> +</span><span id="ChangeDistiller-141"><a href="#ChangeDistiller-141"><span class="linenos">141</span></a> +</span><span id="ChangeDistiller-142"><a href="#ChangeDistiller-142"><span class="linenos">142</span></a> <span class="k">return</span> <span class="n">edit_script</span> +</span><span id="ChangeDistiller-143"><a href="#ChangeDistiller-143"><span class="linenos">143</span></a> +</span><span id="ChangeDistiller-144"><a href="#ChangeDistiller-144"><span class="linenos">144</span></a> <span class="k">def</span> <span class="nf">_generate_move_edits</span><span class="p">(</span> +</span><span id="ChangeDistiller-145"><a href="#ChangeDistiller-145"><span class="linenos">145</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">matching_set</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]</span> +</span><span id="ChangeDistiller-146"><a href="#ChangeDistiller-146"><span class="linenos">146</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Move</span><span class="p">]:</span> +</span><span id="ChangeDistiller-147"><a href="#ChangeDistiller-147"><span class="linenos">147</span></a> <span class="n">source_args</span> <span class="o">=</span> <span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">_expression_only_args</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> +</span><span id="ChangeDistiller-148"><a href="#ChangeDistiller-148"><span class="linenos">148</span></a> <span class="n">target_args</span> <span class="o">=</span> <span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">_expression_only_args</span><span class="p">(</span><span class="n">target</span><span class="p">)]</span> +</span><span id="ChangeDistiller-149"><a href="#ChangeDistiller-149"><span class="linenos">149</span></a> +</span><span id="ChangeDistiller-150"><a href="#ChangeDistiller-150"><span class="linenos">150</span></a> <span class="n">args_lcs</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">_lcs</span><span class="p">(</span><span class="n">source_args</span><span class="p">,</span> <span class="n">target_args</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">:</span> <span class="p">(</span><span class="n">l</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> <span class="ow">in</span> <span class="n">matching_set</span><span class="p">))</span> +</span><span id="ChangeDistiller-151"><a href="#ChangeDistiller-151"><span class="linenos">151</span></a> +</span><span id="ChangeDistiller-152"><a href="#ChangeDistiller-152"><span class="linenos">152</span></a> <span class="n">move_edits</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="ChangeDistiller-153"><a href="#ChangeDistiller-153"><span class="linenos">153</span></a> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">source_args</span><span class="p">:</span> +</span><span id="ChangeDistiller-154"><a href="#ChangeDistiller-154"><span class="linenos">154</span></a> <span class="k">if</span> <span class="n">a</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">args_lcs</span> <span class="ow">and</span> <span class="n">a</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="p">:</span> +</span><span id="ChangeDistiller-155"><a href="#ChangeDistiller-155"><span class="linenos">155</span></a> <span class="n">move_edits</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Move</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">a</span><span class="p">]))</span> +</span><span id="ChangeDistiller-156"><a href="#ChangeDistiller-156"><span class="linenos">156</span></a> +</span><span id="ChangeDistiller-157"><a href="#ChangeDistiller-157"><span class="linenos">157</span></a> <span class="k">return</span> <span class="n">move_edits</span> +</span><span id="ChangeDistiller-158"><a href="#ChangeDistiller-158"><span class="linenos">158</span></a> +</span><span id="ChangeDistiller-159"><a href="#ChangeDistiller-159"><span class="linenos">159</span></a> <span class="k">def</span> <span class="nf">_compute_matching_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]:</span> +</span><span id="ChangeDistiller-160"><a href="#ChangeDistiller-160"><span class="linenos">160</span></a> <span class="n">leaves_matching_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_compute_leaf_matching_set</span><span class="p">()</span> +</span><span id="ChangeDistiller-161"><a href="#ChangeDistiller-161"><span class="linenos">161</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="n">leaves_matching_set</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="ChangeDistiller-162"><a href="#ChangeDistiller-162"><span class="linenos">162</span></a> +</span><span id="ChangeDistiller-163"><a href="#ChangeDistiller-163"><span class="linenos">163</span></a> <span class="n">ordered_unmatched_source_nodes</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ChangeDistiller-164"><a href="#ChangeDistiller-164"><span class="linenos">164</span></a> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="o">.</span><span class="n">bfs</span><span class="p">()</span> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> +</span><span id="ChangeDistiller-165"><a href="#ChangeDistiller-165"><span class="linenos">165</span></a> <span class="p">}</span> +</span><span id="ChangeDistiller-166"><a href="#ChangeDistiller-166"><span class="linenos">166</span></a> <span class="n">ordered_unmatched_target_nodes</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ChangeDistiller-167"><a href="#ChangeDistiller-167"><span class="linenos">167</span></a> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="o">.</span><span class="n">bfs</span><span class="p">()</span> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> +</span><span id="ChangeDistiller-168"><a href="#ChangeDistiller-168"><span class="linenos">168</span></a> <span class="p">}</span> +</span><span id="ChangeDistiller-169"><a href="#ChangeDistiller-169"><span class="linenos">169</span></a> +</span><span id="ChangeDistiller-170"><a href="#ChangeDistiller-170"><span class="linenos">170</span></a> <span class="k">for</span> <span class="n">source_node_id</span> <span class="ow">in</span> <span class="n">ordered_unmatched_source_nodes</span><span class="p">:</span> +</span><span id="ChangeDistiller-171"><a href="#ChangeDistiller-171"><span class="linenos">171</span></a> <span class="k">for</span> <span class="n">target_node_id</span> <span class="ow">in</span> <span class="n">ordered_unmatched_target_nodes</span><span class="p">:</span> +</span><span id="ChangeDistiller-172"><a href="#ChangeDistiller-172"><span class="linenos">172</span></a> <span class="n">source_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">[</span><span class="n">source_node_id</span><span class="p">]</span> +</span><span id="ChangeDistiller-173"><a href="#ChangeDistiller-173"><span class="linenos">173</span></a> <span class="n">target_node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">[</span><span class="n">target_node_id</span><span class="p">]</span> +</span><span id="ChangeDistiller-174"><a href="#ChangeDistiller-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="n">_is_same_type</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">):</span> +</span><span id="ChangeDistiller-175"><a href="#ChangeDistiller-175"><span class="linenos">175</span></a> <span class="n">source_leaf_ids</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="n">source_node</span><span class="p">)}</span> +</span><span id="ChangeDistiller-176"><a href="#ChangeDistiller-176"><span class="linenos">176</span></a> <span class="n">target_leaf_ids</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">l</span><span class="p">)</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">_get_leaves</span><span class="p">(</span><span class="n">target_node</span><span class="p">)}</span> +</span><span id="ChangeDistiller-177"><a href="#ChangeDistiller-177"><span class="linenos">177</span></a> +</span><span id="ChangeDistiller-178"><a href="#ChangeDistiller-178"><span class="linenos">178</span></a> <span class="n">max_leaves_num</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_leaf_ids</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">target_leaf_ids</span><span class="p">))</span> +</span><span id="ChangeDistiller-179"><a href="#ChangeDistiller-179"><span class="linenos">179</span></a> <span class="k">if</span> <span class="n">max_leaves_num</span><span class="p">:</span> +</span><span id="ChangeDistiller-180"><a href="#ChangeDistiller-180"><span class="linenos">180</span></a> <span class="n">common_leaves_num</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span> +</span><span id="ChangeDistiller-181"><a href="#ChangeDistiller-181"><span class="linenos">181</span></a> <span class="mi">1</span> <span class="k">if</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">source_leaf_ids</span> <span class="ow">and</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">target_leaf_ids</span> <span class="k">else</span> <span class="mi">0</span> +</span><span id="ChangeDistiller-182"><a href="#ChangeDistiller-182"><span class="linenos">182</span></a> <span class="k">for</span> <span class="n">s</span><span class="p">,</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">leaves_matching_set</span> +</span><span id="ChangeDistiller-183"><a href="#ChangeDistiller-183"><span class="linenos">183</span></a> <span class="p">)</span> +</span><span id="ChangeDistiller-184"><a href="#ChangeDistiller-184"><span class="linenos">184</span></a> <span class="n">leaf_similarity_score</span> <span class="o">=</span> <span class="n">common_leaves_num</span> <span class="o">/</span> <span class="n">max_leaves_num</span> +</span><span id="ChangeDistiller-185"><a href="#ChangeDistiller-185"><span class="linenos">185</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="ChangeDistiller-186"><a href="#ChangeDistiller-186"><span class="linenos">186</span></a> <span class="n">leaf_similarity_score</span> <span class="o">=</span> <span class="mf">0.0</span> +</span><span id="ChangeDistiller-187"><a href="#ChangeDistiller-187"><span class="linenos">187</span></a> +</span><span id="ChangeDistiller-188"><a href="#ChangeDistiller-188"><span class="linenos">188</span></a> <span class="n">adjusted_t</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="ChangeDistiller-189"><a href="#ChangeDistiller-189"><span class="linenos">189</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">t</span> <span class="k">if</span> <span class="nb">min</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">source_leaf_ids</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">target_leaf_ids</span><span class="p">))</span> <span class="o">></span> <span class="mi">4</span> <span class="k">else</span> <span class="mf">0.4</span> +</span><span id="ChangeDistiller-190"><a href="#ChangeDistiller-190"><span class="linenos">190</span></a> <span class="p">)</span> +</span><span id="ChangeDistiller-191"><a href="#ChangeDistiller-191"><span class="linenos">191</span></a> +</span><span id="ChangeDistiller-192"><a href="#ChangeDistiller-192"><span class="linenos">192</span></a> <span class="k">if</span> <span class="n">leaf_similarity_score</span> <span class="o">>=</span> <span class="mf">0.8</span> <span class="ow">or</span> <span class="p">(</span> +</span><span id="ChangeDistiller-193"><a href="#ChangeDistiller-193"><span class="linenos">193</span></a> <span class="n">leaf_similarity_score</span> <span class="o">>=</span> <span class="n">adjusted_t</span> +</span><span id="ChangeDistiller-194"><a href="#ChangeDistiller-194"><span class="linenos">194</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dice_coefficient</span><span class="p">(</span><span class="n">source_node</span><span class="p">,</span> <span class="n">target_node</span><span class="p">)</span> <span class="o">>=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f</span> +</span><span id="ChangeDistiller-195"><a href="#ChangeDistiller-195"><span class="linenos">195</span></a> <span class="p">):</span> +</span><span id="ChangeDistiller-196"><a href="#ChangeDistiller-196"><span class="linenos">196</span></a> <span class="n">matching_set</span><span class="o">.</span><span class="n">add</span><span class="p">((</span><span class="n">source_node_id</span><span class="p">,</span> <span class="n">target_node_id</span><span class="p">))</span> +</span><span id="ChangeDistiller-197"><a href="#ChangeDistiller-197"><span class="linenos">197</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">source_node_id</span><span class="p">)</span> +</span><span id="ChangeDistiller-198"><a href="#ChangeDistiller-198"><span class="linenos">198</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">target_node_id</span><span class="p">)</span> +</span><span id="ChangeDistiller-199"><a href="#ChangeDistiller-199"><span class="linenos">199</span></a> <span class="n">ordered_unmatched_target_nodes</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">target_node_id</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="ChangeDistiller-200"><a href="#ChangeDistiller-200"><span class="linenos">200</span></a> <span class="k">break</span> +</span><span id="ChangeDistiller-201"><a href="#ChangeDistiller-201"><span class="linenos">201</span></a> +</span><span id="ChangeDistiller-202"><a href="#ChangeDistiller-202"><span class="linenos">202</span></a> <span class="k">return</span> <span class="n">matching_set</span> +</span><span id="ChangeDistiller-203"><a href="#ChangeDistiller-203"><span class="linenos">203</span></a> +</span><span id="ChangeDistiller-204"><a href="#ChangeDistiller-204"><span class="linenos">204</span></a> <span class="k">def</span> <span class="nf">_compute_leaf_matching_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]:</span> +</span><span id="ChangeDistiller-205"><a href="#ChangeDistiller-205"><span class="linenos">205</span></a> <span class="n">candidate_matchings</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="ChangeDistiller-206"><a href="#ChangeDistiller-206"><span class="linenos">206</span></a> <span class="n">source_leaves</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">_get_leaves</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source</span><span class="p">))</span> +</span><span id="ChangeDistiller-207"><a href="#ChangeDistiller-207"><span class="linenos">207</span></a> <span class="n">target_leaves</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">_get_leaves</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target</span><span class="p">))</span> +</span><span id="ChangeDistiller-208"><a href="#ChangeDistiller-208"><span class="linenos">208</span></a> <span class="k">for</span> <span class="n">source_leaf</span> <span class="ow">in</span> <span class="n">source_leaves</span><span class="p">:</span> +</span><span id="ChangeDistiller-209"><a href="#ChangeDistiller-209"><span class="linenos">209</span></a> <span class="k">for</span> <span class="n">target_leaf</span> <span class="ow">in</span> <span class="n">target_leaves</span><span class="p">:</span> +</span><span id="ChangeDistiller-210"><a href="#ChangeDistiller-210"><span class="linenos">210</span></a> <span class="k">if</span> <span class="n">_is_same_type</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span><span class="p">):</span> +</span><span id="ChangeDistiller-211"><a href="#ChangeDistiller-211"><span class="linenos">211</span></a> <span class="n">similarity_score</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dice_coefficient</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span><span class="p">)</span> +</span><span id="ChangeDistiller-212"><a href="#ChangeDistiller-212"><span class="linenos">212</span></a> <span class="k">if</span> <span class="n">similarity_score</span> <span class="o">>=</span> <span class="bp">self</span><span class="o">.</span><span class="n">f</span><span class="p">:</span> +</span><span id="ChangeDistiller-213"><a href="#ChangeDistiller-213"><span class="linenos">213</span></a> <span class="n">heappush</span><span class="p">(</span> +</span><span id="ChangeDistiller-214"><a href="#ChangeDistiller-214"><span class="linenos">214</span></a> <span class="n">candidate_matchings</span><span class="p">,</span> +</span><span id="ChangeDistiller-215"><a href="#ChangeDistiller-215"><span class="linenos">215</span></a> <span class="p">(</span> +</span><span id="ChangeDistiller-216"><a href="#ChangeDistiller-216"><span class="linenos">216</span></a> <span class="o">-</span><span class="n">similarity_score</span><span class="p">,</span> +</span><span id="ChangeDistiller-217"><a href="#ChangeDistiller-217"><span class="linenos">217</span></a> <span class="nb">len</span><span class="p">(</span><span class="n">candidate_matchings</span><span class="p">),</span> +</span><span id="ChangeDistiller-218"><a href="#ChangeDistiller-218"><span class="linenos">218</span></a> <span class="n">source_leaf</span><span class="p">,</span> +</span><span id="ChangeDistiller-219"><a href="#ChangeDistiller-219"><span class="linenos">219</span></a> <span class="n">target_leaf</span><span class="p">,</span> +</span><span id="ChangeDistiller-220"><a href="#ChangeDistiller-220"><span class="linenos">220</span></a> <span class="p">),</span> +</span><span id="ChangeDistiller-221"><a href="#ChangeDistiller-221"><span class="linenos">221</span></a> <span class="p">)</span> +</span><span id="ChangeDistiller-222"><a href="#ChangeDistiller-222"><span class="linenos">222</span></a> +</span><span id="ChangeDistiller-223"><a href="#ChangeDistiller-223"><span class="linenos">223</span></a> <span class="c1"># Pick best matchings based on the highest score</span> +</span><span id="ChangeDistiller-224"><a href="#ChangeDistiller-224"><span class="linenos">224</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="ChangeDistiller-225"><a href="#ChangeDistiller-225"><span class="linenos">225</span></a> <span class="k">while</span> <span class="n">candidate_matchings</span><span class="p">:</span> +</span><span id="ChangeDistiller-226"><a href="#ChangeDistiller-226"><span class="linenos">226</span></a> <span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">source_leaf</span><span class="p">,</span> <span class="n">target_leaf</span> <span class="o">=</span> <span class="n">heappop</span><span class="p">(</span><span class="n">candidate_matchings</span><span class="p">)</span> +</span><span id="ChangeDistiller-227"><a href="#ChangeDistiller-227"><span class="linenos">227</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="ChangeDistiller-228"><a href="#ChangeDistiller-228"><span class="linenos">228</span></a> <span class="nb">id</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> +</span><span id="ChangeDistiller-229"><a href="#ChangeDistiller-229"><span class="linenos">229</span></a> <span class="ow">and</span> <span class="nb">id</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> +</span><span id="ChangeDistiller-230"><a href="#ChangeDistiller-230"><span class="linenos">230</span></a> <span class="p">):</span> +</span><span id="ChangeDistiller-231"><a href="#ChangeDistiller-231"><span class="linenos">231</span></a> <span class="n">matching_set</span><span class="o">.</span><span class="n">add</span><span class="p">((</span><span class="nb">id</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">),</span> <span class="nb">id</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">)))</span> +</span><span id="ChangeDistiller-232"><a href="#ChangeDistiller-232"><span class="linenos">232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">source_leaf</span><span class="p">))</span> +</span><span id="ChangeDistiller-233"><a href="#ChangeDistiller-233"><span class="linenos">233</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="nb">id</span><span class="p">(</span><span class="n">target_leaf</span><span class="p">))</span> +</span><span id="ChangeDistiller-234"><a href="#ChangeDistiller-234"><span class="linenos">234</span></a> +</span><span id="ChangeDistiller-235"><a href="#ChangeDistiller-235"><span class="linenos">235</span></a> <span class="k">return</span> <span class="n">matching_set</span> +</span><span id="ChangeDistiller-236"><a href="#ChangeDistiller-236"><span class="linenos">236</span></a> +</span><span id="ChangeDistiller-237"><a href="#ChangeDistiller-237"><span class="linenos">237</span></a> <span class="k">def</span> <span class="nf">_dice_coefficient</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="nb">float</span><span class="p">:</span> +</span><span id="ChangeDistiller-238"><a href="#ChangeDistiller-238"><span class="linenos">238</span></a> <span class="n">source_histo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> +</span><span id="ChangeDistiller-239"><a href="#ChangeDistiller-239"><span class="linenos">239</span></a> <span class="n">target_histo</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo</span><span class="p">(</span><span class="n">target</span><span class="p">)</span> +</span><span id="ChangeDistiller-240"><a href="#ChangeDistiller-240"><span class="linenos">240</span></a> +</span><span id="ChangeDistiller-241"><a href="#ChangeDistiller-241"><span class="linenos">241</span></a> <span class="n">total_grams</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="n">source_histo</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> <span class="o">+</span> <span class="nb">sum</span><span class="p">(</span><span class="n">target_histo</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="ChangeDistiller-242"><a href="#ChangeDistiller-242"><span class="linenos">242</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">total_grams</span><span class="p">:</span> +</span><span id="ChangeDistiller-243"><a href="#ChangeDistiller-243"><span class="linenos">243</span></a> <span class="k">return</span> <span class="mf">1.0</span> <span class="k">if</span> <span class="n">source</span> <span class="o">==</span> <span class="n">target</span> <span class="k">else</span> <span class="mf">0.0</span> +</span><span id="ChangeDistiller-244"><a href="#ChangeDistiller-244"><span class="linenos">244</span></a> +</span><span id="ChangeDistiller-245"><a href="#ChangeDistiller-245"><span class="linenos">245</span></a> <span class="n">overlap_len</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="ChangeDistiller-246"><a href="#ChangeDistiller-246"><span class="linenos">246</span></a> <span class="n">overlapping_grams</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source_histo</span><span class="p">)</span> <span class="o">&</span> <span class="nb">set</span><span class="p">(</span><span class="n">target_histo</span><span class="p">)</span> +</span><span id="ChangeDistiller-247"><a href="#ChangeDistiller-247"><span class="linenos">247</span></a> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">overlapping_grams</span><span class="p">:</span> +</span><span id="ChangeDistiller-248"><a href="#ChangeDistiller-248"><span class="linenos">248</span></a> <span class="n">overlap_len</span> <span class="o">+=</span> <span class="nb">min</span><span class="p">(</span><span class="n">source_histo</span><span class="p">[</span><span class="n">g</span><span class="p">],</span> <span class="n">target_histo</span><span class="p">[</span><span class="n">g</span><span class="p">])</span> +</span><span id="ChangeDistiller-249"><a href="#ChangeDistiller-249"><span class="linenos">249</span></a> +</span><span id="ChangeDistiller-250"><a href="#ChangeDistiller-250"><span class="linenos">250</span></a> <span class="k">return</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">overlap_len</span> <span class="o">/</span> <span class="n">total_grams</span> +</span><span id="ChangeDistiller-251"><a href="#ChangeDistiller-251"><span class="linenos">251</span></a> +</span><span id="ChangeDistiller-252"><a href="#ChangeDistiller-252"><span class="linenos">252</span></a> <span class="k">def</span> <span class="nf">_bigram_histo</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]:</span> +</span><span id="ChangeDistiller-253"><a href="#ChangeDistiller-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">:</span> +</span><span id="ChangeDistiller-254"><a href="#ChangeDistiller-254"><span class="linenos">254</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">expression</span><span class="p">)]</span> +</span><span id="ChangeDistiller-255"><a href="#ChangeDistiller-255"><span class="linenos">255</span></a> +</span><span id="ChangeDistiller-256"><a href="#ChangeDistiller-256"><span class="linenos">256</span></a> <span class="n">expression_str</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sql_generator</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="ChangeDistiller-257"><a href="#ChangeDistiller-257"><span class="linenos">257</span></a> <span class="n">count</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression_str</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="ChangeDistiller-258"><a href="#ChangeDistiller-258"><span class="linenos">258</span></a> <span class="n">bigram_histo</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">int</span><span class="p">)</span> +</span><span id="ChangeDistiller-259"><a href="#ChangeDistiller-259"><span class="linenos">259</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">count</span><span class="p">):</span> +</span><span id="ChangeDistiller-260"><a href="#ChangeDistiller-260"><span class="linenos">260</span></a> <span class="n">bigram_histo</span><span class="p">[</span><span class="n">expression_str</span><span class="p">[</span><span class="n">i</span> <span class="p">:</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">2</span><span class="p">]]</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="ChangeDistiller-261"><a href="#ChangeDistiller-261"><span class="linenos">261</span></a> +</span><span id="ChangeDistiller-262"><a href="#ChangeDistiller-262"><span class="linenos">262</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">expression</span><span class="p">)]</span> <span class="o">=</span> <span class="n">bigram_histo</span> +</span><span id="ChangeDistiller-263"><a href="#ChangeDistiller-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="n">bigram_histo</span> +</span></pre></div> + + + <div class="docstring"><p>The implementation of the Change Distiller algorithm described by Beat Fluri and Martin Pinzger in +their paper <a href="https://ieeexplore.ieee.org/document/4339230">https://ieeexplore.ieee.org/document/4339230</a>, which in turn is based on the algorithm by +Chawathe et al. described in <a href="http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf">http://ilpubs.stanford.edu:8090/115/1/1995-46.pdf</a>.</p> +</div> + + + <div id="ChangeDistiller.__init__" class="classattr"> + <input id="ChangeDistiller.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">ChangeDistiller</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">f</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span>, </span><span class="param"><span class="n">t</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span></span>)</span> + + <label class="view-source-button" for="ChangeDistiller.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ChangeDistiller.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ChangeDistiller.__init__-108"><a href="#ChangeDistiller.__init__-108"><span class="linenos">108</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">f</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span><span class="p">,</span> <span class="n">t</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="mf">0.6</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="ChangeDistiller.__init__-109"><a href="#ChangeDistiller.__init__-109"><span class="linenos">109</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">f</span> <span class="o">=</span> <span class="n">f</span> +</span><span id="ChangeDistiller.__init__-110"><a href="#ChangeDistiller.__init__-110"><span class="linenos">110</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">t</span> <span class="o">=</span> <span class="n">t</span> +</span><span id="ChangeDistiller.__init__-111"><a href="#ChangeDistiller.__init__-111"><span class="linenos">111</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_sql_generator</span> <span class="o">=</span> <span class="n">Dialect</span><span class="p">()</span><span class="o">.</span><span class="n">generator</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="ChangeDistiller.diff" class="classattr"> + <input id="ChangeDistiller.diff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">diff</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">source</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">target</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="n"><a href="#Insert">sqlglot.diff.Insert</a></span><span class="p">,</span> <span class="n"><a href="#Remove">sqlglot.diff.Remove</a></span><span class="p">,</span> <span class="n"><a href="#Move">sqlglot.diff.Move</a></span><span class="p">,</span> <span class="n"><a href="#Update">sqlglot.diff.Update</a></span><span class="p">,</span> <span class="n"><a href="#Keep">sqlglot.diff.Keep</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="ChangeDistiller.diff-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ChangeDistiller.diff"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ChangeDistiller.diff-113"><a href="#ChangeDistiller.diff-113"><span class="linenos">113</span></a> <span class="k">def</span> <span class="nf">diff</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Edit</span><span class="p">]:</span> +</span><span id="ChangeDistiller.diff-114"><a href="#ChangeDistiller.diff-114"><span class="linenos">114</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source</span> <span class="o">=</span> <span class="n">source</span> +</span><span id="ChangeDistiller.diff-115"><a href="#ChangeDistiller.diff-115"><span class="linenos">115</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_target</span> <span class="o">=</span> <span class="n">target</span> +</span><span id="ChangeDistiller.diff-116"><a href="#ChangeDistiller.diff-116"><span class="linenos">116</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">bfs</span><span class="p">()}</span> +</span><span id="ChangeDistiller.diff-117"><a href="#ChangeDistiller.diff-117"><span class="linenos">117</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> <span class="n">n</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">target</span><span class="o">.</span><span class="n">bfs</span><span class="p">()}</span> +</span><span id="ChangeDistiller.diff-118"><a href="#ChangeDistiller.diff-118"><span class="linenos">118</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_source_nodes</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_source_index</span><span class="p">)</span> +</span><span id="ChangeDistiller.diff-119"><a href="#ChangeDistiller.diff-119"><span class="linenos">119</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unmatched_target_nodes</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_target_index</span><span class="p">)</span> +</span><span id="ChangeDistiller.diff-120"><a href="#ChangeDistiller.diff-120"><span class="linenos">120</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_bigram_histo_cache</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">DefaultDict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">int</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="ChangeDistiller.diff-121"><a href="#ChangeDistiller.diff-121"><span class="linenos">121</span></a> +</span><span id="ChangeDistiller.diff-122"><a href="#ChangeDistiller.diff-122"><span class="linenos">122</span></a> <span class="n">matching_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_compute_matching_set</span><span class="p">()</span> +</span><span id="ChangeDistiller.diff-123"><a href="#ChangeDistiller.diff-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_generate_edit_script</span><span class="p">(</span><span class="n">matching_set</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/errors.html b/docs/sqlglot/errors.html new file mode 100644 index 0000000..534f71a --- /dev/null +++ b/docs/sqlglot/errors.html @@ -0,0 +1,877 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.errors API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#ErrorLevel">ErrorLevel</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#ErrorLevel.IGNORE">IGNORE</a> + </li> + <li> + <a class="variable" href="#ErrorLevel.WARN">WARN</a> + </li> + <li> + <a class="variable" href="#ErrorLevel.RAISE">RAISE</a> + </li> + <li> + <a class="variable" href="#ErrorLevel.IMMEDIATE">IMMEDIATE</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#SqlglotError">SqlglotError</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UnsupportedError">UnsupportedError</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ParseError">ParseError</a> + <ul class="memberlist"> + <li> + <a class="function" href="#ParseError.__init__">ParseError</a> + </li> + <li> + <a class="function" href="#ParseError.new">new</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#TokenError">TokenError</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#OptimizeError">OptimizeError</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SchemaError">SchemaError</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ExecuteError">ExecuteError</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="function" href="#concat_messages">concat_messages</a> + </li> + <li> + <a class="function" href="#merge_errors">merge_errors</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/errors.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.errors </h1> + + + <input id="mod-errors-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-errors-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">auto</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">AutoName</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">ErrorLevel</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="n">IGNORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="w"> </span><span class="sd">"""Ignore all errors."""</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="n">WARN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="w"> </span><span class="sd">"""Log all errors."""</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="n">RAISE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="w"> </span><span class="sd">"""Collect all errors and raise a single exception."""</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="n">IMMEDIATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="w"> </span><span class="sd">"""Immediately raise an exception on the first error found."""</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a><span class="k">class</span> <span class="nc">SqlglotError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="k">pass</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a><span class="k">class</span> <span class="nc">UnsupportedError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="k">pass</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a><span class="k">class</span> <span class="nc">ParseError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="p">):</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="n">errors</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="nd">@classmethod</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="k">def</span> <span class="nf">new</span><span class="p">(</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> <span class="bp">cls</span><span class="p">,</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> <span class="n">description</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="n">line</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> <span class="n">col</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> <span class="n">start_context</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="n">highlight</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="n">end_context</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> <span class="n">into_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> <span class="n">message</span><span class="p">,</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> <span class="p">[</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> <span class="p">{</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="s2">"description"</span><span class="p">:</span> <span class="n">description</span><span class="p">,</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="s2">"line"</span><span class="p">:</span> <span class="n">line</span><span class="p">,</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="s2">"col"</span><span class="p">:</span> <span class="n">col</span><span class="p">,</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> <span class="s2">"start_context"</span><span class="p">:</span> <span class="n">start_context</span><span class="p">,</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="s2">"highlight"</span><span class="p">:</span> <span class="n">highlight</span><span class="p">,</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> <span class="s2">"end_context"</span><span class="p">:</span> <span class="n">end_context</span><span class="p">,</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="s2">"into_expression"</span><span class="p">:</span> <span class="n">into_expression</span><span class="p">,</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="p">}</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> <span class="p">],</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> <span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a><span class="k">class</span> <span class="nc">TokenError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="k">pass</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a><span class="k">class</span> <span class="nc">OptimizeError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a> <span class="k">pass</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a><span class="k">class</span> <span class="nc">SchemaError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos">77</span></a> <span class="k">pass</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos">78</span></a> +</span><span id="L-79"><a href="#L-79"><span class="linenos">79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos">80</span></a><span class="k">class</span> <span class="nc">ExecuteError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos">81</span></a> <span class="k">pass</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos">82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos">83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos">84</span></a><span class="k">def</span> <span class="nf">concat_messages</span><span class="p">(</span><span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">],</span> <span class="n">maximum</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos">85</span></a> <span class="n">msg</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">errors</span><span class="p">[:</span><span class="n">maximum</span><span class="p">]]</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos">86</span></a> <span class="n">remaining</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">errors</span><span class="p">)</span> <span class="o">-</span> <span class="n">maximum</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos">87</span></a> <span class="k">if</span> <span class="n">remaining</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos">88</span></a> <span class="n">msg</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"... and </span><span class="si">{</span><span class="n">remaining</span><span class="si">}</span><span class="s2"> more"</span><span class="p">)</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos">89</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos">90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos">91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos">92</span></a><span class="k">def</span> <span class="nf">merge_errors</span><span class="p">(</span><span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">ParseError</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]:</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos">93</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">e_dict</span> <span class="k">for</span> <span class="n">error</span> <span class="ow">in</span> <span class="n">errors</span> <span class="k">for</span> <span class="n">e_dict</span> <span class="ow">in</span> <span class="n">error</span><span class="o">.</span><span class="n">errors</span><span class="p">]</span> +</span></pre></div> + + + </section> + <section id="ErrorLevel"> + <input id="ErrorLevel-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ErrorLevel</span><wbr>(<span class="base"><a href="helper.html#AutoName">sqlglot.helper.AutoName</a></span>): + + <label class="view-source-button" for="ErrorLevel-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ErrorLevel"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ErrorLevel-10"><a href="#ErrorLevel-10"><span class="linenos">10</span></a><span class="k">class</span> <span class="nc">ErrorLevel</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="ErrorLevel-11"><a href="#ErrorLevel-11"><span class="linenos">11</span></a> <span class="n">IGNORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ErrorLevel-12"><a href="#ErrorLevel-12"><span class="linenos">12</span></a><span class="w"> </span><span class="sd">"""Ignore all errors."""</span> +</span><span id="ErrorLevel-13"><a href="#ErrorLevel-13"><span class="linenos">13</span></a> +</span><span id="ErrorLevel-14"><a href="#ErrorLevel-14"><span class="linenos">14</span></a> <span class="n">WARN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ErrorLevel-15"><a href="#ErrorLevel-15"><span class="linenos">15</span></a><span class="w"> </span><span class="sd">"""Log all errors."""</span> +</span><span id="ErrorLevel-16"><a href="#ErrorLevel-16"><span class="linenos">16</span></a> +</span><span id="ErrorLevel-17"><a href="#ErrorLevel-17"><span class="linenos">17</span></a> <span class="n">RAISE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ErrorLevel-18"><a href="#ErrorLevel-18"><span class="linenos">18</span></a><span class="w"> </span><span class="sd">"""Collect all errors and raise a single exception."""</span> +</span><span id="ErrorLevel-19"><a href="#ErrorLevel-19"><span class="linenos">19</span></a> +</span><span id="ErrorLevel-20"><a href="#ErrorLevel-20"><span class="linenos">20</span></a> <span class="n">IMMEDIATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ErrorLevel-21"><a href="#ErrorLevel-21"><span class="linenos">21</span></a><span class="w"> </span><span class="sd">"""Immediately raise an exception on the first error found."""</span> +</span></pre></div> + + + <div class="docstring"><p>An enumeration.</p> +</div> + + + <div id="ErrorLevel.IGNORE" class="classattr"> + <div class="attr variable"> + <span class="name">IGNORE</span><span class="default_value"> = <<a href="#ErrorLevel.IGNORE">ErrorLevel.IGNORE</a>: 'IGNORE'></span> + + + </div> + <a class="headerlink" href="#ErrorLevel.IGNORE"></a> + + <div class="docstring"><p>Ignore all errors.</p> +</div> + + + </div> + <div id="ErrorLevel.WARN" class="classattr"> + <div class="attr variable"> + <span class="name">WARN</span><span class="default_value"> = <<a href="#ErrorLevel.WARN">ErrorLevel.WARN</a>: 'WARN'></span> + + + </div> + <a class="headerlink" href="#ErrorLevel.WARN"></a> + + <div class="docstring"><p>Log all errors.</p> +</div> + + + </div> + <div id="ErrorLevel.RAISE" class="classattr"> + <div class="attr variable"> + <span class="name">RAISE</span><span class="default_value"> = <<a href="#ErrorLevel.RAISE">ErrorLevel.RAISE</a>: 'RAISE'></span> + + + </div> + <a class="headerlink" href="#ErrorLevel.RAISE"></a> + + <div class="docstring"><p>Collect all errors and raise a single exception.</p> +</div> + + + </div> + <div id="ErrorLevel.IMMEDIATE" class="classattr"> + <div class="attr variable"> + <span class="name">IMMEDIATE</span><span class="default_value"> = <<a href="#ErrorLevel.IMMEDIATE">ErrorLevel.IMMEDIATE</a>: 'IMMEDIATE'></span> + + + </div> + <a class="headerlink" href="#ErrorLevel.IMMEDIATE"></a> + + <div class="docstring"><p>Immediately raise an exception on the first error found.</p> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="ErrorLevel.name" class="variable">name</dd> + <dd id="ErrorLevel.value" class="variable">value</dd> + + </div> + </dl> + </div> + </section> + <section id="SqlglotError"> + <input id="SqlglotError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SqlglotError</span><wbr>(<span class="base">builtins.Exception</span>): + + <label class="view-source-button" for="SqlglotError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SqlglotError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SqlglotError-24"><a href="#SqlglotError-24"><span class="linenos">24</span></a><span class="k">class</span> <span class="nc">SqlglotError</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span> +</span><span id="SqlglotError-25"><a href="#SqlglotError-25"><span class="linenos">25</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.Exception</dt> + <dd id="SqlglotError.__init__" class="function">Exception</dd> + + </div> + <div><dt>builtins.BaseException</dt> + <dd id="SqlglotError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="UnsupportedError"> + <input id="UnsupportedError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UnsupportedError</span><wbr>(<span class="base"><a href="#SqlglotError">SqlglotError</a></span>): + + <label class="view-source-button" for="UnsupportedError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UnsupportedError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UnsupportedError-28"><a href="#UnsupportedError-28"><span class="linenos">28</span></a><span class="k">class</span> <span class="nc">UnsupportedError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="UnsupportedError-29"><a href="#UnsupportedError-29"><span class="linenos">29</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.Exception</dt> + <dd id="UnsupportedError.__init__" class="function">Exception</dd> + + </div> + <div><dt>builtins.BaseException</dt> + <dd id="UnsupportedError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="ParseError"> + <input id="ParseError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ParseError</span><wbr>(<span class="base"><a href="#SqlglotError">SqlglotError</a></span>): + + <label class="view-source-button" for="ParseError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ParseError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ParseError-32"><a href="#ParseError-32"><span class="linenos">32</span></a><span class="k">class</span> <span class="nc">ParseError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="ParseError-33"><a href="#ParseError-33"><span class="linenos">33</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="ParseError-34"><a href="#ParseError-34"><span class="linenos">34</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="ParseError-35"><a href="#ParseError-35"><span class="linenos">35</span></a> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="ParseError-36"><a href="#ParseError-36"><span class="linenos">36</span></a> <span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-37"><a href="#ParseError-37"><span class="linenos">37</span></a> <span class="p">):</span> +</span><span id="ParseError-38"><a href="#ParseError-38"><span class="linenos">38</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="ParseError-39"><a href="#ParseError-39"><span class="linenos">39</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="n">errors</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="ParseError-40"><a href="#ParseError-40"><span class="linenos">40</span></a> +</span><span id="ParseError-41"><a href="#ParseError-41"><span class="linenos">41</span></a> <span class="nd">@classmethod</span> +</span><span id="ParseError-42"><a href="#ParseError-42"><span class="linenos">42</span></a> <span class="k">def</span> <span class="nf">new</span><span class="p">(</span> +</span><span id="ParseError-43"><a href="#ParseError-43"><span class="linenos">43</span></a> <span class="bp">cls</span><span class="p">,</span> +</span><span id="ParseError-44"><a href="#ParseError-44"><span class="linenos">44</span></a> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="ParseError-45"><a href="#ParseError-45"><span class="linenos">45</span></a> <span class="n">description</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-46"><a href="#ParseError-46"><span class="linenos">46</span></a> <span class="n">line</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-47"><a href="#ParseError-47"><span class="linenos">47</span></a> <span class="n">col</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-48"><a href="#ParseError-48"><span class="linenos">48</span></a> <span class="n">start_context</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-49"><a href="#ParseError-49"><span class="linenos">49</span></a> <span class="n">highlight</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-50"><a href="#ParseError-50"><span class="linenos">50</span></a> <span class="n">end_context</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-51"><a href="#ParseError-51"><span class="linenos">51</span></a> <span class="n">into_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError-52"><a href="#ParseError-52"><span class="linenos">52</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="ParseError-53"><a href="#ParseError-53"><span class="linenos">53</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span> +</span><span id="ParseError-54"><a href="#ParseError-54"><span class="linenos">54</span></a> <span class="n">message</span><span class="p">,</span> +</span><span id="ParseError-55"><a href="#ParseError-55"><span class="linenos">55</span></a> <span class="p">[</span> +</span><span id="ParseError-56"><a href="#ParseError-56"><span class="linenos">56</span></a> <span class="p">{</span> +</span><span id="ParseError-57"><a href="#ParseError-57"><span class="linenos">57</span></a> <span class="s2">"description"</span><span class="p">:</span> <span class="n">description</span><span class="p">,</span> +</span><span id="ParseError-58"><a href="#ParseError-58"><span class="linenos">58</span></a> <span class="s2">"line"</span><span class="p">:</span> <span class="n">line</span><span class="p">,</span> +</span><span id="ParseError-59"><a href="#ParseError-59"><span class="linenos">59</span></a> <span class="s2">"col"</span><span class="p">:</span> <span class="n">col</span><span class="p">,</span> +</span><span id="ParseError-60"><a href="#ParseError-60"><span class="linenos">60</span></a> <span class="s2">"start_context"</span><span class="p">:</span> <span class="n">start_context</span><span class="p">,</span> +</span><span id="ParseError-61"><a href="#ParseError-61"><span class="linenos">61</span></a> <span class="s2">"highlight"</span><span class="p">:</span> <span class="n">highlight</span><span class="p">,</span> +</span><span id="ParseError-62"><a href="#ParseError-62"><span class="linenos">62</span></a> <span class="s2">"end_context"</span><span class="p">:</span> <span class="n">end_context</span><span class="p">,</span> +</span><span id="ParseError-63"><a href="#ParseError-63"><span class="linenos">63</span></a> <span class="s2">"into_expression"</span><span class="p">:</span> <span class="n">into_expression</span><span class="p">,</span> +</span><span id="ParseError-64"><a href="#ParseError-64"><span class="linenos">64</span></a> <span class="p">}</span> +</span><span id="ParseError-65"><a href="#ParseError-65"><span class="linenos">65</span></a> <span class="p">],</span> +</span><span id="ParseError-66"><a href="#ParseError-66"><span class="linenos">66</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div id="ParseError.__init__" class="classattr"> + <input id="ParseError.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">ParseError</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">message</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="n">errors</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="ParseError.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ParseError.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ParseError.__init__-33"><a href="#ParseError.__init__-33"><span class="linenos">33</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="ParseError.__init__-34"><a href="#ParseError.__init__-34"><span class="linenos">34</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="ParseError.__init__-35"><a href="#ParseError.__init__-35"><span class="linenos">35</span></a> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="ParseError.__init__-36"><a href="#ParseError.__init__-36"><span class="linenos">36</span></a> <span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.__init__-37"><a href="#ParseError.__init__-37"><span class="linenos">37</span></a> <span class="p">):</span> +</span><span id="ParseError.__init__-38"><a href="#ParseError.__init__-38"><span class="linenos">38</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="ParseError.__init__-39"><a href="#ParseError.__init__-39"><span class="linenos">39</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="n">errors</span> <span class="ow">or</span> <span class="p">[]</span> +</span></pre></div> + + + + + </div> + <div id="ParseError.new" class="classattr"> + <input id="ParseError.new-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">new</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">description</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">line</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">col</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">start_context</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">highlight</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">end_context</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">into_expression</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#ParseError">sqlglot.errors.ParseError</a></span>:</span></span> + + <label class="view-source-button" for="ParseError.new-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ParseError.new"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ParseError.new-41"><a href="#ParseError.new-41"><span class="linenos">41</span></a> <span class="nd">@classmethod</span> +</span><span id="ParseError.new-42"><a href="#ParseError.new-42"><span class="linenos">42</span></a> <span class="k">def</span> <span class="nf">new</span><span class="p">(</span> +</span><span id="ParseError.new-43"><a href="#ParseError.new-43"><span class="linenos">43</span></a> <span class="bp">cls</span><span class="p">,</span> +</span><span id="ParseError.new-44"><a href="#ParseError.new-44"><span class="linenos">44</span></a> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="ParseError.new-45"><a href="#ParseError.new-45"><span class="linenos">45</span></a> <span class="n">description</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-46"><a href="#ParseError.new-46"><span class="linenos">46</span></a> <span class="n">line</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-47"><a href="#ParseError.new-47"><span class="linenos">47</span></a> <span class="n">col</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-48"><a href="#ParseError.new-48"><span class="linenos">48</span></a> <span class="n">start_context</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-49"><a href="#ParseError.new-49"><span class="linenos">49</span></a> <span class="n">highlight</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-50"><a href="#ParseError.new-50"><span class="linenos">50</span></a> <span class="n">end_context</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-51"><a href="#ParseError.new-51"><span class="linenos">51</span></a> <span class="n">into_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="ParseError.new-52"><a href="#ParseError.new-52"><span class="linenos">52</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="ParseError.new-53"><a href="#ParseError.new-53"><span class="linenos">53</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span> +</span><span id="ParseError.new-54"><a href="#ParseError.new-54"><span class="linenos">54</span></a> <span class="n">message</span><span class="p">,</span> +</span><span id="ParseError.new-55"><a href="#ParseError.new-55"><span class="linenos">55</span></a> <span class="p">[</span> +</span><span id="ParseError.new-56"><a href="#ParseError.new-56"><span class="linenos">56</span></a> <span class="p">{</span> +</span><span id="ParseError.new-57"><a href="#ParseError.new-57"><span class="linenos">57</span></a> <span class="s2">"description"</span><span class="p">:</span> <span class="n">description</span><span class="p">,</span> +</span><span id="ParseError.new-58"><a href="#ParseError.new-58"><span class="linenos">58</span></a> <span class="s2">"line"</span><span class="p">:</span> <span class="n">line</span><span class="p">,</span> +</span><span id="ParseError.new-59"><a href="#ParseError.new-59"><span class="linenos">59</span></a> <span class="s2">"col"</span><span class="p">:</span> <span class="n">col</span><span class="p">,</span> +</span><span id="ParseError.new-60"><a href="#ParseError.new-60"><span class="linenos">60</span></a> <span class="s2">"start_context"</span><span class="p">:</span> <span class="n">start_context</span><span class="p">,</span> +</span><span id="ParseError.new-61"><a href="#ParseError.new-61"><span class="linenos">61</span></a> <span class="s2">"highlight"</span><span class="p">:</span> <span class="n">highlight</span><span class="p">,</span> +</span><span id="ParseError.new-62"><a href="#ParseError.new-62"><span class="linenos">62</span></a> <span class="s2">"end_context"</span><span class="p">:</span> <span class="n">end_context</span><span class="p">,</span> +</span><span id="ParseError.new-63"><a href="#ParseError.new-63"><span class="linenos">63</span></a> <span class="s2">"into_expression"</span><span class="p">:</span> <span class="n">into_expression</span><span class="p">,</span> +</span><span id="ParseError.new-64"><a href="#ParseError.new-64"><span class="linenos">64</span></a> <span class="p">}</span> +</span><span id="ParseError.new-65"><a href="#ParseError.new-65"><span class="linenos">65</span></a> <span class="p">],</span> +</span><span id="ParseError.new-66"><a href="#ParseError.new-66"><span class="linenos">66</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.BaseException</dt> + <dd id="ParseError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="TokenError"> + <input id="TokenError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TokenError</span><wbr>(<span class="base"><a href="#SqlglotError">SqlglotError</a></span>): + + <label class="view-source-button" for="TokenError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TokenError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TokenError-69"><a href="#TokenError-69"><span class="linenos">69</span></a><span class="k">class</span> <span class="nc">TokenError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="TokenError-70"><a href="#TokenError-70"><span class="linenos">70</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.Exception</dt> + <dd id="TokenError.__init__" class="function">Exception</dd> + + </div> + <div><dt>builtins.BaseException</dt> + <dd id="TokenError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="OptimizeError"> + <input id="OptimizeError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">OptimizeError</span><wbr>(<span class="base"><a href="#SqlglotError">SqlglotError</a></span>): + + <label class="view-source-button" for="OptimizeError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#OptimizeError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="OptimizeError-73"><a href="#OptimizeError-73"><span class="linenos">73</span></a><span class="k">class</span> <span class="nc">OptimizeError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="OptimizeError-74"><a href="#OptimizeError-74"><span class="linenos">74</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.Exception</dt> + <dd id="OptimizeError.__init__" class="function">Exception</dd> + + </div> + <div><dt>builtins.BaseException</dt> + <dd id="OptimizeError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="SchemaError"> + <input id="SchemaError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SchemaError</span><wbr>(<span class="base"><a href="#SqlglotError">SqlglotError</a></span>): + + <label class="view-source-button" for="SchemaError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SchemaError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SchemaError-77"><a href="#SchemaError-77"><span class="linenos">77</span></a><span class="k">class</span> <span class="nc">SchemaError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="SchemaError-78"><a href="#SchemaError-78"><span class="linenos">78</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.Exception</dt> + <dd id="SchemaError.__init__" class="function">Exception</dd> + + </div> + <div><dt>builtins.BaseException</dt> + <dd id="SchemaError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="ExecuteError"> + <input id="ExecuteError-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ExecuteError</span><wbr>(<span class="base"><a href="#SqlglotError">SqlglotError</a></span>): + + <label class="view-source-button" for="ExecuteError-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ExecuteError"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ExecuteError-81"><a href="#ExecuteError-81"><span class="linenos">81</span></a><span class="k">class</span> <span class="nc">ExecuteError</span><span class="p">(</span><span class="n">SqlglotError</span><span class="p">):</span> +</span><span id="ExecuteError-82"><a href="#ExecuteError-82"><span class="linenos">82</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Common base class for all non-exit exceptions.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>builtins.Exception</dt> + <dd id="ExecuteError.__init__" class="function">Exception</dd> + + </div> + <div><dt>builtins.BaseException</dt> + <dd id="ExecuteError.with_traceback" class="function">with_traceback</dd> + + </div> + </dl> + </div> + </section> + <section id="concat_messages"> + <input id="concat_messages-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">concat_messages</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">errors</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span>, </span><span class="param"><span class="n">maximum</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="concat_messages-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#concat_messages"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="concat_messages-85"><a href="#concat_messages-85"><span class="linenos">85</span></a><span class="k">def</span> <span class="nf">concat_messages</span><span class="p">(</span><span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">],</span> <span class="n">maximum</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="concat_messages-86"><a href="#concat_messages-86"><span class="linenos">86</span></a> <span class="n">msg</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">errors</span><span class="p">[:</span><span class="n">maximum</span><span class="p">]]</span> +</span><span id="concat_messages-87"><a href="#concat_messages-87"><span class="linenos">87</span></a> <span class="n">remaining</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">errors</span><span class="p">)</span> <span class="o">-</span> <span class="n">maximum</span> +</span><span id="concat_messages-88"><a href="#concat_messages-88"><span class="linenos">88</span></a> <span class="k">if</span> <span class="n">remaining</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="concat_messages-89"><a href="#concat_messages-89"><span class="linenos">89</span></a> <span class="n">msg</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"... and </span><span class="si">{</span><span class="n">remaining</span><span class="si">}</span><span class="s2"> more"</span><span class="p">)</span> +</span><span id="concat_messages-90"><a href="#concat_messages-90"><span class="linenos">90</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="merge_errors"> + <input id="merge_errors-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">merge_errors</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">errors</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n"><a href="#ParseError">sqlglot.errors.ParseError</a></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Any</span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="merge_errors-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#merge_errors"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="merge_errors-93"><a href="#merge_errors-93"><span class="linenos">93</span></a><span class="k">def</span> <span class="nf">merge_errors</span><span class="p">(</span><span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">ParseError</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]]:</span> +</span><span id="merge_errors-94"><a href="#merge_errors-94"><span class="linenos">94</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">e_dict</span> <span class="k">for</span> <span class="n">error</span> <span class="ow">in</span> <span class="n">errors</span> <span class="k">for</span> <span class="n">e_dict</span> <span class="ow">in</span> <span class="n">error</span><span class="o">.</span><span class="n">errors</span><span class="p">]</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/executor.html b/docs/sqlglot/executor.html new file mode 100644 index 0000000..a0cfd40 --- /dev/null +++ b/docs/sqlglot/executor.html @@ -0,0 +1,694 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.executor API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + <h2>Contents</h2> + <ul> + <li><a href="#writing-a-python-sql-engine-from-scratch">Writing a Python SQL engine from scratch</a> + <ul> + <li><a href="#introduction">Introduction</a></li> + <li><a href="#why">Why?</a></li> + <li><a href="#how">How?</a></li> + <li><a href="#tokenizing">Tokenizing</a></li> + <li><a href="#parsing">Parsing</a></li> + <li><a href="#optimizing">Optimizing</a></li> + <li><a href="#planning">Planning</a></li> + <li><a href="#executing">Executing</a></li> + <li><a href="#whats-next">What's next</a></li> + <li><a href="#special-thanks">Special thanks</a></li> + <li><a href="#get-in-touch">Get in touch</a></li> + </ul></li> +</ul> + + + <h2>Submodules</h2> + <ul> + <li><a href="executor/context.html">context</a></li> + <li><a href="executor/env.html">env</a></li> + <li><a href="executor/python.html">python</a></li> + <li><a href="executor/table.html">table</a></li> + </ul> + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#execute">execute</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/executor/__init__.py">Edit on GitHub</a> + + <div class="docstring"><h1 id="writing-a-python-sql-engine-from-scratch">Writing a Python SQL engine from scratch</h1> + +<p><a href="https://www.linkedin.com/in/toby-mao/">Toby Mao</a></p> + +<h2 id="introduction">Introduction</h2> + +<p>When I first started writing SQLGlot in early 2021, my goal was just to translate SQL queries from SparkSQL to Presto and vice versa. However, over the last year and a half, I've ended up with a full-fledged SQL engine. SQLGlot can now parse and transpile between <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/dialects/__init__.py">18 SQL dialects</a> and can execute all 24 <a href="https://www.tpc.org/tpch/">TPC-H</a> SQL queries. The parser and engine are all written from scratch using Python.</p> + +<p>This post will cover <a href="#why">why</a> I went through the effort of creating a Python SQL engine and <a href="#how">how</a> a simple query goes from a string to actually transforming data. The following steps are briefly summarized:</p> + +<ul> +<li><a href="#tokenizing">Tokenizing</a></li> +<li><a href="#parsing">Parsing</a></li> +<li><a href="#optimizing">Optimizing</a></li> +<li><a href="#planning">Planning</a></li> +<li><a href="#executing">Executing</a></li> +</ul> + +<h2 id="why">Why?</h2> + +<p>I started working on SQLGlot because of my work on the <a href="https://netflixtechblog.com/reimagining-experimentation-analysis-at-netflix-71356393af21">experimentation and metrics platform</a> at Netflix, where I built tools that allowed data scientists to define and compute SQL-based metrics. Netflix relied on multiple engines to query data (Spark, Presto, and Druid), so my team built the metrics platform around <a href="https://github.com/kayak/pypika">PyPika</a>, a Python SQL query builder. This way, definitions could be reused across multiple engines. However, it became quickly apparent that writing python code to programmatically generate SQL was challenging for data scientists, especially those with academic backgrounds, since they were mostly familiar with R and SQL. At the time, the only Python SQL parser was <a href="[https://github.com/andialbrecht/sqlparse">sqlparse</a>, which is not actually a parser but a tokenizer, so having users write raw SQL into the platform wasn't really an option. Some time later, I randomly stumbled across <a href="https://craftinginterpreters.com/">Crafting Interpreters</a> and realized that I could use it as a guide towards creating my own SQL parser/transpiler.</p> + +<p>Why did I do this? Isn't a Python SQL engine going to be extremely slow?</p> + +<p>The main reason why I ended up building a SQL engine was...just for <strong>entertainment</strong>. It's been fun learning about all the things required to actually run a SQL query, and seeing it actually work is extremely rewarding. Before SQLGlot, I had zero experience with lexers, parsers, or compilers.</p> + +<p>In terms of practical use cases, I planned to use the Python SQL engine for unit testing SQL pipelines. Big data pipelines are tough to test because many of the engines are not open source and cannot be run locally. With SQLGlot, you can take a SQL query targeting a warehouse such as <a href="https://www.snowflake.com/en/">Snowflake</a> and seamlessly run it in CI on mock Python data. It's easy to mock data and create arbitrary <a href="https://en.wikipedia.org/wiki/User-defined_function">UDFs</a> because everything is just Python. Although the implementation is slow and unsuitable for large amounts of data (> 1 million rows), there's very little overhead/startup and you can run queries on test data in a couple of milliseconds.</p> + +<p>Finally, the components that have been built to support execution can be used as a <strong>foundation</strong> for a faster engine. I'm inspired by what <a href="https://github.com/apache/calcite">Apache Calcite</a> has done for the JVM world. Even though Python is commonly used for data, there hasn't been a Calcite for Python. So, you could say that SQLGlot aims to be that framework. For example, it wouldn't take much work to replace the Python execution engine with numpy/pandas/arrow to become a respectably-performing query engine. The implementation would be able to leverage the parser, optimizer, and logical planner, only needing to implement physical execution. There is a lot of work in the Python ecosystem around high performance vectorized computation, which I think could benefit from a pure Python-based <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">AST</a>/<a href="https://en.wikipedia.org/wiki/Query_plan">plan</a>. Parsing and planning doesn't have to be fast when the bottleneck of running queries is processing terabytes of data. So, having a Python-based ecosystem around SQL is beneficial given the ease of development in Python, despite not having bare metal performance.</p> + +<p>Parts of SQLGlot's toolkit are being used today by the following:</p> + +<ul> +<li><a href="https://github.com/ibis-project/ibis">Ibis</a>: A Python library that provides a lightweight, universal interface for data wrangling. +<ul> +<li>Uses the Python SQL expression builder and leverages the optimizer/planner to convert SQL into dataframe operations.</li> +</ul></li> +<li><a href="https://github.com/kelsin/mysql-mimic">mysql-mimic</a>: Pure-Python implementation of the MySQL server wire protocol +<ul> +<li>Parses / transforms SQL and executes INFORMATION_SCHEMA queries.</li> +</ul></li> +<li><a href="https://github.com/marsupialtail/quokka">Quokka</a>: Push-based vectorized query engine +<ul> +<li>Parse and optimizes SQL.</li> +</ul></li> +<li><a href="https://github.com/moj-analytical-services/splink">Splink</a>: Fast, accurate and scalable probabilistic data linkage using your choice of SQL backend. +<ul> +<li>Transpiles queries.</li> +</ul></li> +</ul> + +<h2 id="how">How?</h2> + +<p>There are many steps involved with actually running a simple query like:</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">SELECT</span> +<span class="w"> </span><span class="n">bar</span><span class="p">.</span><span class="n">a</span><span class="p">,</span> +<span class="w"> </span><span class="n">b</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">b</span> +<span class="k">FROM</span><span class="w"> </span><span class="n">bar</span> +<span class="k">JOIN</span><span class="w"> </span><span class="n">baz</span> +<span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="n">bar</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">baz</span><span class="p">.</span><span class="n">a</span> +<span class="k">WHERE</span><span class="w"> </span><span class="n">bar</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">1</span> +</code></pre> +</div> + +<p>In this post, I'll walk through all the steps SQLGlot takes to run this query over Python objects.</p> + +<h2 id="tokenizing">Tokenizing</h2> + +<p>The first step is to convert the sql string into a list of tokens. SQLGlot's tokenizer is quite simple and can be found <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/tokens.py">here</a>. In a while loop, it checks each character and either appends the character to the current token, or makes a new token.</p> + +<p>Running the SQLGlot tokenizer shows the output.</p> + +<p><img src="python_sql_engine_images/tokenizer.png" alt="Tokenizer Output" /></p> + +<p>Each keyword has been converted to a SQLGlot Token object. Each token has some metadata associated with it, like line/column information for error messages. Comments are also a part of the token, so that comments can be preserved.</p> + +<h2 id="parsing">Parsing</h2> + +<p>Once a SQL statement is tokenized, we don't need to worry about white space and other formatting, so it's easier to work with. We can now convert the list of tokens into an AST. The SQLGlot <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/parser.py">parser</a> is a handwritten <a href="https://en.wikipedia.org/wiki/Recursive_descent_parser">recursive descent</a> parser.</p> + +<p>Similar to the tokenizer, it consumes the tokens sequentially, but it instead uses a recursive algorithm. The tokens are converted into a single AST node that presents the SQL query. The SQLGlot parser was designed to support various dialects, so it contains many options for overriding parsing functionality.</p> + +<p><img src="python_sql_engine_images/parser.png" alt="Parser Output" /></p> + +<p>The AST is a generic representation of a given SQL query. Each dialect can override or implement its own generator, which can convert an AST object into syntatically-correct SQL.</p> + +<h2 id="optimizing">Optimizing</h2> + +<p>Once we have our AST, we can transform it into an equivalent query that produces the same results more efficiently. When optimizing queries, most engines first convert the AST into a logical plan and then optimize the plan. However, I chose to <strong>optimize the AST directly</strong> for the following reasons:</p> + +<ol> +<li><p>It's easier to debug and <a href="https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/optimizer">validate</a> the optimizations when the input and output are both SQL.</p></li> +<li><p>Rules can be applied a la carte to transform SQL into a more desirable form.</p></li> +<li><p>I wanted a way to generate 'canonical sql'. Having a canonical representation of SQL is useful for understanding if two queries are semantically equivalent (e.g. <code>SELECT 1 + 1</code> and <code>SELECT 2</code>).</p></li> +</ol> + +<p>I've yet to find another engine that takes this approach, but I'm quite happy with this decision. The optimizer currently does not perform any "physical optimizations" such as join reordering. Those are left to the execution layer, as additional statistics and information could become relevant.</p> + +<p><img src="python_sql_engine_images/optimizer.png" alt="Optimizer Output" /></p> + +<p>The optimizer currently has <a href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer">17 rules</a>. Each of these rules is applied, transforming the AST in place. The combination of these rules creates "canonical" sql that can then be more easily converted into a logical plan and executed.</p> + +<p>Some example rules are:</p> + +<h3 id="qualify_tables-and-qualify_columns">qualify_tables and qualify_columns</h3> + +<ul> +<li>Adds all db/catalog qualifiers to tables and forces an alias.</li> +<li>Ensure each column is unambiguous and expand stars.</li> +</ul> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">x</span><span class="p">;</span> + +<span class="k">SELECT</span><span class="w"> </span><span class="ss">"db"</span><span class="p">.</span><span class="ss">"x"</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="ss">"x"</span><span class="p">;</span> +</code></pre> +</div> + +<h3 id="simplify">simplify</h3> + +<p>Boolean and math simplification. Check out all the <a href="https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/optimizer/simplify.sql">test cases</a>.</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="p">((</span><span class="k">NOT</span><span class="w"> </span><span class="k">FALSE</span><span class="p">)</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="p">))</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="p">(</span><span class="k">TRUE</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="mi">3</span><span class="p">);</span> +<span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="p">;</span> + +<span class="mi">1</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span> +<span class="mi">2</span><span class="p">;</span> +</code></pre> +</div> + +<h3 id="normalize">normalize</h3> + +<p>Attempts to convert all predicates into <a href="https://en.wikipedia.org/wiki/Conjunctive_normal_form">conjunctive normal form</a>.</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="c1">-- DNF</span> +<span class="p">(</span><span class="n">A</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">B</span><span class="p">)</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="p">(</span><span class="n">B</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="k">C</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">D</span><span class="p">);</span> + +<span class="c1">-- CNF</span> +<span class="p">(</span><span class="n">A</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="k">C</span><span class="p">)</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="p">(</span><span class="n">A</span><span class="w"> </span><span class="k">OR</span><span class="w"> </span><span class="n">D</span><span class="p">)</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">B</span><span class="p">;</span> +</code></pre> +</div> + +<h3 id="unnest_subqueries">unnest_subqueries</h3> + +<p>Converts subqueries in predicates into joins.</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="c1">-- The subquery can be converted into a left join</span> +<span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> +<span class="k">FROM</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">x</span> +<span class="k">WHERE</span><span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">a</span> +<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">y</span> +<span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="n">a</span> +<span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span> + +<span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> +<span class="k">FROM</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">x</span> +<span class="k">LEFT</span><span class="w"> </span><span class="k">JOIN</span><span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">a</span> +<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">y</span> +<span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="k">TRUE</span> +<span class="w"> </span><span class="k">GROUP</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="n">a</span> +<span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="ss">"_u_0"</span> +<span class="w"> </span><span class="k">ON</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">"_u_0"</span><span class="p">.</span><span class="n">a</span> +<span class="k">WHERE</span><span class="w"> </span><span class="p">(</span><span class="ss">"_u_0"</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="k">NOT</span><span class="w"> </span><span class="ss">"_u_0"</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="k">IS</span><span class="w"> </span><span class="k">NULL</span><span class="p">)</span> +</code></pre> +</div> + +<h3 id="pushdown_predicates">pushdown_predicates</h3> + +<p>Push down filters into the innermost query.</p> + +<div class="pdoc-code codehilite"> +<pre><span></span><code><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> +<span class="k">FROM</span><span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> +<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">x</span> +<span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">y</span> +<span class="k">WHERE</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span> + +<span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> +<span class="k">FROM</span><span class="w"> </span><span class="p">(</span> +<span class="w"> </span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span> +<span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">x</span> +<span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">y</span><span class="p">.</span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span> +<span class="p">)</span><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="k">TRUE</span> +</code></pre> +</div> + +<h3 id="annotate_types">annotate_types</h3> + +<p>Infer all types throughout the AST given schema information and function type definitions.</p> + +<h2 id="planning">Planning</h2> + +<p>After the SQL AST has been "optimized", it's much easier to <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/planner.py">convert into a logical plan</a>. The AST is traversed and converted into a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph">DAG</a> consisting of one of five steps. The different steps are:</p> + +<h3 id="scan">Scan</h3> + +<p>Selects columns from a table, applies projections, and finally filters the table.</p> + +<h3 id="sort">Sort</h3> + +<p>Sorts a table for order by expressions.</p> + +<h3 id="set">Set</h3> + +<p>Applies the operators union/union all/except/intersect.</p> + +<h3 id="aggregate">Aggregate</h3> + +<p>Applies an aggregation/group by.</p> + +<h3 id="join">Join</h3> + +<p>Joins multiple tables together.</p> + +<p><img src="python_sql_engine_images/planner.png" alt="Planner Output" /></p> + +<p>The logical plan is quite simple and contains the information required to convert it into a physical plan (execution).</p> + +<h2 id="executing">Executing</h2> + +<p>Finally, we can actually execute the SQL query. The <a href="https://github.com/tobymao/sqlglot/blob/main/sqlglot/executor/python.py">Python engine</a> is not fast, but it's very small (~400 LOC)! It iterates the DAG with a queue and runs each step, passing each intermediary table to the next step.</p> + +<p>In order to keep things simple, it evaluates expressions with <code>eval</code>. Because SQLGlot was built primarily to be a transpiler, it was simple to create a "Python SQL" dialect. So a SQL expression <code>x + 1</code> can just be converted into <code>scope['x'] + 1</code>.</p> + +<p><img src="python_sql_engine_images/executor.png" alt="Executor Output" /></p> + +<h2 id="whats-next">What's next</h2> + +<p>SQLGlot's main focus will always be on parsing/transpiling, but I plan to continue development on the execution engine. I'd like to pass <a href="https://www.tpc.org/tpcds/">TPC-DS</a>. If someone doesn't beat me to it, I may even take a stab at writing a Pandas/Arrow execution engine.</p> + +<p>I'm hoping that over time, SQLGlot will spark the Python SQL ecosystem just like Calcite has for Java.</p> + +<h2 id="special-thanks">Special thanks</h2> + +<p>SQLGlot would not be what it is without it's core contributors. In particular, the execution engine would not exist without <a href="https://github.com/barakalon">Barak Alon</a> and <a href="https://github.com/GeorgeSittas">George Sittas</a>.</p> + +<h2 id="get-in-touch">Get in touch</h2> + +<p>If you'd like to chat more about SQLGlot, please join my <a href="https://join.slack.com/t/tobiko-data/shared_invite/zt-1ma66d79v-a4dbf4DUpLAQJ8ptQrJygg">Slack Channel</a>!</p> + +<hr /> +</div> + + <input id="mod-executor-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-executor-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">"""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="sd">.. include:: ../../posts/python_sql_engine.md</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="sd">----</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="sd">"""</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">import</span> <span class="nn">logging</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="kn">import</span> <span class="nn">time</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">maybe_parse</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ExecuteError</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="kn">from</span> <span class="nn">sqlglot.executor.python</span> <span class="kn">import</span> <span class="n">PythonExecutor</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="kn">from</span> <span class="nn">sqlglot.executor.table</span> <span class="kn">import</span> <span class="n">Table</span><span class="p">,</span> <span class="n">ensure_tables</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer</span> <span class="kn">import</span> <span class="n">optimize</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="kn">from</span> <span class="nn">sqlglot.planner</span> <span class="kn">import</span> <span class="n">Plan</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">ensure_schema</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"sqlglot"</span><span class="p">)</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">DialectType</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="kn">from</span> <span class="nn">sqlglot.executor.table</span> <span class="kn">import</span> <span class="n">Tables</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">Expression</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">Schema</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a><span class="k">def</span> <span class="nf">execute</span><span class="p">(</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">|</span> <span class="n">Schema</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a><span class="sd"> Run a sql query against data.</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a><span class="sd"> Args:</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a><span class="sd"> sql: a sql statement.</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a><span class="sd"> schema: database schema.</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a><span class="sd"> This can either be an instance of `Schema` or a mapping in one of the following forms:</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a><span class="sd"> 1. {table: {col: type}}</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a><span class="sd"> 2. {db: {table: {col: type}}}</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a><span class="sd"> 3. {catalog: {db: {table: {col: type}}}}</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a><span class="sd"> read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a><span class="sd"> tables: additional tables to register.</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a><span class="sd"> Returns:</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a><span class="sd"> Simple columnar data structure.</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a><span class="sd"> """</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> <span class="n">tables_</span> <span class="o">=</span> <span class="n">ensure_tables</span><span class="p">(</span><span class="n">tables</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">schema</span><span class="p">:</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="n">name</span><span class="p">:</span> <span class="p">{</span><span class="n">column</span><span class="p">:</span> <span class="nb">type</span><span class="p">(</span><span class="n">table</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">column</span><span class="p">])</span><span class="o">.</span><span class="vm">__name__</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">}</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables_</span><span class="o">.</span><span class="n">mapping</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="p">}</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="k">if</span> <span class="n">tables_</span><span class="o">.</span><span class="n">supported_table_args</span> <span class="ow">and</span> <span class="n">tables_</span><span class="o">.</span><span class="n">supported_table_args</span> <span class="o">!=</span> <span class="n">schema</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">:</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="k">raise</span> <span class="n">ExecuteError</span><span class="p">(</span><span class="s2">"Tables must support the same table args as schema"</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">read</span><span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> <span class="n">now</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Optimization finished: </span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">now</span><span class="p">)</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Optimized SQL: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a> <span class="n">plan</span> <span class="o">=</span> <span class="n">Plan</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Logical Plan: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">plan</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos">77</span></a> <span class="n">now</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos">78</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">PythonExecutor</span><span class="p">(</span><span class="n">tables</span><span class="o">=</span><span class="n">tables_</span><span class="p">)</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">plan</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos">79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos">80</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Query finished: </span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">now</span><span class="p">)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos">81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos">82</span></a> <span class="k">return</span> <span class="n">result</span> +</span></pre></div> + + + </section> + <section id="execute"> + <input id="execute-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">execute</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">schema</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Dict</span><span class="p">,</span> <span class="n"><a href="schema.html#Schema">sqlglot.schema.Schema</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">read</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">tables</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="executor/table.html#Table">sqlglot.executor.table.Table</a></span>:</span></span> + + <label class="view-source-button" for="execute-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#execute"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="execute-31"><a href="#execute-31"><span class="linenos">31</span></a><span class="k">def</span> <span class="nf">execute</span><span class="p">(</span> +</span><span id="execute-32"><a href="#execute-32"><span class="linenos">32</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> +</span><span id="execute-33"><a href="#execute-33"><span class="linenos">33</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">|</span> <span class="n">Schema</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="execute-34"><a href="#execute-34"><span class="linenos">34</span></a> <span class="n">read</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="execute-35"><a href="#execute-35"><span class="linenos">35</span></a> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="execute-36"><a href="#execute-36"><span class="linenos">36</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="execute-37"><a href="#execute-37"><span class="linenos">37</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="execute-38"><a href="#execute-38"><span class="linenos">38</span></a><span class="sd"> Run a sql query against data.</span> +</span><span id="execute-39"><a href="#execute-39"><span class="linenos">39</span></a> +</span><span id="execute-40"><a href="#execute-40"><span class="linenos">40</span></a><span class="sd"> Args:</span> +</span><span id="execute-41"><a href="#execute-41"><span class="linenos">41</span></a><span class="sd"> sql: a sql statement.</span> +</span><span id="execute-42"><a href="#execute-42"><span class="linenos">42</span></a><span class="sd"> schema: database schema.</span> +</span><span id="execute-43"><a href="#execute-43"><span class="linenos">43</span></a><span class="sd"> This can either be an instance of `Schema` or a mapping in one of the following forms:</span> +</span><span id="execute-44"><a href="#execute-44"><span class="linenos">44</span></a><span class="sd"> 1. {table: {col: type}}</span> +</span><span id="execute-45"><a href="#execute-45"><span class="linenos">45</span></a><span class="sd"> 2. {db: {table: {col: type}}}</span> +</span><span id="execute-46"><a href="#execute-46"><span class="linenos">46</span></a><span class="sd"> 3. {catalog: {db: {table: {col: type}}}}</span> +</span><span id="execute-47"><a href="#execute-47"><span class="linenos">47</span></a><span class="sd"> read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="execute-48"><a href="#execute-48"><span class="linenos">48</span></a><span class="sd"> tables: additional tables to register.</span> +</span><span id="execute-49"><a href="#execute-49"><span class="linenos">49</span></a> +</span><span id="execute-50"><a href="#execute-50"><span class="linenos">50</span></a><span class="sd"> Returns:</span> +</span><span id="execute-51"><a href="#execute-51"><span class="linenos">51</span></a><span class="sd"> Simple columnar data structure.</span> +</span><span id="execute-52"><a href="#execute-52"><span class="linenos">52</span></a><span class="sd"> """</span> +</span><span id="execute-53"><a href="#execute-53"><span class="linenos">53</span></a> <span class="n">tables_</span> <span class="o">=</span> <span class="n">ensure_tables</span><span class="p">(</span><span class="n">tables</span><span class="p">)</span> +</span><span id="execute-54"><a href="#execute-54"><span class="linenos">54</span></a> +</span><span id="execute-55"><a href="#execute-55"><span class="linenos">55</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">schema</span><span class="p">:</span> +</span><span id="execute-56"><a href="#execute-56"><span class="linenos">56</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="execute-57"><a href="#execute-57"><span class="linenos">57</span></a> <span class="n">name</span><span class="p">:</span> <span class="p">{</span><span class="n">column</span><span class="p">:</span> <span class="nb">type</span><span class="p">(</span><span class="n">table</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">column</span><span class="p">])</span><span class="o">.</span><span class="vm">__name__</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">}</span> +</span><span id="execute-58"><a href="#execute-58"><span class="linenos">58</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables_</span><span class="o">.</span><span class="n">mapping</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="execute-59"><a href="#execute-59"><span class="linenos">59</span></a> <span class="p">}</span> +</span><span id="execute-60"><a href="#execute-60"><span class="linenos">60</span></a> +</span><span id="execute-61"><a href="#execute-61"><span class="linenos">61</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="execute-62"><a href="#execute-62"><span class="linenos">62</span></a> +</span><span id="execute-63"><a href="#execute-63"><span class="linenos">63</span></a> <span class="k">if</span> <span class="n">tables_</span><span class="o">.</span><span class="n">supported_table_args</span> <span class="ow">and</span> <span class="n">tables_</span><span class="o">.</span><span class="n">supported_table_args</span> <span class="o">!=</span> <span class="n">schema</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">:</span> +</span><span id="execute-64"><a href="#execute-64"><span class="linenos">64</span></a> <span class="k">raise</span> <span class="n">ExecuteError</span><span class="p">(</span><span class="s2">"Tables must support the same table args as schema"</span><span class="p">)</span> +</span><span id="execute-65"><a href="#execute-65"><span class="linenos">65</span></a> +</span><span id="execute-66"><a href="#execute-66"><span class="linenos">66</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">read</span><span class="p">)</span> +</span><span id="execute-67"><a href="#execute-67"><span class="linenos">67</span></a> +</span><span id="execute-68"><a href="#execute-68"><span class="linenos">68</span></a> <span class="n">now</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> +</span><span id="execute-69"><a href="#execute-69"><span class="linenos">69</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="execute-70"><a href="#execute-70"><span class="linenos">70</span></a> +</span><span id="execute-71"><a href="#execute-71"><span class="linenos">71</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Optimization finished: </span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">now</span><span class="p">)</span> +</span><span id="execute-72"><a href="#execute-72"><span class="linenos">72</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Optimized SQL: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="execute-73"><a href="#execute-73"><span class="linenos">73</span></a> +</span><span id="execute-74"><a href="#execute-74"><span class="linenos">74</span></a> <span class="n">plan</span> <span class="o">=</span> <span class="n">Plan</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="execute-75"><a href="#execute-75"><span class="linenos">75</span></a> +</span><span id="execute-76"><a href="#execute-76"><span class="linenos">76</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Logical Plan: </span><span class="si">%s</span><span class="s2">"</span><span class="p">,</span> <span class="n">plan</span><span class="p">)</span> +</span><span id="execute-77"><a href="#execute-77"><span class="linenos">77</span></a> +</span><span id="execute-78"><a href="#execute-78"><span class="linenos">78</span></a> <span class="n">now</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> +</span><span id="execute-79"><a href="#execute-79"><span class="linenos">79</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">PythonExecutor</span><span class="p">(</span><span class="n">tables</span><span class="o">=</span><span class="n">tables_</span><span class="p">)</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">plan</span><span class="p">)</span> +</span><span id="execute-80"><a href="#execute-80"><span class="linenos">80</span></a> +</span><span id="execute-81"><a href="#execute-81"><span class="linenos">81</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s2">"Query finished: </span><span class="si">%f</span><span class="s2">"</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">now</span><span class="p">)</span> +</span><span id="execute-82"><a href="#execute-82"><span class="linenos">82</span></a> +</span><span id="execute-83"><a href="#execute-83"><span class="linenos">83</span></a> <span class="k">return</span> <span class="n">result</span> +</span></pre></div> + + + <div class="docstring"><p>Run a sql query against data.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql:</strong> a sql statement.</li> +<li><strong>schema:</strong> database schema. +This can either be an instance of <code>Schema</code> or a mapping in one of the following forms: +<ol> +<li>{table: {col: type}}</li> +<li>{db: {table: {col: type}}}</li> +<li>{catalog: {db: {table: {col: type}}}}</li> +</ol></li> +<li><strong>read:</strong> the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").</li> +<li><strong>tables:</strong> additional tables to register.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Simple columnar data structure.</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/executor/context.html b/docs/sqlglot/executor/context.html new file mode 100644 index 0000000..da6c629 --- /dev/null +++ b/docs/sqlglot/executor/context.html @@ -0,0 +1,715 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.executor.context API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../executor.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.executor</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Context">Context</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Context.__init__">Context</a> + </li> + <li> + <a class="function" href="#Context.eval">eval</a> + </li> + <li> + <a class="function" href="#Context.eval_tuple">eval_tuple</a> + </li> + <li> + <a class="function" href="#Context.add_columns">add_columns</a> + </li> + <li> + <a class="function" href="#Context.table_iter">table_iter</a> + </li> + <li> + <a class="function" href="#Context.filter">filter</a> + </li> + <li> + <a class="function" href="#Context.sort">sort</a> + </li> + <li> + <a class="function" href="#Context.set_row">set_row</a> + </li> + <li> + <a class="function" href="#Context.set_index">set_index</a> + </li> + <li> + <a class="function" href="#Context.set_range">set_range</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/executor/context.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../executor.html">executor</a><wbr>.context </h1> + + + <input id="mod-context-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-context-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.executor.env</span> <span class="kn">import</span> <span class="n">ENV</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="kn">from</span> <span class="nn">sqlglot.executor.table</span> <span class="kn">import</span> <span class="n">Table</span><span class="p">,</span> <span class="n">TableIter</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="k">class</span> <span class="nc">Context</span><span class="p">:</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> Execution context for sql expressions.</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> Context is used to hold relevant data tables which can then be queried on with eval.</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> References to columns can either be scalar or vectors. When set_row is used, column references</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> evaluate to scalars while set_range evaluates to vectors. This allows convenient and efficient</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> evaluation of aggregation functions.</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> """</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Table</span><span class="p">],</span> <span class="n">env</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> Args</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> tables: representing the scope of the current execution context.</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> env: dictionary of functions within the execution context.</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> """</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> <span class="o">=</span> <span class="n">tables</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Table</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span> <span class="o">=</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="o">.</span><span class="n">range_reader</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> <span class="o">=</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="o">.</span><span class="n">reader</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">ENV</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">env</span> <span class="ow">or</span> <span class="p">{}),</span> <span class="s2">"scope"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span><span class="p">}</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">def</span> <span class="nf">eval</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">code</span><span class="p">):</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">return</span> <span class="nb">eval</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">def</span> <span class="nf">eval_tuple</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">codes</span><span class="p">):</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">code</span><span class="p">)</span> <span class="k">for</span> <span class="n">code</span> <span class="ow">in</span> <span class="n">codes</span><span class="p">)</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="nd">@property</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">for</span> <span class="n">other</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="o">.</span><span class="n">columns</span> <span class="o">!=</span> <span class="n">other</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Columns are different."</span><span class="p">)</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">other</span><span class="o">.</span><span class="n">rows</span><span class="p">):</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Rows are different."</span><span class="p">)</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="k">def</span> <span class="nf">add_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">table</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">*</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="nd">@property</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">:</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">)):</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">reader</span> <span class="o">=</span> <span class="n">table</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">yield</span> <span class="n">reader</span><span class="p">,</span> <span class="bp">self</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">def</span> <span class="nf">table_iter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">TableIter</span><span class="p">,</span> <span class="n">Context</span><span class="p">]]:</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">for</span> <span class="n">reader</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">]:</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="k">yield</span> <span class="n">reader</span><span class="p">,</span> <span class="bp">self</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">def</span> <span class="nf">filter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">condition</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">)]</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">table</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">rows</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">def</span> <span class="nf">sort_key</span><span class="p">(</span><span class="n">row</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">:</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_row</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="n">sort_key</span><span class="p">)</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="nf">set_row</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">table</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="n">row</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">def</span> <span class="nf">set_index</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">table</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="k">def</span> <span class="nf">set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">:</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">def</span> <span class="fm">__contains__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> +</span></pre></div> + + + </section> + <section id="Context"> + <input id="Context-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Context</span>: + + <label class="view-source-button" for="Context-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context-12"><a href="#Context-12"><span class="linenos"> 12</span></a><span class="k">class</span> <span class="nc">Context</span><span class="p">:</span> +</span><span id="Context-13"><a href="#Context-13"><span class="linenos"> 13</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Context-14"><a href="#Context-14"><span class="linenos"> 14</span></a><span class="sd"> Execution context for sql expressions.</span> +</span><span id="Context-15"><a href="#Context-15"><span class="linenos"> 15</span></a> +</span><span id="Context-16"><a href="#Context-16"><span class="linenos"> 16</span></a><span class="sd"> Context is used to hold relevant data tables which can then be queried on with eval.</span> +</span><span id="Context-17"><a href="#Context-17"><span class="linenos"> 17</span></a> +</span><span id="Context-18"><a href="#Context-18"><span class="linenos"> 18</span></a><span class="sd"> References to columns can either be scalar or vectors. When set_row is used, column references</span> +</span><span id="Context-19"><a href="#Context-19"><span class="linenos"> 19</span></a><span class="sd"> evaluate to scalars while set_range evaluates to vectors. This allows convenient and efficient</span> +</span><span id="Context-20"><a href="#Context-20"><span class="linenos"> 20</span></a><span class="sd"> evaluation of aggregation functions.</span> +</span><span id="Context-21"><a href="#Context-21"><span class="linenos"> 21</span></a><span class="sd"> """</span> +</span><span id="Context-22"><a href="#Context-22"><span class="linenos"> 22</span></a> +</span><span id="Context-23"><a href="#Context-23"><span class="linenos"> 23</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Table</span><span class="p">],</span> <span class="n">env</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-24"><a href="#Context-24"><span class="linenos"> 24</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Context-25"><a href="#Context-25"><span class="linenos"> 25</span></a><span class="sd"> Args</span> +</span><span id="Context-26"><a href="#Context-26"><span class="linenos"> 26</span></a><span class="sd"> tables: representing the scope of the current execution context.</span> +</span><span id="Context-27"><a href="#Context-27"><span class="linenos"> 27</span></a><span class="sd"> env: dictionary of functions within the execution context.</span> +</span><span id="Context-28"><a href="#Context-28"><span class="linenos"> 28</span></a><span class="sd"> """</span> +</span><span id="Context-29"><a href="#Context-29"><span class="linenos"> 29</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> <span class="o">=</span> <span class="n">tables</span> +</span><span id="Context-30"><a href="#Context-30"><span class="linenos"> 30</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Table</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Context-31"><a href="#Context-31"><span class="linenos"> 31</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span> <span class="o">=</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="o">.</span><span class="n">range_reader</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="Context-32"><a href="#Context-32"><span class="linenos"> 32</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> <span class="o">=</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="o">.</span><span class="n">reader</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="Context-33"><a href="#Context-33"><span class="linenos"> 33</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">ENV</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">env</span> <span class="ow">or</span> <span class="p">{}),</span> <span class="s2">"scope"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span><span class="p">}</span> +</span><span id="Context-34"><a href="#Context-34"><span class="linenos"> 34</span></a> +</span><span id="Context-35"><a href="#Context-35"><span class="linenos"> 35</span></a> <span class="k">def</span> <span class="nf">eval</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">code</span><span class="p">):</span> +</span><span id="Context-36"><a href="#Context-36"><span class="linenos"> 36</span></a> <span class="k">return</span> <span class="nb">eval</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">)</span> +</span><span id="Context-37"><a href="#Context-37"><span class="linenos"> 37</span></a> +</span><span id="Context-38"><a href="#Context-38"><span class="linenos"> 38</span></a> <span class="k">def</span> <span class="nf">eval_tuple</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">codes</span><span class="p">):</span> +</span><span id="Context-39"><a href="#Context-39"><span class="linenos"> 39</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">code</span><span class="p">)</span> <span class="k">for</span> <span class="n">code</span> <span class="ow">in</span> <span class="n">codes</span><span class="p">)</span> +</span><span id="Context-40"><a href="#Context-40"><span class="linenos"> 40</span></a> +</span><span id="Context-41"><a href="#Context-41"><span class="linenos"> 41</span></a> <span class="nd">@property</span> +</span><span id="Context-42"><a href="#Context-42"><span class="linenos"> 42</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="Context-43"><a href="#Context-43"><span class="linenos"> 43</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-44"><a href="#Context-44"><span class="linenos"> 44</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="Context-45"><a href="#Context-45"><span class="linenos"> 45</span></a> <span class="k">for</span> <span class="n">other</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context-46"><a href="#Context-46"><span class="linenos"> 46</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="o">.</span><span class="n">columns</span> <span class="o">!=</span> <span class="n">other</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="Context-47"><a href="#Context-47"><span class="linenos"> 47</span></a> <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Columns are different."</span><span class="p">)</span> +</span><span id="Context-48"><a href="#Context-48"><span class="linenos"> 48</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">other</span><span class="o">.</span><span class="n">rows</span><span class="p">):</span> +</span><span id="Context-49"><a href="#Context-49"><span class="linenos"> 49</span></a> <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Rows are different."</span><span class="p">)</span> +</span><span id="Context-50"><a href="#Context-50"><span class="linenos"> 50</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span> +</span><span id="Context-51"><a href="#Context-51"><span class="linenos"> 51</span></a> +</span><span id="Context-52"><a href="#Context-52"><span class="linenos"> 52</span></a> <span class="k">def</span> <span class="nf">add_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-53"><a href="#Context-53"><span class="linenos"> 53</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context-54"><a href="#Context-54"><span class="linenos"> 54</span></a> <span class="n">table</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">*</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Context-55"><a href="#Context-55"><span class="linenos"> 55</span></a> +</span><span id="Context-56"><a href="#Context-56"><span class="linenos"> 56</span></a> <span class="nd">@property</span> +</span><span id="Context-57"><a href="#Context-57"><span class="linenos"> 57</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">:</span> +</span><span id="Context-58"><a href="#Context-58"><span class="linenos"> 58</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span> +</span><span id="Context-59"><a href="#Context-59"><span class="linenos"> 59</span></a> +</span><span id="Context-60"><a href="#Context-60"><span class="linenos"> 60</span></a> <span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Context-61"><a href="#Context-61"><span class="linenos"> 61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="Context-62"><a href="#Context-62"><span class="linenos"> 62</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">)):</span> +</span><span id="Context-63"><a href="#Context-63"><span class="linenos"> 63</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context-64"><a href="#Context-64"><span class="linenos"> 64</span></a> <span class="n">reader</span> <span class="o">=</span> <span class="n">table</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> +</span><span id="Context-65"><a href="#Context-65"><span class="linenos"> 65</span></a> <span class="k">yield</span> <span class="n">reader</span><span class="p">,</span> <span class="bp">self</span> +</span><span id="Context-66"><a href="#Context-66"><span class="linenos"> 66</span></a> +</span><span id="Context-67"><a href="#Context-67"><span class="linenos"> 67</span></a> <span class="k">def</span> <span class="nf">table_iter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">TableIter</span><span class="p">,</span> <span class="n">Context</span><span class="p">]]:</span> +</span><span id="Context-68"><a href="#Context-68"><span class="linenos"> 68</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="Context-69"><a href="#Context-69"><span class="linenos"> 69</span></a> +</span><span id="Context-70"><a href="#Context-70"><span class="linenos"> 70</span></a> <span class="k">for</span> <span class="n">reader</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">]:</span> +</span><span id="Context-71"><a href="#Context-71"><span class="linenos"> 71</span></a> <span class="k">yield</span> <span class="n">reader</span><span class="p">,</span> <span class="bp">self</span> +</span><span id="Context-72"><a href="#Context-72"><span class="linenos"> 72</span></a> +</span><span id="Context-73"><a href="#Context-73"><span class="linenos"> 73</span></a> <span class="k">def</span> <span class="nf">filter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">condition</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-74"><a href="#Context-74"><span class="linenos"> 74</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">)]</span> +</span><span id="Context-75"><a href="#Context-75"><span class="linenos"> 75</span></a> +</span><span id="Context-76"><a href="#Context-76"><span class="linenos"> 76</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context-77"><a href="#Context-77"><span class="linenos"> 77</span></a> <span class="n">table</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">rows</span> +</span><span id="Context-78"><a href="#Context-78"><span class="linenos"> 78</span></a> +</span><span id="Context-79"><a href="#Context-79"><span class="linenos"> 79</span></a> <span class="k">def</span> <span class="nf">sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-80"><a href="#Context-80"><span class="linenos"> 80</span></a> <span class="k">def</span> <span class="nf">sort_key</span><span class="p">(</span><span class="n">row</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">:</span> +</span><span id="Context-81"><a href="#Context-81"><span class="linenos"> 81</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_row</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> +</span><span id="Context-82"><a href="#Context-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="Context-83"><a href="#Context-83"><span class="linenos"> 83</span></a> +</span><span id="Context-84"><a href="#Context-84"><span class="linenos"> 84</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="n">sort_key</span><span class="p">)</span> +</span><span id="Context-85"><a href="#Context-85"><span class="linenos"> 85</span></a> +</span><span id="Context-86"><a href="#Context-86"><span class="linenos"> 86</span></a> <span class="k">def</span> <span class="nf">set_row</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-87"><a href="#Context-87"><span class="linenos"> 87</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context-88"><a href="#Context-88"><span class="linenos"> 88</span></a> <span class="n">table</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="n">row</span> +</span><span id="Context-89"><a href="#Context-89"><span class="linenos"> 89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="Context-90"><a href="#Context-90"><span class="linenos"> 90</span></a> +</span><span id="Context-91"><a href="#Context-91"><span class="linenos"> 91</span></a> <span class="k">def</span> <span class="nf">set_index</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-92"><a href="#Context-92"><span class="linenos"> 92</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context-93"><a href="#Context-93"><span class="linenos"> 93</span></a> <span class="n">table</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="Context-94"><a href="#Context-94"><span class="linenos"> 94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="Context-95"><a href="#Context-95"><span class="linenos"> 95</span></a> +</span><span id="Context-96"><a href="#Context-96"><span class="linenos"> 96</span></a> <span class="k">def</span> <span class="nf">set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context-97"><a href="#Context-97"><span class="linenos"> 97</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">:</span> +</span><span id="Context-98"><a href="#Context-98"><span class="linenos"> 98</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="Context-99"><a href="#Context-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span> +</span><span id="Context-100"><a href="#Context-100"><span class="linenos">100</span></a> +</span><span id="Context-101"><a href="#Context-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="fm">__contains__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Context-102"><a href="#Context-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> +</span></pre></div> + + + <div class="docstring"><p>Execution context for sql expressions.</p> + +<p>Context is used to hold relevant data tables which can then be queried on with eval.</p> + +<p>References to columns can either be scalar or vectors. When set_row is used, column references +evaluate to scalars while set_range evaluates to vectors. This allows convenient and efficient +evaluation of aggregation functions.</p> +</div> + + + <div id="Context.__init__" class="classattr"> + <input id="Context.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Context</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">tables</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="table.html#Table">sqlglot.executor.table.Table</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">env</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="Context.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.__init__-23"><a href="#Context.__init__-23"><span class="linenos">23</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Table</span><span class="p">],</span> <span class="n">env</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.__init__-24"><a href="#Context.__init__-24"><span class="linenos">24</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Context.__init__-25"><a href="#Context.__init__-25"><span class="linenos">25</span></a><span class="sd"> Args</span> +</span><span id="Context.__init__-26"><a href="#Context.__init__-26"><span class="linenos">26</span></a><span class="sd"> tables: representing the scope of the current execution context.</span> +</span><span id="Context.__init__-27"><a href="#Context.__init__-27"><span class="linenos">27</span></a><span class="sd"> env: dictionary of functions within the execution context.</span> +</span><span id="Context.__init__-28"><a href="#Context.__init__-28"><span class="linenos">28</span></a><span class="sd"> """</span> +</span><span id="Context.__init__-29"><a href="#Context.__init__-29"><span class="linenos">29</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> <span class="o">=</span> <span class="n">tables</span> +</span><span id="Context.__init__-30"><a href="#Context.__init__-30"><span class="linenos">30</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_table</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Table</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Context.__init__-31"><a href="#Context.__init__-31"><span class="linenos">31</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span> <span class="o">=</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="o">.</span><span class="n">range_reader</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="Context.__init__-32"><a href="#Context.__init__-32"><span class="linenos">32</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> <span class="o">=</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="o">.</span><span class="n">reader</span> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="Context.__init__-33"><a href="#Context.__init__-33"><span class="linenos">33</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">ENV</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">env</span> <span class="ow">or</span> <span class="p">{}),</span> <span class="s2">"scope"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span><span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Args + tables: representing the scope of the current execution context. + env: dictionary of functions within the execution context.</p> +</div> + + + </div> + <div id="Context.eval" class="classattr"> + <input id="Context.eval-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eval</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">code</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Context.eval-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.eval"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.eval-35"><a href="#Context.eval-35"><span class="linenos">35</span></a> <span class="k">def</span> <span class="nf">eval</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">code</span><span class="p">):</span> +</span><span id="Context.eval-36"><a href="#Context.eval-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="nb">eval</span><span class="p">(</span><span class="n">code</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Context.eval_tuple" class="classattr"> + <input id="Context.eval_tuple-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eval_tuple</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">codes</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Context.eval_tuple-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.eval_tuple"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.eval_tuple-38"><a href="#Context.eval_tuple-38"><span class="linenos">38</span></a> <span class="k">def</span> <span class="nf">eval_tuple</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">codes</span><span class="p">):</span> +</span><span id="Context.eval_tuple-39"><a href="#Context.eval_tuple-39"><span class="linenos">39</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">code</span><span class="p">)</span> <span class="k">for</span> <span class="n">code</span> <span class="ow">in</span> <span class="n">codes</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Context.add_columns" class="classattr"> + <input id="Context.add_columns-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_columns</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Context.add_columns-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.add_columns"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.add_columns-52"><a href="#Context.add_columns-52"><span class="linenos">52</span></a> <span class="k">def</span> <span class="nf">add_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.add_columns-53"><a href="#Context.add_columns-53"><span class="linenos">53</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context.add_columns-54"><a href="#Context.add_columns-54"><span class="linenos">54</span></a> <span class="n">table</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">*</span><span class="n">columns</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Context.table_iter" class="classattr"> + <input id="Context.table_iter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table_iter</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n">Iterator</span><span class="p">[</span><span class="n">Tuple</span><span class="p">[</span><span class="n"><a href="table.html#TableIter">sqlglot.executor.table.TableIter</a></span><span class="p">,</span> <span class="n"><a href="#Context">sqlglot.executor.context.Context</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="Context.table_iter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.table_iter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.table_iter-67"><a href="#Context.table_iter-67"><span class="linenos">67</span></a> <span class="k">def</span> <span class="nf">table_iter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">TableIter</span><span class="p">,</span> <span class="n">Context</span><span class="p">]]:</span> +</span><span id="Context.table_iter-68"><a href="#Context.table_iter-68"><span class="linenos">68</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span><span id="Context.table_iter-69"><a href="#Context.table_iter-69"><span class="linenos">69</span></a> +</span><span id="Context.table_iter-70"><a href="#Context.table_iter-70"><span class="linenos">70</span></a> <span class="k">for</span> <span class="n">reader</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">]:</span> +</span><span id="Context.table_iter-71"><a href="#Context.table_iter-71"><span class="linenos">71</span></a> <span class="k">yield</span> <span class="n">reader</span><span class="p">,</span> <span class="bp">self</span> +</span></pre></div> + + + + + </div> + <div id="Context.filter" class="classattr"> + <input id="Context.filter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">filter</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">condition</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Context.filter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.filter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.filter-73"><a href="#Context.filter-73"><span class="linenos">73</span></a> <span class="k">def</span> <span class="nf">filter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">condition</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.filter-74"><a href="#Context.filter-74"><span class="linenos">74</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">)]</span> +</span><span id="Context.filter-75"><a href="#Context.filter-75"><span class="linenos">75</span></a> +</span><span id="Context.filter-76"><a href="#Context.filter-76"><span class="linenos">76</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context.filter-77"><a href="#Context.filter-77"><span class="linenos">77</span></a> <span class="n">table</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">rows</span> +</span></pre></div> + + + + + </div> + <div id="Context.sort" class="classattr"> + <input id="Context.sort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sort</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">key</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Context.sort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.sort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.sort-79"><a href="#Context.sort-79"><span class="linenos">79</span></a> <span class="k">def</span> <span class="nf">sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.sort-80"><a href="#Context.sort-80"><span class="linenos">80</span></a> <span class="k">def</span> <span class="nf">sort_key</span><span class="p">(</span><span class="n">row</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">:</span> +</span><span id="Context.sort-81"><a href="#Context.sort-81"><span class="linenos">81</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_row</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> +</span><span id="Context.sort-82"><a href="#Context.sort-82"><span class="linenos">82</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="Context.sort-83"><a href="#Context.sort-83"><span class="linenos">83</span></a> +</span><span id="Context.sort-84"><a href="#Context.sort-84"><span class="linenos">84</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="n">sort_key</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Context.set_row" class="classattr"> + <input id="Context.set_row-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_row</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">row</span><span class="p">:</span> <span class="n">Tuple</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Context.set_row-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.set_row"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.set_row-86"><a href="#Context.set_row-86"><span class="linenos">86</span></a> <span class="k">def</span> <span class="nf">set_row</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.set_row-87"><a href="#Context.set_row-87"><span class="linenos">87</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context.set_row-88"><a href="#Context.set_row-88"><span class="linenos">88</span></a> <span class="n">table</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="n">row</span> +</span><span id="Context.set_row-89"><a href="#Context.set_row-89"><span class="linenos">89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span></pre></div> + + + + + </div> + <div id="Context.set_index" class="classattr"> + <input id="Context.set_index-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_index</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">index</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Context.set_index-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.set_index"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.set_index-91"><a href="#Context.set_index-91"><span class="linenos">91</span></a> <span class="k">def</span> <span class="nf">set_index</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.set_index-92"><a href="#Context.set_index-92"><span class="linenos">92</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Context.set_index-93"><a href="#Context.set_index-93"><span class="linenos">93</span></a> <span class="n">table</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="Context.set_index-94"><a href="#Context.set_index-94"><span class="linenos">94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">row_readers</span> +</span></pre></div> + + + + + </div> + <div id="Context.set_range" class="classattr"> + <input id="Context.set_range-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_range</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">start</span><span class="p">:</span> <span class="nb">int</span>, </span><span class="param"><span class="n">end</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Context.set_range-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Context.set_range"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Context.set_range-96"><a href="#Context.set_range-96"><span class="linenos">96</span></a> <span class="k">def</span> <span class="nf">set_range</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Context.set_range-97"><a href="#Context.set_range-97"><span class="linenos">97</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">:</span> +</span><span id="Context.set_range-98"><a href="#Context.set_range-98"><span class="linenos">98</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span><span class="p">[</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">)</span> +</span><span id="Context.set_range-99"><a href="#Context.set_range-99"><span class="linenos">99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"scope"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">range_readers</span> +</span></pre></div> + + + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/executor/env.html b/docs/sqlglot/executor/env.html new file mode 100644 index 0000000..f221871 --- /dev/null +++ b/docs/sqlglot/executor/env.html @@ -0,0 +1,717 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.executor.env API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../executor.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.executor</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#reverse_key">reverse_key</a> + <ul class="memberlist"> + <li> + <a class="function" href="#reverse_key.__init__">reverse_key</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#filter_nulls">filter_nulls</a> + </li> + <li> + <a class="function" href="#null_if_any">null_if_any</a> + </li> + <li> + <a class="function" href="#str_position">str_position</a> + </li> + <li> + <a class="function" href="#substring">substring</a> + </li> + <li> + <a class="function" href="#cast">cast</a> + </li> + <li> + <a class="function" href="#ordered">ordered</a> + </li> + <li> + <a class="function" href="#interval">interval</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/executor/env.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../executor.html">executor</a><wbr>.env </h1> + + + <input id="mod-env-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-env-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">datetime</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">import</span> <span class="nn">inspect</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">re</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">statistics</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">functools</span> <span class="kn">import</span> <span class="n">wraps</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">PYTHON_VERSION</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="k">class</span> <span class="nc">reverse_key</span><span class="p">:</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="k">return</span> <span class="n">other</span><span class="o">.</span><span class="n">obj</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="k">def</span> <span class="fm">__lt__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="k">return</span> <span class="n">other</span><span class="o">.</span><span class="n">obj</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="k">def</span> <span class="nf">filter_nulls</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">empty_null</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="k">def</span> <span class="nf">_func</span><span class="p">(</span><span class="n">values</span><span class="p">):</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">filtered</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">v</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">values</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">filtered</span> <span class="ow">and</span> <span class="n">empty_null</span><span class="p">:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="n">filtered</span><span class="p">)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">return</span> <span class="n">_func</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="k">def</span> <span class="nf">null_if_any</span><span class="p">(</span><span class="o">*</span><span class="n">required</span><span class="p">):</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="sd"> Decorator that makes a function return `None` if any of the `required` arguments are `None`.</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="sd"> This also supports decoration with no arguments, e.g.:</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a><span class="sd"> @null_if_any</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="sd"> def foo(a, b): ...</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="sd"> In which case all arguments are required.</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="sd"> """</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">f</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">required</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">callable</span><span class="p">(</span><span class="n">required</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">f</span> <span class="o">=</span> <span class="n">required</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">required</span> <span class="o">=</span> <span class="p">()</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">func</span><span class="p">):</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">if</span> <span class="n">required</span><span class="p">:</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">required_indices</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">i</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">param</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">inspect</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">func</span><span class="p">)</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="k">if</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">required</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="p">]</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">def</span> <span class="nf">predicate</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">required_indices</span><span class="p">)</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">def</span> <span class="nf">predicate</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span><span class="n">a</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">def</span> <span class="nf">_func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="k">if</span> <span class="n">predicate</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">return</span> <span class="n">_func</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="n">f</span><span class="p">:</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">return</span> <span class="n">decorator</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">return</span> <span class="n">decorator</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="nd">@null_if_any</span><span class="p">(</span><span class="s2">"substr"</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="k">def</span> <span class="nf">str_position</span><span class="p">(</span><span class="n">substr</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">position</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">position</span> <span class="o">=</span> <span class="n">position</span> <span class="o">-</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">position</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">position</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">return</span> <span class="n">this</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">substr</span><span class="p">,</span> <span class="n">position</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a><span class="nd">@null_if_any</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="k">def</span> <span class="nf">substring</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">elif</span> <span class="n">start</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">elif</span> <span class="n">start</span> <span class="o"><</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> <span class="o">+</span> <span class="n">start</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">start</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">end</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">length</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">start</span> <span class="o">+</span> <span class="n">length</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">return</span> <span class="n">this</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a><span class="nd">@null_if_any</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a><span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="p">):</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="n">to</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="n">to</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="n">to</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEXT_TYPES</span><span class="p">:</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">if</span> <span class="n">to</span> <span class="ow">in</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">}:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="n">to</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">NUMERIC_TYPES</span><span class="p">:</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">return</span> <span class="nb">int</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Casting to '</span><span class="si">{</span><span class="n">to</span><span class="si">}</span><span class="s2">' not implemented."</span><span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a><span class="k">def</span> <span class="nf">ordered</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">desc</span><span class="p">,</span> <span class="n">nulls_first</span><span class="p">):</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">if</span> <span class="n">desc</span><span class="p">:</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">return</span> <span class="n">reverse_key</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a><span class="nd">@null_if_any</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a><span class="k">def</span> <span class="nf">interval</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">unit</span><span class="p">):</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"DAY"</span><span class="p">:</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">this</span><span class="p">))</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a><span class="n">ENV</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="s2">"exp"</span><span class="p">:</span> <span class="n">exp</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="c1"># aggs</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="s2">"ARRAYAGG"</span><span class="p">:</span> <span class="nb">list</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="s2">"AVG"</span><span class="p">:</span> <span class="n">filter_nulls</span><span class="p">(</span><span class="n">statistics</span><span class="o">.</span><span class="n">fmean</span> <span class="k">if</span> <span class="n">PYTHON_VERSION</span> <span class="o">>=</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span> <span class="k">else</span> <span class="n">statistics</span><span class="o">.</span><span class="n">mean</span><span class="p">),</span> <span class="c1"># type: ignore</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="s2">"COUNT"</span><span class="p">:</span> <span class="n">filter_nulls</span><span class="p">(</span><span class="k">lambda</span> <span class="n">acc</span><span class="p">:</span> <span class="nb">sum</span><span class="p">(</span><span class="mi">1</span> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">acc</span><span class="p">),</span> <span class="kc">False</span><span class="p">),</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="s2">"MAX"</span><span class="p">:</span> <span class="n">filter_nulls</span><span class="p">(</span><span class="nb">max</span><span class="p">),</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="s2">"MIN"</span><span class="p">:</span> <span class="n">filter_nulls</span><span class="p">(</span><span class="nb">min</span><span class="p">),</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="s2">"SUM"</span><span class="p">:</span> <span class="n">filter_nulls</span><span class="p">(</span><span class="nb">sum</span><span class="p">),</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="c1"># scalar functions</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="s2">"ABS"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">:</span> <span class="nb">abs</span><span class="p">(</span><span class="n">this</span><span class="p">)),</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="s2">"ADD"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">e</span> <span class="o">+</span> <span class="n">this</span><span class="p">),</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="s2">"ARRAYANY"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">arr</span><span class="p">,</span> <span class="n">func</span><span class="p">:</span> <span class="nb">any</span><span class="p">(</span><span class="n">func</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">arr</span><span class="p">)),</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="s2">"BETWEEN"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="p">:</span> <span class="n">low</span> <span class="o"><=</span> <span class="n">this</span> <span class="ow">and</span> <span class="n">this</span> <span class="o"><=</span> <span class="n">high</span><span class="p">),</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="s2">"BITWISEAND"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">&</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="s2">"BITWISELEFTSHIFT"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o"><<</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="s2">"BITWISEOR"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">|</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="s2">"BITWISERIGHTSHIFT"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">>></span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"BITWISEXOR"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">^</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="s2">"CAST"</span><span class="p">:</span> <span class="n">cast</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="s2">"COALESCE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="nb">next</span><span class="p">((</span><span class="n">a</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="n">a</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">),</span> <span class="kc">None</span><span class="p">),</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="s2">"CONCAT"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="s2">"CONCATWS"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">this</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">args</span><span class="p">)),</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="s2">"DIV"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">e</span> <span class="o">/</span> <span class="n">this</span><span class="p">),</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"EQ"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">==</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"EXTRACT"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">)),</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="s2">"GT"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">></span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"GTE"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">>=</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="s2">"IFNULL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">alt</span><span class="p">:</span> <span class="n">alt</span> <span class="k">if</span> <span class="n">e</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">e</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="s2">"IF"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">predicate</span><span class="p">,</span> <span class="n">true</span><span class="p">,</span> <span class="n">false</span><span class="p">:</span> <span class="n">true</span> <span class="k">if</span> <span class="n">predicate</span> <span class="k">else</span> <span class="n">false</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="s2">"INTDIV"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">e</span> <span class="o">//</span> <span class="n">this</span><span class="p">),</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="s2">"INTERVAL"</span><span class="p">:</span> <span class="n">interval</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="s2">"LIKE"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="nb">bool</span><span class="p">(</span><span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"_"</span><span class="p">,</span> <span class="s2">"."</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"%"</span><span class="p">,</span> <span class="s2">".*"</span><span class="p">),</span> <span class="n">this</span><span class="p">))</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="p">),</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"LOWER"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="n">arg</span><span class="o">.</span><span class="n">lower</span><span class="p">()),</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"LT"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o"><</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="s2">"LTE"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o"><=</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="s2">"MOD"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">e</span> <span class="o">%</span> <span class="n">this</span><span class="p">),</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="s2">"MUL"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">e</span> <span class="o">*</span> <span class="n">this</span><span class="p">),</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="s2">"NEQ"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">this</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">this</span> <span class="o">!=</span> <span class="n">e</span><span class="p">),</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="s2">"ORD"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="nb">ord</span><span class="p">),</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="s2">"ORDERED"</span><span class="p">:</span> <span class="n">ordered</span><span class="p">,</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="s2">"POW"</span><span class="p">:</span> <span class="nb">pow</span><span class="p">,</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="s2">"STRPOSITION"</span><span class="p">:</span> <span class="n">str_position</span><span class="p">,</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="s2">"SUB"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">e</span> <span class="o">-</span> <span class="n">this</span><span class="p">),</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="s2">"SUBSTRING"</span><span class="p">:</span> <span class="n">substring</span><span class="p">,</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="s2">"TIMESTRTOTIME"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">arg</span><span class="p">)),</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="s2">"UPPER"</span><span class="p">:</span> <span class="n">null_if_any</span><span class="p">(</span><span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="n">arg</span><span class="o">.</span><span class="n">upper</span><span class="p">()),</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a><span class="p">}</span> +</span></pre></div> + + + </section> + <section id="reverse_key"> + <input id="reverse_key-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">reverse_key</span>: + + <label class="view-source-button" for="reverse_key-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#reverse_key"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="reverse_key-12"><a href="#reverse_key-12"><span class="linenos">12</span></a><span class="k">class</span> <span class="nc">reverse_key</span><span class="p">:</span> +</span><span id="reverse_key-13"><a href="#reverse_key-13"><span class="linenos">13</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span> +</span><span id="reverse_key-14"><a href="#reverse_key-14"><span class="linenos">14</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> +</span><span id="reverse_key-15"><a href="#reverse_key-15"><span class="linenos">15</span></a> +</span><span id="reverse_key-16"><a href="#reverse_key-16"><span class="linenos">16</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="reverse_key-17"><a href="#reverse_key-17"><span class="linenos">17</span></a> <span class="k">return</span> <span class="n">other</span><span class="o">.</span><span class="n">obj</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> +</span><span id="reverse_key-18"><a href="#reverse_key-18"><span class="linenos">18</span></a> +</span><span id="reverse_key-19"><a href="#reverse_key-19"><span class="linenos">19</span></a> <span class="k">def</span> <span class="fm">__lt__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="reverse_key-20"><a href="#reverse_key-20"><span class="linenos">20</span></a> <span class="k">return</span> <span class="n">other</span><span class="o">.</span><span class="n">obj</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> +</span></pre></div> + + + + + <div id="reverse_key.__init__" class="classattr"> + <input id="reverse_key.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">reverse_key</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">obj</span></span>)</span> + + <label class="view-source-button" for="reverse_key.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#reverse_key.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="reverse_key.__init__-13"><a href="#reverse_key.__init__-13"><span class="linenos">13</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span> +</span><span id="reverse_key.__init__-14"><a href="#reverse_key.__init__-14"><span class="linenos">14</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> +</span></pre></div> + + + + + </div> + </section> + <section id="filter_nulls"> + <input id="filter_nulls-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">filter_nulls</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">func</span>, </span><span class="param"><span class="n">empty_null</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="filter_nulls-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#filter_nulls"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="filter_nulls-23"><a href="#filter_nulls-23"><span class="linenos">23</span></a><span class="k">def</span> <span class="nf">filter_nulls</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">empty_null</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="filter_nulls-24"><a href="#filter_nulls-24"><span class="linenos">24</span></a> <span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span> +</span><span id="filter_nulls-25"><a href="#filter_nulls-25"><span class="linenos">25</span></a> <span class="k">def</span> <span class="nf">_func</span><span class="p">(</span><span class="n">values</span><span class="p">):</span> +</span><span id="filter_nulls-26"><a href="#filter_nulls-26"><span class="linenos">26</span></a> <span class="n">filtered</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">v</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">values</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="filter_nulls-27"><a href="#filter_nulls-27"><span class="linenos">27</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">filtered</span> <span class="ow">and</span> <span class="n">empty_null</span><span class="p">:</span> +</span><span id="filter_nulls-28"><a href="#filter_nulls-28"><span class="linenos">28</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="filter_nulls-29"><a href="#filter_nulls-29"><span class="linenos">29</span></a> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="n">filtered</span><span class="p">)</span> +</span><span id="filter_nulls-30"><a href="#filter_nulls-30"><span class="linenos">30</span></a> +</span><span id="filter_nulls-31"><a href="#filter_nulls-31"><span class="linenos">31</span></a> <span class="k">return</span> <span class="n">_func</span> +</span></pre></div> + + + + + </section> + <section id="null_if_any"> + <input id="null_if_any-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">null_if_any</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">*</span><span class="n">required</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="null_if_any-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#null_if_any"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="null_if_any-34"><a href="#null_if_any-34"><span class="linenos">34</span></a><span class="k">def</span> <span class="nf">null_if_any</span><span class="p">(</span><span class="o">*</span><span class="n">required</span><span class="p">):</span> +</span><span id="null_if_any-35"><a href="#null_if_any-35"><span class="linenos">35</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="null_if_any-36"><a href="#null_if_any-36"><span class="linenos">36</span></a><span class="sd"> Decorator that makes a function return `None` if any of the `required` arguments are `None`.</span> +</span><span id="null_if_any-37"><a href="#null_if_any-37"><span class="linenos">37</span></a> +</span><span id="null_if_any-38"><a href="#null_if_any-38"><span class="linenos">38</span></a><span class="sd"> This also supports decoration with no arguments, e.g.:</span> +</span><span id="null_if_any-39"><a href="#null_if_any-39"><span class="linenos">39</span></a> +</span><span id="null_if_any-40"><a href="#null_if_any-40"><span class="linenos">40</span></a><span class="sd"> @null_if_any</span> +</span><span id="null_if_any-41"><a href="#null_if_any-41"><span class="linenos">41</span></a><span class="sd"> def foo(a, b): ...</span> +</span><span id="null_if_any-42"><a href="#null_if_any-42"><span class="linenos">42</span></a> +</span><span id="null_if_any-43"><a href="#null_if_any-43"><span class="linenos">43</span></a><span class="sd"> In which case all arguments are required.</span> +</span><span id="null_if_any-44"><a href="#null_if_any-44"><span class="linenos">44</span></a><span class="sd"> """</span> +</span><span id="null_if_any-45"><a href="#null_if_any-45"><span class="linenos">45</span></a> <span class="n">f</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="null_if_any-46"><a href="#null_if_any-46"><span class="linenos">46</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">required</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">callable</span><span class="p">(</span><span class="n">required</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span> +</span><span id="null_if_any-47"><a href="#null_if_any-47"><span class="linenos">47</span></a> <span class="n">f</span> <span class="o">=</span> <span class="n">required</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="null_if_any-48"><a href="#null_if_any-48"><span class="linenos">48</span></a> <span class="n">required</span> <span class="o">=</span> <span class="p">()</span> +</span><span id="null_if_any-49"><a href="#null_if_any-49"><span class="linenos">49</span></a> +</span><span id="null_if_any-50"><a href="#null_if_any-50"><span class="linenos">50</span></a> <span class="k">def</span> <span class="nf">decorator</span><span class="p">(</span><span class="n">func</span><span class="p">):</span> +</span><span id="null_if_any-51"><a href="#null_if_any-51"><span class="linenos">51</span></a> <span class="k">if</span> <span class="n">required</span><span class="p">:</span> +</span><span id="null_if_any-52"><a href="#null_if_any-52"><span class="linenos">52</span></a> <span class="n">required_indices</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="null_if_any-53"><a href="#null_if_any-53"><span class="linenos">53</span></a> <span class="n">i</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">param</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">inspect</span><span class="o">.</span><span class="n">signature</span><span class="p">(</span><span class="n">func</span><span class="p">)</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="k">if</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">required</span> +</span><span id="null_if_any-54"><a href="#null_if_any-54"><span class="linenos">54</span></a> <span class="p">]</span> +</span><span id="null_if_any-55"><a href="#null_if_any-55"><span class="linenos">55</span></a> +</span><span id="null_if_any-56"><a href="#null_if_any-56"><span class="linenos">56</span></a> <span class="k">def</span> <span class="nf">predicate</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="null_if_any-57"><a href="#null_if_any-57"><span class="linenos">57</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">required_indices</span><span class="p">)</span> +</span><span id="null_if_any-58"><a href="#null_if_any-58"><span class="linenos">58</span></a> +</span><span id="null_if_any-59"><a href="#null_if_any-59"><span class="linenos">59</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="null_if_any-60"><a href="#null_if_any-60"><span class="linenos">60</span></a> +</span><span id="null_if_any-61"><a href="#null_if_any-61"><span class="linenos">61</span></a> <span class="k">def</span> <span class="nf">predicate</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="null_if_any-62"><a href="#null_if_any-62"><span class="linenos">62</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span><span class="n">a</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="null_if_any-63"><a href="#null_if_any-63"><span class="linenos">63</span></a> +</span><span id="null_if_any-64"><a href="#null_if_any-64"><span class="linenos">64</span></a> <span class="nd">@wraps</span><span class="p">(</span><span class="n">func</span><span class="p">)</span> +</span><span id="null_if_any-65"><a href="#null_if_any-65"><span class="linenos">65</span></a> <span class="k">def</span> <span class="nf">_func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="null_if_any-66"><a href="#null_if_any-66"><span class="linenos">66</span></a> <span class="k">if</span> <span class="n">predicate</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">):</span> +</span><span id="null_if_any-67"><a href="#null_if_any-67"><span class="linenos">67</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="null_if_any-68"><a href="#null_if_any-68"><span class="linenos">68</span></a> <span class="k">return</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span> +</span><span id="null_if_any-69"><a href="#null_if_any-69"><span class="linenos">69</span></a> +</span><span id="null_if_any-70"><a href="#null_if_any-70"><span class="linenos">70</span></a> <span class="k">return</span> <span class="n">_func</span> +</span><span id="null_if_any-71"><a href="#null_if_any-71"><span class="linenos">71</span></a> +</span><span id="null_if_any-72"><a href="#null_if_any-72"><span class="linenos">72</span></a> <span class="k">if</span> <span class="n">f</span><span class="p">:</span> +</span><span id="null_if_any-73"><a href="#null_if_any-73"><span class="linenos">73</span></a> <span class="k">return</span> <span class="n">decorator</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> +</span><span id="null_if_any-74"><a href="#null_if_any-74"><span class="linenos">74</span></a> +</span><span id="null_if_any-75"><a href="#null_if_any-75"><span class="linenos">75</span></a> <span class="k">return</span> <span class="n">decorator</span> +</span></pre></div> + + + <div class="docstring"><p>Decorator that makes a function return <code>None</code> if any of the <code>required</code> arguments are <code>None</code>.</p> + +<p>This also supports decoration with no arguments, e.g.:</p> + +<pre><code>@null_if_any +def foo(a, b): ... +</code></pre> + +<p>In which case all arguments are required.</p> +</div> + + + </section> + <section id="str_position"> + <input id="str_position-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@null_if_any('substr', 'this')</div> + + <span class="def">def</span> + <span class="name">str_position</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">substr</span>, </span><span class="param"><span class="n">this</span>, </span><span class="param"><span class="n">position</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="str_position-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#str_position"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="str_position-78"><a href="#str_position-78"><span class="linenos">78</span></a><span class="nd">@null_if_any</span><span class="p">(</span><span class="s2">"substr"</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="str_position-79"><a href="#str_position-79"><span class="linenos">79</span></a><span class="k">def</span> <span class="nf">str_position</span><span class="p">(</span><span class="n">substr</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">position</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="str_position-80"><a href="#str_position-80"><span class="linenos">80</span></a> <span class="n">position</span> <span class="o">=</span> <span class="n">position</span> <span class="o">-</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">position</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">position</span> +</span><span id="str_position-81"><a href="#str_position-81"><span class="linenos">81</span></a> <span class="k">return</span> <span class="n">this</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">substr</span><span class="p">,</span> <span class="n">position</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> +</span></pre></div> + + + + + </section> + <section id="substring"> + <input id="substring-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@null_if_any('this')</div> + + <span class="def">def</span> + <span class="name">substring</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">this</span>, </span><span class="param"><span class="n">start</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">length</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="substring-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#substring"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="substring-84"><a href="#substring-84"><span class="linenos">84</span></a><span class="nd">@null_if_any</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="substring-85"><a href="#substring-85"><span class="linenos">85</span></a><span class="k">def</span> <span class="nf">substring</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">length</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="substring-86"><a href="#substring-86"><span class="linenos">86</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="substring-87"><a href="#substring-87"><span class="linenos">87</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="substring-88"><a href="#substring-88"><span class="linenos">88</span></a> <span class="k">elif</span> <span class="n">start</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="substring-89"><a href="#substring-89"><span class="linenos">89</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="substring-90"><a href="#substring-90"><span class="linenos">90</span></a> <span class="k">elif</span> <span class="n">start</span> <span class="o"><</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="substring-91"><a href="#substring-91"><span class="linenos">91</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> <span class="o">+</span> <span class="n">start</span> +</span><span id="substring-92"><a href="#substring-92"><span class="linenos">92</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="substring-93"><a href="#substring-93"><span class="linenos">93</span></a> <span class="n">start</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="substring-94"><a href="#substring-94"><span class="linenos">94</span></a> +</span><span id="substring-95"><a href="#substring-95"><span class="linenos">95</span></a> <span class="n">end</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">length</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">start</span> <span class="o">+</span> <span class="n">length</span> +</span><span id="substring-96"><a href="#substring-96"><span class="linenos">96</span></a> +</span><span id="substring-97"><a href="#substring-97"><span class="linenos">97</span></a> <span class="k">return</span> <span class="n">this</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span></pre></div> + + + + + </section> + <section id="cast"> + <input id="cast-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@null_if_any</div> + + <span class="def">def</span> + <span class="name">cast</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">this</span>, </span><span class="param"><span class="n">to</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="cast-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#cast"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="cast-100"><a href="#cast-100"><span class="linenos">100</span></a><span class="nd">@null_if_any</span> +</span><span id="cast-101"><a href="#cast-101"><span class="linenos">101</span></a><span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="p">):</span> +</span><span id="cast-102"><a href="#cast-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="n">to</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="cast-103"><a href="#cast-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="cast-104"><a href="#cast-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="n">to</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="cast-105"><a href="#cast-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="cast-106"><a href="#cast-106"><span class="linenos">106</span></a> <span class="k">if</span> <span class="n">to</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEXT_TYPES</span><span class="p">:</span> +</span><span id="cast-107"><a href="#cast-107"><span class="linenos">107</span></a> <span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="cast-108"><a href="#cast-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="n">to</span> <span class="ow">in</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">}:</span> +</span><span id="cast-109"><a href="#cast-109"><span class="linenos">109</span></a> <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="cast-110"><a href="#cast-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="n">to</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">NUMERIC_TYPES</span><span class="p">:</span> +</span><span id="cast-111"><a href="#cast-111"><span class="linenos">111</span></a> <span class="k">return</span> <span class="nb">int</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="cast-112"><a href="#cast-112"><span class="linenos">112</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Casting to '</span><span class="si">{</span><span class="n">to</span><span class="si">}</span><span class="s2">' not implemented."</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="ordered"> + <input id="ordered-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ordered</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">this</span>, </span><span class="param"><span class="n">desc</span>, </span><span class="param"><span class="n">nulls_first</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="ordered-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ordered"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ordered-115"><a href="#ordered-115"><span class="linenos">115</span></a><span class="k">def</span> <span class="nf">ordered</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">desc</span><span class="p">,</span> <span class="n">nulls_first</span><span class="p">):</span> +</span><span id="ordered-116"><a href="#ordered-116"><span class="linenos">116</span></a> <span class="k">if</span> <span class="n">desc</span><span class="p">:</span> +</span><span id="ordered-117"><a href="#ordered-117"><span class="linenos">117</span></a> <span class="k">return</span> <span class="n">reverse_key</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="ordered-118"><a href="#ordered-118"><span class="linenos">118</span></a> <span class="k">return</span> <span class="n">this</span> +</span></pre></div> + + + + + </section> + <section id="interval"> + <input id="interval-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@null_if_any</div> + + <span class="def">def</span> + <span class="name">interval</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">this</span>, </span><span class="param"><span class="n">unit</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="interval-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#interval"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="interval-121"><a href="#interval-121"><span class="linenos">121</span></a><span class="nd">@null_if_any</span> +</span><span id="interval-122"><a href="#interval-122"><span class="linenos">122</span></a><span class="k">def</span> <span class="nf">interval</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">unit</span><span class="p">):</span> +</span><span id="interval-123"><a href="#interval-123"><span class="linenos">123</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"DAY"</span><span class="p">:</span> +</span><span id="interval-124"><a href="#interval-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">timedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="nb">float</span><span class="p">(</span><span class="n">this</span><span class="p">))</span> +</span><span id="interval-125"><a href="#interval-125"><span class="linenos">125</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/executor/python.html b/docs/sqlglot/executor/python.html new file mode 100644 index 0000000..c035943 --- /dev/null +++ b/docs/sqlglot/executor/python.html @@ -0,0 +1,2130 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.executor.python API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../executor.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.executor</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#PythonExecutor">PythonExecutor</a> + <ul class="memberlist"> + <li> + <a class="function" href="#PythonExecutor.__init__">PythonExecutor</a> + </li> + <li> + <a class="function" href="#PythonExecutor.execute">execute</a> + </li> + <li> + <a class="function" href="#PythonExecutor.generate">generate</a> + </li> + <li> + <a class="function" href="#PythonExecutor.generate_tuple">generate_tuple</a> + </li> + <li> + <a class="function" href="#PythonExecutor.context">context</a> + </li> + <li> + <a class="function" href="#PythonExecutor.table">table</a> + </li> + <li> + <a class="function" href="#PythonExecutor.scan">scan</a> + </li> + <li> + <a class="function" href="#PythonExecutor.static">static</a> + </li> + <li> + <a class="function" href="#PythonExecutor.scan_table">scan_table</a> + </li> + <li> + <a class="function" href="#PythonExecutor.scan_csv">scan_csv</a> + </li> + <li> + <a class="function" href="#PythonExecutor.join">join</a> + </li> + <li> + <a class="function" href="#PythonExecutor.nested_loop_join">nested_loop_join</a> + </li> + <li> + <a class="function" href="#PythonExecutor.hash_join">hash_join</a> + </li> + <li> + <a class="function" href="#PythonExecutor.aggregate">aggregate</a> + </li> + <li> + <a class="function" href="#PythonExecutor.sort">sort</a> + </li> + <li> + <a class="function" href="#PythonExecutor.set_operation">set_operation</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Python">Python</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Python.__init__">Python</a> + </li> + <li> + <a class="class" href="#Python.Tokenizer">Python.Tokenizer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Python.Generator">Python.Generator</a> + <ul class="memberlist"> + </ul> + + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/executor/python.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../executor.html">executor</a><wbr>.python </h1> + + + <input id="mod-python-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-python-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">ast</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">import</span> <span class="nn">collections</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">math</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">planner</span><span class="p">,</span> <span class="n">tokens</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">inline_array_sql</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ExecuteError</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.executor.context</span> <span class="kn">import</span> <span class="n">Context</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.executor.env</span> <span class="kn">import</span> <span class="n">ENV</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">sqlglot.executor.table</span> <span class="kn">import</span> <span class="n">RowReader</span><span class="p">,</span> <span class="n">Table</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">csv_reader</span><span class="p">,</span> <span class="n">subclasses</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="k">class</span> <span class="nc">PythonExecutor</span><span class="p">:</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">tables</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span> <span class="o">=</span> <span class="n">Python</span><span class="p">()</span><span class="o">.</span><span class="n">generator</span><span class="p">(</span><span class="n">identify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">ENV</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">env</span> <span class="ow">or</span> <span class="p">{})}</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> <span class="o">=</span> <span class="n">tables</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plan</span><span class="p">):</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">running</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">finished</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">plan</span><span class="o">.</span><span class="n">leaves</span><span class="p">)</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">contexts</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="p">{</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">table</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">contexts</span><span class="p">[</span><span class="n">dep</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="p">}</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">running</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Scan</span><span class="p">):</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Aggregate</span><span class="p">):</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aggregate</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Sort</span><span class="p">):</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">SetOperation</span><span class="p">):</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">running</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">finished</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependents</span><span class="p">:</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="k">if</span> <span class="n">dep</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">running</span> <span class="ow">and</span> <span class="nb">all</span><span class="p">(</span><span class="n">d</span> <span class="ow">in</span> <span class="n">contexts</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dep</span><span class="o">.</span><span class="n">dependencies</span><span class="p">):</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">if</span> <span class="nb">all</span><span class="p">(</span><span class="n">d</span> <span class="ow">in</span> <span class="n">finished</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dep</span><span class="o">.</span><span class="n">dependents</span><span class="p">):</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">contexts</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">raise</span> <span class="n">ExecuteError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Step '</span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">' failed: </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="kn">from</span> <span class="nn">e</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">plan</span><span class="o">.</span><span class="n">root</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">return</span> <span class="n">contexts</span><span class="p">[</span><span class="n">root</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">root</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="w"> </span><span class="sd">"""Convert a SQL expression into literal Python code and compile it into bytecode."""</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">return</span> <span class="nb">compile</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">sql</span><span class="p">,</span> <span class="s2">"eval"</span><span class="p">,</span> <span class="n">optimize</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="k">def</span> <span class="nf">generate_tuple</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="w"> </span><span class="sd">"""Convert an array of SQL expressions into tuple of Python byte code."""</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">def</span> <span class="nf">context</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tables</span><span class="p">):</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">return</span> <span class="n">Context</span><span class="p">(</span><span class="n">tables</span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">)</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="k">else</span> <span class="n">expression</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="p">)</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">def</span> <span class="nf">scan</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">context</span><span class="p">,</span> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">static</span><span class="p">()</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">elif</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">projections</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">source</span><span class="p">]})</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">table_iter</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">table_iter</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan_csv</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">context</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">table_iter</span><span class="p">)</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">context</span><span class="p">,</span> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan_table</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">for</span> <span class="n">reader</span> <span class="ow">in</span> <span class="n">table_iter</span><span class="p">:</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sink</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">break</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">context</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">continue</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">def</span> <span class="nf">static</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({}),</span> <span class="p">[</span><span class="n">RowReader</span><span class="p">(())]</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="k">def</span> <span class="nf">scan_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">):</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="p">)</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="n">context</span><span class="p">,</span> <span class="nb">iter</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="k">def</span> <span class="nf">scan_csv</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">):</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="k">with</span> <span class="n">csv_reader</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> <span class="k">as</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">alias</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">yield</span> <span class="n">context</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">types</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">types</span><span class="p">:</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">row</span><span class="p">:</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">types</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">ast</span><span class="o">.</span><span class="n">literal_eval</span><span class="p">(</span><span class="n">v</span><span class="p">)))</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SyntaxError</span><span class="p">):</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">types</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_row</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">t</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">t</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">types</span><span class="p">,</span> <span class="n">row</span><span class="p">)))</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">yield</span> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">reader</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="n">source_table</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">source</span><span class="p">]</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="n">source_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">source</span><span class="p">:</span> <span class="n">source_table</span><span class="p">})</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">column_ranges</span> <span class="o">=</span> <span class="p">{</span><span class="n">source</span><span class="p">:</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">source_table</span><span class="o">.</span><span class="n">columns</span><span class="p">))}</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">step</span><span class="o">.</span><span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">stop</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">column_ranges</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">column_ranges</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="o">+</span> <span class="n">start</span><span class="p">)</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">join_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"source_key"</span><span class="p">):</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">hash_join</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">)</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nested_loop_join</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">)</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">source_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="p">{</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">Table</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">column_range</span><span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">column_range</span> <span class="ow">in</span> <span class="n">column_ranges</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="p">}</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="p">)</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"condition"</span><span class="p">])</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="k">if</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="n">source_context</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="k">return</span> <span class="n">source_context</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span> <span class="k">if</span> <span class="n">projections</span> <span class="k">else</span> <span class="n">source_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="k">if</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">ctx</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="k">continue</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sink</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="k">break</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="p">{</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">Table</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">source_context</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="p">}</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="p">)</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="k">def</span> <span class="nf">nested_loop_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">):</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">source_context</span><span class="o">.</span><span class="n">columns</span> <span class="o">+</span> <span class="n">join_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="k">for</span> <span class="n">reader_a</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="k">for</span> <span class="n">reader_b</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">join_context</span><span class="p">:</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader_a</span><span class="o">.</span><span class="n">row</span> <span class="o">+</span> <span class="n">reader_b</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="k">def</span> <span class="nf">hash_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">):</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">source_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"source_key"</span><span class="p">])</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">join_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"join_key"</span><span class="p">])</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"LEFT"</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"RIGHT"</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">results</span> <span class="o">=</span> <span class="n">collections</span><span class="o">.</span><span class="n">defaultdict</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="p">([],</span> <span class="p">[]))</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="n">results</span><span class="p">[</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">source_key</span><span class="p">)][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">join_context</span><span class="p">:</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">results</span><span class="p">[</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">join_key</span><span class="p">)][</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">source_context</span><span class="o">.</span><span class="n">columns</span> <span class="o">+</span> <span class="n">join_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">nulls</span> <span class="o">=</span> <span class="p">[(</span><span class="kc">None</span><span class="p">,)</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">join_context</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">left</span> <span class="k">else</span> <span class="n">source_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)]</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="k">for</span> <span class="n">a_group</span><span class="p">,</span> <span class="n">b_group</span> <span class="ow">in</span> <span class="n">results</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="k">if</span> <span class="n">left</span><span class="p">:</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="n">b_group</span> <span class="o">=</span> <span class="n">b_group</span> <span class="ow">or</span> <span class="n">nulls</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="k">elif</span> <span class="n">right</span><span class="p">:</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="n">a_group</span> <span class="o">=</span> <span class="n">a_group</span> <span class="ow">or</span> <span class="n">nulls</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="k">for</span> <span class="n">a_row</span><span class="p">,</span> <span class="n">b_row</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">product</span><span class="p">(</span><span class="n">a_group</span><span class="p">,</span> <span class="n">b_group</span><span class="p">):</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">a_row</span> <span class="o">+</span> <span class="n">b_row</span><span class="p">)</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">def</span> <span class="nf">aggregate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">aggregations</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">aggregations</span><span class="p">)</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">operands</span><span class="p">)</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="n">operands</span><span class="p">:</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="n">operand_table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">operands</span><span class="p">)</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">operand_table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">operands</span><span class="p">))</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">operand_table</span><span class="o">.</span><span class="n">rows</span><span class="p">)):</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="n">width</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">context</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">*</span><span class="n">operand_table</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">operand_table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="nb">range</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">width</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">operand_table</span><span class="o">.</span><span class="n">columns</span><span class="p">)),</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="p">)</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="p">{</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="kc">None</span><span class="p">:</span> <span class="n">operand_table</span><span class="p">,</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="o">**</span><span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">,</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="p">}</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="p">)</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="n">context</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">group_by</span><span class="p">)</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="n">group</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="n">end</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">group</span><span class="p">)</span> <span class="o">+</span> <span class="n">step</span><span class="o">.</span><span class="n">aggregations</span><span class="p">)</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="k">def</span> <span class="nf">add_row</span><span class="p">():</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span> <span class="ow">or</span> <span class="n">context</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">group</span> <span class="o">+</span> <span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">aggregations</span><span class="p">))</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="k">if</span> <span class="n">length</span><span class="p">:</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">length</span><span class="p">):</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">key</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">group_by</span><span class="p">)</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">key</span> <span class="k">if</span> <span class="n">group</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">group</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="n">end</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="n">key</span> <span class="o">!=</span> <span class="n">group</span><span class="p">:</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="n">add_row</span><span class="p">()</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">key</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">2</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="k">break</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="n">add_row</span><span class="p">()</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">elif</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span> <span class="o">></span> <span class="mi">0</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">aggregations</span><span class="p">))</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="p">,</span> <span class="o">**</span><span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">}})</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="k">if</span> <span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="n">context</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="k">def</span> <span class="nf">sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">projection_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">]</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="o">+</span> <span class="n">projection_columns</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">+</span> <span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">sort_ctx</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="p">{</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="kc">None</span><span class="p">:</span> <span class="n">sink</span><span class="p">,</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="o">**</span><span class="p">{</span><span class="n">table</span><span class="p">:</span> <span class="n">sink</span> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">},</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="p">}</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="p">)</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">key</span><span class="p">))</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">math</span><span class="o">.</span><span class="n">isinf</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">):</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="mi">0</span> <span class="p">:</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">]</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="n">output</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">projection_columns</span><span class="p">,</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="n">rows</span><span class="o">=</span><span class="p">[</span><span class="n">r</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)]</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">],</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="p">)</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">output</span><span class="p">})</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="k">def</span> <span class="nf">set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">left</span><span class="p">]</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">right</span><span class="p">]</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">):</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="k">elif</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">):</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="k">elif</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="ow">and</span> <span class="n">step</span><span class="o">.</span><span class="n">distinct</span><span class="p">:</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">left</span><span class="o">.</span><span class="n">rows</span> <span class="o">+</span> <span class="n">right</span><span class="o">.</span><span class="n">rows</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a><span class="k">def</span> <span class="nf">_ordered_py</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="s2">"True"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"False"</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="s2">"True"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nulls_first"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"False"</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ORDERED(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">desc</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">nulls_first</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a><span class="k">def</span> <span class="nf">_rename</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">):</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="k">if</span> <span class="s2">"expressions"</span> <span class="ow">in</span> <span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">, "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">())</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">ex</span><span class="p">:</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not rename </span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="kn">from</span> <span class="nn">ex</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a><span class="k">def</span> <span class="nf">_case_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"None"</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">]):</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> = (</span><span class="si">{</span><span class="n">condition</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">condition</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> if </span><span class="si">{</span><span class="n">condition</span><span class="si">}</span><span class="s2"> else (</span><span class="si">{</span><span class="n">chain</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="n">chain</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a><span class="k">def</span> <span class="nf">_lambda_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">names</span> <span class="o">=</span> <span class="p">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">e</span><span class="o">.</span><span class="n">expressions</span><span class="p">}</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="n">e</span> <span class="o">=</span> <span class="n">e</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">n</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="ow">and</span> <span class="n">n</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">in</span> <span class="n">names</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="k">else</span> <span class="n">n</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="p">)</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"lambda </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a><span class="k">class</span> <span class="nc">Python</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> <span class="o">**</span><span class="p">{</span><span class="n">klass</span><span class="p">:</span> <span class="n">_rename</span> <span class="k">for</span> <span class="n">klass</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)},</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="o">**</span><span class="p">{</span><span class="n">klass</span><span class="p">:</span> <span class="n">_rename</span> <span class="k">for</span> <span class="n">klass</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">ALL_FUNCTIONS</span><span class="p">},</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">:</span> <span class="n">_case_sql</span><span class="p">,</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"and"</span><span class="p">),</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">:</span> <span class="n">_rename</span><span class="p">,</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="s2">"True"</span> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">"False"</span><span class="p">,</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">, exp.DataType.Type.</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'to'</span><span class="p">]</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"scope[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'table'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="kc">None</span><span class="si">}</span><span class="s2">][</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"set(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EXTRACT('</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s2">', </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> in (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"is"</span><span class="p">),</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">:</span> <span class="n">_lambda_sql</span><span class="p">,</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"not </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"None"</span><span class="p">,</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"or"</span><span class="p">),</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">:</span> <span class="n">_ordered_py</span><span class="p">,</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> <span class="p">}</span> +</span></pre></div> + + + </section> + <section id="PythonExecutor"> + <input id="PythonExecutor-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PythonExecutor</span>: + + <label class="view-source-button" for="PythonExecutor-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor-16"><a href="#PythonExecutor-16"><span class="linenos"> 16</span></a><span class="k">class</span> <span class="nc">PythonExecutor</span><span class="p">:</span> +</span><span id="PythonExecutor-17"><a href="#PythonExecutor-17"><span class="linenos"> 17</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">tables</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="PythonExecutor-18"><a href="#PythonExecutor-18"><span class="linenos"> 18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span> <span class="o">=</span> <span class="n">Python</span><span class="p">()</span><span class="o">.</span><span class="n">generator</span><span class="p">(</span><span class="n">identify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="PythonExecutor-19"><a href="#PythonExecutor-19"><span class="linenos"> 19</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">ENV</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">env</span> <span class="ow">or</span> <span class="p">{})}</span> +</span><span id="PythonExecutor-20"><a href="#PythonExecutor-20"><span class="linenos"> 20</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> <span class="o">=</span> <span class="n">tables</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="PythonExecutor-21"><a href="#PythonExecutor-21"><span class="linenos"> 21</span></a> +</span><span id="PythonExecutor-22"><a href="#PythonExecutor-22"><span class="linenos"> 22</span></a> <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plan</span><span class="p">):</span> +</span><span id="PythonExecutor-23"><a href="#PythonExecutor-23"><span class="linenos"> 23</span></a> <span class="n">running</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="PythonExecutor-24"><a href="#PythonExecutor-24"><span class="linenos"> 24</span></a> <span class="n">finished</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="PythonExecutor-25"><a href="#PythonExecutor-25"><span class="linenos"> 25</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">plan</span><span class="o">.</span><span class="n">leaves</span><span class="p">)</span> +</span><span id="PythonExecutor-26"><a href="#PythonExecutor-26"><span class="linenos"> 26</span></a> <span class="n">contexts</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="PythonExecutor-27"><a href="#PythonExecutor-27"><span class="linenos"> 27</span></a> +</span><span id="PythonExecutor-28"><a href="#PythonExecutor-28"><span class="linenos"> 28</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="PythonExecutor-29"><a href="#PythonExecutor-29"><span class="linenos"> 29</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="PythonExecutor-30"><a href="#PythonExecutor-30"><span class="linenos"> 30</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="PythonExecutor-31"><a href="#PythonExecutor-31"><span class="linenos"> 31</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor-32"><a href="#PythonExecutor-32"><span class="linenos"> 32</span></a> <span class="p">{</span> +</span><span id="PythonExecutor-33"><a href="#PythonExecutor-33"><span class="linenos"> 33</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">table</span> +</span><span id="PythonExecutor-34"><a href="#PythonExecutor-34"><span class="linenos"> 34</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span> +</span><span id="PythonExecutor-35"><a href="#PythonExecutor-35"><span class="linenos"> 35</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">contexts</span><span class="p">[</span><span class="n">dep</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="PythonExecutor-36"><a href="#PythonExecutor-36"><span class="linenos"> 36</span></a> <span class="p">}</span> +</span><span id="PythonExecutor-37"><a href="#PythonExecutor-37"><span class="linenos"> 37</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-38"><a href="#PythonExecutor-38"><span class="linenos"> 38</span></a> <span class="n">running</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="PythonExecutor-39"><a href="#PythonExecutor-39"><span class="linenos"> 39</span></a> +</span><span id="PythonExecutor-40"><a href="#PythonExecutor-40"><span class="linenos"> 40</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Scan</span><span class="p">):</span> +</span><span id="PythonExecutor-41"><a href="#PythonExecutor-41"><span class="linenos"> 41</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor-42"><a href="#PythonExecutor-42"><span class="linenos"> 42</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Aggregate</span><span class="p">):</span> +</span><span id="PythonExecutor-43"><a href="#PythonExecutor-43"><span class="linenos"> 43</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aggregate</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor-44"><a href="#PythonExecutor-44"><span class="linenos"> 44</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="PythonExecutor-45"><a href="#PythonExecutor-45"><span class="linenos"> 45</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor-46"><a href="#PythonExecutor-46"><span class="linenos"> 46</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Sort</span><span class="p">):</span> +</span><span id="PythonExecutor-47"><a href="#PythonExecutor-47"><span class="linenos"> 47</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor-48"><a href="#PythonExecutor-48"><span class="linenos"> 48</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">SetOperation</span><span class="p">):</span> +</span><span id="PythonExecutor-49"><a href="#PythonExecutor-49"><span class="linenos"> 49</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor-50"><a href="#PythonExecutor-50"><span class="linenos"> 50</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-51"><a href="#PythonExecutor-51"><span class="linenos"> 51</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="PythonExecutor-52"><a href="#PythonExecutor-52"><span class="linenos"> 52</span></a> +</span><span id="PythonExecutor-53"><a href="#PythonExecutor-53"><span class="linenos"> 53</span></a> <span class="n">running</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="PythonExecutor-54"><a href="#PythonExecutor-54"><span class="linenos"> 54</span></a> <span class="n">finished</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="PythonExecutor-55"><a href="#PythonExecutor-55"><span class="linenos"> 55</span></a> +</span><span id="PythonExecutor-56"><a href="#PythonExecutor-56"><span class="linenos"> 56</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependents</span><span class="p">:</span> +</span><span id="PythonExecutor-57"><a href="#PythonExecutor-57"><span class="linenos"> 57</span></a> <span class="k">if</span> <span class="n">dep</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">running</span> <span class="ow">and</span> <span class="nb">all</span><span class="p">(</span><span class="n">d</span> <span class="ow">in</span> <span class="n">contexts</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dep</span><span class="o">.</span><span class="n">dependencies</span><span class="p">):</span> +</span><span id="PythonExecutor-58"><a href="#PythonExecutor-58"><span class="linenos"> 58</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="PythonExecutor-59"><a href="#PythonExecutor-59"><span class="linenos"> 59</span></a> +</span><span id="PythonExecutor-60"><a href="#PythonExecutor-60"><span class="linenos"> 60</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="PythonExecutor-61"><a href="#PythonExecutor-61"><span class="linenos"> 61</span></a> <span class="k">if</span> <span class="nb">all</span><span class="p">(</span><span class="n">d</span> <span class="ow">in</span> <span class="n">finished</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dep</span><span class="o">.</span><span class="n">dependents</span><span class="p">):</span> +</span><span id="PythonExecutor-62"><a href="#PythonExecutor-62"><span class="linenos"> 62</span></a> <span class="n">contexts</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="PythonExecutor-63"><a href="#PythonExecutor-63"><span class="linenos"> 63</span></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> +</span><span id="PythonExecutor-64"><a href="#PythonExecutor-64"><span class="linenos"> 64</span></a> <span class="k">raise</span> <span class="n">ExecuteError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Step '</span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">' failed: </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="kn">from</span> <span class="nn">e</span> +</span><span id="PythonExecutor-65"><a href="#PythonExecutor-65"><span class="linenos"> 65</span></a> +</span><span id="PythonExecutor-66"><a href="#PythonExecutor-66"><span class="linenos"> 66</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">plan</span><span class="o">.</span><span class="n">root</span> +</span><span id="PythonExecutor-67"><a href="#PythonExecutor-67"><span class="linenos"> 67</span></a> <span class="k">return</span> <span class="n">contexts</span><span class="p">[</span><span class="n">root</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">root</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span><span id="PythonExecutor-68"><a href="#PythonExecutor-68"><span class="linenos"> 68</span></a> +</span><span id="PythonExecutor-69"><a href="#PythonExecutor-69"><span class="linenos"> 69</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="PythonExecutor-70"><a href="#PythonExecutor-70"><span class="linenos"> 70</span></a><span class="w"> </span><span class="sd">"""Convert a SQL expression into literal Python code and compile it into bytecode."""</span> +</span><span id="PythonExecutor-71"><a href="#PythonExecutor-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="PythonExecutor-72"><a href="#PythonExecutor-72"><span class="linenos"> 72</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="PythonExecutor-73"><a href="#PythonExecutor-73"><span class="linenos"> 73</span></a> +</span><span id="PythonExecutor-74"><a href="#PythonExecutor-74"><span class="linenos"> 74</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="PythonExecutor-75"><a href="#PythonExecutor-75"><span class="linenos"> 75</span></a> <span class="k">return</span> <span class="nb">compile</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">sql</span><span class="p">,</span> <span class="s2">"eval"</span><span class="p">,</span> <span class="n">optimize</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> +</span><span id="PythonExecutor-76"><a href="#PythonExecutor-76"><span class="linenos"> 76</span></a> +</span><span id="PythonExecutor-77"><a href="#PythonExecutor-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">generate_tuple</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="PythonExecutor-78"><a href="#PythonExecutor-78"><span class="linenos"> 78</span></a><span class="w"> </span><span class="sd">"""Convert an array of SQL expressions into tuple of Python byte code."""</span> +</span><span id="PythonExecutor-79"><a href="#PythonExecutor-79"><span class="linenos"> 79</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="PythonExecutor-80"><a href="#PythonExecutor-80"><span class="linenos"> 80</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="PythonExecutor-81"><a href="#PythonExecutor-81"><span class="linenos"> 81</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="PythonExecutor-82"><a href="#PythonExecutor-82"><span class="linenos"> 82</span></a> +</span><span id="PythonExecutor-83"><a href="#PythonExecutor-83"><span class="linenos"> 83</span></a> <span class="k">def</span> <span class="nf">context</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tables</span><span class="p">):</span> +</span><span id="PythonExecutor-84"><a href="#PythonExecutor-84"><span class="linenos"> 84</span></a> <span class="k">return</span> <span class="n">Context</span><span class="p">(</span><span class="n">tables</span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">)</span> +</span><span id="PythonExecutor-85"><a href="#PythonExecutor-85"><span class="linenos"> 85</span></a> +</span><span id="PythonExecutor-86"><a href="#PythonExecutor-86"><span class="linenos"> 86</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="PythonExecutor-87"><a href="#PythonExecutor-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="PythonExecutor-88"><a href="#PythonExecutor-88"><span class="linenos"> 88</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="k">else</span> <span class="n">expression</span> +</span><span id="PythonExecutor-89"><a href="#PythonExecutor-89"><span class="linenos"> 89</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span> +</span><span id="PythonExecutor-90"><a href="#PythonExecutor-90"><span class="linenos"> 90</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-91"><a href="#PythonExecutor-91"><span class="linenos"> 91</span></a> +</span><span id="PythonExecutor-92"><a href="#PythonExecutor-92"><span class="linenos"> 92</span></a> <span class="k">def</span> <span class="nf">scan</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor-93"><a href="#PythonExecutor-93"><span class="linenos"> 93</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span> +</span><span id="PythonExecutor-94"><a href="#PythonExecutor-94"><span class="linenos"> 94</span></a> +</span><span id="PythonExecutor-95"><a href="#PythonExecutor-95"><span class="linenos"> 95</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="PythonExecutor-96"><a href="#PythonExecutor-96"><span class="linenos"> 96</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span> +</span><span id="PythonExecutor-97"><a href="#PythonExecutor-97"><span class="linenos"> 97</span></a> +</span><span id="PythonExecutor-98"><a href="#PythonExecutor-98"><span class="linenos"> 98</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor-99"><a href="#PythonExecutor-99"><span class="linenos"> 99</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor-100"><a href="#PythonExecutor-100"><span class="linenos">100</span></a> +</span><span id="PythonExecutor-101"><a href="#PythonExecutor-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="PythonExecutor-102"><a href="#PythonExecutor-102"><span class="linenos">102</span></a> <span class="n">context</span><span class="p">,</span> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">static</span><span class="p">()</span> +</span><span id="PythonExecutor-103"><a href="#PythonExecutor-103"><span class="linenos">103</span></a> <span class="k">elif</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="PythonExecutor-104"><a href="#PythonExecutor-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">projections</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="PythonExecutor-105"><a href="#PythonExecutor-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">source</span><span class="p">]})</span> +</span><span id="PythonExecutor-106"><a href="#PythonExecutor-106"><span class="linenos">106</span></a> <span class="n">table_iter</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">table_iter</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> +</span><span id="PythonExecutor-107"><a href="#PythonExecutor-107"><span class="linenos">107</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="PythonExecutor-108"><a href="#PythonExecutor-108"><span class="linenos">108</span></a> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan_csv</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="PythonExecutor-109"><a href="#PythonExecutor-109"><span class="linenos">109</span></a> <span class="n">context</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">table_iter</span><span class="p">)</span> +</span><span id="PythonExecutor-110"><a href="#PythonExecutor-110"><span class="linenos">110</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-111"><a href="#PythonExecutor-111"><span class="linenos">111</span></a> <span class="n">context</span><span class="p">,</span> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan_table</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="PythonExecutor-112"><a href="#PythonExecutor-112"><span class="linenos">112</span></a> +</span><span id="PythonExecutor-113"><a href="#PythonExecutor-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor-114"><a href="#PythonExecutor-114"><span class="linenos">114</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor-115"><a href="#PythonExecutor-115"><span class="linenos">115</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-116"><a href="#PythonExecutor-116"><span class="linenos">116</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-117"><a href="#PythonExecutor-117"><span class="linenos">117</span></a> +</span><span id="PythonExecutor-118"><a href="#PythonExecutor-118"><span class="linenos">118</span></a> <span class="k">for</span> <span class="n">reader</span> <span class="ow">in</span> <span class="n">table_iter</span><span class="p">:</span> +</span><span id="PythonExecutor-119"><a href="#PythonExecutor-119"><span class="linenos">119</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sink</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="PythonExecutor-120"><a href="#PythonExecutor-120"><span class="linenos">120</span></a> <span class="k">break</span> +</span><span id="PythonExecutor-121"><a href="#PythonExecutor-121"><span class="linenos">121</span></a> +</span><span id="PythonExecutor-122"><a href="#PythonExecutor-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">context</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="PythonExecutor-123"><a href="#PythonExecutor-123"><span class="linenos">123</span></a> <span class="k">continue</span> +</span><span id="PythonExecutor-124"><a href="#PythonExecutor-124"><span class="linenos">124</span></a> +</span><span id="PythonExecutor-125"><a href="#PythonExecutor-125"><span class="linenos">125</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor-126"><a href="#PythonExecutor-126"><span class="linenos">126</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="PythonExecutor-127"><a href="#PythonExecutor-127"><span class="linenos">127</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-128"><a href="#PythonExecutor-128"><span class="linenos">128</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor-129"><a href="#PythonExecutor-129"><span class="linenos">129</span></a> +</span><span id="PythonExecutor-130"><a href="#PythonExecutor-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span><span id="PythonExecutor-131"><a href="#PythonExecutor-131"><span class="linenos">131</span></a> +</span><span id="PythonExecutor-132"><a href="#PythonExecutor-132"><span class="linenos">132</span></a> <span class="k">def</span> <span class="nf">static</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="PythonExecutor-133"><a href="#PythonExecutor-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({}),</span> <span class="p">[</span><span class="n">RowReader</span><span class="p">(())]</span> +</span><span id="PythonExecutor-134"><a href="#PythonExecutor-134"><span class="linenos">134</span></a> +</span><span id="PythonExecutor-135"><a href="#PythonExecutor-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">scan_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">):</span> +</span><span id="PythonExecutor-136"><a href="#PythonExecutor-136"><span class="linenos">136</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="p">)</span> +</span><span id="PythonExecutor-137"><a href="#PythonExecutor-137"><span class="linenos">137</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="PythonExecutor-138"><a href="#PythonExecutor-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">context</span><span class="p">,</span> <span class="nb">iter</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="PythonExecutor-139"><a href="#PythonExecutor-139"><span class="linenos">139</span></a> +</span><span id="PythonExecutor-140"><a href="#PythonExecutor-140"><span class="linenos">140</span></a> <span class="k">def</span> <span class="nf">scan_csv</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">):</span> +</span><span id="PythonExecutor-141"><a href="#PythonExecutor-141"><span class="linenos">141</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">alias</span> +</span><span id="PythonExecutor-142"><a href="#PythonExecutor-142"><span class="linenos">142</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">this</span> +</span><span id="PythonExecutor-143"><a href="#PythonExecutor-143"><span class="linenos">143</span></a> +</span><span id="PythonExecutor-144"><a href="#PythonExecutor-144"><span class="linenos">144</span></a> <span class="k">with</span> <span class="n">csv_reader</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> <span class="k">as</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="PythonExecutor-145"><a href="#PythonExecutor-145"><span class="linenos">145</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="PythonExecutor-146"><a href="#PythonExecutor-146"><span class="linenos">146</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-147"><a href="#PythonExecutor-147"><span class="linenos">147</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">alias</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="PythonExecutor-148"><a href="#PythonExecutor-148"><span class="linenos">148</span></a> <span class="k">yield</span> <span class="n">context</span> +</span><span id="PythonExecutor-149"><a href="#PythonExecutor-149"><span class="linenos">149</span></a> <span class="n">types</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="PythonExecutor-150"><a href="#PythonExecutor-150"><span class="linenos">150</span></a> +</span><span id="PythonExecutor-151"><a href="#PythonExecutor-151"><span class="linenos">151</span></a> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="PythonExecutor-152"><a href="#PythonExecutor-152"><span class="linenos">152</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">types</span><span class="p">:</span> +</span><span id="PythonExecutor-153"><a href="#PythonExecutor-153"><span class="linenos">153</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">row</span><span class="p">:</span> +</span><span id="PythonExecutor-154"><a href="#PythonExecutor-154"><span class="linenos">154</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="PythonExecutor-155"><a href="#PythonExecutor-155"><span class="linenos">155</span></a> <span class="n">types</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">ast</span><span class="o">.</span><span class="n">literal_eval</span><span class="p">(</span><span class="n">v</span><span class="p">)))</span> +</span><span id="PythonExecutor-156"><a href="#PythonExecutor-156"><span class="linenos">156</span></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SyntaxError</span><span class="p">):</span> +</span><span id="PythonExecutor-157"><a href="#PythonExecutor-157"><span class="linenos">157</span></a> <span class="n">types</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span> +</span><span id="PythonExecutor-158"><a href="#PythonExecutor-158"><span class="linenos">158</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_row</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">t</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">t</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">types</span><span class="p">,</span> <span class="n">row</span><span class="p">)))</span> +</span><span id="PythonExecutor-159"><a href="#PythonExecutor-159"><span class="linenos">159</span></a> <span class="k">yield</span> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">reader</span> +</span><span id="PythonExecutor-160"><a href="#PythonExecutor-160"><span class="linenos">160</span></a> +</span><span id="PythonExecutor-161"><a href="#PythonExecutor-161"><span class="linenos">161</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor-162"><a href="#PythonExecutor-162"><span class="linenos">162</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="PythonExecutor-163"><a href="#PythonExecutor-163"><span class="linenos">163</span></a> +</span><span id="PythonExecutor-164"><a href="#PythonExecutor-164"><span class="linenos">164</span></a> <span class="n">source_table</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">source</span><span class="p">]</span> +</span><span id="PythonExecutor-165"><a href="#PythonExecutor-165"><span class="linenos">165</span></a> <span class="n">source_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">source</span><span class="p">:</span> <span class="n">source_table</span><span class="p">})</span> +</span><span id="PythonExecutor-166"><a href="#PythonExecutor-166"><span class="linenos">166</span></a> <span class="n">column_ranges</span> <span class="o">=</span> <span class="p">{</span><span class="n">source</span><span class="p">:</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">source_table</span><span class="o">.</span><span class="n">columns</span><span class="p">))}</span> +</span><span id="PythonExecutor-167"><a href="#PythonExecutor-167"><span class="linenos">167</span></a> +</span><span id="PythonExecutor-168"><a href="#PythonExecutor-168"><span class="linenos">168</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">step</span><span class="o">.</span><span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="PythonExecutor-169"><a href="#PythonExecutor-169"><span class="linenos">169</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="PythonExecutor-170"><a href="#PythonExecutor-170"><span class="linenos">170</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">stop</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">column_ranges</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="PythonExecutor-171"><a href="#PythonExecutor-171"><span class="linenos">171</span></a> <span class="n">column_ranges</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="o">+</span> <span class="n">start</span><span class="p">)</span> +</span><span id="PythonExecutor-172"><a href="#PythonExecutor-172"><span class="linenos">172</span></a> <span class="n">join_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="PythonExecutor-173"><a href="#PythonExecutor-173"><span class="linenos">173</span></a> +</span><span id="PythonExecutor-174"><a href="#PythonExecutor-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"source_key"</span><span class="p">):</span> +</span><span id="PythonExecutor-175"><a href="#PythonExecutor-175"><span class="linenos">175</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">hash_join</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">)</span> +</span><span id="PythonExecutor-176"><a href="#PythonExecutor-176"><span class="linenos">176</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-177"><a href="#PythonExecutor-177"><span class="linenos">177</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nested_loop_join</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">)</span> +</span><span id="PythonExecutor-178"><a href="#PythonExecutor-178"><span class="linenos">178</span></a> +</span><span id="PythonExecutor-179"><a href="#PythonExecutor-179"><span class="linenos">179</span></a> <span class="n">source_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor-180"><a href="#PythonExecutor-180"><span class="linenos">180</span></a> <span class="p">{</span> +</span><span id="PythonExecutor-181"><a href="#PythonExecutor-181"><span class="linenos">181</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">Table</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">column_range</span><span class="p">)</span> +</span><span id="PythonExecutor-182"><a href="#PythonExecutor-182"><span class="linenos">182</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">column_range</span> <span class="ow">in</span> <span class="n">column_ranges</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="PythonExecutor-183"><a href="#PythonExecutor-183"><span class="linenos">183</span></a> <span class="p">}</span> +</span><span id="PythonExecutor-184"><a href="#PythonExecutor-184"><span class="linenos">184</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-185"><a href="#PythonExecutor-185"><span class="linenos">185</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"condition"</span><span class="p">])</span> +</span><span id="PythonExecutor-186"><a href="#PythonExecutor-186"><span class="linenos">186</span></a> <span class="k">if</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="PythonExecutor-187"><a href="#PythonExecutor-187"><span class="linenos">187</span></a> <span class="n">source_context</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor-188"><a href="#PythonExecutor-188"><span class="linenos">188</span></a> +</span><span id="PythonExecutor-189"><a href="#PythonExecutor-189"><span class="linenos">189</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor-190"><a href="#PythonExecutor-190"><span class="linenos">190</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor-191"><a href="#PythonExecutor-191"><span class="linenos">191</span></a> +</span><span id="PythonExecutor-192"><a href="#PythonExecutor-192"><span class="linenos">192</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor-193"><a href="#PythonExecutor-193"><span class="linenos">193</span></a> <span class="k">return</span> <span class="n">source_context</span> +</span><span id="PythonExecutor-194"><a href="#PythonExecutor-194"><span class="linenos">194</span></a> +</span><span id="PythonExecutor-195"><a href="#PythonExecutor-195"><span class="linenos">195</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span> <span class="k">if</span> <span class="n">projections</span> <span class="k">else</span> <span class="n">source_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-196"><a href="#PythonExecutor-196"><span class="linenos">196</span></a> +</span><span id="PythonExecutor-197"><a href="#PythonExecutor-197"><span class="linenos">197</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="PythonExecutor-198"><a href="#PythonExecutor-198"><span class="linenos">198</span></a> <span class="k">if</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">ctx</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="PythonExecutor-199"><a href="#PythonExecutor-199"><span class="linenos">199</span></a> <span class="k">continue</span> +</span><span id="PythonExecutor-200"><a href="#PythonExecutor-200"><span class="linenos">200</span></a> +</span><span id="PythonExecutor-201"><a href="#PythonExecutor-201"><span class="linenos">201</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor-202"><a href="#PythonExecutor-202"><span class="linenos">202</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="PythonExecutor-203"><a href="#PythonExecutor-203"><span class="linenos">203</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-204"><a href="#PythonExecutor-204"><span class="linenos">204</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor-205"><a href="#PythonExecutor-205"><span class="linenos">205</span></a> +</span><span id="PythonExecutor-206"><a href="#PythonExecutor-206"><span class="linenos">206</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sink</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="PythonExecutor-207"><a href="#PythonExecutor-207"><span class="linenos">207</span></a> <span class="k">break</span> +</span><span id="PythonExecutor-208"><a href="#PythonExecutor-208"><span class="linenos">208</span></a> +</span><span id="PythonExecutor-209"><a href="#PythonExecutor-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor-210"><a href="#PythonExecutor-210"><span class="linenos">210</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span><span id="PythonExecutor-211"><a href="#PythonExecutor-211"><span class="linenos">211</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-212"><a href="#PythonExecutor-212"><span class="linenos">212</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor-213"><a href="#PythonExecutor-213"><span class="linenos">213</span></a> <span class="p">{</span> +</span><span id="PythonExecutor-214"><a href="#PythonExecutor-214"><span class="linenos">214</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">Table</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="PythonExecutor-215"><a href="#PythonExecutor-215"><span class="linenos">215</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">source_context</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="PythonExecutor-216"><a href="#PythonExecutor-216"><span class="linenos">216</span></a> <span class="p">}</span> +</span><span id="PythonExecutor-217"><a href="#PythonExecutor-217"><span class="linenos">217</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-218"><a href="#PythonExecutor-218"><span class="linenos">218</span></a> +</span><span id="PythonExecutor-219"><a href="#PythonExecutor-219"><span class="linenos">219</span></a> <span class="k">def</span> <span class="nf">nested_loop_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">):</span> +</span><span id="PythonExecutor-220"><a href="#PythonExecutor-220"><span class="linenos">220</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">source_context</span><span class="o">.</span><span class="n">columns</span> <span class="o">+</span> <span class="n">join_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-221"><a href="#PythonExecutor-221"><span class="linenos">221</span></a> +</span><span id="PythonExecutor-222"><a href="#PythonExecutor-222"><span class="linenos">222</span></a> <span class="k">for</span> <span class="n">reader_a</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="PythonExecutor-223"><a href="#PythonExecutor-223"><span class="linenos">223</span></a> <span class="k">for</span> <span class="n">reader_b</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">join_context</span><span class="p">:</span> +</span><span id="PythonExecutor-224"><a href="#PythonExecutor-224"><span class="linenos">224</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader_a</span><span class="o">.</span><span class="n">row</span> <span class="o">+</span> <span class="n">reader_b</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor-225"><a href="#PythonExecutor-225"><span class="linenos">225</span></a> +</span><span id="PythonExecutor-226"><a href="#PythonExecutor-226"><span class="linenos">226</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="PythonExecutor-227"><a href="#PythonExecutor-227"><span class="linenos">227</span></a> +</span><span id="PythonExecutor-228"><a href="#PythonExecutor-228"><span class="linenos">228</span></a> <span class="k">def</span> <span class="nf">hash_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">):</span> +</span><span id="PythonExecutor-229"><a href="#PythonExecutor-229"><span class="linenos">229</span></a> <span class="n">source_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"source_key"</span><span class="p">])</span> +</span><span id="PythonExecutor-230"><a href="#PythonExecutor-230"><span class="linenos">230</span></a> <span class="n">join_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"join_key"</span><span class="p">])</span> +</span><span id="PythonExecutor-231"><a href="#PythonExecutor-231"><span class="linenos">231</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"LEFT"</span> +</span><span id="PythonExecutor-232"><a href="#PythonExecutor-232"><span class="linenos">232</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"RIGHT"</span> +</span><span id="PythonExecutor-233"><a href="#PythonExecutor-233"><span class="linenos">233</span></a> +</span><span id="PythonExecutor-234"><a href="#PythonExecutor-234"><span class="linenos">234</span></a> <span class="n">results</span> <span class="o">=</span> <span class="n">collections</span><span class="o">.</span><span class="n">defaultdict</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="p">([],</span> <span class="p">[]))</span> +</span><span id="PythonExecutor-235"><a href="#PythonExecutor-235"><span class="linenos">235</span></a> +</span><span id="PythonExecutor-236"><a href="#PythonExecutor-236"><span class="linenos">236</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="PythonExecutor-237"><a href="#PythonExecutor-237"><span class="linenos">237</span></a> <span class="n">results</span><span class="p">[</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">source_key</span><span class="p">)][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor-238"><a href="#PythonExecutor-238"><span class="linenos">238</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">join_context</span><span class="p">:</span> +</span><span id="PythonExecutor-239"><a href="#PythonExecutor-239"><span class="linenos">239</span></a> <span class="n">results</span><span class="p">[</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">join_key</span><span class="p">)][</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor-240"><a href="#PythonExecutor-240"><span class="linenos">240</span></a> +</span><span id="PythonExecutor-241"><a href="#PythonExecutor-241"><span class="linenos">241</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">source_context</span><span class="o">.</span><span class="n">columns</span> <span class="o">+</span> <span class="n">join_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-242"><a href="#PythonExecutor-242"><span class="linenos">242</span></a> <span class="n">nulls</span> <span class="o">=</span> <span class="p">[(</span><span class="kc">None</span><span class="p">,)</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">join_context</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">left</span> <span class="k">else</span> <span class="n">source_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)]</span> +</span><span id="PythonExecutor-243"><a href="#PythonExecutor-243"><span class="linenos">243</span></a> +</span><span id="PythonExecutor-244"><a href="#PythonExecutor-244"><span class="linenos">244</span></a> <span class="k">for</span> <span class="n">a_group</span><span class="p">,</span> <span class="n">b_group</span> <span class="ow">in</span> <span class="n">results</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="PythonExecutor-245"><a href="#PythonExecutor-245"><span class="linenos">245</span></a> <span class="k">if</span> <span class="n">left</span><span class="p">:</span> +</span><span id="PythonExecutor-246"><a href="#PythonExecutor-246"><span class="linenos">246</span></a> <span class="n">b_group</span> <span class="o">=</span> <span class="n">b_group</span> <span class="ow">or</span> <span class="n">nulls</span> +</span><span id="PythonExecutor-247"><a href="#PythonExecutor-247"><span class="linenos">247</span></a> <span class="k">elif</span> <span class="n">right</span><span class="p">:</span> +</span><span id="PythonExecutor-248"><a href="#PythonExecutor-248"><span class="linenos">248</span></a> <span class="n">a_group</span> <span class="o">=</span> <span class="n">a_group</span> <span class="ow">or</span> <span class="n">nulls</span> +</span><span id="PythonExecutor-249"><a href="#PythonExecutor-249"><span class="linenos">249</span></a> +</span><span id="PythonExecutor-250"><a href="#PythonExecutor-250"><span class="linenos">250</span></a> <span class="k">for</span> <span class="n">a_row</span><span class="p">,</span> <span class="n">b_row</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">product</span><span class="p">(</span><span class="n">a_group</span><span class="p">,</span> <span class="n">b_group</span><span class="p">):</span> +</span><span id="PythonExecutor-251"><a href="#PythonExecutor-251"><span class="linenos">251</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">a_row</span> <span class="o">+</span> <span class="n">b_row</span><span class="p">)</span> +</span><span id="PythonExecutor-252"><a href="#PythonExecutor-252"><span class="linenos">252</span></a> +</span><span id="PythonExecutor-253"><a href="#PythonExecutor-253"><span class="linenos">253</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="PythonExecutor-254"><a href="#PythonExecutor-254"><span class="linenos">254</span></a> +</span><span id="PythonExecutor-255"><a href="#PythonExecutor-255"><span class="linenos">255</span></a> <span class="k">def</span> <span class="nf">aggregate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor-256"><a href="#PythonExecutor-256"><span class="linenos">256</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="PythonExecutor-257"><a href="#PythonExecutor-257"><span class="linenos">257</span></a> <span class="n">aggregations</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">aggregations</span><span class="p">)</span> +</span><span id="PythonExecutor-258"><a href="#PythonExecutor-258"><span class="linenos">258</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">operands</span><span class="p">)</span> +</span><span id="PythonExecutor-259"><a href="#PythonExecutor-259"><span class="linenos">259</span></a> +</span><span id="PythonExecutor-260"><a href="#PythonExecutor-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="n">operands</span><span class="p">:</span> +</span><span id="PythonExecutor-261"><a href="#PythonExecutor-261"><span class="linenos">261</span></a> <span class="n">operand_table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">operands</span><span class="p">)</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-262"><a href="#PythonExecutor-262"><span class="linenos">262</span></a> +</span><span id="PythonExecutor-263"><a href="#PythonExecutor-263"><span class="linenos">263</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="PythonExecutor-264"><a href="#PythonExecutor-264"><span class="linenos">264</span></a> <span class="n">operand_table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">operands</span><span class="p">))</span> +</span><span id="PythonExecutor-265"><a href="#PythonExecutor-265"><span class="linenos">265</span></a> +</span><span id="PythonExecutor-266"><a href="#PythonExecutor-266"><span class="linenos">266</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">operand_table</span><span class="o">.</span><span class="n">rows</span><span class="p">)):</span> +</span><span id="PythonExecutor-267"><a href="#PythonExecutor-267"><span class="linenos">267</span></a> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span> +</span><span id="PythonExecutor-268"><a href="#PythonExecutor-268"><span class="linenos">268</span></a> +</span><span id="PythonExecutor-269"><a href="#PythonExecutor-269"><span class="linenos">269</span></a> <span class="n">width</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-270"><a href="#PythonExecutor-270"><span class="linenos">270</span></a> <span class="n">context</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">*</span><span class="n">operand_table</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-271"><a href="#PythonExecutor-271"><span class="linenos">271</span></a> +</span><span id="PythonExecutor-272"><a href="#PythonExecutor-272"><span class="linenos">272</span></a> <span class="n">operand_table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="PythonExecutor-273"><a href="#PythonExecutor-273"><span class="linenos">273</span></a> <span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> +</span><span id="PythonExecutor-274"><a href="#PythonExecutor-274"><span class="linenos">274</span></a> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> +</span><span id="PythonExecutor-275"><a href="#PythonExecutor-275"><span class="linenos">275</span></a> <span class="nb">range</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">width</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">operand_table</span><span class="o">.</span><span class="n">columns</span><span class="p">)),</span> +</span><span id="PythonExecutor-276"><a href="#PythonExecutor-276"><span class="linenos">276</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-277"><a href="#PythonExecutor-277"><span class="linenos">277</span></a> +</span><span id="PythonExecutor-278"><a href="#PythonExecutor-278"><span class="linenos">278</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor-279"><a href="#PythonExecutor-279"><span class="linenos">279</span></a> <span class="p">{</span> +</span><span id="PythonExecutor-280"><a href="#PythonExecutor-280"><span class="linenos">280</span></a> <span class="kc">None</span><span class="p">:</span> <span class="n">operand_table</span><span class="p">,</span> +</span><span id="PythonExecutor-281"><a href="#PythonExecutor-281"><span class="linenos">281</span></a> <span class="o">**</span><span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">,</span> +</span><span id="PythonExecutor-282"><a href="#PythonExecutor-282"><span class="linenos">282</span></a> <span class="p">}</span> +</span><span id="PythonExecutor-283"><a href="#PythonExecutor-283"><span class="linenos">283</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-284"><a href="#PythonExecutor-284"><span class="linenos">284</span></a> +</span><span id="PythonExecutor-285"><a href="#PythonExecutor-285"><span class="linenos">285</span></a> <span class="n">context</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">group_by</span><span class="p">)</span> +</span><span id="PythonExecutor-286"><a href="#PythonExecutor-286"><span class="linenos">286</span></a> +</span><span id="PythonExecutor-287"><a href="#PythonExecutor-287"><span class="linenos">287</span></a> <span class="n">group</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="PythonExecutor-288"><a href="#PythonExecutor-288"><span class="linenos">288</span></a> <span class="n">start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="PythonExecutor-289"><a href="#PythonExecutor-289"><span class="linenos">289</span></a> <span class="n">end</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="PythonExecutor-290"><a href="#PythonExecutor-290"><span class="linenos">290</span></a> <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> +</span><span id="PythonExecutor-291"><a href="#PythonExecutor-291"><span class="linenos">291</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">group</span><span class="p">)</span> <span class="o">+</span> <span class="n">step</span><span class="o">.</span><span class="n">aggregations</span><span class="p">)</span> +</span><span id="PythonExecutor-292"><a href="#PythonExecutor-292"><span class="linenos">292</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor-293"><a href="#PythonExecutor-293"><span class="linenos">293</span></a> +</span><span id="PythonExecutor-294"><a href="#PythonExecutor-294"><span class="linenos">294</span></a> <span class="k">def</span> <span class="nf">add_row</span><span class="p">():</span> +</span><span id="PythonExecutor-295"><a href="#PythonExecutor-295"><span class="linenos">295</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span> <span class="ow">or</span> <span class="n">context</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="PythonExecutor-296"><a href="#PythonExecutor-296"><span class="linenos">296</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">group</span> <span class="o">+</span> <span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">aggregations</span><span class="p">))</span> +</span><span id="PythonExecutor-297"><a href="#PythonExecutor-297"><span class="linenos">297</span></a> +</span><span id="PythonExecutor-298"><a href="#PythonExecutor-298"><span class="linenos">298</span></a> <span class="k">if</span> <span class="n">length</span><span class="p">:</span> +</span><span id="PythonExecutor-299"><a href="#PythonExecutor-299"><span class="linenos">299</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">length</span><span class="p">):</span> +</span><span id="PythonExecutor-300"><a href="#PythonExecutor-300"><span class="linenos">300</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> +</span><span id="PythonExecutor-301"><a href="#PythonExecutor-301"><span class="linenos">301</span></a> <span class="n">key</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">group_by</span><span class="p">)</span> +</span><span id="PythonExecutor-302"><a href="#PythonExecutor-302"><span class="linenos">302</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">key</span> <span class="k">if</span> <span class="n">group</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">group</span> +</span><span id="PythonExecutor-303"><a href="#PythonExecutor-303"><span class="linenos">303</span></a> <span class="n">end</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="PythonExecutor-304"><a href="#PythonExecutor-304"><span class="linenos">304</span></a> <span class="k">if</span> <span class="n">key</span> <span class="o">!=</span> <span class="n">group</span><span class="p">:</span> +</span><span id="PythonExecutor-305"><a href="#PythonExecutor-305"><span class="linenos">305</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="PythonExecutor-306"><a href="#PythonExecutor-306"><span class="linenos">306</span></a> <span class="n">add_row</span><span class="p">()</span> +</span><span id="PythonExecutor-307"><a href="#PythonExecutor-307"><span class="linenos">307</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">key</span> +</span><span id="PythonExecutor-308"><a href="#PythonExecutor-308"><span class="linenos">308</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">2</span> +</span><span id="PythonExecutor-309"><a href="#PythonExecutor-309"><span class="linenos">309</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="PythonExecutor-310"><a href="#PythonExecutor-310"><span class="linenos">310</span></a> <span class="k">break</span> +</span><span id="PythonExecutor-311"><a href="#PythonExecutor-311"><span class="linenos">311</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="PythonExecutor-312"><a href="#PythonExecutor-312"><span class="linenos">312</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="PythonExecutor-313"><a href="#PythonExecutor-313"><span class="linenos">313</span></a> <span class="n">add_row</span><span class="p">()</span> +</span><span id="PythonExecutor-314"><a href="#PythonExecutor-314"><span class="linenos">314</span></a> <span class="k">elif</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span> <span class="o">></span> <span class="mi">0</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="PythonExecutor-315"><a href="#PythonExecutor-315"><span class="linenos">315</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="PythonExecutor-316"><a href="#PythonExecutor-316"><span class="linenos">316</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">aggregations</span><span class="p">))</span> +</span><span id="PythonExecutor-317"><a href="#PythonExecutor-317"><span class="linenos">317</span></a> +</span><span id="PythonExecutor-318"><a href="#PythonExecutor-318"><span class="linenos">318</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="p">,</span> <span class="o">**</span><span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">}})</span> +</span><span id="PythonExecutor-319"><a href="#PythonExecutor-319"><span class="linenos">319</span></a> +</span><span id="PythonExecutor-320"><a href="#PythonExecutor-320"><span class="linenos">320</span></a> <span class="k">if</span> <span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor-321"><a href="#PythonExecutor-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor-322"><a href="#PythonExecutor-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="n">context</span> +</span><span id="PythonExecutor-323"><a href="#PythonExecutor-323"><span class="linenos">323</span></a> +</span><span id="PythonExecutor-324"><a href="#PythonExecutor-324"><span class="linenos">324</span></a> <span class="k">def</span> <span class="nf">sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor-325"><a href="#PythonExecutor-325"><span class="linenos">325</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor-326"><a href="#PythonExecutor-326"><span class="linenos">326</span></a> <span class="n">projection_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">]</span> +</span><span id="PythonExecutor-327"><a href="#PythonExecutor-327"><span class="linenos">327</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="o">+</span> <span class="n">projection_columns</span> +</span><span id="PythonExecutor-328"><a href="#PythonExecutor-328"><span class="linenos">328</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="PythonExecutor-329"><a href="#PythonExecutor-329"><span class="linenos">329</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="PythonExecutor-330"><a href="#PythonExecutor-330"><span class="linenos">330</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">+</span> <span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="PythonExecutor-331"><a href="#PythonExecutor-331"><span class="linenos">331</span></a> +</span><span id="PythonExecutor-332"><a href="#PythonExecutor-332"><span class="linenos">332</span></a> <span class="n">sort_ctx</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor-333"><a href="#PythonExecutor-333"><span class="linenos">333</span></a> <span class="p">{</span> +</span><span id="PythonExecutor-334"><a href="#PythonExecutor-334"><span class="linenos">334</span></a> <span class="kc">None</span><span class="p">:</span> <span class="n">sink</span><span class="p">,</span> +</span><span id="PythonExecutor-335"><a href="#PythonExecutor-335"><span class="linenos">335</span></a> <span class="o">**</span><span class="p">{</span><span class="n">table</span><span class="p">:</span> <span class="n">sink</span> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">},</span> +</span><span id="PythonExecutor-336"><a href="#PythonExecutor-336"><span class="linenos">336</span></a> <span class="p">}</span> +</span><span id="PythonExecutor-337"><a href="#PythonExecutor-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-338"><a href="#PythonExecutor-338"><span class="linenos">338</span></a> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">key</span><span class="p">))</span> +</span><span id="PythonExecutor-339"><a href="#PythonExecutor-339"><span class="linenos">339</span></a> +</span><span id="PythonExecutor-340"><a href="#PythonExecutor-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">math</span><span class="o">.</span><span class="n">isinf</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">):</span> +</span><span id="PythonExecutor-341"><a href="#PythonExecutor-341"><span class="linenos">341</span></a> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="mi">0</span> <span class="p">:</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">]</span> +</span><span id="PythonExecutor-342"><a href="#PythonExecutor-342"><span class="linenos">342</span></a> +</span><span id="PythonExecutor-343"><a href="#PythonExecutor-343"><span class="linenos">343</span></a> <span class="n">output</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="PythonExecutor-344"><a href="#PythonExecutor-344"><span class="linenos">344</span></a> <span class="n">projection_columns</span><span class="p">,</span> +</span><span id="PythonExecutor-345"><a href="#PythonExecutor-345"><span class="linenos">345</span></a> <span class="n">rows</span><span class="o">=</span><span class="p">[</span><span class="n">r</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)]</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">],</span> +</span><span id="PythonExecutor-346"><a href="#PythonExecutor-346"><span class="linenos">346</span></a> <span class="p">)</span> +</span><span id="PythonExecutor-347"><a href="#PythonExecutor-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">output</span><span class="p">})</span> +</span><span id="PythonExecutor-348"><a href="#PythonExecutor-348"><span class="linenos">348</span></a> +</span><span id="PythonExecutor-349"><a href="#PythonExecutor-349"><span class="linenos">349</span></a> <span class="k">def</span> <span class="nf">set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor-350"><a href="#PythonExecutor-350"><span class="linenos">350</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">left</span><span class="p">]</span> +</span><span id="PythonExecutor-351"><a href="#PythonExecutor-351"><span class="linenos">351</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">right</span><span class="p">]</span> +</span><span id="PythonExecutor-352"><a href="#PythonExecutor-352"><span class="linenos">352</span></a> +</span><span id="PythonExecutor-353"><a href="#PythonExecutor-353"><span class="linenos">353</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor-354"><a href="#PythonExecutor-354"><span class="linenos">354</span></a> +</span><span id="PythonExecutor-355"><a href="#PythonExecutor-355"><span class="linenos">355</span></a> <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">):</span> +</span><span id="PythonExecutor-356"><a href="#PythonExecutor-356"><span class="linenos">356</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="PythonExecutor-357"><a href="#PythonExecutor-357"><span class="linenos">357</span></a> <span class="k">elif</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">):</span> +</span><span id="PythonExecutor-358"><a href="#PythonExecutor-358"><span class="linenos">358</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="PythonExecutor-359"><a href="#PythonExecutor-359"><span class="linenos">359</span></a> <span class="k">elif</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="ow">and</span> <span class="n">step</span><span class="o">.</span><span class="n">distinct</span><span class="p">:</span> +</span><span id="PythonExecutor-360"><a href="#PythonExecutor-360"><span class="linenos">360</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="PythonExecutor-361"><a href="#PythonExecutor-361"><span class="linenos">361</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor-362"><a href="#PythonExecutor-362"><span class="linenos">362</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">left</span><span class="o">.</span><span class="n">rows</span> <span class="o">+</span> <span class="n">right</span><span class="o">.</span><span class="n">rows</span> +</span><span id="PythonExecutor-363"><a href="#PythonExecutor-363"><span class="linenos">363</span></a> +</span><span id="PythonExecutor-364"><a href="#PythonExecutor-364"><span class="linenos">364</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span></pre></div> + + + + + <div id="PythonExecutor.__init__" class="classattr"> + <input id="PythonExecutor.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">PythonExecutor</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">env</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">tables</span><span class="o">=</span><span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="PythonExecutor.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.__init__-17"><a href="#PythonExecutor.__init__-17"><span class="linenos">17</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">tables</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="PythonExecutor.__init__-18"><a href="#PythonExecutor.__init__-18"><span class="linenos">18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span> <span class="o">=</span> <span class="n">Python</span><span class="p">()</span><span class="o">.</span><span class="n">generator</span><span class="p">(</span><span class="n">identify</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="PythonExecutor.__init__-19"><a href="#PythonExecutor.__init__-19"><span class="linenos">19</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">env</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">ENV</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">env</span> <span class="ow">or</span> <span class="p">{})}</span> +</span><span id="PythonExecutor.__init__-20"><a href="#PythonExecutor.__init__-20"><span class="linenos">20</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span> <span class="o">=</span> <span class="n">tables</span> <span class="ow">or</span> <span class="p">{}</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.execute" class="classattr"> + <input id="PythonExecutor.execute-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">execute</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">plan</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.execute-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.execute"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.execute-22"><a href="#PythonExecutor.execute-22"><span class="linenos">22</span></a> <span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">plan</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-23"><a href="#PythonExecutor.execute-23"><span class="linenos">23</span></a> <span class="n">running</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="PythonExecutor.execute-24"><a href="#PythonExecutor.execute-24"><span class="linenos">24</span></a> <span class="n">finished</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="PythonExecutor.execute-25"><a href="#PythonExecutor.execute-25"><span class="linenos">25</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">plan</span><span class="o">.</span><span class="n">leaves</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-26"><a href="#PythonExecutor.execute-26"><span class="linenos">26</span></a> <span class="n">contexts</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="PythonExecutor.execute-27"><a href="#PythonExecutor.execute-27"><span class="linenos">27</span></a> +</span><span id="PythonExecutor.execute-28"><a href="#PythonExecutor.execute-28"><span class="linenos">28</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="PythonExecutor.execute-29"><a href="#PythonExecutor.execute-29"><span class="linenos">29</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="PythonExecutor.execute-30"><a href="#PythonExecutor.execute-30"><span class="linenos">30</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="PythonExecutor.execute-31"><a href="#PythonExecutor.execute-31"><span class="linenos">31</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor.execute-32"><a href="#PythonExecutor.execute-32"><span class="linenos">32</span></a> <span class="p">{</span> +</span><span id="PythonExecutor.execute-33"><a href="#PythonExecutor.execute-33"><span class="linenos">33</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">table</span> +</span><span id="PythonExecutor.execute-34"><a href="#PythonExecutor.execute-34"><span class="linenos">34</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span> +</span><span id="PythonExecutor.execute-35"><a href="#PythonExecutor.execute-35"><span class="linenos">35</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">contexts</span><span class="p">[</span><span class="n">dep</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="PythonExecutor.execute-36"><a href="#PythonExecutor.execute-36"><span class="linenos">36</span></a> <span class="p">}</span> +</span><span id="PythonExecutor.execute-37"><a href="#PythonExecutor.execute-37"><span class="linenos">37</span></a> <span class="p">)</span> +</span><span id="PythonExecutor.execute-38"><a href="#PythonExecutor.execute-38"><span class="linenos">38</span></a> <span class="n">running</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-39"><a href="#PythonExecutor.execute-39"><span class="linenos">39</span></a> +</span><span id="PythonExecutor.execute-40"><a href="#PythonExecutor.execute-40"><span class="linenos">40</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Scan</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-41"><a href="#PythonExecutor.execute-41"><span class="linenos">41</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-42"><a href="#PythonExecutor.execute-42"><span class="linenos">42</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Aggregate</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-43"><a href="#PythonExecutor.execute-43"><span class="linenos">43</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">aggregate</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-44"><a href="#PythonExecutor.execute-44"><span class="linenos">44</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-45"><a href="#PythonExecutor.execute-45"><span class="linenos">45</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-46"><a href="#PythonExecutor.execute-46"><span class="linenos">46</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">Sort</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-47"><a href="#PythonExecutor.execute-47"><span class="linenos">47</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-48"><a href="#PythonExecutor.execute-48"><span class="linenos">48</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">planner</span><span class="o">.</span><span class="n">SetOperation</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-49"><a href="#PythonExecutor.execute-49"><span class="linenos">49</span></a> <span class="n">contexts</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-50"><a href="#PythonExecutor.execute-50"><span class="linenos">50</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.execute-51"><a href="#PythonExecutor.execute-51"><span class="linenos">51</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="PythonExecutor.execute-52"><a href="#PythonExecutor.execute-52"><span class="linenos">52</span></a> +</span><span id="PythonExecutor.execute-53"><a href="#PythonExecutor.execute-53"><span class="linenos">53</span></a> <span class="n">running</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-54"><a href="#PythonExecutor.execute-54"><span class="linenos">54</span></a> <span class="n">finished</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-55"><a href="#PythonExecutor.execute-55"><span class="linenos">55</span></a> +</span><span id="PythonExecutor.execute-56"><a href="#PythonExecutor.execute-56"><span class="linenos">56</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependents</span><span class="p">:</span> +</span><span id="PythonExecutor.execute-57"><a href="#PythonExecutor.execute-57"><span class="linenos">57</span></a> <span class="k">if</span> <span class="n">dep</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">running</span> <span class="ow">and</span> <span class="nb">all</span><span class="p">(</span><span class="n">d</span> <span class="ow">in</span> <span class="n">contexts</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dep</span><span class="o">.</span><span class="n">dependencies</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-58"><a href="#PythonExecutor.execute-58"><span class="linenos">58</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-59"><a href="#PythonExecutor.execute-59"><span class="linenos">59</span></a> +</span><span id="PythonExecutor.execute-60"><a href="#PythonExecutor.execute-60"><span class="linenos">60</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="PythonExecutor.execute-61"><a href="#PythonExecutor.execute-61"><span class="linenos">61</span></a> <span class="k">if</span> <span class="nb">all</span><span class="p">(</span><span class="n">d</span> <span class="ow">in</span> <span class="n">finished</span> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dep</span><span class="o">.</span><span class="n">dependents</span><span class="p">):</span> +</span><span id="PythonExecutor.execute-62"><a href="#PythonExecutor.execute-62"><span class="linenos">62</span></a> <span class="n">contexts</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="PythonExecutor.execute-63"><a href="#PythonExecutor.execute-63"><span class="linenos">63</span></a> <span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> +</span><span id="PythonExecutor.execute-64"><a href="#PythonExecutor.execute-64"><span class="linenos">64</span></a> <span class="k">raise</span> <span class="n">ExecuteError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Step '</span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">' failed: </span><span class="si">{</span><span class="n">e</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="kn">from</span> <span class="nn">e</span> +</span><span id="PythonExecutor.execute-65"><a href="#PythonExecutor.execute-65"><span class="linenos">65</span></a> +</span><span id="PythonExecutor.execute-66"><a href="#PythonExecutor.execute-66"><span class="linenos">66</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">plan</span><span class="o">.</span><span class="n">root</span> +</span><span id="PythonExecutor.execute-67"><a href="#PythonExecutor.execute-67"><span class="linenos">67</span></a> <span class="k">return</span> <span class="n">contexts</span><span class="p">[</span><span class="n">root</span><span class="p">]</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">root</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.generate" class="classattr"> + <input id="PythonExecutor.generate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.generate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.generate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.generate-69"><a href="#PythonExecutor.generate-69"><span class="linenos">69</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="PythonExecutor.generate-70"><a href="#PythonExecutor.generate-70"><span class="linenos">70</span></a><span class="w"> </span><span class="sd">"""Convert a SQL expression into literal Python code and compile it into bytecode."""</span> +</span><span id="PythonExecutor.generate-71"><a href="#PythonExecutor.generate-71"><span class="linenos">71</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="PythonExecutor.generate-72"><a href="#PythonExecutor.generate-72"><span class="linenos">72</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="PythonExecutor.generate-73"><a href="#PythonExecutor.generate-73"><span class="linenos">73</span></a> +</span><span id="PythonExecutor.generate-74"><a href="#PythonExecutor.generate-74"><span class="linenos">74</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generator</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="PythonExecutor.generate-75"><a href="#PythonExecutor.generate-75"><span class="linenos">75</span></a> <span class="k">return</span> <span class="nb">compile</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">sql</span><span class="p">,</span> <span class="s2">"eval"</span><span class="p">,</span> <span class="n">optimize</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Convert a SQL expression into literal Python code and compile it into bytecode.</p> +</div> + + + </div> + <div id="PythonExecutor.generate_tuple" class="classattr"> + <input id="PythonExecutor.generate_tuple-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generate_tuple</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expressions</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.generate_tuple-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.generate_tuple"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.generate_tuple-77"><a href="#PythonExecutor.generate_tuple-77"><span class="linenos">77</span></a> <span class="k">def</span> <span class="nf">generate_tuple</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="PythonExecutor.generate_tuple-78"><a href="#PythonExecutor.generate_tuple-78"><span class="linenos">78</span></a><span class="w"> </span><span class="sd">"""Convert an array of SQL expressions into tuple of Python byte code."""</span> +</span><span id="PythonExecutor.generate_tuple-79"><a href="#PythonExecutor.generate_tuple-79"><span class="linenos">79</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="PythonExecutor.generate_tuple-80"><a href="#PythonExecutor.generate_tuple-80"><span class="linenos">80</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="PythonExecutor.generate_tuple-81"><a href="#PythonExecutor.generate_tuple-81"><span class="linenos">81</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Convert an array of SQL expressions into tuple of Python byte code.</p> +</div> + + + </div> + <div id="PythonExecutor.context" class="classattr"> + <input id="PythonExecutor.context-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">context</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">tables</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.context-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.context"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.context-83"><a href="#PythonExecutor.context-83"><span class="linenos">83</span></a> <span class="k">def</span> <span class="nf">context</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tables</span><span class="p">):</span> +</span><span id="PythonExecutor.context-84"><a href="#PythonExecutor.context-84"><span class="linenos">84</span></a> <span class="k">return</span> <span class="n">Context</span><span class="p">(</span><span class="n">tables</span><span class="p">,</span> <span class="n">env</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.table" class="classattr"> + <input id="PythonExecutor.table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expressions</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.table-86"><a href="#PythonExecutor.table-86"><span class="linenos">86</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="PythonExecutor.table-87"><a href="#PythonExecutor.table-87"><span class="linenos">87</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="PythonExecutor.table-88"><a href="#PythonExecutor.table-88"><span class="linenos">88</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="k">else</span> <span class="n">expression</span> +</span><span id="PythonExecutor.table-89"><a href="#PythonExecutor.table-89"><span class="linenos">89</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span> +</span><span id="PythonExecutor.table-90"><a href="#PythonExecutor.table-90"><span class="linenos">90</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.scan" class="classattr"> + <input id="PythonExecutor.scan-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">scan</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span>, </span><span class="param"><span class="n">context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.scan-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.scan"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.scan-92"><a href="#PythonExecutor.scan-92"><span class="linenos"> 92</span></a> <span class="k">def</span> <span class="nf">scan</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor.scan-93"><a href="#PythonExecutor.scan-93"><span class="linenos"> 93</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span> +</span><span id="PythonExecutor.scan-94"><a href="#PythonExecutor.scan-94"><span class="linenos"> 94</span></a> +</span><span id="PythonExecutor.scan-95"><a href="#PythonExecutor.scan-95"><span class="linenos"> 95</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="PythonExecutor.scan-96"><a href="#PythonExecutor.scan-96"><span class="linenos"> 96</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span> +</span><span id="PythonExecutor.scan-97"><a href="#PythonExecutor.scan-97"><span class="linenos"> 97</span></a> +</span><span id="PythonExecutor.scan-98"><a href="#PythonExecutor.scan-98"><span class="linenos"> 98</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-99"><a href="#PythonExecutor.scan-99"><span class="linenos"> 99</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-100"><a href="#PythonExecutor.scan-100"><span class="linenos">100</span></a> +</span><span id="PythonExecutor.scan-101"><a href="#PythonExecutor.scan-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-102"><a href="#PythonExecutor.scan-102"><span class="linenos">102</span></a> <span class="n">context</span><span class="p">,</span> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">static</span><span class="p">()</span> +</span><span id="PythonExecutor.scan-103"><a href="#PythonExecutor.scan-103"><span class="linenos">103</span></a> <span class="k">elif</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-104"><a href="#PythonExecutor.scan-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">projections</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-105"><a href="#PythonExecutor.scan-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">source</span><span class="p">]})</span> +</span><span id="PythonExecutor.scan-106"><a href="#PythonExecutor.scan-106"><span class="linenos">106</span></a> <span class="n">table_iter</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">table_iter</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-107"><a href="#PythonExecutor.scan-107"><span class="linenos">107</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="PythonExecutor.scan-108"><a href="#PythonExecutor.scan-108"><span class="linenos">108</span></a> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan_csv</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-109"><a href="#PythonExecutor.scan-109"><span class="linenos">109</span></a> <span class="n">context</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">table_iter</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-110"><a href="#PythonExecutor.scan-110"><span class="linenos">110</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-111"><a href="#PythonExecutor.scan-111"><span class="linenos">111</span></a> <span class="n">context</span><span class="p">,</span> <span class="n">table_iter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan_table</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-112"><a href="#PythonExecutor.scan-112"><span class="linenos">112</span></a> +</span><span id="PythonExecutor.scan-113"><a href="#PythonExecutor.scan-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-114"><a href="#PythonExecutor.scan-114"><span class="linenos">114</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-115"><a href="#PythonExecutor.scan-115"><span class="linenos">115</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-116"><a href="#PythonExecutor.scan-116"><span class="linenos">116</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-117"><a href="#PythonExecutor.scan-117"><span class="linenos">117</span></a> +</span><span id="PythonExecutor.scan-118"><a href="#PythonExecutor.scan-118"><span class="linenos">118</span></a> <span class="k">for</span> <span class="n">reader</span> <span class="ow">in</span> <span class="n">table_iter</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-119"><a href="#PythonExecutor.scan-119"><span class="linenos">119</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sink</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-120"><a href="#PythonExecutor.scan-120"><span class="linenos">120</span></a> <span class="k">break</span> +</span><span id="PythonExecutor.scan-121"><a href="#PythonExecutor.scan-121"><span class="linenos">121</span></a> +</span><span id="PythonExecutor.scan-122"><a href="#PythonExecutor.scan-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">context</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="PythonExecutor.scan-123"><a href="#PythonExecutor.scan-123"><span class="linenos">123</span></a> <span class="k">continue</span> +</span><span id="PythonExecutor.scan-124"><a href="#PythonExecutor.scan-124"><span class="linenos">124</span></a> +</span><span id="PythonExecutor.scan-125"><a href="#PythonExecutor.scan-125"><span class="linenos">125</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-126"><a href="#PythonExecutor.scan-126"><span class="linenos">126</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="PythonExecutor.scan-127"><a href="#PythonExecutor.scan-127"><span class="linenos">127</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.scan-128"><a href="#PythonExecutor.scan-128"><span class="linenos">128</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor.scan-129"><a href="#PythonExecutor.scan-129"><span class="linenos">129</span></a> +</span><span id="PythonExecutor.scan-130"><a href="#PythonExecutor.scan-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.static" class="classattr"> + <input id="PythonExecutor.static-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">static</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.static-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.static"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.static-132"><a href="#PythonExecutor.static-132"><span class="linenos">132</span></a> <span class="k">def</span> <span class="nf">static</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="PythonExecutor.static-133"><a href="#PythonExecutor.static-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({}),</span> <span class="p">[</span><span class="n">RowReader</span><span class="p">(())]</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.scan_table" class="classattr"> + <input id="PythonExecutor.scan_table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">scan_table</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.scan_table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.scan_table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.scan_table-135"><a href="#PythonExecutor.scan_table-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">scan_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">):</span> +</span><span id="PythonExecutor.scan_table-136"><a href="#PythonExecutor.scan_table-136"><span class="linenos">136</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="p">)</span> +</span><span id="PythonExecutor.scan_table-137"><a href="#PythonExecutor.scan_table-137"><span class="linenos">137</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="PythonExecutor.scan_table-138"><a href="#PythonExecutor.scan_table-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">context</span><span class="p">,</span> <span class="nb">iter</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.scan_csv" class="classattr"> + <input id="PythonExecutor.scan_csv-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">scan_csv</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.scan_csv-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.scan_csv"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.scan_csv-140"><a href="#PythonExecutor.scan_csv-140"><span class="linenos">140</span></a> <span class="k">def</span> <span class="nf">scan_csv</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">):</span> +</span><span id="PythonExecutor.scan_csv-141"><a href="#PythonExecutor.scan_csv-141"><span class="linenos">141</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">alias</span> +</span><span id="PythonExecutor.scan_csv-142"><a href="#PythonExecutor.scan_csv-142"><span class="linenos">142</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">this</span> +</span><span id="PythonExecutor.scan_csv-143"><a href="#PythonExecutor.scan_csv-143"><span class="linenos">143</span></a> +</span><span id="PythonExecutor.scan_csv-144"><a href="#PythonExecutor.scan_csv-144"><span class="linenos">144</span></a> <span class="k">with</span> <span class="n">csv_reader</span><span class="p">(</span><span class="n">source</span><span class="p">)</span> <span class="k">as</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="PythonExecutor.scan_csv-145"><a href="#PythonExecutor.scan_csv-145"><span class="linenos">145</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="PythonExecutor.scan_csv-146"><a href="#PythonExecutor.scan_csv-146"><span class="linenos">146</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.scan_csv-147"><a href="#PythonExecutor.scan_csv-147"><span class="linenos">147</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">alias</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="PythonExecutor.scan_csv-148"><a href="#PythonExecutor.scan_csv-148"><span class="linenos">148</span></a> <span class="k">yield</span> <span class="n">context</span> +</span><span id="PythonExecutor.scan_csv-149"><a href="#PythonExecutor.scan_csv-149"><span class="linenos">149</span></a> <span class="n">types</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="PythonExecutor.scan_csv-150"><a href="#PythonExecutor.scan_csv-150"><span class="linenos">150</span></a> +</span><span id="PythonExecutor.scan_csv-151"><a href="#PythonExecutor.scan_csv-151"><span class="linenos">151</span></a> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="PythonExecutor.scan_csv-152"><a href="#PythonExecutor.scan_csv-152"><span class="linenos">152</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">types</span><span class="p">:</span> +</span><span id="PythonExecutor.scan_csv-153"><a href="#PythonExecutor.scan_csv-153"><span class="linenos">153</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">row</span><span class="p">:</span> +</span><span id="PythonExecutor.scan_csv-154"><a href="#PythonExecutor.scan_csv-154"><span class="linenos">154</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="PythonExecutor.scan_csv-155"><a href="#PythonExecutor.scan_csv-155"><span class="linenos">155</span></a> <span class="n">types</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">ast</span><span class="o">.</span><span class="n">literal_eval</span><span class="p">(</span><span class="n">v</span><span class="p">)))</span> +</span><span id="PythonExecutor.scan_csv-156"><a href="#PythonExecutor.scan_csv-156"><span class="linenos">156</span></a> <span class="k">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">SyntaxError</span><span class="p">):</span> +</span><span id="PythonExecutor.scan_csv-157"><a href="#PythonExecutor.scan_csv-157"><span class="linenos">157</span></a> <span class="n">types</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span> +</span><span id="PythonExecutor.scan_csv-158"><a href="#PythonExecutor.scan_csv-158"><span class="linenos">158</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_row</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">t</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">t</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">types</span><span class="p">,</span> <span class="n">row</span><span class="p">)))</span> +</span><span id="PythonExecutor.scan_csv-159"><a href="#PythonExecutor.scan_csv-159"><span class="linenos">159</span></a> <span class="k">yield</span> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">reader</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.join" class="classattr"> + <input id="PythonExecutor.join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">join</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span>, </span><span class="param"><span class="n">context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.join-161"><a href="#PythonExecutor.join-161"><span class="linenos">161</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor.join-162"><a href="#PythonExecutor.join-162"><span class="linenos">162</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="PythonExecutor.join-163"><a href="#PythonExecutor.join-163"><span class="linenos">163</span></a> +</span><span id="PythonExecutor.join-164"><a href="#PythonExecutor.join-164"><span class="linenos">164</span></a> <span class="n">source_table</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">source</span><span class="p">]</span> +</span><span id="PythonExecutor.join-165"><a href="#PythonExecutor.join-165"><span class="linenos">165</span></a> <span class="n">source_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">source</span><span class="p">:</span> <span class="n">source_table</span><span class="p">})</span> +</span><span id="PythonExecutor.join-166"><a href="#PythonExecutor.join-166"><span class="linenos">166</span></a> <span class="n">column_ranges</span> <span class="o">=</span> <span class="p">{</span><span class="n">source</span><span class="p">:</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">source_table</span><span class="o">.</span><span class="n">columns</span><span class="p">))}</span> +</span><span id="PythonExecutor.join-167"><a href="#PythonExecutor.join-167"><span class="linenos">167</span></a> +</span><span id="PythonExecutor.join-168"><a href="#PythonExecutor.join-168"><span class="linenos">168</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">step</span><span class="o">.</span><span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="PythonExecutor.join-169"><a href="#PythonExecutor.join-169"><span class="linenos">169</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="PythonExecutor.join-170"><a href="#PythonExecutor.join-170"><span class="linenos">170</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">stop</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">column_ranges</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="PythonExecutor.join-171"><a href="#PythonExecutor.join-171"><span class="linenos">171</span></a> <span class="n">column_ranges</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="o">+</span> <span class="n">start</span><span class="p">)</span> +</span><span id="PythonExecutor.join-172"><a href="#PythonExecutor.join-172"><span class="linenos">172</span></a> <span class="n">join_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="p">})</span> +</span><span id="PythonExecutor.join-173"><a href="#PythonExecutor.join-173"><span class="linenos">173</span></a> +</span><span id="PythonExecutor.join-174"><a href="#PythonExecutor.join-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"source_key"</span><span class="p">):</span> +</span><span id="PythonExecutor.join-175"><a href="#PythonExecutor.join-175"><span class="linenos">175</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">hash_join</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">)</span> +</span><span id="PythonExecutor.join-176"><a href="#PythonExecutor.join-176"><span class="linenos">176</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.join-177"><a href="#PythonExecutor.join-177"><span class="linenos">177</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">nested_loop_join</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">)</span> +</span><span id="PythonExecutor.join-178"><a href="#PythonExecutor.join-178"><span class="linenos">178</span></a> +</span><span id="PythonExecutor.join-179"><a href="#PythonExecutor.join-179"><span class="linenos">179</span></a> <span class="n">source_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor.join-180"><a href="#PythonExecutor.join-180"><span class="linenos">180</span></a> <span class="p">{</span> +</span><span id="PythonExecutor.join-181"><a href="#PythonExecutor.join-181"><span class="linenos">181</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">Table</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">column_range</span><span class="p">)</span> +</span><span id="PythonExecutor.join-182"><a href="#PythonExecutor.join-182"><span class="linenos">182</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">column_range</span> <span class="ow">in</span> <span class="n">column_ranges</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="PythonExecutor.join-183"><a href="#PythonExecutor.join-183"><span class="linenos">183</span></a> <span class="p">}</span> +</span><span id="PythonExecutor.join-184"><a href="#PythonExecutor.join-184"><span class="linenos">184</span></a> <span class="p">)</span> +</span><span id="PythonExecutor.join-185"><a href="#PythonExecutor.join-185"><span class="linenos">185</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"condition"</span><span class="p">])</span> +</span><span id="PythonExecutor.join-186"><a href="#PythonExecutor.join-186"><span class="linenos">186</span></a> <span class="k">if</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="PythonExecutor.join-187"><a href="#PythonExecutor.join-187"><span class="linenos">187</span></a> <span class="n">source_context</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor.join-188"><a href="#PythonExecutor.join-188"><span class="linenos">188</span></a> +</span><span id="PythonExecutor.join-189"><a href="#PythonExecutor.join-189"><span class="linenos">189</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor.join-190"><a href="#PythonExecutor.join-190"><span class="linenos">190</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor.join-191"><a href="#PythonExecutor.join-191"><span class="linenos">191</span></a> +</span><span id="PythonExecutor.join-192"><a href="#PythonExecutor.join-192"><span class="linenos">192</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor.join-193"><a href="#PythonExecutor.join-193"><span class="linenos">193</span></a> <span class="k">return</span> <span class="n">source_context</span> +</span><span id="PythonExecutor.join-194"><a href="#PythonExecutor.join-194"><span class="linenos">194</span></a> +</span><span id="PythonExecutor.join-195"><a href="#PythonExecutor.join-195"><span class="linenos">195</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span> <span class="k">if</span> <span class="n">projections</span> <span class="k">else</span> <span class="n">source_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.join-196"><a href="#PythonExecutor.join-196"><span class="linenos">196</span></a> +</span><span id="PythonExecutor.join-197"><a href="#PythonExecutor.join-197"><span class="linenos">197</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="PythonExecutor.join-198"><a href="#PythonExecutor.join-198"><span class="linenos">198</span></a> <span class="k">if</span> <span class="n">condition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">ctx</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="PythonExecutor.join-199"><a href="#PythonExecutor.join-199"><span class="linenos">199</span></a> <span class="k">continue</span> +</span><span id="PythonExecutor.join-200"><a href="#PythonExecutor.join-200"><span class="linenos">200</span></a> +</span><span id="PythonExecutor.join-201"><a href="#PythonExecutor.join-201"><span class="linenos">201</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor.join-202"><a href="#PythonExecutor.join-202"><span class="linenos">202</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="PythonExecutor.join-203"><a href="#PythonExecutor.join-203"><span class="linenos">203</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.join-204"><a href="#PythonExecutor.join-204"><span class="linenos">204</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor.join-205"><a href="#PythonExecutor.join-205"><span class="linenos">205</span></a> +</span><span id="PythonExecutor.join-206"><a href="#PythonExecutor.join-206"><span class="linenos">206</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sink</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="PythonExecutor.join-207"><a href="#PythonExecutor.join-207"><span class="linenos">207</span></a> <span class="k">break</span> +</span><span id="PythonExecutor.join-208"><a href="#PythonExecutor.join-208"><span class="linenos">208</span></a> +</span><span id="PythonExecutor.join-209"><a href="#PythonExecutor.join-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor.join-210"><a href="#PythonExecutor.join-210"><span class="linenos">210</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span><span id="PythonExecutor.join-211"><a href="#PythonExecutor.join-211"><span class="linenos">211</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.join-212"><a href="#PythonExecutor.join-212"><span class="linenos">212</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor.join-213"><a href="#PythonExecutor.join-213"><span class="linenos">213</span></a> <span class="p">{</span> +</span><span id="PythonExecutor.join-214"><a href="#PythonExecutor.join-214"><span class="linenos">214</span></a> <span class="n">name</span><span class="p">:</span> <span class="n">Table</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">table</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="PythonExecutor.join-215"><a href="#PythonExecutor.join-215"><span class="linenos">215</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">source_context</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="PythonExecutor.join-216"><a href="#PythonExecutor.join-216"><span class="linenos">216</span></a> <span class="p">}</span> +</span><span id="PythonExecutor.join-217"><a href="#PythonExecutor.join-217"><span class="linenos">217</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.nested_loop_join" class="classattr"> + <input id="PythonExecutor.nested_loop_join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">nested_loop_join</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">_join</span>, </span><span class="param"><span class="n">source_context</span>, </span><span class="param"><span class="n">join_context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.nested_loop_join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.nested_loop_join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.nested_loop_join-219"><a href="#PythonExecutor.nested_loop_join-219"><span class="linenos">219</span></a> <span class="k">def</span> <span class="nf">nested_loop_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">):</span> +</span><span id="PythonExecutor.nested_loop_join-220"><a href="#PythonExecutor.nested_loop_join-220"><span class="linenos">220</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">source_context</span><span class="o">.</span><span class="n">columns</span> <span class="o">+</span> <span class="n">join_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.nested_loop_join-221"><a href="#PythonExecutor.nested_loop_join-221"><span class="linenos">221</span></a> +</span><span id="PythonExecutor.nested_loop_join-222"><a href="#PythonExecutor.nested_loop_join-222"><span class="linenos">222</span></a> <span class="k">for</span> <span class="n">reader_a</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="PythonExecutor.nested_loop_join-223"><a href="#PythonExecutor.nested_loop_join-223"><span class="linenos">223</span></a> <span class="k">for</span> <span class="n">reader_b</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">join_context</span><span class="p">:</span> +</span><span id="PythonExecutor.nested_loop_join-224"><a href="#PythonExecutor.nested_loop_join-224"><span class="linenos">224</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader_a</span><span class="o">.</span><span class="n">row</span> <span class="o">+</span> <span class="n">reader_b</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor.nested_loop_join-225"><a href="#PythonExecutor.nested_loop_join-225"><span class="linenos">225</span></a> +</span><span id="PythonExecutor.nested_loop_join-226"><a href="#PythonExecutor.nested_loop_join-226"><span class="linenos">226</span></a> <span class="k">return</span> <span class="n">table</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.hash_join" class="classattr"> + <input id="PythonExecutor.hash_join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">hash_join</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">join</span>, </span><span class="param"><span class="n">source_context</span>, </span><span class="param"><span class="n">join_context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.hash_join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.hash_join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.hash_join-228"><a href="#PythonExecutor.hash_join-228"><span class="linenos">228</span></a> <span class="k">def</span> <span class="nf">hash_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">source_context</span><span class="p">,</span> <span class="n">join_context</span><span class="p">):</span> +</span><span id="PythonExecutor.hash_join-229"><a href="#PythonExecutor.hash_join-229"><span class="linenos">229</span></a> <span class="n">source_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"source_key"</span><span class="p">])</span> +</span><span id="PythonExecutor.hash_join-230"><a href="#PythonExecutor.hash_join-230"><span class="linenos">230</span></a> <span class="n">join_key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">join</span><span class="p">[</span><span class="s2">"join_key"</span><span class="p">])</span> +</span><span id="PythonExecutor.hash_join-231"><a href="#PythonExecutor.hash_join-231"><span class="linenos">231</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"LEFT"</span> +</span><span id="PythonExecutor.hash_join-232"><a href="#PythonExecutor.hash_join-232"><span class="linenos">232</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span> <span class="o">==</span> <span class="s2">"RIGHT"</span> +</span><span id="PythonExecutor.hash_join-233"><a href="#PythonExecutor.hash_join-233"><span class="linenos">233</span></a> +</span><span id="PythonExecutor.hash_join-234"><a href="#PythonExecutor.hash_join-234"><span class="linenos">234</span></a> <span class="n">results</span> <span class="o">=</span> <span class="n">collections</span><span class="o">.</span><span class="n">defaultdict</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="p">([],</span> <span class="p">[]))</span> +</span><span id="PythonExecutor.hash_join-235"><a href="#PythonExecutor.hash_join-235"><span class="linenos">235</span></a> +</span><span id="PythonExecutor.hash_join-236"><a href="#PythonExecutor.hash_join-236"><span class="linenos">236</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">source_context</span><span class="p">:</span> +</span><span id="PythonExecutor.hash_join-237"><a href="#PythonExecutor.hash_join-237"><span class="linenos">237</span></a> <span class="n">results</span><span class="p">[</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">source_key</span><span class="p">)][</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor.hash_join-238"><a href="#PythonExecutor.hash_join-238"><span class="linenos">238</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">join_context</span><span class="p">:</span> +</span><span id="PythonExecutor.hash_join-239"><a href="#PythonExecutor.hash_join-239"><span class="linenos">239</span></a> <span class="n">results</span><span class="p">[</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">join_key</span><span class="p">)][</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span><span class="p">)</span> +</span><span id="PythonExecutor.hash_join-240"><a href="#PythonExecutor.hash_join-240"><span class="linenos">240</span></a> +</span><span id="PythonExecutor.hash_join-241"><a href="#PythonExecutor.hash_join-241"><span class="linenos">241</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">source_context</span><span class="o">.</span><span class="n">columns</span> <span class="o">+</span> <span class="n">join_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.hash_join-242"><a href="#PythonExecutor.hash_join-242"><span class="linenos">242</span></a> <span class="n">nulls</span> <span class="o">=</span> <span class="p">[(</span><span class="kc">None</span><span class="p">,)</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">join_context</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">left</span> <span class="k">else</span> <span class="n">source_context</span><span class="o">.</span><span class="n">columns</span><span class="p">)]</span> +</span><span id="PythonExecutor.hash_join-243"><a href="#PythonExecutor.hash_join-243"><span class="linenos">243</span></a> +</span><span id="PythonExecutor.hash_join-244"><a href="#PythonExecutor.hash_join-244"><span class="linenos">244</span></a> <span class="k">for</span> <span class="n">a_group</span><span class="p">,</span> <span class="n">b_group</span> <span class="ow">in</span> <span class="n">results</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="PythonExecutor.hash_join-245"><a href="#PythonExecutor.hash_join-245"><span class="linenos">245</span></a> <span class="k">if</span> <span class="n">left</span><span class="p">:</span> +</span><span id="PythonExecutor.hash_join-246"><a href="#PythonExecutor.hash_join-246"><span class="linenos">246</span></a> <span class="n">b_group</span> <span class="o">=</span> <span class="n">b_group</span> <span class="ow">or</span> <span class="n">nulls</span> +</span><span id="PythonExecutor.hash_join-247"><a href="#PythonExecutor.hash_join-247"><span class="linenos">247</span></a> <span class="k">elif</span> <span class="n">right</span><span class="p">:</span> +</span><span id="PythonExecutor.hash_join-248"><a href="#PythonExecutor.hash_join-248"><span class="linenos">248</span></a> <span class="n">a_group</span> <span class="o">=</span> <span class="n">a_group</span> <span class="ow">or</span> <span class="n">nulls</span> +</span><span id="PythonExecutor.hash_join-249"><a href="#PythonExecutor.hash_join-249"><span class="linenos">249</span></a> +</span><span id="PythonExecutor.hash_join-250"><a href="#PythonExecutor.hash_join-250"><span class="linenos">250</span></a> <span class="k">for</span> <span class="n">a_row</span><span class="p">,</span> <span class="n">b_row</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">product</span><span class="p">(</span><span class="n">a_group</span><span class="p">,</span> <span class="n">b_group</span><span class="p">):</span> +</span><span id="PythonExecutor.hash_join-251"><a href="#PythonExecutor.hash_join-251"><span class="linenos">251</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">a_row</span> <span class="o">+</span> <span class="n">b_row</span><span class="p">)</span> +</span><span id="PythonExecutor.hash_join-252"><a href="#PythonExecutor.hash_join-252"><span class="linenos">252</span></a> +</span><span id="PythonExecutor.hash_join-253"><a href="#PythonExecutor.hash_join-253"><span class="linenos">253</span></a> <span class="k">return</span> <span class="n">table</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.aggregate" class="classattr"> + <input id="PythonExecutor.aggregate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">aggregate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span>, </span><span class="param"><span class="n">context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.aggregate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.aggregate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.aggregate-255"><a href="#PythonExecutor.aggregate-255"><span class="linenos">255</span></a> <span class="k">def</span> <span class="nf">aggregate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor.aggregate-256"><a href="#PythonExecutor.aggregate-256"><span class="linenos">256</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="PythonExecutor.aggregate-257"><a href="#PythonExecutor.aggregate-257"><span class="linenos">257</span></a> <span class="n">aggregations</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">aggregations</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-258"><a href="#PythonExecutor.aggregate-258"><span class="linenos">258</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">operands</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-259"><a href="#PythonExecutor.aggregate-259"><span class="linenos">259</span></a> +</span><span id="PythonExecutor.aggregate-260"><a href="#PythonExecutor.aggregate-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="n">operands</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-261"><a href="#PythonExecutor.aggregate-261"><span class="linenos">261</span></a> <span class="n">operand_table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">operands</span><span class="p">)</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-262"><a href="#PythonExecutor.aggregate-262"><span class="linenos">262</span></a> +</span><span id="PythonExecutor.aggregate-263"><a href="#PythonExecutor.aggregate-263"><span class="linenos">263</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-264"><a href="#PythonExecutor.aggregate-264"><span class="linenos">264</span></a> <span class="n">operand_table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">operands</span><span class="p">))</span> +</span><span id="PythonExecutor.aggregate-265"><a href="#PythonExecutor.aggregate-265"><span class="linenos">265</span></a> +</span><span id="PythonExecutor.aggregate-266"><a href="#PythonExecutor.aggregate-266"><span class="linenos">266</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> <span class="n">operand_table</span><span class="o">.</span><span class="n">rows</span><span class="p">)):</span> +</span><span id="PythonExecutor.aggregate-267"><a href="#PythonExecutor.aggregate-267"><span class="linenos">267</span></a> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span> +</span><span id="PythonExecutor.aggregate-268"><a href="#PythonExecutor.aggregate-268"><span class="linenos">268</span></a> +</span><span id="PythonExecutor.aggregate-269"><a href="#PythonExecutor.aggregate-269"><span class="linenos">269</span></a> <span class="n">width</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-270"><a href="#PythonExecutor.aggregate-270"><span class="linenos">270</span></a> <span class="n">context</span><span class="o">.</span><span class="n">add_columns</span><span class="p">(</span><span class="o">*</span><span class="n">operand_table</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-271"><a href="#PythonExecutor.aggregate-271"><span class="linenos">271</span></a> +</span><span id="PythonExecutor.aggregate-272"><a href="#PythonExecutor.aggregate-272"><span class="linenos">272</span></a> <span class="n">operand_table</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="PythonExecutor.aggregate-273"><a href="#PythonExecutor.aggregate-273"><span class="linenos">273</span></a> <span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> +</span><span id="PythonExecutor.aggregate-274"><a href="#PythonExecutor.aggregate-274"><span class="linenos">274</span></a> <span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">,</span> +</span><span id="PythonExecutor.aggregate-275"><a href="#PythonExecutor.aggregate-275"><span class="linenos">275</span></a> <span class="nb">range</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">width</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">operand_table</span><span class="o">.</span><span class="n">columns</span><span class="p">)),</span> +</span><span id="PythonExecutor.aggregate-276"><a href="#PythonExecutor.aggregate-276"><span class="linenos">276</span></a> <span class="p">)</span> +</span><span id="PythonExecutor.aggregate-277"><a href="#PythonExecutor.aggregate-277"><span class="linenos">277</span></a> +</span><span id="PythonExecutor.aggregate-278"><a href="#PythonExecutor.aggregate-278"><span class="linenos">278</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor.aggregate-279"><a href="#PythonExecutor.aggregate-279"><span class="linenos">279</span></a> <span class="p">{</span> +</span><span id="PythonExecutor.aggregate-280"><a href="#PythonExecutor.aggregate-280"><span class="linenos">280</span></a> <span class="kc">None</span><span class="p">:</span> <span class="n">operand_table</span><span class="p">,</span> +</span><span id="PythonExecutor.aggregate-281"><a href="#PythonExecutor.aggregate-281"><span class="linenos">281</span></a> <span class="o">**</span><span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">,</span> +</span><span id="PythonExecutor.aggregate-282"><a href="#PythonExecutor.aggregate-282"><span class="linenos">282</span></a> <span class="p">}</span> +</span><span id="PythonExecutor.aggregate-283"><a href="#PythonExecutor.aggregate-283"><span class="linenos">283</span></a> <span class="p">)</span> +</span><span id="PythonExecutor.aggregate-284"><a href="#PythonExecutor.aggregate-284"><span class="linenos">284</span></a> +</span><span id="PythonExecutor.aggregate-285"><a href="#PythonExecutor.aggregate-285"><span class="linenos">285</span></a> <span class="n">context</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">group_by</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-286"><a href="#PythonExecutor.aggregate-286"><span class="linenos">286</span></a> +</span><span id="PythonExecutor.aggregate-287"><a href="#PythonExecutor.aggregate-287"><span class="linenos">287</span></a> <span class="n">group</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="PythonExecutor.aggregate-288"><a href="#PythonExecutor.aggregate-288"><span class="linenos">288</span></a> <span class="n">start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="PythonExecutor.aggregate-289"><a href="#PythonExecutor.aggregate-289"><span class="linenos">289</span></a> <span class="n">end</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="PythonExecutor.aggregate-290"><a href="#PythonExecutor.aggregate-290"><span class="linenos">290</span></a> <span class="n">length</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-291"><a href="#PythonExecutor.aggregate-291"><span class="linenos">291</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">group</span><span class="p">)</span> <span class="o">+</span> <span class="n">step</span><span class="o">.</span><span class="n">aggregations</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-292"><a href="#PythonExecutor.aggregate-292"><span class="linenos">292</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">condition</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-293"><a href="#PythonExecutor.aggregate-293"><span class="linenos">293</span></a> +</span><span id="PythonExecutor.aggregate-294"><a href="#PythonExecutor.aggregate-294"><span class="linenos">294</span></a> <span class="k">def</span> <span class="nf">add_row</span><span class="p">():</span> +</span><span id="PythonExecutor.aggregate-295"><a href="#PythonExecutor.aggregate-295"><span class="linenos">295</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span> <span class="ow">or</span> <span class="n">context</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="PythonExecutor.aggregate-296"><a href="#PythonExecutor.aggregate-296"><span class="linenos">296</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">group</span> <span class="o">+</span> <span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">aggregations</span><span class="p">))</span> +</span><span id="PythonExecutor.aggregate-297"><a href="#PythonExecutor.aggregate-297"><span class="linenos">297</span></a> +</span><span id="PythonExecutor.aggregate-298"><a href="#PythonExecutor.aggregate-298"><span class="linenos">298</span></a> <span class="k">if</span> <span class="n">length</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-299"><a href="#PythonExecutor.aggregate-299"><span class="linenos">299</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">length</span><span class="p">):</span> +</span><span id="PythonExecutor.aggregate-300"><a href="#PythonExecutor.aggregate-300"><span class="linenos">300</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-301"><a href="#PythonExecutor.aggregate-301"><span class="linenos">301</span></a> <span class="n">key</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">group_by</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-302"><a href="#PythonExecutor.aggregate-302"><span class="linenos">302</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">key</span> <span class="k">if</span> <span class="n">group</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">group</span> +</span><span id="PythonExecutor.aggregate-303"><a href="#PythonExecutor.aggregate-303"><span class="linenos">303</span></a> <span class="n">end</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="PythonExecutor.aggregate-304"><a href="#PythonExecutor.aggregate-304"><span class="linenos">304</span></a> <span class="k">if</span> <span class="n">key</span> <span class="o">!=</span> <span class="n">group</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-305"><a href="#PythonExecutor.aggregate-305"><span class="linenos">305</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">2</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-306"><a href="#PythonExecutor.aggregate-306"><span class="linenos">306</span></a> <span class="n">add_row</span><span class="p">()</span> +</span><span id="PythonExecutor.aggregate-307"><a href="#PythonExecutor.aggregate-307"><span class="linenos">307</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">key</span> +</span><span id="PythonExecutor.aggregate-308"><a href="#PythonExecutor.aggregate-308"><span class="linenos">308</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">2</span> +</span><span id="PythonExecutor.aggregate-309"><a href="#PythonExecutor.aggregate-309"><span class="linenos">309</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> <span class="o">>=</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-310"><a href="#PythonExecutor.aggregate-310"><span class="linenos">310</span></a> <span class="k">break</span> +</span><span id="PythonExecutor.aggregate-311"><a href="#PythonExecutor.aggregate-311"><span class="linenos">311</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-312"><a href="#PythonExecutor.aggregate-312"><span class="linenos">312</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-313"><a href="#PythonExecutor.aggregate-313"><span class="linenos">313</span></a> <span class="n">add_row</span><span class="p">()</span> +</span><span id="PythonExecutor.aggregate-314"><a href="#PythonExecutor.aggregate-314"><span class="linenos">314</span></a> <span class="k">elif</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span> <span class="o">></span> <span class="mi">0</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-315"><a href="#PythonExecutor.aggregate-315"><span class="linenos">315</span></a> <span class="n">context</span><span class="o">.</span><span class="n">set_range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-316"><a href="#PythonExecutor.aggregate-316"><span class="linenos">316</span></a> <span class="n">table</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">aggregations</span><span class="p">))</span> +</span><span id="PythonExecutor.aggregate-317"><a href="#PythonExecutor.aggregate-317"><span class="linenos">317</span></a> +</span><span id="PythonExecutor.aggregate-318"><a href="#PythonExecutor.aggregate-318"><span class="linenos">318</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span><span class="p">,</span> <span class="o">**</span><span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">table</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">}})</span> +</span><span id="PythonExecutor.aggregate-319"><a href="#PythonExecutor.aggregate-319"><span class="linenos">319</span></a> +</span><span id="PythonExecutor.aggregate-320"><a href="#PythonExecutor.aggregate-320"><span class="linenos">320</span></a> <span class="k">if</span> <span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> +</span><span id="PythonExecutor.aggregate-321"><a href="#PythonExecutor.aggregate-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scan</span><span class="p">(</span><span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span> +</span><span id="PythonExecutor.aggregate-322"><a href="#PythonExecutor.aggregate-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="n">context</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.sort" class="classattr"> + <input id="PythonExecutor.sort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sort</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span>, </span><span class="param"><span class="n">context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.sort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.sort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.sort-324"><a href="#PythonExecutor.sort-324"><span class="linenos">324</span></a> <span class="k">def</span> <span class="nf">sort</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor.sort-325"><a href="#PythonExecutor.sort-325"><span class="linenos">325</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">)</span> +</span><span id="PythonExecutor.sort-326"><a href="#PythonExecutor.sort-326"><span class="linenos">326</span></a> <span class="n">projection_columns</span> <span class="o">=</span> <span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">step</span><span class="o">.</span><span class="n">projections</span><span class="p">]</span> +</span><span id="PythonExecutor.sort-327"><a href="#PythonExecutor.sort-327"><span class="linenos">327</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="o">+</span> <span class="n">projection_columns</span> +</span><span id="PythonExecutor.sort-328"><a href="#PythonExecutor.sort-328"><span class="linenos">328</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)</span> +</span><span id="PythonExecutor.sort-329"><a href="#PythonExecutor.sort-329"><span class="linenos">329</span></a> <span class="k">for</span> <span class="n">reader</span><span class="p">,</span> <span class="n">ctx</span> <span class="ow">in</span> <span class="n">context</span><span class="p">:</span> +</span><span id="PythonExecutor.sort-330"><a href="#PythonExecutor.sort-330"><span class="linenos">330</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">+</span> <span class="n">ctx</span><span class="o">.</span><span class="n">eval_tuple</span><span class="p">(</span><span class="n">projections</span><span class="p">))</span> +</span><span id="PythonExecutor.sort-331"><a href="#PythonExecutor.sort-331"><span class="linenos">331</span></a> +</span><span id="PythonExecutor.sort-332"><a href="#PythonExecutor.sort-332"><span class="linenos">332</span></a> <span class="n">sort_ctx</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">(</span> +</span><span id="PythonExecutor.sort-333"><a href="#PythonExecutor.sort-333"><span class="linenos">333</span></a> <span class="p">{</span> +</span><span id="PythonExecutor.sort-334"><a href="#PythonExecutor.sort-334"><span class="linenos">334</span></a> <span class="kc">None</span><span class="p">:</span> <span class="n">sink</span><span class="p">,</span> +</span><span id="PythonExecutor.sort-335"><a href="#PythonExecutor.sort-335"><span class="linenos">335</span></a> <span class="o">**</span><span class="p">{</span><span class="n">table</span><span class="p">:</span> <span class="n">sink</span> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">},</span> +</span><span id="PythonExecutor.sort-336"><a href="#PythonExecutor.sort-336"><span class="linenos">336</span></a> <span class="p">}</span> +</span><span id="PythonExecutor.sort-337"><a href="#PythonExecutor.sort-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="PythonExecutor.sort-338"><a href="#PythonExecutor.sort-338"><span class="linenos">338</span></a> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">generate_tuple</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">key</span><span class="p">))</span> +</span><span id="PythonExecutor.sort-339"><a href="#PythonExecutor.sort-339"><span class="linenos">339</span></a> +</span><span id="PythonExecutor.sort-340"><a href="#PythonExecutor.sort-340"><span class="linenos">340</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">math</span><span class="o">.</span><span class="n">isinf</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">):</span> +</span><span id="PythonExecutor.sort-341"><a href="#PythonExecutor.sort-341"><span class="linenos">341</span></a> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="mi">0</span> <span class="p">:</span> <span class="n">step</span><span class="o">.</span><span class="n">limit</span><span class="p">]</span> +</span><span id="PythonExecutor.sort-342"><a href="#PythonExecutor.sort-342"><span class="linenos">342</span></a> +</span><span id="PythonExecutor.sort-343"><a href="#PythonExecutor.sort-343"><span class="linenos">343</span></a> <span class="n">output</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="PythonExecutor.sort-344"><a href="#PythonExecutor.sort-344"><span class="linenos">344</span></a> <span class="n">projection_columns</span><span class="p">,</span> +</span><span id="PythonExecutor.sort-345"><a href="#PythonExecutor.sort-345"><span class="linenos">345</span></a> <span class="n">rows</span><span class="o">=</span><span class="p">[</span><span class="n">r</span><span class="p">[</span><span class="nb">len</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)]</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">sort_ctx</span><span class="o">.</span><span class="n">table</span><span class="o">.</span><span class="n">rows</span><span class="p">],</span> +</span><span id="PythonExecutor.sort-346"><a href="#PythonExecutor.sort-346"><span class="linenos">346</span></a> <span class="p">)</span> +</span><span id="PythonExecutor.sort-347"><a href="#PythonExecutor.sort-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">output</span><span class="p">})</span> +</span></pre></div> + + + + + </div> + <div id="PythonExecutor.set_operation" class="classattr"> + <input id="PythonExecutor.set_operation-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_operation</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">step</span>, </span><span class="param"><span class="n">context</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="PythonExecutor.set_operation-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PythonExecutor.set_operation"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PythonExecutor.set_operation-349"><a href="#PythonExecutor.set_operation-349"><span class="linenos">349</span></a> <span class="k">def</span> <span class="nf">set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">step</span><span class="p">,</span> <span class="n">context</span><span class="p">):</span> +</span><span id="PythonExecutor.set_operation-350"><a href="#PythonExecutor.set_operation-350"><span class="linenos">350</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">left</span><span class="p">]</span> +</span><span id="PythonExecutor.set_operation-351"><a href="#PythonExecutor.set_operation-351"><span class="linenos">351</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">right</span><span class="p">]</span> +</span><span id="PythonExecutor.set_operation-352"><a href="#PythonExecutor.set_operation-352"><span class="linenos">352</span></a> +</span><span id="PythonExecutor.set_operation-353"><a href="#PythonExecutor.set_operation-353"><span class="linenos">353</span></a> <span class="n">sink</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="PythonExecutor.set_operation-354"><a href="#PythonExecutor.set_operation-354"><span class="linenos">354</span></a> +</span><span id="PythonExecutor.set_operation-355"><a href="#PythonExecutor.set_operation-355"><span class="linenos">355</span></a> <span class="k">if</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">):</span> +</span><span id="PythonExecutor.set_operation-356"><a href="#PythonExecutor.set_operation-356"><span class="linenos">356</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="PythonExecutor.set_operation-357"><a href="#PythonExecutor.set_operation-357"><span class="linenos">357</span></a> <span class="k">elif</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">):</span> +</span><span id="PythonExecutor.set_operation-358"><a href="#PythonExecutor.set_operation-358"><span class="linenos">358</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="PythonExecutor.set_operation-359"><a href="#PythonExecutor.set_operation-359"><span class="linenos">359</span></a> <span class="k">elif</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">step</span><span class="o">.</span><span class="n">op</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="ow">and</span> <span class="n">step</span><span class="o">.</span><span class="n">distinct</span><span class="p">:</span> +</span><span id="PythonExecutor.set_operation-360"><a href="#PythonExecutor.set_operation-360"><span class="linenos">360</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">left</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">right</span><span class="o">.</span><span class="n">rows</span><span class="p">)))</span> +</span><span id="PythonExecutor.set_operation-361"><a href="#PythonExecutor.set_operation-361"><span class="linenos">361</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="PythonExecutor.set_operation-362"><a href="#PythonExecutor.set_operation-362"><span class="linenos">362</span></a> <span class="n">sink</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">left</span><span class="o">.</span><span class="n">rows</span> <span class="o">+</span> <span class="n">right</span><span class="o">.</span><span class="n">rows</span> +</span><span id="PythonExecutor.set_operation-363"><a href="#PythonExecutor.set_operation-363"><span class="linenos">363</span></a> +</span><span id="PythonExecutor.set_operation-364"><a href="#PythonExecutor.set_operation-364"><span class="linenos">364</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">context</span><span class="p">({</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">sink</span><span class="p">})</span> +</span></pre></div> + + + + + </div> + </section> + <section id="Python"> + <input id="Python-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Python</span><wbr>(<span class="base"><a href="../dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span>): + + <label class="view-source-button" for="Python-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Python"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Python-410"><a href="#Python-410"><span class="linenos">410</span></a><span class="k">class</span> <span class="nc">Python</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> +</span><span id="Python-411"><a href="#Python-411"><span class="linenos">411</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Python-412"><a href="#Python-412"><span class="linenos">412</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span><span id="Python-413"><a href="#Python-413"><span class="linenos">413</span></a> +</span><span id="Python-414"><a href="#Python-414"><span class="linenos">414</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Python-415"><a href="#Python-415"><span class="linenos">415</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Python-416"><a href="#Python-416"><span class="linenos">416</span></a> <span class="o">**</span><span class="p">{</span><span class="n">klass</span><span class="p">:</span> <span class="n">_rename</span> <span class="k">for</span> <span class="n">klass</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)},</span> +</span><span id="Python-417"><a href="#Python-417"><span class="linenos">417</span></a> <span class="o">**</span><span class="p">{</span><span class="n">klass</span><span class="p">:</span> <span class="n">_rename</span> <span class="k">for</span> <span class="n">klass</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">ALL_FUNCTIONS</span><span class="p">},</span> +</span><span id="Python-418"><a href="#Python-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">:</span> <span class="n">_case_sql</span><span class="p">,</span> +</span><span id="Python-419"><a href="#Python-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="Python-420"><a href="#Python-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="Python-421"><a href="#Python-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"and"</span><span class="p">),</span> +</span><span id="Python-422"><a href="#Python-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">:</span> <span class="n">_rename</span><span class="p">,</span> +</span><span id="Python-423"><a href="#Python-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="s2">"True"</span> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">"False"</span><span class="p">,</span> +</span><span id="Python-424"><a href="#Python-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">, exp.DataType.Type.</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'to'</span><span class="p">]</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python-425"><a href="#Python-425"><span class="linenos">425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"scope[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'table'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="kc">None</span><span class="si">}</span><span class="s2">][</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Python-426"><a href="#Python-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"set(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python-427"><a href="#Python-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EXTRACT('</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s2">', </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python-428"><a href="#Python-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> in (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python-429"><a href="#Python-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"is"</span><span class="p">),</span> +</span><span id="Python-430"><a href="#Python-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">:</span> <span class="n">_lambda_sql</span><span class="p">,</span> +</span><span id="Python-431"><a href="#Python-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"not </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Python-432"><a href="#Python-432"><span class="linenos">432</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"None"</span><span class="p">,</span> +</span><span id="Python-433"><a href="#Python-433"><span class="linenos">433</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"or"</span><span class="p">),</span> +</span><span id="Python-434"><a href="#Python-434"><span class="linenos">434</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">:</span> <span class="n">_ordered_py</span><span class="p">,</span> +</span><span id="Python-435"><a href="#Python-435"><span class="linenos">435</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span> +</span><span id="Python-436"><a href="#Python-436"><span class="linenos">436</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div id="Python.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Python</span><span class="signature pdoc-code condensed">()</span> + + + </div> + <a class="headerlink" href="#Python.__init__"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></dt> + <dd id="Python.get_or_raise" class="function"><a href="../dialects/dialect.html#Dialect.get_or_raise">get_or_raise</a></dd> + <dd id="Python.format_time" class="function"><a href="../dialects/dialect.html#Dialect.format_time">format_time</a></dd> + <dd id="Python.parse" class="function"><a href="../dialects/dialect.html#Dialect.parse">parse</a></dd> + <dd id="Python.parse_into" class="function"><a href="../dialects/dialect.html#Dialect.parse_into">parse_into</a></dd> + <dd id="Python.generate" class="function"><a href="../dialects/dialect.html#Dialect.generate">generate</a></dd> + <dd id="Python.transpile" class="function"><a href="../dialects/dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Python.parser" class="function"><a href="../dialects/dialect.html#Dialect.parser">parser</a></dd> + <dd id="Python.generator" class="function"><a href="../dialects/dialect.html#Dialect.generator">generator</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Python.Tokenizer"> + <input id="Python.Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Python.Tokenizer</span><wbr>(<span class="base"><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></span>): + + <label class="view-source-button" for="Python.Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Python.Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Python.Tokenizer-411"><a href="#Python.Tokenizer-411"><span class="linenos">411</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Python.Tokenizer-412"><a href="#Python.Tokenizer-412"><span class="linenos">412</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt> + <dd id="Python.Tokenizer.__init__" class="function"><a href="../tokens.html#Tokenizer.__init__">Tokenizer</a></dd> + <dd id="Python.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd> + <dd id="Python.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Python.Generator"> + <input id="Python.Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Python.Generator</span><wbr>(<span class="base"><a href="../generator.html#Generator">sqlglot.generator.Generator</a></span>): + + <label class="view-source-button" for="Python.Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Python.Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Python.Generator-414"><a href="#Python.Generator-414"><span class="linenos">414</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Python.Generator-415"><a href="#Python.Generator-415"><span class="linenos">415</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Python.Generator-416"><a href="#Python.Generator-416"><span class="linenos">416</span></a> <span class="o">**</span><span class="p">{</span><span class="n">klass</span><span class="p">:</span> <span class="n">_rename</span> <span class="k">for</span> <span class="n">klass</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)},</span> +</span><span id="Python.Generator-417"><a href="#Python.Generator-417"><span class="linenos">417</span></a> <span class="o">**</span><span class="p">{</span><span class="n">klass</span><span class="p">:</span> <span class="n">_rename</span> <span class="k">for</span> <span class="n">klass</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">ALL_FUNCTIONS</span><span class="p">},</span> +</span><span id="Python.Generator-418"><a href="#Python.Generator-418"><span class="linenos">418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">:</span> <span class="n">_case_sql</span><span class="p">,</span> +</span><span id="Python.Generator-419"><a href="#Python.Generator-419"><span class="linenos">419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="Python.Generator-420"><a href="#Python.Generator-420"><span class="linenos">420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">:</span> <span class="n">inline_array_sql</span><span class="p">,</span> +</span><span id="Python.Generator-421"><a href="#Python.Generator-421"><span class="linenos">421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"and"</span><span class="p">),</span> +</span><span id="Python.Generator-422"><a href="#Python.Generator-422"><span class="linenos">422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">:</span> <span class="n">_rename</span><span class="p">,</span> +</span><span id="Python.Generator-423"><a href="#Python.Generator-423"><span class="linenos">423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="s2">"True"</span> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">"False"</span><span class="p">,</span> +</span><span id="Python.Generator-424"><a href="#Python.Generator-424"><span class="linenos">424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">, exp.DataType.Type.</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'to'</span><span class="p">]</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python.Generator-425"><a href="#Python.Generator-425"><span class="linenos">425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"scope[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'table'</span><span class="p">)</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="kc">None</span><span class="si">}</span><span class="s2">][</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">]"</span><span class="p">,</span> +</span><span id="Python.Generator-426"><a href="#Python.Generator-426"><span class="linenos">426</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"set(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python.Generator-427"><a href="#Python.Generator-427"><span class="linenos">427</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"EXTRACT('</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span><span class="si">}</span><span class="s2">', </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python.Generator-428"><a href="#Python.Generator-428"><span class="linenos">428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> in (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Python.Generator-429"><a href="#Python.Generator-429"><span class="linenos">429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"is"</span><span class="p">),</span> +</span><span id="Python.Generator-430"><a href="#Python.Generator-430"><span class="linenos">430</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">:</span> <span class="n">_lambda_sql</span><span class="p">,</span> +</span><span id="Python.Generator-431"><a href="#Python.Generator-431"><span class="linenos">431</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"not </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Python.Generator-432"><a href="#Python.Generator-432"><span class="linenos">432</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"None"</span><span class="p">,</span> +</span><span id="Python.Generator-433"><a href="#Python.Generator-433"><span class="linenos">433</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="s2">"or"</span><span class="p">),</span> +</span><span id="Python.Generator-434"><a href="#Python.Generator-434"><span class="linenos">434</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">:</span> <span class="n">_ordered_py</span><span class="p">,</span> +</span><span id="Python.Generator-435"><a href="#Python.Generator-435"><span class="linenos">435</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">:</span> <span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="s2">"1"</span><span class="p">,</span> +</span><span id="Python.Generator-436"><a href="#Python.Generator-436"><span class="linenos">436</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../generator.html#Generator">sqlglot.generator.Generator</a></dt> + <dd id="Python.Generator.__init__" class="function"><a href="../generator.html#Generator.__init__">Generator</a></dd> + <dd id="Python.Generator.generate" class="function"><a href="../generator.html#Generator.generate">generate</a></dd> + <dd id="Python.Generator.unsupported" class="function"><a href="../generator.html#Generator.unsupported">unsupported</a></dd> + <dd id="Python.Generator.sep" class="function"><a href="../generator.html#Generator.sep">sep</a></dd> + <dd id="Python.Generator.seg" class="function"><a href="../generator.html#Generator.seg">seg</a></dd> + <dd id="Python.Generator.pad_comment" class="function"><a href="../generator.html#Generator.pad_comment">pad_comment</a></dd> + <dd id="Python.Generator.maybe_comment" class="function"><a href="../generator.html#Generator.maybe_comment">maybe_comment</a></dd> + <dd id="Python.Generator.wrap" class="function"><a href="../generator.html#Generator.wrap">wrap</a></dd> + <dd id="Python.Generator.no_identify" class="function"><a href="../generator.html#Generator.no_identify">no_identify</a></dd> + <dd id="Python.Generator.normalize_func" class="function"><a href="../generator.html#Generator.normalize_func">normalize_func</a></dd> + <dd id="Python.Generator.indent" class="function"><a href="../generator.html#Generator.indent">indent</a></dd> + <dd id="Python.Generator.sql" class="function"><a href="../generator.html#Generator.sql">sql</a></dd> + <dd id="Python.Generator.uncache_sql" class="function"><a href="../generator.html#Generator.uncache_sql">uncache_sql</a></dd> + <dd id="Python.Generator.cache_sql" class="function"><a href="../generator.html#Generator.cache_sql">cache_sql</a></dd> + <dd id="Python.Generator.characterset_sql" class="function"><a href="../generator.html#Generator.characterset_sql">characterset_sql</a></dd> + <dd id="Python.Generator.column_sql" class="function"><a href="../generator.html#Generator.column_sql">column_sql</a></dd> + <dd id="Python.Generator.columndef_sql" class="function"><a href="../generator.html#Generator.columndef_sql">columndef_sql</a></dd> + <dd id="Python.Generator.columnconstraint_sql" class="function"><a href="../generator.html#Generator.columnconstraint_sql">columnconstraint_sql</a></dd> + <dd id="Python.Generator.autoincrementcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a></dd> + <dd id="Python.Generator.checkcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a></dd> + <dd id="Python.Generator.commentcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a></dd> + <dd id="Python.Generator.collatecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a></dd> + <dd id="Python.Generator.encodecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a></dd> + <dd id="Python.Generator.defaultcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a></dd> + <dd id="Python.Generator.generatedasidentitycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a></dd> + <dd id="Python.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> + <dd id="Python.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> + <dd id="Python.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Python.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> + <dd id="Python.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> + <dd id="Python.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> + <dd id="Python.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> + <dd id="Python.Generator.cte_sql" class="function"><a href="../generator.html#Generator.cte_sql">cte_sql</a></dd> + <dd id="Python.Generator.tablealias_sql" class="function"><a href="../generator.html#Generator.tablealias_sql">tablealias_sql</a></dd> + <dd id="Python.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> + <dd id="Python.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> + <dd id="Python.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> + <dd id="Python.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> + <dd id="Python.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> + <dd id="Python.Generator.drop_sql" class="function"><a href="../generator.html#Generator.drop_sql">drop_sql</a></dd> + <dd id="Python.Generator.except_sql" class="function"><a href="../generator.html#Generator.except_sql">except_sql</a></dd> + <dd id="Python.Generator.except_op" class="function"><a href="../generator.html#Generator.except_op">except_op</a></dd> + <dd id="Python.Generator.fetch_sql" class="function"><a href="../generator.html#Generator.fetch_sql">fetch_sql</a></dd> + <dd id="Python.Generator.filter_sql" class="function"><a href="../generator.html#Generator.filter_sql">filter_sql</a></dd> + <dd id="Python.Generator.hint_sql" class="function"><a href="../generator.html#Generator.hint_sql">hint_sql</a></dd> + <dd id="Python.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> + <dd id="Python.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Python.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> + <dd id="Python.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> + <dd id="Python.Generator.properties_sql" class="function"><a href="../generator.html#Generator.properties_sql">properties_sql</a></dd> + <dd id="Python.Generator.root_properties" class="function"><a href="../generator.html#Generator.root_properties">root_properties</a></dd> + <dd id="Python.Generator.properties" class="function"><a href="../generator.html#Generator.properties">properties</a></dd> + <dd id="Python.Generator.with_properties" class="function"><a href="../generator.html#Generator.with_properties">with_properties</a></dd> + <dd id="Python.Generator.locate_properties" class="function"><a href="../generator.html#Generator.locate_properties">locate_properties</a></dd> + <dd id="Python.Generator.property_sql" class="function"><a href="../generator.html#Generator.property_sql">property_sql</a></dd> + <dd id="Python.Generator.likeproperty_sql" class="function"><a href="../generator.html#Generator.likeproperty_sql">likeproperty_sql</a></dd> + <dd id="Python.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> + <dd id="Python.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> + <dd id="Python.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> + <dd id="Python.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> + <dd id="Python.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> + <dd id="Python.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> + <dd id="Python.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> + <dd id="Python.Generator.blockcompressionproperty_sql" class="function"><a href="../generator.html#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a></dd> + <dd id="Python.Generator.isolatedloadingproperty_sql" class="function"><a href="../generator.html#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a></dd> + <dd id="Python.Generator.insert_sql" class="function"><a href="../generator.html#Generator.insert_sql">insert_sql</a></dd> + <dd id="Python.Generator.intersect_sql" class="function"><a href="../generator.html#Generator.intersect_sql">intersect_sql</a></dd> + <dd id="Python.Generator.intersect_op" class="function"><a href="../generator.html#Generator.intersect_op">intersect_op</a></dd> + <dd id="Python.Generator.introducer_sql" class="function"><a href="../generator.html#Generator.introducer_sql">introducer_sql</a></dd> + <dd id="Python.Generator.pseudotype_sql" class="function"><a href="../generator.html#Generator.pseudotype_sql">pseudotype_sql</a></dd> + <dd id="Python.Generator.rowformatdelimitedproperty_sql" class="function"><a href="../generator.html#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a></dd> + <dd id="Python.Generator.table_sql" class="function"><a href="../generator.html#Generator.table_sql">table_sql</a></dd> + <dd id="Python.Generator.tablesample_sql" class="function"><a href="../generator.html#Generator.tablesample_sql">tablesample_sql</a></dd> + <dd id="Python.Generator.pivot_sql" class="function"><a href="../generator.html#Generator.pivot_sql">pivot_sql</a></dd> + <dd id="Python.Generator.tuple_sql" class="function"><a href="../generator.html#Generator.tuple_sql">tuple_sql</a></dd> + <dd id="Python.Generator.update_sql" class="function"><a href="../generator.html#Generator.update_sql">update_sql</a></dd> + <dd id="Python.Generator.values_sql" class="function"><a href="../generator.html#Generator.values_sql">values_sql</a></dd> + <dd id="Python.Generator.var_sql" class="function"><a href="../generator.html#Generator.var_sql">var_sql</a></dd> + <dd id="Python.Generator.into_sql" class="function"><a href="../generator.html#Generator.into_sql">into_sql</a></dd> + <dd id="Python.Generator.from_sql" class="function"><a href="../generator.html#Generator.from_sql">from_sql</a></dd> + <dd id="Python.Generator.group_sql" class="function"><a href="../generator.html#Generator.group_sql">group_sql</a></dd> + <dd id="Python.Generator.having_sql" class="function"><a href="../generator.html#Generator.having_sql">having_sql</a></dd> + <dd id="Python.Generator.join_sql" class="function"><a href="../generator.html#Generator.join_sql">join_sql</a></dd> + <dd id="Python.Generator.lambda_sql" class="function"><a href="../generator.html#Generator.lambda_sql">lambda_sql</a></dd> + <dd id="Python.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> + <dd id="Python.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> + <dd id="Python.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Python.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> + <dd id="Python.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> + <dd id="Python.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> + <dd id="Python.Generator.null_sql" class="function"><a href="../generator.html#Generator.null_sql">null_sql</a></dd> + <dd id="Python.Generator.boolean_sql" class="function"><a href="../generator.html#Generator.boolean_sql">boolean_sql</a></dd> + <dd id="Python.Generator.order_sql" class="function"><a href="../generator.html#Generator.order_sql">order_sql</a></dd> + <dd id="Python.Generator.cluster_sql" class="function"><a href="../generator.html#Generator.cluster_sql">cluster_sql</a></dd> + <dd id="Python.Generator.distribute_sql" class="function"><a href="../generator.html#Generator.distribute_sql">distribute_sql</a></dd> + <dd id="Python.Generator.sort_sql" class="function"><a href="../generator.html#Generator.sort_sql">sort_sql</a></dd> + <dd id="Python.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> + <dd id="Python.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> + <dd id="Python.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Python.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> + <dd id="Python.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Python.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> + <dd id="Python.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_sql</a></dd> + <dd id="Python.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> + <dd id="Python.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> + <dd id="Python.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> + <dd id="Python.Generator.subquery_sql" class="function"><a href="../generator.html#Generator.subquery_sql">subquery_sql</a></dd> + <dd id="Python.Generator.qualify_sql" class="function"><a href="../generator.html#Generator.qualify_sql">qualify_sql</a></dd> + <dd id="Python.Generator.union_sql" class="function"><a href="../generator.html#Generator.union_sql">union_sql</a></dd> + <dd id="Python.Generator.union_op" class="function"><a href="../generator.html#Generator.union_op">union_op</a></dd> + <dd id="Python.Generator.unnest_sql" class="function"><a href="../generator.html#Generator.unnest_sql">unnest_sql</a></dd> + <dd id="Python.Generator.where_sql" class="function"><a href="../generator.html#Generator.where_sql">where_sql</a></dd> + <dd id="Python.Generator.window_sql" class="function"><a href="../generator.html#Generator.window_sql">window_sql</a></dd> + <dd id="Python.Generator.partition_by_sql" class="function"><a href="../generator.html#Generator.partition_by_sql">partition_by_sql</a></dd> + <dd id="Python.Generator.window_spec_sql" class="function"><a href="../generator.html#Generator.window_spec_sql">window_spec_sql</a></dd> + <dd id="Python.Generator.withingroup_sql" class="function"><a href="../generator.html#Generator.withingroup_sql">withingroup_sql</a></dd> + <dd id="Python.Generator.between_sql" class="function"><a href="../generator.html#Generator.between_sql">between_sql</a></dd> + <dd id="Python.Generator.bracket_sql" class="function"><a href="../generator.html#Generator.bracket_sql">bracket_sql</a></dd> + <dd id="Python.Generator.all_sql" class="function"><a href="../generator.html#Generator.all_sql">all_sql</a></dd> + <dd id="Python.Generator.any_sql" class="function"><a href="../generator.html#Generator.any_sql">any_sql</a></dd> + <dd id="Python.Generator.exists_sql" class="function"><a href="../generator.html#Generator.exists_sql">exists_sql</a></dd> + <dd id="Python.Generator.case_sql" class="function"><a href="../generator.html#Generator.case_sql">case_sql</a></dd> + <dd id="Python.Generator.constraint_sql" class="function"><a href="../generator.html#Generator.constraint_sql">constraint_sql</a></dd> + <dd id="Python.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> + <dd id="Python.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> + <dd id="Python.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Python.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> + <dd id="Python.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> + <dd id="Python.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> + <dd id="Python.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> + <dd id="Python.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> + <dd id="Python.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> + <dd id="Python.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> + <dd id="Python.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> + <dd id="Python.Generator.return_sql" class="function"><a href="../generator.html#Generator.return_sql">return_sql</a></dd> + <dd id="Python.Generator.reference_sql" class="function"><a href="../generator.html#Generator.reference_sql">reference_sql</a></dd> + <dd id="Python.Generator.anonymous_sql" class="function"><a href="../generator.html#Generator.anonymous_sql">anonymous_sql</a></dd> + <dd id="Python.Generator.paren_sql" class="function"><a href="../generator.html#Generator.paren_sql">paren_sql</a></dd> + <dd id="Python.Generator.neg_sql" class="function"><a href="../generator.html#Generator.neg_sql">neg_sql</a></dd> + <dd id="Python.Generator.not_sql" class="function"><a href="../generator.html#Generator.not_sql">not_sql</a></dd> + <dd id="Python.Generator.alias_sql" class="function"><a href="../generator.html#Generator.alias_sql">alias_sql</a></dd> + <dd id="Python.Generator.aliases_sql" class="function"><a href="../generator.html#Generator.aliases_sql">aliases_sql</a></dd> + <dd id="Python.Generator.attimezone_sql" class="function"><a href="../generator.html#Generator.attimezone_sql">attimezone_sql</a></dd> + <dd id="Python.Generator.add_sql" class="function"><a href="../generator.html#Generator.add_sql">add_sql</a></dd> + <dd id="Python.Generator.and_sql" class="function"><a href="../generator.html#Generator.and_sql">and_sql</a></dd> + <dd id="Python.Generator.connector_sql" class="function"><a href="../generator.html#Generator.connector_sql">connector_sql</a></dd> + <dd id="Python.Generator.bitwiseand_sql" class="function"><a href="../generator.html#Generator.bitwiseand_sql">bitwiseand_sql</a></dd> + <dd id="Python.Generator.bitwiseleftshift_sql" class="function"><a href="../generator.html#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a></dd> + <dd id="Python.Generator.bitwisenot_sql" class="function"><a href="../generator.html#Generator.bitwisenot_sql">bitwisenot_sql</a></dd> + <dd id="Python.Generator.bitwiseor_sql" class="function"><a href="../generator.html#Generator.bitwiseor_sql">bitwiseor_sql</a></dd> + <dd id="Python.Generator.bitwiserightshift_sql" class="function"><a href="../generator.html#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a></dd> + <dd id="Python.Generator.bitwisexor_sql" class="function"><a href="../generator.html#Generator.bitwisexor_sql">bitwisexor_sql</a></dd> + <dd id="Python.Generator.cast_sql" class="function"><a href="../generator.html#Generator.cast_sql">cast_sql</a></dd> + <dd id="Python.Generator.currentdate_sql" class="function"><a href="../generator.html#Generator.currentdate_sql">currentdate_sql</a></dd> + <dd id="Python.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> + <dd id="Python.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> + <dd id="Python.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> + <dd id="Python.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> + <dd id="Python.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> + <dd id="Python.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Python.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> + <dd id="Python.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> + <dd id="Python.Generator.droppartition_sql" class="function"><a href="../generator.html#Generator.droppartition_sql">droppartition_sql</a></dd> + <dd id="Python.Generator.addconstraint_sql" class="function"><a href="../generator.html#Generator.addconstraint_sql">addconstraint_sql</a></dd> + <dd id="Python.Generator.distinct_sql" class="function"><a href="../generator.html#Generator.distinct_sql">distinct_sql</a></dd> + <dd id="Python.Generator.ignorenulls_sql" class="function"><a href="../generator.html#Generator.ignorenulls_sql">ignorenulls_sql</a></dd> + <dd id="Python.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> + <dd id="Python.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> + <dd id="Python.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Python.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> + <dd id="Python.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> + <dd id="Python.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> + <dd id="Python.Generator.eq_sql" class="function"><a href="../generator.html#Generator.eq_sql">eq_sql</a></dd> + <dd id="Python.Generator.escape_sql" class="function"><a href="../generator.html#Generator.escape_sql">escape_sql</a></dd> + <dd id="Python.Generator.glob_sql" class="function"><a href="../generator.html#Generator.glob_sql">glob_sql</a></dd> + <dd id="Python.Generator.gt_sql" class="function"><a href="../generator.html#Generator.gt_sql">gt_sql</a></dd> + <dd id="Python.Generator.gte_sql" class="function"><a href="../generator.html#Generator.gte_sql">gte_sql</a></dd> + <dd id="Python.Generator.ilike_sql" class="function"><a href="../generator.html#Generator.ilike_sql">ilike_sql</a></dd> + <dd id="Python.Generator.is_sql" class="function"><a href="../generator.html#Generator.is_sql">is_sql</a></dd> + <dd id="Python.Generator.like_sql" class="function"><a href="../generator.html#Generator.like_sql">like_sql</a></dd> + <dd id="Python.Generator.similarto_sql" class="function"><a href="../generator.html#Generator.similarto_sql">similarto_sql</a></dd> + <dd id="Python.Generator.lt_sql" class="function"><a href="../generator.html#Generator.lt_sql">lt_sql</a></dd> + <dd id="Python.Generator.lte_sql" class="function"><a href="../generator.html#Generator.lte_sql">lte_sql</a></dd> + <dd id="Python.Generator.mod_sql" class="function"><a href="../generator.html#Generator.mod_sql">mod_sql</a></dd> + <dd id="Python.Generator.mul_sql" class="function"><a href="../generator.html#Generator.mul_sql">mul_sql</a></dd> + <dd id="Python.Generator.neq_sql" class="function"><a href="../generator.html#Generator.neq_sql">neq_sql</a></dd> + <dd id="Python.Generator.nullsafeeq_sql" class="function"><a href="../generator.html#Generator.nullsafeeq_sql">nullsafeeq_sql</a></dd> + <dd id="Python.Generator.nullsafeneq_sql" class="function"><a href="../generator.html#Generator.nullsafeneq_sql">nullsafeneq_sql</a></dd> + <dd id="Python.Generator.or_sql" class="function"><a href="../generator.html#Generator.or_sql">or_sql</a></dd> + <dd id="Python.Generator.slice_sql" class="function"><a href="../generator.html#Generator.slice_sql">slice_sql</a></dd> + <dd id="Python.Generator.sub_sql" class="function"><a href="../generator.html#Generator.sub_sql">sub_sql</a></dd> + <dd id="Python.Generator.trycast_sql" class="function"><a href="../generator.html#Generator.trycast_sql">trycast_sql</a></dd> + <dd id="Python.Generator.use_sql" class="function"><a href="../generator.html#Generator.use_sql">use_sql</a></dd> + <dd id="Python.Generator.binary" class="function"><a href="../generator.html#Generator.binary">binary</a></dd> + <dd id="Python.Generator.function_fallback_sql" class="function"><a href="../generator.html#Generator.function_fallback_sql">function_fallback_sql</a></dd> + <dd id="Python.Generator.format_args" class="function"><a href="../generator.html#Generator.format_args">format_args</a></dd> + <dd id="Python.Generator.text_width" class="function"><a href="../generator.html#Generator.text_width">text_width</a></dd> + <dd id="Python.Generator.format_time" class="function"><a href="../generator.html#Generator.format_time">format_time</a></dd> + <dd id="Python.Generator.expressions" class="function"><a href="../generator.html#Generator.expressions">expressions</a></dd> + <dd id="Python.Generator.op_expressions" class="function"><a href="../generator.html#Generator.op_expressions">op_expressions</a></dd> + <dd id="Python.Generator.naked_property" class="function"><a href="../generator.html#Generator.naked_property">naked_property</a></dd> + <dd id="Python.Generator.set_operation" class="function"><a href="../generator.html#Generator.set_operation">set_operation</a></dd> + <dd id="Python.Generator.tag_sql" class="function"><a href="../generator.html#Generator.tag_sql">tag_sql</a></dd> + <dd id="Python.Generator.token_sql" class="function"><a href="../generator.html#Generator.token_sql">token_sql</a></dd> + <dd id="Python.Generator.userdefinedfunction_sql" class="function"><a href="../generator.html#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a></dd> + <dd id="Python.Generator.userdefinedfunctionkwarg_sql" class="function"><a href="../generator.html#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a></dd> + <dd id="Python.Generator.joinhint_sql" class="function"><a href="../generator.html#Generator.joinhint_sql">joinhint_sql</a></dd> + <dd id="Python.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> + <dd id="Python.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> + <dd id="Python.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/executor/table.html b/docs/sqlglot/executor/table.html new file mode 100644 index 0000000..59f777b --- /dev/null +++ b/docs/sqlglot/executor/table.html @@ -0,0 +1,802 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.executor.table API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../executor.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.executor</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Table">Table</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Table.__init__">Table</a> + </li> + <li> + <a class="function" href="#Table.add_columns">add_columns</a> + </li> + <li> + <a class="function" href="#Table.append">append</a> + </li> + <li> + <a class="function" href="#Table.pop">pop</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#TableIter">TableIter</a> + <ul class="memberlist"> + <li> + <a class="function" href="#TableIter.__init__">TableIter</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#RangeReader">RangeReader</a> + <ul class="memberlist"> + <li> + <a class="function" href="#RangeReader.__init__">RangeReader</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#RowReader">RowReader</a> + <ul class="memberlist"> + <li> + <a class="function" href="#RowReader.__init__">RowReader</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Tables">Tables</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="function" href="#ensure_tables">ensure_tables</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/executor/table.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../executor.html">executor</a><wbr>.table </h1> + + + <input id="mod-table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-table-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">dict_depth</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">AbstractMappingSchema</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">Table</span><span class="p">:</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="n">rows</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">column_range</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="o">=</span> <span class="n">column_range</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">RowReader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">rows</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="k">if</span> <span class="n">rows</span><span class="p">:</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">rows</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_reader</span> <span class="o">=</span> <span class="n">RangeReader</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="k">def</span> <span class="nf">add_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">+=</span> <span class="n">columns</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">:</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="o">.</span><span class="n">start</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="o">.</span><span class="n">stop</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="p">)</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">RowReader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">):</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">def</span> <span class="nf">pop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="nd">@property</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">def</span> <span class="nf">width</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">def</span> <span class="fm">__len__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">return</span> <span class="n">TableIter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">):</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">column</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="ow">or</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">widths</span> <span class="o">=</span> <span class="p">{</span><span class="n">column</span><span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">}</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">)]</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">></span> <span class="mi">10</span><span class="p">:</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">break</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="nb">str</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="n">column</span><span class="p">])</span><span class="o">.</span><span class="n">rjust</span><span class="p">(</span><span class="n">widths</span><span class="p">[</span><span class="n">column</span><span class="p">])[</span><span class="mi">0</span> <span class="p">:</span> <span class="n">widths</span><span class="p">[</span><span class="n">column</span><span class="p">]]</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="p">)</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="k">class</span> <span class="nc">TableIter</span><span class="p">:</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="fm">__next__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">):</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">index</span><span class="p">]</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="k">raise</span> <span class="ne">StopIteration</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="k">class</span> <span class="nc">RangeReader</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="fm">__len__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">range</span><span class="p">)</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">):</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">column</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">range</span><span class="p">)</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a><span class="k">class</span> <span class="nc">RowReader</span><span class="p">:</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="n">column_range</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">column</span><span class="p">:</span> <span class="n">i</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">column_range</span> <span class="ow">or</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">column_range</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="p">}</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">row</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="n">column</span><span class="p">]]</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="k">class</span> <span class="nc">Tables</span><span class="p">(</span><span class="n">AbstractMappingSchema</span><span class="p">[</span><span class="n">Table</span><span class="p">]):</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">pass</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a><span class="k">def</span> <span class="nf">ensure_tables</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">])</span> <span class="o">-></span> <span class="n">Tables</span><span class="p">:</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">return</span> <span class="n">Tables</span><span class="p">(</span><span class="n">_ensure_tables</span><span class="p">(</span><span class="n">d</span><span class="p">))</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a><span class="k">def</span> <span class="nf">_ensure_tables</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">d</span><span class="p">:</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">depth</span> <span class="o">=</span> <span class="n">dict_depth</span><span class="p">(</span><span class="n">d</span><span class="p">)</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">depth</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">_ensure_tables</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">result</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">d</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">result</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">table</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="p">()</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="nb">tuple</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="n">c</span><span class="p">]</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">)</span> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">table</span><span class="p">]</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">result</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">Table</span><span class="p">(</span><span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">,</span> <span class="n">rows</span><span class="o">=</span><span class="n">rows</span><span class="p">)</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="n">result</span> +</span></pre></div> + + + </section> + <section id="Table"> + <input id="Table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Table</span>: + + <label class="view-source-button" for="Table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Table-10"><a href="#Table-10"><span class="linenos">10</span></a><span class="k">class</span> <span class="nc">Table</span><span class="p">:</span> +</span><span id="Table-11"><a href="#Table-11"><span class="linenos">11</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="n">rows</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">column_range</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Table-12"><a href="#Table-12"><span class="linenos">12</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table-13"><a href="#Table-13"><span class="linenos">13</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="o">=</span> <span class="n">column_range</span> +</span><span id="Table-14"><a href="#Table-14"><span class="linenos">14</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">RowReader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="Table-15"><a href="#Table-15"><span class="linenos">15</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">rows</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="Table-16"><a href="#Table-16"><span class="linenos">16</span></a> <span class="k">if</span> <span class="n">rows</span><span class="p">:</span> +</span><span id="Table-17"><a href="#Table-17"><span class="linenos">17</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">rows</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table-18"><a href="#Table-18"><span class="linenos">18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_reader</span> <span class="o">=</span> <span class="n">RangeReader</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Table-19"><a href="#Table-19"><span class="linenos">19</span></a> +</span><span id="Table-20"><a href="#Table-20"><span class="linenos">20</span></a> <span class="k">def</span> <span class="nf">add_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Table-21"><a href="#Table-21"><span class="linenos">21</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">+=</span> <span class="n">columns</span> +</span><span id="Table-22"><a href="#Table-22"><span class="linenos">22</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">:</span> +</span><span id="Table-23"><a href="#Table-23"><span class="linenos">23</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span> +</span><span id="Table-24"><a href="#Table-24"><span class="linenos">24</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="o">.</span><span class="n">start</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="o">.</span><span class="n">stop</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table-25"><a href="#Table-25"><span class="linenos">25</span></a> <span class="p">)</span> +</span><span id="Table-26"><a href="#Table-26"><span class="linenos">26</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">RowReader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="Table-27"><a href="#Table-27"><span class="linenos">27</span></a> +</span><span id="Table-28"><a href="#Table-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">):</span> +</span><span id="Table-29"><a href="#Table-29"><span class="linenos">29</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table-30"><a href="#Table-30"><span class="linenos">30</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> +</span><span id="Table-31"><a href="#Table-31"><span class="linenos">31</span></a> +</span><span id="Table-32"><a href="#Table-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">pop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table-33"><a href="#Table-33"><span class="linenos">33</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="Table-34"><a href="#Table-34"><span class="linenos">34</span></a> +</span><span id="Table-35"><a href="#Table-35"><span class="linenos">35</span></a> <span class="nd">@property</span> +</span><span id="Table-36"><a href="#Table-36"><span class="linenos">36</span></a> <span class="k">def</span> <span class="nf">width</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table-37"><a href="#Table-37"><span class="linenos">37</span></a> <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table-38"><a href="#Table-38"><span class="linenos">38</span></a> +</span><span id="Table-39"><a href="#Table-39"><span class="linenos">39</span></a> <span class="k">def</span> <span class="fm">__len__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table-40"><a href="#Table-40"><span class="linenos">40</span></a> <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">)</span> +</span><span id="Table-41"><a href="#Table-41"><span class="linenos">41</span></a> +</span><span id="Table-42"><a href="#Table-42"><span class="linenos">42</span></a> <span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table-43"><a href="#Table-43"><span class="linenos">43</span></a> <span class="k">return</span> <span class="n">TableIter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Table-44"><a href="#Table-44"><span class="linenos">44</span></a> +</span><span id="Table-45"><a href="#Table-45"><span class="linenos">45</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">):</span> +</span><span id="Table-46"><a href="#Table-46"><span class="linenos">46</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="Table-47"><a href="#Table-47"><span class="linenos">47</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> +</span><span id="Table-48"><a href="#Table-48"><span class="linenos">48</span></a> +</span><span id="Table-49"><a href="#Table-49"><span class="linenos">49</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table-50"><a href="#Table-50"><span class="linenos">50</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="Table-51"><a href="#Table-51"><span class="linenos">51</span></a> <span class="n">column</span> +</span><span id="Table-52"><a href="#Table-52"><span class="linenos">52</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table-53"><a href="#Table-53"><span class="linenos">53</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="ow">or</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> +</span><span id="Table-54"><a href="#Table-54"><span class="linenos">54</span></a> <span class="p">)</span> +</span><span id="Table-55"><a href="#Table-55"><span class="linenos">55</span></a> <span class="n">widths</span> <span class="o">=</span> <span class="p">{</span><span class="n">column</span><span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">}</span> +</span><span id="Table-56"><a href="#Table-56"><span class="linenos">56</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">)]</span> +</span><span id="Table-57"><a href="#Table-57"><span class="linenos">57</span></a> +</span><span id="Table-58"><a href="#Table-58"><span class="linenos">58</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table-59"><a href="#Table-59"><span class="linenos">59</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o">></span> <span class="mi">10</span><span class="p">:</span> +</span><span id="Table-60"><a href="#Table-60"><span class="linenos">60</span></a> <span class="k">break</span> +</span><span id="Table-61"><a href="#Table-61"><span class="linenos">61</span></a> +</span><span id="Table-62"><a href="#Table-62"><span class="linenos">62</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Table-63"><a href="#Table-63"><span class="linenos">63</span></a> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Table-64"><a href="#Table-64"><span class="linenos">64</span></a> <span class="nb">str</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="n">column</span><span class="p">])</span><span class="o">.</span><span class="n">rjust</span><span class="p">(</span><span class="n">widths</span><span class="p">[</span><span class="n">column</span><span class="p">])[</span><span class="mi">0</span> <span class="p">:</span> <span class="n">widths</span><span class="p">[</span><span class="n">column</span><span class="p">]]</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="Table-65"><a href="#Table-65"><span class="linenos">65</span></a> <span class="p">)</span> +</span><span id="Table-66"><a href="#Table-66"><span class="linenos">66</span></a> <span class="p">)</span> +</span><span id="Table-67"><a href="#Table-67"><span class="linenos">67</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Table.__init__" class="classattr"> + <input id="Table.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Table</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">columns</span>, </span><span class="param"><span class="n">rows</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">column_range</span><span class="o">=</span><span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="Table.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Table.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Table.__init__-11"><a href="#Table.__init__-11"><span class="linenos">11</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="n">rows</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">column_range</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Table.__init__-12"><a href="#Table.__init__-12"><span class="linenos">12</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table.__init__-13"><a href="#Table.__init__-13"><span class="linenos">13</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="o">=</span> <span class="n">column_range</span> +</span><span id="Table.__init__-14"><a href="#Table.__init__-14"><span class="linenos">14</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">RowReader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span><span id="Table.__init__-15"><a href="#Table.__init__-15"><span class="linenos">15</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span> <span class="o">=</span> <span class="n">rows</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="Table.__init__-16"><a href="#Table.__init__-16"><span class="linenos">16</span></a> <span class="k">if</span> <span class="n">rows</span><span class="p">:</span> +</span><span id="Table.__init__-17"><a href="#Table.__init__-17"><span class="linenos">17</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">rows</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table.__init__-18"><a href="#Table.__init__-18"><span class="linenos">18</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range_reader</span> <span class="o">=</span> <span class="n">RangeReader</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Table.add_columns" class="classattr"> + <input id="Table.add_columns-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_columns</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Table.add_columns-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Table.add_columns"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Table.add_columns-20"><a href="#Table.add_columns-20"><span class="linenos">20</span></a> <span class="k">def</span> <span class="nf">add_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">columns</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Table.add_columns-21"><a href="#Table.add_columns-21"><span class="linenos">21</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">+=</span> <span class="n">columns</span> +</span><span id="Table.add_columns-22"><a href="#Table.add_columns-22"><span class="linenos">22</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">:</span> +</span><span id="Table.add_columns-23"><a href="#Table.add_columns-23"><span class="linenos">23</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span> +</span><span id="Table.add_columns-24"><a href="#Table.add_columns-24"><span class="linenos">24</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="o">.</span><span class="n">start</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="o">.</span><span class="n">stop</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table.add_columns-25"><a href="#Table.add_columns-25"><span class="linenos">25</span></a> <span class="p">)</span> +</span><span id="Table.add_columns-26"><a href="#Table.add_columns-26"><span class="linenos">26</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">RowReader</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">column_range</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Table.append" class="classattr"> + <input id="Table.append-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">append</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">row</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Table.append-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Table.append"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Table.append-28"><a href="#Table.append-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">row</span><span class="p">):</span> +</span><span id="Table.append-29"><a href="#Table.append-29"><span class="linenos">29</span></a> <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Table.append-30"><a href="#Table.append-30"><span class="linenos">30</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">row</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Table.pop" class="classattr"> + <input id="Table.pop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pop</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Table.pop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Table.pop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Table.pop-32"><a href="#Table.pop-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">pop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Table.pop-33"><a href="#Table.pop-33"><span class="linenos">33</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">rows</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + </section> + <section id="TableIter"> + <input id="TableIter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TableIter</span>: + + <label class="view-source-button" for="TableIter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TableIter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TableIter-70"><a href="#TableIter-70"><span class="linenos">70</span></a><span class="k">class</span> <span class="nc">TableIter</span><span class="p">:</span> +</span><span id="TableIter-71"><a href="#TableIter-71"><span class="linenos">71</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span> +</span><span id="TableIter-72"><a href="#TableIter-72"><span class="linenos">72</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="TableIter-73"><a href="#TableIter-73"><span class="linenos">73</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="TableIter-74"><a href="#TableIter-74"><span class="linenos">74</span></a> +</span><span id="TableIter-75"><a href="#TableIter-75"><span class="linenos">75</span></a> <span class="k">def</span> <span class="fm">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="TableIter-76"><a href="#TableIter-76"><span class="linenos">76</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="TableIter-77"><a href="#TableIter-77"><span class="linenos">77</span></a> +</span><span id="TableIter-78"><a href="#TableIter-78"><span class="linenos">78</span></a> <span class="k">def</span> <span class="fm">__next__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="TableIter-79"><a href="#TableIter-79"><span class="linenos">79</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="TableIter-80"><a href="#TableIter-80"><span class="linenos">80</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">):</span> +</span><span id="TableIter-81"><a href="#TableIter-81"><span class="linenos">81</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">index</span><span class="p">]</span> +</span><span id="TableIter-82"><a href="#TableIter-82"><span class="linenos">82</span></a> <span class="k">raise</span> <span class="ne">StopIteration</span> +</span></pre></div> + + + + + <div id="TableIter.__init__" class="classattr"> + <input id="TableIter.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">TableIter</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">table</span></span>)</span> + + <label class="view-source-button" for="TableIter.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TableIter.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TableIter.__init__-71"><a href="#TableIter.__init__-71"><span class="linenos">71</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span> +</span><span id="TableIter.__init__-72"><a href="#TableIter.__init__-72"><span class="linenos">72</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="TableIter.__init__-73"><a href="#TableIter.__init__-73"><span class="linenos">73</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span></pre></div> + + + + + </div> + </section> + <section id="RangeReader"> + <input id="RangeReader-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RangeReader</span>: + + <label class="view-source-button" for="RangeReader-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RangeReader"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RangeReader-85"><a href="#RangeReader-85"><span class="linenos">85</span></a><span class="k">class</span> <span class="nc">RangeReader</span><span class="p">:</span> +</span><span id="RangeReader-86"><a href="#RangeReader-86"><span class="linenos">86</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span> +</span><span id="RangeReader-87"><a href="#RangeReader-87"><span class="linenos">87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="RangeReader-88"><a href="#RangeReader-88"><span class="linenos">88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> +</span><span id="RangeReader-89"><a href="#RangeReader-89"><span class="linenos">89</span></a> +</span><span id="RangeReader-90"><a href="#RangeReader-90"><span class="linenos">90</span></a> <span class="k">def</span> <span class="fm">__len__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="RangeReader-91"><a href="#RangeReader-91"><span class="linenos">91</span></a> <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">range</span><span class="p">)</span> +</span><span id="RangeReader-92"><a href="#RangeReader-92"><span class="linenos">92</span></a> +</span><span id="RangeReader-93"><a href="#RangeReader-93"><span class="linenos">93</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">):</span> +</span><span id="RangeReader-94"><a href="#RangeReader-94"><span class="linenos">94</span></a> <span class="k">return</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="n">column</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">range</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="RangeReader.__init__" class="classattr"> + <input id="RangeReader.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">RangeReader</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">table</span></span>)</span> + + <label class="view-source-button" for="RangeReader.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RangeReader.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RangeReader.__init__-86"><a href="#RangeReader.__init__-86"><span class="linenos">86</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">):</span> +</span><span id="RangeReader.__init__-87"><a href="#RangeReader.__init__-87"><span class="linenos">87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">table</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="RangeReader.__init__-88"><a href="#RangeReader.__init__-88"><span class="linenos">88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">range</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="RowReader"> + <input id="RowReader-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RowReader</span>: + + <label class="view-source-button" for="RowReader-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RowReader"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RowReader-97"><a href="#RowReader-97"><span class="linenos"> 97</span></a><span class="k">class</span> <span class="nc">RowReader</span><span class="p">:</span> +</span><span id="RowReader-98"><a href="#RowReader-98"><span class="linenos"> 98</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="n">column_range</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="RowReader-99"><a href="#RowReader-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="RowReader-100"><a href="#RowReader-100"><span class="linenos">100</span></a> <span class="n">column</span><span class="p">:</span> <span class="n">i</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">column_range</span> <span class="ow">or</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">column_range</span> +</span><span id="RowReader-101"><a href="#RowReader-101"><span class="linenos">101</span></a> <span class="p">}</span> +</span><span id="RowReader-102"><a href="#RowReader-102"><span class="linenos">102</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="RowReader-103"><a href="#RowReader-103"><span class="linenos">103</span></a> +</span><span id="RowReader-104"><a href="#RowReader-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="fm">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column</span><span class="p">):</span> +</span><span id="RowReader-105"><a href="#RowReader-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">row</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">columns</span><span class="p">[</span><span class="n">column</span><span class="p">]]</span> +</span></pre></div> + + + + + <div id="RowReader.__init__" class="classattr"> + <input id="RowReader.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">RowReader</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">columns</span>, </span><span class="param"><span class="n">column_range</span><span class="o">=</span><span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="RowReader.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RowReader.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RowReader.__init__-98"><a href="#RowReader.__init__-98"><span class="linenos"> 98</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">columns</span><span class="p">,</span> <span class="n">column_range</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="RowReader.__init__-99"><a href="#RowReader.__init__-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="RowReader.__init__-100"><a href="#RowReader.__init__-100"><span class="linenos">100</span></a> <span class="n">column</span><span class="p">:</span> <span class="n">i</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">column_range</span> <span class="ow">or</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">column_range</span> +</span><span id="RowReader.__init__-101"><a href="#RowReader.__init__-101"><span class="linenos">101</span></a> <span class="p">}</span> +</span><span id="RowReader.__init__-102"><a href="#RowReader.__init__-102"><span class="linenos">102</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">row</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + </section> + <section id="Tables"> + <input id="Tables-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tables</span><wbr>(<span class="base"><a href="../schema.html#AbstractMappingSchema">sqlglot.schema.AbstractMappingSchema[sqlglot.executor.table.Table]</a></span>): + + <label class="view-source-button" for="Tables-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tables"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tables-108"><a href="#Tables-108"><span class="linenos">108</span></a><span class="k">class</span> <span class="nc">Tables</span><span class="p">(</span><span class="n">AbstractMappingSchema</span><span class="p">[</span><span class="n">Table</span><span class="p">]):</span> +</span><span id="Tables-109"><a href="#Tables-109"><span class="linenos">109</span></a> <span class="k">pass</span> +</span></pre></div> + + + <div class="docstring"><p>Abstract base class for generic types.</p> + +<p>A generic type is typically declared by inheriting from +this class parameterized with one or more type variables. +For example, a generic mapping type might be defined as::</p> + +<p>class Mapping(Generic[KT, VT]): + def __getitem__(self, key: KT) -> VT: + ... + # Etc.</p> + +<p>This class can then be used as follows::</p> + +<p>def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: + try: + return mapping[key] + except KeyError: + return default</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="../schema.html#AbstractMappingSchema">sqlglot.schema.AbstractMappingSchema</a></dt> + <dd id="Tables.__init__" class="function"><a href="../schema.html#AbstractMappingSchema.__init__">AbstractMappingSchema</a></dd> + <dd id="Tables.table_parts" class="function"><a href="../schema.html#AbstractMappingSchema.table_parts">table_parts</a></dd> + <dd id="Tables.find" class="function"><a href="../schema.html#AbstractMappingSchema.find">find</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ensure_tables"> + <input id="ensure_tables-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ensure_tables</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">d</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n"><a href="#Tables">sqlglot.executor.table.Tables</a></span>:</span></span> + + <label class="view-source-button" for="ensure_tables-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ensure_tables"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ensure_tables-112"><a href="#ensure_tables-112"><span class="linenos">112</span></a><span class="k">def</span> <span class="nf">ensure_tables</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">])</span> <span class="o">-></span> <span class="n">Tables</span><span class="p">:</span> +</span><span id="ensure_tables-113"><a href="#ensure_tables-113"><span class="linenos">113</span></a> <span class="k">return</span> <span class="n">Tables</span><span class="p">(</span><span class="n">_ensure_tables</span><span class="p">(</span><span class="n">d</span><span class="p">))</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/expressions.html b/docs/sqlglot/expressions.html new file mode 100644 index 0000000..997a895 --- /dev/null +++ b/docs/sqlglot/expressions.html @@ -0,0 +1,39484 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.expressions API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + <h2>Contents</h2> + <ul> + <li><a href="#expressions">Expressions</a></li> +</ul> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Expression">Expression</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Expression.__init__">Expression</a> + </li> + <li> + <a class="variable" href="#Expression.this">this</a> + </li> + <li> + <a class="variable" href="#Expression.expression">expression</a> + </li> + <li> + <a class="variable" href="#Expression.expressions">expressions</a> + </li> + <li> + <a class="function" href="#Expression.text">text</a> + </li> + <li> + <a class="variable" href="#Expression.is_string">is_string</a> + </li> + <li> + <a class="variable" href="#Expression.is_number">is_number</a> + </li> + <li> + <a class="variable" href="#Expression.is_int">is_int</a> + </li> + <li> + <a class="variable" href="#Expression.alias">alias</a> + </li> + <li> + <a class="variable" href="#Expression.output_name">output_name</a> + </li> + <li> + <a class="function" href="#Expression.copy">copy</a> + </li> + <li> + <a class="function" href="#Expression.append">append</a> + </li> + <li> + <a class="function" href="#Expression.set">set</a> + </li> + <li> + <a class="variable" href="#Expression.depth">depth</a> + </li> + <li> + <a class="function" href="#Expression.find">find</a> + </li> + <li> + <a class="function" href="#Expression.find_all">find_all</a> + </li> + <li> + <a class="function" href="#Expression.find_ancestor">find_ancestor</a> + </li> + <li> + <a class="variable" href="#Expression.parent_select">parent_select</a> + </li> + <li> + <a class="function" href="#Expression.walk">walk</a> + </li> + <li> + <a class="function" href="#Expression.dfs">dfs</a> + </li> + <li> + <a class="function" href="#Expression.bfs">bfs</a> + </li> + <li> + <a class="function" href="#Expression.unnest">unnest</a> + </li> + <li> + <a class="function" href="#Expression.unalias">unalias</a> + </li> + <li> + <a class="function" href="#Expression.unnest_operands">unnest_operands</a> + </li> + <li> + <a class="function" href="#Expression.flatten">flatten</a> + </li> + <li> + <a class="function" href="#Expression.sql">sql</a> + </li> + <li> + <a class="function" href="#Expression.transform">transform</a> + </li> + <li> + <a class="function" href="#Expression.replace">replace</a> + </li> + <li> + <a class="function" href="#Expression.pop">pop</a> + </li> + <li> + <a class="function" href="#Expression.assert_is">assert_is</a> + </li> + <li> + <a class="function" href="#Expression.error_messages">error_messages</a> + </li> + <li> + <a class="function" href="#Expression.dump">dump</a> + </li> + <li> + <a class="function" href="#Expression.load">load</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Condition">Condition</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Condition.and_">and_</a> + </li> + <li> + <a class="function" href="#Condition.or_">or_</a> + </li> + <li> + <a class="function" href="#Condition.not_">not_</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Predicate">Predicate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DerivedTable">DerivedTable</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Unionable">Unionable</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Unionable.union">union</a> + </li> + <li> + <a class="function" href="#Unionable.intersect">intersect</a> + </li> + <li> + <a class="function" href="#Unionable.except_">except_</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#UDTF">UDTF</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Cache">Cache</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Uncache">Uncache</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Create">Create</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Describe">Describe</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Set">Set</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SetItem">SetItem</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Show">Show</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UserDefinedFunction">UserDefinedFunction</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UserDefinedFunctionKwarg">UserDefinedFunctionKwarg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CharacterSet">CharacterSet</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#With">With</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#WithinGroup">WithinGroup</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CTE">CTE</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TableAlias">TableAlias</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitString">BitString</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#HexString">HexString</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ByteString">ByteString</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Column">Column</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Column.output_name">output_name</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#ColumnDef">ColumnDef</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AlterColumn">AlterColumn</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RenameTable">RenameTable</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ColumnConstraint">ColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ColumnConstraintKind">ColumnConstraintKind</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AutoIncrementColumnConstraint">AutoIncrementColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CheckColumnConstraint">CheckColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CollateColumnConstraint">CollateColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CommentColumnConstraint">CommentColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DefaultColumnConstraint">DefaultColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#EncodeColumnConstraint">EncodeColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#GeneratedAsIdentityColumnConstraint">GeneratedAsIdentityColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#NotNullColumnConstraint">NotNullColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#PrimaryKeyColumnConstraint">PrimaryKeyColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UniqueColumnConstraint">UniqueColumnConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Constraint">Constraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Delete">Delete</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Drop">Drop</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Filter">Filter</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Check">Check</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Directory">Directory</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ForeignKey">ForeignKey</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#PrimaryKey">PrimaryKey</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Unique">Unique</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Into">Into</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#From">From</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Having">Having</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Hint">Hint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JoinHint">JoinHint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Identifier">Identifier</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Identifier.output_name">output_name</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Index">Index</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Insert">Insert</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Introducer">Introducer</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#National">National</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LoadData">LoadData</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Partition">Partition</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Fetch">Fetch</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Group">Group</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Lambda">Lambda</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Limit">Limit</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Literal">Literal</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Literal.number">number</a> + </li> + <li> + <a class="function" href="#Literal.string">string</a> + </li> + <li> + <a class="variable" href="#Literal.output_name">output_name</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Join">Join</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Join.on">on</a> + </li> + <li> + <a class="function" href="#Join.using">using</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Lateral">Lateral</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#MatchRecognize">MatchRecognize</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Final">Final</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Offset">Offset</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Order">Order</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Cluster">Cluster</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Distribute">Distribute</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Sort">Sort</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Ordered">Ordered</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Property">Property</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AlgorithmProperty">AlgorithmProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DefinerProperty">DefinerProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SqlSecurityProperty">SqlSecurityProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TableFormatProperty">TableFormatProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#PartitionedByProperty">PartitionedByProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#FileFormatProperty">FileFormatProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DistKeyProperty">DistKeyProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SortKeyProperty">SortKeyProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DistStyleProperty">DistStyleProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LikeProperty">LikeProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LocationProperty">LocationProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#EngineProperty">EngineProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AutoIncrementProperty">AutoIncrementProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CharacterSetProperty">CharacterSetProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CollateProperty">CollateProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SchemaCommentProperty">SchemaCommentProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ReturnsProperty">ReturnsProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LanguageProperty">LanguageProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ExecuteAsProperty">ExecuteAsProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#VolatilityProperty">VolatilityProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RowFormatDelimitedProperty">RowFormatDelimitedProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RowFormatSerdeProperty">RowFormatSerdeProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SerdeProperties">SerdeProperties</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#FallbackProperty">FallbackProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#WithJournalTableProperty">WithJournalTableProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LogProperty">LogProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JournalProperty">JournalProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AfterJournalProperty">AfterJournalProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ChecksumProperty">ChecksumProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#FreespaceProperty">FreespaceProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#MergeBlockRatioProperty">MergeBlockRatioProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DataBlocksizeProperty">DataBlocksizeProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BlockCompressionProperty">BlockCompressionProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#IsolatedLoadingProperty">IsolatedLoadingProperty</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Properties">Properties</a> + <ul class="memberlist"> + <li> + <a class="class" href="#Properties.Location">Properties.Location</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Properties.Location.POST_CREATE">POST_CREATE</a> + </li> + <li> + <a class="variable" href="#Properties.Location.PRE_SCHEMA">PRE_SCHEMA</a> + </li> + <li> + <a class="variable" href="#Properties.Location.POST_INDEX">POST_INDEX</a> + </li> + <li> + <a class="variable" href="#Properties.Location.POST_SCHEMA_ROOT">POST_SCHEMA_ROOT</a> + </li> + <li> + <a class="variable" href="#Properties.Location.POST_SCHEMA_WITH">POST_SCHEMA_WITH</a> + </li> + <li> + <a class="variable" href="#Properties.Location.UNSUPPORTED">UNSUPPORTED</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#Properties.from_dict">from_dict</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Qualify">Qualify</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Return">Return</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Reference">Reference</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Tuple">Tuple</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Subqueryable">Subqueryable</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Subqueryable.subquery">subquery</a> + </li> + <li> + <a class="function" href="#Subqueryable.limit">limit</a> + </li> + <li> + <a class="function" href="#Subqueryable.with_">with_</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Table">Table</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SystemTime">SystemTime</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Union">Union</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Union.limit">limit</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Except">Except</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Intersect">Intersect</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Unnest">Unnest</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Update">Update</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Values">Values</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Var">Var</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Schema">Schema</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Lock">Lock</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Select">Select</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Select.from_">from_</a> + </li> + <li> + <a class="function" href="#Select.group_by">group_by</a> + </li> + <li> + <a class="function" href="#Select.order_by">order_by</a> + </li> + <li> + <a class="function" href="#Select.sort_by">sort_by</a> + </li> + <li> + <a class="function" href="#Select.cluster_by">cluster_by</a> + </li> + <li> + <a class="function" href="#Select.limit">limit</a> + </li> + <li> + <a class="function" href="#Select.offset">offset</a> + </li> + <li> + <a class="function" href="#Select.select">select</a> + </li> + <li> + <a class="function" href="#Select.lateral">lateral</a> + </li> + <li> + <a class="function" href="#Select.join">join</a> + </li> + <li> + <a class="function" href="#Select.where">where</a> + </li> + <li> + <a class="function" href="#Select.having">having</a> + </li> + <li> + <a class="function" href="#Select.window">window</a> + </li> + <li> + <a class="function" href="#Select.distinct">distinct</a> + </li> + <li> + <a class="function" href="#Select.ctas">ctas</a> + </li> + <li> + <a class="function" href="#Select.lock">lock</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Subquery">Subquery</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Subquery.unnest">unnest</a> + </li> + <li> + <a class="variable" href="#Subquery.output_name">output_name</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#TableSample">TableSample</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Tag">Tag</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Pivot">Pivot</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Window">Window</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#WindowSpec">WindowSpec</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Where">Where</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Star">Star</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Star.output_name">output_name</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Parameter">Parameter</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SessionParameter">SessionParameter</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Placeholder">Placeholder</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Null">Null</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Boolean">Boolean</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DataType">DataType</a> + <ul class="memberlist"> + <li> + <a class="class" href="#DataType.Type">DataType.Type</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#DataType.Type.CHAR">CHAR</a> + </li> + <li> + <a class="variable" href="#DataType.Type.NCHAR">NCHAR</a> + </li> + <li> + <a class="variable" href="#DataType.Type.VARCHAR">VARCHAR</a> + </li> + <li> + <a class="variable" href="#DataType.Type.NVARCHAR">NVARCHAR</a> + </li> + <li> + <a class="variable" href="#DataType.Type.TEXT">TEXT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.MEDIUMTEXT">MEDIUMTEXT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.LONGTEXT">LONGTEXT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.MEDIUMBLOB">MEDIUMBLOB</a> + </li> + <li> + <a class="variable" href="#DataType.Type.LONGBLOB">LONGBLOB</a> + </li> + <li> + <a class="variable" href="#DataType.Type.BINARY">BINARY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.VARBINARY">VARBINARY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.INT">INT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.TINYINT">TINYINT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.SMALLINT">SMALLINT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.BIGINT">BIGINT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.FLOAT">FLOAT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.DOUBLE">DOUBLE</a> + </li> + <li> + <a class="variable" href="#DataType.Type.DECIMAL">DECIMAL</a> + </li> + <li> + <a class="variable" href="#DataType.Type.BOOLEAN">BOOLEAN</a> + </li> + <li> + <a class="variable" href="#DataType.Type.JSON">JSON</a> + </li> + <li> + <a class="variable" href="#DataType.Type.JSONB">JSONB</a> + </li> + <li> + <a class="variable" href="#DataType.Type.INTERVAL">INTERVAL</a> + </li> + <li> + <a class="variable" href="#DataType.Type.TIME">TIME</a> + </li> + <li> + <a class="variable" href="#DataType.Type.TIMESTAMP">TIMESTAMP</a> + </li> + <li> + <a class="variable" href="#DataType.Type.TIMESTAMPTZ">TIMESTAMPTZ</a> + </li> + <li> + <a class="variable" href="#DataType.Type.TIMESTAMPLTZ">TIMESTAMPLTZ</a> + </li> + <li> + <a class="variable" href="#DataType.Type.DATE">DATE</a> + </li> + <li> + <a class="variable" href="#DataType.Type.DATETIME">DATETIME</a> + </li> + <li> + <a class="variable" href="#DataType.Type.ARRAY">ARRAY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.MAP">MAP</a> + </li> + <li> + <a class="variable" href="#DataType.Type.UUID">UUID</a> + </li> + <li> + <a class="variable" href="#DataType.Type.GEOGRAPHY">GEOGRAPHY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.GEOMETRY">GEOMETRY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.STRUCT">STRUCT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.NULLABLE">NULLABLE</a> + </li> + <li> + <a class="variable" href="#DataType.Type.HLLSKETCH">HLLSKETCH</a> + </li> + <li> + <a class="variable" href="#DataType.Type.HSTORE">HSTORE</a> + </li> + <li> + <a class="variable" href="#DataType.Type.SUPER">SUPER</a> + </li> + <li> + <a class="variable" href="#DataType.Type.SERIAL">SERIAL</a> + </li> + <li> + <a class="variable" href="#DataType.Type.SMALLSERIAL">SMALLSERIAL</a> + </li> + <li> + <a class="variable" href="#DataType.Type.BIGSERIAL">BIGSERIAL</a> + </li> + <li> + <a class="variable" href="#DataType.Type.XML">XML</a> + </li> + <li> + <a class="variable" href="#DataType.Type.UNIQUEIDENTIFIER">UNIQUEIDENTIFIER</a> + </li> + <li> + <a class="variable" href="#DataType.Type.MONEY">MONEY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.SMALLMONEY">SMALLMONEY</a> + </li> + <li> + <a class="variable" href="#DataType.Type.ROWVERSION">ROWVERSION</a> + </li> + <li> + <a class="variable" href="#DataType.Type.IMAGE">IMAGE</a> + </li> + <li> + <a class="variable" href="#DataType.Type.VARIANT">VARIANT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.OBJECT">OBJECT</a> + </li> + <li> + <a class="variable" href="#DataType.Type.NULL">NULL</a> + </li> + <li> + <a class="variable" href="#DataType.Type.UNKNOWN">UNKNOWN</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#DataType.build">build</a> + </li> + <li> + <a class="function" href="#DataType.is_type">is_type</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#PseudoType">PseudoType</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StructKwarg">StructKwarg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SubqueryPredicate">SubqueryPredicate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#All">All</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Any">Any</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Exists">Exists</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Command">Command</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Transaction">Transaction</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Commit">Commit</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Rollback">Rollback</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AlterTable">AlterTable</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AddConstraint">AddConstraint</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DropPartition">DropPartition</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Binary">Binary</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Add">Add</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Connector">Connector</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#And">And</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Or">Or</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitwiseAnd">BitwiseAnd</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitwiseLeftShift">BitwiseLeftShift</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitwiseOr">BitwiseOr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitwiseRightShift">BitwiseRightShift</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitwiseXor">BitwiseXor</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Div">Div</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Dot">Dot</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DPipe">DPipe</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#EQ">EQ</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#NullSafeEQ">NullSafeEQ</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#NullSafeNEQ">NullSafeNEQ</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Distance">Distance</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Escape">Escape</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Glob">Glob</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#GT">GT</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#GTE">GTE</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ILike">ILike</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#IntDiv">IntDiv</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Is">Is</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Kwarg">Kwarg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Like">Like</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LT">LT</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LTE">LTE</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Mod">Mod</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Mul">Mul</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#NEQ">NEQ</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SimilarTo">SimilarTo</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Slice">Slice</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Sub">Sub</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Unary">Unary</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#BitwiseNot">BitwiseNot</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Not">Not</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Paren">Paren</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Neg">Neg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Alias">Alias</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Alias.output_name">output_name</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Aliases">Aliases</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AtTimeZone">AtTimeZone</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Between">Between</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Bracket">Bracket</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Distinct">Distinct</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#In">In</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeUnit">TimeUnit</a> + <ul class="memberlist"> + <li> + <a class="function" href="#TimeUnit.__init__">TimeUnit</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Interval">Interval</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#IgnoreNulls">IgnoreNulls</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RespectNulls">RespectNulls</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Func">Func</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Func.from_arg_list">from_arg_list</a> + </li> + <li> + <a class="function" href="#Func.sql_names">sql_names</a> + </li> + <li> + <a class="function" href="#Func.sql_name">sql_name</a> + </li> + <li> + <a class="function" href="#Func.default_parser_mappings">default_parser_mappings</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#AggFunc">AggFunc</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Abs">Abs</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Anonymous">Anonymous</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ApproxDistinct">ApproxDistinct</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Array">Array</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#GenerateSeries">GenerateSeries</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayAgg">ArrayAgg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayAll">ArrayAll</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayAny">ArrayAny</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayConcat">ArrayConcat</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayContains">ArrayContains</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayFilter">ArrayFilter</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArraySize">ArraySize</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArraySort">ArraySort</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArraySum">ArraySum</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ArrayUnionAgg">ArrayUnionAgg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Avg">Avg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#AnyValue">AnyValue</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Case">Case</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Cast">Cast</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#Cast.output_name">output_name</a> + </li> + <li> + <a class="function" href="#Cast.is_type">is_type</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Collate">Collate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TryCast">TryCast</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Ceil">Ceil</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Coalesce">Coalesce</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Concat">Concat</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ConcatWs">ConcatWs</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Count">Count</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CurrentDate">CurrentDate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CurrentDatetime">CurrentDatetime</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CurrentTime">CurrentTime</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#CurrentTimestamp">CurrentTimestamp</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateAdd">DateAdd</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateSub">DateSub</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateDiff">DateDiff</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateTrunc">DateTrunc</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DatetimeAdd">DatetimeAdd</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DatetimeSub">DatetimeSub</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DatetimeDiff">DatetimeDiff</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DatetimeTrunc">DatetimeTrunc</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DayOfWeek">DayOfWeek</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DayOfMonth">DayOfMonth</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DayOfYear">DayOfYear</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#WeekOfYear">WeekOfYear</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LastDateOfMonth">LastDateOfMonth</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Extract">Extract</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimestampAdd">TimestampAdd</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimestampSub">TimestampSub</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimestampDiff">TimestampDiff</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimestampTrunc">TimestampTrunc</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeAdd">TimeAdd</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeSub">TimeSub</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeDiff">TimeDiff</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeTrunc">TimeTrunc</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateFromParts">DateFromParts</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateStrToDate">DateStrToDate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateToDateStr">DateToDateStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DateToDi">DateToDi</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Day">Day</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Decode">Decode</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#DiToDate">DiToDate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Encode">Encode</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Exp">Exp</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Explode">Explode</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Floor">Floor</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Greatest">Greatest</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#GroupConcat">GroupConcat</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Hex">Hex</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#If">If</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#IfNull">IfNull</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Initcap">Initcap</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JSONBContains">JSONBContains</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JSONExtract">JSONExtract</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JSONExtractScalar">JSONExtractScalar</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JSONBExtract">JSONBExtract</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#JSONBExtractScalar">JSONBExtractScalar</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Least">Least</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Length">Length</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Levenshtein">Levenshtein</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Ln">Ln</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Log">Log</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Log2">Log2</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Log10">Log10</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#LogicalOr">LogicalOr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Lower">Lower</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Map">Map</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#VarMap">VarMap</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Matches">Matches</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Max">Max</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Min">Min</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Month">Month</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Nvl2">Nvl2</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Posexplode">Posexplode</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Pow">Pow</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#PercentileCont">PercentileCont</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#PercentileDisc">PercentileDisc</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Quantile">Quantile</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Quantiles">Quantiles</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#QuantileIf">QuantileIf</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ApproxQuantile">ApproxQuantile</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#ReadCSV">ReadCSV</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Reduce">Reduce</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RegexpLike">RegexpLike</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RegexpILike">RegexpILike</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RegexpSplit">RegexpSplit</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Repeat">Repeat</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Round">Round</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#RowNumber">RowNumber</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SafeDivide">SafeDivide</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SetAgg">SetAgg</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#SortArray">SortArray</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Split">Split</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Substring">Substring</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StrPosition">StrPosition</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StrToDate">StrToDate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StrToTime">StrToTime</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StrToUnix">StrToUnix</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#NumberToStr">NumberToStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Struct">Struct</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StructExtract">StructExtract</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Sum">Sum</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Sqrt">Sqrt</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Stddev">Stddev</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StddevPop">StddevPop</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#StddevSamp">StddevSamp</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeToStr">TimeToStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeToTimeStr">TimeToTimeStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeToUnix">TimeToUnix</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeStrToDate">TimeStrToDate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeStrToTime">TimeStrToTime</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TimeStrToUnix">TimeStrToUnix</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Trim">Trim</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TsOrDsAdd">TsOrDsAdd</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TsOrDsToDateStr">TsOrDsToDateStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TsOrDsToDate">TsOrDsToDate</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#TsOrDiToDi">TsOrDiToDi</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Unhex">Unhex</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UnixToStr">UnixToStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UnixToTime">UnixToTime</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#UnixToTimeStr">UnixToTimeStr</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Upper">Upper</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Variance">Variance</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#VariancePop">VariancePop</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Week">Week</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Year">Year</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Use">Use</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#Merge">Merge</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="class" href="#When">When</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="function" href="#maybe_parse">maybe_parse</a> + </li> + <li> + <a class="function" href="#union">union</a> + </li> + <li> + <a class="function" href="#intersect">intersect</a> + </li> + <li> + <a class="function" href="#except_">except_</a> + </li> + <li> + <a class="function" href="#select">select</a> + </li> + <li> + <a class="function" href="#from_">from_</a> + </li> + <li> + <a class="function" href="#update">update</a> + </li> + <li> + <a class="function" href="#delete">delete</a> + </li> + <li> + <a class="function" href="#condition">condition</a> + </li> + <li> + <a class="function" href="#and_">and_</a> + </li> + <li> + <a class="function" href="#or_">or_</a> + </li> + <li> + <a class="function" href="#not_">not_</a> + </li> + <li> + <a class="function" href="#paren">paren</a> + </li> + <li> + <a class="function" href="#to_identifier">to_identifier</a> + </li> + <li> + <a class="function" href="#to_interval">to_interval</a> + </li> + <li> + <a class="function" href="#to_table">to_table</a> + </li> + <li> + <a class="function" href="#to_column">to_column</a> + </li> + <li> + <a class="function" href="#alias_">alias_</a> + </li> + <li> + <a class="function" href="#subquery">subquery</a> + </li> + <li> + <a class="function" href="#column">column</a> + </li> + <li> + <a class="function" href="#cast">cast</a> + </li> + <li> + <a class="function" href="#table_">table_</a> + </li> + <li> + <a class="function" href="#values">values</a> + </li> + <li> + <a class="function" href="#rename_table">rename_table</a> + </li> + <li> + <a class="function" href="#convert">convert</a> + </li> + <li> + <a class="function" href="#replace_children">replace_children</a> + </li> + <li> + <a class="function" href="#column_table_names">column_table_names</a> + </li> + <li> + <a class="function" href="#table_name">table_name</a> + </li> + <li> + <a class="function" href="#replace_tables">replace_tables</a> + </li> + <li> + <a class="function" href="#replace_placeholders">replace_placeholders</a> + </li> + <li> + <a class="function" href="#expand">expand</a> + </li> + <li> + <a class="function" href="#func">func</a> + </li> + <li> + <a class="function" href="#true">true</a> + </li> + <li> + <a class="function" href="#false">false</a> + </li> + <li> + <a class="function" href="#null">null</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/expressions.py">Edit on GitHub</a> + + <div class="docstring"><h2 id="expressions">Expressions</h2> + +<p>Every AST node in SQLGlot is represented by a subclass of <code><a href="#Expression">Expression</a></code>.</p> + +<p>This module contains the implementation of all supported <code><a href="#Expression">Expression</a></code> types. Additionally, +it exposes a number of helper functions, which are mainly used to programmatically build +SQL expressions, such as <code><a href="#select">sqlglot.expressions.select</a></code>.</p> + +<hr /> +</div> + + <input id="mod-expressions-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-expressions-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="sd">"""</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="sd">## Expressions</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="sd">Every AST node in SQLGlot is represented by a subclass of `Expression`.</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="sd">This module contains the implementation of all supported `Expression` types. Additionally,</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="sd">it exposes a number of helper functions, which are mainly used to programmatically build</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd">SQL expressions, such as `sqlglot.expressions.select`.</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="sd">----</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd">"""</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="kn">import</span> <span class="nn">datetime</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">import</span> <span class="nn">math</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="kn">import</span> <span class="nn">numbers</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="kn">import</span> <span class="nn">re</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">deque</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">auto</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ParseError</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">AutoName</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">camel_to_snake_case</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">ensure_collection</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">seq_get</span><span class="p">,</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">split_num_words</span><span class="p">,</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">subclasses</span><span class="p">,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="p">)</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">Token</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">DialectType</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a><span class="k">class</span> <span class="nc">_Expression</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">):</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">)</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="c1"># When an Expression class is created, its key is automatically set to be</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="c1"># the lowercase version of the class' name.</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">clsname</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="c1"># This is so that docstrings are not inherited in pdoc</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">klass</span><span class="o">.</span><span class="vm">__doc__</span> <span class="o">=</span> <span class="n">klass</span><span class="o">.</span><span class="vm">__doc__</span> <span class="ow">or</span> <span class="s2">""</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">return</span> <span class="n">klass</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="k">class</span> <span class="nc">Expression</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Expression</span><span class="p">):</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> context, such as its child expressions, their names (arg keys), and whether a given child expression</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> is optional or not.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="sd"> Attributes:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a><span class="sd"> key: a unique key for each class in the Expression hierarchy. This is useful for hashing</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a><span class="sd"> and representing expressions as strings.</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> arg_types: determines what arguments (child nodes) are supported by an expression. It</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="sd"> maps arg keys to booleans that indicate whether the corresponding args are optional.</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a><span class="sd"> Example:</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a><span class="sd"> >>> class Foo(Expression):</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="sd"> ... arg_types = {"this": True, "expression": False}</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="sd"> The above definition informs us that Foo is an Expression that requires an argument called</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a><span class="sd"> "this" and may also optionally receive an argument called "expression".</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="sd"> Args:</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a><span class="sd"> args: a mapping used for retrieving the arguments of an expression, given their arg keys.</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="sd"> parent: a reference to the parent expression (or None, in case of root expressions).</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a><span class="sd"> arg_key: the arg key an expression is associated with, i.e. the name its parent expression</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="sd"> uses to refer to it.</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="sd"> comments: a list of comments that are associated with a given expression. This is used in</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="sd"> order to preserve comments when transpiling SQL code.</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="sd"> _type: the `sqlglot.expressions.DataType` type of an expression. This is inferred by the</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd"> optimizer, in order to enable some transformations that require type information.</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a><span class="sd"> """</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">key</span> <span class="o">=</span> <span class="s2">"expression"</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"args"</span><span class="p">,</span> <span class="s2">"parent"</span><span class="p">,</span> <span class="s2">"arg_key"</span><span class="p">,</span> <span class="s2">"comments"</span><span class="p">,</span> <span class="s2">"_type"</span><span class="p">)</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="n">args</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">for</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">return</span> <span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">type</span><span class="p">(</span><span class="n">other</span><span class="p">)</span> <span class="ow">and</span> <span class="n">_norm_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">==</span> <span class="n">_norm_args</span><span class="p">(</span><span class="n">other</span><span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos"> 100</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos"> 101</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">(</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos"> 102</span></a> <span class="p">(</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos"> 103</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">,</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos"> 104</span></a> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos"> 105</span></a> <span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="k">else</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">_norm_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos"> 106</span></a> <span class="p">),</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos"> 107</span></a> <span class="p">)</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos"> 108</span></a> <span class="p">)</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos"> 109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos"> 110</span></a> <span class="nd">@property</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos"> 111</span></a> <span class="k">def</span> <span class="nf">this</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos"> 112</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos"> 113</span></a><span class="sd"> Retrieves the argument with key "this".</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos"> 114</span></a><span class="sd"> """</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos"> 115</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos"> 116</span></a> +</span><span id="L-117"><a href="#L-117"><span class="linenos"> 117</span></a> <span class="nd">@property</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos"> 118</span></a> <span class="k">def</span> <span class="nf">expression</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos"> 119</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos"> 120</span></a><span class="sd"> Retrieves the argument with key "expression".</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos"> 121</span></a><span class="sd"> """</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos"> 122</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos"> 123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos"> 124</span></a> <span class="nd">@property</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos"> 125</span></a> <span class="k">def</span> <span class="nf">expressions</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos"> 126</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos"> 127</span></a><span class="sd"> Retrieves the argument with key "expressions".</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos"> 128</span></a><span class="sd"> """</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos"> 129</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos"> 130</span></a> +</span><span id="L-131"><a href="#L-131"><span class="linenos"> 131</span></a> <span class="k">def</span> <span class="nf">text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos"> 132</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos"> 133</span></a><span class="sd"> Returns a textual representation of the argument corresponding to "key". This can only be used</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos"> 134</span></a><span class="sd"> for args that are strings or leaf Expression instances, such as identifiers and literals.</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos"> 135</span></a><span class="sd"> """</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos"> 136</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos"> 137</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos"> 138</span></a> <span class="k">return</span> <span class="n">field</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos"> 139</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="p">(</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">Literal</span><span class="p">,</span> <span class="n">Var</span><span class="p">)):</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos"> 140</span></a> <span class="k">return</span> <span class="n">field</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos"> 141</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="p">(</span><span class="n">Star</span><span class="p">,</span> <span class="n">Null</span><span class="p">)):</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos"> 142</span></a> <span class="k">return</span> <span class="n">field</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos"> 143</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos"> 144</span></a> +</span><span id="L-145"><a href="#L-145"><span class="linenos"> 145</span></a> <span class="nd">@property</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos"> 146</span></a> <span class="k">def</span> <span class="nf">is_string</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos"> 147</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos"> 148</span></a><span class="sd"> Checks whether a Literal expression is a string.</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos"> 149</span></a><span class="sd"> """</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos"> 150</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Literal</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos"> 151</span></a> +</span><span id="L-152"><a href="#L-152"><span class="linenos"> 152</span></a> <span class="nd">@property</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos"> 153</span></a> <span class="k">def</span> <span class="nf">is_number</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos"> 154</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos"> 155</span></a><span class="sd"> Checks whether a Literal expression is a number.</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos"> 156</span></a><span class="sd"> """</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos"> 157</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Literal</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos"> 158</span></a> +</span><span id="L-159"><a href="#L-159"><span class="linenos"> 159</span></a> <span class="nd">@property</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos"> 160</span></a> <span class="k">def</span> <span class="nf">is_int</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos"> 161</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos"> 162</span></a><span class="sd"> Checks whether a Literal expression is an integer.</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos"> 163</span></a><span class="sd"> """</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos"> 164</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos"> 165</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos"> 166</span></a> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos"> 167</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos"> 168</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos"> 169</span></a> <span class="k">pass</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos"> 170</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos"> 171</span></a> +</span><span id="L-172"><a href="#L-172"><span class="linenos"> 172</span></a> <span class="nd">@property</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos"> 173</span></a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos"> 174</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos"> 175</span></a><span class="sd"> Returns the alias of the expression, or an empty string if it's not aliased.</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos"> 176</span></a><span class="sd"> """</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos"> 177</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">TableAlias</span><span class="p">):</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos"> 178</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos"> 179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos"> 180</span></a> +</span><span id="L-181"><a href="#L-181"><span class="linenos"> 181</span></a> <span class="nd">@property</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos"> 182</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos"> 183</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos"> 184</span></a> +</span><span id="L-185"><a href="#L-185"><span class="linenos"> 185</span></a> <span class="nd">@property</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos"> 186</span></a> <span class="k">def</span> <span class="nf">alias_or_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos"> 187</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos"> 188</span></a> +</span><span id="L-189"><a href="#L-189"><span class="linenos"> 189</span></a> <span class="nd">@property</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos"> 190</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos"> 191</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos"> 192</span></a><span class="sd"> Name of the output column if this expression is a selection.</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos"> 193</span></a> +</span><span id="L-194"><a href="#L-194"><span class="linenos"> 194</span></a><span class="sd"> If the Expression has no output name, an empty string is returned.</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos"> 195</span></a> +</span><span id="L-196"><a href="#L-196"><span class="linenos"> 196</span></a><span class="sd"> Example:</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos"> 197</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos"> 198</span></a><span class="sd"> >>> parse_one("SELECT a").expressions[0].output_name</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos"> 199</span></a><span class="sd"> 'a'</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos"> 200</span></a><span class="sd"> >>> parse_one("SELECT b AS c").expressions[0].output_name</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos"> 201</span></a><span class="sd"> 'c'</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos"> 202</span></a><span class="sd"> >>> parse_one("SELECT 1 + 2").expressions[0].output_name</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos"> 203</span></a><span class="sd"> ''</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos"> 204</span></a><span class="sd"> """</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos"> 205</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos"> 206</span></a> +</span><span id="L-207"><a href="#L-207"><span class="linenos"> 207</span></a> <span class="nd">@property</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos"> 208</span></a> <span class="k">def</span> <span class="nf">type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span><span class="p">]:</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos"> 209</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos"> 210</span></a> +</span><span id="L-211"><a href="#L-211"><span class="linenos"> 211</span></a> <span class="nd">@type</span><span class="o">.</span><span class="n">setter</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos"> 212</span></a> <span class="k">def</span> <span class="nf">type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span> <span class="o">|</span> <span class="nb">str</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos"> 213</span></a> <span class="k">if</span> <span class="n">dtype</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos"> 214</span></a> <span class="n">dtype</span> <span class="o">=</span> <span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos"> 215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span> <span class="o">=</span> <span class="n">dtype</span> <span class="c1"># type: ignore</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos"> 216</span></a> +</span><span id="L-217"><a href="#L-217"><span class="linenos"> 217</span></a> <span class="k">def</span> <span class="nf">__deepcopy__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">memo</span><span class="p">):</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos"> 218</span></a> <span class="n">copy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="o">**</span><span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">))</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos"> 219</span></a> <span class="n">copy</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos"> 220</span></a> <span class="n">copy</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos"> 221</span></a> <span class="k">return</span> <span class="n">copy</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos"> 222</span></a> +</span><span id="L-223"><a href="#L-223"><span class="linenos"> 223</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos"> 224</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos"> 225</span></a><span class="sd"> Returns a deep copy of the expression.</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos"> 226</span></a><span class="sd"> """</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos"> 227</span></a> <span class="n">new</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos"> 228</span></a> <span class="n">new</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos"> 229</span></a> <span class="k">for</span> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">new</span><span class="o">.</span><span class="n">bfs</span><span class="p">():</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos"> 230</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Expression</span><span class="p">)</span> <span class="ow">and</span> <span class="n">parent</span><span class="p">:</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos"> 231</span></a> <span class="n">item</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos"> 232</span></a> <span class="k">return</span> <span class="n">new</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos"> 233</span></a> +</span><span id="L-234"><a href="#L-234"><span class="linenos"> 234</span></a> <span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos"> 235</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos"> 236</span></a><span class="sd"> Appends value to arg_key if it's a list or sets it as a new list.</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos"> 237</span></a> +</span><span id="L-238"><a href="#L-238"><span class="linenos"> 238</span></a><span class="sd"> Args:</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos"> 239</span></a><span class="sd"> arg_key (str): name of the list expression arg</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos"> 240</span></a><span class="sd"> value (Any): value to append to the list</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos"> 241</span></a><span class="sd"> """</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos"> 242</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg_key</span><span class="p">),</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos"> 243</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos"> 244</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos"> 245</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos"> 246</span></a> +</span><span id="L-247"><a href="#L-247"><span class="linenos"> 247</span></a> <span class="k">def</span> <span class="nf">set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos"> 248</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos"> 249</span></a><span class="sd"> Sets `arg_key` to `value`.</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos"> 250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos"> 251</span></a><span class="sd"> Args:</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos"> 252</span></a><span class="sd"> arg_key (str): name of the expression arg.</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos"> 253</span></a><span class="sd"> value: value to set the arg to.</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos"> 254</span></a><span class="sd"> """</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos"> 255</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos"> 256</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos"> 257</span></a> +</span><span id="L-258"><a href="#L-258"><span class="linenos"> 258</span></a> <span class="k">def</span> <span class="nf">_set_parent</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos"> 259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos"> 260</span></a> <span class="n">value</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos"> 261</span></a> <span class="n">value</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">=</span> <span class="n">arg_key</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos"> 262</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos"> 263</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="p">:</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos"> 264</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos"> 265</span></a> <span class="n">v</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos"> 266</span></a> <span class="n">v</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">=</span> <span class="n">arg_key</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos"> 267</span></a> +</span><span id="L-268"><a href="#L-268"><span class="linenos"> 268</span></a> <span class="nd">@property</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos"> 269</span></a> <span class="k">def</span> <span class="nf">depth</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos"> 270</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos"> 271</span></a><span class="sd"> Returns the depth of this tree.</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos"> 272</span></a><span class="sd"> """</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos"> 273</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos"> 274</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">depth</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos"> 275</span></a> <span class="k">return</span> <span class="mi">0</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos"> 276</span></a> +</span><span id="L-277"><a href="#L-277"><span class="linenos"> 277</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos"> 278</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos"> 279</span></a><span class="sd"> Returns the first node in this tree which matches at least one of</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos"> 280</span></a><span class="sd"> the specified types.</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos"> 281</span></a> +</span><span id="L-282"><a href="#L-282"><span class="linenos"> 282</span></a><span class="sd"> Args:</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos"> 283</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos"> 284</span></a> +</span><span id="L-285"><a href="#L-285"><span class="linenos"> 285</span></a><span class="sd"> Returns:</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos"> 286</span></a><span class="sd"> The node which matches the criteria or None if no such node was found.</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos"> 287</span></a><span class="sd"> """</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos"> 288</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos"> 289</span></a> +</span><span id="L-290"><a href="#L-290"><span class="linenos"> 290</span></a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos"> 291</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos"> 292</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree and only</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos"> 293</span></a><span class="sd"> yields those that match at least one of the specified expression types.</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos"> 294</span></a> +</span><span id="L-295"><a href="#L-295"><span class="linenos"> 295</span></a><span class="sd"> Args:</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos"> 296</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos"> 297</span></a> +</span><span id="L-298"><a href="#L-298"><span class="linenos"> 298</span></a><span class="sd"> Returns:</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos"> 299</span></a><span class="sd"> The generator object.</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos"> 300</span></a><span class="sd"> """</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos"> 301</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">):</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos"> 302</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos"> 303</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos"> 304</span></a> +</span><span id="L-305"><a href="#L-305"><span class="linenos"> 305</span></a> <span class="k">def</span> <span class="nf">find_ancestor</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">):</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos"> 306</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos"> 307</span></a><span class="sd"> Returns a nearest parent matching expression_types.</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos"> 308</span></a> +</span><span id="L-309"><a href="#L-309"><span class="linenos"> 309</span></a><span class="sd"> Args:</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos"> 310</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos"> 311</span></a> +</span><span id="L-312"><a href="#L-312"><span class="linenos"> 312</span></a><span class="sd"> Returns:</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos"> 313</span></a><span class="sd"> The parent node.</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos"> 314</span></a><span class="sd"> """</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos"> 315</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos"> 316</span></a> <span class="k">while</span> <span class="n">ancestor</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos"> 317</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="n">ancestor</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos"> 318</span></a> <span class="k">return</span> <span class="n">ancestor</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos"> 319</span></a> +</span><span id="L-320"><a href="#L-320"><span class="linenos"> 320</span></a> <span class="nd">@property</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos"> 321</span></a> <span class="k">def</span> <span class="nf">parent_select</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos"> 322</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos"> 323</span></a><span class="sd"> Returns the parent select statement.</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos"> 324</span></a><span class="sd"> """</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos"> 325</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos"> 326</span></a> +</span><span id="L-327"><a href="#L-327"><span class="linenos"> 327</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos"> 328</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos"> 329</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree.</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos"> 330</span></a> +</span><span id="L-331"><a href="#L-331"><span class="linenos"> 331</span></a><span class="sd"> Args:</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos"> 332</span></a><span class="sd"> bfs (bool): if set to True the BFS traversal order will be applied,</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos"> 333</span></a><span class="sd"> otherwise the DFS traversal will be used instead.</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos"> 334</span></a><span class="sd"> prune ((node, parent, arg_key) -> bool): callable that returns True if</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos"> 335</span></a><span class="sd"> the generator should stop traversing this branch of the tree.</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos"> 336</span></a> +</span><span id="L-337"><a href="#L-337"><span class="linenos"> 337</span></a><span class="sd"> Returns:</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos"> 338</span></a><span class="sd"> the generator object.</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos"> 339</span></a><span class="sd"> """</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos"> 340</span></a> <span class="k">if</span> <span class="n">bfs</span><span class="p">:</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos"> 341</span></a> <span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">bfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="n">prune</span><span class="p">)</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos"> 342</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos"> 343</span></a> <span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="n">prune</span><span class="p">)</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos"> 344</span></a> +</span><span id="L-345"><a href="#L-345"><span class="linenos"> 345</span></a> <span class="k">def</span> <span class="nf">dfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos"> 346</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos"> 347</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree in</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos"> 348</span></a><span class="sd"> the DFS (Depth-first) order.</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos"> 349</span></a> +</span><span id="L-350"><a href="#L-350"><span class="linenos"> 350</span></a><span class="sd"> Returns:</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos"> 351</span></a><span class="sd"> The generator object.</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos"> 352</span></a><span class="sd"> """</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos"> 353</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos"> 354</span></a> <span class="k">yield</span> <span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos"> 355</span></a> <span class="k">if</span> <span class="n">prune</span> <span class="ow">and</span> <span class="n">prune</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos"> 356</span></a> <span class="k">return</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos"> 357</span></a> +</span><span id="L-358"><a href="#L-358"><span class="linenos"> 358</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos"> 359</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos"> 360</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos"> 361</span></a> <span class="k">yield from</span> <span class="n">node</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">prune</span><span class="p">)</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos"> 362</span></a> +</span><span id="L-363"><a href="#L-363"><span class="linenos"> 363</span></a> <span class="k">def</span> <span class="nf">bfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos"> 364</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos"> 365</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree in</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos"> 366</span></a><span class="sd"> the BFS (Breadth-first) order.</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos"> 367</span></a> +</span><span id="L-368"><a href="#L-368"><span class="linenos"> 368</span></a><span class="sd"> Returns:</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos"> 369</span></a><span class="sd"> The generator object.</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos"> 370</span></a><span class="sd"> """</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos"> 371</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="n">deque</span><span class="p">([(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="kc">None</span><span class="p">)])</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos"> 372</span></a> +</span><span id="L-373"><a href="#L-373"><span class="linenos"> 373</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos"> 374</span></a> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">popleft</span><span class="p">()</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos"> 375</span></a> +</span><span id="L-376"><a href="#L-376"><span class="linenos"> 376</span></a> <span class="k">yield</span> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos"> 377</span></a> <span class="k">if</span> <span class="n">prune</span> <span class="ow">and</span> <span class="n">prune</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos"> 378</span></a> <span class="k">continue</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos"> 379</span></a> +</span><span id="L-380"><a href="#L-380"><span class="linenos"> 380</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos"> 381</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">item</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos"> 382</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos"> 383</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos"> 384</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">node</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">k</span><span class="p">))</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos"> 385</span></a> +</span><span id="L-386"><a href="#L-386"><span class="linenos"> 386</span></a> <span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos"> 387</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos"> 388</span></a><span class="sd"> Returns the first non parenthesis child or self.</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos"> 389</span></a><span class="sd"> """</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos"> 390</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos"> 391</span></a> <span class="k">while</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Paren</span><span class="p">):</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos"> 392</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos"> 393</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos"> 394</span></a> +</span><span id="L-395"><a href="#L-395"><span class="linenos"> 395</span></a> <span class="k">def</span> <span class="nf">unalias</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos"> 396</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos"> 397</span></a><span class="sd"> Returns the inner expression if this is an Alias.</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos"> 398</span></a><span class="sd"> """</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos"> 399</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Alias</span><span class="p">):</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos"> 400</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos"> 401</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos"> 402</span></a> +</span><span id="L-403"><a href="#L-403"><span class="linenos"> 403</span></a> <span class="k">def</span> <span class="nf">unnest_operands</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos"> 404</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos"> 405</span></a><span class="sd"> Returns unnested operands as a tuple.</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos"> 406</span></a><span class="sd"> """</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos"> 407</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">arg</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">if</span> <span class="n">arg</span><span class="p">)</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos"> 408</span></a> +</span><span id="L-409"><a href="#L-409"><span class="linenos"> 409</span></a> <span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">unnest</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos"> 410</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos"> 411</span></a><span class="sd"> Returns a generator which yields child nodes who's parents are the same class.</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos"> 412</span></a> +</span><span id="L-413"><a href="#L-413"><span class="linenos"> 413</span></a><span class="sd"> A AND B AND C -> [A, B, C]</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos"> 414</span></a><span class="sd"> """</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos"> 415</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="k">lambda</span> <span class="n">n</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="n">p</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)):</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos"> 416</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">):</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos"> 417</span></a> <span class="k">yield</span> <span class="n">node</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> <span class="k">if</span> <span class="n">unnest</span> <span class="k">else</span> <span class="n">node</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos"> 418</span></a> +</span><span id="L-419"><a href="#L-419"><span class="linenos"> 419</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos"> 420</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos"> 421</span></a> +</span><span id="L-422"><a href="#L-422"><span class="linenos"> 422</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos"> 423</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_s</span><span class="p">()</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos"> 424</span></a> +</span><span id="L-425"><a href="#L-425"><span class="linenos"> 425</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos"> 426</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos"> 427</span></a><span class="sd"> Returns SQL string representation of this tree.</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos"> 428</span></a> +</span><span id="L-429"><a href="#L-429"><span class="linenos"> 429</span></a><span class="sd"> Args:</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos"> 430</span></a><span class="sd"> dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos"> 431</span></a><span class="sd"> opts: other `sqlglot.generator.Generator` options.</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos"> 432</span></a> +</span><span id="L-433"><a href="#L-433"><span class="linenos"> 433</span></a><span class="sd"> Returns:</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos"> 434</span></a><span class="sd"> The SQL string.</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos"> 435</span></a><span class="sd"> """</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos"> 436</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="L-437"><a href="#L-437"><span class="linenos"> 437</span></a> +</span><span id="L-438"><a href="#L-438"><span class="linenos"> 438</span></a> <span class="k">return</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">dialect</span><span class="p">)()</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos"> 439</span></a> +</span><span id="L-440"><a href="#L-440"><span class="linenos"> 440</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">hide_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos"> 441</span></a> <span class="n">indent</span> <span class="o">=</span> <span class="s2">""</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">level</span> <span class="k">else</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos"> 442</span></a> <span class="n">indent</span> <span class="o">+=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s2">" "</span><span class="p">]</span> <span class="o">*</span> <span class="n">level</span><span class="p">)</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos"> 443</span></a> <span class="n">left</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> "</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos"> 444</span></a> +</span><span id="L-445"><a href="#L-445"><span class="linenos"> 445</span></a> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos"> 446</span></a> <span class="n">k</span><span class="p">:</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos"> 447</span></a> <span class="n">v</span><span class="o">.</span><span class="n">_to_s</span><span class="p">(</span><span class="n">hide_missing</span><span class="o">=</span><span class="n">hide_missing</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos"> 448</span></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="s2">"_to_s"</span><span class="p">)</span> +</span><span id="L-449"><a href="#L-449"><span class="linenos"> 449</span></a> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos"> 450</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">vs</span><span class="p">)</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos"> 451</span></a> <span class="k">if</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos"> 452</span></a> <span class="p">)</span> +</span><span id="L-453"><a href="#L-453"><span class="linenos"> 453</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">vs</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos"> 454</span></a> <span class="p">}</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos"> 455</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"comments"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos"> 456</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos"> 457</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">v</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">hide_missing</span><span class="p">}</span> +</span><span id="L-458"><a href="#L-458"><span class="linenos"> 458</span></a> +</span><span id="L-459"><a href="#L-459"><span class="linenos"> 459</span></a> <span class="n">right</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">v</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos"> 460</span></a> <span class="n">right</span> <span class="o">+=</span> <span class="s2">")"</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos"> 461</span></a> +</span><span id="L-462"><a href="#L-462"><span class="linenos"> 462</span></a> <span class="k">return</span> <span class="n">indent</span> <span class="o">+</span> <span class="n">left</span> <span class="o">+</span> <span class="n">right</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos"> 463</span></a> +</span><span id="L-464"><a href="#L-464"><span class="linenos"> 464</span></a> <span class="k">def</span> <span class="nf">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fun</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-465"><a href="#L-465"><span class="linenos"> 465</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-466"><a href="#L-466"><span class="linenos"> 466</span></a><span class="sd"> Recursively visits all tree nodes (excluding already transformed ones)</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos"> 467</span></a><span class="sd"> and applies the given transformation function to each node.</span> +</span><span id="L-468"><a href="#L-468"><span class="linenos"> 468</span></a> +</span><span id="L-469"><a href="#L-469"><span class="linenos"> 469</span></a><span class="sd"> Args:</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos"> 470</span></a><span class="sd"> fun (function): a function which takes a node as an argument and returns a</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos"> 471</span></a><span class="sd"> new transformed node or the same node without modifications. If the function</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos"> 472</span></a><span class="sd"> returns None, then the corresponding node will be removed from the syntax tree.</span> +</span><span id="L-473"><a href="#L-473"><span class="linenos"> 473</span></a><span class="sd"> copy (bool): if set to True a new tree instance is constructed, otherwise the tree is</span> +</span><span id="L-474"><a href="#L-474"><span class="linenos"> 474</span></a><span class="sd"> modified in place.</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos"> 475</span></a> +</span><span id="L-476"><a href="#L-476"><span class="linenos"> 476</span></a><span class="sd"> Returns:</span> +</span><span id="L-477"><a href="#L-477"><span class="linenos"> 477</span></a><span class="sd"> The transformed tree.</span> +</span><span id="L-478"><a href="#L-478"><span class="linenos"> 478</span></a><span class="sd"> """</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos"> 479</span></a> <span class="n">node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="k">if</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos"> 480</span></a> <span class="n">new_node</span> <span class="o">=</span> <span class="n">fun</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-481"><a href="#L-481"><span class="linenos"> 481</span></a> +</span><span id="L-482"><a href="#L-482"><span class="linenos"> 482</span></a> <span class="k">if</span> <span class="n">new_node</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">new_node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos"> 483</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos"> 484</span></a> <span class="k">if</span> <span class="n">new_node</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">node</span><span class="p">:</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos"> 485</span></a> <span class="n">new_node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos"> 486</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="L-487"><a href="#L-487"><span class="linenos"> 487</span></a> +</span><span id="L-488"><a href="#L-488"><span class="linenos"> 488</span></a> <span class="n">replace_children</span><span class="p">(</span><span class="n">new_node</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">child</span><span class="p">:</span> <span class="n">child</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">fun</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos"> 489</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos"> 490</span></a> +</span><span id="L-491"><a href="#L-491"><span class="linenos"> 491</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-492"><a href="#L-492"><span class="linenos"> 492</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos"> 493</span></a><span class="sd"> Swap out this expression with a new expression.</span> +</span><span id="L-494"><a href="#L-494"><span class="linenos"> 494</span></a> +</span><span id="L-495"><a href="#L-495"><span class="linenos"> 495</span></a><span class="sd"> For example::</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos"> 496</span></a> +</span><span id="L-497"><a href="#L-497"><span class="linenos"> 497</span></a><span class="sd"> >>> tree = Select().select("x").from_("tbl")</span> +</span><span id="L-498"><a href="#L-498"><span class="linenos"> 498</span></a><span class="sd"> >>> tree.find(Column).replace(Column(this="y"))</span> +</span><span id="L-499"><a href="#L-499"><span class="linenos"> 499</span></a><span class="sd"> (COLUMN this: y)</span> +</span><span id="L-500"><a href="#L-500"><span class="linenos"> 500</span></a><span class="sd"> >>> tree.sql()</span> +</span><span id="L-501"><a href="#L-501"><span class="linenos"> 501</span></a><span class="sd"> 'SELECT y FROM tbl'</span> +</span><span id="L-502"><a href="#L-502"><span class="linenos"> 502</span></a> +</span><span id="L-503"><a href="#L-503"><span class="linenos"> 503</span></a><span class="sd"> Args:</span> +</span><span id="L-504"><a href="#L-504"><span class="linenos"> 504</span></a><span class="sd"> expression (Expression|None): new node</span> +</span><span id="L-505"><a href="#L-505"><span class="linenos"> 505</span></a> +</span><span id="L-506"><a href="#L-506"><span class="linenos"> 506</span></a><span class="sd"> Returns:</span> +</span><span id="L-507"><a href="#L-507"><span class="linenos"> 507</span></a><span class="sd"> The new expression or expressions.</span> +</span><span id="L-508"><a href="#L-508"><span class="linenos"> 508</span></a><span class="sd"> """</span> +</span><span id="L-509"><a href="#L-509"><span class="linenos"> 509</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> +</span><span id="L-510"><a href="#L-510"><span class="linenos"> 510</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-511"><a href="#L-511"><span class="linenos"> 511</span></a> +</span><span id="L-512"><a href="#L-512"><span class="linenos"> 512</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-513"><a href="#L-513"><span class="linenos"> 513</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-514"><a href="#L-514"><span class="linenos"> 514</span></a> +</span><span id="L-515"><a href="#L-515"><span class="linenos"> 515</span></a> <span class="n">replace_children</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">child</span><span class="p">:</span> <span class="n">expression</span> <span class="k">if</span> <span class="n">child</span> <span class="ow">is</span> <span class="bp">self</span> <span class="k">else</span> <span class="n">child</span><span class="p">)</span> +</span><span id="L-516"><a href="#L-516"><span class="linenos"> 516</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-517"><a href="#L-517"><span class="linenos"> 517</span></a> +</span><span id="L-518"><a href="#L-518"><span class="linenos"> 518</span></a> <span class="k">def</span> <span class="nf">pop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-519"><a href="#L-519"><span class="linenos"> 519</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-520"><a href="#L-520"><span class="linenos"> 520</span></a><span class="sd"> Remove this expression from its AST.</span> +</span><span id="L-521"><a href="#L-521"><span class="linenos"> 521</span></a><span class="sd"> """</span> +</span><span id="L-522"><a href="#L-522"><span class="linenos"> 522</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> +</span><span id="L-523"><a href="#L-523"><span class="linenos"> 523</span></a> +</span><span id="L-524"><a href="#L-524"><span class="linenos"> 524</span></a> <span class="k">def</span> <span class="nf">assert_is</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_</span><span class="p">):</span> +</span><span id="L-525"><a href="#L-525"><span class="linenos"> 525</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-526"><a href="#L-526"><span class="linenos"> 526</span></a><span class="sd"> Assert that this `Expression` is an instance of `type_`.</span> +</span><span id="L-527"><a href="#L-527"><span class="linenos"> 527</span></a> +</span><span id="L-528"><a href="#L-528"><span class="linenos"> 528</span></a><span class="sd"> If it is NOT an instance of `type_`, this raises an assertion error.</span> +</span><span id="L-529"><a href="#L-529"><span class="linenos"> 529</span></a><span class="sd"> Otherwise, this returns this expression.</span> +</span><span id="L-530"><a href="#L-530"><span class="linenos"> 530</span></a> +</span><span id="L-531"><a href="#L-531"><span class="linenos"> 531</span></a><span class="sd"> Examples:</span> +</span><span id="L-532"><a href="#L-532"><span class="linenos"> 532</span></a><span class="sd"> This is useful for type security in chained expressions:</span> +</span><span id="L-533"><a href="#L-533"><span class="linenos"> 533</span></a> +</span><span id="L-534"><a href="#L-534"><span class="linenos"> 534</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-535"><a href="#L-535"><span class="linenos"> 535</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql()</span> +</span><span id="L-536"><a href="#L-536"><span class="linenos"> 536</span></a><span class="sd"> 'SELECT x, z FROM y'</span> +</span><span id="L-537"><a href="#L-537"><span class="linenos"> 537</span></a><span class="sd"> """</span> +</span><span id="L-538"><a href="#L-538"><span class="linenos"> 538</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_</span><span class="p">)</span> +</span><span id="L-539"><a href="#L-539"><span class="linenos"> 539</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="L-540"><a href="#L-540"><span class="linenos"> 540</span></a> +</span><span id="L-541"><a href="#L-541"><span class="linenos"> 541</span></a> <span class="k">def</span> <span class="nf">error_messages</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-542"><a href="#L-542"><span class="linenos"> 542</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-543"><a href="#L-543"><span class="linenos"> 543</span></a><span class="sd"> Checks if this expression is valid (e.g. all mandatory args are set).</span> +</span><span id="L-544"><a href="#L-544"><span class="linenos"> 544</span></a> +</span><span id="L-545"><a href="#L-545"><span class="linenos"> 545</span></a><span class="sd"> Args:</span> +</span><span id="L-546"><a href="#L-546"><span class="linenos"> 546</span></a><span class="sd"> args: a sequence of values that were used to instantiate a Func expression. This is used</span> +</span><span id="L-547"><a href="#L-547"><span class="linenos"> 547</span></a><span class="sd"> to check that the provided arguments don't exceed the function argument limit.</span> +</span><span id="L-548"><a href="#L-548"><span class="linenos"> 548</span></a> +</span><span id="L-549"><a href="#L-549"><span class="linenos"> 549</span></a><span class="sd"> Returns:</span> +</span><span id="L-550"><a href="#L-550"><span class="linenos"> 550</span></a><span class="sd"> A list of error messages for all possible errors that were found.</span> +</span><span id="L-551"><a href="#L-551"><span class="linenos"> 551</span></a><span class="sd"> """</span> +</span><span id="L-552"><a href="#L-552"><span class="linenos"> 552</span></a> <span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-553"><a href="#L-553"><span class="linenos"> 553</span></a> +</span><span id="L-554"><a href="#L-554"><span class="linenos"> 554</span></a> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="L-555"><a href="#L-555"><span class="linenos"> 555</span></a> <span class="k">if</span> <span class="n">k</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">:</span> +</span><span id="L-556"><a href="#L-556"><span class="linenos"> 556</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unexpected keyword: '</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">' for </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-557"><a href="#L-557"><span class="linenos"> 557</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">mandatory</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-558"><a href="#L-558"><span class="linenos"> 558</span></a> <span class="n">v</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> +</span><span id="L-559"><a href="#L-559"><span class="linenos"> 559</span></a> <span class="k">if</span> <span class="n">mandatory</span> <span class="ow">and</span> <span class="p">(</span><span class="n">v</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">v</span><span class="p">)):</span> +</span><span id="L-560"><a href="#L-560"><span class="linenos"> 560</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Required keyword: '</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">' missing for </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-561"><a href="#L-561"><span class="linenos"> 561</span></a> +</span><span id="L-562"><a href="#L-562"><span class="linenos"> 562</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-563"><a href="#L-563"><span class="linenos"> 563</span></a> <span class="n">args</span> +</span><span id="L-564"><a href="#L-564"><span class="linenos"> 564</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Func</span><span class="p">)</span> +</span><span id="L-565"><a href="#L-565"><span class="linenos"> 565</span></a> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> +</span><span id="L-566"><a href="#L-566"><span class="linenos"> 566</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_var_len_args</span> +</span><span id="L-567"><a href="#L-567"><span class="linenos"> 567</span></a> <span class="p">):</span> +</span><span id="L-568"><a href="#L-568"><span class="linenos"> 568</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-569"><a href="#L-569"><span class="linenos"> 569</span></a> <span class="sa">f</span><span class="s2">"The number of provided arguments (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">) is greater than "</span> +</span><span id="L-570"><a href="#L-570"><span class="linenos"> 570</span></a> <span class="sa">f</span><span class="s2">"the maximum number of supported arguments (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-571"><a href="#L-571"><span class="linenos"> 571</span></a> <span class="p">)</span> +</span><span id="L-572"><a href="#L-572"><span class="linenos"> 572</span></a> +</span><span id="L-573"><a href="#L-573"><span class="linenos"> 573</span></a> <span class="k">return</span> <span class="n">errors</span> +</span><span id="L-574"><a href="#L-574"><span class="linenos"> 574</span></a> +</span><span id="L-575"><a href="#L-575"><span class="linenos"> 575</span></a> <span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-576"><a href="#L-576"><span class="linenos"> 576</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-577"><a href="#L-577"><span class="linenos"> 577</span></a><span class="sd"> Dump this Expression to a JSON-serializable dict.</span> +</span><span id="L-578"><a href="#L-578"><span class="linenos"> 578</span></a><span class="sd"> """</span> +</span><span id="L-579"><a href="#L-579"><span class="linenos"> 579</span></a> <span class="kn">from</span> <span class="nn">sqlglot.serde</span> <span class="kn">import</span> <span class="n">dump</span> +</span><span id="L-580"><a href="#L-580"><span class="linenos"> 580</span></a> +</span><span id="L-581"><a href="#L-581"><span class="linenos"> 581</span></a> <span class="k">return</span> <span class="n">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-582"><a href="#L-582"><span class="linenos"> 582</span></a> +</span><span id="L-583"><a href="#L-583"><span class="linenos"> 583</span></a> <span class="nd">@classmethod</span> +</span><span id="L-584"><a href="#L-584"><span class="linenos"> 584</span></a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span> +</span><span id="L-585"><a href="#L-585"><span class="linenos"> 585</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-586"><a href="#L-586"><span class="linenos"> 586</span></a><span class="sd"> Load a dict (as returned by `Expression.dump`) into an Expression instance.</span> +</span><span id="L-587"><a href="#L-587"><span class="linenos"> 587</span></a><span class="sd"> """</span> +</span><span id="L-588"><a href="#L-588"><span class="linenos"> 588</span></a> <span class="kn">from</span> <span class="nn">sqlglot.serde</span> <span class="kn">import</span> <span class="n">load</span> +</span><span id="L-589"><a href="#L-589"><span class="linenos"> 589</span></a> +</span><span id="L-590"><a href="#L-590"><span class="linenos"> 590</span></a> <span class="k">return</span> <span class="n">load</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> +</span><span id="L-591"><a href="#L-591"><span class="linenos"> 591</span></a> +</span><span id="L-592"><a href="#L-592"><span class="linenos"> 592</span></a> +</span><span id="L-593"><a href="#L-593"><span class="linenos"> 593</span></a><span class="n">IntoType</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span> +</span><span id="L-594"><a href="#L-594"><span class="linenos"> 594</span></a> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-595"><a href="#L-595"><span class="linenos"> 595</span></a> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="L-596"><a href="#L-596"><span class="linenos"> 596</span></a> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">Expression</span><span class="p">]]],</span> +</span><span id="L-597"><a href="#L-597"><span class="linenos"> 597</span></a><span class="p">]</span> +</span><span id="L-598"><a href="#L-598"><span class="linenos"> 598</span></a> +</span><span id="L-599"><a href="#L-599"><span class="linenos"> 599</span></a> +</span><span id="L-600"><a href="#L-600"><span class="linenos"> 600</span></a><span class="k">class</span> <span class="nc">Condition</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-601"><a href="#L-601"><span class="linenos"> 601</span></a> <span class="k">def</span> <span class="nf">and_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-602"><a href="#L-602"><span class="linenos"> 602</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-603"><a href="#L-603"><span class="linenos"> 603</span></a><span class="sd"> AND this condition with one or multiple expressions.</span> +</span><span id="L-604"><a href="#L-604"><span class="linenos"> 604</span></a> +</span><span id="L-605"><a href="#L-605"><span class="linenos"> 605</span></a><span class="sd"> Example:</span> +</span><span id="L-606"><a href="#L-606"><span class="linenos"> 606</span></a><span class="sd"> >>> condition("x=1").and_("y=1").sql()</span> +</span><span id="L-607"><a href="#L-607"><span class="linenos"> 607</span></a><span class="sd"> 'x = 1 AND y = 1'</span> +</span><span id="L-608"><a href="#L-608"><span class="linenos"> 608</span></a> +</span><span id="L-609"><a href="#L-609"><span class="linenos"> 609</span></a><span class="sd"> Args:</span> +</span><span id="L-610"><a href="#L-610"><span class="linenos"> 610</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-611"><a href="#L-611"><span class="linenos"> 611</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-612"><a href="#L-612"><span class="linenos"> 612</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-613"><a href="#L-613"><span class="linenos"> 613</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-614"><a href="#L-614"><span class="linenos"> 614</span></a> +</span><span id="L-615"><a href="#L-615"><span class="linenos"> 615</span></a><span class="sd"> Returns:</span> +</span><span id="L-616"><a href="#L-616"><span class="linenos"> 616</span></a><span class="sd"> And: the new condition.</span> +</span><span id="L-617"><a href="#L-617"><span class="linenos"> 617</span></a><span class="sd"> """</span> +</span><span id="L-618"><a href="#L-618"><span class="linenos"> 618</span></a> <span class="k">return</span> <span class="n">and_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-619"><a href="#L-619"><span class="linenos"> 619</span></a> +</span><span id="L-620"><a href="#L-620"><span class="linenos"> 620</span></a> <span class="k">def</span> <span class="nf">or_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-621"><a href="#L-621"><span class="linenos"> 621</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-622"><a href="#L-622"><span class="linenos"> 622</span></a><span class="sd"> OR this condition with one or multiple expressions.</span> +</span><span id="L-623"><a href="#L-623"><span class="linenos"> 623</span></a> +</span><span id="L-624"><a href="#L-624"><span class="linenos"> 624</span></a><span class="sd"> Example:</span> +</span><span id="L-625"><a href="#L-625"><span class="linenos"> 625</span></a><span class="sd"> >>> condition("x=1").or_("y=1").sql()</span> +</span><span id="L-626"><a href="#L-626"><span class="linenos"> 626</span></a><span class="sd"> 'x = 1 OR y = 1'</span> +</span><span id="L-627"><a href="#L-627"><span class="linenos"> 627</span></a> +</span><span id="L-628"><a href="#L-628"><span class="linenos"> 628</span></a><span class="sd"> Args:</span> +</span><span id="L-629"><a href="#L-629"><span class="linenos"> 629</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-630"><a href="#L-630"><span class="linenos"> 630</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-631"><a href="#L-631"><span class="linenos"> 631</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-632"><a href="#L-632"><span class="linenos"> 632</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-633"><a href="#L-633"><span class="linenos"> 633</span></a> +</span><span id="L-634"><a href="#L-634"><span class="linenos"> 634</span></a><span class="sd"> Returns:</span> +</span><span id="L-635"><a href="#L-635"><span class="linenos"> 635</span></a><span class="sd"> Or: the new condition.</span> +</span><span id="L-636"><a href="#L-636"><span class="linenos"> 636</span></a><span class="sd"> """</span> +</span><span id="L-637"><a href="#L-637"><span class="linenos"> 637</span></a> <span class="k">return</span> <span class="n">or_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-638"><a href="#L-638"><span class="linenos"> 638</span></a> +</span><span id="L-639"><a href="#L-639"><span class="linenos"> 639</span></a> <span class="k">def</span> <span class="nf">not_</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-640"><a href="#L-640"><span class="linenos"> 640</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-641"><a href="#L-641"><span class="linenos"> 641</span></a><span class="sd"> Wrap this condition with NOT.</span> +</span><span id="L-642"><a href="#L-642"><span class="linenos"> 642</span></a> +</span><span id="L-643"><a href="#L-643"><span class="linenos"> 643</span></a><span class="sd"> Example:</span> +</span><span id="L-644"><a href="#L-644"><span class="linenos"> 644</span></a><span class="sd"> >>> condition("x=1").not_().sql()</span> +</span><span id="L-645"><a href="#L-645"><span class="linenos"> 645</span></a><span class="sd"> 'NOT x = 1'</span> +</span><span id="L-646"><a href="#L-646"><span class="linenos"> 646</span></a> +</span><span id="L-647"><a href="#L-647"><span class="linenos"> 647</span></a><span class="sd"> Returns:</span> +</span><span id="L-648"><a href="#L-648"><span class="linenos"> 648</span></a><span class="sd"> Not: the new condition.</span> +</span><span id="L-649"><a href="#L-649"><span class="linenos"> 649</span></a><span class="sd"> """</span> +</span><span id="L-650"><a href="#L-650"><span class="linenos"> 650</span></a> <span class="k">return</span> <span class="n">not_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-651"><a href="#L-651"><span class="linenos"> 651</span></a> +</span><span id="L-652"><a href="#L-652"><span class="linenos"> 652</span></a> +</span><span id="L-653"><a href="#L-653"><span class="linenos"> 653</span></a><span class="k">class</span> <span class="nc">Predicate</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-654"><a href="#L-654"><span class="linenos"> 654</span></a><span class="w"> </span><span class="sd">"""Relationships like x = y, x > 1, x >= y."""</span> +</span><span id="L-655"><a href="#L-655"><span class="linenos"> 655</span></a> +</span><span id="L-656"><a href="#L-656"><span class="linenos"> 656</span></a> +</span><span id="L-657"><a href="#L-657"><span class="linenos"> 657</span></a><span class="k">class</span> <span class="nc">DerivedTable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-658"><a href="#L-658"><span class="linenos"> 658</span></a> <span class="nd">@property</span> +</span><span id="L-659"><a href="#L-659"><span class="linenos"> 659</span></a> <span class="k">def</span> <span class="nf">alias_column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-660"><a href="#L-660"><span class="linenos"> 660</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-661"><a href="#L-661"><span class="linenos"> 661</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_alias</span><span class="p">:</span> +</span><span id="L-662"><a href="#L-662"><span class="linenos"> 662</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-663"><a href="#L-663"><span class="linenos"> 663</span></a> <span class="n">column_list</span> <span class="o">=</span> <span class="n">table_alias</span><span class="o">.</span><span class="n">assert_is</span><span class="p">(</span><span class="n">TableAlias</span><span class="p">)</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-664"><a href="#L-664"><span class="linenos"> 664</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">column_list</span><span class="p">]</span> +</span><span id="L-665"><a href="#L-665"><span class="linenos"> 665</span></a> +</span><span id="L-666"><a href="#L-666"><span class="linenos"> 666</span></a> <span class="nd">@property</span> +</span><span id="L-667"><a href="#L-667"><span class="linenos"> 667</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-668"><a href="#L-668"><span class="linenos"> 668</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-669"><a href="#L-669"><span class="linenos"> 669</span></a> +</span><span id="L-670"><a href="#L-670"><span class="linenos"> 670</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-671"><a href="#L-671"><span class="linenos"> 671</span></a> <span class="k">return</span> <span class="n">alias</span><span class="o">.</span><span class="n">columns</span> +</span><span id="L-672"><a href="#L-672"><span class="linenos"> 672</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-673"><a href="#L-673"><span class="linenos"> 673</span></a> +</span><span id="L-674"><a href="#L-674"><span class="linenos"> 674</span></a> <span class="nd">@property</span> +</span><span id="L-675"><a href="#L-675"><span class="linenos"> 675</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-676"><a href="#L-676"><span class="linenos"> 676</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">select</span><span class="o">.</span><span class="n">output_name</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">selects</span><span class="p">]</span> +</span><span id="L-677"><a href="#L-677"><span class="linenos"> 677</span></a> +</span><span id="L-678"><a href="#L-678"><span class="linenos"> 678</span></a> +</span><span id="L-679"><a href="#L-679"><span class="linenos"> 679</span></a><span class="k">class</span> <span class="nc">Unionable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-680"><a href="#L-680"><span class="linenos"> 680</span></a> <span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-681"><a href="#L-681"><span class="linenos"> 681</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-682"><a href="#L-682"><span class="linenos"> 682</span></a><span class="sd"> Builds a UNION expression.</span> +</span><span id="L-683"><a href="#L-683"><span class="linenos"> 683</span></a> +</span><span id="L-684"><a href="#L-684"><span class="linenos"> 684</span></a><span class="sd"> Example:</span> +</span><span id="L-685"><a href="#L-685"><span class="linenos"> 685</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-686"><a href="#L-686"><span class="linenos"> 686</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql()</span> +</span><span id="L-687"><a href="#L-687"><span class="linenos"> 687</span></a><span class="sd"> 'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</span><span id="L-688"><a href="#L-688"><span class="linenos"> 688</span></a> +</span><span id="L-689"><a href="#L-689"><span class="linenos"> 689</span></a><span class="sd"> Args:</span> +</span><span id="L-690"><a href="#L-690"><span class="linenos"> 690</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="L-691"><a href="#L-691"><span class="linenos"> 691</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-692"><a href="#L-692"><span class="linenos"> 692</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="L-693"><a href="#L-693"><span class="linenos"> 693</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-694"><a href="#L-694"><span class="linenos"> 694</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-695"><a href="#L-695"><span class="linenos"> 695</span></a><span class="sd"> Returns:</span> +</span><span id="L-696"><a href="#L-696"><span class="linenos"> 696</span></a><span class="sd"> Union: the Union expression.</span> +</span><span id="L-697"><a href="#L-697"><span class="linenos"> 697</span></a><span class="sd"> """</span> +</span><span id="L-698"><a href="#L-698"><span class="linenos"> 698</span></a> <span class="k">return</span> <span class="n">union</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-699"><a href="#L-699"><span class="linenos"> 699</span></a> +</span><span id="L-700"><a href="#L-700"><span class="linenos"> 700</span></a> <span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-701"><a href="#L-701"><span class="linenos"> 701</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-702"><a href="#L-702"><span class="linenos"> 702</span></a><span class="sd"> Builds an INTERSECT expression.</span> +</span><span id="L-703"><a href="#L-703"><span class="linenos"> 703</span></a> +</span><span id="L-704"><a href="#L-704"><span class="linenos"> 704</span></a><span class="sd"> Example:</span> +</span><span id="L-705"><a href="#L-705"><span class="linenos"> 705</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-706"><a href="#L-706"><span class="linenos"> 706</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql()</span> +</span><span id="L-707"><a href="#L-707"><span class="linenos"> 707</span></a><span class="sd"> 'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</span><span id="L-708"><a href="#L-708"><span class="linenos"> 708</span></a> +</span><span id="L-709"><a href="#L-709"><span class="linenos"> 709</span></a><span class="sd"> Args:</span> +</span><span id="L-710"><a href="#L-710"><span class="linenos"> 710</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="L-711"><a href="#L-711"><span class="linenos"> 711</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-712"><a href="#L-712"><span class="linenos"> 712</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="L-713"><a href="#L-713"><span class="linenos"> 713</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-714"><a href="#L-714"><span class="linenos"> 714</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-715"><a href="#L-715"><span class="linenos"> 715</span></a><span class="sd"> Returns:</span> +</span><span id="L-716"><a href="#L-716"><span class="linenos"> 716</span></a><span class="sd"> Intersect: the Intersect expression</span> +</span><span id="L-717"><a href="#L-717"><span class="linenos"> 717</span></a><span class="sd"> """</span> +</span><span id="L-718"><a href="#L-718"><span class="linenos"> 718</span></a> <span class="k">return</span> <span class="n">intersect</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-719"><a href="#L-719"><span class="linenos"> 719</span></a> +</span><span id="L-720"><a href="#L-720"><span class="linenos"> 720</span></a> <span class="k">def</span> <span class="nf">except_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-721"><a href="#L-721"><span class="linenos"> 721</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-722"><a href="#L-722"><span class="linenos"> 722</span></a><span class="sd"> Builds an EXCEPT expression.</span> +</span><span id="L-723"><a href="#L-723"><span class="linenos"> 723</span></a> +</span><span id="L-724"><a href="#L-724"><span class="linenos"> 724</span></a><span class="sd"> Example:</span> +</span><span id="L-725"><a href="#L-725"><span class="linenos"> 725</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-726"><a href="#L-726"><span class="linenos"> 726</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql()</span> +</span><span id="L-727"><a href="#L-727"><span class="linenos"> 727</span></a><span class="sd"> 'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</span><span id="L-728"><a href="#L-728"><span class="linenos"> 728</span></a> +</span><span id="L-729"><a href="#L-729"><span class="linenos"> 729</span></a><span class="sd"> Args:</span> +</span><span id="L-730"><a href="#L-730"><span class="linenos"> 730</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="L-731"><a href="#L-731"><span class="linenos"> 731</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-732"><a href="#L-732"><span class="linenos"> 732</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="L-733"><a href="#L-733"><span class="linenos"> 733</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-734"><a href="#L-734"><span class="linenos"> 734</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-735"><a href="#L-735"><span class="linenos"> 735</span></a><span class="sd"> Returns:</span> +</span><span id="L-736"><a href="#L-736"><span class="linenos"> 736</span></a><span class="sd"> Except: the Except expression</span> +</span><span id="L-737"><a href="#L-737"><span class="linenos"> 737</span></a><span class="sd"> """</span> +</span><span id="L-738"><a href="#L-738"><span class="linenos"> 738</span></a> <span class="k">return</span> <span class="n">except_</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-739"><a href="#L-739"><span class="linenos"> 739</span></a> +</span><span id="L-740"><a href="#L-740"><span class="linenos"> 740</span></a> +</span><span id="L-741"><a href="#L-741"><span class="linenos"> 741</span></a><span class="k">class</span> <span class="nc">UDTF</span><span class="p">(</span><span class="n">DerivedTable</span><span class="p">,</span> <span class="n">Unionable</span><span class="p">):</span> +</span><span id="L-742"><a href="#L-742"><span class="linenos"> 742</span></a> <span class="k">pass</span> +</span><span id="L-743"><a href="#L-743"><span class="linenos"> 743</span></a> +</span><span id="L-744"><a href="#L-744"><span class="linenos"> 744</span></a> +</span><span id="L-745"><a href="#L-745"><span class="linenos"> 745</span></a><span class="k">class</span> <span class="nc">Cache</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-746"><a href="#L-746"><span class="linenos"> 746</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-747"><a href="#L-747"><span class="linenos"> 747</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-748"><a href="#L-748"><span class="linenos"> 748</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-749"><a href="#L-749"><span class="linenos"> 749</span></a> <span class="s2">"lazy"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-750"><a href="#L-750"><span class="linenos"> 750</span></a> <span class="s2">"options"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-751"><a href="#L-751"><span class="linenos"> 751</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-752"><a href="#L-752"><span class="linenos"> 752</span></a> <span class="p">}</span> +</span><span id="L-753"><a href="#L-753"><span class="linenos"> 753</span></a> +</span><span id="L-754"><a href="#L-754"><span class="linenos"> 754</span></a> +</span><span id="L-755"><a href="#L-755"><span class="linenos"> 755</span></a><span class="k">class</span> <span class="nc">Uncache</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-756"><a href="#L-756"><span class="linenos"> 756</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-757"><a href="#L-757"><span class="linenos"> 757</span></a> +</span><span id="L-758"><a href="#L-758"><span class="linenos"> 758</span></a> +</span><span id="L-759"><a href="#L-759"><span class="linenos"> 759</span></a><span class="k">class</span> <span class="nc">Create</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-760"><a href="#L-760"><span class="linenos"> 760</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-761"><a href="#L-761"><span class="linenos"> 761</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-762"><a href="#L-762"><span class="linenos"> 762</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-763"><a href="#L-763"><span class="linenos"> 763</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-764"><a href="#L-764"><span class="linenos"> 764</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-765"><a href="#L-765"><span class="linenos"> 765</span></a> <span class="s2">"set"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-766"><a href="#L-766"><span class="linenos"> 766</span></a> <span class="s2">"multiset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-767"><a href="#L-767"><span class="linenos"> 767</span></a> <span class="s2">"global_temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-768"><a href="#L-768"><span class="linenos"> 768</span></a> <span class="s2">"volatile"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-769"><a href="#L-769"><span class="linenos"> 769</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-770"><a href="#L-770"><span class="linenos"> 770</span></a> <span class="s2">"properties"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-771"><a href="#L-771"><span class="linenos"> 771</span></a> <span class="s2">"temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-772"><a href="#L-772"><span class="linenos"> 772</span></a> <span class="s2">"transient"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-773"><a href="#L-773"><span class="linenos"> 773</span></a> <span class="s2">"external"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-774"><a href="#L-774"><span class="linenos"> 774</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-775"><a href="#L-775"><span class="linenos"> 775</span></a> <span class="s2">"unique"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-776"><a href="#L-776"><span class="linenos"> 776</span></a> <span class="s2">"materialized"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-777"><a href="#L-777"><span class="linenos"> 777</span></a> <span class="s2">"data"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-778"><a href="#L-778"><span class="linenos"> 778</span></a> <span class="s2">"statistics"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-779"><a href="#L-779"><span class="linenos"> 779</span></a> <span class="s2">"no_primary_index"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-780"><a href="#L-780"><span class="linenos"> 780</span></a> <span class="s2">"indexes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-781"><a href="#L-781"><span class="linenos"> 781</span></a> <span class="s2">"no_schema_binding"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-782"><a href="#L-782"><span class="linenos"> 782</span></a> <span class="s2">"begin"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-783"><a href="#L-783"><span class="linenos"> 783</span></a> <span class="p">}</span> +</span><span id="L-784"><a href="#L-784"><span class="linenos"> 784</span></a> +</span><span id="L-785"><a href="#L-785"><span class="linenos"> 785</span></a> +</span><span id="L-786"><a href="#L-786"><span class="linenos"> 786</span></a><span class="k">class</span> <span class="nc">Describe</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-787"><a href="#L-787"><span class="linenos"> 787</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-788"><a href="#L-788"><span class="linenos"> 788</span></a> +</span><span id="L-789"><a href="#L-789"><span class="linenos"> 789</span></a> +</span><span id="L-790"><a href="#L-790"><span class="linenos"> 790</span></a><span class="k">class</span> <span class="nc">Set</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-791"><a href="#L-791"><span class="linenos"> 791</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-792"><a href="#L-792"><span class="linenos"> 792</span></a> +</span><span id="L-793"><a href="#L-793"><span class="linenos"> 793</span></a> +</span><span id="L-794"><a href="#L-794"><span class="linenos"> 794</span></a><span class="k">class</span> <span class="nc">SetItem</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-795"><a href="#L-795"><span class="linenos"> 795</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-796"><a href="#L-796"><span class="linenos"> 796</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-797"><a href="#L-797"><span class="linenos"> 797</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-798"><a href="#L-798"><span class="linenos"> 798</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-799"><a href="#L-799"><span class="linenos"> 799</span></a> <span class="s2">"collate"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># MySQL SET NAMES statement</span> +</span><span id="L-800"><a href="#L-800"><span class="linenos"> 800</span></a> <span class="s2">"global"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-801"><a href="#L-801"><span class="linenos"> 801</span></a> <span class="p">}</span> +</span><span id="L-802"><a href="#L-802"><span class="linenos"> 802</span></a> +</span><span id="L-803"><a href="#L-803"><span class="linenos"> 803</span></a> +</span><span id="L-804"><a href="#L-804"><span class="linenos"> 804</span></a><span class="k">class</span> <span class="nc">Show</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-805"><a href="#L-805"><span class="linenos"> 805</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-806"><a href="#L-806"><span class="linenos"> 806</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-807"><a href="#L-807"><span class="linenos"> 807</span></a> <span class="s2">"target"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-808"><a href="#L-808"><span class="linenos"> 808</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-809"><a href="#L-809"><span class="linenos"> 809</span></a> <span class="s2">"limit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-810"><a href="#L-810"><span class="linenos"> 810</span></a> <span class="s2">"like"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-811"><a href="#L-811"><span class="linenos"> 811</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-812"><a href="#L-812"><span class="linenos"> 812</span></a> <span class="s2">"db"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-813"><a href="#L-813"><span class="linenos"> 813</span></a> <span class="s2">"full"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-814"><a href="#L-814"><span class="linenos"> 814</span></a> <span class="s2">"mutex"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-815"><a href="#L-815"><span class="linenos"> 815</span></a> <span class="s2">"query"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-816"><a href="#L-816"><span class="linenos"> 816</span></a> <span class="s2">"channel"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-817"><a href="#L-817"><span class="linenos"> 817</span></a> <span class="s2">"global"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-818"><a href="#L-818"><span class="linenos"> 818</span></a> <span class="s2">"log"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-819"><a href="#L-819"><span class="linenos"> 819</span></a> <span class="s2">"position"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-820"><a href="#L-820"><span class="linenos"> 820</span></a> <span class="s2">"types"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-821"><a href="#L-821"><span class="linenos"> 821</span></a> <span class="p">}</span> +</span><span id="L-822"><a href="#L-822"><span class="linenos"> 822</span></a> +</span><span id="L-823"><a href="#L-823"><span class="linenos"> 823</span></a> +</span><span id="L-824"><a href="#L-824"><span class="linenos"> 824</span></a><span class="k">class</span> <span class="nc">UserDefinedFunction</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-825"><a href="#L-825"><span class="linenos"> 825</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"wrapped"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-826"><a href="#L-826"><span class="linenos"> 826</span></a> +</span><span id="L-827"><a href="#L-827"><span class="linenos"> 827</span></a> +</span><span id="L-828"><a href="#L-828"><span class="linenos"> 828</span></a><span class="k">class</span> <span class="nc">UserDefinedFunctionKwarg</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-829"><a href="#L-829"><span class="linenos"> 829</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-830"><a href="#L-830"><span class="linenos"> 830</span></a> +</span><span id="L-831"><a href="#L-831"><span class="linenos"> 831</span></a> +</span><span id="L-832"><a href="#L-832"><span class="linenos"> 832</span></a><span class="k">class</span> <span class="nc">CharacterSet</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-833"><a href="#L-833"><span class="linenos"> 833</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-834"><a href="#L-834"><span class="linenos"> 834</span></a> +</span><span id="L-835"><a href="#L-835"><span class="linenos"> 835</span></a> +</span><span id="L-836"><a href="#L-836"><span class="linenos"> 836</span></a><span class="k">class</span> <span class="nc">With</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-837"><a href="#L-837"><span class="linenos"> 837</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"recursive"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-838"><a href="#L-838"><span class="linenos"> 838</span></a> +</span><span id="L-839"><a href="#L-839"><span class="linenos"> 839</span></a> <span class="nd">@property</span> +</span><span id="L-840"><a href="#L-840"><span class="linenos"> 840</span></a> <span class="k">def</span> <span class="nf">recursive</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-841"><a href="#L-841"><span class="linenos"> 841</span></a> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">))</span> +</span><span id="L-842"><a href="#L-842"><span class="linenos"> 842</span></a> +</span><span id="L-843"><a href="#L-843"><span class="linenos"> 843</span></a> +</span><span id="L-844"><a href="#L-844"><span class="linenos"> 844</span></a><span class="k">class</span> <span class="nc">WithinGroup</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-845"><a href="#L-845"><span class="linenos"> 845</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-846"><a href="#L-846"><span class="linenos"> 846</span></a> +</span><span id="L-847"><a href="#L-847"><span class="linenos"> 847</span></a> +</span><span id="L-848"><a href="#L-848"><span class="linenos"> 848</span></a><span class="k">class</span> <span class="nc">CTE</span><span class="p">(</span><span class="n">DerivedTable</span><span class="p">):</span> +</span><span id="L-849"><a href="#L-849"><span class="linenos"> 849</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-850"><a href="#L-850"><span class="linenos"> 850</span></a> +</span><span id="L-851"><a href="#L-851"><span class="linenos"> 851</span></a> +</span><span id="L-852"><a href="#L-852"><span class="linenos"> 852</span></a><span class="k">class</span> <span class="nc">TableAlias</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-853"><a href="#L-853"><span class="linenos"> 853</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"columns"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-854"><a href="#L-854"><span class="linenos"> 854</span></a> +</span><span id="L-855"><a href="#L-855"><span class="linenos"> 855</span></a> <span class="nd">@property</span> +</span><span id="L-856"><a href="#L-856"><span class="linenos"> 856</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-857"><a href="#L-857"><span class="linenos"> 857</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-858"><a href="#L-858"><span class="linenos"> 858</span></a> +</span><span id="L-859"><a href="#L-859"><span class="linenos"> 859</span></a> +</span><span id="L-860"><a href="#L-860"><span class="linenos"> 860</span></a><span class="k">class</span> <span class="nc">BitString</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-861"><a href="#L-861"><span class="linenos"> 861</span></a> <span class="k">pass</span> +</span><span id="L-862"><a href="#L-862"><span class="linenos"> 862</span></a> +</span><span id="L-863"><a href="#L-863"><span class="linenos"> 863</span></a> +</span><span id="L-864"><a href="#L-864"><span class="linenos"> 864</span></a><span class="k">class</span> <span class="nc">HexString</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-865"><a href="#L-865"><span class="linenos"> 865</span></a> <span class="k">pass</span> +</span><span id="L-866"><a href="#L-866"><span class="linenos"> 866</span></a> +</span><span id="L-867"><a href="#L-867"><span class="linenos"> 867</span></a> +</span><span id="L-868"><a href="#L-868"><span class="linenos"> 868</span></a><span class="k">class</span> <span class="nc">ByteString</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-869"><a href="#L-869"><span class="linenos"> 869</span></a> <span class="k">pass</span> +</span><span id="L-870"><a href="#L-870"><span class="linenos"> 870</span></a> +</span><span id="L-871"><a href="#L-871"><span class="linenos"> 871</span></a> +</span><span id="L-872"><a href="#L-872"><span class="linenos"> 872</span></a><span class="k">class</span> <span class="nc">Column</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-873"><a href="#L-873"><span class="linenos"> 873</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-874"><a href="#L-874"><span class="linenos"> 874</span></a> +</span><span id="L-875"><a href="#L-875"><span class="linenos"> 875</span></a> <span class="nd">@property</span> +</span><span id="L-876"><a href="#L-876"><span class="linenos"> 876</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-877"><a href="#L-877"><span class="linenos"> 877</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="L-878"><a href="#L-878"><span class="linenos"> 878</span></a> +</span><span id="L-879"><a href="#L-879"><span class="linenos"> 879</span></a> <span class="nd">@property</span> +</span><span id="L-880"><a href="#L-880"><span class="linenos"> 880</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-881"><a href="#L-881"><span class="linenos"> 881</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-882"><a href="#L-882"><span class="linenos"> 882</span></a> +</span><span id="L-883"><a href="#L-883"><span class="linenos"> 883</span></a> +</span><span id="L-884"><a href="#L-884"><span class="linenos"> 884</span></a><span class="k">class</span> <span class="nc">ColumnDef</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-885"><a href="#L-885"><span class="linenos"> 885</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-886"><a href="#L-886"><span class="linenos"> 886</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-887"><a href="#L-887"><span class="linenos"> 887</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-888"><a href="#L-888"><span class="linenos"> 888</span></a> <span class="s2">"constraints"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-889"><a href="#L-889"><span class="linenos"> 889</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-890"><a href="#L-890"><span class="linenos"> 890</span></a> <span class="p">}</span> +</span><span id="L-891"><a href="#L-891"><span class="linenos"> 891</span></a> +</span><span id="L-892"><a href="#L-892"><span class="linenos"> 892</span></a> +</span><span id="L-893"><a href="#L-893"><span class="linenos"> 893</span></a><span class="k">class</span> <span class="nc">AlterColumn</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-894"><a href="#L-894"><span class="linenos"> 894</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-895"><a href="#L-895"><span class="linenos"> 895</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-896"><a href="#L-896"><span class="linenos"> 896</span></a> <span class="s2">"dtype"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-897"><a href="#L-897"><span class="linenos"> 897</span></a> <span class="s2">"collate"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-898"><a href="#L-898"><span class="linenos"> 898</span></a> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-899"><a href="#L-899"><span class="linenos"> 899</span></a> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-900"><a href="#L-900"><span class="linenos"> 900</span></a> <span class="s2">"drop"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-901"><a href="#L-901"><span class="linenos"> 901</span></a> <span class="p">}</span> +</span><span id="L-902"><a href="#L-902"><span class="linenos"> 902</span></a> +</span><span id="L-903"><a href="#L-903"><span class="linenos"> 903</span></a> +</span><span id="L-904"><a href="#L-904"><span class="linenos"> 904</span></a><span class="k">class</span> <span class="nc">RenameTable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-905"><a href="#L-905"><span class="linenos"> 905</span></a> <span class="k">pass</span> +</span><span id="L-906"><a href="#L-906"><span class="linenos"> 906</span></a> +</span><span id="L-907"><a href="#L-907"><span class="linenos"> 907</span></a> +</span><span id="L-908"><a href="#L-908"><span class="linenos"> 908</span></a><span class="k">class</span> <span class="nc">ColumnConstraint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-909"><a href="#L-909"><span class="linenos"> 909</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-910"><a href="#L-910"><span class="linenos"> 910</span></a> +</span><span id="L-911"><a href="#L-911"><span class="linenos"> 911</span></a> +</span><span id="L-912"><a href="#L-912"><span class="linenos"> 912</span></a><span class="k">class</span> <span class="nc">ColumnConstraintKind</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-913"><a href="#L-913"><span class="linenos"> 913</span></a> <span class="k">pass</span> +</span><span id="L-914"><a href="#L-914"><span class="linenos"> 914</span></a> +</span><span id="L-915"><a href="#L-915"><span class="linenos"> 915</span></a> +</span><span id="L-916"><a href="#L-916"><span class="linenos"> 916</span></a><span class="k">class</span> <span class="nc">AutoIncrementColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-917"><a href="#L-917"><span class="linenos"> 917</span></a> <span class="k">pass</span> +</span><span id="L-918"><a href="#L-918"><span class="linenos"> 918</span></a> +</span><span id="L-919"><a href="#L-919"><span class="linenos"> 919</span></a> +</span><span id="L-920"><a href="#L-920"><span class="linenos"> 920</span></a><span class="k">class</span> <span class="nc">CheckColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-921"><a href="#L-921"><span class="linenos"> 921</span></a> <span class="k">pass</span> +</span><span id="L-922"><a href="#L-922"><span class="linenos"> 922</span></a> +</span><span id="L-923"><a href="#L-923"><span class="linenos"> 923</span></a> +</span><span id="L-924"><a href="#L-924"><span class="linenos"> 924</span></a><span class="k">class</span> <span class="nc">CollateColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-925"><a href="#L-925"><span class="linenos"> 925</span></a> <span class="k">pass</span> +</span><span id="L-926"><a href="#L-926"><span class="linenos"> 926</span></a> +</span><span id="L-927"><a href="#L-927"><span class="linenos"> 927</span></a> +</span><span id="L-928"><a href="#L-928"><span class="linenos"> 928</span></a><span class="k">class</span> <span class="nc">CommentColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-929"><a href="#L-929"><span class="linenos"> 929</span></a> <span class="k">pass</span> +</span><span id="L-930"><a href="#L-930"><span class="linenos"> 930</span></a> +</span><span id="L-931"><a href="#L-931"><span class="linenos"> 931</span></a> +</span><span id="L-932"><a href="#L-932"><span class="linenos"> 932</span></a><span class="k">class</span> <span class="nc">DefaultColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-933"><a href="#L-933"><span class="linenos"> 933</span></a> <span class="k">pass</span> +</span><span id="L-934"><a href="#L-934"><span class="linenos"> 934</span></a> +</span><span id="L-935"><a href="#L-935"><span class="linenos"> 935</span></a> +</span><span id="L-936"><a href="#L-936"><span class="linenos"> 936</span></a><span class="k">class</span> <span class="nc">EncodeColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-937"><a href="#L-937"><span class="linenos"> 937</span></a> <span class="k">pass</span> +</span><span id="L-938"><a href="#L-938"><span class="linenos"> 938</span></a> +</span><span id="L-939"><a href="#L-939"><span class="linenos"> 939</span></a> +</span><span id="L-940"><a href="#L-940"><span class="linenos"> 940</span></a><span class="k">class</span> <span class="nc">GeneratedAsIdentityColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-941"><a href="#L-941"><span class="linenos"> 941</span></a> <span class="c1"># this: True -> ALWAYS, this: False -> BY DEFAULT</span> +</span><span id="L-942"><a href="#L-942"><span class="linenos"> 942</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"increment"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-943"><a href="#L-943"><span class="linenos"> 943</span></a> +</span><span id="L-944"><a href="#L-944"><span class="linenos"> 944</span></a> +</span><span id="L-945"><a href="#L-945"><span class="linenos"> 945</span></a><span class="k">class</span> <span class="nc">NotNullColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-946"><a href="#L-946"><span class="linenos"> 946</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"allow_null"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-947"><a href="#L-947"><span class="linenos"> 947</span></a> +</span><span id="L-948"><a href="#L-948"><span class="linenos"> 948</span></a> +</span><span id="L-949"><a href="#L-949"><span class="linenos"> 949</span></a><span class="k">class</span> <span class="nc">PrimaryKeyColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-950"><a href="#L-950"><span class="linenos"> 950</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"desc"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-951"><a href="#L-951"><span class="linenos"> 951</span></a> +</span><span id="L-952"><a href="#L-952"><span class="linenos"> 952</span></a> +</span><span id="L-953"><a href="#L-953"><span class="linenos"> 953</span></a><span class="k">class</span> <span class="nc">UniqueColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="L-954"><a href="#L-954"><span class="linenos"> 954</span></a> <span class="k">pass</span> +</span><span id="L-955"><a href="#L-955"><span class="linenos"> 955</span></a> +</span><span id="L-956"><a href="#L-956"><span class="linenos"> 956</span></a> +</span><span id="L-957"><a href="#L-957"><span class="linenos"> 957</span></a><span class="k">class</span> <span class="nc">Constraint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-958"><a href="#L-958"><span class="linenos"> 958</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-959"><a href="#L-959"><span class="linenos"> 959</span></a> +</span><span id="L-960"><a href="#L-960"><span class="linenos"> 960</span></a> +</span><span id="L-961"><a href="#L-961"><span class="linenos"> 961</span></a><span class="k">class</span> <span class="nc">Delete</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-962"><a href="#L-962"><span class="linenos"> 962</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-963"><a href="#L-963"><span class="linenos"> 963</span></a> +</span><span id="L-964"><a href="#L-964"><span class="linenos"> 964</span></a> +</span><span id="L-965"><a href="#L-965"><span class="linenos"> 965</span></a><span class="k">class</span> <span class="nc">Drop</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-966"><a href="#L-966"><span class="linenos"> 966</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-967"><a href="#L-967"><span class="linenos"> 967</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-968"><a href="#L-968"><span class="linenos"> 968</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-969"><a href="#L-969"><span class="linenos"> 969</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-970"><a href="#L-970"><span class="linenos"> 970</span></a> <span class="s2">"temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-971"><a href="#L-971"><span class="linenos"> 971</span></a> <span class="s2">"materialized"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-972"><a href="#L-972"><span class="linenos"> 972</span></a> <span class="s2">"cascade"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-973"><a href="#L-973"><span class="linenos"> 973</span></a> <span class="p">}</span> +</span><span id="L-974"><a href="#L-974"><span class="linenos"> 974</span></a> +</span><span id="L-975"><a href="#L-975"><span class="linenos"> 975</span></a> +</span><span id="L-976"><a href="#L-976"><span class="linenos"> 976</span></a><span class="k">class</span> <span class="nc">Filter</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-977"><a href="#L-977"><span class="linenos"> 977</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-978"><a href="#L-978"><span class="linenos"> 978</span></a> +</span><span id="L-979"><a href="#L-979"><span class="linenos"> 979</span></a> +</span><span id="L-980"><a href="#L-980"><span class="linenos"> 980</span></a><span class="k">class</span> <span class="nc">Check</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-981"><a href="#L-981"><span class="linenos"> 981</span></a> <span class="k">pass</span> +</span><span id="L-982"><a href="#L-982"><span class="linenos"> 982</span></a> +</span><span id="L-983"><a href="#L-983"><span class="linenos"> 983</span></a> +</span><span id="L-984"><a href="#L-984"><span class="linenos"> 984</span></a><span class="k">class</span> <span class="nc">Directory</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-985"><a href="#L-985"><span class="linenos"> 985</span></a> <span class="c1"># https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-dml-insert-overwrite-directory-hive.html</span> +</span><span id="L-986"><a href="#L-986"><span class="linenos"> 986</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"local"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"row_format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-987"><a href="#L-987"><span class="linenos"> 987</span></a> +</span><span id="L-988"><a href="#L-988"><span class="linenos"> 988</span></a> +</span><span id="L-989"><a href="#L-989"><span class="linenos"> 989</span></a><span class="k">class</span> <span class="nc">ForeignKey</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-990"><a href="#L-990"><span class="linenos"> 990</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-991"><a href="#L-991"><span class="linenos"> 991</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-992"><a href="#L-992"><span class="linenos"> 992</span></a> <span class="s2">"reference"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-993"><a href="#L-993"><span class="linenos"> 993</span></a> <span class="s2">"delete"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-994"><a href="#L-994"><span class="linenos"> 994</span></a> <span class="s2">"update"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-995"><a href="#L-995"><span class="linenos"> 995</span></a> <span class="p">}</span> +</span><span id="L-996"><a href="#L-996"><span class="linenos"> 996</span></a> +</span><span id="L-997"><a href="#L-997"><span class="linenos"> 997</span></a> +</span><span id="L-998"><a href="#L-998"><span class="linenos"> 998</span></a><span class="k">class</span> <span class="nc">PrimaryKey</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-999"><a href="#L-999"><span class="linenos"> 999</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1000"><a href="#L-1000"><span class="linenos">1000</span></a> +</span><span id="L-1001"><a href="#L-1001"><span class="linenos">1001</span></a> +</span><span id="L-1002"><a href="#L-1002"><span class="linenos">1002</span></a><span class="k">class</span> <span class="nc">Unique</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1003"><a href="#L-1003"><span class="linenos">1003</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1004"><a href="#L-1004"><span class="linenos">1004</span></a> +</span><span id="L-1005"><a href="#L-1005"><span class="linenos">1005</span></a> +</span><span id="L-1006"><a href="#L-1006"><span class="linenos">1006</span></a><span class="c1"># https://www.postgresql.org/docs/9.1/sql-selectinto.html</span> +</span><span id="L-1007"><a href="#L-1007"><span class="linenos">1007</span></a><span class="c1"># https://docs.aws.amazon.com/redshift/latest/dg/r_SELECT_INTO.html#r_SELECT_INTO-examples</span> +</span><span id="L-1008"><a href="#L-1008"><span class="linenos">1008</span></a><span class="k">class</span> <span class="nc">Into</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1009"><a href="#L-1009"><span class="linenos">1009</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"unlogged"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1010"><a href="#L-1010"><span class="linenos">1010</span></a> +</span><span id="L-1011"><a href="#L-1011"><span class="linenos">1011</span></a> +</span><span id="L-1012"><a href="#L-1012"><span class="linenos">1012</span></a><span class="k">class</span> <span class="nc">From</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1013"><a href="#L-1013"><span class="linenos">1013</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1014"><a href="#L-1014"><span class="linenos">1014</span></a> +</span><span id="L-1015"><a href="#L-1015"><span class="linenos">1015</span></a> +</span><span id="L-1016"><a href="#L-1016"><span class="linenos">1016</span></a><span class="k">class</span> <span class="nc">Having</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1017"><a href="#L-1017"><span class="linenos">1017</span></a> <span class="k">pass</span> +</span><span id="L-1018"><a href="#L-1018"><span class="linenos">1018</span></a> +</span><span id="L-1019"><a href="#L-1019"><span class="linenos">1019</span></a> +</span><span id="L-1020"><a href="#L-1020"><span class="linenos">1020</span></a><span class="k">class</span> <span class="nc">Hint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1021"><a href="#L-1021"><span class="linenos">1021</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1022"><a href="#L-1022"><span class="linenos">1022</span></a> +</span><span id="L-1023"><a href="#L-1023"><span class="linenos">1023</span></a> +</span><span id="L-1024"><a href="#L-1024"><span class="linenos">1024</span></a><span class="k">class</span> <span class="nc">JoinHint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1025"><a href="#L-1025"><span class="linenos">1025</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1026"><a href="#L-1026"><span class="linenos">1026</span></a> +</span><span id="L-1027"><a href="#L-1027"><span class="linenos">1027</span></a> +</span><span id="L-1028"><a href="#L-1028"><span class="linenos">1028</span></a><span class="k">class</span> <span class="nc">Identifier</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1029"><a href="#L-1029"><span class="linenos">1029</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1030"><a href="#L-1030"><span class="linenos">1030</span></a> +</span><span id="L-1031"><a href="#L-1031"><span class="linenos">1031</span></a> <span class="nd">@property</span> +</span><span id="L-1032"><a href="#L-1032"><span class="linenos">1032</span></a> <span class="k">def</span> <span class="nf">quoted</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1033"><a href="#L-1033"><span class="linenos">1033</span></a> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">))</span> +</span><span id="L-1034"><a href="#L-1034"><span class="linenos">1034</span></a> +</span><span id="L-1035"><a href="#L-1035"><span class="linenos">1035</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="L-1036"><a href="#L-1036"><span class="linenos">1036</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> <span class="ow">and</span> <span class="n">_norm_arg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="o">==</span> <span class="n">_norm_arg</span><span class="p">(</span><span class="n">other</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-1037"><a href="#L-1037"><span class="linenos">1037</span></a> +</span><span id="L-1038"><a href="#L-1038"><span class="linenos">1038</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1039"><a href="#L-1039"><span class="linenos">1039</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">lower</span><span class="p">()))</span> +</span><span id="L-1040"><a href="#L-1040"><span class="linenos">1040</span></a> +</span><span id="L-1041"><a href="#L-1041"><span class="linenos">1041</span></a> <span class="nd">@property</span> +</span><span id="L-1042"><a href="#L-1042"><span class="linenos">1042</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1043"><a href="#L-1043"><span class="linenos">1043</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-1044"><a href="#L-1044"><span class="linenos">1044</span></a> +</span><span id="L-1045"><a href="#L-1045"><span class="linenos">1045</span></a> +</span><span id="L-1046"><a href="#L-1046"><span class="linenos">1046</span></a><span class="k">class</span> <span class="nc">Index</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1047"><a href="#L-1047"><span class="linenos">1047</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1048"><a href="#L-1048"><span class="linenos">1048</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1049"><a href="#L-1049"><span class="linenos">1049</span></a> <span class="s2">"table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1050"><a href="#L-1050"><span class="linenos">1050</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1051"><a href="#L-1051"><span class="linenos">1051</span></a> <span class="s2">"columns"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1052"><a href="#L-1052"><span class="linenos">1052</span></a> <span class="s2">"unique"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1053"><a href="#L-1053"><span class="linenos">1053</span></a> <span class="s2">"primary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1054"><a href="#L-1054"><span class="linenos">1054</span></a> <span class="s2">"amp"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># teradata</span> +</span><span id="L-1055"><a href="#L-1055"><span class="linenos">1055</span></a> <span class="p">}</span> +</span><span id="L-1056"><a href="#L-1056"><span class="linenos">1056</span></a> +</span><span id="L-1057"><a href="#L-1057"><span class="linenos">1057</span></a> +</span><span id="L-1058"><a href="#L-1058"><span class="linenos">1058</span></a><span class="k">class</span> <span class="nc">Insert</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1059"><a href="#L-1059"><span class="linenos">1059</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1060"><a href="#L-1060"><span class="linenos">1060</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1061"><a href="#L-1061"><span class="linenos">1061</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1062"><a href="#L-1062"><span class="linenos">1062</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1063"><a href="#L-1063"><span class="linenos">1063</span></a> <span class="s2">"overwrite"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1064"><a href="#L-1064"><span class="linenos">1064</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1065"><a href="#L-1065"><span class="linenos">1065</span></a> <span class="s2">"partition"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1066"><a href="#L-1066"><span class="linenos">1066</span></a> <span class="p">}</span> +</span><span id="L-1067"><a href="#L-1067"><span class="linenos">1067</span></a> +</span><span id="L-1068"><a href="#L-1068"><span class="linenos">1068</span></a> +</span><span id="L-1069"><a href="#L-1069"><span class="linenos">1069</span></a><span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/charset-introducer.html</span> +</span><span id="L-1070"><a href="#L-1070"><span class="linenos">1070</span></a><span class="k">class</span> <span class="nc">Introducer</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1071"><a href="#L-1071"><span class="linenos">1071</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1072"><a href="#L-1072"><span class="linenos">1072</span></a> +</span><span id="L-1073"><a href="#L-1073"><span class="linenos">1073</span></a> +</span><span id="L-1074"><a href="#L-1074"><span class="linenos">1074</span></a><span class="c1"># national char, like n'utf8'</span> +</span><span id="L-1075"><a href="#L-1075"><span class="linenos">1075</span></a><span class="k">class</span> <span class="nc">National</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1076"><a href="#L-1076"><span class="linenos">1076</span></a> <span class="k">pass</span> +</span><span id="L-1077"><a href="#L-1077"><span class="linenos">1077</span></a> +</span><span id="L-1078"><a href="#L-1078"><span class="linenos">1078</span></a> +</span><span id="L-1079"><a href="#L-1079"><span class="linenos">1079</span></a><span class="k">class</span> <span class="nc">LoadData</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1080"><a href="#L-1080"><span class="linenos">1080</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1081"><a href="#L-1081"><span class="linenos">1081</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1082"><a href="#L-1082"><span class="linenos">1082</span></a> <span class="s2">"local"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1083"><a href="#L-1083"><span class="linenos">1083</span></a> <span class="s2">"overwrite"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1084"><a href="#L-1084"><span class="linenos">1084</span></a> <span class="s2">"inpath"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1085"><a href="#L-1085"><span class="linenos">1085</span></a> <span class="s2">"partition"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1086"><a href="#L-1086"><span class="linenos">1086</span></a> <span class="s2">"input_format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1087"><a href="#L-1087"><span class="linenos">1087</span></a> <span class="s2">"serde"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1088"><a href="#L-1088"><span class="linenos">1088</span></a> <span class="p">}</span> +</span><span id="L-1089"><a href="#L-1089"><span class="linenos">1089</span></a> +</span><span id="L-1090"><a href="#L-1090"><span class="linenos">1090</span></a> +</span><span id="L-1091"><a href="#L-1091"><span class="linenos">1091</span></a><span class="k">class</span> <span class="nc">Partition</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1092"><a href="#L-1092"><span class="linenos">1092</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1093"><a href="#L-1093"><span class="linenos">1093</span></a> +</span><span id="L-1094"><a href="#L-1094"><span class="linenos">1094</span></a> +</span><span id="L-1095"><a href="#L-1095"><span class="linenos">1095</span></a><span class="k">class</span> <span class="nc">Fetch</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1096"><a href="#L-1096"><span class="linenos">1096</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"direction"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"count"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1097"><a href="#L-1097"><span class="linenos">1097</span></a> +</span><span id="L-1098"><a href="#L-1098"><span class="linenos">1098</span></a> +</span><span id="L-1099"><a href="#L-1099"><span class="linenos">1099</span></a><span class="k">class</span> <span class="nc">Group</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1100"><a href="#L-1100"><span class="linenos">1100</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1101"><a href="#L-1101"><span class="linenos">1101</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1102"><a href="#L-1102"><span class="linenos">1102</span></a> <span class="s2">"grouping_sets"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1103"><a href="#L-1103"><span class="linenos">1103</span></a> <span class="s2">"cube"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1104"><a href="#L-1104"><span class="linenos">1104</span></a> <span class="s2">"rollup"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1105"><a href="#L-1105"><span class="linenos">1105</span></a> <span class="p">}</span> +</span><span id="L-1106"><a href="#L-1106"><span class="linenos">1106</span></a> +</span><span id="L-1107"><a href="#L-1107"><span class="linenos">1107</span></a> +</span><span id="L-1108"><a href="#L-1108"><span class="linenos">1108</span></a><span class="k">class</span> <span class="nc">Lambda</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1109"><a href="#L-1109"><span class="linenos">1109</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1110"><a href="#L-1110"><span class="linenos">1110</span></a> +</span><span id="L-1111"><a href="#L-1111"><span class="linenos">1111</span></a> +</span><span id="L-1112"><a href="#L-1112"><span class="linenos">1112</span></a><span class="k">class</span> <span class="nc">Limit</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1113"><a href="#L-1113"><span class="linenos">1113</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1114"><a href="#L-1114"><span class="linenos">1114</span></a> +</span><span id="L-1115"><a href="#L-1115"><span class="linenos">1115</span></a> +</span><span id="L-1116"><a href="#L-1116"><span class="linenos">1116</span></a><span class="k">class</span> <span class="nc">Literal</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-1117"><a href="#L-1117"><span class="linenos">1117</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"is_string"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1118"><a href="#L-1118"><span class="linenos">1118</span></a> +</span><span id="L-1119"><a href="#L-1119"><span class="linenos">1119</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="L-1120"><a href="#L-1120"><span class="linenos">1120</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-1121"><a href="#L-1121"><span class="linenos">1121</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">Literal</span><span class="p">)</span> +</span><span id="L-1122"><a href="#L-1122"><span class="linenos">1122</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-1123"><a href="#L-1123"><span class="linenos">1123</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> +</span><span id="L-1124"><a href="#L-1124"><span class="linenos">1124</span></a> <span class="p">)</span> +</span><span id="L-1125"><a href="#L-1125"><span class="linenos">1125</span></a> +</span><span id="L-1126"><a href="#L-1126"><span class="linenos">1126</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1127"><a href="#L-1127"><span class="linenos">1127</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]))</span> +</span><span id="L-1128"><a href="#L-1128"><span class="linenos">1128</span></a> +</span><span id="L-1129"><a href="#L-1129"><span class="linenos">1129</span></a> <span class="nd">@classmethod</span> +</span><span id="L-1130"><a href="#L-1130"><span class="linenos">1130</span></a> <span class="k">def</span> <span class="nf">number</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">number</span><span class="p">)</span> <span class="o">-></span> <span class="n">Literal</span><span class="p">:</span> +</span><span id="L-1131"><a href="#L-1131"><span class="linenos">1131</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">number</span><span class="p">),</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1132"><a href="#L-1132"><span class="linenos">1132</span></a> +</span><span id="L-1133"><a href="#L-1133"><span class="linenos">1133</span></a> <span class="nd">@classmethod</span> +</span><span id="L-1134"><a href="#L-1134"><span class="linenos">1134</span></a> <span class="k">def</span> <span class="nf">string</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">string</span><span class="p">)</span> <span class="o">-></span> <span class="n">Literal</span><span class="p">:</span> +</span><span id="L-1135"><a href="#L-1135"><span class="linenos">1135</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">string</span><span class="p">),</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1136"><a href="#L-1136"><span class="linenos">1136</span></a> +</span><span id="L-1137"><a href="#L-1137"><span class="linenos">1137</span></a> <span class="nd">@property</span> +</span><span id="L-1138"><a href="#L-1138"><span class="linenos">1138</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1139"><a href="#L-1139"><span class="linenos">1139</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-1140"><a href="#L-1140"><span class="linenos">1140</span></a> +</span><span id="L-1141"><a href="#L-1141"><span class="linenos">1141</span></a> +</span><span id="L-1142"><a href="#L-1142"><span class="linenos">1142</span></a><span class="k">class</span> <span class="nc">Join</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1143"><a href="#L-1143"><span class="linenos">1143</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1144"><a href="#L-1144"><span class="linenos">1144</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1145"><a href="#L-1145"><span class="linenos">1145</span></a> <span class="s2">"on"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1146"><a href="#L-1146"><span class="linenos">1146</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1147"><a href="#L-1147"><span class="linenos">1147</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1148"><a href="#L-1148"><span class="linenos">1148</span></a> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1149"><a href="#L-1149"><span class="linenos">1149</span></a> <span class="s2">"natural"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1150"><a href="#L-1150"><span class="linenos">1150</span></a> <span class="p">}</span> +</span><span id="L-1151"><a href="#L-1151"><span class="linenos">1151</span></a> +</span><span id="L-1152"><a href="#L-1152"><span class="linenos">1152</span></a> <span class="nd">@property</span> +</span><span id="L-1153"><a href="#L-1153"><span class="linenos">1153</span></a> <span class="k">def</span> <span class="nf">kind</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1154"><a href="#L-1154"><span class="linenos">1154</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-1155"><a href="#L-1155"><span class="linenos">1155</span></a> +</span><span id="L-1156"><a href="#L-1156"><span class="linenos">1156</span></a> <span class="nd">@property</span> +</span><span id="L-1157"><a href="#L-1157"><span class="linenos">1157</span></a> <span class="k">def</span> <span class="nf">side</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1158"><a href="#L-1158"><span class="linenos">1158</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-1159"><a href="#L-1159"><span class="linenos">1159</span></a> +</span><span id="L-1160"><a href="#L-1160"><span class="linenos">1160</span></a> <span class="nd">@property</span> +</span><span id="L-1161"><a href="#L-1161"><span class="linenos">1161</span></a> <span class="k">def</span> <span class="nf">alias_or_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1162"><a href="#L-1162"><span class="linenos">1162</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-1163"><a href="#L-1163"><span class="linenos">1163</span></a> +</span><span id="L-1164"><a href="#L-1164"><span class="linenos">1164</span></a> <span class="k">def</span> <span class="nf">on</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-1165"><a href="#L-1165"><span class="linenos">1165</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1166"><a href="#L-1166"><span class="linenos">1166</span></a><span class="sd"> Append to or set the ON expressions.</span> +</span><span id="L-1167"><a href="#L-1167"><span class="linenos">1167</span></a> +</span><span id="L-1168"><a href="#L-1168"><span class="linenos">1168</span></a><span class="sd"> Example:</span> +</span><span id="L-1169"><a href="#L-1169"><span class="linenos">1169</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-1170"><a href="#L-1170"><span class="linenos">1170</span></a><span class="sd"> >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql()</span> +</span><span id="L-1171"><a href="#L-1171"><span class="linenos">1171</span></a><span class="sd"> 'JOIN x ON y = 1'</span> +</span><span id="L-1172"><a href="#L-1172"><span class="linenos">1172</span></a> +</span><span id="L-1173"><a href="#L-1173"><span class="linenos">1173</span></a><span class="sd"> Args:</span> +</span><span id="L-1174"><a href="#L-1174"><span class="linenos">1174</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1175"><a href="#L-1175"><span class="linenos">1175</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-1176"><a href="#L-1176"><span class="linenos">1176</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="L-1177"><a href="#L-1177"><span class="linenos">1177</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="L-1178"><a href="#L-1178"><span class="linenos">1178</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="L-1179"><a href="#L-1179"><span class="linenos">1179</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-1180"><a href="#L-1180"><span class="linenos">1180</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1181"><a href="#L-1181"><span class="linenos">1181</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1182"><a href="#L-1182"><span class="linenos">1182</span></a> +</span><span id="L-1183"><a href="#L-1183"><span class="linenos">1183</span></a><span class="sd"> Returns:</span> +</span><span id="L-1184"><a href="#L-1184"><span class="linenos">1184</span></a><span class="sd"> Join: the modified join expression.</span> +</span><span id="L-1185"><a href="#L-1185"><span class="linenos">1185</span></a><span class="sd"> """</span> +</span><span id="L-1186"><a href="#L-1186"><span class="linenos">1186</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="L-1187"><a href="#L-1187"><span class="linenos">1187</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1188"><a href="#L-1188"><span class="linenos">1188</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1189"><a href="#L-1189"><span class="linenos">1189</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"on"</span><span class="p">,</span> +</span><span id="L-1190"><a href="#L-1190"><span class="linenos">1190</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1191"><a href="#L-1191"><span class="linenos">1191</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1192"><a href="#L-1192"><span class="linenos">1192</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1193"><a href="#L-1193"><span class="linenos">1193</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1194"><a href="#L-1194"><span class="linenos">1194</span></a> <span class="p">)</span> +</span><span id="L-1195"><a href="#L-1195"><span class="linenos">1195</span></a> +</span><span id="L-1196"><a href="#L-1196"><span class="linenos">1196</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="L-1197"><a href="#L-1197"><span class="linenos">1197</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-1198"><a href="#L-1198"><span class="linenos">1198</span></a> +</span><span id="L-1199"><a href="#L-1199"><span class="linenos">1199</span></a> <span class="k">return</span> <span class="n">join</span> +</span><span id="L-1200"><a href="#L-1200"><span class="linenos">1200</span></a> +</span><span id="L-1201"><a href="#L-1201"><span class="linenos">1201</span></a> <span class="k">def</span> <span class="nf">using</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-1202"><a href="#L-1202"><span class="linenos">1202</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1203"><a href="#L-1203"><span class="linenos">1203</span></a><span class="sd"> Append to or set the USING expressions.</span> +</span><span id="L-1204"><a href="#L-1204"><span class="linenos">1204</span></a> +</span><span id="L-1205"><a href="#L-1205"><span class="linenos">1205</span></a><span class="sd"> Example:</span> +</span><span id="L-1206"><a href="#L-1206"><span class="linenos">1206</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-1207"><a href="#L-1207"><span class="linenos">1207</span></a><span class="sd"> >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql()</span> +</span><span id="L-1208"><a href="#L-1208"><span class="linenos">1208</span></a><span class="sd"> 'JOIN x USING (foo, bla)'</span> +</span><span id="L-1209"><a href="#L-1209"><span class="linenos">1209</span></a> +</span><span id="L-1210"><a href="#L-1210"><span class="linenos">1210</span></a><span class="sd"> Args:</span> +</span><span id="L-1211"><a href="#L-1211"><span class="linenos">1211</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1212"><a href="#L-1212"><span class="linenos">1212</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-1213"><a href="#L-1213"><span class="linenos">1213</span></a><span class="sd"> append (bool): if `True`, concatenate the new expressions to the existing "using" list.</span> +</span><span id="L-1214"><a href="#L-1214"><span class="linenos">1214</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="L-1215"><a href="#L-1215"><span class="linenos">1215</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-1216"><a href="#L-1216"><span class="linenos">1216</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1217"><a href="#L-1217"><span class="linenos">1217</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1218"><a href="#L-1218"><span class="linenos">1218</span></a> +</span><span id="L-1219"><a href="#L-1219"><span class="linenos">1219</span></a><span class="sd"> Returns:</span> +</span><span id="L-1220"><a href="#L-1220"><span class="linenos">1220</span></a><span class="sd"> Join: the modified join expression.</span> +</span><span id="L-1221"><a href="#L-1221"><span class="linenos">1221</span></a><span class="sd"> """</span> +</span><span id="L-1222"><a href="#L-1222"><span class="linenos">1222</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-1223"><a href="#L-1223"><span class="linenos">1223</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1224"><a href="#L-1224"><span class="linenos">1224</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1225"><a href="#L-1225"><span class="linenos">1225</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"using"</span><span class="p">,</span> +</span><span id="L-1226"><a href="#L-1226"><span class="linenos">1226</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1227"><a href="#L-1227"><span class="linenos">1227</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1228"><a href="#L-1228"><span class="linenos">1228</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1229"><a href="#L-1229"><span class="linenos">1229</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1230"><a href="#L-1230"><span class="linenos">1230</span></a> <span class="p">)</span> +</span><span id="L-1231"><a href="#L-1231"><span class="linenos">1231</span></a> +</span><span id="L-1232"><a href="#L-1232"><span class="linenos">1232</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="L-1233"><a href="#L-1233"><span class="linenos">1233</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-1234"><a href="#L-1234"><span class="linenos">1234</span></a> +</span><span id="L-1235"><a href="#L-1235"><span class="linenos">1235</span></a> <span class="k">return</span> <span class="n">join</span> +</span><span id="L-1236"><a href="#L-1236"><span class="linenos">1236</span></a> +</span><span id="L-1237"><a href="#L-1237"><span class="linenos">1237</span></a> +</span><span id="L-1238"><a href="#L-1238"><span class="linenos">1238</span></a><span class="k">class</span> <span class="nc">Lateral</span><span class="p">(</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-1239"><a href="#L-1239"><span class="linenos">1239</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"view"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"outer"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1240"><a href="#L-1240"><span class="linenos">1240</span></a> +</span><span id="L-1241"><a href="#L-1241"><span class="linenos">1241</span></a> +</span><span id="L-1242"><a href="#L-1242"><span class="linenos">1242</span></a><span class="k">class</span> <span class="nc">MatchRecognize</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1243"><a href="#L-1243"><span class="linenos">1243</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1244"><a href="#L-1244"><span class="linenos">1244</span></a> <span class="s2">"partition_by"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1245"><a href="#L-1245"><span class="linenos">1245</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1246"><a href="#L-1246"><span class="linenos">1246</span></a> <span class="s2">"measures"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1247"><a href="#L-1247"><span class="linenos">1247</span></a> <span class="s2">"rows"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1248"><a href="#L-1248"><span class="linenos">1248</span></a> <span class="s2">"after"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1249"><a href="#L-1249"><span class="linenos">1249</span></a> <span class="s2">"pattern"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1250"><a href="#L-1250"><span class="linenos">1250</span></a> <span class="s2">"define"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1251"><a href="#L-1251"><span class="linenos">1251</span></a> <span class="p">}</span> +</span><span id="L-1252"><a href="#L-1252"><span class="linenos">1252</span></a> +</span><span id="L-1253"><a href="#L-1253"><span class="linenos">1253</span></a> +</span><span id="L-1254"><a href="#L-1254"><span class="linenos">1254</span></a><span class="c1"># Clickhouse FROM FINAL modifier</span> +</span><span id="L-1255"><a href="#L-1255"><span class="linenos">1255</span></a><span class="c1"># https://clickhouse.com/docs/en/sql-reference/statements/select/from/#final-modifier</span> +</span><span id="L-1256"><a href="#L-1256"><span class="linenos">1256</span></a><span class="k">class</span> <span class="nc">Final</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1257"><a href="#L-1257"><span class="linenos">1257</span></a> <span class="k">pass</span> +</span><span id="L-1258"><a href="#L-1258"><span class="linenos">1258</span></a> +</span><span id="L-1259"><a href="#L-1259"><span class="linenos">1259</span></a> +</span><span id="L-1260"><a href="#L-1260"><span class="linenos">1260</span></a><span class="k">class</span> <span class="nc">Offset</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1261"><a href="#L-1261"><span class="linenos">1261</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1262"><a href="#L-1262"><span class="linenos">1262</span></a> +</span><span id="L-1263"><a href="#L-1263"><span class="linenos">1263</span></a> +</span><span id="L-1264"><a href="#L-1264"><span class="linenos">1264</span></a><span class="k">class</span> <span class="nc">Order</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1265"><a href="#L-1265"><span class="linenos">1265</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1266"><a href="#L-1266"><span class="linenos">1266</span></a> +</span><span id="L-1267"><a href="#L-1267"><span class="linenos">1267</span></a> +</span><span id="L-1268"><a href="#L-1268"><span class="linenos">1268</span></a><span class="c1"># hive specific sorts</span> +</span><span id="L-1269"><a href="#L-1269"><span class="linenos">1269</span></a><span class="c1"># https://cwiki.apache.org/confluence/display/Hive/LanguageManual+SortBy</span> +</span><span id="L-1270"><a href="#L-1270"><span class="linenos">1270</span></a><span class="k">class</span> <span class="nc">Cluster</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span> +</span><span id="L-1271"><a href="#L-1271"><span class="linenos">1271</span></a> <span class="k">pass</span> +</span><span id="L-1272"><a href="#L-1272"><span class="linenos">1272</span></a> +</span><span id="L-1273"><a href="#L-1273"><span class="linenos">1273</span></a> +</span><span id="L-1274"><a href="#L-1274"><span class="linenos">1274</span></a><span class="k">class</span> <span class="nc">Distribute</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span> +</span><span id="L-1275"><a href="#L-1275"><span class="linenos">1275</span></a> <span class="k">pass</span> +</span><span id="L-1276"><a href="#L-1276"><span class="linenos">1276</span></a> +</span><span id="L-1277"><a href="#L-1277"><span class="linenos">1277</span></a> +</span><span id="L-1278"><a href="#L-1278"><span class="linenos">1278</span></a><span class="k">class</span> <span class="nc">Sort</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span> +</span><span id="L-1279"><a href="#L-1279"><span class="linenos">1279</span></a> <span class="k">pass</span> +</span><span id="L-1280"><a href="#L-1280"><span class="linenos">1280</span></a> +</span><span id="L-1281"><a href="#L-1281"><span class="linenos">1281</span></a> +</span><span id="L-1282"><a href="#L-1282"><span class="linenos">1282</span></a><span class="k">class</span> <span class="nc">Ordered</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1283"><a href="#L-1283"><span class="linenos">1283</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"desc"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"nulls_first"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1284"><a href="#L-1284"><span class="linenos">1284</span></a> +</span><span id="L-1285"><a href="#L-1285"><span class="linenos">1285</span></a> +</span><span id="L-1286"><a href="#L-1286"><span class="linenos">1286</span></a><span class="k">class</span> <span class="nc">Property</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1287"><a href="#L-1287"><span class="linenos">1287</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"value"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1288"><a href="#L-1288"><span class="linenos">1288</span></a> +</span><span id="L-1289"><a href="#L-1289"><span class="linenos">1289</span></a> +</span><span id="L-1290"><a href="#L-1290"><span class="linenos">1290</span></a><span class="k">class</span> <span class="nc">AlgorithmProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1291"><a href="#L-1291"><span class="linenos">1291</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1292"><a href="#L-1292"><span class="linenos">1292</span></a> +</span><span id="L-1293"><a href="#L-1293"><span class="linenos">1293</span></a> +</span><span id="L-1294"><a href="#L-1294"><span class="linenos">1294</span></a><span class="k">class</span> <span class="nc">DefinerProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1295"><a href="#L-1295"><span class="linenos">1295</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1296"><a href="#L-1296"><span class="linenos">1296</span></a> +</span><span id="L-1297"><a href="#L-1297"><span class="linenos">1297</span></a> +</span><span id="L-1298"><a href="#L-1298"><span class="linenos">1298</span></a><span class="k">class</span> <span class="nc">SqlSecurityProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1299"><a href="#L-1299"><span class="linenos">1299</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"definer"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1300"><a href="#L-1300"><span class="linenos">1300</span></a> +</span><span id="L-1301"><a href="#L-1301"><span class="linenos">1301</span></a> +</span><span id="L-1302"><a href="#L-1302"><span class="linenos">1302</span></a><span class="k">class</span> <span class="nc">TableFormatProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1303"><a href="#L-1303"><span class="linenos">1303</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1304"><a href="#L-1304"><span class="linenos">1304</span></a> +</span><span id="L-1305"><a href="#L-1305"><span class="linenos">1305</span></a> +</span><span id="L-1306"><a href="#L-1306"><span class="linenos">1306</span></a><span class="k">class</span> <span class="nc">PartitionedByProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1307"><a href="#L-1307"><span class="linenos">1307</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1308"><a href="#L-1308"><span class="linenos">1308</span></a> +</span><span id="L-1309"><a href="#L-1309"><span class="linenos">1309</span></a> +</span><span id="L-1310"><a href="#L-1310"><span class="linenos">1310</span></a><span class="k">class</span> <span class="nc">FileFormatProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1311"><a href="#L-1311"><span class="linenos">1311</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1312"><a href="#L-1312"><span class="linenos">1312</span></a> +</span><span id="L-1313"><a href="#L-1313"><span class="linenos">1313</span></a> +</span><span id="L-1314"><a href="#L-1314"><span class="linenos">1314</span></a><span class="k">class</span> <span class="nc">DistKeyProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1315"><a href="#L-1315"><span class="linenos">1315</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1316"><a href="#L-1316"><span class="linenos">1316</span></a> +</span><span id="L-1317"><a href="#L-1317"><span class="linenos">1317</span></a> +</span><span id="L-1318"><a href="#L-1318"><span class="linenos">1318</span></a><span class="k">class</span> <span class="nc">SortKeyProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1319"><a href="#L-1319"><span class="linenos">1319</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"compound"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1320"><a href="#L-1320"><span class="linenos">1320</span></a> +</span><span id="L-1321"><a href="#L-1321"><span class="linenos">1321</span></a> +</span><span id="L-1322"><a href="#L-1322"><span class="linenos">1322</span></a><span class="k">class</span> <span class="nc">DistStyleProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1323"><a href="#L-1323"><span class="linenos">1323</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1324"><a href="#L-1324"><span class="linenos">1324</span></a> +</span><span id="L-1325"><a href="#L-1325"><span class="linenos">1325</span></a> +</span><span id="L-1326"><a href="#L-1326"><span class="linenos">1326</span></a><span class="k">class</span> <span class="nc">LikeProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1327"><a href="#L-1327"><span class="linenos">1327</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1328"><a href="#L-1328"><span class="linenos">1328</span></a> +</span><span id="L-1329"><a href="#L-1329"><span class="linenos">1329</span></a> +</span><span id="L-1330"><a href="#L-1330"><span class="linenos">1330</span></a><span class="k">class</span> <span class="nc">LocationProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1331"><a href="#L-1331"><span class="linenos">1331</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1332"><a href="#L-1332"><span class="linenos">1332</span></a> +</span><span id="L-1333"><a href="#L-1333"><span class="linenos">1333</span></a> +</span><span id="L-1334"><a href="#L-1334"><span class="linenos">1334</span></a><span class="k">class</span> <span class="nc">EngineProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1335"><a href="#L-1335"><span class="linenos">1335</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1336"><a href="#L-1336"><span class="linenos">1336</span></a> +</span><span id="L-1337"><a href="#L-1337"><span class="linenos">1337</span></a> +</span><span id="L-1338"><a href="#L-1338"><span class="linenos">1338</span></a><span class="k">class</span> <span class="nc">AutoIncrementProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1339"><a href="#L-1339"><span class="linenos">1339</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1340"><a href="#L-1340"><span class="linenos">1340</span></a> +</span><span id="L-1341"><a href="#L-1341"><span class="linenos">1341</span></a> +</span><span id="L-1342"><a href="#L-1342"><span class="linenos">1342</span></a><span class="k">class</span> <span class="nc">CharacterSetProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1343"><a href="#L-1343"><span class="linenos">1343</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1344"><a href="#L-1344"><span class="linenos">1344</span></a> +</span><span id="L-1345"><a href="#L-1345"><span class="linenos">1345</span></a> +</span><span id="L-1346"><a href="#L-1346"><span class="linenos">1346</span></a><span class="k">class</span> <span class="nc">CollateProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1347"><a href="#L-1347"><span class="linenos">1347</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1348"><a href="#L-1348"><span class="linenos">1348</span></a> +</span><span id="L-1349"><a href="#L-1349"><span class="linenos">1349</span></a> +</span><span id="L-1350"><a href="#L-1350"><span class="linenos">1350</span></a><span class="k">class</span> <span class="nc">SchemaCommentProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1351"><a href="#L-1351"><span class="linenos">1351</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1352"><a href="#L-1352"><span class="linenos">1352</span></a> +</span><span id="L-1353"><a href="#L-1353"><span class="linenos">1353</span></a> +</span><span id="L-1354"><a href="#L-1354"><span class="linenos">1354</span></a><span class="k">class</span> <span class="nc">ReturnsProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1355"><a href="#L-1355"><span class="linenos">1355</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"is_table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1356"><a href="#L-1356"><span class="linenos">1356</span></a> +</span><span id="L-1357"><a href="#L-1357"><span class="linenos">1357</span></a> +</span><span id="L-1358"><a href="#L-1358"><span class="linenos">1358</span></a><span class="k">class</span> <span class="nc">LanguageProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1359"><a href="#L-1359"><span class="linenos">1359</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1360"><a href="#L-1360"><span class="linenos">1360</span></a> +</span><span id="L-1361"><a href="#L-1361"><span class="linenos">1361</span></a> +</span><span id="L-1362"><a href="#L-1362"><span class="linenos">1362</span></a><span class="k">class</span> <span class="nc">ExecuteAsProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1363"><a href="#L-1363"><span class="linenos">1363</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1364"><a href="#L-1364"><span class="linenos">1364</span></a> +</span><span id="L-1365"><a href="#L-1365"><span class="linenos">1365</span></a> +</span><span id="L-1366"><a href="#L-1366"><span class="linenos">1366</span></a><span class="k">class</span> <span class="nc">VolatilityProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1367"><a href="#L-1367"><span class="linenos">1367</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1368"><a href="#L-1368"><span class="linenos">1368</span></a> +</span><span id="L-1369"><a href="#L-1369"><span class="linenos">1369</span></a> +</span><span id="L-1370"><a href="#L-1370"><span class="linenos">1370</span></a><span class="k">class</span> <span class="nc">RowFormatDelimitedProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1371"><a href="#L-1371"><span class="linenos">1371</span></a> <span class="c1"># https://cwiki.apache.org/confluence/display/hive/languagemanual+dml</span> +</span><span id="L-1372"><a href="#L-1372"><span class="linenos">1372</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1373"><a href="#L-1373"><span class="linenos">1373</span></a> <span class="s2">"fields"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1374"><a href="#L-1374"><span class="linenos">1374</span></a> <span class="s2">"escaped"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1375"><a href="#L-1375"><span class="linenos">1375</span></a> <span class="s2">"collection_items"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1376"><a href="#L-1376"><span class="linenos">1376</span></a> <span class="s2">"map_keys"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1377"><a href="#L-1377"><span class="linenos">1377</span></a> <span class="s2">"lines"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1378"><a href="#L-1378"><span class="linenos">1378</span></a> <span class="s2">"null"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1379"><a href="#L-1379"><span class="linenos">1379</span></a> <span class="s2">"serde"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1380"><a href="#L-1380"><span class="linenos">1380</span></a> <span class="p">}</span> +</span><span id="L-1381"><a href="#L-1381"><span class="linenos">1381</span></a> +</span><span id="L-1382"><a href="#L-1382"><span class="linenos">1382</span></a> +</span><span id="L-1383"><a href="#L-1383"><span class="linenos">1383</span></a><span class="k">class</span> <span class="nc">RowFormatSerdeProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1384"><a href="#L-1384"><span class="linenos">1384</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1385"><a href="#L-1385"><span class="linenos">1385</span></a> +</span><span id="L-1386"><a href="#L-1386"><span class="linenos">1386</span></a> +</span><span id="L-1387"><a href="#L-1387"><span class="linenos">1387</span></a><span class="k">class</span> <span class="nc">SerdeProperties</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1388"><a href="#L-1388"><span class="linenos">1388</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1389"><a href="#L-1389"><span class="linenos">1389</span></a> +</span><span id="L-1390"><a href="#L-1390"><span class="linenos">1390</span></a> +</span><span id="L-1391"><a href="#L-1391"><span class="linenos">1391</span></a><span class="k">class</span> <span class="nc">FallbackProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1392"><a href="#L-1392"><span class="linenos">1392</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"protection"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1393"><a href="#L-1393"><span class="linenos">1393</span></a> +</span><span id="L-1394"><a href="#L-1394"><span class="linenos">1394</span></a> +</span><span id="L-1395"><a href="#L-1395"><span class="linenos">1395</span></a><span class="k">class</span> <span class="nc">WithJournalTableProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1396"><a href="#L-1396"><span class="linenos">1396</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1397"><a href="#L-1397"><span class="linenos">1397</span></a> +</span><span id="L-1398"><a href="#L-1398"><span class="linenos">1398</span></a> +</span><span id="L-1399"><a href="#L-1399"><span class="linenos">1399</span></a><span class="k">class</span> <span class="nc">LogProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1400"><a href="#L-1400"><span class="linenos">1400</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1401"><a href="#L-1401"><span class="linenos">1401</span></a> +</span><span id="L-1402"><a href="#L-1402"><span class="linenos">1402</span></a> +</span><span id="L-1403"><a href="#L-1403"><span class="linenos">1403</span></a><span class="k">class</span> <span class="nc">JournalProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1404"><a href="#L-1404"><span class="linenos">1404</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"dual"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"before"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1405"><a href="#L-1405"><span class="linenos">1405</span></a> +</span><span id="L-1406"><a href="#L-1406"><span class="linenos">1406</span></a> +</span><span id="L-1407"><a href="#L-1407"><span class="linenos">1407</span></a><span class="k">class</span> <span class="nc">AfterJournalProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1408"><a href="#L-1408"><span class="linenos">1408</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"dual"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"local"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1409"><a href="#L-1409"><span class="linenos">1409</span></a> +</span><span id="L-1410"><a href="#L-1410"><span class="linenos">1410</span></a> +</span><span id="L-1411"><a href="#L-1411"><span class="linenos">1411</span></a><span class="k">class</span> <span class="nc">ChecksumProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1412"><a href="#L-1412"><span class="linenos">1412</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"on"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1413"><a href="#L-1413"><span class="linenos">1413</span></a> +</span><span id="L-1414"><a href="#L-1414"><span class="linenos">1414</span></a> +</span><span id="L-1415"><a href="#L-1415"><span class="linenos">1415</span></a><span class="k">class</span> <span class="nc">FreespaceProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1416"><a href="#L-1416"><span class="linenos">1416</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1417"><a href="#L-1417"><span class="linenos">1417</span></a> +</span><span id="L-1418"><a href="#L-1418"><span class="linenos">1418</span></a> +</span><span id="L-1419"><a href="#L-1419"><span class="linenos">1419</span></a><span class="k">class</span> <span class="nc">MergeBlockRatioProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1420"><a href="#L-1420"><span class="linenos">1420</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"no"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1421"><a href="#L-1421"><span class="linenos">1421</span></a> +</span><span id="L-1422"><a href="#L-1422"><span class="linenos">1422</span></a> +</span><span id="L-1423"><a href="#L-1423"><span class="linenos">1423</span></a><span class="k">class</span> <span class="nc">DataBlocksizeProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1424"><a href="#L-1424"><span class="linenos">1424</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"size"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"units"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"min"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1425"><a href="#L-1425"><span class="linenos">1425</span></a> +</span><span id="L-1426"><a href="#L-1426"><span class="linenos">1426</span></a> +</span><span id="L-1427"><a href="#L-1427"><span class="linenos">1427</span></a><span class="k">class</span> <span class="nc">BlockCompressionProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1428"><a href="#L-1428"><span class="linenos">1428</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"autotemp"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"always"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"manual"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"never"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1429"><a href="#L-1429"><span class="linenos">1429</span></a> +</span><span id="L-1430"><a href="#L-1430"><span class="linenos">1430</span></a> +</span><span id="L-1431"><a href="#L-1431"><span class="linenos">1431</span></a><span class="k">class</span> <span class="nc">IsolatedLoadingProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-1432"><a href="#L-1432"><span class="linenos">1432</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1433"><a href="#L-1433"><span class="linenos">1433</span></a> <span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1434"><a href="#L-1434"><span class="linenos">1434</span></a> <span class="s2">"concurrent"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1435"><a href="#L-1435"><span class="linenos">1435</span></a> <span class="s2">"for_all"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1436"><a href="#L-1436"><span class="linenos">1436</span></a> <span class="s2">"for_insert"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1437"><a href="#L-1437"><span class="linenos">1437</span></a> <span class="s2">"for_none"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1438"><a href="#L-1438"><span class="linenos">1438</span></a> <span class="p">}</span> +</span><span id="L-1439"><a href="#L-1439"><span class="linenos">1439</span></a> +</span><span id="L-1440"><a href="#L-1440"><span class="linenos">1440</span></a> +</span><span id="L-1441"><a href="#L-1441"><span class="linenos">1441</span></a><span class="k">class</span> <span class="nc">Properties</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1442"><a href="#L-1442"><span class="linenos">1442</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1443"><a href="#L-1443"><span class="linenos">1443</span></a> +</span><span id="L-1444"><a href="#L-1444"><span class="linenos">1444</span></a> <span class="n">NAME_TO_PROPERTY</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1445"><a href="#L-1445"><span class="linenos">1445</span></a> <span class="s2">"ALGORITHM"</span><span class="p">:</span> <span class="n">AlgorithmProperty</span><span class="p">,</span> +</span><span id="L-1446"><a href="#L-1446"><span class="linenos">1446</span></a> <span class="s2">"AUTO_INCREMENT"</span><span class="p">:</span> <span class="n">AutoIncrementProperty</span><span class="p">,</span> +</span><span id="L-1447"><a href="#L-1447"><span class="linenos">1447</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">CharacterSetProperty</span><span class="p">,</span> +</span><span id="L-1448"><a href="#L-1448"><span class="linenos">1448</span></a> <span class="s2">"COLLATE"</span><span class="p">:</span> <span class="n">CollateProperty</span><span class="p">,</span> +</span><span id="L-1449"><a href="#L-1449"><span class="linenos">1449</span></a> <span class="s2">"COMMENT"</span><span class="p">:</span> <span class="n">SchemaCommentProperty</span><span class="p">,</span> +</span><span id="L-1450"><a href="#L-1450"><span class="linenos">1450</span></a> <span class="s2">"DEFINER"</span><span class="p">:</span> <span class="n">DefinerProperty</span><span class="p">,</span> +</span><span id="L-1451"><a href="#L-1451"><span class="linenos">1451</span></a> <span class="s2">"DISTKEY"</span><span class="p">:</span> <span class="n">DistKeyProperty</span><span class="p">,</span> +</span><span id="L-1452"><a href="#L-1452"><span class="linenos">1452</span></a> <span class="s2">"DISTSTYLE"</span><span class="p">:</span> <span class="n">DistStyleProperty</span><span class="p">,</span> +</span><span id="L-1453"><a href="#L-1453"><span class="linenos">1453</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="n">EngineProperty</span><span class="p">,</span> +</span><span id="L-1454"><a href="#L-1454"><span class="linenos">1454</span></a> <span class="s2">"EXECUTE AS"</span><span class="p">:</span> <span class="n">ExecuteAsProperty</span><span class="p">,</span> +</span><span id="L-1455"><a href="#L-1455"><span class="linenos">1455</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">FileFormatProperty</span><span class="p">,</span> +</span><span id="L-1456"><a href="#L-1456"><span class="linenos">1456</span></a> <span class="s2">"LANGUAGE"</span><span class="p">:</span> <span class="n">LanguageProperty</span><span class="p">,</span> +</span><span id="L-1457"><a href="#L-1457"><span class="linenos">1457</span></a> <span class="s2">"LOCATION"</span><span class="p">:</span> <span class="n">LocationProperty</span><span class="p">,</span> +</span><span id="L-1458"><a href="#L-1458"><span class="linenos">1458</span></a> <span class="s2">"PARTITIONED_BY"</span><span class="p">:</span> <span class="n">PartitionedByProperty</span><span class="p">,</span> +</span><span id="L-1459"><a href="#L-1459"><span class="linenos">1459</span></a> <span class="s2">"RETURNS"</span><span class="p">:</span> <span class="n">ReturnsProperty</span><span class="p">,</span> +</span><span id="L-1460"><a href="#L-1460"><span class="linenos">1460</span></a> <span class="s2">"SORTKEY"</span><span class="p">:</span> <span class="n">SortKeyProperty</span><span class="p">,</span> +</span><span id="L-1461"><a href="#L-1461"><span class="linenos">1461</span></a> <span class="s2">"TABLE_FORMAT"</span><span class="p">:</span> <span class="n">TableFormatProperty</span><span class="p">,</span> +</span><span id="L-1462"><a href="#L-1462"><span class="linenos">1462</span></a> <span class="p">}</span> +</span><span id="L-1463"><a href="#L-1463"><span class="linenos">1463</span></a> +</span><span id="L-1464"><a href="#L-1464"><span class="linenos">1464</span></a> <span class="n">PROPERTY_TO_NAME</span> <span class="o">=</span> <span class="p">{</span><span class="n">v</span><span class="p">:</span> <span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">NAME_TO_PROPERTY</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="L-1465"><a href="#L-1465"><span class="linenos">1465</span></a> +</span><span id="L-1466"><a href="#L-1466"><span class="linenos">1466</span></a> <span class="k">class</span> <span class="nc">Location</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="L-1467"><a href="#L-1467"><span class="linenos">1467</span></a> <span class="n">POST_CREATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-1468"><a href="#L-1468"><span class="linenos">1468</span></a> <span class="n">PRE_SCHEMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-1469"><a href="#L-1469"><span class="linenos">1469</span></a> <span class="n">POST_INDEX</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-1470"><a href="#L-1470"><span class="linenos">1470</span></a> <span class="n">POST_SCHEMA_ROOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-1471"><a href="#L-1471"><span class="linenos">1471</span></a> <span class="n">POST_SCHEMA_WITH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-1472"><a href="#L-1472"><span class="linenos">1472</span></a> <span class="n">UNSUPPORTED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-1473"><a href="#L-1473"><span class="linenos">1473</span></a> +</span><span id="L-1474"><a href="#L-1474"><span class="linenos">1474</span></a> <span class="nd">@classmethod</span> +</span><span id="L-1475"><a href="#L-1475"><span class="linenos">1475</span></a> <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">properties_dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">Properties</span><span class="p">:</span> +</span><span id="L-1476"><a href="#L-1476"><span class="linenos">1476</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1477"><a href="#L-1477"><span class="linenos">1477</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">properties_dict</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-1478"><a href="#L-1478"><span class="linenos">1478</span></a> <span class="n">property_cls</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">NAME_TO_PROPERTY</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="L-1479"><a href="#L-1479"><span class="linenos">1479</span></a> <span class="k">if</span> <span class="n">property_cls</span><span class="p">:</span> +</span><span id="L-1480"><a href="#L-1480"><span class="linenos">1480</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">property_cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span> +</span><span id="L-1481"><a href="#L-1481"><span class="linenos">1481</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1482"><a href="#L-1482"><span class="linenos">1482</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Property</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">key</span><span class="p">),</span> <span class="n">value</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span> +</span><span id="L-1483"><a href="#L-1483"><span class="linenos">1483</span></a> +</span><span id="L-1484"><a href="#L-1484"><span class="linenos">1484</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-1485"><a href="#L-1485"><span class="linenos">1485</span></a> +</span><span id="L-1486"><a href="#L-1486"><span class="linenos">1486</span></a> +</span><span id="L-1487"><a href="#L-1487"><span class="linenos">1487</span></a><span class="k">class</span> <span class="nc">Qualify</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1488"><a href="#L-1488"><span class="linenos">1488</span></a> <span class="k">pass</span> +</span><span id="L-1489"><a href="#L-1489"><span class="linenos">1489</span></a> +</span><span id="L-1490"><a href="#L-1490"><span class="linenos">1490</span></a> +</span><span id="L-1491"><a href="#L-1491"><span class="linenos">1491</span></a><span class="c1"># https://www.ibm.com/docs/en/ias?topic=procedures-return-statement-in-sql</span> +</span><span id="L-1492"><a href="#L-1492"><span class="linenos">1492</span></a><span class="k">class</span> <span class="nc">Return</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1493"><a href="#L-1493"><span class="linenos">1493</span></a> <span class="k">pass</span> +</span><span id="L-1494"><a href="#L-1494"><span class="linenos">1494</span></a> +</span><span id="L-1495"><a href="#L-1495"><span class="linenos">1495</span></a> +</span><span id="L-1496"><a href="#L-1496"><span class="linenos">1496</span></a><span class="k">class</span> <span class="nc">Reference</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1497"><a href="#L-1497"><span class="linenos">1497</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1498"><a href="#L-1498"><span class="linenos">1498</span></a> +</span><span id="L-1499"><a href="#L-1499"><span class="linenos">1499</span></a> +</span><span id="L-1500"><a href="#L-1500"><span class="linenos">1500</span></a><span class="k">class</span> <span class="nc">Tuple</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1501"><a href="#L-1501"><span class="linenos">1501</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1502"><a href="#L-1502"><span class="linenos">1502</span></a> +</span><span id="L-1503"><a href="#L-1503"><span class="linenos">1503</span></a> +</span><span id="L-1504"><a href="#L-1504"><span class="linenos">1504</span></a><span class="k">class</span> <span class="nc">Subqueryable</span><span class="p">(</span><span class="n">Unionable</span><span class="p">):</span> +</span><span id="L-1505"><a href="#L-1505"><span class="linenos">1505</span></a> <span class="k">def</span> <span class="nf">subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Subquery</span><span class="p">:</span> +</span><span id="L-1506"><a href="#L-1506"><span class="linenos">1506</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1507"><a href="#L-1507"><span class="linenos">1507</span></a><span class="sd"> Convert this expression to an aliased expression that can be used as a Subquery.</span> +</span><span id="L-1508"><a href="#L-1508"><span class="linenos">1508</span></a> +</span><span id="L-1509"><a href="#L-1509"><span class="linenos">1509</span></a><span class="sd"> Example:</span> +</span><span id="L-1510"><a href="#L-1510"><span class="linenos">1510</span></a><span class="sd"> >>> subquery = Select().select("x").from_("tbl").subquery()</span> +</span><span id="L-1511"><a href="#L-1511"><span class="linenos">1511</span></a><span class="sd"> >>> Select().select("x").from_(subquery).sql()</span> +</span><span id="L-1512"><a href="#L-1512"><span class="linenos">1512</span></a><span class="sd"> 'SELECT x FROM (SELECT x FROM tbl)'</span> +</span><span id="L-1513"><a href="#L-1513"><span class="linenos">1513</span></a> +</span><span id="L-1514"><a href="#L-1514"><span class="linenos">1514</span></a><span class="sd"> Args:</span> +</span><span id="L-1515"><a href="#L-1515"><span class="linenos">1515</span></a><span class="sd"> alias (str | Identifier): an optional alias for the subquery</span> +</span><span id="L-1516"><a href="#L-1516"><span class="linenos">1516</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1517"><a href="#L-1517"><span class="linenos">1517</span></a> +</span><span id="L-1518"><a href="#L-1518"><span class="linenos">1518</span></a><span class="sd"> Returns:</span> +</span><span id="L-1519"><a href="#L-1519"><span class="linenos">1519</span></a><span class="sd"> Alias: the subquery</span> +</span><span id="L-1520"><a href="#L-1520"><span class="linenos">1520</span></a><span class="sd"> """</span> +</span><span id="L-1521"><a href="#L-1521"><span class="linenos">1521</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-1522"><a href="#L-1522"><span class="linenos">1522</span></a> <span class="k">return</span> <span class="n">Subquery</span><span class="p">(</span> +</span><span id="L-1523"><a href="#L-1523"><span class="linenos">1523</span></a> <span class="n">this</span><span class="o">=</span><span class="n">instance</span><span class="p">,</span> +</span><span id="L-1524"><a href="#L-1524"><span class="linenos">1524</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">)),</span> +</span><span id="L-1525"><a href="#L-1525"><span class="linenos">1525</span></a> <span class="p">)</span> +</span><span id="L-1526"><a href="#L-1526"><span class="linenos">1526</span></a> +</span><span id="L-1527"><a href="#L-1527"><span class="linenos">1527</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1528"><a href="#L-1528"><span class="linenos">1528</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="L-1529"><a href="#L-1529"><span class="linenos">1529</span></a> +</span><span id="L-1530"><a href="#L-1530"><span class="linenos">1530</span></a> <span class="nd">@property</span> +</span><span id="L-1531"><a href="#L-1531"><span class="linenos">1531</span></a> <span class="k">def</span> <span class="nf">ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1532"><a href="#L-1532"><span class="linenos">1532</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="L-1533"><a href="#L-1533"><span class="linenos">1533</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="L-1534"><a href="#L-1534"><span class="linenos">1534</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-1535"><a href="#L-1535"><span class="linenos">1535</span></a> <span class="k">return</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-1536"><a href="#L-1536"><span class="linenos">1536</span></a> +</span><span id="L-1537"><a href="#L-1537"><span class="linenos">1537</span></a> <span class="nd">@property</span> +</span><span id="L-1538"><a href="#L-1538"><span class="linenos">1538</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1539"><a href="#L-1539"><span class="linenos">1539</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Subqueryable objects must implement `selects`"</span><span class="p">)</span> +</span><span id="L-1540"><a href="#L-1540"><span class="linenos">1540</span></a> +</span><span id="L-1541"><a href="#L-1541"><span class="linenos">1541</span></a> <span class="nd">@property</span> +</span><span id="L-1542"><a href="#L-1542"><span class="linenos">1542</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1543"><a href="#L-1543"><span class="linenos">1543</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Subqueryable objects must implement `named_selects`"</span><span class="p">)</span> +</span><span id="L-1544"><a href="#L-1544"><span class="linenos">1544</span></a> +</span><span id="L-1545"><a href="#L-1545"><span class="linenos">1545</span></a> <span class="k">def</span> <span class="nf">with_</span><span class="p">(</span> +</span><span id="L-1546"><a href="#L-1546"><span class="linenos">1546</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-1547"><a href="#L-1547"><span class="linenos">1547</span></a> <span class="n">alias</span><span class="p">,</span> +</span><span id="L-1548"><a href="#L-1548"><span class="linenos">1548</span></a> <span class="n">as_</span><span class="p">,</span> +</span><span id="L-1549"><a href="#L-1549"><span class="linenos">1549</span></a> <span class="n">recursive</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-1550"><a href="#L-1550"><span class="linenos">1550</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-1551"><a href="#L-1551"><span class="linenos">1551</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-1552"><a href="#L-1552"><span class="linenos">1552</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-1553"><a href="#L-1553"><span class="linenos">1553</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1554"><a href="#L-1554"><span class="linenos">1554</span></a> <span class="p">):</span> +</span><span id="L-1555"><a href="#L-1555"><span class="linenos">1555</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1556"><a href="#L-1556"><span class="linenos">1556</span></a><span class="sd"> Append to or set the common table expressions.</span> +</span><span id="L-1557"><a href="#L-1557"><span class="linenos">1557</span></a> +</span><span id="L-1558"><a href="#L-1558"><span class="linenos">1558</span></a><span class="sd"> Example:</span> +</span><span id="L-1559"><a href="#L-1559"><span class="linenos">1559</span></a><span class="sd"> >>> Select().with_("tbl2", as_="SELECT * FROM tbl").select("x").from_("tbl2").sql()</span> +</span><span id="L-1560"><a href="#L-1560"><span class="linenos">1560</span></a><span class="sd"> 'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2'</span> +</span><span id="L-1561"><a href="#L-1561"><span class="linenos">1561</span></a> +</span><span id="L-1562"><a href="#L-1562"><span class="linenos">1562</span></a><span class="sd"> Args:</span> +</span><span id="L-1563"><a href="#L-1563"><span class="linenos">1563</span></a><span class="sd"> alias (str | Expression): the SQL code string to parse as the table name.</span> +</span><span id="L-1564"><a href="#L-1564"><span class="linenos">1564</span></a><span class="sd"> If an `Expression` instance is passed, this is used as-is.</span> +</span><span id="L-1565"><a href="#L-1565"><span class="linenos">1565</span></a><span class="sd"> as_ (str | Expression): the SQL code string to parse as the table expression.</span> +</span><span id="L-1566"><a href="#L-1566"><span class="linenos">1566</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-1567"><a href="#L-1567"><span class="linenos">1567</span></a><span class="sd"> recursive (bool): set the RECURSIVE part of the expression. Defaults to `False`.</span> +</span><span id="L-1568"><a href="#L-1568"><span class="linenos">1568</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-1569"><a href="#L-1569"><span class="linenos">1569</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="L-1570"><a href="#L-1570"><span class="linenos">1570</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1571"><a href="#L-1571"><span class="linenos">1571</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1572"><a href="#L-1572"><span class="linenos">1572</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1573"><a href="#L-1573"><span class="linenos">1573</span></a> +</span><span id="L-1574"><a href="#L-1574"><span class="linenos">1574</span></a><span class="sd"> Returns:</span> +</span><span id="L-1575"><a href="#L-1575"><span class="linenos">1575</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1576"><a href="#L-1576"><span class="linenos">1576</span></a><span class="sd"> """</span> +</span><span id="L-1577"><a href="#L-1577"><span class="linenos">1577</span></a> <span class="n">alias_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="L-1578"><a href="#L-1578"><span class="linenos">1578</span></a> <span class="n">alias</span><span class="p">,</span> +</span><span id="L-1579"><a href="#L-1579"><span class="linenos">1579</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1580"><a href="#L-1580"><span class="linenos">1580</span></a> <span class="n">into</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">,</span> +</span><span id="L-1581"><a href="#L-1581"><span class="linenos">1581</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1582"><a href="#L-1582"><span class="linenos">1582</span></a> <span class="p">)</span> +</span><span id="L-1583"><a href="#L-1583"><span class="linenos">1583</span></a> <span class="n">as_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="L-1584"><a href="#L-1584"><span class="linenos">1584</span></a> <span class="n">as_</span><span class="p">,</span> +</span><span id="L-1585"><a href="#L-1585"><span class="linenos">1585</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1586"><a href="#L-1586"><span class="linenos">1586</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1587"><a href="#L-1587"><span class="linenos">1587</span></a> <span class="p">)</span> +</span><span id="L-1588"><a href="#L-1588"><span class="linenos">1588</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="n">CTE</span><span class="p">(</span> +</span><span id="L-1589"><a href="#L-1589"><span class="linenos">1589</span></a> <span class="n">this</span><span class="o">=</span><span class="n">as_expression</span><span class="p">,</span> +</span><span id="L-1590"><a href="#L-1590"><span class="linenos">1590</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias_expression</span><span class="p">,</span> +</span><span id="L-1591"><a href="#L-1591"><span class="linenos">1591</span></a> <span class="p">)</span> +</span><span id="L-1592"><a href="#L-1592"><span class="linenos">1592</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-1593"><a href="#L-1593"><span class="linenos">1593</span></a> <span class="n">cte</span><span class="p">,</span> +</span><span id="L-1594"><a href="#L-1594"><span class="linenos">1594</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1595"><a href="#L-1595"><span class="linenos">1595</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"with"</span><span class="p">,</span> +</span><span id="L-1596"><a href="#L-1596"><span class="linenos">1596</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1597"><a href="#L-1597"><span class="linenos">1597</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1598"><a href="#L-1598"><span class="linenos">1598</span></a> <span class="n">into</span><span class="o">=</span><span class="n">With</span><span class="p">,</span> +</span><span id="L-1599"><a href="#L-1599"><span class="linenos">1599</span></a> <span class="n">properties</span><span class="o">=</span><span class="p">{</span><span class="s2">"recursive"</span><span class="p">:</span> <span class="n">recursive</span> <span class="ow">or</span> <span class="kc">False</span><span class="p">},</span> +</span><span id="L-1600"><a href="#L-1600"><span class="linenos">1600</span></a> <span class="p">)</span> +</span><span id="L-1601"><a href="#L-1601"><span class="linenos">1601</span></a> +</span><span id="L-1602"><a href="#L-1602"><span class="linenos">1602</span></a> +</span><span id="L-1603"><a href="#L-1603"><span class="linenos">1603</span></a><span class="n">QUERY_MODIFIERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1604"><a href="#L-1604"><span class="linenos">1604</span></a> <span class="s2">"match"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1605"><a href="#L-1605"><span class="linenos">1605</span></a> <span class="s2">"laterals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1606"><a href="#L-1606"><span class="linenos">1606</span></a> <span class="s2">"joins"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1607"><a href="#L-1607"><span class="linenos">1607</span></a> <span class="s2">"pivots"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1608"><a href="#L-1608"><span class="linenos">1608</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1609"><a href="#L-1609"><span class="linenos">1609</span></a> <span class="s2">"group"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1610"><a href="#L-1610"><span class="linenos">1610</span></a> <span class="s2">"having"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1611"><a href="#L-1611"><span class="linenos">1611</span></a> <span class="s2">"qualify"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1612"><a href="#L-1612"><span class="linenos">1612</span></a> <span class="s2">"windows"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1613"><a href="#L-1613"><span class="linenos">1613</span></a> <span class="s2">"distribute"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1614"><a href="#L-1614"><span class="linenos">1614</span></a> <span class="s2">"sort"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1615"><a href="#L-1615"><span class="linenos">1615</span></a> <span class="s2">"cluster"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1616"><a href="#L-1616"><span class="linenos">1616</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1617"><a href="#L-1617"><span class="linenos">1617</span></a> <span class="s2">"limit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1618"><a href="#L-1618"><span class="linenos">1618</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1619"><a href="#L-1619"><span class="linenos">1619</span></a> <span class="s2">"lock"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1620"><a href="#L-1620"><span class="linenos">1620</span></a><span class="p">}</span> +</span><span id="L-1621"><a href="#L-1621"><span class="linenos">1621</span></a> +</span><span id="L-1622"><a href="#L-1622"><span class="linenos">1622</span></a> +</span><span id="L-1623"><a href="#L-1623"><span class="linenos">1623</span></a><span class="k">class</span> <span class="nc">Table</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1624"><a href="#L-1624"><span class="linenos">1624</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1625"><a href="#L-1625"><span class="linenos">1625</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1626"><a href="#L-1626"><span class="linenos">1626</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1627"><a href="#L-1627"><span class="linenos">1627</span></a> <span class="s2">"db"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1628"><a href="#L-1628"><span class="linenos">1628</span></a> <span class="s2">"catalog"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1629"><a href="#L-1629"><span class="linenos">1629</span></a> <span class="s2">"laterals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1630"><a href="#L-1630"><span class="linenos">1630</span></a> <span class="s2">"joins"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1631"><a href="#L-1631"><span class="linenos">1631</span></a> <span class="s2">"pivots"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1632"><a href="#L-1632"><span class="linenos">1632</span></a> <span class="s2">"hints"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1633"><a href="#L-1633"><span class="linenos">1633</span></a> <span class="s2">"system_time"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1634"><a href="#L-1634"><span class="linenos">1634</span></a> <span class="p">}</span> +</span><span id="L-1635"><a href="#L-1635"><span class="linenos">1635</span></a> +</span><span id="L-1636"><a href="#L-1636"><span class="linenos">1636</span></a> +</span><span id="L-1637"><a href="#L-1637"><span class="linenos">1637</span></a><span class="c1"># See the TSQL "Querying data in a system-versioned temporal table" page</span> +</span><span id="L-1638"><a href="#L-1638"><span class="linenos">1638</span></a><span class="k">class</span> <span class="nc">SystemTime</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1639"><a href="#L-1639"><span class="linenos">1639</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1640"><a href="#L-1640"><span class="linenos">1640</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1641"><a href="#L-1641"><span class="linenos">1641</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1642"><a href="#L-1642"><span class="linenos">1642</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1643"><a href="#L-1643"><span class="linenos">1643</span></a> <span class="p">}</span> +</span><span id="L-1644"><a href="#L-1644"><span class="linenos">1644</span></a> +</span><span id="L-1645"><a href="#L-1645"><span class="linenos">1645</span></a> +</span><span id="L-1646"><a href="#L-1646"><span class="linenos">1646</span></a><span class="k">class</span> <span class="nc">Union</span><span class="p">(</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-1647"><a href="#L-1647"><span class="linenos">1647</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1648"><a href="#L-1648"><span class="linenos">1648</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1649"><a href="#L-1649"><span class="linenos">1649</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1650"><a href="#L-1650"><span class="linenos">1650</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1651"><a href="#L-1651"><span class="linenos">1651</span></a> <span class="s2">"distinct"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1652"><a href="#L-1652"><span class="linenos">1652</span></a> <span class="o">**</span><span class="n">QUERY_MODIFIERS</span><span class="p">,</span> +</span><span id="L-1653"><a href="#L-1653"><span class="linenos">1653</span></a> <span class="p">}</span> +</span><span id="L-1654"><a href="#L-1654"><span class="linenos">1654</span></a> +</span><span id="L-1655"><a href="#L-1655"><span class="linenos">1655</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1656"><a href="#L-1656"><span class="linenos">1656</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1657"><a href="#L-1657"><span class="linenos">1657</span></a><span class="sd"> Set the LIMIT expression.</span> +</span><span id="L-1658"><a href="#L-1658"><span class="linenos">1658</span></a> +</span><span id="L-1659"><a href="#L-1659"><span class="linenos">1659</span></a><span class="sd"> Example:</span> +</span><span id="L-1660"><a href="#L-1660"><span class="linenos">1660</span></a><span class="sd"> >>> select("1").union(select("1")).limit(1).sql()</span> +</span><span id="L-1661"><a href="#L-1661"><span class="linenos">1661</span></a><span class="sd"> 'SELECT * FROM (SELECT 1 UNION SELECT 1) AS _l_0 LIMIT 1'</span> +</span><span id="L-1662"><a href="#L-1662"><span class="linenos">1662</span></a> +</span><span id="L-1663"><a href="#L-1663"><span class="linenos">1663</span></a><span class="sd"> Args:</span> +</span><span id="L-1664"><a href="#L-1664"><span class="linenos">1664</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="L-1665"><a href="#L-1665"><span class="linenos">1665</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="L-1666"><a href="#L-1666"><span class="linenos">1666</span></a><span class="sd"> If a `Limit` instance is passed, this is used as-is.</span> +</span><span id="L-1667"><a href="#L-1667"><span class="linenos">1667</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Limit`.</span> +</span><span id="L-1668"><a href="#L-1668"><span class="linenos">1668</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1669"><a href="#L-1669"><span class="linenos">1669</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1670"><a href="#L-1670"><span class="linenos">1670</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1671"><a href="#L-1671"><span class="linenos">1671</span></a> +</span><span id="L-1672"><a href="#L-1672"><span class="linenos">1672</span></a><span class="sd"> Returns:</span> +</span><span id="L-1673"><a href="#L-1673"><span class="linenos">1673</span></a><span class="sd"> Select: The limited subqueryable.</span> +</span><span id="L-1674"><a href="#L-1674"><span class="linenos">1674</span></a><span class="sd"> """</span> +</span><span id="L-1675"><a href="#L-1675"><span class="linenos">1675</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-1676"><a href="#L-1676"><span class="linenos">1676</span></a> <span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span> +</span><span id="L-1677"><a href="#L-1677"><span class="linenos">1677</span></a> <span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">alias</span><span class="o">=</span><span class="s2">"_l_0"</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">))</span> +</span><span id="L-1678"><a href="#L-1678"><span class="linenos">1678</span></a> <span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-1679"><a href="#L-1679"><span class="linenos">1679</span></a> <span class="p">)</span> +</span><span id="L-1680"><a href="#L-1680"><span class="linenos">1680</span></a> +</span><span id="L-1681"><a href="#L-1681"><span class="linenos">1681</span></a> <span class="nd">@property</span> +</span><span id="L-1682"><a href="#L-1682"><span class="linenos">1682</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1683"><a href="#L-1683"><span class="linenos">1683</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="L-1684"><a href="#L-1684"><span class="linenos">1684</span></a> +</span><span id="L-1685"><a href="#L-1685"><span class="linenos">1685</span></a> <span class="nd">@property</span> +</span><span id="L-1686"><a href="#L-1686"><span class="linenos">1686</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1687"><a href="#L-1687"><span class="linenos">1687</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">selects</span> +</span><span id="L-1688"><a href="#L-1688"><span class="linenos">1688</span></a> +</span><span id="L-1689"><a href="#L-1689"><span class="linenos">1689</span></a> <span class="nd">@property</span> +</span><span id="L-1690"><a href="#L-1690"><span class="linenos">1690</span></a> <span class="k">def</span> <span class="nf">left</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1691"><a href="#L-1691"><span class="linenos">1691</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-1692"><a href="#L-1692"><span class="linenos">1692</span></a> +</span><span id="L-1693"><a href="#L-1693"><span class="linenos">1693</span></a> <span class="nd">@property</span> +</span><span id="L-1694"><a href="#L-1694"><span class="linenos">1694</span></a> <span class="k">def</span> <span class="nf">right</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-1695"><a href="#L-1695"><span class="linenos">1695</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-1696"><a href="#L-1696"><span class="linenos">1696</span></a> +</span><span id="L-1697"><a href="#L-1697"><span class="linenos">1697</span></a> +</span><span id="L-1698"><a href="#L-1698"><span class="linenos">1698</span></a><span class="k">class</span> <span class="nc">Except</span><span class="p">(</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-1699"><a href="#L-1699"><span class="linenos">1699</span></a> <span class="k">pass</span> +</span><span id="L-1700"><a href="#L-1700"><span class="linenos">1700</span></a> +</span><span id="L-1701"><a href="#L-1701"><span class="linenos">1701</span></a> +</span><span id="L-1702"><a href="#L-1702"><span class="linenos">1702</span></a><span class="k">class</span> <span class="nc">Intersect</span><span class="p">(</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-1703"><a href="#L-1703"><span class="linenos">1703</span></a> <span class="k">pass</span> +</span><span id="L-1704"><a href="#L-1704"><span class="linenos">1704</span></a> +</span><span id="L-1705"><a href="#L-1705"><span class="linenos">1705</span></a> +</span><span id="L-1706"><a href="#L-1706"><span class="linenos">1706</span></a><span class="k">class</span> <span class="nc">Unnest</span><span class="p">(</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-1707"><a href="#L-1707"><span class="linenos">1707</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1708"><a href="#L-1708"><span class="linenos">1708</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1709"><a href="#L-1709"><span class="linenos">1709</span></a> <span class="s2">"ordinality"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1710"><a href="#L-1710"><span class="linenos">1710</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1711"><a href="#L-1711"><span class="linenos">1711</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1712"><a href="#L-1712"><span class="linenos">1712</span></a> <span class="p">}</span> +</span><span id="L-1713"><a href="#L-1713"><span class="linenos">1713</span></a> +</span><span id="L-1714"><a href="#L-1714"><span class="linenos">1714</span></a> +</span><span id="L-1715"><a href="#L-1715"><span class="linenos">1715</span></a><span class="k">class</span> <span class="nc">Update</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1716"><a href="#L-1716"><span class="linenos">1716</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1717"><a href="#L-1717"><span class="linenos">1717</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1718"><a href="#L-1718"><span class="linenos">1718</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1719"><a href="#L-1719"><span class="linenos">1719</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1720"><a href="#L-1720"><span class="linenos">1720</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1721"><a href="#L-1721"><span class="linenos">1721</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1722"><a href="#L-1722"><span class="linenos">1722</span></a> <span class="p">}</span> +</span><span id="L-1723"><a href="#L-1723"><span class="linenos">1723</span></a> +</span><span id="L-1724"><a href="#L-1724"><span class="linenos">1724</span></a> +</span><span id="L-1725"><a href="#L-1725"><span class="linenos">1725</span></a><span class="k">class</span> <span class="nc">Values</span><span class="p">(</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-1726"><a href="#L-1726"><span class="linenos">1726</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1727"><a href="#L-1727"><span class="linenos">1727</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1728"><a href="#L-1728"><span class="linenos">1728</span></a> <span class="s2">"ordinality"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1729"><a href="#L-1729"><span class="linenos">1729</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1730"><a href="#L-1730"><span class="linenos">1730</span></a> <span class="p">}</span> +</span><span id="L-1731"><a href="#L-1731"><span class="linenos">1731</span></a> +</span><span id="L-1732"><a href="#L-1732"><span class="linenos">1732</span></a> +</span><span id="L-1733"><a href="#L-1733"><span class="linenos">1733</span></a><span class="k">class</span> <span class="nc">Var</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1734"><a href="#L-1734"><span class="linenos">1734</span></a> <span class="k">pass</span> +</span><span id="L-1735"><a href="#L-1735"><span class="linenos">1735</span></a> +</span><span id="L-1736"><a href="#L-1736"><span class="linenos">1736</span></a> +</span><span id="L-1737"><a href="#L-1737"><span class="linenos">1737</span></a><span class="k">class</span> <span class="nc">Schema</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1738"><a href="#L-1738"><span class="linenos">1738</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-1739"><a href="#L-1739"><span class="linenos">1739</span></a> +</span><span id="L-1740"><a href="#L-1740"><span class="linenos">1740</span></a> +</span><span id="L-1741"><a href="#L-1741"><span class="linenos">1741</span></a><span class="c1"># Used to represent the FOR UPDATE and FOR SHARE locking read types.</span> +</span><span id="L-1742"><a href="#L-1742"><span class="linenos">1742</span></a><span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/innodb-locking-reads.html</span> +</span><span id="L-1743"><a href="#L-1743"><span class="linenos">1743</span></a><span class="k">class</span> <span class="nc">Lock</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-1744"><a href="#L-1744"><span class="linenos">1744</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"update"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-1745"><a href="#L-1745"><span class="linenos">1745</span></a> +</span><span id="L-1746"><a href="#L-1746"><span class="linenos">1746</span></a> +</span><span id="L-1747"><a href="#L-1747"><span class="linenos">1747</span></a><span class="k">class</span> <span class="nc">Select</span><span class="p">(</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-1748"><a href="#L-1748"><span class="linenos">1748</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-1749"><a href="#L-1749"><span class="linenos">1749</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1750"><a href="#L-1750"><span class="linenos">1750</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1751"><a href="#L-1751"><span class="linenos">1751</span></a> <span class="s2">"hint"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1752"><a href="#L-1752"><span class="linenos">1752</span></a> <span class="s2">"distinct"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1753"><a href="#L-1753"><span class="linenos">1753</span></a> <span class="s2">"into"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1754"><a href="#L-1754"><span class="linenos">1754</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1755"><a href="#L-1755"><span class="linenos">1755</span></a> <span class="o">**</span><span class="n">QUERY_MODIFIERS</span><span class="p">,</span> +</span><span id="L-1756"><a href="#L-1756"><span class="linenos">1756</span></a> <span class="p">}</span> +</span><span id="L-1757"><a href="#L-1757"><span class="linenos">1757</span></a> +</span><span id="L-1758"><a href="#L-1758"><span class="linenos">1758</span></a> <span class="k">def</span> <span class="nf">from_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1759"><a href="#L-1759"><span class="linenos">1759</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1760"><a href="#L-1760"><span class="linenos">1760</span></a><span class="sd"> Set the FROM expression.</span> +</span><span id="L-1761"><a href="#L-1761"><span class="linenos">1761</span></a> +</span><span id="L-1762"><a href="#L-1762"><span class="linenos">1762</span></a><span class="sd"> Example:</span> +</span><span id="L-1763"><a href="#L-1763"><span class="linenos">1763</span></a><span class="sd"> >>> Select().from_("tbl").select("x").sql()</span> +</span><span id="L-1764"><a href="#L-1764"><span class="linenos">1764</span></a><span class="sd"> 'SELECT x FROM tbl'</span> +</span><span id="L-1765"><a href="#L-1765"><span class="linenos">1765</span></a> +</span><span id="L-1766"><a href="#L-1766"><span class="linenos">1766</span></a><span class="sd"> Args:</span> +</span><span id="L-1767"><a href="#L-1767"><span class="linenos">1767</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1768"><a href="#L-1768"><span class="linenos">1768</span></a><span class="sd"> If a `From` instance is passed, this is used as-is.</span> +</span><span id="L-1769"><a href="#L-1769"><span class="linenos">1769</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `From`.</span> +</span><span id="L-1770"><a href="#L-1770"><span class="linenos">1770</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-1771"><a href="#L-1771"><span class="linenos">1771</span></a><span class="sd"> Otherwise, this flattens all the `From` expression into a single expression.</span> +</span><span id="L-1772"><a href="#L-1772"><span class="linenos">1772</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1773"><a href="#L-1773"><span class="linenos">1773</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1774"><a href="#L-1774"><span class="linenos">1774</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1775"><a href="#L-1775"><span class="linenos">1775</span></a> +</span><span id="L-1776"><a href="#L-1776"><span class="linenos">1776</span></a><span class="sd"> Returns:</span> +</span><span id="L-1777"><a href="#L-1777"><span class="linenos">1777</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1778"><a href="#L-1778"><span class="linenos">1778</span></a><span class="sd"> """</span> +</span><span id="L-1779"><a href="#L-1779"><span class="linenos">1779</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-1780"><a href="#L-1780"><span class="linenos">1780</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1781"><a href="#L-1781"><span class="linenos">1781</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1782"><a href="#L-1782"><span class="linenos">1782</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"from"</span><span class="p">,</span> +</span><span id="L-1783"><a href="#L-1783"><span class="linenos">1783</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1784"><a href="#L-1784"><span class="linenos">1784</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1785"><a href="#L-1785"><span class="linenos">1785</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> +</span><span id="L-1786"><a href="#L-1786"><span class="linenos">1786</span></a> <span class="n">into</span><span class="o">=</span><span class="n">From</span><span class="p">,</span> +</span><span id="L-1787"><a href="#L-1787"><span class="linenos">1787</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1788"><a href="#L-1788"><span class="linenos">1788</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1789"><a href="#L-1789"><span class="linenos">1789</span></a> <span class="p">)</span> +</span><span id="L-1790"><a href="#L-1790"><span class="linenos">1790</span></a> +</span><span id="L-1791"><a href="#L-1791"><span class="linenos">1791</span></a> <span class="k">def</span> <span class="nf">group_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1792"><a href="#L-1792"><span class="linenos">1792</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1793"><a href="#L-1793"><span class="linenos">1793</span></a><span class="sd"> Set the GROUP BY expression.</span> +</span><span id="L-1794"><a href="#L-1794"><span class="linenos">1794</span></a> +</span><span id="L-1795"><a href="#L-1795"><span class="linenos">1795</span></a><span class="sd"> Example:</span> +</span><span id="L-1796"><a href="#L-1796"><span class="linenos">1796</span></a><span class="sd"> >>> Select().from_("tbl").select("x", "COUNT(1)").group_by("x").sql()</span> +</span><span id="L-1797"><a href="#L-1797"><span class="linenos">1797</span></a><span class="sd"> 'SELECT x, COUNT(1) FROM tbl GROUP BY x'</span> +</span><span id="L-1798"><a href="#L-1798"><span class="linenos">1798</span></a> +</span><span id="L-1799"><a href="#L-1799"><span class="linenos">1799</span></a><span class="sd"> Args:</span> +</span><span id="L-1800"><a href="#L-1800"><span class="linenos">1800</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1801"><a href="#L-1801"><span class="linenos">1801</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="L-1802"><a href="#L-1802"><span class="linenos">1802</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Group`.</span> +</span><span id="L-1803"><a href="#L-1803"><span class="linenos">1803</span></a><span class="sd"> If nothing is passed in then a group by is not applied to the expression</span> +</span><span id="L-1804"><a href="#L-1804"><span class="linenos">1804</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-1805"><a href="#L-1805"><span class="linenos">1805</span></a><span class="sd"> Otherwise, this flattens all the `Group` expression into a single expression.</span> +</span><span id="L-1806"><a href="#L-1806"><span class="linenos">1806</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1807"><a href="#L-1807"><span class="linenos">1807</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1808"><a href="#L-1808"><span class="linenos">1808</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1809"><a href="#L-1809"><span class="linenos">1809</span></a> +</span><span id="L-1810"><a href="#L-1810"><span class="linenos">1810</span></a><span class="sd"> Returns:</span> +</span><span id="L-1811"><a href="#L-1811"><span class="linenos">1811</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1812"><a href="#L-1812"><span class="linenos">1812</span></a><span class="sd"> """</span> +</span><span id="L-1813"><a href="#L-1813"><span class="linenos">1813</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-1814"><a href="#L-1814"><span class="linenos">1814</span></a> <span class="k">return</span> <span class="bp">self</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-1815"><a href="#L-1815"><span class="linenos">1815</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-1816"><a href="#L-1816"><span class="linenos">1816</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1817"><a href="#L-1817"><span class="linenos">1817</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1818"><a href="#L-1818"><span class="linenos">1818</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"group"</span><span class="p">,</span> +</span><span id="L-1819"><a href="#L-1819"><span class="linenos">1819</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1820"><a href="#L-1820"><span class="linenos">1820</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1821"><a href="#L-1821"><span class="linenos">1821</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"GROUP BY"</span><span class="p">,</span> +</span><span id="L-1822"><a href="#L-1822"><span class="linenos">1822</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Group</span><span class="p">,</span> +</span><span id="L-1823"><a href="#L-1823"><span class="linenos">1823</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1824"><a href="#L-1824"><span class="linenos">1824</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1825"><a href="#L-1825"><span class="linenos">1825</span></a> <span class="p">)</span> +</span><span id="L-1826"><a href="#L-1826"><span class="linenos">1826</span></a> +</span><span id="L-1827"><a href="#L-1827"><span class="linenos">1827</span></a> <span class="k">def</span> <span class="nf">order_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1828"><a href="#L-1828"><span class="linenos">1828</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1829"><a href="#L-1829"><span class="linenos">1829</span></a><span class="sd"> Set the ORDER BY expression.</span> +</span><span id="L-1830"><a href="#L-1830"><span class="linenos">1830</span></a> +</span><span id="L-1831"><a href="#L-1831"><span class="linenos">1831</span></a><span class="sd"> Example:</span> +</span><span id="L-1832"><a href="#L-1832"><span class="linenos">1832</span></a><span class="sd"> >>> Select().from_("tbl").select("x").order_by("x DESC").sql()</span> +</span><span id="L-1833"><a href="#L-1833"><span class="linenos">1833</span></a><span class="sd"> 'SELECT x FROM tbl ORDER BY x DESC'</span> +</span><span id="L-1834"><a href="#L-1834"><span class="linenos">1834</span></a> +</span><span id="L-1835"><a href="#L-1835"><span class="linenos">1835</span></a><span class="sd"> Args:</span> +</span><span id="L-1836"><a href="#L-1836"><span class="linenos">1836</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1837"><a href="#L-1837"><span class="linenos">1837</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="L-1838"><a href="#L-1838"><span class="linenos">1838</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Order`.</span> +</span><span id="L-1839"><a href="#L-1839"><span class="linenos">1839</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-1840"><a href="#L-1840"><span class="linenos">1840</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="L-1841"><a href="#L-1841"><span class="linenos">1841</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1842"><a href="#L-1842"><span class="linenos">1842</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1843"><a href="#L-1843"><span class="linenos">1843</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1844"><a href="#L-1844"><span class="linenos">1844</span></a> +</span><span id="L-1845"><a href="#L-1845"><span class="linenos">1845</span></a><span class="sd"> Returns:</span> +</span><span id="L-1846"><a href="#L-1846"><span class="linenos">1846</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1847"><a href="#L-1847"><span class="linenos">1847</span></a><span class="sd"> """</span> +</span><span id="L-1848"><a href="#L-1848"><span class="linenos">1848</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-1849"><a href="#L-1849"><span class="linenos">1849</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1850"><a href="#L-1850"><span class="linenos">1850</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1851"><a href="#L-1851"><span class="linenos">1851</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"order"</span><span class="p">,</span> +</span><span id="L-1852"><a href="#L-1852"><span class="linenos">1852</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1853"><a href="#L-1853"><span class="linenos">1853</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1854"><a href="#L-1854"><span class="linenos">1854</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ORDER BY"</span><span class="p">,</span> +</span><span id="L-1855"><a href="#L-1855"><span class="linenos">1855</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Order</span><span class="p">,</span> +</span><span id="L-1856"><a href="#L-1856"><span class="linenos">1856</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1857"><a href="#L-1857"><span class="linenos">1857</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1858"><a href="#L-1858"><span class="linenos">1858</span></a> <span class="p">)</span> +</span><span id="L-1859"><a href="#L-1859"><span class="linenos">1859</span></a> +</span><span id="L-1860"><a href="#L-1860"><span class="linenos">1860</span></a> <span class="k">def</span> <span class="nf">sort_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1861"><a href="#L-1861"><span class="linenos">1861</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1862"><a href="#L-1862"><span class="linenos">1862</span></a><span class="sd"> Set the SORT BY expression.</span> +</span><span id="L-1863"><a href="#L-1863"><span class="linenos">1863</span></a> +</span><span id="L-1864"><a href="#L-1864"><span class="linenos">1864</span></a><span class="sd"> Example:</span> +</span><span id="L-1865"><a href="#L-1865"><span class="linenos">1865</span></a><span class="sd"> >>> Select().from_("tbl").select("x").sort_by("x DESC").sql()</span> +</span><span id="L-1866"><a href="#L-1866"><span class="linenos">1866</span></a><span class="sd"> 'SELECT x FROM tbl SORT BY x DESC'</span> +</span><span id="L-1867"><a href="#L-1867"><span class="linenos">1867</span></a> +</span><span id="L-1868"><a href="#L-1868"><span class="linenos">1868</span></a><span class="sd"> Args:</span> +</span><span id="L-1869"><a href="#L-1869"><span class="linenos">1869</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1870"><a href="#L-1870"><span class="linenos">1870</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="L-1871"><a href="#L-1871"><span class="linenos">1871</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `SORT`.</span> +</span><span id="L-1872"><a href="#L-1872"><span class="linenos">1872</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-1873"><a href="#L-1873"><span class="linenos">1873</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="L-1874"><a href="#L-1874"><span class="linenos">1874</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1875"><a href="#L-1875"><span class="linenos">1875</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1876"><a href="#L-1876"><span class="linenos">1876</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1877"><a href="#L-1877"><span class="linenos">1877</span></a> +</span><span id="L-1878"><a href="#L-1878"><span class="linenos">1878</span></a><span class="sd"> Returns:</span> +</span><span id="L-1879"><a href="#L-1879"><span class="linenos">1879</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1880"><a href="#L-1880"><span class="linenos">1880</span></a><span class="sd"> """</span> +</span><span id="L-1881"><a href="#L-1881"><span class="linenos">1881</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-1882"><a href="#L-1882"><span class="linenos">1882</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1883"><a href="#L-1883"><span class="linenos">1883</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1884"><a href="#L-1884"><span class="linenos">1884</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"sort"</span><span class="p">,</span> +</span><span id="L-1885"><a href="#L-1885"><span class="linenos">1885</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1886"><a href="#L-1886"><span class="linenos">1886</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1887"><a href="#L-1887"><span class="linenos">1887</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"SORT BY"</span><span class="p">,</span> +</span><span id="L-1888"><a href="#L-1888"><span class="linenos">1888</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Sort</span><span class="p">,</span> +</span><span id="L-1889"><a href="#L-1889"><span class="linenos">1889</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1890"><a href="#L-1890"><span class="linenos">1890</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1891"><a href="#L-1891"><span class="linenos">1891</span></a> <span class="p">)</span> +</span><span id="L-1892"><a href="#L-1892"><span class="linenos">1892</span></a> +</span><span id="L-1893"><a href="#L-1893"><span class="linenos">1893</span></a> <span class="k">def</span> <span class="nf">cluster_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1894"><a href="#L-1894"><span class="linenos">1894</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1895"><a href="#L-1895"><span class="linenos">1895</span></a><span class="sd"> Set the CLUSTER BY expression.</span> +</span><span id="L-1896"><a href="#L-1896"><span class="linenos">1896</span></a> +</span><span id="L-1897"><a href="#L-1897"><span class="linenos">1897</span></a><span class="sd"> Example:</span> +</span><span id="L-1898"><a href="#L-1898"><span class="linenos">1898</span></a><span class="sd"> >>> Select().from_("tbl").select("x").cluster_by("x DESC").sql()</span> +</span><span id="L-1899"><a href="#L-1899"><span class="linenos">1899</span></a><span class="sd"> 'SELECT x FROM tbl CLUSTER BY x DESC'</span> +</span><span id="L-1900"><a href="#L-1900"><span class="linenos">1900</span></a> +</span><span id="L-1901"><a href="#L-1901"><span class="linenos">1901</span></a><span class="sd"> Args:</span> +</span><span id="L-1902"><a href="#L-1902"><span class="linenos">1902</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1903"><a href="#L-1903"><span class="linenos">1903</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="L-1904"><a href="#L-1904"><span class="linenos">1904</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Cluster`.</span> +</span><span id="L-1905"><a href="#L-1905"><span class="linenos">1905</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-1906"><a href="#L-1906"><span class="linenos">1906</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="L-1907"><a href="#L-1907"><span class="linenos">1907</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1908"><a href="#L-1908"><span class="linenos">1908</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1909"><a href="#L-1909"><span class="linenos">1909</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1910"><a href="#L-1910"><span class="linenos">1910</span></a> +</span><span id="L-1911"><a href="#L-1911"><span class="linenos">1911</span></a><span class="sd"> Returns:</span> +</span><span id="L-1912"><a href="#L-1912"><span class="linenos">1912</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1913"><a href="#L-1913"><span class="linenos">1913</span></a><span class="sd"> """</span> +</span><span id="L-1914"><a href="#L-1914"><span class="linenos">1914</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-1915"><a href="#L-1915"><span class="linenos">1915</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1916"><a href="#L-1916"><span class="linenos">1916</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1917"><a href="#L-1917"><span class="linenos">1917</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"cluster"</span><span class="p">,</span> +</span><span id="L-1918"><a href="#L-1918"><span class="linenos">1918</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-1919"><a href="#L-1919"><span class="linenos">1919</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1920"><a href="#L-1920"><span class="linenos">1920</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"CLUSTER BY"</span><span class="p">,</span> +</span><span id="L-1921"><a href="#L-1921"><span class="linenos">1921</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Cluster</span><span class="p">,</span> +</span><span id="L-1922"><a href="#L-1922"><span class="linenos">1922</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1923"><a href="#L-1923"><span class="linenos">1923</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1924"><a href="#L-1924"><span class="linenos">1924</span></a> <span class="p">)</span> +</span><span id="L-1925"><a href="#L-1925"><span class="linenos">1925</span></a> +</span><span id="L-1926"><a href="#L-1926"><span class="linenos">1926</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1927"><a href="#L-1927"><span class="linenos">1927</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1928"><a href="#L-1928"><span class="linenos">1928</span></a><span class="sd"> Set the LIMIT expression.</span> +</span><span id="L-1929"><a href="#L-1929"><span class="linenos">1929</span></a> +</span><span id="L-1930"><a href="#L-1930"><span class="linenos">1930</span></a><span class="sd"> Example:</span> +</span><span id="L-1931"><a href="#L-1931"><span class="linenos">1931</span></a><span class="sd"> >>> Select().from_("tbl").select("x").limit(10).sql()</span> +</span><span id="L-1932"><a href="#L-1932"><span class="linenos">1932</span></a><span class="sd"> 'SELECT x FROM tbl LIMIT 10'</span> +</span><span id="L-1933"><a href="#L-1933"><span class="linenos">1933</span></a> +</span><span id="L-1934"><a href="#L-1934"><span class="linenos">1934</span></a><span class="sd"> Args:</span> +</span><span id="L-1935"><a href="#L-1935"><span class="linenos">1935</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="L-1936"><a href="#L-1936"><span class="linenos">1936</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="L-1937"><a href="#L-1937"><span class="linenos">1937</span></a><span class="sd"> If a `Limit` instance is passed, this is used as-is.</span> +</span><span id="L-1938"><a href="#L-1938"><span class="linenos">1938</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Limit`.</span> +</span><span id="L-1939"><a href="#L-1939"><span class="linenos">1939</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1940"><a href="#L-1940"><span class="linenos">1940</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1941"><a href="#L-1941"><span class="linenos">1941</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1942"><a href="#L-1942"><span class="linenos">1942</span></a> +</span><span id="L-1943"><a href="#L-1943"><span class="linenos">1943</span></a><span class="sd"> Returns:</span> +</span><span id="L-1944"><a href="#L-1944"><span class="linenos">1944</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1945"><a href="#L-1945"><span class="linenos">1945</span></a><span class="sd"> """</span> +</span><span id="L-1946"><a href="#L-1946"><span class="linenos">1946</span></a> <span class="k">return</span> <span class="n">_apply_builder</span><span class="p">(</span> +</span><span id="L-1947"><a href="#L-1947"><span class="linenos">1947</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-1948"><a href="#L-1948"><span class="linenos">1948</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1949"><a href="#L-1949"><span class="linenos">1949</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"limit"</span><span class="p">,</span> +</span><span id="L-1950"><a href="#L-1950"><span class="linenos">1950</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Limit</span><span class="p">,</span> +</span><span id="L-1951"><a href="#L-1951"><span class="linenos">1951</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"LIMIT"</span><span class="p">,</span> +</span><span id="L-1952"><a href="#L-1952"><span class="linenos">1952</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1953"><a href="#L-1953"><span class="linenos">1953</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1954"><a href="#L-1954"><span class="linenos">1954</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1955"><a href="#L-1955"><span class="linenos">1955</span></a> <span class="p">)</span> +</span><span id="L-1956"><a href="#L-1956"><span class="linenos">1956</span></a> +</span><span id="L-1957"><a href="#L-1957"><span class="linenos">1957</span></a> <span class="k">def</span> <span class="nf">offset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1958"><a href="#L-1958"><span class="linenos">1958</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1959"><a href="#L-1959"><span class="linenos">1959</span></a><span class="sd"> Set the OFFSET expression.</span> +</span><span id="L-1960"><a href="#L-1960"><span class="linenos">1960</span></a> +</span><span id="L-1961"><a href="#L-1961"><span class="linenos">1961</span></a><span class="sd"> Example:</span> +</span><span id="L-1962"><a href="#L-1962"><span class="linenos">1962</span></a><span class="sd"> >>> Select().from_("tbl").select("x").offset(10).sql()</span> +</span><span id="L-1963"><a href="#L-1963"><span class="linenos">1963</span></a><span class="sd"> 'SELECT x FROM tbl OFFSET 10'</span> +</span><span id="L-1964"><a href="#L-1964"><span class="linenos">1964</span></a> +</span><span id="L-1965"><a href="#L-1965"><span class="linenos">1965</span></a><span class="sd"> Args:</span> +</span><span id="L-1966"><a href="#L-1966"><span class="linenos">1966</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="L-1967"><a href="#L-1967"><span class="linenos">1967</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="L-1968"><a href="#L-1968"><span class="linenos">1968</span></a><span class="sd"> If a `Offset` instance is passed, this is used as-is.</span> +</span><span id="L-1969"><a href="#L-1969"><span class="linenos">1969</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Offset`.</span> +</span><span id="L-1970"><a href="#L-1970"><span class="linenos">1970</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-1971"><a href="#L-1971"><span class="linenos">1971</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-1972"><a href="#L-1972"><span class="linenos">1972</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-1973"><a href="#L-1973"><span class="linenos">1973</span></a> +</span><span id="L-1974"><a href="#L-1974"><span class="linenos">1974</span></a><span class="sd"> Returns:</span> +</span><span id="L-1975"><a href="#L-1975"><span class="linenos">1975</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-1976"><a href="#L-1976"><span class="linenos">1976</span></a><span class="sd"> """</span> +</span><span id="L-1977"><a href="#L-1977"><span class="linenos">1977</span></a> <span class="k">return</span> <span class="n">_apply_builder</span><span class="p">(</span> +</span><span id="L-1978"><a href="#L-1978"><span class="linenos">1978</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-1979"><a href="#L-1979"><span class="linenos">1979</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-1980"><a href="#L-1980"><span class="linenos">1980</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"offset"</span><span class="p">,</span> +</span><span id="L-1981"><a href="#L-1981"><span class="linenos">1981</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Offset</span><span class="p">,</span> +</span><span id="L-1982"><a href="#L-1982"><span class="linenos">1982</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"OFFSET"</span><span class="p">,</span> +</span><span id="L-1983"><a href="#L-1983"><span class="linenos">1983</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-1984"><a href="#L-1984"><span class="linenos">1984</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-1985"><a href="#L-1985"><span class="linenos">1985</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-1986"><a href="#L-1986"><span class="linenos">1986</span></a> <span class="p">)</span> +</span><span id="L-1987"><a href="#L-1987"><span class="linenos">1987</span></a> +</span><span id="L-1988"><a href="#L-1988"><span class="linenos">1988</span></a> <span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-1989"><a href="#L-1989"><span class="linenos">1989</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-1990"><a href="#L-1990"><span class="linenos">1990</span></a><span class="sd"> Append to or set the SELECT expressions.</span> +</span><span id="L-1991"><a href="#L-1991"><span class="linenos">1991</span></a> +</span><span id="L-1992"><a href="#L-1992"><span class="linenos">1992</span></a><span class="sd"> Example:</span> +</span><span id="L-1993"><a href="#L-1993"><span class="linenos">1993</span></a><span class="sd"> >>> Select().select("x", "y").sql()</span> +</span><span id="L-1994"><a href="#L-1994"><span class="linenos">1994</span></a><span class="sd"> 'SELECT x, y'</span> +</span><span id="L-1995"><a href="#L-1995"><span class="linenos">1995</span></a> +</span><span id="L-1996"><a href="#L-1996"><span class="linenos">1996</span></a><span class="sd"> Args:</span> +</span><span id="L-1997"><a href="#L-1997"><span class="linenos">1997</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-1998"><a href="#L-1998"><span class="linenos">1998</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-1999"><a href="#L-1999"><span class="linenos">1999</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-2000"><a href="#L-2000"><span class="linenos">2000</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="L-2001"><a href="#L-2001"><span class="linenos">2001</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-2002"><a href="#L-2002"><span class="linenos">2002</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2003"><a href="#L-2003"><span class="linenos">2003</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-2004"><a href="#L-2004"><span class="linenos">2004</span></a> +</span><span id="L-2005"><a href="#L-2005"><span class="linenos">2005</span></a><span class="sd"> Returns:</span> +</span><span id="L-2006"><a href="#L-2006"><span class="linenos">2006</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-2007"><a href="#L-2007"><span class="linenos">2007</span></a><span class="sd"> """</span> +</span><span id="L-2008"><a href="#L-2008"><span class="linenos">2008</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-2009"><a href="#L-2009"><span class="linenos">2009</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2010"><a href="#L-2010"><span class="linenos">2010</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-2011"><a href="#L-2011"><span class="linenos">2011</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="L-2012"><a href="#L-2012"><span class="linenos">2012</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2013"><a href="#L-2013"><span class="linenos">2013</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-2014"><a href="#L-2014"><span class="linenos">2014</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2015"><a href="#L-2015"><span class="linenos">2015</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2016"><a href="#L-2016"><span class="linenos">2016</span></a> <span class="p">)</span> +</span><span id="L-2017"><a href="#L-2017"><span class="linenos">2017</span></a> +</span><span id="L-2018"><a href="#L-2018"><span class="linenos">2018</span></a> <span class="k">def</span> <span class="nf">lateral</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2019"><a href="#L-2019"><span class="linenos">2019</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2020"><a href="#L-2020"><span class="linenos">2020</span></a><span class="sd"> Append to or set the LATERAL expressions.</span> +</span><span id="L-2021"><a href="#L-2021"><span class="linenos">2021</span></a> +</span><span id="L-2022"><a href="#L-2022"><span class="linenos">2022</span></a><span class="sd"> Example:</span> +</span><span id="L-2023"><a href="#L-2023"><span class="linenos">2023</span></a><span class="sd"> >>> Select().select("x").lateral("OUTER explode(y) tbl2 AS z").from_("tbl").sql()</span> +</span><span id="L-2024"><a href="#L-2024"><span class="linenos">2024</span></a><span class="sd"> 'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z'</span> +</span><span id="L-2025"><a href="#L-2025"><span class="linenos">2025</span></a> +</span><span id="L-2026"><a href="#L-2026"><span class="linenos">2026</span></a><span class="sd"> Args:</span> +</span><span id="L-2027"><a href="#L-2027"><span class="linenos">2027</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-2028"><a href="#L-2028"><span class="linenos">2028</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2029"><a href="#L-2029"><span class="linenos">2029</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-2030"><a href="#L-2030"><span class="linenos">2030</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="L-2031"><a href="#L-2031"><span class="linenos">2031</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-2032"><a href="#L-2032"><span class="linenos">2032</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2033"><a href="#L-2033"><span class="linenos">2033</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-2034"><a href="#L-2034"><span class="linenos">2034</span></a> +</span><span id="L-2035"><a href="#L-2035"><span class="linenos">2035</span></a><span class="sd"> Returns:</span> +</span><span id="L-2036"><a href="#L-2036"><span class="linenos">2036</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-2037"><a href="#L-2037"><span class="linenos">2037</span></a><span class="sd"> """</span> +</span><span id="L-2038"><a href="#L-2038"><span class="linenos">2038</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-2039"><a href="#L-2039"><span class="linenos">2039</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2040"><a href="#L-2040"><span class="linenos">2040</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-2041"><a href="#L-2041"><span class="linenos">2041</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"laterals"</span><span class="p">,</span> +</span><span id="L-2042"><a href="#L-2042"><span class="linenos">2042</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2043"><a href="#L-2043"><span class="linenos">2043</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Lateral</span><span class="p">,</span> +</span><span id="L-2044"><a href="#L-2044"><span class="linenos">2044</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"LATERAL VIEW"</span><span class="p">,</span> +</span><span id="L-2045"><a href="#L-2045"><span class="linenos">2045</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-2046"><a href="#L-2046"><span class="linenos">2046</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2047"><a href="#L-2047"><span class="linenos">2047</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2048"><a href="#L-2048"><span class="linenos">2048</span></a> <span class="p">)</span> +</span><span id="L-2049"><a href="#L-2049"><span class="linenos">2049</span></a> +</span><span id="L-2050"><a href="#L-2050"><span class="linenos">2050</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span> +</span><span id="L-2051"><a href="#L-2051"><span class="linenos">2051</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-2052"><a href="#L-2052"><span class="linenos">2052</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-2053"><a href="#L-2053"><span class="linenos">2053</span></a> <span class="n">on</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-2054"><a href="#L-2054"><span class="linenos">2054</span></a> <span class="n">using</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-2055"><a href="#L-2055"><span class="linenos">2055</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-2056"><a href="#L-2056"><span class="linenos">2056</span></a> <span class="n">join_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-2057"><a href="#L-2057"><span class="linenos">2057</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-2058"><a href="#L-2058"><span class="linenos">2058</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-2059"><a href="#L-2059"><span class="linenos">2059</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-2060"><a href="#L-2060"><span class="linenos">2060</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2061"><a href="#L-2061"><span class="linenos">2061</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2062"><a href="#L-2062"><span class="linenos">2062</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2063"><a href="#L-2063"><span class="linenos">2063</span></a><span class="sd"> Append to or set the JOIN expressions.</span> +</span><span id="L-2064"><a href="#L-2064"><span class="linenos">2064</span></a> +</span><span id="L-2065"><a href="#L-2065"><span class="linenos">2065</span></a><span class="sd"> Example:</span> +</span><span id="L-2066"><a href="#L-2066"><span class="linenos">2066</span></a><span class="sd"> >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql()</span> +</span><span id="L-2067"><a href="#L-2067"><span class="linenos">2067</span></a><span class="sd"> 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</span><span id="L-2068"><a href="#L-2068"><span class="linenos">2068</span></a> +</span><span id="L-2069"><a href="#L-2069"><span class="linenos">2069</span></a><span class="sd"> >>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql()</span> +</span><span id="L-2070"><a href="#L-2070"><span class="linenos">2070</span></a><span class="sd"> 'SELECT 1 FROM a JOIN b USING (x, y, z)'</span> +</span><span id="L-2071"><a href="#L-2071"><span class="linenos">2071</span></a> +</span><span id="L-2072"><a href="#L-2072"><span class="linenos">2072</span></a><span class="sd"> Use `join_type` to change the type of join:</span> +</span><span id="L-2073"><a href="#L-2073"><span class="linenos">2073</span></a> +</span><span id="L-2074"><a href="#L-2074"><span class="linenos">2074</span></a><span class="sd"> >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y", join_type="left outer").sql()</span> +</span><span id="L-2075"><a href="#L-2075"><span class="linenos">2075</span></a><span class="sd"> 'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</span><span id="L-2076"><a href="#L-2076"><span class="linenos">2076</span></a> +</span><span id="L-2077"><a href="#L-2077"><span class="linenos">2077</span></a><span class="sd"> Args:</span> +</span><span id="L-2078"><a href="#L-2078"><span class="linenos">2078</span></a><span class="sd"> expression (str | Expression): the SQL code string to parse.</span> +</span><span id="L-2079"><a href="#L-2079"><span class="linenos">2079</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2080"><a href="#L-2080"><span class="linenos">2080</span></a><span class="sd"> on (str | Expression): optionally specify the join "on" criteria as a SQL string.</span> +</span><span id="L-2081"><a href="#L-2081"><span class="linenos">2081</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2082"><a href="#L-2082"><span class="linenos">2082</span></a><span class="sd"> using (str | Expression): optionally specify the join "using" criteria as a SQL string.</span> +</span><span id="L-2083"><a href="#L-2083"><span class="linenos">2083</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2084"><a href="#L-2084"><span class="linenos">2084</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="L-2085"><a href="#L-2085"><span class="linenos">2085</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="L-2086"><a href="#L-2086"><span class="linenos">2086</span></a><span class="sd"> join_type (str): If set, alter the parsed join type</span> +</span><span id="L-2087"><a href="#L-2087"><span class="linenos">2087</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-2088"><a href="#L-2088"><span class="linenos">2088</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2089"><a href="#L-2089"><span class="linenos">2089</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-2090"><a href="#L-2090"><span class="linenos">2090</span></a> +</span><span id="L-2091"><a href="#L-2091"><span class="linenos">2091</span></a><span class="sd"> Returns:</span> +</span><span id="L-2092"><a href="#L-2092"><span class="linenos">2092</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-2093"><a href="#L-2093"><span class="linenos">2093</span></a><span class="sd"> """</span> +</span><span id="L-2094"><a href="#L-2094"><span class="linenos">2094</span></a> <span class="n">parse_args</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">}</span> +</span><span id="L-2095"><a href="#L-2095"><span class="linenos">2095</span></a> +</span><span id="L-2096"><a href="#L-2096"><span class="linenos">2096</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-2097"><a href="#L-2097"><span class="linenos">2097</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Join</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"JOIN"</span><span class="p">,</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> +</span><span id="L-2098"><a href="#L-2098"><span class="linenos">2098</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="L-2099"><a href="#L-2099"><span class="linenos">2099</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="p">(</span><span class="n">Join</span><span class="p">,</span> <span class="n">Expression</span><span class="p">),</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> +</span><span id="L-2100"><a href="#L-2100"><span class="linenos">2100</span></a> +</span><span id="L-2101"><a href="#L-2101"><span class="linenos">2101</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">expression</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Join</span><span class="p">)</span> <span class="k">else</span> <span class="n">Join</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-2102"><a href="#L-2102"><span class="linenos">2102</span></a> +</span><span id="L-2103"><a href="#L-2103"><span class="linenos">2103</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">Select</span><span class="p">):</span> +</span><span id="L-2104"><a href="#L-2104"><span class="linenos">2104</span></a> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">subquery</span><span class="p">())</span> +</span><span id="L-2105"><a href="#L-2105"><span class="linenos">2105</span></a> +</span><span id="L-2106"><a href="#L-2106"><span class="linenos">2106</span></a> <span class="k">if</span> <span class="n">join_type</span><span class="p">:</span> +</span><span id="L-2107"><a href="#L-2107"><span class="linenos">2107</span></a> <span class="n">natural</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="L-2108"><a href="#L-2108"><span class="linenos">2108</span></a> <span class="n">side</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="L-2109"><a href="#L-2109"><span class="linenos">2109</span></a> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="L-2110"><a href="#L-2110"><span class="linenos">2110</span></a> +</span><span id="L-2111"><a href="#L-2111"><span class="linenos">2111</span></a> <span class="n">natural</span><span class="p">,</span> <span class="n">side</span><span class="p">,</span> <span class="n">kind</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">join_type</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="s2">"JOIN_TYPE"</span><span class="p">,</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-2112"><a href="#L-2112"><span class="linenos">2112</span></a> +</span><span id="L-2113"><a href="#L-2113"><span class="linenos">2113</span></a> <span class="k">if</span> <span class="n">natural</span><span class="p">:</span> +</span><span id="L-2114"><a href="#L-2114"><span class="linenos">2114</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"natural"</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span><span id="L-2115"><a href="#L-2115"><span class="linenos">2115</span></a> <span class="k">if</span> <span class="n">side</span><span class="p">:</span> +</span><span id="L-2116"><a href="#L-2116"><span class="linenos">2116</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"side"</span><span class="p">,</span> <span class="n">side</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-2117"><a href="#L-2117"><span class="linenos">2117</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="L-2118"><a href="#L-2118"><span class="linenos">2118</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="n">kind</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-2119"><a href="#L-2119"><span class="linenos">2119</span></a> +</span><span id="L-2120"><a href="#L-2120"><span class="linenos">2120</span></a> <span class="k">if</span> <span class="n">on</span><span class="p">:</span> +</span><span id="L-2121"><a href="#L-2121"><span class="linenos">2121</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">and_</span><span class="p">(</span><span class="o">*</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">on</span><span class="p">),</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-2122"><a href="#L-2122"><span class="linenos">2122</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="n">on</span><span class="p">)</span> +</span><span id="L-2123"><a href="#L-2123"><span class="linenos">2123</span></a> +</span><span id="L-2124"><a href="#L-2124"><span class="linenos">2124</span></a> <span class="k">if</span> <span class="n">using</span><span class="p">:</span> +</span><span id="L-2125"><a href="#L-2125"><span class="linenos">2125</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-2126"><a href="#L-2126"><span class="linenos">2126</span></a> <span class="o">*</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">using</span><span class="p">),</span> +</span><span id="L-2127"><a href="#L-2127"><span class="linenos">2127</span></a> <span class="n">instance</span><span class="o">=</span><span class="n">join</span><span class="p">,</span> +</span><span id="L-2128"><a href="#L-2128"><span class="linenos">2128</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"using"</span><span class="p">,</span> +</span><span id="L-2129"><a href="#L-2129"><span class="linenos">2129</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2130"><a href="#L-2130"><span class="linenos">2130</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2131"><a href="#L-2131"><span class="linenos">2131</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2132"><a href="#L-2132"><span class="linenos">2132</span></a> <span class="p">)</span> +</span><span id="L-2133"><a href="#L-2133"><span class="linenos">2133</span></a> +</span><span id="L-2134"><a href="#L-2134"><span class="linenos">2134</span></a> <span class="k">if</span> <span class="n">join_alias</span><span class="p">:</span> +</span><span id="L-2135"><a href="#L-2135"><span class="linenos">2135</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">alias_</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">join_alias</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-2136"><a href="#L-2136"><span class="linenos">2136</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-2137"><a href="#L-2137"><span class="linenos">2137</span></a> <span class="n">join</span><span class="p">,</span> +</span><span id="L-2138"><a href="#L-2138"><span class="linenos">2138</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-2139"><a href="#L-2139"><span class="linenos">2139</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"joins"</span><span class="p">,</span> +</span><span id="L-2140"><a href="#L-2140"><span class="linenos">2140</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2141"><a href="#L-2141"><span class="linenos">2141</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2142"><a href="#L-2142"><span class="linenos">2142</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2143"><a href="#L-2143"><span class="linenos">2143</span></a> <span class="p">)</span> +</span><span id="L-2144"><a href="#L-2144"><span class="linenos">2144</span></a> +</span><span id="L-2145"><a href="#L-2145"><span class="linenos">2145</span></a> <span class="k">def</span> <span class="nf">where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2146"><a href="#L-2146"><span class="linenos">2146</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2147"><a href="#L-2147"><span class="linenos">2147</span></a><span class="sd"> Append to or set the WHERE expressions.</span> +</span><span id="L-2148"><a href="#L-2148"><span class="linenos">2148</span></a> +</span><span id="L-2149"><a href="#L-2149"><span class="linenos">2149</span></a><span class="sd"> Example:</span> +</span><span id="L-2150"><a href="#L-2150"><span class="linenos">2150</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a' OR x < 'b'").sql()</span> +</span><span id="L-2151"><a href="#L-2151"><span class="linenos">2151</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' OR x < 'b'"</span> +</span><span id="L-2152"><a href="#L-2152"><span class="linenos">2152</span></a> +</span><span id="L-2153"><a href="#L-2153"><span class="linenos">2153</span></a><span class="sd"> Args:</span> +</span><span id="L-2154"><a href="#L-2154"><span class="linenos">2154</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-2155"><a href="#L-2155"><span class="linenos">2155</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2156"><a href="#L-2156"><span class="linenos">2156</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="L-2157"><a href="#L-2157"><span class="linenos">2157</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="L-2158"><a href="#L-2158"><span class="linenos">2158</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="L-2159"><a href="#L-2159"><span class="linenos">2159</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-2160"><a href="#L-2160"><span class="linenos">2160</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2161"><a href="#L-2161"><span class="linenos">2161</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-2162"><a href="#L-2162"><span class="linenos">2162</span></a> +</span><span id="L-2163"><a href="#L-2163"><span class="linenos">2163</span></a><span class="sd"> Returns:</span> +</span><span id="L-2164"><a href="#L-2164"><span class="linenos">2164</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-2165"><a href="#L-2165"><span class="linenos">2165</span></a><span class="sd"> """</span> +</span><span id="L-2166"><a href="#L-2166"><span class="linenos">2166</span></a> <span class="k">return</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="L-2167"><a href="#L-2167"><span class="linenos">2167</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2168"><a href="#L-2168"><span class="linenos">2168</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-2169"><a href="#L-2169"><span class="linenos">2169</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"where"</span><span class="p">,</span> +</span><span id="L-2170"><a href="#L-2170"><span class="linenos">2170</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2171"><a href="#L-2171"><span class="linenos">2171</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> +</span><span id="L-2172"><a href="#L-2172"><span class="linenos">2172</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-2173"><a href="#L-2173"><span class="linenos">2173</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2174"><a href="#L-2174"><span class="linenos">2174</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2175"><a href="#L-2175"><span class="linenos">2175</span></a> <span class="p">)</span> +</span><span id="L-2176"><a href="#L-2176"><span class="linenos">2176</span></a> +</span><span id="L-2177"><a href="#L-2177"><span class="linenos">2177</span></a> <span class="k">def</span> <span class="nf">having</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2178"><a href="#L-2178"><span class="linenos">2178</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2179"><a href="#L-2179"><span class="linenos">2179</span></a><span class="sd"> Append to or set the HAVING expressions.</span> +</span><span id="L-2180"><a href="#L-2180"><span class="linenos">2180</span></a> +</span><span id="L-2181"><a href="#L-2181"><span class="linenos">2181</span></a><span class="sd"> Example:</span> +</span><span id="L-2182"><a href="#L-2182"><span class="linenos">2182</span></a><span class="sd"> >>> Select().select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 3").sql()</span> +</span><span id="L-2183"><a href="#L-2183"><span class="linenos">2183</span></a><span class="sd"> 'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3'</span> +</span><span id="L-2184"><a href="#L-2184"><span class="linenos">2184</span></a> +</span><span id="L-2185"><a href="#L-2185"><span class="linenos">2185</span></a><span class="sd"> Args:</span> +</span><span id="L-2186"><a href="#L-2186"><span class="linenos">2186</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-2187"><a href="#L-2187"><span class="linenos">2187</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2188"><a href="#L-2188"><span class="linenos">2188</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="L-2189"><a href="#L-2189"><span class="linenos">2189</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="L-2190"><a href="#L-2190"><span class="linenos">2190</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="L-2191"><a href="#L-2191"><span class="linenos">2191</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-2192"><a href="#L-2192"><span class="linenos">2192</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2193"><a href="#L-2193"><span class="linenos">2193</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-2194"><a href="#L-2194"><span class="linenos">2194</span></a> +</span><span id="L-2195"><a href="#L-2195"><span class="linenos">2195</span></a><span class="sd"> Returns:</span> +</span><span id="L-2196"><a href="#L-2196"><span class="linenos">2196</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-2197"><a href="#L-2197"><span class="linenos">2197</span></a><span class="sd"> """</span> +</span><span id="L-2198"><a href="#L-2198"><span class="linenos">2198</span></a> <span class="k">return</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="L-2199"><a href="#L-2199"><span class="linenos">2199</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2200"><a href="#L-2200"><span class="linenos">2200</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-2201"><a href="#L-2201"><span class="linenos">2201</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"having"</span><span class="p">,</span> +</span><span id="L-2202"><a href="#L-2202"><span class="linenos">2202</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2203"><a href="#L-2203"><span class="linenos">2203</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Having</span><span class="p">,</span> +</span><span id="L-2204"><a href="#L-2204"><span class="linenos">2204</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-2205"><a href="#L-2205"><span class="linenos">2205</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2206"><a href="#L-2206"><span class="linenos">2206</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2207"><a href="#L-2207"><span class="linenos">2207</span></a> <span class="p">)</span> +</span><span id="L-2208"><a href="#L-2208"><span class="linenos">2208</span></a> +</span><span id="L-2209"><a href="#L-2209"><span class="linenos">2209</span></a> <span class="k">def</span> <span class="nf">window</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2210"><a href="#L-2210"><span class="linenos">2210</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-2211"><a href="#L-2211"><span class="linenos">2211</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2212"><a href="#L-2212"><span class="linenos">2212</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-2213"><a href="#L-2213"><span class="linenos">2213</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"windows"</span><span class="p">,</span> +</span><span id="L-2214"><a href="#L-2214"><span class="linenos">2214</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="L-2215"><a href="#L-2215"><span class="linenos">2215</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Window</span><span class="p">,</span> +</span><span id="L-2216"><a href="#L-2216"><span class="linenos">2216</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-2217"><a href="#L-2217"><span class="linenos">2217</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="L-2218"><a href="#L-2218"><span class="linenos">2218</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2219"><a href="#L-2219"><span class="linenos">2219</span></a> <span class="p">)</span> +</span><span id="L-2220"><a href="#L-2220"><span class="linenos">2220</span></a> +</span><span id="L-2221"><a href="#L-2221"><span class="linenos">2221</span></a> <span class="k">def</span> <span class="nf">distinct</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2222"><a href="#L-2222"><span class="linenos">2222</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2223"><a href="#L-2223"><span class="linenos">2223</span></a><span class="sd"> Set the OFFSET expression.</span> +</span><span id="L-2224"><a href="#L-2224"><span class="linenos">2224</span></a> +</span><span id="L-2225"><a href="#L-2225"><span class="linenos">2225</span></a><span class="sd"> Example:</span> +</span><span id="L-2226"><a href="#L-2226"><span class="linenos">2226</span></a><span class="sd"> >>> Select().from_("tbl").select("x").distinct().sql()</span> +</span><span id="L-2227"><a href="#L-2227"><span class="linenos">2227</span></a><span class="sd"> 'SELECT DISTINCT x FROM tbl'</span> +</span><span id="L-2228"><a href="#L-2228"><span class="linenos">2228</span></a> +</span><span id="L-2229"><a href="#L-2229"><span class="linenos">2229</span></a><span class="sd"> Args:</span> +</span><span id="L-2230"><a href="#L-2230"><span class="linenos">2230</span></a><span class="sd"> distinct (bool): whether the Select should be distinct</span> +</span><span id="L-2231"><a href="#L-2231"><span class="linenos">2231</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2232"><a href="#L-2232"><span class="linenos">2232</span></a> +</span><span id="L-2233"><a href="#L-2233"><span class="linenos">2233</span></a><span class="sd"> Returns:</span> +</span><span id="L-2234"><a href="#L-2234"><span class="linenos">2234</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="L-2235"><a href="#L-2235"><span class="linenos">2235</span></a><span class="sd"> """</span> +</span><span id="L-2236"><a href="#L-2236"><span class="linenos">2236</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-2237"><a href="#L-2237"><span class="linenos">2237</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="n">Distinct</span><span class="p">()</span> <span class="k">if</span> <span class="n">distinct</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-2238"><a href="#L-2238"><span class="linenos">2238</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="L-2239"><a href="#L-2239"><span class="linenos">2239</span></a> +</span><span id="L-2240"><a href="#L-2240"><span class="linenos">2240</span></a> <span class="k">def</span> <span class="nf">ctas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">properties</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Create</span><span class="p">:</span> +</span><span id="L-2241"><a href="#L-2241"><span class="linenos">2241</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2242"><a href="#L-2242"><span class="linenos">2242</span></a><span class="sd"> Convert this expression to a CREATE TABLE AS statement.</span> +</span><span id="L-2243"><a href="#L-2243"><span class="linenos">2243</span></a> +</span><span id="L-2244"><a href="#L-2244"><span class="linenos">2244</span></a><span class="sd"> Example:</span> +</span><span id="L-2245"><a href="#L-2245"><span class="linenos">2245</span></a><span class="sd"> >>> Select().select("*").from_("tbl").ctas("x").sql()</span> +</span><span id="L-2246"><a href="#L-2246"><span class="linenos">2246</span></a><span class="sd"> 'CREATE TABLE x AS SELECT * FROM tbl'</span> +</span><span id="L-2247"><a href="#L-2247"><span class="linenos">2247</span></a> +</span><span id="L-2248"><a href="#L-2248"><span class="linenos">2248</span></a><span class="sd"> Args:</span> +</span><span id="L-2249"><a href="#L-2249"><span class="linenos">2249</span></a><span class="sd"> table (str | Expression): the SQL code string to parse as the table name.</span> +</span><span id="L-2250"><a href="#L-2250"><span class="linenos">2250</span></a><span class="sd"> If another `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-2251"><a href="#L-2251"><span class="linenos">2251</span></a><span class="sd"> properties (dict): an optional mapping of table properties</span> +</span><span id="L-2252"><a href="#L-2252"><span class="linenos">2252</span></a><span class="sd"> dialect (str): the dialect used to parse the input table.</span> +</span><span id="L-2253"><a href="#L-2253"><span class="linenos">2253</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="L-2254"><a href="#L-2254"><span class="linenos">2254</span></a><span class="sd"> opts (kwargs): other options to use to parse the input table.</span> +</span><span id="L-2255"><a href="#L-2255"><span class="linenos">2255</span></a> +</span><span id="L-2256"><a href="#L-2256"><span class="linenos">2256</span></a><span class="sd"> Returns:</span> +</span><span id="L-2257"><a href="#L-2257"><span class="linenos">2257</span></a><span class="sd"> Create: the CREATE TABLE AS expression</span> +</span><span id="L-2258"><a href="#L-2258"><span class="linenos">2258</span></a><span class="sd"> """</span> +</span><span id="L-2259"><a href="#L-2259"><span class="linenos">2259</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-2260"><a href="#L-2260"><span class="linenos">2260</span></a> <span class="n">table_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="L-2261"><a href="#L-2261"><span class="linenos">2261</span></a> <span class="n">table</span><span class="p">,</span> +</span><span id="L-2262"><a href="#L-2262"><span class="linenos">2262</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> +</span><span id="L-2263"><a href="#L-2263"><span class="linenos">2263</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-2264"><a href="#L-2264"><span class="linenos">2264</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-2265"><a href="#L-2265"><span class="linenos">2265</span></a> <span class="p">)</span> +</span><span id="L-2266"><a href="#L-2266"><span class="linenos">2266</span></a> <span class="n">properties_expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2267"><a href="#L-2267"><span class="linenos">2267</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="L-2268"><a href="#L-2268"><span class="linenos">2268</span></a> <span class="n">properties_expression</span> <span class="o">=</span> <span class="n">Properties</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> +</span><span id="L-2269"><a href="#L-2269"><span class="linenos">2269</span></a> +</span><span id="L-2270"><a href="#L-2270"><span class="linenos">2270</span></a> <span class="k">return</span> <span class="n">Create</span><span class="p">(</span> +</span><span id="L-2271"><a href="#L-2271"><span class="linenos">2271</span></a> <span class="n">this</span><span class="o">=</span><span class="n">table_expression</span><span class="p">,</span> +</span><span id="L-2272"><a href="#L-2272"><span class="linenos">2272</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"table"</span><span class="p">,</span> +</span><span id="L-2273"><a href="#L-2273"><span class="linenos">2273</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">instance</span><span class="p">,</span> +</span><span id="L-2274"><a href="#L-2274"><span class="linenos">2274</span></a> <span class="n">properties</span><span class="o">=</span><span class="n">properties_expression</span><span class="p">,</span> +</span><span id="L-2275"><a href="#L-2275"><span class="linenos">2275</span></a> <span class="p">)</span> +</span><span id="L-2276"><a href="#L-2276"><span class="linenos">2276</span></a> +</span><span id="L-2277"><a href="#L-2277"><span class="linenos">2277</span></a> <span class="k">def</span> <span class="nf">lock</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-2278"><a href="#L-2278"><span class="linenos">2278</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2279"><a href="#L-2279"><span class="linenos">2279</span></a><span class="sd"> Set the locking read mode for this expression.</span> +</span><span id="L-2280"><a href="#L-2280"><span class="linenos">2280</span></a> +</span><span id="L-2281"><a href="#L-2281"><span class="linenos">2281</span></a><span class="sd"> Examples:</span> +</span><span id="L-2282"><a href="#L-2282"><span class="linenos">2282</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a'").lock().sql("mysql")</span> +</span><span id="L-2283"><a href="#L-2283"><span class="linenos">2283</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' FOR UPDATE"</span> +</span><span id="L-2284"><a href="#L-2284"><span class="linenos">2284</span></a> +</span><span id="L-2285"><a href="#L-2285"><span class="linenos">2285</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a'").lock(update=False).sql("mysql")</span> +</span><span id="L-2286"><a href="#L-2286"><span class="linenos">2286</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' FOR SHARE"</span> +</span><span id="L-2287"><a href="#L-2287"><span class="linenos">2287</span></a> +</span><span id="L-2288"><a href="#L-2288"><span class="linenos">2288</span></a><span class="sd"> Args:</span> +</span><span id="L-2289"><a href="#L-2289"><span class="linenos">2289</span></a><span class="sd"> update: if `True`, the locking type will be `FOR UPDATE`, else it will be `FOR SHARE`.</span> +</span><span id="L-2290"><a href="#L-2290"><span class="linenos">2290</span></a><span class="sd"> copy: if `False`, modify this expression instance in-place.</span> +</span><span id="L-2291"><a href="#L-2291"><span class="linenos">2291</span></a> +</span><span id="L-2292"><a href="#L-2292"><span class="linenos">2292</span></a><span class="sd"> Returns:</span> +</span><span id="L-2293"><a href="#L-2293"><span class="linenos">2293</span></a><span class="sd"> The modified expression.</span> +</span><span id="L-2294"><a href="#L-2294"><span class="linenos">2294</span></a><span class="sd"> """</span> +</span><span id="L-2295"><a href="#L-2295"><span class="linenos">2295</span></a> +</span><span id="L-2296"><a href="#L-2296"><span class="linenos">2296</span></a> <span class="n">inst</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-2297"><a href="#L-2297"><span class="linenos">2297</span></a> <span class="n">inst</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"lock"</span><span class="p">,</span> <span class="n">Lock</span><span class="p">(</span><span class="n">update</span><span class="o">=</span><span class="n">update</span><span class="p">))</span> +</span><span id="L-2298"><a href="#L-2298"><span class="linenos">2298</span></a> +</span><span id="L-2299"><a href="#L-2299"><span class="linenos">2299</span></a> <span class="k">return</span> <span class="n">inst</span> +</span><span id="L-2300"><a href="#L-2300"><span class="linenos">2300</span></a> +</span><span id="L-2301"><a href="#L-2301"><span class="linenos">2301</span></a> <span class="nd">@property</span> +</span><span id="L-2302"><a href="#L-2302"><span class="linenos">2302</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-2303"><a href="#L-2303"><span class="linenos">2303</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">e</span><span class="o">.</span><span class="n">output_name</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> +</span><span id="L-2304"><a href="#L-2304"><span class="linenos">2304</span></a> +</span><span id="L-2305"><a href="#L-2305"><span class="linenos">2305</span></a> <span class="nd">@property</span> +</span><span id="L-2306"><a href="#L-2306"><span class="linenos">2306</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2307"><a href="#L-2307"><span class="linenos">2307</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-2308"><a href="#L-2308"><span class="linenos">2308</span></a> +</span><span id="L-2309"><a href="#L-2309"><span class="linenos">2309</span></a> +</span><span id="L-2310"><a href="#L-2310"><span class="linenos">2310</span></a><span class="k">class</span> <span class="nc">Subquery</span><span class="p">(</span><span class="n">DerivedTable</span><span class="p">,</span> <span class="n">Unionable</span><span class="p">):</span> +</span><span id="L-2311"><a href="#L-2311"><span class="linenos">2311</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2312"><a href="#L-2312"><span class="linenos">2312</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2313"><a href="#L-2313"><span class="linenos">2313</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2314"><a href="#L-2314"><span class="linenos">2314</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2315"><a href="#L-2315"><span class="linenos">2315</span></a> <span class="o">**</span><span class="n">QUERY_MODIFIERS</span><span class="p">,</span> +</span><span id="L-2316"><a href="#L-2316"><span class="linenos">2316</span></a> <span class="p">}</span> +</span><span id="L-2317"><a href="#L-2317"><span class="linenos">2317</span></a> +</span><span id="L-2318"><a href="#L-2318"><span class="linenos">2318</span></a> <span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2319"><a href="#L-2319"><span class="linenos">2319</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2320"><a href="#L-2320"><span class="linenos">2320</span></a><span class="sd"> Returns the first non subquery.</span> +</span><span id="L-2321"><a href="#L-2321"><span class="linenos">2321</span></a><span class="sd"> """</span> +</span><span id="L-2322"><a href="#L-2322"><span class="linenos">2322</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="L-2323"><a href="#L-2323"><span class="linenos">2323</span></a> <span class="k">while</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-2324"><a href="#L-2324"><span class="linenos">2324</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-2325"><a href="#L-2325"><span class="linenos">2325</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-2326"><a href="#L-2326"><span class="linenos">2326</span></a> +</span><span id="L-2327"><a href="#L-2327"><span class="linenos">2327</span></a> <span class="nd">@property</span> +</span><span id="L-2328"><a href="#L-2328"><span class="linenos">2328</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2329"><a href="#L-2329"><span class="linenos">2329</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-2330"><a href="#L-2330"><span class="linenos">2330</span></a> +</span><span id="L-2331"><a href="#L-2331"><span class="linenos">2331</span></a> +</span><span id="L-2332"><a href="#L-2332"><span class="linenos">2332</span></a><span class="k">class</span> <span class="nc">TableSample</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2333"><a href="#L-2333"><span class="linenos">2333</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2334"><a href="#L-2334"><span class="linenos">2334</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2335"><a href="#L-2335"><span class="linenos">2335</span></a> <span class="s2">"method"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2336"><a href="#L-2336"><span class="linenos">2336</span></a> <span class="s2">"bucket_numerator"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2337"><a href="#L-2337"><span class="linenos">2337</span></a> <span class="s2">"bucket_denominator"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2338"><a href="#L-2338"><span class="linenos">2338</span></a> <span class="s2">"bucket_field"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2339"><a href="#L-2339"><span class="linenos">2339</span></a> <span class="s2">"percent"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2340"><a href="#L-2340"><span class="linenos">2340</span></a> <span class="s2">"rows"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2341"><a href="#L-2341"><span class="linenos">2341</span></a> <span class="s2">"size"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2342"><a href="#L-2342"><span class="linenos">2342</span></a> <span class="s2">"seed"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2343"><a href="#L-2343"><span class="linenos">2343</span></a> <span class="p">}</span> +</span><span id="L-2344"><a href="#L-2344"><span class="linenos">2344</span></a> +</span><span id="L-2345"><a href="#L-2345"><span class="linenos">2345</span></a> +</span><span id="L-2346"><a href="#L-2346"><span class="linenos">2346</span></a><span class="k">class</span> <span class="nc">Tag</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2347"><a href="#L-2347"><span class="linenos">2347</span></a><span class="w"> </span><span class="sd">"""Tags are used for generating arbitrary sql like SELECT <span>x</span>."""</span> +</span><span id="L-2348"><a href="#L-2348"><span class="linenos">2348</span></a> +</span><span id="L-2349"><a href="#L-2349"><span class="linenos">2349</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2350"><a href="#L-2350"><span class="linenos">2350</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2351"><a href="#L-2351"><span class="linenos">2351</span></a> <span class="s2">"prefix"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2352"><a href="#L-2352"><span class="linenos">2352</span></a> <span class="s2">"postfix"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2353"><a href="#L-2353"><span class="linenos">2353</span></a> <span class="p">}</span> +</span><span id="L-2354"><a href="#L-2354"><span class="linenos">2354</span></a> +</span><span id="L-2355"><a href="#L-2355"><span class="linenos">2355</span></a> +</span><span id="L-2356"><a href="#L-2356"><span class="linenos">2356</span></a><span class="k">class</span> <span class="nc">Pivot</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2357"><a href="#L-2357"><span class="linenos">2357</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2358"><a href="#L-2358"><span class="linenos">2358</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2359"><a href="#L-2359"><span class="linenos">2359</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2360"><a href="#L-2360"><span class="linenos">2360</span></a> <span class="s2">"field"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2361"><a href="#L-2361"><span class="linenos">2361</span></a> <span class="s2">"unpivot"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2362"><a href="#L-2362"><span class="linenos">2362</span></a> <span class="p">}</span> +</span><span id="L-2363"><a href="#L-2363"><span class="linenos">2363</span></a> +</span><span id="L-2364"><a href="#L-2364"><span class="linenos">2364</span></a> +</span><span id="L-2365"><a href="#L-2365"><span class="linenos">2365</span></a><span class="k">class</span> <span class="nc">Window</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2366"><a href="#L-2366"><span class="linenos">2366</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2367"><a href="#L-2367"><span class="linenos">2367</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2368"><a href="#L-2368"><span class="linenos">2368</span></a> <span class="s2">"partition_by"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2369"><a href="#L-2369"><span class="linenos">2369</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2370"><a href="#L-2370"><span class="linenos">2370</span></a> <span class="s2">"spec"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2371"><a href="#L-2371"><span class="linenos">2371</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2372"><a href="#L-2372"><span class="linenos">2372</span></a> <span class="p">}</span> +</span><span id="L-2373"><a href="#L-2373"><span class="linenos">2373</span></a> +</span><span id="L-2374"><a href="#L-2374"><span class="linenos">2374</span></a> +</span><span id="L-2375"><a href="#L-2375"><span class="linenos">2375</span></a><span class="k">class</span> <span class="nc">WindowSpec</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2376"><a href="#L-2376"><span class="linenos">2376</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2377"><a href="#L-2377"><span class="linenos">2377</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2378"><a href="#L-2378"><span class="linenos">2378</span></a> <span class="s2">"start"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2379"><a href="#L-2379"><span class="linenos">2379</span></a> <span class="s2">"start_side"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2380"><a href="#L-2380"><span class="linenos">2380</span></a> <span class="s2">"end"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2381"><a href="#L-2381"><span class="linenos">2381</span></a> <span class="s2">"end_side"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2382"><a href="#L-2382"><span class="linenos">2382</span></a> <span class="p">}</span> +</span><span id="L-2383"><a href="#L-2383"><span class="linenos">2383</span></a> +</span><span id="L-2384"><a href="#L-2384"><span class="linenos">2384</span></a> +</span><span id="L-2385"><a href="#L-2385"><span class="linenos">2385</span></a><span class="k">class</span> <span class="nc">Where</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2386"><a href="#L-2386"><span class="linenos">2386</span></a> <span class="k">pass</span> +</span><span id="L-2387"><a href="#L-2387"><span class="linenos">2387</span></a> +</span><span id="L-2388"><a href="#L-2388"><span class="linenos">2388</span></a> +</span><span id="L-2389"><a href="#L-2389"><span class="linenos">2389</span></a><span class="k">class</span> <span class="nc">Star</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2390"><a href="#L-2390"><span class="linenos">2390</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"except"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"replace"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2391"><a href="#L-2391"><span class="linenos">2391</span></a> +</span><span id="L-2392"><a href="#L-2392"><span class="linenos">2392</span></a> <span class="nd">@property</span> +</span><span id="L-2393"><a href="#L-2393"><span class="linenos">2393</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-2394"><a href="#L-2394"><span class="linenos">2394</span></a> <span class="k">return</span> <span class="s2">"*"</span> +</span><span id="L-2395"><a href="#L-2395"><span class="linenos">2395</span></a> +</span><span id="L-2396"><a href="#L-2396"><span class="linenos">2396</span></a> <span class="nd">@property</span> +</span><span id="L-2397"><a href="#L-2397"><span class="linenos">2397</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2398"><a href="#L-2398"><span class="linenos">2398</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-2399"><a href="#L-2399"><span class="linenos">2399</span></a> +</span><span id="L-2400"><a href="#L-2400"><span class="linenos">2400</span></a> +</span><span id="L-2401"><a href="#L-2401"><span class="linenos">2401</span></a><span class="k">class</span> <span class="nc">Parameter</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2402"><a href="#L-2402"><span class="linenos">2402</span></a> <span class="k">pass</span> +</span><span id="L-2403"><a href="#L-2403"><span class="linenos">2403</span></a> +</span><span id="L-2404"><a href="#L-2404"><span class="linenos">2404</span></a> +</span><span id="L-2405"><a href="#L-2405"><span class="linenos">2405</span></a><span class="k">class</span> <span class="nc">SessionParameter</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2406"><a href="#L-2406"><span class="linenos">2406</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2407"><a href="#L-2407"><span class="linenos">2407</span></a> +</span><span id="L-2408"><a href="#L-2408"><span class="linenos">2408</span></a> +</span><span id="L-2409"><a href="#L-2409"><span class="linenos">2409</span></a><span class="k">class</span> <span class="nc">Placeholder</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2410"><a href="#L-2410"><span class="linenos">2410</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2411"><a href="#L-2411"><span class="linenos">2411</span></a> +</span><span id="L-2412"><a href="#L-2412"><span class="linenos">2412</span></a> +</span><span id="L-2413"><a href="#L-2413"><span class="linenos">2413</span></a><span class="k">class</span> <span class="nc">Null</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2414"><a href="#L-2414"><span class="linenos">2414</span></a> <span class="n">arg_types</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-2415"><a href="#L-2415"><span class="linenos">2415</span></a> +</span><span id="L-2416"><a href="#L-2416"><span class="linenos">2416</span></a> <span class="nd">@property</span> +</span><span id="L-2417"><a href="#L-2417"><span class="linenos">2417</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-2418"><a href="#L-2418"><span class="linenos">2418</span></a> <span class="k">return</span> <span class="s2">"NULL"</span> +</span><span id="L-2419"><a href="#L-2419"><span class="linenos">2419</span></a> +</span><span id="L-2420"><a href="#L-2420"><span class="linenos">2420</span></a> +</span><span id="L-2421"><a href="#L-2421"><span class="linenos">2421</span></a><span class="k">class</span> <span class="nc">Boolean</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2422"><a href="#L-2422"><span class="linenos">2422</span></a> <span class="k">pass</span> +</span><span id="L-2423"><a href="#L-2423"><span class="linenos">2423</span></a> +</span><span id="L-2424"><a href="#L-2424"><span class="linenos">2424</span></a> +</span><span id="L-2425"><a href="#L-2425"><span class="linenos">2425</span></a><span class="k">class</span> <span class="nc">DataType</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2426"><a href="#L-2426"><span class="linenos">2426</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2427"><a href="#L-2427"><span class="linenos">2427</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2428"><a href="#L-2428"><span class="linenos">2428</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2429"><a href="#L-2429"><span class="linenos">2429</span></a> <span class="s2">"nested"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2430"><a href="#L-2430"><span class="linenos">2430</span></a> <span class="s2">"values"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2431"><a href="#L-2431"><span class="linenos">2431</span></a> <span class="p">}</span> +</span><span id="L-2432"><a href="#L-2432"><span class="linenos">2432</span></a> +</span><span id="L-2433"><a href="#L-2433"><span class="linenos">2433</span></a> <span class="k">class</span> <span class="nc">Type</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="L-2434"><a href="#L-2434"><span class="linenos">2434</span></a> <span class="n">CHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2435"><a href="#L-2435"><span class="linenos">2435</span></a> <span class="n">NCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2436"><a href="#L-2436"><span class="linenos">2436</span></a> <span class="n">VARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2437"><a href="#L-2437"><span class="linenos">2437</span></a> <span class="n">NVARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2438"><a href="#L-2438"><span class="linenos">2438</span></a> <span class="n">TEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2439"><a href="#L-2439"><span class="linenos">2439</span></a> <span class="n">MEDIUMTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2440"><a href="#L-2440"><span class="linenos">2440</span></a> <span class="n">LONGTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2441"><a href="#L-2441"><span class="linenos">2441</span></a> <span class="n">MEDIUMBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2442"><a href="#L-2442"><span class="linenos">2442</span></a> <span class="n">LONGBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2443"><a href="#L-2443"><span class="linenos">2443</span></a> <span class="n">BINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2444"><a href="#L-2444"><span class="linenos">2444</span></a> <span class="n">VARBINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2445"><a href="#L-2445"><span class="linenos">2445</span></a> <span class="n">INT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2446"><a href="#L-2446"><span class="linenos">2446</span></a> <span class="n">TINYINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2447"><a href="#L-2447"><span class="linenos">2447</span></a> <span class="n">SMALLINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2448"><a href="#L-2448"><span class="linenos">2448</span></a> <span class="n">BIGINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2449"><a href="#L-2449"><span class="linenos">2449</span></a> <span class="n">FLOAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2450"><a href="#L-2450"><span class="linenos">2450</span></a> <span class="n">DOUBLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2451"><a href="#L-2451"><span class="linenos">2451</span></a> <span class="n">DECIMAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2452"><a href="#L-2452"><span class="linenos">2452</span></a> <span class="n">BOOLEAN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2453"><a href="#L-2453"><span class="linenos">2453</span></a> <span class="n">JSON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2454"><a href="#L-2454"><span class="linenos">2454</span></a> <span class="n">JSONB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2455"><a href="#L-2455"><span class="linenos">2455</span></a> <span class="n">INTERVAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2456"><a href="#L-2456"><span class="linenos">2456</span></a> <span class="n">TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2457"><a href="#L-2457"><span class="linenos">2457</span></a> <span class="n">TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2458"><a href="#L-2458"><span class="linenos">2458</span></a> <span class="n">TIMESTAMPTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2459"><a href="#L-2459"><span class="linenos">2459</span></a> <span class="n">TIMESTAMPLTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2460"><a href="#L-2460"><span class="linenos">2460</span></a> <span class="n">DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2461"><a href="#L-2461"><span class="linenos">2461</span></a> <span class="n">DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2462"><a href="#L-2462"><span class="linenos">2462</span></a> <span class="n">ARRAY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2463"><a href="#L-2463"><span class="linenos">2463</span></a> <span class="n">MAP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2464"><a href="#L-2464"><span class="linenos">2464</span></a> <span class="n">UUID</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2465"><a href="#L-2465"><span class="linenos">2465</span></a> <span class="n">GEOGRAPHY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2466"><a href="#L-2466"><span class="linenos">2466</span></a> <span class="n">GEOMETRY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2467"><a href="#L-2467"><span class="linenos">2467</span></a> <span class="n">STRUCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2468"><a href="#L-2468"><span class="linenos">2468</span></a> <span class="n">NULLABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2469"><a href="#L-2469"><span class="linenos">2469</span></a> <span class="n">HLLSKETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2470"><a href="#L-2470"><span class="linenos">2470</span></a> <span class="n">HSTORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2471"><a href="#L-2471"><span class="linenos">2471</span></a> <span class="n">SUPER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2472"><a href="#L-2472"><span class="linenos">2472</span></a> <span class="n">SERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2473"><a href="#L-2473"><span class="linenos">2473</span></a> <span class="n">SMALLSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2474"><a href="#L-2474"><span class="linenos">2474</span></a> <span class="n">BIGSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2475"><a href="#L-2475"><span class="linenos">2475</span></a> <span class="n">XML</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2476"><a href="#L-2476"><span class="linenos">2476</span></a> <span class="n">UNIQUEIDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2477"><a href="#L-2477"><span class="linenos">2477</span></a> <span class="n">MONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2478"><a href="#L-2478"><span class="linenos">2478</span></a> <span class="n">SMALLMONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2479"><a href="#L-2479"><span class="linenos">2479</span></a> <span class="n">ROWVERSION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2480"><a href="#L-2480"><span class="linenos">2480</span></a> <span class="n">IMAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2481"><a href="#L-2481"><span class="linenos">2481</span></a> <span class="n">VARIANT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2482"><a href="#L-2482"><span class="linenos">2482</span></a> <span class="n">OBJECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2483"><a href="#L-2483"><span class="linenos">2483</span></a> <span class="n">NULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-2484"><a href="#L-2484"><span class="linenos">2484</span></a> <span class="n">UNKNOWN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> <span class="c1"># Sentinel value, useful for type annotation</span> +</span><span id="L-2485"><a href="#L-2485"><span class="linenos">2485</span></a> +</span><span id="L-2486"><a href="#L-2486"><span class="linenos">2486</span></a> <span class="n">TEXT_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2487"><a href="#L-2487"><span class="linenos">2487</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="L-2488"><a href="#L-2488"><span class="linenos">2488</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="L-2489"><a href="#L-2489"><span class="linenos">2489</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-2490"><a href="#L-2490"><span class="linenos">2490</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-2491"><a href="#L-2491"><span class="linenos">2491</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-2492"><a href="#L-2492"><span class="linenos">2492</span></a> <span class="p">}</span> +</span><span id="L-2493"><a href="#L-2493"><span class="linenos">2493</span></a> +</span><span id="L-2494"><a href="#L-2494"><span class="linenos">2494</span></a> <span class="n">INTEGER_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2495"><a href="#L-2495"><span class="linenos">2495</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-2496"><a href="#L-2496"><span class="linenos">2496</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="L-2497"><a href="#L-2497"><span class="linenos">2497</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-2498"><a href="#L-2498"><span class="linenos">2498</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-2499"><a href="#L-2499"><span class="linenos">2499</span></a> <span class="p">}</span> +</span><span id="L-2500"><a href="#L-2500"><span class="linenos">2500</span></a> +</span><span id="L-2501"><a href="#L-2501"><span class="linenos">2501</span></a> <span class="n">FLOAT_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2502"><a href="#L-2502"><span class="linenos">2502</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-2503"><a href="#L-2503"><span class="linenos">2503</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-2504"><a href="#L-2504"><span class="linenos">2504</span></a> <span class="p">}</span> +</span><span id="L-2505"><a href="#L-2505"><span class="linenos">2505</span></a> +</span><span id="L-2506"><a href="#L-2506"><span class="linenos">2506</span></a> <span class="n">NUMERIC_TYPES</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">INTEGER_TYPES</span><span class="p">,</span> <span class="o">*</span><span class="n">FLOAT_TYPES</span><span class="p">}</span> +</span><span id="L-2507"><a href="#L-2507"><span class="linenos">2507</span></a> +</span><span id="L-2508"><a href="#L-2508"><span class="linenos">2508</span></a> <span class="n">TEMPORAL_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2509"><a href="#L-2509"><span class="linenos">2509</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-2510"><a href="#L-2510"><span class="linenos">2510</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-2511"><a href="#L-2511"><span class="linenos">2511</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-2512"><a href="#L-2512"><span class="linenos">2512</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="L-2513"><a href="#L-2513"><span class="linenos">2513</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-2514"><a href="#L-2514"><span class="linenos">2514</span></a> <span class="p">}</span> +</span><span id="L-2515"><a href="#L-2515"><span class="linenos">2515</span></a> +</span><span id="L-2516"><a href="#L-2516"><span class="linenos">2516</span></a> <span class="nd">@classmethod</span> +</span><span id="L-2517"><a href="#L-2517"><span class="linenos">2517</span></a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span> +</span><span id="L-2518"><a href="#L-2518"><span class="linenos">2518</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="L-2519"><a href="#L-2519"><span class="linenos">2519</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataType</span><span class="p">:</span> +</span><span id="L-2520"><a href="#L-2520"><span class="linenos">2520</span></a> <span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +</span><span id="L-2521"><a href="#L-2521"><span class="linenos">2521</span></a> +</span><span id="L-2522"><a href="#L-2522"><span class="linenos">2522</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-2523"><a href="#L-2523"><span class="linenos">2523</span></a> <span class="k">if</span> <span class="n">dtype</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">__members__</span><span class="p">:</span> +</span><span id="L-2524"><a href="#L-2524"><span class="linenos">2524</span></a> <span class="n">data_type_exp</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">dtype</span><span class="o">.</span><span class="n">upper</span><span class="p">()])</span> +</span><span id="L-2525"><a href="#L-2525"><span class="linenos">2525</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2526"><a href="#L-2526"><span class="linenos">2526</span></a> <span class="n">data_type_exp</span> <span class="o">=</span> <span class="n">parse_one</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="L-2527"><a href="#L-2527"><span class="linenos">2527</span></a> <span class="k">if</span> <span class="n">data_type_exp</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-2528"><a href="#L-2528"><span class="linenos">2528</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unparsable data type value: </span><span class="si">{</span><span class="n">dtype</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-2529"><a href="#L-2529"><span class="linenos">2529</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">):</span> +</span><span id="L-2530"><a href="#L-2530"><span class="linenos">2530</span></a> <span class="n">data_type_exp</span> <span class="o">=</span> <span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">dtype</span><span class="p">)</span> +</span><span id="L-2531"><a href="#L-2531"><span class="linenos">2531</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="L-2532"><a href="#L-2532"><span class="linenos">2532</span></a> <span class="k">return</span> <span class="n">dtype</span> +</span><span id="L-2533"><a href="#L-2533"><span class="linenos">2533</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2534"><a href="#L-2534"><span class="linenos">2534</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid data type: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span><span class="si">}</span><span class="s2">. Expected str or DataType.Type"</span><span class="p">)</span> +</span><span id="L-2535"><a href="#L-2535"><span class="linenos">2535</span></a> <span class="k">return</span> <span class="n">DataType</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">data_type_exp</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> +</span><span id="L-2536"><a href="#L-2536"><span class="linenos">2536</span></a> +</span><span id="L-2537"><a href="#L-2537"><span class="linenos">2537</span></a> <span class="k">def</span> <span class="nf">is_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-2538"><a href="#L-2538"><span class="linenos">2538</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">dtype</span> +</span><span id="L-2539"><a href="#L-2539"><span class="linenos">2539</span></a> +</span><span id="L-2540"><a href="#L-2540"><span class="linenos">2540</span></a> +</span><span id="L-2541"><a href="#L-2541"><span class="linenos">2541</span></a><span class="c1"># https://www.postgresql.org/docs/15/datatype-pseudo.html</span> +</span><span id="L-2542"><a href="#L-2542"><span class="linenos">2542</span></a><span class="k">class</span> <span class="nc">PseudoType</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2543"><a href="#L-2543"><span class="linenos">2543</span></a> <span class="k">pass</span> +</span><span id="L-2544"><a href="#L-2544"><span class="linenos">2544</span></a> +</span><span id="L-2545"><a href="#L-2545"><span class="linenos">2545</span></a> +</span><span id="L-2546"><a href="#L-2546"><span class="linenos">2546</span></a><span class="k">class</span> <span class="nc">StructKwarg</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2547"><a href="#L-2547"><span class="linenos">2547</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2548"><a href="#L-2548"><span class="linenos">2548</span></a> +</span><span id="L-2549"><a href="#L-2549"><span class="linenos">2549</span></a> +</span><span id="L-2550"><a href="#L-2550"><span class="linenos">2550</span></a><span class="c1"># WHERE x <OP> EXISTS|ALL|ANY|SOME(SELECT ...)</span> +</span><span id="L-2551"><a href="#L-2551"><span class="linenos">2551</span></a><span class="k">class</span> <span class="nc">SubqueryPredicate</span><span class="p">(</span><span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2552"><a href="#L-2552"><span class="linenos">2552</span></a> <span class="k">pass</span> +</span><span id="L-2553"><a href="#L-2553"><span class="linenos">2553</span></a> +</span><span id="L-2554"><a href="#L-2554"><span class="linenos">2554</span></a> +</span><span id="L-2555"><a href="#L-2555"><span class="linenos">2555</span></a><span class="k">class</span> <span class="nc">All</span><span class="p">(</span><span class="n">SubqueryPredicate</span><span class="p">):</span> +</span><span id="L-2556"><a href="#L-2556"><span class="linenos">2556</span></a> <span class="k">pass</span> +</span><span id="L-2557"><a href="#L-2557"><span class="linenos">2557</span></a> +</span><span id="L-2558"><a href="#L-2558"><span class="linenos">2558</span></a> +</span><span id="L-2559"><a href="#L-2559"><span class="linenos">2559</span></a><span class="k">class</span> <span class="nc">Any</span><span class="p">(</span><span class="n">SubqueryPredicate</span><span class="p">):</span> +</span><span id="L-2560"><a href="#L-2560"><span class="linenos">2560</span></a> <span class="k">pass</span> +</span><span id="L-2561"><a href="#L-2561"><span class="linenos">2561</span></a> +</span><span id="L-2562"><a href="#L-2562"><span class="linenos">2562</span></a> +</span><span id="L-2563"><a href="#L-2563"><span class="linenos">2563</span></a><span class="k">class</span> <span class="nc">Exists</span><span class="p">(</span><span class="n">SubqueryPredicate</span><span class="p">):</span> +</span><span id="L-2564"><a href="#L-2564"><span class="linenos">2564</span></a> <span class="k">pass</span> +</span><span id="L-2565"><a href="#L-2565"><span class="linenos">2565</span></a> +</span><span id="L-2566"><a href="#L-2566"><span class="linenos">2566</span></a> +</span><span id="L-2567"><a href="#L-2567"><span class="linenos">2567</span></a><span class="c1"># Commands to interact with the databases or engines. For most of the command</span> +</span><span id="L-2568"><a href="#L-2568"><span class="linenos">2568</span></a><span class="c1"># expressions we parse whatever comes after the command's name as a string.</span> +</span><span id="L-2569"><a href="#L-2569"><span class="linenos">2569</span></a><span class="k">class</span> <span class="nc">Command</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2570"><a href="#L-2570"><span class="linenos">2570</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2571"><a href="#L-2571"><span class="linenos">2571</span></a> +</span><span id="L-2572"><a href="#L-2572"><span class="linenos">2572</span></a> +</span><span id="L-2573"><a href="#L-2573"><span class="linenos">2573</span></a><span class="k">class</span> <span class="nc">Transaction</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2574"><a href="#L-2574"><span class="linenos">2574</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"modes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2575"><a href="#L-2575"><span class="linenos">2575</span></a> +</span><span id="L-2576"><a href="#L-2576"><span class="linenos">2576</span></a> +</span><span id="L-2577"><a href="#L-2577"><span class="linenos">2577</span></a><span class="k">class</span> <span class="nc">Commit</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2578"><a href="#L-2578"><span class="linenos">2578</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"chain"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2579"><a href="#L-2579"><span class="linenos">2579</span></a> +</span><span id="L-2580"><a href="#L-2580"><span class="linenos">2580</span></a> +</span><span id="L-2581"><a href="#L-2581"><span class="linenos">2581</span></a><span class="k">class</span> <span class="nc">Rollback</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2582"><a href="#L-2582"><span class="linenos">2582</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"savepoint"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2583"><a href="#L-2583"><span class="linenos">2583</span></a> +</span><span id="L-2584"><a href="#L-2584"><span class="linenos">2584</span></a> +</span><span id="L-2585"><a href="#L-2585"><span class="linenos">2585</span></a><span class="k">class</span> <span class="nc">AlterTable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2586"><a href="#L-2586"><span class="linenos">2586</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2587"><a href="#L-2587"><span class="linenos">2587</span></a> +</span><span id="L-2588"><a href="#L-2588"><span class="linenos">2588</span></a> +</span><span id="L-2589"><a href="#L-2589"><span class="linenos">2589</span></a><span class="k">class</span> <span class="nc">AddConstraint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2590"><a href="#L-2590"><span class="linenos">2590</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"enforced"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2591"><a href="#L-2591"><span class="linenos">2591</span></a> +</span><span id="L-2592"><a href="#L-2592"><span class="linenos">2592</span></a> +</span><span id="L-2593"><a href="#L-2593"><span class="linenos">2593</span></a><span class="k">class</span> <span class="nc">DropPartition</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2594"><a href="#L-2594"><span class="linenos">2594</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2595"><a href="#L-2595"><span class="linenos">2595</span></a> +</span><span id="L-2596"><a href="#L-2596"><span class="linenos">2596</span></a> +</span><span id="L-2597"><a href="#L-2597"><span class="linenos">2597</span></a><span class="c1"># Binary expressions like (ADD a b)</span> +</span><span id="L-2598"><a href="#L-2598"><span class="linenos">2598</span></a><span class="k">class</span> <span class="nc">Binary</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2599"><a href="#L-2599"><span class="linenos">2599</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2600"><a href="#L-2600"><span class="linenos">2600</span></a> +</span><span id="L-2601"><a href="#L-2601"><span class="linenos">2601</span></a> <span class="nd">@property</span> +</span><span id="L-2602"><a href="#L-2602"><span class="linenos">2602</span></a> <span class="k">def</span> <span class="nf">left</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2603"><a href="#L-2603"><span class="linenos">2603</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-2604"><a href="#L-2604"><span class="linenos">2604</span></a> +</span><span id="L-2605"><a href="#L-2605"><span class="linenos">2605</span></a> <span class="nd">@property</span> +</span><span id="L-2606"><a href="#L-2606"><span class="linenos">2606</span></a> <span class="k">def</span> <span class="nf">right</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2607"><a href="#L-2607"><span class="linenos">2607</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-2608"><a href="#L-2608"><span class="linenos">2608</span></a> +</span><span id="L-2609"><a href="#L-2609"><span class="linenos">2609</span></a> +</span><span id="L-2610"><a href="#L-2610"><span class="linenos">2610</span></a><span class="k">class</span> <span class="nc">Add</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2611"><a href="#L-2611"><span class="linenos">2611</span></a> <span class="k">pass</span> +</span><span id="L-2612"><a href="#L-2612"><span class="linenos">2612</span></a> +</span><span id="L-2613"><a href="#L-2613"><span class="linenos">2613</span></a> +</span><span id="L-2614"><a href="#L-2614"><span class="linenos">2614</span></a><span class="k">class</span> <span class="nc">Connector</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2615"><a href="#L-2615"><span class="linenos">2615</span></a> <span class="k">pass</span> +</span><span id="L-2616"><a href="#L-2616"><span class="linenos">2616</span></a> +</span><span id="L-2617"><a href="#L-2617"><span class="linenos">2617</span></a> +</span><span id="L-2618"><a href="#L-2618"><span class="linenos">2618</span></a><span class="k">class</span> <span class="nc">And</span><span class="p">(</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-2619"><a href="#L-2619"><span class="linenos">2619</span></a> <span class="k">pass</span> +</span><span id="L-2620"><a href="#L-2620"><span class="linenos">2620</span></a> +</span><span id="L-2621"><a href="#L-2621"><span class="linenos">2621</span></a> +</span><span id="L-2622"><a href="#L-2622"><span class="linenos">2622</span></a><span class="k">class</span> <span class="nc">Or</span><span class="p">(</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-2623"><a href="#L-2623"><span class="linenos">2623</span></a> <span class="k">pass</span> +</span><span id="L-2624"><a href="#L-2624"><span class="linenos">2624</span></a> +</span><span id="L-2625"><a href="#L-2625"><span class="linenos">2625</span></a> +</span><span id="L-2626"><a href="#L-2626"><span class="linenos">2626</span></a><span class="k">class</span> <span class="nc">BitwiseAnd</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2627"><a href="#L-2627"><span class="linenos">2627</span></a> <span class="k">pass</span> +</span><span id="L-2628"><a href="#L-2628"><span class="linenos">2628</span></a> +</span><span id="L-2629"><a href="#L-2629"><span class="linenos">2629</span></a> +</span><span id="L-2630"><a href="#L-2630"><span class="linenos">2630</span></a><span class="k">class</span> <span class="nc">BitwiseLeftShift</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2631"><a href="#L-2631"><span class="linenos">2631</span></a> <span class="k">pass</span> +</span><span id="L-2632"><a href="#L-2632"><span class="linenos">2632</span></a> +</span><span id="L-2633"><a href="#L-2633"><span class="linenos">2633</span></a> +</span><span id="L-2634"><a href="#L-2634"><span class="linenos">2634</span></a><span class="k">class</span> <span class="nc">BitwiseOr</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2635"><a href="#L-2635"><span class="linenos">2635</span></a> <span class="k">pass</span> +</span><span id="L-2636"><a href="#L-2636"><span class="linenos">2636</span></a> +</span><span id="L-2637"><a href="#L-2637"><span class="linenos">2637</span></a> +</span><span id="L-2638"><a href="#L-2638"><span class="linenos">2638</span></a><span class="k">class</span> <span class="nc">BitwiseRightShift</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2639"><a href="#L-2639"><span class="linenos">2639</span></a> <span class="k">pass</span> +</span><span id="L-2640"><a href="#L-2640"><span class="linenos">2640</span></a> +</span><span id="L-2641"><a href="#L-2641"><span class="linenos">2641</span></a> +</span><span id="L-2642"><a href="#L-2642"><span class="linenos">2642</span></a><span class="k">class</span> <span class="nc">BitwiseXor</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2643"><a href="#L-2643"><span class="linenos">2643</span></a> <span class="k">pass</span> +</span><span id="L-2644"><a href="#L-2644"><span class="linenos">2644</span></a> +</span><span id="L-2645"><a href="#L-2645"><span class="linenos">2645</span></a> +</span><span id="L-2646"><a href="#L-2646"><span class="linenos">2646</span></a><span class="k">class</span> <span class="nc">Div</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2647"><a href="#L-2647"><span class="linenos">2647</span></a> <span class="k">pass</span> +</span><span id="L-2648"><a href="#L-2648"><span class="linenos">2648</span></a> +</span><span id="L-2649"><a href="#L-2649"><span class="linenos">2649</span></a> +</span><span id="L-2650"><a href="#L-2650"><span class="linenos">2650</span></a><span class="k">class</span> <span class="nc">Dot</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2651"><a href="#L-2651"><span class="linenos">2651</span></a> <span class="nd">@property</span> +</span><span id="L-2652"><a href="#L-2652"><span class="linenos">2652</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-2653"><a href="#L-2653"><span class="linenos">2653</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-2654"><a href="#L-2654"><span class="linenos">2654</span></a> +</span><span id="L-2655"><a href="#L-2655"><span class="linenos">2655</span></a> +</span><span id="L-2656"><a href="#L-2656"><span class="linenos">2656</span></a><span class="k">class</span> <span class="nc">DPipe</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2657"><a href="#L-2657"><span class="linenos">2657</span></a> <span class="k">pass</span> +</span><span id="L-2658"><a href="#L-2658"><span class="linenos">2658</span></a> +</span><span id="L-2659"><a href="#L-2659"><span class="linenos">2659</span></a> +</span><span id="L-2660"><a href="#L-2660"><span class="linenos">2660</span></a><span class="k">class</span> <span class="nc">EQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2661"><a href="#L-2661"><span class="linenos">2661</span></a> <span class="k">pass</span> +</span><span id="L-2662"><a href="#L-2662"><span class="linenos">2662</span></a> +</span><span id="L-2663"><a href="#L-2663"><span class="linenos">2663</span></a> +</span><span id="L-2664"><a href="#L-2664"><span class="linenos">2664</span></a><span class="k">class</span> <span class="nc">NullSafeEQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2665"><a href="#L-2665"><span class="linenos">2665</span></a> <span class="k">pass</span> +</span><span id="L-2666"><a href="#L-2666"><span class="linenos">2666</span></a> +</span><span id="L-2667"><a href="#L-2667"><span class="linenos">2667</span></a> +</span><span id="L-2668"><a href="#L-2668"><span class="linenos">2668</span></a><span class="k">class</span> <span class="nc">NullSafeNEQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2669"><a href="#L-2669"><span class="linenos">2669</span></a> <span class="k">pass</span> +</span><span id="L-2670"><a href="#L-2670"><span class="linenos">2670</span></a> +</span><span id="L-2671"><a href="#L-2671"><span class="linenos">2671</span></a> +</span><span id="L-2672"><a href="#L-2672"><span class="linenos">2672</span></a><span class="k">class</span> <span class="nc">Distance</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2673"><a href="#L-2673"><span class="linenos">2673</span></a> <span class="k">pass</span> +</span><span id="L-2674"><a href="#L-2674"><span class="linenos">2674</span></a> +</span><span id="L-2675"><a href="#L-2675"><span class="linenos">2675</span></a> +</span><span id="L-2676"><a href="#L-2676"><span class="linenos">2676</span></a><span class="k">class</span> <span class="nc">Escape</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2677"><a href="#L-2677"><span class="linenos">2677</span></a> <span class="k">pass</span> +</span><span id="L-2678"><a href="#L-2678"><span class="linenos">2678</span></a> +</span><span id="L-2679"><a href="#L-2679"><span class="linenos">2679</span></a> +</span><span id="L-2680"><a href="#L-2680"><span class="linenos">2680</span></a><span class="k">class</span> <span class="nc">Glob</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2681"><a href="#L-2681"><span class="linenos">2681</span></a> <span class="k">pass</span> +</span><span id="L-2682"><a href="#L-2682"><span class="linenos">2682</span></a> +</span><span id="L-2683"><a href="#L-2683"><span class="linenos">2683</span></a> +</span><span id="L-2684"><a href="#L-2684"><span class="linenos">2684</span></a><span class="k">class</span> <span class="nc">GT</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2685"><a href="#L-2685"><span class="linenos">2685</span></a> <span class="k">pass</span> +</span><span id="L-2686"><a href="#L-2686"><span class="linenos">2686</span></a> +</span><span id="L-2687"><a href="#L-2687"><span class="linenos">2687</span></a> +</span><span id="L-2688"><a href="#L-2688"><span class="linenos">2688</span></a><span class="k">class</span> <span class="nc">GTE</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2689"><a href="#L-2689"><span class="linenos">2689</span></a> <span class="k">pass</span> +</span><span id="L-2690"><a href="#L-2690"><span class="linenos">2690</span></a> +</span><span id="L-2691"><a href="#L-2691"><span class="linenos">2691</span></a> +</span><span id="L-2692"><a href="#L-2692"><span class="linenos">2692</span></a><span class="k">class</span> <span class="nc">ILike</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2693"><a href="#L-2693"><span class="linenos">2693</span></a> <span class="k">pass</span> +</span><span id="L-2694"><a href="#L-2694"><span class="linenos">2694</span></a> +</span><span id="L-2695"><a href="#L-2695"><span class="linenos">2695</span></a> +</span><span id="L-2696"><a href="#L-2696"><span class="linenos">2696</span></a><span class="k">class</span> <span class="nc">IntDiv</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2697"><a href="#L-2697"><span class="linenos">2697</span></a> <span class="k">pass</span> +</span><span id="L-2698"><a href="#L-2698"><span class="linenos">2698</span></a> +</span><span id="L-2699"><a href="#L-2699"><span class="linenos">2699</span></a> +</span><span id="L-2700"><a href="#L-2700"><span class="linenos">2700</span></a><span class="k">class</span> <span class="nc">Is</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2701"><a href="#L-2701"><span class="linenos">2701</span></a> <span class="k">pass</span> +</span><span id="L-2702"><a href="#L-2702"><span class="linenos">2702</span></a> +</span><span id="L-2703"><a href="#L-2703"><span class="linenos">2703</span></a> +</span><span id="L-2704"><a href="#L-2704"><span class="linenos">2704</span></a><span class="k">class</span> <span class="nc">Kwarg</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2705"><a href="#L-2705"><span class="linenos">2705</span></a><span class="w"> </span><span class="sd">"""Kwarg in special functions like func(kwarg => y)."""</span> +</span><span id="L-2706"><a href="#L-2706"><span class="linenos">2706</span></a> +</span><span id="L-2707"><a href="#L-2707"><span class="linenos">2707</span></a> +</span><span id="L-2708"><a href="#L-2708"><span class="linenos">2708</span></a><span class="k">class</span> <span class="nc">Like</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2709"><a href="#L-2709"><span class="linenos">2709</span></a> <span class="k">pass</span> +</span><span id="L-2710"><a href="#L-2710"><span class="linenos">2710</span></a> +</span><span id="L-2711"><a href="#L-2711"><span class="linenos">2711</span></a> +</span><span id="L-2712"><a href="#L-2712"><span class="linenos">2712</span></a><span class="k">class</span> <span class="nc">LT</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2713"><a href="#L-2713"><span class="linenos">2713</span></a> <span class="k">pass</span> +</span><span id="L-2714"><a href="#L-2714"><span class="linenos">2714</span></a> +</span><span id="L-2715"><a href="#L-2715"><span class="linenos">2715</span></a> +</span><span id="L-2716"><a href="#L-2716"><span class="linenos">2716</span></a><span class="k">class</span> <span class="nc">LTE</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2717"><a href="#L-2717"><span class="linenos">2717</span></a> <span class="k">pass</span> +</span><span id="L-2718"><a href="#L-2718"><span class="linenos">2718</span></a> +</span><span id="L-2719"><a href="#L-2719"><span class="linenos">2719</span></a> +</span><span id="L-2720"><a href="#L-2720"><span class="linenos">2720</span></a><span class="k">class</span> <span class="nc">Mod</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2721"><a href="#L-2721"><span class="linenos">2721</span></a> <span class="k">pass</span> +</span><span id="L-2722"><a href="#L-2722"><span class="linenos">2722</span></a> +</span><span id="L-2723"><a href="#L-2723"><span class="linenos">2723</span></a> +</span><span id="L-2724"><a href="#L-2724"><span class="linenos">2724</span></a><span class="k">class</span> <span class="nc">Mul</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2725"><a href="#L-2725"><span class="linenos">2725</span></a> <span class="k">pass</span> +</span><span id="L-2726"><a href="#L-2726"><span class="linenos">2726</span></a> +</span><span id="L-2727"><a href="#L-2727"><span class="linenos">2727</span></a> +</span><span id="L-2728"><a href="#L-2728"><span class="linenos">2728</span></a><span class="k">class</span> <span class="nc">NEQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2729"><a href="#L-2729"><span class="linenos">2729</span></a> <span class="k">pass</span> +</span><span id="L-2730"><a href="#L-2730"><span class="linenos">2730</span></a> +</span><span id="L-2731"><a href="#L-2731"><span class="linenos">2731</span></a> +</span><span id="L-2732"><a href="#L-2732"><span class="linenos">2732</span></a><span class="k">class</span> <span class="nc">SimilarTo</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2733"><a href="#L-2733"><span class="linenos">2733</span></a> <span class="k">pass</span> +</span><span id="L-2734"><a href="#L-2734"><span class="linenos">2734</span></a> +</span><span id="L-2735"><a href="#L-2735"><span class="linenos">2735</span></a> +</span><span id="L-2736"><a href="#L-2736"><span class="linenos">2736</span></a><span class="k">class</span> <span class="nc">Slice</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2737"><a href="#L-2737"><span class="linenos">2737</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2738"><a href="#L-2738"><span class="linenos">2738</span></a> +</span><span id="L-2739"><a href="#L-2739"><span class="linenos">2739</span></a> +</span><span id="L-2740"><a href="#L-2740"><span class="linenos">2740</span></a><span class="k">class</span> <span class="nc">Sub</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2741"><a href="#L-2741"><span class="linenos">2741</span></a> <span class="k">pass</span> +</span><span id="L-2742"><a href="#L-2742"><span class="linenos">2742</span></a> +</span><span id="L-2743"><a href="#L-2743"><span class="linenos">2743</span></a> +</span><span id="L-2744"><a href="#L-2744"><span class="linenos">2744</span></a><span class="c1"># Unary Expressions</span> +</span><span id="L-2745"><a href="#L-2745"><span class="linenos">2745</span></a><span class="c1"># (NOT a)</span> +</span><span id="L-2746"><a href="#L-2746"><span class="linenos">2746</span></a><span class="k">class</span> <span class="nc">Unary</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2747"><a href="#L-2747"><span class="linenos">2747</span></a> <span class="k">pass</span> +</span><span id="L-2748"><a href="#L-2748"><span class="linenos">2748</span></a> +</span><span id="L-2749"><a href="#L-2749"><span class="linenos">2749</span></a> +</span><span id="L-2750"><a href="#L-2750"><span class="linenos">2750</span></a><span class="k">class</span> <span class="nc">BitwiseNot</span><span class="p">(</span><span class="n">Unary</span><span class="p">):</span> +</span><span id="L-2751"><a href="#L-2751"><span class="linenos">2751</span></a> <span class="k">pass</span> +</span><span id="L-2752"><a href="#L-2752"><span class="linenos">2752</span></a> +</span><span id="L-2753"><a href="#L-2753"><span class="linenos">2753</span></a> +</span><span id="L-2754"><a href="#L-2754"><span class="linenos">2754</span></a><span class="k">class</span> <span class="nc">Not</span><span class="p">(</span><span class="n">Unary</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2755"><a href="#L-2755"><span class="linenos">2755</span></a> <span class="k">pass</span> +</span><span id="L-2756"><a href="#L-2756"><span class="linenos">2756</span></a> +</span><span id="L-2757"><a href="#L-2757"><span class="linenos">2757</span></a> +</span><span id="L-2758"><a href="#L-2758"><span class="linenos">2758</span></a><span class="k">class</span> <span class="nc">Paren</span><span class="p">(</span><span class="n">Unary</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2759"><a href="#L-2759"><span class="linenos">2759</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2760"><a href="#L-2760"><span class="linenos">2760</span></a> +</span><span id="L-2761"><a href="#L-2761"><span class="linenos">2761</span></a> +</span><span id="L-2762"><a href="#L-2762"><span class="linenos">2762</span></a><span class="k">class</span> <span class="nc">Neg</span><span class="p">(</span><span class="n">Unary</span><span class="p">):</span> +</span><span id="L-2763"><a href="#L-2763"><span class="linenos">2763</span></a> <span class="k">pass</span> +</span><span id="L-2764"><a href="#L-2764"><span class="linenos">2764</span></a> +</span><span id="L-2765"><a href="#L-2765"><span class="linenos">2765</span></a> +</span><span id="L-2766"><a href="#L-2766"><span class="linenos">2766</span></a><span class="c1"># Special Functions</span> +</span><span id="L-2767"><a href="#L-2767"><span class="linenos">2767</span></a><span class="k">class</span> <span class="nc">Alias</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2768"><a href="#L-2768"><span class="linenos">2768</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2769"><a href="#L-2769"><span class="linenos">2769</span></a> +</span><span id="L-2770"><a href="#L-2770"><span class="linenos">2770</span></a> <span class="nd">@property</span> +</span><span id="L-2771"><a href="#L-2771"><span class="linenos">2771</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2772"><a href="#L-2772"><span class="linenos">2772</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-2773"><a href="#L-2773"><span class="linenos">2773</span></a> +</span><span id="L-2774"><a href="#L-2774"><span class="linenos">2774</span></a> +</span><span id="L-2775"><a href="#L-2775"><span class="linenos">2775</span></a><span class="k">class</span> <span class="nc">Aliases</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2776"><a href="#L-2776"><span class="linenos">2776</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2777"><a href="#L-2777"><span class="linenos">2777</span></a> +</span><span id="L-2778"><a href="#L-2778"><span class="linenos">2778</span></a> <span class="nd">@property</span> +</span><span id="L-2779"><a href="#L-2779"><span class="linenos">2779</span></a> <span class="k">def</span> <span class="nf">aliases</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2780"><a href="#L-2780"><span class="linenos">2780</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-2781"><a href="#L-2781"><span class="linenos">2781</span></a> +</span><span id="L-2782"><a href="#L-2782"><span class="linenos">2782</span></a> +</span><span id="L-2783"><a href="#L-2783"><span class="linenos">2783</span></a><span class="k">class</span> <span class="nc">AtTimeZone</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2784"><a href="#L-2784"><span class="linenos">2784</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2785"><a href="#L-2785"><span class="linenos">2785</span></a> +</span><span id="L-2786"><a href="#L-2786"><span class="linenos">2786</span></a> +</span><span id="L-2787"><a href="#L-2787"><span class="linenos">2787</span></a><span class="k">class</span> <span class="nc">Between</span><span class="p">(</span><span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2788"><a href="#L-2788"><span class="linenos">2788</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"low"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"high"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2789"><a href="#L-2789"><span class="linenos">2789</span></a> +</span><span id="L-2790"><a href="#L-2790"><span class="linenos">2790</span></a> +</span><span id="L-2791"><a href="#L-2791"><span class="linenos">2791</span></a><span class="k">class</span> <span class="nc">Bracket</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2792"><a href="#L-2792"><span class="linenos">2792</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2793"><a href="#L-2793"><span class="linenos">2793</span></a> +</span><span id="L-2794"><a href="#L-2794"><span class="linenos">2794</span></a> +</span><span id="L-2795"><a href="#L-2795"><span class="linenos">2795</span></a><span class="k">class</span> <span class="nc">Distinct</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2796"><a href="#L-2796"><span class="linenos">2796</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2797"><a href="#L-2797"><span class="linenos">2797</span></a> +</span><span id="L-2798"><a href="#L-2798"><span class="linenos">2798</span></a> +</span><span id="L-2799"><a href="#L-2799"><span class="linenos">2799</span></a><span class="k">class</span> <span class="nc">In</span><span class="p">(</span><span class="n">Predicate</span><span class="p">):</span> +</span><span id="L-2800"><a href="#L-2800"><span class="linenos">2800</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-2801"><a href="#L-2801"><span class="linenos">2801</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-2802"><a href="#L-2802"><span class="linenos">2802</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2803"><a href="#L-2803"><span class="linenos">2803</span></a> <span class="s2">"query"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2804"><a href="#L-2804"><span class="linenos">2804</span></a> <span class="s2">"unnest"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2805"><a href="#L-2805"><span class="linenos">2805</span></a> <span class="s2">"field"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2806"><a href="#L-2806"><span class="linenos">2806</span></a> <span class="s2">"is_global"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-2807"><a href="#L-2807"><span class="linenos">2807</span></a> <span class="p">}</span> +</span><span id="L-2808"><a href="#L-2808"><span class="linenos">2808</span></a> +</span><span id="L-2809"><a href="#L-2809"><span class="linenos">2809</span></a> +</span><span id="L-2810"><a href="#L-2810"><span class="linenos">2810</span></a><span class="k">class</span> <span class="nc">TimeUnit</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2811"><a href="#L-2811"><span class="linenos">2811</span></a><span class="w"> </span><span class="sd">"""Automatically converts unit arg into a var."""</span> +</span><span id="L-2812"><a href="#L-2812"><span class="linenos">2812</span></a> +</span><span id="L-2813"><a href="#L-2813"><span class="linenos">2813</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2814"><a href="#L-2814"><span class="linenos">2814</span></a> +</span><span id="L-2815"><a href="#L-2815"><span class="linenos">2815</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-2816"><a href="#L-2816"><span class="linenos">2816</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="L-2817"><a href="#L-2817"><span class="linenos">2817</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="L-2818"><a href="#L-2818"><span class="linenos">2818</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"unit"</span><span class="p">]</span> <span class="o">=</span> <span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-2819"><a href="#L-2819"><span class="linenos">2819</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">Week</span><span class="p">):</span> +</span><span id="L-2820"><a href="#L-2820"><span class="linenos">2820</span></a> <span class="n">unit</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> +</span><span id="L-2821"><a href="#L-2821"><span class="linenos">2821</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-2822"><a href="#L-2822"><span class="linenos">2822</span></a> +</span><span id="L-2823"><a href="#L-2823"><span class="linenos">2823</span></a> +</span><span id="L-2824"><a href="#L-2824"><span class="linenos">2824</span></a><span class="k">class</span> <span class="nc">Interval</span><span class="p">(</span><span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-2825"><a href="#L-2825"><span class="linenos">2825</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2826"><a href="#L-2826"><span class="linenos">2826</span></a> +</span><span id="L-2827"><a href="#L-2827"><span class="linenos">2827</span></a> +</span><span id="L-2828"><a href="#L-2828"><span class="linenos">2828</span></a><span class="k">class</span> <span class="nc">IgnoreNulls</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2829"><a href="#L-2829"><span class="linenos">2829</span></a> <span class="k">pass</span> +</span><span id="L-2830"><a href="#L-2830"><span class="linenos">2830</span></a> +</span><span id="L-2831"><a href="#L-2831"><span class="linenos">2831</span></a> +</span><span id="L-2832"><a href="#L-2832"><span class="linenos">2832</span></a><span class="k">class</span> <span class="nc">RespectNulls</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-2833"><a href="#L-2833"><span class="linenos">2833</span></a> <span class="k">pass</span> +</span><span id="L-2834"><a href="#L-2834"><span class="linenos">2834</span></a> +</span><span id="L-2835"><a href="#L-2835"><span class="linenos">2835</span></a> +</span><span id="L-2836"><a href="#L-2836"><span class="linenos">2836</span></a><span class="c1"># Functions</span> +</span><span id="L-2837"><a href="#L-2837"><span class="linenos">2837</span></a><span class="k">class</span> <span class="nc">Func</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="L-2838"><a href="#L-2838"><span class="linenos">2838</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-2839"><a href="#L-2839"><span class="linenos">2839</span></a><span class="sd"> The base class for all function expressions.</span> +</span><span id="L-2840"><a href="#L-2840"><span class="linenos">2840</span></a> +</span><span id="L-2841"><a href="#L-2841"><span class="linenos">2841</span></a><span class="sd"> Attributes:</span> +</span><span id="L-2842"><a href="#L-2842"><span class="linenos">2842</span></a><span class="sd"> is_var_len_args (bool): if set to True the last argument defined in arg_types will be</span> +</span><span id="L-2843"><a href="#L-2843"><span class="linenos">2843</span></a><span class="sd"> treated as a variable length argument and the argument's value will be stored as a list.</span> +</span><span id="L-2844"><a href="#L-2844"><span class="linenos">2844</span></a><span class="sd"> _sql_names (list): determines the SQL name (1st item in the list) and aliases (subsequent items)</span> +</span><span id="L-2845"><a href="#L-2845"><span class="linenos">2845</span></a><span class="sd"> for this function expression. These values are used to map this node to a name during parsing</span> +</span><span id="L-2846"><a href="#L-2846"><span class="linenos">2846</span></a><span class="sd"> as well as to provide the function's name during SQL string generation. By default the SQL</span> +</span><span id="L-2847"><a href="#L-2847"><span class="linenos">2847</span></a><span class="sd"> name is set to the expression's class name transformed to snake case.</span> +</span><span id="L-2848"><a href="#L-2848"><span class="linenos">2848</span></a><span class="sd"> """</span> +</span><span id="L-2849"><a href="#L-2849"><span class="linenos">2849</span></a> +</span><span id="L-2850"><a href="#L-2850"><span class="linenos">2850</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-2851"><a href="#L-2851"><span class="linenos">2851</span></a> +</span><span id="L-2852"><a href="#L-2852"><span class="linenos">2852</span></a> <span class="nd">@classmethod</span> +</span><span id="L-2853"><a href="#L-2853"><span class="linenos">2853</span></a> <span class="k">def</span> <span class="nf">from_arg_list</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span> +</span><span id="L-2854"><a href="#L-2854"><span class="linenos">2854</span></a> <span class="k">if</span> <span class="bp">cls</span><span class="o">.</span><span class="n">is_var_len_args</span><span class="p">:</span> +</span><span id="L-2855"><a href="#L-2855"><span class="linenos">2855</span></a> <span class="n">all_arg_keys</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> +</span><span id="L-2856"><a href="#L-2856"><span class="linenos">2856</span></a> <span class="c1"># If this function supports variable length argument treat the last argument as such.</span> +</span><span id="L-2857"><a href="#L-2857"><span class="linenos">2857</span></a> <span class="n">non_var_len_arg_keys</span> <span class="o">=</span> <span class="n">all_arg_keys</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="k">if</span> <span class="bp">cls</span><span class="o">.</span><span class="n">is_var_len_args</span> <span class="k">else</span> <span class="n">all_arg_keys</span> +</span><span id="L-2858"><a href="#L-2858"><span class="linenos">2858</span></a> <span class="n">num_non_var</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">non_var_len_arg_keys</span><span class="p">)</span> +</span><span id="L-2859"><a href="#L-2859"><span class="linenos">2859</span></a> +</span><span id="L-2860"><a href="#L-2860"><span class="linenos">2860</span></a> <span class="n">args_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span><span class="p">,</span> <span class="n">arg_key</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">non_var_len_arg_keys</span><span class="p">)}</span> +</span><span id="L-2861"><a href="#L-2861"><span class="linenos">2861</span></a> <span class="n">args_dict</span><span class="p">[</span><span class="n">all_arg_keys</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="n">num_non_var</span><span class="p">:]</span> +</span><span id="L-2862"><a href="#L-2862"><span class="linenos">2862</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2863"><a href="#L-2863"><span class="linenos">2863</span></a> <span class="n">args_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span><span class="p">,</span> <span class="n">arg_key</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="bp">cls</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)}</span> +</span><span id="L-2864"><a href="#L-2864"><span class="linenos">2864</span></a> +</span><span id="L-2865"><a href="#L-2865"><span class="linenos">2865</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="o">**</span><span class="n">args_dict</span><span class="p">)</span> +</span><span id="L-2866"><a href="#L-2866"><span class="linenos">2866</span></a> +</span><span id="L-2867"><a href="#L-2867"><span class="linenos">2867</span></a> <span class="nd">@classmethod</span> +</span><span id="L-2868"><a href="#L-2868"><span class="linenos">2868</span></a> <span class="k">def</span> <span class="nf">sql_names</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="L-2869"><a href="#L-2869"><span class="linenos">2869</span></a> <span class="k">if</span> <span class="bp">cls</span> <span class="ow">is</span> <span class="n">Func</span><span class="p">:</span> +</span><span id="L-2870"><a href="#L-2870"><span class="linenos">2870</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span> +</span><span id="L-2871"><a href="#L-2871"><span class="linenos">2871</span></a> <span class="s2">"SQL name is only supported by concrete function implementations"</span> +</span><span id="L-2872"><a href="#L-2872"><span class="linenos">2872</span></a> <span class="p">)</span> +</span><span id="L-2873"><a href="#L-2873"><span class="linenos">2873</span></a> <span class="k">if</span> <span class="s2">"_sql_names"</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">:</span> +</span><span id="L-2874"><a href="#L-2874"><span class="linenos">2874</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="n">camel_to_snake_case</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)]</span> +</span><span id="L-2875"><a href="#L-2875"><span class="linenos">2875</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_sql_names</span> +</span><span id="L-2876"><a href="#L-2876"><span class="linenos">2876</span></a> +</span><span id="L-2877"><a href="#L-2877"><span class="linenos">2877</span></a> <span class="nd">@classmethod</span> +</span><span id="L-2878"><a href="#L-2878"><span class="linenos">2878</span></a> <span class="k">def</span> <span class="nf">sql_name</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="L-2879"><a href="#L-2879"><span class="linenos">2879</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-2880"><a href="#L-2880"><span class="linenos">2880</span></a> +</span><span id="L-2881"><a href="#L-2881"><span class="linenos">2881</span></a> <span class="nd">@classmethod</span> +</span><span id="L-2882"><a href="#L-2882"><span class="linenos">2882</span></a> <span class="k">def</span> <span class="nf">default_parser_mappings</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="L-2883"><a href="#L-2883"><span class="linenos">2883</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="bp">cls</span><span class="o">.</span><span class="n">from_arg_list</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()}</span> +</span><span id="L-2884"><a href="#L-2884"><span class="linenos">2884</span></a> +</span><span id="L-2885"><a href="#L-2885"><span class="linenos">2885</span></a> +</span><span id="L-2886"><a href="#L-2886"><span class="linenos">2886</span></a><span class="k">class</span> <span class="nc">AggFunc</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2887"><a href="#L-2887"><span class="linenos">2887</span></a> <span class="k">pass</span> +</span><span id="L-2888"><a href="#L-2888"><span class="linenos">2888</span></a> +</span><span id="L-2889"><a href="#L-2889"><span class="linenos">2889</span></a> +</span><span id="L-2890"><a href="#L-2890"><span class="linenos">2890</span></a><span class="k">class</span> <span class="nc">Abs</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2891"><a href="#L-2891"><span class="linenos">2891</span></a> <span class="k">pass</span> +</span><span id="L-2892"><a href="#L-2892"><span class="linenos">2892</span></a> +</span><span id="L-2893"><a href="#L-2893"><span class="linenos">2893</span></a> +</span><span id="L-2894"><a href="#L-2894"><span class="linenos">2894</span></a><span class="k">class</span> <span class="nc">Anonymous</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2895"><a href="#L-2895"><span class="linenos">2895</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2896"><a href="#L-2896"><span class="linenos">2896</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-2897"><a href="#L-2897"><span class="linenos">2897</span></a> +</span><span id="L-2898"><a href="#L-2898"><span class="linenos">2898</span></a> +</span><span id="L-2899"><a href="#L-2899"><span class="linenos">2899</span></a><span class="k">class</span> <span class="nc">ApproxDistinct</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-2900"><a href="#L-2900"><span class="linenos">2900</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"accuracy"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2901"><a href="#L-2901"><span class="linenos">2901</span></a> +</span><span id="L-2902"><a href="#L-2902"><span class="linenos">2902</span></a> +</span><span id="L-2903"><a href="#L-2903"><span class="linenos">2903</span></a><span class="k">class</span> <span class="nc">Array</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2904"><a href="#L-2904"><span class="linenos">2904</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2905"><a href="#L-2905"><span class="linenos">2905</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-2906"><a href="#L-2906"><span class="linenos">2906</span></a> +</span><span id="L-2907"><a href="#L-2907"><span class="linenos">2907</span></a> +</span><span id="L-2908"><a href="#L-2908"><span class="linenos">2908</span></a><span class="k">class</span> <span class="nc">GenerateSeries</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2909"><a href="#L-2909"><span class="linenos">2909</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"start"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"end"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"step"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2910"><a href="#L-2910"><span class="linenos">2910</span></a> +</span><span id="L-2911"><a href="#L-2911"><span class="linenos">2911</span></a> +</span><span id="L-2912"><a href="#L-2912"><span class="linenos">2912</span></a><span class="k">class</span> <span class="nc">ArrayAgg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-2913"><a href="#L-2913"><span class="linenos">2913</span></a> <span class="k">pass</span> +</span><span id="L-2914"><a href="#L-2914"><span class="linenos">2914</span></a> +</span><span id="L-2915"><a href="#L-2915"><span class="linenos">2915</span></a> +</span><span id="L-2916"><a href="#L-2916"><span class="linenos">2916</span></a><span class="k">class</span> <span class="nc">ArrayAll</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2917"><a href="#L-2917"><span class="linenos">2917</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2918"><a href="#L-2918"><span class="linenos">2918</span></a> +</span><span id="L-2919"><a href="#L-2919"><span class="linenos">2919</span></a> +</span><span id="L-2920"><a href="#L-2920"><span class="linenos">2920</span></a><span class="k">class</span> <span class="nc">ArrayAny</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2921"><a href="#L-2921"><span class="linenos">2921</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2922"><a href="#L-2922"><span class="linenos">2922</span></a> +</span><span id="L-2923"><a href="#L-2923"><span class="linenos">2923</span></a> +</span><span id="L-2924"><a href="#L-2924"><span class="linenos">2924</span></a><span class="k">class</span> <span class="nc">ArrayConcat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2925"><a href="#L-2925"><span class="linenos">2925</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2926"><a href="#L-2926"><span class="linenos">2926</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-2927"><a href="#L-2927"><span class="linenos">2927</span></a> +</span><span id="L-2928"><a href="#L-2928"><span class="linenos">2928</span></a> +</span><span id="L-2929"><a href="#L-2929"><span class="linenos">2929</span></a><span class="k">class</span> <span class="nc">ArrayContains</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2930"><a href="#L-2930"><span class="linenos">2930</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2931"><a href="#L-2931"><span class="linenos">2931</span></a> +</span><span id="L-2932"><a href="#L-2932"><span class="linenos">2932</span></a> +</span><span id="L-2933"><a href="#L-2933"><span class="linenos">2933</span></a><span class="k">class</span> <span class="nc">ArrayFilter</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2934"><a href="#L-2934"><span class="linenos">2934</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2935"><a href="#L-2935"><span class="linenos">2935</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"FILTER"</span><span class="p">,</span> <span class="s2">"ARRAY_FILTER"</span><span class="p">]</span> +</span><span id="L-2936"><a href="#L-2936"><span class="linenos">2936</span></a> +</span><span id="L-2937"><a href="#L-2937"><span class="linenos">2937</span></a> +</span><span id="L-2938"><a href="#L-2938"><span class="linenos">2938</span></a><span class="k">class</span> <span class="nc">ArraySize</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2939"><a href="#L-2939"><span class="linenos">2939</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2940"><a href="#L-2940"><span class="linenos">2940</span></a> +</span><span id="L-2941"><a href="#L-2941"><span class="linenos">2941</span></a> +</span><span id="L-2942"><a href="#L-2942"><span class="linenos">2942</span></a><span class="k">class</span> <span class="nc">ArraySort</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2943"><a href="#L-2943"><span class="linenos">2943</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2944"><a href="#L-2944"><span class="linenos">2944</span></a> +</span><span id="L-2945"><a href="#L-2945"><span class="linenos">2945</span></a> +</span><span id="L-2946"><a href="#L-2946"><span class="linenos">2946</span></a><span class="k">class</span> <span class="nc">ArraySum</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2947"><a href="#L-2947"><span class="linenos">2947</span></a> <span class="k">pass</span> +</span><span id="L-2948"><a href="#L-2948"><span class="linenos">2948</span></a> +</span><span id="L-2949"><a href="#L-2949"><span class="linenos">2949</span></a> +</span><span id="L-2950"><a href="#L-2950"><span class="linenos">2950</span></a><span class="k">class</span> <span class="nc">ArrayUnionAgg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-2951"><a href="#L-2951"><span class="linenos">2951</span></a> <span class="k">pass</span> +</span><span id="L-2952"><a href="#L-2952"><span class="linenos">2952</span></a> +</span><span id="L-2953"><a href="#L-2953"><span class="linenos">2953</span></a> +</span><span id="L-2954"><a href="#L-2954"><span class="linenos">2954</span></a><span class="k">class</span> <span class="nc">Avg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-2955"><a href="#L-2955"><span class="linenos">2955</span></a> <span class="k">pass</span> +</span><span id="L-2956"><a href="#L-2956"><span class="linenos">2956</span></a> +</span><span id="L-2957"><a href="#L-2957"><span class="linenos">2957</span></a> +</span><span id="L-2958"><a href="#L-2958"><span class="linenos">2958</span></a><span class="k">class</span> <span class="nc">AnyValue</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-2959"><a href="#L-2959"><span class="linenos">2959</span></a> <span class="k">pass</span> +</span><span id="L-2960"><a href="#L-2960"><span class="linenos">2960</span></a> +</span><span id="L-2961"><a href="#L-2961"><span class="linenos">2961</span></a> +</span><span id="L-2962"><a href="#L-2962"><span class="linenos">2962</span></a><span class="k">class</span> <span class="nc">Case</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2963"><a href="#L-2963"><span class="linenos">2963</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"ifs"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2964"><a href="#L-2964"><span class="linenos">2964</span></a> +</span><span id="L-2965"><a href="#L-2965"><span class="linenos">2965</span></a> +</span><span id="L-2966"><a href="#L-2966"><span class="linenos">2966</span></a><span class="k">class</span> <span class="nc">Cast</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2967"><a href="#L-2967"><span class="linenos">2967</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"to"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-2968"><a href="#L-2968"><span class="linenos">2968</span></a> +</span><span id="L-2969"><a href="#L-2969"><span class="linenos">2969</span></a> <span class="nd">@property</span> +</span><span id="L-2970"><a href="#L-2970"><span class="linenos">2970</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-2971"><a href="#L-2971"><span class="linenos">2971</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-2972"><a href="#L-2972"><span class="linenos">2972</span></a> +</span><span id="L-2973"><a href="#L-2973"><span class="linenos">2973</span></a> <span class="nd">@property</span> +</span><span id="L-2974"><a href="#L-2974"><span class="linenos">2974</span></a> <span class="k">def</span> <span class="nf">to</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2975"><a href="#L-2975"><span class="linenos">2975</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]</span> +</span><span id="L-2976"><a href="#L-2976"><span class="linenos">2976</span></a> +</span><span id="L-2977"><a href="#L-2977"><span class="linenos">2977</span></a> <span class="nd">@property</span> +</span><span id="L-2978"><a href="#L-2978"><span class="linenos">2978</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-2979"><a href="#L-2979"><span class="linenos">2979</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-2980"><a href="#L-2980"><span class="linenos">2980</span></a> +</span><span id="L-2981"><a href="#L-2981"><span class="linenos">2981</span></a> <span class="k">def</span> <span class="nf">is_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-2982"><a href="#L-2982"><span class="linenos">2982</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> +</span><span id="L-2983"><a href="#L-2983"><span class="linenos">2983</span></a> +</span><span id="L-2984"><a href="#L-2984"><span class="linenos">2984</span></a> +</span><span id="L-2985"><a href="#L-2985"><span class="linenos">2985</span></a><span class="k">class</span> <span class="nc">Collate</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-2986"><a href="#L-2986"><span class="linenos">2986</span></a> <span class="k">pass</span> +</span><span id="L-2987"><a href="#L-2987"><span class="linenos">2987</span></a> +</span><span id="L-2988"><a href="#L-2988"><span class="linenos">2988</span></a> +</span><span id="L-2989"><a href="#L-2989"><span class="linenos">2989</span></a><span class="k">class</span> <span class="nc">TryCast</span><span class="p">(</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="L-2990"><a href="#L-2990"><span class="linenos">2990</span></a> <span class="k">pass</span> +</span><span id="L-2991"><a href="#L-2991"><span class="linenos">2991</span></a> +</span><span id="L-2992"><a href="#L-2992"><span class="linenos">2992</span></a> +</span><span id="L-2993"><a href="#L-2993"><span class="linenos">2993</span></a><span class="k">class</span> <span class="nc">Ceil</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2994"><a href="#L-2994"><span class="linenos">2994</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"decimals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-2995"><a href="#L-2995"><span class="linenos">2995</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"CEIL"</span><span class="p">,</span> <span class="s2">"CEILING"</span><span class="p">]</span> +</span><span id="L-2996"><a href="#L-2996"><span class="linenos">2996</span></a> +</span><span id="L-2997"><a href="#L-2997"><span class="linenos">2997</span></a> +</span><span id="L-2998"><a href="#L-2998"><span class="linenos">2998</span></a><span class="k">class</span> <span class="nc">Coalesce</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2999"><a href="#L-2999"><span class="linenos">2999</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3000"><a href="#L-3000"><span class="linenos">3000</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3001"><a href="#L-3001"><span class="linenos">3001</span></a> +</span><span id="L-3002"><a href="#L-3002"><span class="linenos">3002</span></a> +</span><span id="L-3003"><a href="#L-3003"><span class="linenos">3003</span></a><span class="k">class</span> <span class="nc">Concat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3004"><a href="#L-3004"><span class="linenos">3004</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3005"><a href="#L-3005"><span class="linenos">3005</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3006"><a href="#L-3006"><span class="linenos">3006</span></a> +</span><span id="L-3007"><a href="#L-3007"><span class="linenos">3007</span></a> +</span><span id="L-3008"><a href="#L-3008"><span class="linenos">3008</span></a><span class="k">class</span> <span class="nc">ConcatWs</span><span class="p">(</span><span class="n">Concat</span><span class="p">):</span> +</span><span id="L-3009"><a href="#L-3009"><span class="linenos">3009</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"CONCAT_WS"</span><span class="p">]</span> +</span><span id="L-3010"><a href="#L-3010"><span class="linenos">3010</span></a> +</span><span id="L-3011"><a href="#L-3011"><span class="linenos">3011</span></a> +</span><span id="L-3012"><a href="#L-3012"><span class="linenos">3012</span></a><span class="k">class</span> <span class="nc">Count</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3013"><a href="#L-3013"><span class="linenos">3013</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3014"><a href="#L-3014"><span class="linenos">3014</span></a> +</span><span id="L-3015"><a href="#L-3015"><span class="linenos">3015</span></a> +</span><span id="L-3016"><a href="#L-3016"><span class="linenos">3016</span></a><span class="k">class</span> <span class="nc">CurrentDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3017"><a href="#L-3017"><span class="linenos">3017</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3018"><a href="#L-3018"><span class="linenos">3018</span></a> +</span><span id="L-3019"><a href="#L-3019"><span class="linenos">3019</span></a> +</span><span id="L-3020"><a href="#L-3020"><span class="linenos">3020</span></a><span class="k">class</span> <span class="nc">CurrentDatetime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3021"><a href="#L-3021"><span class="linenos">3021</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3022"><a href="#L-3022"><span class="linenos">3022</span></a> +</span><span id="L-3023"><a href="#L-3023"><span class="linenos">3023</span></a> +</span><span id="L-3024"><a href="#L-3024"><span class="linenos">3024</span></a><span class="k">class</span> <span class="nc">CurrentTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3025"><a href="#L-3025"><span class="linenos">3025</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3026"><a href="#L-3026"><span class="linenos">3026</span></a> +</span><span id="L-3027"><a href="#L-3027"><span class="linenos">3027</span></a> +</span><span id="L-3028"><a href="#L-3028"><span class="linenos">3028</span></a><span class="k">class</span> <span class="nc">CurrentTimestamp</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3029"><a href="#L-3029"><span class="linenos">3029</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3030"><a href="#L-3030"><span class="linenos">3030</span></a> +</span><span id="L-3031"><a href="#L-3031"><span class="linenos">3031</span></a> +</span><span id="L-3032"><a href="#L-3032"><span class="linenos">3032</span></a><span class="k">class</span> <span class="nc">DateAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3033"><a href="#L-3033"><span class="linenos">3033</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3034"><a href="#L-3034"><span class="linenos">3034</span></a> +</span><span id="L-3035"><a href="#L-3035"><span class="linenos">3035</span></a> +</span><span id="L-3036"><a href="#L-3036"><span class="linenos">3036</span></a><span class="k">class</span> <span class="nc">DateSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3037"><a href="#L-3037"><span class="linenos">3037</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3038"><a href="#L-3038"><span class="linenos">3038</span></a> +</span><span id="L-3039"><a href="#L-3039"><span class="linenos">3039</span></a> +</span><span id="L-3040"><a href="#L-3040"><span class="linenos">3040</span></a><span class="k">class</span> <span class="nc">DateDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3041"><a href="#L-3041"><span class="linenos">3041</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3042"><a href="#L-3042"><span class="linenos">3042</span></a> +</span><span id="L-3043"><a href="#L-3043"><span class="linenos">3043</span></a> +</span><span id="L-3044"><a href="#L-3044"><span class="linenos">3044</span></a><span class="k">class</span> <span class="nc">DateTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3045"><a href="#L-3045"><span class="linenos">3045</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3046"><a href="#L-3046"><span class="linenos">3046</span></a> +</span><span id="L-3047"><a href="#L-3047"><span class="linenos">3047</span></a> +</span><span id="L-3048"><a href="#L-3048"><span class="linenos">3048</span></a><span class="k">class</span> <span class="nc">DatetimeAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3049"><a href="#L-3049"><span class="linenos">3049</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3050"><a href="#L-3050"><span class="linenos">3050</span></a> +</span><span id="L-3051"><a href="#L-3051"><span class="linenos">3051</span></a> +</span><span id="L-3052"><a href="#L-3052"><span class="linenos">3052</span></a><span class="k">class</span> <span class="nc">DatetimeSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3053"><a href="#L-3053"><span class="linenos">3053</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3054"><a href="#L-3054"><span class="linenos">3054</span></a> +</span><span id="L-3055"><a href="#L-3055"><span class="linenos">3055</span></a> +</span><span id="L-3056"><a href="#L-3056"><span class="linenos">3056</span></a><span class="k">class</span> <span class="nc">DatetimeDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3057"><a href="#L-3057"><span class="linenos">3057</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3058"><a href="#L-3058"><span class="linenos">3058</span></a> +</span><span id="L-3059"><a href="#L-3059"><span class="linenos">3059</span></a> +</span><span id="L-3060"><a href="#L-3060"><span class="linenos">3060</span></a><span class="k">class</span> <span class="nc">DatetimeTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3061"><a href="#L-3061"><span class="linenos">3061</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3062"><a href="#L-3062"><span class="linenos">3062</span></a> +</span><span id="L-3063"><a href="#L-3063"><span class="linenos">3063</span></a> +</span><span id="L-3064"><a href="#L-3064"><span class="linenos">3064</span></a><span class="k">class</span> <span class="nc">DayOfWeek</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3065"><a href="#L-3065"><span class="linenos">3065</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DAY_OF_WEEK"</span><span class="p">,</span> <span class="s2">"DAYOFWEEK"</span><span class="p">]</span> +</span><span id="L-3066"><a href="#L-3066"><span class="linenos">3066</span></a> +</span><span id="L-3067"><a href="#L-3067"><span class="linenos">3067</span></a> +</span><span id="L-3068"><a href="#L-3068"><span class="linenos">3068</span></a><span class="k">class</span> <span class="nc">DayOfMonth</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3069"><a href="#L-3069"><span class="linenos">3069</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DAY_OF_MONTH"</span><span class="p">,</span> <span class="s2">"DAYOFMONTH"</span><span class="p">]</span> +</span><span id="L-3070"><a href="#L-3070"><span class="linenos">3070</span></a> +</span><span id="L-3071"><a href="#L-3071"><span class="linenos">3071</span></a> +</span><span id="L-3072"><a href="#L-3072"><span class="linenos">3072</span></a><span class="k">class</span> <span class="nc">DayOfYear</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3073"><a href="#L-3073"><span class="linenos">3073</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DAY_OF_YEAR"</span><span class="p">,</span> <span class="s2">"DAYOFYEAR"</span><span class="p">]</span> +</span><span id="L-3074"><a href="#L-3074"><span class="linenos">3074</span></a> +</span><span id="L-3075"><a href="#L-3075"><span class="linenos">3075</span></a> +</span><span id="L-3076"><a href="#L-3076"><span class="linenos">3076</span></a><span class="k">class</span> <span class="nc">WeekOfYear</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3077"><a href="#L-3077"><span class="linenos">3077</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"WEEK_OF_YEAR"</span><span class="p">,</span> <span class="s2">"WEEKOFYEAR"</span><span class="p">]</span> +</span><span id="L-3078"><a href="#L-3078"><span class="linenos">3078</span></a> +</span><span id="L-3079"><a href="#L-3079"><span class="linenos">3079</span></a> +</span><span id="L-3080"><a href="#L-3080"><span class="linenos">3080</span></a><span class="k">class</span> <span class="nc">LastDateOfMonth</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3081"><a href="#L-3081"><span class="linenos">3081</span></a> <span class="k">pass</span> +</span><span id="L-3082"><a href="#L-3082"><span class="linenos">3082</span></a> +</span><span id="L-3083"><a href="#L-3083"><span class="linenos">3083</span></a> +</span><span id="L-3084"><a href="#L-3084"><span class="linenos">3084</span></a><span class="k">class</span> <span class="nc">Extract</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3085"><a href="#L-3085"><span class="linenos">3085</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3086"><a href="#L-3086"><span class="linenos">3086</span></a> +</span><span id="L-3087"><a href="#L-3087"><span class="linenos">3087</span></a> +</span><span id="L-3088"><a href="#L-3088"><span class="linenos">3088</span></a><span class="k">class</span> <span class="nc">TimestampAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3089"><a href="#L-3089"><span class="linenos">3089</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3090"><a href="#L-3090"><span class="linenos">3090</span></a> +</span><span id="L-3091"><a href="#L-3091"><span class="linenos">3091</span></a> +</span><span id="L-3092"><a href="#L-3092"><span class="linenos">3092</span></a><span class="k">class</span> <span class="nc">TimestampSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3093"><a href="#L-3093"><span class="linenos">3093</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3094"><a href="#L-3094"><span class="linenos">3094</span></a> +</span><span id="L-3095"><a href="#L-3095"><span class="linenos">3095</span></a> +</span><span id="L-3096"><a href="#L-3096"><span class="linenos">3096</span></a><span class="k">class</span> <span class="nc">TimestampDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3097"><a href="#L-3097"><span class="linenos">3097</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3098"><a href="#L-3098"><span class="linenos">3098</span></a> +</span><span id="L-3099"><a href="#L-3099"><span class="linenos">3099</span></a> +</span><span id="L-3100"><a href="#L-3100"><span class="linenos">3100</span></a><span class="k">class</span> <span class="nc">TimestampTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3101"><a href="#L-3101"><span class="linenos">3101</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3102"><a href="#L-3102"><span class="linenos">3102</span></a> +</span><span id="L-3103"><a href="#L-3103"><span class="linenos">3103</span></a> +</span><span id="L-3104"><a href="#L-3104"><span class="linenos">3104</span></a><span class="k">class</span> <span class="nc">TimeAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3105"><a href="#L-3105"><span class="linenos">3105</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3106"><a href="#L-3106"><span class="linenos">3106</span></a> +</span><span id="L-3107"><a href="#L-3107"><span class="linenos">3107</span></a> +</span><span id="L-3108"><a href="#L-3108"><span class="linenos">3108</span></a><span class="k">class</span> <span class="nc">TimeSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3109"><a href="#L-3109"><span class="linenos">3109</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3110"><a href="#L-3110"><span class="linenos">3110</span></a> +</span><span id="L-3111"><a href="#L-3111"><span class="linenos">3111</span></a> +</span><span id="L-3112"><a href="#L-3112"><span class="linenos">3112</span></a><span class="k">class</span> <span class="nc">TimeDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3113"><a href="#L-3113"><span class="linenos">3113</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3114"><a href="#L-3114"><span class="linenos">3114</span></a> +</span><span id="L-3115"><a href="#L-3115"><span class="linenos">3115</span></a> +</span><span id="L-3116"><a href="#L-3116"><span class="linenos">3116</span></a><span class="k">class</span> <span class="nc">TimeTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3117"><a href="#L-3117"><span class="linenos">3117</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3118"><a href="#L-3118"><span class="linenos">3118</span></a> +</span><span id="L-3119"><a href="#L-3119"><span class="linenos">3119</span></a> +</span><span id="L-3120"><a href="#L-3120"><span class="linenos">3120</span></a><span class="k">class</span> <span class="nc">DateFromParts</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3121"><a href="#L-3121"><span class="linenos">3121</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DATEFROMPARTS"</span><span class="p">]</span> +</span><span id="L-3122"><a href="#L-3122"><span class="linenos">3122</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"year"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"month"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"day"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3123"><a href="#L-3123"><span class="linenos">3123</span></a> +</span><span id="L-3124"><a href="#L-3124"><span class="linenos">3124</span></a> +</span><span id="L-3125"><a href="#L-3125"><span class="linenos">3125</span></a><span class="k">class</span> <span class="nc">DateStrToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3126"><a href="#L-3126"><span class="linenos">3126</span></a> <span class="k">pass</span> +</span><span id="L-3127"><a href="#L-3127"><span class="linenos">3127</span></a> +</span><span id="L-3128"><a href="#L-3128"><span class="linenos">3128</span></a> +</span><span id="L-3129"><a href="#L-3129"><span class="linenos">3129</span></a><span class="k">class</span> <span class="nc">DateToDateStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3130"><a href="#L-3130"><span class="linenos">3130</span></a> <span class="k">pass</span> +</span><span id="L-3131"><a href="#L-3131"><span class="linenos">3131</span></a> +</span><span id="L-3132"><a href="#L-3132"><span class="linenos">3132</span></a> +</span><span id="L-3133"><a href="#L-3133"><span class="linenos">3133</span></a><span class="k">class</span> <span class="nc">DateToDi</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3134"><a href="#L-3134"><span class="linenos">3134</span></a> <span class="k">pass</span> +</span><span id="L-3135"><a href="#L-3135"><span class="linenos">3135</span></a> +</span><span id="L-3136"><a href="#L-3136"><span class="linenos">3136</span></a> +</span><span id="L-3137"><a href="#L-3137"><span class="linenos">3137</span></a><span class="k">class</span> <span class="nc">Day</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3138"><a href="#L-3138"><span class="linenos">3138</span></a> <span class="k">pass</span> +</span><span id="L-3139"><a href="#L-3139"><span class="linenos">3139</span></a> +</span><span id="L-3140"><a href="#L-3140"><span class="linenos">3140</span></a> +</span><span id="L-3141"><a href="#L-3141"><span class="linenos">3141</span></a><span class="k">class</span> <span class="nc">Decode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3142"><a href="#L-3142"><span class="linenos">3142</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"charset"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"replace"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3143"><a href="#L-3143"><span class="linenos">3143</span></a> +</span><span id="L-3144"><a href="#L-3144"><span class="linenos">3144</span></a> +</span><span id="L-3145"><a href="#L-3145"><span class="linenos">3145</span></a><span class="k">class</span> <span class="nc">DiToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3146"><a href="#L-3146"><span class="linenos">3146</span></a> <span class="k">pass</span> +</span><span id="L-3147"><a href="#L-3147"><span class="linenos">3147</span></a> +</span><span id="L-3148"><a href="#L-3148"><span class="linenos">3148</span></a> +</span><span id="L-3149"><a href="#L-3149"><span class="linenos">3149</span></a><span class="k">class</span> <span class="nc">Encode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3150"><a href="#L-3150"><span class="linenos">3150</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"charset"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3151"><a href="#L-3151"><span class="linenos">3151</span></a> +</span><span id="L-3152"><a href="#L-3152"><span class="linenos">3152</span></a> +</span><span id="L-3153"><a href="#L-3153"><span class="linenos">3153</span></a><span class="k">class</span> <span class="nc">Exp</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3154"><a href="#L-3154"><span class="linenos">3154</span></a> <span class="k">pass</span> +</span><span id="L-3155"><a href="#L-3155"><span class="linenos">3155</span></a> +</span><span id="L-3156"><a href="#L-3156"><span class="linenos">3156</span></a> +</span><span id="L-3157"><a href="#L-3157"><span class="linenos">3157</span></a><span class="k">class</span> <span class="nc">Explode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3158"><a href="#L-3158"><span class="linenos">3158</span></a> <span class="k">pass</span> +</span><span id="L-3159"><a href="#L-3159"><span class="linenos">3159</span></a> +</span><span id="L-3160"><a href="#L-3160"><span class="linenos">3160</span></a> +</span><span id="L-3161"><a href="#L-3161"><span class="linenos">3161</span></a><span class="k">class</span> <span class="nc">Floor</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3162"><a href="#L-3162"><span class="linenos">3162</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"decimals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3163"><a href="#L-3163"><span class="linenos">3163</span></a> +</span><span id="L-3164"><a href="#L-3164"><span class="linenos">3164</span></a> +</span><span id="L-3165"><a href="#L-3165"><span class="linenos">3165</span></a><span class="k">class</span> <span class="nc">Greatest</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3166"><a href="#L-3166"><span class="linenos">3166</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3167"><a href="#L-3167"><span class="linenos">3167</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3168"><a href="#L-3168"><span class="linenos">3168</span></a> +</span><span id="L-3169"><a href="#L-3169"><span class="linenos">3169</span></a> +</span><span id="L-3170"><a href="#L-3170"><span class="linenos">3170</span></a><span class="k">class</span> <span class="nc">GroupConcat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3171"><a href="#L-3171"><span class="linenos">3171</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"separator"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3172"><a href="#L-3172"><span class="linenos">3172</span></a> +</span><span id="L-3173"><a href="#L-3173"><span class="linenos">3173</span></a> +</span><span id="L-3174"><a href="#L-3174"><span class="linenos">3174</span></a><span class="k">class</span> <span class="nc">Hex</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3175"><a href="#L-3175"><span class="linenos">3175</span></a> <span class="k">pass</span> +</span><span id="L-3176"><a href="#L-3176"><span class="linenos">3176</span></a> +</span><span id="L-3177"><a href="#L-3177"><span class="linenos">3177</span></a> +</span><span id="L-3178"><a href="#L-3178"><span class="linenos">3178</span></a><span class="k">class</span> <span class="nc">If</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3179"><a href="#L-3179"><span class="linenos">3179</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3180"><a href="#L-3180"><span class="linenos">3180</span></a> +</span><span id="L-3181"><a href="#L-3181"><span class="linenos">3181</span></a> +</span><span id="L-3182"><a href="#L-3182"><span class="linenos">3182</span></a><span class="k">class</span> <span class="nc">IfNull</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3183"><a href="#L-3183"><span class="linenos">3183</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3184"><a href="#L-3184"><span class="linenos">3184</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"IFNULL"</span><span class="p">,</span> <span class="s2">"NVL"</span><span class="p">]</span> +</span><span id="L-3185"><a href="#L-3185"><span class="linenos">3185</span></a> +</span><span id="L-3186"><a href="#L-3186"><span class="linenos">3186</span></a> +</span><span id="L-3187"><a href="#L-3187"><span class="linenos">3187</span></a><span class="k">class</span> <span class="nc">Initcap</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3188"><a href="#L-3188"><span class="linenos">3188</span></a> <span class="k">pass</span> +</span><span id="L-3189"><a href="#L-3189"><span class="linenos">3189</span></a> +</span><span id="L-3190"><a href="#L-3190"><span class="linenos">3190</span></a> +</span><span id="L-3191"><a href="#L-3191"><span class="linenos">3191</span></a><span class="k">class</span> <span class="nc">JSONBContains</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-3192"><a href="#L-3192"><span class="linenos">3192</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSONB_CONTAINS"</span><span class="p">]</span> +</span><span id="L-3193"><a href="#L-3193"><span class="linenos">3193</span></a> +</span><span id="L-3194"><a href="#L-3194"><span class="linenos">3194</span></a> +</span><span id="L-3195"><a href="#L-3195"><span class="linenos">3195</span></a><span class="k">class</span> <span class="nc">JSONExtract</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Func</span><span class="p">):</span> +</span><span id="L-3196"><a href="#L-3196"><span class="linenos">3196</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSON_EXTRACT"</span><span class="p">]</span> +</span><span id="L-3197"><a href="#L-3197"><span class="linenos">3197</span></a> +</span><span id="L-3198"><a href="#L-3198"><span class="linenos">3198</span></a> +</span><span id="L-3199"><a href="#L-3199"><span class="linenos">3199</span></a><span class="k">class</span> <span class="nc">JSONExtractScalar</span><span class="p">(</span><span class="n">JSONExtract</span><span class="p">):</span> +</span><span id="L-3200"><a href="#L-3200"><span class="linenos">3200</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSON_EXTRACT_SCALAR"</span><span class="p">]</span> +</span><span id="L-3201"><a href="#L-3201"><span class="linenos">3201</span></a> +</span><span id="L-3202"><a href="#L-3202"><span class="linenos">3202</span></a> +</span><span id="L-3203"><a href="#L-3203"><span class="linenos">3203</span></a><span class="k">class</span> <span class="nc">JSONBExtract</span><span class="p">(</span><span class="n">JSONExtract</span><span class="p">):</span> +</span><span id="L-3204"><a href="#L-3204"><span class="linenos">3204</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSONB_EXTRACT"</span><span class="p">]</span> +</span><span id="L-3205"><a href="#L-3205"><span class="linenos">3205</span></a> +</span><span id="L-3206"><a href="#L-3206"><span class="linenos">3206</span></a> +</span><span id="L-3207"><a href="#L-3207"><span class="linenos">3207</span></a><span class="k">class</span> <span class="nc">JSONBExtractScalar</span><span class="p">(</span><span class="n">JSONExtract</span><span class="p">):</span> +</span><span id="L-3208"><a href="#L-3208"><span class="linenos">3208</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSONB_EXTRACT_SCALAR"</span><span class="p">]</span> +</span><span id="L-3209"><a href="#L-3209"><span class="linenos">3209</span></a> +</span><span id="L-3210"><a href="#L-3210"><span class="linenos">3210</span></a> +</span><span id="L-3211"><a href="#L-3211"><span class="linenos">3211</span></a><span class="k">class</span> <span class="nc">Least</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3212"><a href="#L-3212"><span class="linenos">3212</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3213"><a href="#L-3213"><span class="linenos">3213</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3214"><a href="#L-3214"><span class="linenos">3214</span></a> +</span><span id="L-3215"><a href="#L-3215"><span class="linenos">3215</span></a> +</span><span id="L-3216"><a href="#L-3216"><span class="linenos">3216</span></a><span class="k">class</span> <span class="nc">Length</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3217"><a href="#L-3217"><span class="linenos">3217</span></a> <span class="k">pass</span> +</span><span id="L-3218"><a href="#L-3218"><span class="linenos">3218</span></a> +</span><span id="L-3219"><a href="#L-3219"><span class="linenos">3219</span></a> +</span><span id="L-3220"><a href="#L-3220"><span class="linenos">3220</span></a><span class="k">class</span> <span class="nc">Levenshtein</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3221"><a href="#L-3221"><span class="linenos">3221</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-3222"><a href="#L-3222"><span class="linenos">3222</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-3223"><a href="#L-3223"><span class="linenos">3223</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3224"><a href="#L-3224"><span class="linenos">3224</span></a> <span class="s2">"ins_cost"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3225"><a href="#L-3225"><span class="linenos">3225</span></a> <span class="s2">"del_cost"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3226"><a href="#L-3226"><span class="linenos">3226</span></a> <span class="s2">"sub_cost"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3227"><a href="#L-3227"><span class="linenos">3227</span></a> <span class="p">}</span> +</span><span id="L-3228"><a href="#L-3228"><span class="linenos">3228</span></a> +</span><span id="L-3229"><a href="#L-3229"><span class="linenos">3229</span></a> +</span><span id="L-3230"><a href="#L-3230"><span class="linenos">3230</span></a><span class="k">class</span> <span class="nc">Ln</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3231"><a href="#L-3231"><span class="linenos">3231</span></a> <span class="k">pass</span> +</span><span id="L-3232"><a href="#L-3232"><span class="linenos">3232</span></a> +</span><span id="L-3233"><a href="#L-3233"><span class="linenos">3233</span></a> +</span><span id="L-3234"><a href="#L-3234"><span class="linenos">3234</span></a><span class="k">class</span> <span class="nc">Log</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3235"><a href="#L-3235"><span class="linenos">3235</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3236"><a href="#L-3236"><span class="linenos">3236</span></a> +</span><span id="L-3237"><a href="#L-3237"><span class="linenos">3237</span></a> +</span><span id="L-3238"><a href="#L-3238"><span class="linenos">3238</span></a><span class="k">class</span> <span class="nc">Log2</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3239"><a href="#L-3239"><span class="linenos">3239</span></a> <span class="k">pass</span> +</span><span id="L-3240"><a href="#L-3240"><span class="linenos">3240</span></a> +</span><span id="L-3241"><a href="#L-3241"><span class="linenos">3241</span></a> +</span><span id="L-3242"><a href="#L-3242"><span class="linenos">3242</span></a><span class="k">class</span> <span class="nc">Log10</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3243"><a href="#L-3243"><span class="linenos">3243</span></a> <span class="k">pass</span> +</span><span id="L-3244"><a href="#L-3244"><span class="linenos">3244</span></a> +</span><span id="L-3245"><a href="#L-3245"><span class="linenos">3245</span></a> +</span><span id="L-3246"><a href="#L-3246"><span class="linenos">3246</span></a><span class="k">class</span> <span class="nc">LogicalOr</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3247"><a href="#L-3247"><span class="linenos">3247</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"LOGICAL_OR"</span><span class="p">,</span> <span class="s2">"BOOL_OR"</span><span class="p">]</span> +</span><span id="L-3248"><a href="#L-3248"><span class="linenos">3248</span></a> +</span><span id="L-3249"><a href="#L-3249"><span class="linenos">3249</span></a> +</span><span id="L-3250"><a href="#L-3250"><span class="linenos">3250</span></a><span class="k">class</span> <span class="nc">Lower</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3251"><a href="#L-3251"><span class="linenos">3251</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"LOWER"</span><span class="p">,</span> <span class="s2">"LCASE"</span><span class="p">]</span> +</span><span id="L-3252"><a href="#L-3252"><span class="linenos">3252</span></a> +</span><span id="L-3253"><a href="#L-3253"><span class="linenos">3253</span></a> +</span><span id="L-3254"><a href="#L-3254"><span class="linenos">3254</span></a><span class="k">class</span> <span class="nc">Map</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3255"><a href="#L-3255"><span class="linenos">3255</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"keys"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"values"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3256"><a href="#L-3256"><span class="linenos">3256</span></a> +</span><span id="L-3257"><a href="#L-3257"><span class="linenos">3257</span></a> +</span><span id="L-3258"><a href="#L-3258"><span class="linenos">3258</span></a><span class="k">class</span> <span class="nc">VarMap</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3259"><a href="#L-3259"><span class="linenos">3259</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"keys"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"values"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3260"><a href="#L-3260"><span class="linenos">3260</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3261"><a href="#L-3261"><span class="linenos">3261</span></a> +</span><span id="L-3262"><a href="#L-3262"><span class="linenos">3262</span></a> +</span><span id="L-3263"><a href="#L-3263"><span class="linenos">3263</span></a><span class="k">class</span> <span class="nc">Matches</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3264"><a href="#L-3264"><span class="linenos">3264</span></a><span class="w"> </span><span class="sd">"""Oracle/Snowflake decode.</span> +</span><span id="L-3265"><a href="#L-3265"><span class="linenos">3265</span></a><span class="sd"> https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm</span> +</span><span id="L-3266"><a href="#L-3266"><span class="linenos">3266</span></a><span class="sd"> Pattern matching MATCHES(value, search1, result1, ...searchN, resultN, else)</span> +</span><span id="L-3267"><a href="#L-3267"><span class="linenos">3267</span></a><span class="sd"> """</span> +</span><span id="L-3268"><a href="#L-3268"><span class="linenos">3268</span></a> +</span><span id="L-3269"><a href="#L-3269"><span class="linenos">3269</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3270"><a href="#L-3270"><span class="linenos">3270</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3271"><a href="#L-3271"><span class="linenos">3271</span></a> +</span><span id="L-3272"><a href="#L-3272"><span class="linenos">3272</span></a> +</span><span id="L-3273"><a href="#L-3273"><span class="linenos">3273</span></a><span class="k">class</span> <span class="nc">Max</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3274"><a href="#L-3274"><span class="linenos">3274</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3275"><a href="#L-3275"><span class="linenos">3275</span></a> +</span><span id="L-3276"><a href="#L-3276"><span class="linenos">3276</span></a> +</span><span id="L-3277"><a href="#L-3277"><span class="linenos">3277</span></a><span class="k">class</span> <span class="nc">Min</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3278"><a href="#L-3278"><span class="linenos">3278</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3279"><a href="#L-3279"><span class="linenos">3279</span></a> +</span><span id="L-3280"><a href="#L-3280"><span class="linenos">3280</span></a> +</span><span id="L-3281"><a href="#L-3281"><span class="linenos">3281</span></a><span class="k">class</span> <span class="nc">Month</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3282"><a href="#L-3282"><span class="linenos">3282</span></a> <span class="k">pass</span> +</span><span id="L-3283"><a href="#L-3283"><span class="linenos">3283</span></a> +</span><span id="L-3284"><a href="#L-3284"><span class="linenos">3284</span></a> +</span><span id="L-3285"><a href="#L-3285"><span class="linenos">3285</span></a><span class="k">class</span> <span class="nc">Nvl2</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3286"><a href="#L-3286"><span class="linenos">3286</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3287"><a href="#L-3287"><span class="linenos">3287</span></a> +</span><span id="L-3288"><a href="#L-3288"><span class="linenos">3288</span></a> +</span><span id="L-3289"><a href="#L-3289"><span class="linenos">3289</span></a><span class="k">class</span> <span class="nc">Posexplode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3290"><a href="#L-3290"><span class="linenos">3290</span></a> <span class="k">pass</span> +</span><span id="L-3291"><a href="#L-3291"><span class="linenos">3291</span></a> +</span><span id="L-3292"><a href="#L-3292"><span class="linenos">3292</span></a> +</span><span id="L-3293"><a href="#L-3293"><span class="linenos">3293</span></a><span class="k">class</span> <span class="nc">Pow</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Func</span><span class="p">):</span> +</span><span id="L-3294"><a href="#L-3294"><span class="linenos">3294</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"POWER"</span><span class="p">,</span> <span class="s2">"POW"</span><span class="p">]</span> +</span><span id="L-3295"><a href="#L-3295"><span class="linenos">3295</span></a> +</span><span id="L-3296"><a href="#L-3296"><span class="linenos">3296</span></a> +</span><span id="L-3297"><a href="#L-3297"><span class="linenos">3297</span></a><span class="k">class</span> <span class="nc">PercentileCont</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3298"><a href="#L-3298"><span class="linenos">3298</span></a> <span class="k">pass</span> +</span><span id="L-3299"><a href="#L-3299"><span class="linenos">3299</span></a> +</span><span id="L-3300"><a href="#L-3300"><span class="linenos">3300</span></a> +</span><span id="L-3301"><a href="#L-3301"><span class="linenos">3301</span></a><span class="k">class</span> <span class="nc">PercentileDisc</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3302"><a href="#L-3302"><span class="linenos">3302</span></a> <span class="k">pass</span> +</span><span id="L-3303"><a href="#L-3303"><span class="linenos">3303</span></a> +</span><span id="L-3304"><a href="#L-3304"><span class="linenos">3304</span></a> +</span><span id="L-3305"><a href="#L-3305"><span class="linenos">3305</span></a><span class="k">class</span> <span class="nc">Quantile</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3306"><a href="#L-3306"><span class="linenos">3306</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"quantile"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3307"><a href="#L-3307"><span class="linenos">3307</span></a> +</span><span id="L-3308"><a href="#L-3308"><span class="linenos">3308</span></a> +</span><span id="L-3309"><a href="#L-3309"><span class="linenos">3309</span></a><span class="c1"># Clickhouse-specific:</span> +</span><span id="L-3310"><a href="#L-3310"><span class="linenos">3310</span></a><span class="c1"># https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/quantiles/#quantiles</span> +</span><span id="L-3311"><a href="#L-3311"><span class="linenos">3311</span></a><span class="k">class</span> <span class="nc">Quantiles</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3312"><a href="#L-3312"><span class="linenos">3312</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"parameters"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3313"><a href="#L-3313"><span class="linenos">3313</span></a> +</span><span id="L-3314"><a href="#L-3314"><span class="linenos">3314</span></a> +</span><span id="L-3315"><a href="#L-3315"><span class="linenos">3315</span></a><span class="k">class</span> <span class="nc">QuantileIf</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3316"><a href="#L-3316"><span class="linenos">3316</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"parameters"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3317"><a href="#L-3317"><span class="linenos">3317</span></a> +</span><span id="L-3318"><a href="#L-3318"><span class="linenos">3318</span></a> +</span><span id="L-3319"><a href="#L-3319"><span class="linenos">3319</span></a><span class="k">class</span> <span class="nc">ApproxQuantile</span><span class="p">(</span><span class="n">Quantile</span><span class="p">):</span> +</span><span id="L-3320"><a href="#L-3320"><span class="linenos">3320</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"quantile"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"accuracy"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"weight"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3321"><a href="#L-3321"><span class="linenos">3321</span></a> +</span><span id="L-3322"><a href="#L-3322"><span class="linenos">3322</span></a> +</span><span id="L-3323"><a href="#L-3323"><span class="linenos">3323</span></a><span class="k">class</span> <span class="nc">ReadCSV</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3324"><a href="#L-3324"><span class="linenos">3324</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"READ_CSV"</span><span class="p">]</span> +</span><span id="L-3325"><a href="#L-3325"><span class="linenos">3325</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3326"><a href="#L-3326"><span class="linenos">3326</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3327"><a href="#L-3327"><span class="linenos">3327</span></a> +</span><span id="L-3328"><a href="#L-3328"><span class="linenos">3328</span></a> +</span><span id="L-3329"><a href="#L-3329"><span class="linenos">3329</span></a><span class="k">class</span> <span class="nc">Reduce</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3330"><a href="#L-3330"><span class="linenos">3330</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"initial"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"merge"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"finish"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3331"><a href="#L-3331"><span class="linenos">3331</span></a> +</span><span id="L-3332"><a href="#L-3332"><span class="linenos">3332</span></a> +</span><span id="L-3333"><a href="#L-3333"><span class="linenos">3333</span></a><span class="k">class</span> <span class="nc">RegexpLike</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3334"><a href="#L-3334"><span class="linenos">3334</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"flag"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3335"><a href="#L-3335"><span class="linenos">3335</span></a> +</span><span id="L-3336"><a href="#L-3336"><span class="linenos">3336</span></a> +</span><span id="L-3337"><a href="#L-3337"><span class="linenos">3337</span></a><span class="k">class</span> <span class="nc">RegexpILike</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3338"><a href="#L-3338"><span class="linenos">3338</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"flag"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3339"><a href="#L-3339"><span class="linenos">3339</span></a> +</span><span id="L-3340"><a href="#L-3340"><span class="linenos">3340</span></a> +</span><span id="L-3341"><a href="#L-3341"><span class="linenos">3341</span></a><span class="k">class</span> <span class="nc">RegexpSplit</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3342"><a href="#L-3342"><span class="linenos">3342</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3343"><a href="#L-3343"><span class="linenos">3343</span></a> +</span><span id="L-3344"><a href="#L-3344"><span class="linenos">3344</span></a> +</span><span id="L-3345"><a href="#L-3345"><span class="linenos">3345</span></a><span class="k">class</span> <span class="nc">Repeat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3346"><a href="#L-3346"><span class="linenos">3346</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"times"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3347"><a href="#L-3347"><span class="linenos">3347</span></a> +</span><span id="L-3348"><a href="#L-3348"><span class="linenos">3348</span></a> +</span><span id="L-3349"><a href="#L-3349"><span class="linenos">3349</span></a><span class="k">class</span> <span class="nc">Round</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3350"><a href="#L-3350"><span class="linenos">3350</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"decimals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3351"><a href="#L-3351"><span class="linenos">3351</span></a> +</span><span id="L-3352"><a href="#L-3352"><span class="linenos">3352</span></a> +</span><span id="L-3353"><a href="#L-3353"><span class="linenos">3353</span></a><span class="k">class</span> <span class="nc">RowNumber</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3354"><a href="#L-3354"><span class="linenos">3354</span></a> <span class="n">arg_types</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-3355"><a href="#L-3355"><span class="linenos">3355</span></a> +</span><span id="L-3356"><a href="#L-3356"><span class="linenos">3356</span></a> +</span><span id="L-3357"><a href="#L-3357"><span class="linenos">3357</span></a><span class="k">class</span> <span class="nc">SafeDivide</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3358"><a href="#L-3358"><span class="linenos">3358</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3359"><a href="#L-3359"><span class="linenos">3359</span></a> +</span><span id="L-3360"><a href="#L-3360"><span class="linenos">3360</span></a> +</span><span id="L-3361"><a href="#L-3361"><span class="linenos">3361</span></a><span class="k">class</span> <span class="nc">SetAgg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3362"><a href="#L-3362"><span class="linenos">3362</span></a> <span class="k">pass</span> +</span><span id="L-3363"><a href="#L-3363"><span class="linenos">3363</span></a> +</span><span id="L-3364"><a href="#L-3364"><span class="linenos">3364</span></a> +</span><span id="L-3365"><a href="#L-3365"><span class="linenos">3365</span></a><span class="k">class</span> <span class="nc">SortArray</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3366"><a href="#L-3366"><span class="linenos">3366</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"asc"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3367"><a href="#L-3367"><span class="linenos">3367</span></a> +</span><span id="L-3368"><a href="#L-3368"><span class="linenos">3368</span></a> +</span><span id="L-3369"><a href="#L-3369"><span class="linenos">3369</span></a><span class="k">class</span> <span class="nc">Split</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3370"><a href="#L-3370"><span class="linenos">3370</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3371"><a href="#L-3371"><span class="linenos">3371</span></a> +</span><span id="L-3372"><a href="#L-3372"><span class="linenos">3372</span></a> +</span><span id="L-3373"><a href="#L-3373"><span class="linenos">3373</span></a><span class="c1"># Start may be omitted in the case of postgres</span> +</span><span id="L-3374"><a href="#L-3374"><span class="linenos">3374</span></a><span class="c1"># https://www.postgresql.org/docs/9.1/functions-string.html @ Table 9-6</span> +</span><span id="L-3375"><a href="#L-3375"><span class="linenos">3375</span></a><span class="k">class</span> <span class="nc">Substring</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3376"><a href="#L-3376"><span class="linenos">3376</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"length"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3377"><a href="#L-3377"><span class="linenos">3377</span></a> +</span><span id="L-3378"><a href="#L-3378"><span class="linenos">3378</span></a> +</span><span id="L-3379"><a href="#L-3379"><span class="linenos">3379</span></a><span class="k">class</span> <span class="nc">StrPosition</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3380"><a href="#L-3380"><span class="linenos">3380</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-3381"><a href="#L-3381"><span class="linenos">3381</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-3382"><a href="#L-3382"><span class="linenos">3382</span></a> <span class="s2">"substr"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-3383"><a href="#L-3383"><span class="linenos">3383</span></a> <span class="s2">"position"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3384"><a href="#L-3384"><span class="linenos">3384</span></a> <span class="s2">"instance"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3385"><a href="#L-3385"><span class="linenos">3385</span></a> <span class="p">}</span> +</span><span id="L-3386"><a href="#L-3386"><span class="linenos">3386</span></a> +</span><span id="L-3387"><a href="#L-3387"><span class="linenos">3387</span></a> +</span><span id="L-3388"><a href="#L-3388"><span class="linenos">3388</span></a><span class="k">class</span> <span class="nc">StrToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3389"><a href="#L-3389"><span class="linenos">3389</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3390"><a href="#L-3390"><span class="linenos">3390</span></a> +</span><span id="L-3391"><a href="#L-3391"><span class="linenos">3391</span></a> +</span><span id="L-3392"><a href="#L-3392"><span class="linenos">3392</span></a><span class="k">class</span> <span class="nc">StrToTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3393"><a href="#L-3393"><span class="linenos">3393</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3394"><a href="#L-3394"><span class="linenos">3394</span></a> +</span><span id="L-3395"><a href="#L-3395"><span class="linenos">3395</span></a> +</span><span id="L-3396"><a href="#L-3396"><span class="linenos">3396</span></a><span class="c1"># Spark allows unix_timestamp()</span> +</span><span id="L-3397"><a href="#L-3397"><span class="linenos">3397</span></a><span class="c1"># https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.sql.functions.unix_timestamp.html</span> +</span><span id="L-3398"><a href="#L-3398"><span class="linenos">3398</span></a><span class="k">class</span> <span class="nc">StrToUnix</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3399"><a href="#L-3399"><span class="linenos">3399</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3400"><a href="#L-3400"><span class="linenos">3400</span></a> +</span><span id="L-3401"><a href="#L-3401"><span class="linenos">3401</span></a> +</span><span id="L-3402"><a href="#L-3402"><span class="linenos">3402</span></a><span class="k">class</span> <span class="nc">NumberToStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3403"><a href="#L-3403"><span class="linenos">3403</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3404"><a href="#L-3404"><span class="linenos">3404</span></a> +</span><span id="L-3405"><a href="#L-3405"><span class="linenos">3405</span></a> +</span><span id="L-3406"><a href="#L-3406"><span class="linenos">3406</span></a><span class="k">class</span> <span class="nc">Struct</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3407"><a href="#L-3407"><span class="linenos">3407</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3408"><a href="#L-3408"><span class="linenos">3408</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-3409"><a href="#L-3409"><span class="linenos">3409</span></a> +</span><span id="L-3410"><a href="#L-3410"><span class="linenos">3410</span></a> +</span><span id="L-3411"><a href="#L-3411"><span class="linenos">3411</span></a><span class="k">class</span> <span class="nc">StructExtract</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3412"><a href="#L-3412"><span class="linenos">3412</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3413"><a href="#L-3413"><span class="linenos">3413</span></a> +</span><span id="L-3414"><a href="#L-3414"><span class="linenos">3414</span></a> +</span><span id="L-3415"><a href="#L-3415"><span class="linenos">3415</span></a><span class="k">class</span> <span class="nc">Sum</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3416"><a href="#L-3416"><span class="linenos">3416</span></a> <span class="k">pass</span> +</span><span id="L-3417"><a href="#L-3417"><span class="linenos">3417</span></a> +</span><span id="L-3418"><a href="#L-3418"><span class="linenos">3418</span></a> +</span><span id="L-3419"><a href="#L-3419"><span class="linenos">3419</span></a><span class="k">class</span> <span class="nc">Sqrt</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3420"><a href="#L-3420"><span class="linenos">3420</span></a> <span class="k">pass</span> +</span><span id="L-3421"><a href="#L-3421"><span class="linenos">3421</span></a> +</span><span id="L-3422"><a href="#L-3422"><span class="linenos">3422</span></a> +</span><span id="L-3423"><a href="#L-3423"><span class="linenos">3423</span></a><span class="k">class</span> <span class="nc">Stddev</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3424"><a href="#L-3424"><span class="linenos">3424</span></a> <span class="k">pass</span> +</span><span id="L-3425"><a href="#L-3425"><span class="linenos">3425</span></a> +</span><span id="L-3426"><a href="#L-3426"><span class="linenos">3426</span></a> +</span><span id="L-3427"><a href="#L-3427"><span class="linenos">3427</span></a><span class="k">class</span> <span class="nc">StddevPop</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3428"><a href="#L-3428"><span class="linenos">3428</span></a> <span class="k">pass</span> +</span><span id="L-3429"><a href="#L-3429"><span class="linenos">3429</span></a> +</span><span id="L-3430"><a href="#L-3430"><span class="linenos">3430</span></a> +</span><span id="L-3431"><a href="#L-3431"><span class="linenos">3431</span></a><span class="k">class</span> <span class="nc">StddevSamp</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3432"><a href="#L-3432"><span class="linenos">3432</span></a> <span class="k">pass</span> +</span><span id="L-3433"><a href="#L-3433"><span class="linenos">3433</span></a> +</span><span id="L-3434"><a href="#L-3434"><span class="linenos">3434</span></a> +</span><span id="L-3435"><a href="#L-3435"><span class="linenos">3435</span></a><span class="k">class</span> <span class="nc">TimeToStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3436"><a href="#L-3436"><span class="linenos">3436</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3437"><a href="#L-3437"><span class="linenos">3437</span></a> +</span><span id="L-3438"><a href="#L-3438"><span class="linenos">3438</span></a> +</span><span id="L-3439"><a href="#L-3439"><span class="linenos">3439</span></a><span class="k">class</span> <span class="nc">TimeToTimeStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3440"><a href="#L-3440"><span class="linenos">3440</span></a> <span class="k">pass</span> +</span><span id="L-3441"><a href="#L-3441"><span class="linenos">3441</span></a> +</span><span id="L-3442"><a href="#L-3442"><span class="linenos">3442</span></a> +</span><span id="L-3443"><a href="#L-3443"><span class="linenos">3443</span></a><span class="k">class</span> <span class="nc">TimeToUnix</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3444"><a href="#L-3444"><span class="linenos">3444</span></a> <span class="k">pass</span> +</span><span id="L-3445"><a href="#L-3445"><span class="linenos">3445</span></a> +</span><span id="L-3446"><a href="#L-3446"><span class="linenos">3446</span></a> +</span><span id="L-3447"><a href="#L-3447"><span class="linenos">3447</span></a><span class="k">class</span> <span class="nc">TimeStrToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3448"><a href="#L-3448"><span class="linenos">3448</span></a> <span class="k">pass</span> +</span><span id="L-3449"><a href="#L-3449"><span class="linenos">3449</span></a> +</span><span id="L-3450"><a href="#L-3450"><span class="linenos">3450</span></a> +</span><span id="L-3451"><a href="#L-3451"><span class="linenos">3451</span></a><span class="k">class</span> <span class="nc">TimeStrToTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3452"><a href="#L-3452"><span class="linenos">3452</span></a> <span class="k">pass</span> +</span><span id="L-3453"><a href="#L-3453"><span class="linenos">3453</span></a> +</span><span id="L-3454"><a href="#L-3454"><span class="linenos">3454</span></a> +</span><span id="L-3455"><a href="#L-3455"><span class="linenos">3455</span></a><span class="k">class</span> <span class="nc">TimeStrToUnix</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3456"><a href="#L-3456"><span class="linenos">3456</span></a> <span class="k">pass</span> +</span><span id="L-3457"><a href="#L-3457"><span class="linenos">3457</span></a> +</span><span id="L-3458"><a href="#L-3458"><span class="linenos">3458</span></a> +</span><span id="L-3459"><a href="#L-3459"><span class="linenos">3459</span></a><span class="k">class</span> <span class="nc">Trim</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3460"><a href="#L-3460"><span class="linenos">3460</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-3461"><a href="#L-3461"><span class="linenos">3461</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-3462"><a href="#L-3462"><span class="linenos">3462</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3463"><a href="#L-3463"><span class="linenos">3463</span></a> <span class="s2">"position"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3464"><a href="#L-3464"><span class="linenos">3464</span></a> <span class="s2">"collation"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-3465"><a href="#L-3465"><span class="linenos">3465</span></a> <span class="p">}</span> +</span><span id="L-3466"><a href="#L-3466"><span class="linenos">3466</span></a> +</span><span id="L-3467"><a href="#L-3467"><span class="linenos">3467</span></a> +</span><span id="L-3468"><a href="#L-3468"><span class="linenos">3468</span></a><span class="k">class</span> <span class="nc">TsOrDsAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="L-3469"><a href="#L-3469"><span class="linenos">3469</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3470"><a href="#L-3470"><span class="linenos">3470</span></a> +</span><span id="L-3471"><a href="#L-3471"><span class="linenos">3471</span></a> +</span><span id="L-3472"><a href="#L-3472"><span class="linenos">3472</span></a><span class="k">class</span> <span class="nc">TsOrDsToDateStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3473"><a href="#L-3473"><span class="linenos">3473</span></a> <span class="k">pass</span> +</span><span id="L-3474"><a href="#L-3474"><span class="linenos">3474</span></a> +</span><span id="L-3475"><a href="#L-3475"><span class="linenos">3475</span></a> +</span><span id="L-3476"><a href="#L-3476"><span class="linenos">3476</span></a><span class="k">class</span> <span class="nc">TsOrDsToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3477"><a href="#L-3477"><span class="linenos">3477</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3478"><a href="#L-3478"><span class="linenos">3478</span></a> +</span><span id="L-3479"><a href="#L-3479"><span class="linenos">3479</span></a> +</span><span id="L-3480"><a href="#L-3480"><span class="linenos">3480</span></a><span class="k">class</span> <span class="nc">TsOrDiToDi</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3481"><a href="#L-3481"><span class="linenos">3481</span></a> <span class="k">pass</span> +</span><span id="L-3482"><a href="#L-3482"><span class="linenos">3482</span></a> +</span><span id="L-3483"><a href="#L-3483"><span class="linenos">3483</span></a> +</span><span id="L-3484"><a href="#L-3484"><span class="linenos">3484</span></a><span class="k">class</span> <span class="nc">Unhex</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3485"><a href="#L-3485"><span class="linenos">3485</span></a> <span class="k">pass</span> +</span><span id="L-3486"><a href="#L-3486"><span class="linenos">3486</span></a> +</span><span id="L-3487"><a href="#L-3487"><span class="linenos">3487</span></a> +</span><span id="L-3488"><a href="#L-3488"><span class="linenos">3488</span></a><span class="k">class</span> <span class="nc">UnixToStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3489"><a href="#L-3489"><span class="linenos">3489</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3490"><a href="#L-3490"><span class="linenos">3490</span></a> +</span><span id="L-3491"><a href="#L-3491"><span class="linenos">3491</span></a> +</span><span id="L-3492"><a href="#L-3492"><span class="linenos">3492</span></a><span class="c1"># https://prestodb.io/docs/current/functions/datetime.html</span> +</span><span id="L-3493"><a href="#L-3493"><span class="linenos">3493</span></a><span class="c1"># presto has weird zone/hours/minutes</span> +</span><span id="L-3494"><a href="#L-3494"><span class="linenos">3494</span></a><span class="k">class</span> <span class="nc">UnixToTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3495"><a href="#L-3495"><span class="linenos">3495</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"scale"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"hours"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"minutes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3496"><a href="#L-3496"><span class="linenos">3496</span></a> +</span><span id="L-3497"><a href="#L-3497"><span class="linenos">3497</span></a> <span class="n">SECONDS</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"seconds"</span><span class="p">)</span> +</span><span id="L-3498"><a href="#L-3498"><span class="linenos">3498</span></a> <span class="n">MILLIS</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"millis"</span><span class="p">)</span> +</span><span id="L-3499"><a href="#L-3499"><span class="linenos">3499</span></a> <span class="n">MICROS</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"micros"</span><span class="p">)</span> +</span><span id="L-3500"><a href="#L-3500"><span class="linenos">3500</span></a> +</span><span id="L-3501"><a href="#L-3501"><span class="linenos">3501</span></a> +</span><span id="L-3502"><a href="#L-3502"><span class="linenos">3502</span></a><span class="k">class</span> <span class="nc">UnixToTimeStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3503"><a href="#L-3503"><span class="linenos">3503</span></a> <span class="k">pass</span> +</span><span id="L-3504"><a href="#L-3504"><span class="linenos">3504</span></a> +</span><span id="L-3505"><a href="#L-3505"><span class="linenos">3505</span></a> +</span><span id="L-3506"><a href="#L-3506"><span class="linenos">3506</span></a><span class="k">class</span> <span class="nc">Upper</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3507"><a href="#L-3507"><span class="linenos">3507</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"UPPER"</span><span class="p">,</span> <span class="s2">"UCASE"</span><span class="p">]</span> +</span><span id="L-3508"><a href="#L-3508"><span class="linenos">3508</span></a> +</span><span id="L-3509"><a href="#L-3509"><span class="linenos">3509</span></a> +</span><span id="L-3510"><a href="#L-3510"><span class="linenos">3510</span></a><span class="k">class</span> <span class="nc">Variance</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3511"><a href="#L-3511"><span class="linenos">3511</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"VARIANCE"</span><span class="p">,</span> <span class="s2">"VARIANCE_SAMP"</span><span class="p">,</span> <span class="s2">"VAR_SAMP"</span><span class="p">]</span> +</span><span id="L-3512"><a href="#L-3512"><span class="linenos">3512</span></a> +</span><span id="L-3513"><a href="#L-3513"><span class="linenos">3513</span></a> +</span><span id="L-3514"><a href="#L-3514"><span class="linenos">3514</span></a><span class="k">class</span> <span class="nc">VariancePop</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-3515"><a href="#L-3515"><span class="linenos">3515</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"VARIANCE_POP"</span><span class="p">,</span> <span class="s2">"VAR_POP"</span><span class="p">]</span> +</span><span id="L-3516"><a href="#L-3516"><span class="linenos">3516</span></a> +</span><span id="L-3517"><a href="#L-3517"><span class="linenos">3517</span></a> +</span><span id="L-3518"><a href="#L-3518"><span class="linenos">3518</span></a><span class="k">class</span> <span class="nc">Week</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3519"><a href="#L-3519"><span class="linenos">3519</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"mode"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3520"><a href="#L-3520"><span class="linenos">3520</span></a> +</span><span id="L-3521"><a href="#L-3521"><span class="linenos">3521</span></a> +</span><span id="L-3522"><a href="#L-3522"><span class="linenos">3522</span></a><span class="k">class</span> <span class="nc">Year</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3523"><a href="#L-3523"><span class="linenos">3523</span></a> <span class="k">pass</span> +</span><span id="L-3524"><a href="#L-3524"><span class="linenos">3524</span></a> +</span><span id="L-3525"><a href="#L-3525"><span class="linenos">3525</span></a> +</span><span id="L-3526"><a href="#L-3526"><span class="linenos">3526</span></a><span class="k">class</span> <span class="nc">Use</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-3527"><a href="#L-3527"><span class="linenos">3527</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="L-3528"><a href="#L-3528"><span class="linenos">3528</span></a> +</span><span id="L-3529"><a href="#L-3529"><span class="linenos">3529</span></a> +</span><span id="L-3530"><a href="#L-3530"><span class="linenos">3530</span></a><span class="k">class</span> <span class="nc">Merge</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-3531"><a href="#L-3531"><span class="linenos">3531</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3532"><a href="#L-3532"><span class="linenos">3532</span></a> +</span><span id="L-3533"><a href="#L-3533"><span class="linenos">3533</span></a> +</span><span id="L-3534"><a href="#L-3534"><span class="linenos">3534</span></a><span class="k">class</span> <span class="nc">When</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-3535"><a href="#L-3535"><span class="linenos">3535</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"then"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="L-3536"><a href="#L-3536"><span class="linenos">3536</span></a> +</span><span id="L-3537"><a href="#L-3537"><span class="linenos">3537</span></a> +</span><span id="L-3538"><a href="#L-3538"><span class="linenos">3538</span></a><span class="k">def</span> <span class="nf">_norm_args</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-3539"><a href="#L-3539"><span class="linenos">3539</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-3540"><a href="#L-3540"><span class="linenos">3540</span></a> +</span><span id="L-3541"><a href="#L-3541"><span class="linenos">3541</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-3542"><a href="#L-3542"><span class="linenos">3542</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-3543"><a href="#L-3543"><span class="linenos">3543</span></a> <span class="n">arg</span> <span class="o">=</span> <span class="p">[</span><span class="n">_norm_arg</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">arg</span><span class="p">]</span> +</span><span id="L-3544"><a href="#L-3544"><span class="linenos">3544</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">arg</span><span class="p">:</span> +</span><span id="L-3545"><a href="#L-3545"><span class="linenos">3545</span></a> <span class="n">arg</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3546"><a href="#L-3546"><span class="linenos">3546</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3547"><a href="#L-3547"><span class="linenos">3547</span></a> <span class="n">arg</span> <span class="o">=</span> <span class="n">_norm_arg</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> +</span><span id="L-3548"><a href="#L-3548"><span class="linenos">3548</span></a> +</span><span id="L-3549"><a href="#L-3549"><span class="linenos">3549</span></a> <span class="k">if</span> <span class="n">arg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">arg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">False</span><span class="p">:</span> +</span><span id="L-3550"><a href="#L-3550"><span class="linenos">3550</span></a> <span class="n">args</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">arg</span> +</span><span id="L-3551"><a href="#L-3551"><span class="linenos">3551</span></a> +</span><span id="L-3552"><a href="#L-3552"><span class="linenos">3552</span></a> <span class="k">return</span> <span class="n">args</span> +</span><span id="L-3553"><a href="#L-3553"><span class="linenos">3553</span></a> +</span><span id="L-3554"><a href="#L-3554"><span class="linenos">3554</span></a> +</span><span id="L-3555"><a href="#L-3555"><span class="linenos">3555</span></a><span class="k">def</span> <span class="nf">_norm_arg</span><span class="p">(</span><span class="n">arg</span><span class="p">):</span> +</span><span id="L-3556"><a href="#L-3556"><span class="linenos">3556</span></a> <span class="k">return</span> <span class="n">arg</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="n">arg</span> +</span><span id="L-3557"><a href="#L-3557"><span class="linenos">3557</span></a> +</span><span id="L-3558"><a href="#L-3558"><span class="linenos">3558</span></a> +</span><span id="L-3559"><a href="#L-3559"><span class="linenos">3559</span></a><span class="n">ALL_FUNCTIONS</span> <span class="o">=</span> <span class="n">subclasses</span><span class="p">(</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">Func</span><span class="p">,</span> <span class="p">(</span><span class="n">AggFunc</span><span class="p">,</span> <span class="n">Anonymous</span><span class="p">,</span> <span class="n">Func</span><span class="p">))</span> +</span><span id="L-3560"><a href="#L-3560"><span class="linenos">3560</span></a> +</span><span id="L-3561"><a href="#L-3561"><span class="linenos">3561</span></a> +</span><span id="L-3562"><a href="#L-3562"><span class="linenos">3562</span></a><span class="c1"># Helpers</span> +</span><span id="L-3563"><a href="#L-3563"><span class="linenos">3563</span></a><span class="k">def</span> <span class="nf">maybe_parse</span><span class="p">(</span> +</span><span id="L-3564"><a href="#L-3564"><span class="linenos">3564</span></a> <span class="n">sql_or_expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> +</span><span id="L-3565"><a href="#L-3565"><span class="linenos">3565</span></a> <span class="o">*</span><span class="p">,</span> +</span><span id="L-3566"><a href="#L-3566"><span class="linenos">3566</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">IntoType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-3567"><a href="#L-3567"><span class="linenos">3567</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-3568"><a href="#L-3568"><span class="linenos">3568</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-3569"><a href="#L-3569"><span class="linenos">3569</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3570"><a href="#L-3570"><span class="linenos">3570</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3571"><a href="#L-3571"><span class="linenos">3571</span></a><span class="w"> </span><span class="sd">"""Gracefully handle a possible string or expression.</span> +</span><span id="L-3572"><a href="#L-3572"><span class="linenos">3572</span></a> +</span><span id="L-3573"><a href="#L-3573"><span class="linenos">3573</span></a><span class="sd"> Example:</span> +</span><span id="L-3574"><a href="#L-3574"><span class="linenos">3574</span></a><span class="sd"> >>> maybe_parse("1")</span> +</span><span id="L-3575"><a href="#L-3575"><span class="linenos">3575</span></a><span class="sd"> (LITERAL this: 1, is_string: False)</span> +</span><span id="L-3576"><a href="#L-3576"><span class="linenos">3576</span></a><span class="sd"> >>> maybe_parse(to_identifier("x"))</span> +</span><span id="L-3577"><a href="#L-3577"><span class="linenos">3577</span></a><span class="sd"> (IDENTIFIER this: x, quoted: False)</span> +</span><span id="L-3578"><a href="#L-3578"><span class="linenos">3578</span></a> +</span><span id="L-3579"><a href="#L-3579"><span class="linenos">3579</span></a><span class="sd"> Args:</span> +</span><span id="L-3580"><a href="#L-3580"><span class="linenos">3580</span></a><span class="sd"> sql_or_expression: the SQL code string or an expression</span> +</span><span id="L-3581"><a href="#L-3581"><span class="linenos">3581</span></a><span class="sd"> into: the SQLGlot Expression to parse into</span> +</span><span id="L-3582"><a href="#L-3582"><span class="linenos">3582</span></a><span class="sd"> dialect: the dialect used to parse the input expressions (in the case that an</span> +</span><span id="L-3583"><a href="#L-3583"><span class="linenos">3583</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="L-3584"><a href="#L-3584"><span class="linenos">3584</span></a><span class="sd"> prefix: a string to prefix the sql with before it gets parsed</span> +</span><span id="L-3585"><a href="#L-3585"><span class="linenos">3585</span></a><span class="sd"> (automatically includes a space)</span> +</span><span id="L-3586"><a href="#L-3586"><span class="linenos">3586</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="L-3587"><a href="#L-3587"><span class="linenos">3587</span></a><span class="sd"> that an input expression is a SQL string).</span> +</span><span id="L-3588"><a href="#L-3588"><span class="linenos">3588</span></a> +</span><span id="L-3589"><a href="#L-3589"><span class="linenos">3589</span></a><span class="sd"> Returns:</span> +</span><span id="L-3590"><a href="#L-3590"><span class="linenos">3590</span></a><span class="sd"> Expression: the parsed or given expression.</span> +</span><span id="L-3591"><a href="#L-3591"><span class="linenos">3591</span></a><span class="sd"> """</span> +</span><span id="L-3592"><a href="#L-3592"><span class="linenos">3592</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-3593"><a href="#L-3593"><span class="linenos">3593</span></a> <span class="k">return</span> <span class="n">sql_or_expression</span> +</span><span id="L-3594"><a href="#L-3594"><span class="linenos">3594</span></a> +</span><span id="L-3595"><a href="#L-3595"><span class="linenos">3595</span></a> <span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="L-3596"><a href="#L-3596"><span class="linenos">3596</span></a> +</span><span id="L-3597"><a href="#L-3597"><span class="linenos">3597</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="p">)</span> +</span><span id="L-3598"><a href="#L-3598"><span class="linenos">3598</span></a> <span class="k">if</span> <span class="n">prefix</span><span class="p">:</span> +</span><span id="L-3599"><a href="#L-3599"><span class="linenos">3599</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-3600"><a href="#L-3600"><span class="linenos">3600</span></a> <span class="k">return</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">parse_one</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">into</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3601"><a href="#L-3601"><span class="linenos">3601</span></a> +</span><span id="L-3602"><a href="#L-3602"><span class="linenos">3602</span></a> +</span><span id="L-3603"><a href="#L-3603"><span class="linenos">3603</span></a><span class="k">def</span> <span class="nf">_maybe_copy</span><span class="p">(</span><span class="n">instance</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-3604"><a href="#L-3604"><span class="linenos">3604</span></a> <span class="k">return</span> <span class="n">instance</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="k">if</span> <span class="n">copy</span> <span class="k">else</span> <span class="n">instance</span> +</span><span id="L-3605"><a href="#L-3605"><span class="linenos">3605</span></a> +</span><span id="L-3606"><a href="#L-3606"><span class="linenos">3606</span></a> +</span><span id="L-3607"><a href="#L-3607"><span class="linenos">3607</span></a><span class="k">def</span> <span class="nf">_is_wrong_expression</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="p">):</span> +</span><span id="L-3608"><a href="#L-3608"><span class="linenos">3608</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Expression</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="p">)</span> +</span><span id="L-3609"><a href="#L-3609"><span class="linenos">3609</span></a> +</span><span id="L-3610"><a href="#L-3610"><span class="linenos">3610</span></a> +</span><span id="L-3611"><a href="#L-3611"><span class="linenos">3611</span></a><span class="k">def</span> <span class="nf">_apply_builder</span><span class="p">(</span> +</span><span id="L-3612"><a href="#L-3612"><span class="linenos">3612</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-3613"><a href="#L-3613"><span class="linenos">3613</span></a> <span class="n">instance</span><span class="p">,</span> +</span><span id="L-3614"><a href="#L-3614"><span class="linenos">3614</span></a> <span class="n">arg</span><span class="p">,</span> +</span><span id="L-3615"><a href="#L-3615"><span class="linenos">3615</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3616"><a href="#L-3616"><span class="linenos">3616</span></a> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3617"><a href="#L-3617"><span class="linenos">3617</span></a> <span class="n">into</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3618"><a href="#L-3618"><span class="linenos">3618</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3619"><a href="#L-3619"><span class="linenos">3619</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3620"><a href="#L-3620"><span class="linenos">3620</span></a><span class="p">):</span> +</span><span id="L-3621"><a href="#L-3621"><span class="linenos">3621</span></a> <span class="k">if</span> <span class="n">_is_wrong_expression</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="p">):</span> +</span><span id="L-3622"><a href="#L-3622"><span class="linenos">3622</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">into</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-3623"><a href="#L-3623"><span class="linenos">3623</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="n">instance</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-3624"><a href="#L-3624"><span class="linenos">3624</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="L-3625"><a href="#L-3625"><span class="linenos">3625</span></a> <span class="n">sql_or_expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-3626"><a href="#L-3626"><span class="linenos">3626</span></a> <span class="n">prefix</span><span class="o">=</span><span class="n">prefix</span><span class="p">,</span> +</span><span id="L-3627"><a href="#L-3627"><span class="linenos">3627</span></a> <span class="n">into</span><span class="o">=</span><span class="n">into</span><span class="p">,</span> +</span><span id="L-3628"><a href="#L-3628"><span class="linenos">3628</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-3629"><a href="#L-3629"><span class="linenos">3629</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3630"><a href="#L-3630"><span class="linenos">3630</span></a> <span class="p">)</span> +</span><span id="L-3631"><a href="#L-3631"><span class="linenos">3631</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-3632"><a href="#L-3632"><span class="linenos">3632</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="L-3633"><a href="#L-3633"><span class="linenos">3633</span></a> +</span><span id="L-3634"><a href="#L-3634"><span class="linenos">3634</span></a> +</span><span id="L-3635"><a href="#L-3635"><span class="linenos">3635</span></a><span class="k">def</span> <span class="nf">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="L-3636"><a href="#L-3636"><span class="linenos">3636</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-3637"><a href="#L-3637"><span class="linenos">3637</span></a> <span class="n">instance</span><span class="p">,</span> +</span><span id="L-3638"><a href="#L-3638"><span class="linenos">3638</span></a> <span class="n">arg</span><span class="p">,</span> +</span><span id="L-3639"><a href="#L-3639"><span class="linenos">3639</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3640"><a href="#L-3640"><span class="linenos">3640</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3641"><a href="#L-3641"><span class="linenos">3641</span></a> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3642"><a href="#L-3642"><span class="linenos">3642</span></a> <span class="n">into</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3643"><a href="#L-3643"><span class="linenos">3643</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3644"><a href="#L-3644"><span class="linenos">3644</span></a> <span class="n">properties</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3645"><a href="#L-3645"><span class="linenos">3645</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3646"><a href="#L-3646"><span class="linenos">3646</span></a><span class="p">):</span> +</span><span id="L-3647"><a href="#L-3647"><span class="linenos">3647</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="n">instance</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-3648"><a href="#L-3648"><span class="linenos">3648</span></a> <span class="n">parsed</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-3649"><a href="#L-3649"><span class="linenos">3649</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-3650"><a href="#L-3650"><span class="linenos">3650</span></a> <span class="k">if</span> <span class="n">_is_wrong_expression</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="p">):</span> +</span><span id="L-3651"><a href="#L-3651"><span class="linenos">3651</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">into</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="p">])</span> +</span><span id="L-3652"><a href="#L-3652"><span class="linenos">3652</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="L-3653"><a href="#L-3653"><span class="linenos">3653</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-3654"><a href="#L-3654"><span class="linenos">3654</span></a> <span class="n">into</span><span class="o">=</span><span class="n">into</span><span class="p">,</span> +</span><span id="L-3655"><a href="#L-3655"><span class="linenos">3655</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-3656"><a href="#L-3656"><span class="linenos">3656</span></a> <span class="n">prefix</span><span class="o">=</span><span class="n">prefix</span><span class="p">,</span> +</span><span id="L-3657"><a href="#L-3657"><span class="linenos">3657</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3658"><a href="#L-3658"><span class="linenos">3658</span></a> <span class="p">)</span> +</span><span id="L-3659"><a href="#L-3659"><span class="linenos">3659</span></a> <span class="n">parsed</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-3660"><a href="#L-3660"><span class="linenos">3660</span></a> +</span><span id="L-3661"><a href="#L-3661"><span class="linenos">3661</span></a> <span class="n">existing</span> <span class="o">=</span> <span class="n">instance</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> +</span><span id="L-3662"><a href="#L-3662"><span class="linenos">3662</span></a> <span class="k">if</span> <span class="n">append</span> <span class="ow">and</span> <span class="n">existing</span><span class="p">:</span> +</span><span id="L-3663"><a href="#L-3663"><span class="linenos">3663</span></a> <span class="n">parsed</span> <span class="o">=</span> <span class="n">existing</span><span class="o">.</span><span class="n">expressions</span> <span class="o">+</span> <span class="n">parsed</span> +</span><span id="L-3664"><a href="#L-3664"><span class="linenos">3664</span></a> +</span><span id="L-3665"><a href="#L-3665"><span class="linenos">3665</span></a> <span class="n">child</span> <span class="o">=</span> <span class="n">into</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">parsed</span><span class="p">)</span> +</span><span id="L-3666"><a href="#L-3666"><span class="linenos">3666</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="p">(</span><span class="n">properties</span> <span class="ow">or</span> <span class="p">{})</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-3667"><a href="#L-3667"><span class="linenos">3667</span></a> <span class="n">child</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> +</span><span id="L-3668"><a href="#L-3668"><span class="linenos">3668</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="n">child</span><span class="p">)</span> +</span><span id="L-3669"><a href="#L-3669"><span class="linenos">3669</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="L-3670"><a href="#L-3670"><span class="linenos">3670</span></a> +</span><span id="L-3671"><a href="#L-3671"><span class="linenos">3671</span></a> +</span><span id="L-3672"><a href="#L-3672"><span class="linenos">3672</span></a><span class="k">def</span> <span class="nf">_apply_list_builder</span><span class="p">(</span> +</span><span id="L-3673"><a href="#L-3673"><span class="linenos">3673</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-3674"><a href="#L-3674"><span class="linenos">3674</span></a> <span class="n">instance</span><span class="p">,</span> +</span><span id="L-3675"><a href="#L-3675"><span class="linenos">3675</span></a> <span class="n">arg</span><span class="p">,</span> +</span><span id="L-3676"><a href="#L-3676"><span class="linenos">3676</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3677"><a href="#L-3677"><span class="linenos">3677</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3678"><a href="#L-3678"><span class="linenos">3678</span></a> <span class="n">prefix</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3679"><a href="#L-3679"><span class="linenos">3679</span></a> <span class="n">into</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3680"><a href="#L-3680"><span class="linenos">3680</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3681"><a href="#L-3681"><span class="linenos">3681</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3682"><a href="#L-3682"><span class="linenos">3682</span></a><span class="p">):</span> +</span><span id="L-3683"><a href="#L-3683"><span class="linenos">3683</span></a> <span class="n">inst</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="n">instance</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-3684"><a href="#L-3684"><span class="linenos">3684</span></a> +</span><span id="L-3685"><a href="#L-3685"><span class="linenos">3685</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-3686"><a href="#L-3686"><span class="linenos">3686</span></a> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="L-3687"><a href="#L-3687"><span class="linenos">3687</span></a> <span class="n">sql_or_expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-3688"><a href="#L-3688"><span class="linenos">3688</span></a> <span class="n">into</span><span class="o">=</span><span class="n">into</span><span class="p">,</span> +</span><span id="L-3689"><a href="#L-3689"><span class="linenos">3689</span></a> <span class="n">prefix</span><span class="o">=</span><span class="n">prefix</span><span class="p">,</span> +</span><span id="L-3690"><a href="#L-3690"><span class="linenos">3690</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-3691"><a href="#L-3691"><span class="linenos">3691</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3692"><a href="#L-3692"><span class="linenos">3692</span></a> <span class="p">)</span> +</span><span id="L-3693"><a href="#L-3693"><span class="linenos">3693</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span> +</span><span id="L-3694"><a href="#L-3694"><span class="linenos">3694</span></a> <span class="p">]</span> +</span><span id="L-3695"><a href="#L-3695"><span class="linenos">3695</span></a> +</span><span id="L-3696"><a href="#L-3696"><span class="linenos">3696</span></a> <span class="n">existing_expressions</span> <span class="o">=</span> <span class="n">inst</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> +</span><span id="L-3697"><a href="#L-3697"><span class="linenos">3697</span></a> <span class="k">if</span> <span class="n">append</span> <span class="ow">and</span> <span class="n">existing_expressions</span><span class="p">:</span> +</span><span id="L-3698"><a href="#L-3698"><span class="linenos">3698</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">existing_expressions</span> <span class="o">+</span> <span class="n">expressions</span> +</span><span id="L-3699"><a href="#L-3699"><span class="linenos">3699</span></a> +</span><span id="L-3700"><a href="#L-3700"><span class="linenos">3700</span></a> <span class="n">inst</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="L-3701"><a href="#L-3701"><span class="linenos">3701</span></a> <span class="k">return</span> <span class="n">inst</span> +</span><span id="L-3702"><a href="#L-3702"><span class="linenos">3702</span></a> +</span><span id="L-3703"><a href="#L-3703"><span class="linenos">3703</span></a> +</span><span id="L-3704"><a href="#L-3704"><span class="linenos">3704</span></a><span class="k">def</span> <span class="nf">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="L-3705"><a href="#L-3705"><span class="linenos">3705</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-3706"><a href="#L-3706"><span class="linenos">3706</span></a> <span class="n">instance</span><span class="p">,</span> +</span><span id="L-3707"><a href="#L-3707"><span class="linenos">3707</span></a> <span class="n">arg</span><span class="p">,</span> +</span><span id="L-3708"><a href="#L-3708"><span class="linenos">3708</span></a> <span class="n">into</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3709"><a href="#L-3709"><span class="linenos">3709</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3710"><a href="#L-3710"><span class="linenos">3710</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-3711"><a href="#L-3711"><span class="linenos">3711</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-3712"><a href="#L-3712"><span class="linenos">3712</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3713"><a href="#L-3713"><span class="linenos">3713</span></a><span class="p">):</span> +</span><span id="L-3714"><a href="#L-3714"><span class="linenos">3714</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">exp</span> <span class="k">for</span> <span class="n">exp</span> <span class="ow">in</span> <span class="n">expressions</span> <span class="k">if</span> <span class="n">exp</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">exp</span> <span class="o">!=</span> <span class="s2">""</span><span class="p">]</span> +</span><span id="L-3715"><a href="#L-3715"><span class="linenos">3715</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-3716"><a href="#L-3716"><span class="linenos">3716</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="L-3717"><a href="#L-3717"><span class="linenos">3717</span></a> +</span><span id="L-3718"><a href="#L-3718"><span class="linenos">3718</span></a> <span class="n">inst</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="n">instance</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="L-3719"><a href="#L-3719"><span class="linenos">3719</span></a> +</span><span id="L-3720"><a href="#L-3720"><span class="linenos">3720</span></a> <span class="n">existing</span> <span class="o">=</span> <span class="n">inst</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> +</span><span id="L-3721"><a href="#L-3721"><span class="linenos">3721</span></a> <span class="k">if</span> <span class="n">append</span> <span class="ow">and</span> <span class="n">existing</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-3722"><a href="#L-3722"><span class="linenos">3722</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">existing</span><span class="o">.</span><span class="n">this</span> <span class="k">if</span> <span class="n">into</span> <span class="k">else</span> <span class="n">existing</span><span class="p">]</span> <span class="o">+</span> <span class="nb">list</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-3723"><a href="#L-3723"><span class="linenos">3723</span></a> +</span><span id="L-3724"><a href="#L-3724"><span class="linenos">3724</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">and_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3725"><a href="#L-3725"><span class="linenos">3725</span></a> +</span><span id="L-3726"><a href="#L-3726"><span class="linenos">3726</span></a> <span class="n">inst</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="n">into</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">node</span><span class="p">)</span> <span class="k">if</span> <span class="n">into</span> <span class="k">else</span> <span class="n">node</span><span class="p">)</span> +</span><span id="L-3727"><a href="#L-3727"><span class="linenos">3727</span></a> <span class="k">return</span> <span class="n">inst</span> +</span><span id="L-3728"><a href="#L-3728"><span class="linenos">3728</span></a> +</span><span id="L-3729"><a href="#L-3729"><span class="linenos">3729</span></a> +</span><span id="L-3730"><a href="#L-3730"><span class="linenos">3730</span></a><span class="k">def</span> <span class="nf">_combine</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="n">operator</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-3731"><a href="#L-3731"><span class="linenos">3731</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">condition</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">]</span> +</span><span id="L-3732"><a href="#L-3732"><span class="linenos">3732</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-3733"><a href="#L-3733"><span class="linenos">3733</span></a> <span class="k">if</span> <span class="n">expressions</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="L-3734"><a href="#L-3734"><span class="linenos">3734</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">_wrap_operator</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-3735"><a href="#L-3735"><span class="linenos">3735</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="L-3736"><a href="#L-3736"><span class="linenos">3736</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">operator</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">_wrap_operator</span><span class="p">(</span><span class="n">expression</span><span class="p">))</span> +</span><span id="L-3737"><a href="#L-3737"><span class="linenos">3737</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3738"><a href="#L-3738"><span class="linenos">3738</span></a> +</span><span id="L-3739"><a href="#L-3739"><span class="linenos">3739</span></a> +</span><span id="L-3740"><a href="#L-3740"><span class="linenos">3740</span></a><span class="k">def</span> <span class="nf">_wrap_operator</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-3741"><a href="#L-3741"><span class="linenos">3741</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">And</span><span class="p">,</span> <span class="n">Or</span><span class="p">,</span> <span class="n">Not</span><span class="p">)):</span> +</span><span id="L-3742"><a href="#L-3742"><span class="linenos">3742</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">Paren</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-3743"><a href="#L-3743"><span class="linenos">3743</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-3744"><a href="#L-3744"><span class="linenos">3744</span></a> +</span><span id="L-3745"><a href="#L-3745"><span class="linenos">3745</span></a> +</span><span id="L-3746"><a href="#L-3746"><span class="linenos">3746</span></a><span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-3747"><a href="#L-3747"><span class="linenos">3747</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3748"><a href="#L-3748"><span class="linenos">3748</span></a><span class="sd"> Initializes a syntax tree from one UNION expression.</span> +</span><span id="L-3749"><a href="#L-3749"><span class="linenos">3749</span></a> +</span><span id="L-3750"><a href="#L-3750"><span class="linenos">3750</span></a><span class="sd"> Example:</span> +</span><span id="L-3751"><a href="#L-3751"><span class="linenos">3751</span></a><span class="sd"> >>> union("SELECT * FROM foo", "SELECT * FROM bla").sql()</span> +</span><span id="L-3752"><a href="#L-3752"><span class="linenos">3752</span></a><span class="sd"> 'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</span><span id="L-3753"><a href="#L-3753"><span class="linenos">3753</span></a> +</span><span id="L-3754"><a href="#L-3754"><span class="linenos">3754</span></a><span class="sd"> Args:</span> +</span><span id="L-3755"><a href="#L-3755"><span class="linenos">3755</span></a><span class="sd"> left (str | Expression): the SQL code string corresponding to the left-hand side.</span> +</span><span id="L-3756"><a href="#L-3756"><span class="linenos">3756</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-3757"><a href="#L-3757"><span class="linenos">3757</span></a><span class="sd"> right (str | Expression): the SQL code string corresponding to the right-hand side.</span> +</span><span id="L-3758"><a href="#L-3758"><span class="linenos">3758</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-3759"><a href="#L-3759"><span class="linenos">3759</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="L-3760"><a href="#L-3760"><span class="linenos">3760</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-3761"><a href="#L-3761"><span class="linenos">3761</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-3762"><a href="#L-3762"><span class="linenos">3762</span></a><span class="sd"> Returns:</span> +</span><span id="L-3763"><a href="#L-3763"><span class="linenos">3763</span></a><span class="sd"> Union: the syntax tree for the UNION expression.</span> +</span><span id="L-3764"><a href="#L-3764"><span class="linenos">3764</span></a><span class="sd"> """</span> +</span><span id="L-3765"><a href="#L-3765"><span class="linenos">3765</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3766"><a href="#L-3766"><span class="linenos">3766</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3767"><a href="#L-3767"><span class="linenos">3767</span></a> +</span><span id="L-3768"><a href="#L-3768"><span class="linenos">3768</span></a> <span class="k">return</span> <span class="n">Union</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">)</span> +</span><span id="L-3769"><a href="#L-3769"><span class="linenos">3769</span></a> +</span><span id="L-3770"><a href="#L-3770"><span class="linenos">3770</span></a> +</span><span id="L-3771"><a href="#L-3771"><span class="linenos">3771</span></a><span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-3772"><a href="#L-3772"><span class="linenos">3772</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3773"><a href="#L-3773"><span class="linenos">3773</span></a><span class="sd"> Initializes a syntax tree from one INTERSECT expression.</span> +</span><span id="L-3774"><a href="#L-3774"><span class="linenos">3774</span></a> +</span><span id="L-3775"><a href="#L-3775"><span class="linenos">3775</span></a><span class="sd"> Example:</span> +</span><span id="L-3776"><a href="#L-3776"><span class="linenos">3776</span></a><span class="sd"> >>> intersect("SELECT * FROM foo", "SELECT * FROM bla").sql()</span> +</span><span id="L-3777"><a href="#L-3777"><span class="linenos">3777</span></a><span class="sd"> 'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</span><span id="L-3778"><a href="#L-3778"><span class="linenos">3778</span></a> +</span><span id="L-3779"><a href="#L-3779"><span class="linenos">3779</span></a><span class="sd"> Args:</span> +</span><span id="L-3780"><a href="#L-3780"><span class="linenos">3780</span></a><span class="sd"> left (str | Expression): the SQL code string corresponding to the left-hand side.</span> +</span><span id="L-3781"><a href="#L-3781"><span class="linenos">3781</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-3782"><a href="#L-3782"><span class="linenos">3782</span></a><span class="sd"> right (str | Expression): the SQL code string corresponding to the right-hand side.</span> +</span><span id="L-3783"><a href="#L-3783"><span class="linenos">3783</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-3784"><a href="#L-3784"><span class="linenos">3784</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="L-3785"><a href="#L-3785"><span class="linenos">3785</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-3786"><a href="#L-3786"><span class="linenos">3786</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-3787"><a href="#L-3787"><span class="linenos">3787</span></a><span class="sd"> Returns:</span> +</span><span id="L-3788"><a href="#L-3788"><span class="linenos">3788</span></a><span class="sd"> Intersect: the syntax tree for the INTERSECT expression.</span> +</span><span id="L-3789"><a href="#L-3789"><span class="linenos">3789</span></a><span class="sd"> """</span> +</span><span id="L-3790"><a href="#L-3790"><span class="linenos">3790</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3791"><a href="#L-3791"><span class="linenos">3791</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3792"><a href="#L-3792"><span class="linenos">3792</span></a> +</span><span id="L-3793"><a href="#L-3793"><span class="linenos">3793</span></a> <span class="k">return</span> <span class="n">Intersect</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">)</span> +</span><span id="L-3794"><a href="#L-3794"><span class="linenos">3794</span></a> +</span><span id="L-3795"><a href="#L-3795"><span class="linenos">3795</span></a> +</span><span id="L-3796"><a href="#L-3796"><span class="linenos">3796</span></a><span class="k">def</span> <span class="nf">except_</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-3797"><a href="#L-3797"><span class="linenos">3797</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3798"><a href="#L-3798"><span class="linenos">3798</span></a><span class="sd"> Initializes a syntax tree from one EXCEPT expression.</span> +</span><span id="L-3799"><a href="#L-3799"><span class="linenos">3799</span></a> +</span><span id="L-3800"><a href="#L-3800"><span class="linenos">3800</span></a><span class="sd"> Example:</span> +</span><span id="L-3801"><a href="#L-3801"><span class="linenos">3801</span></a><span class="sd"> >>> except_("SELECT * FROM foo", "SELECT * FROM bla").sql()</span> +</span><span id="L-3802"><a href="#L-3802"><span class="linenos">3802</span></a><span class="sd"> 'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</span><span id="L-3803"><a href="#L-3803"><span class="linenos">3803</span></a> +</span><span id="L-3804"><a href="#L-3804"><span class="linenos">3804</span></a><span class="sd"> Args:</span> +</span><span id="L-3805"><a href="#L-3805"><span class="linenos">3805</span></a><span class="sd"> left (str | Expression): the SQL code string corresponding to the left-hand side.</span> +</span><span id="L-3806"><a href="#L-3806"><span class="linenos">3806</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-3807"><a href="#L-3807"><span class="linenos">3807</span></a><span class="sd"> right (str | Expression): the SQL code string corresponding to the right-hand side.</span> +</span><span id="L-3808"><a href="#L-3808"><span class="linenos">3808</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="L-3809"><a href="#L-3809"><span class="linenos">3809</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="L-3810"><a href="#L-3810"><span class="linenos">3810</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-3811"><a href="#L-3811"><span class="linenos">3811</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="L-3812"><a href="#L-3812"><span class="linenos">3812</span></a><span class="sd"> Returns:</span> +</span><span id="L-3813"><a href="#L-3813"><span class="linenos">3813</span></a><span class="sd"> Except: the syntax tree for the EXCEPT statement.</span> +</span><span id="L-3814"><a href="#L-3814"><span class="linenos">3814</span></a><span class="sd"> """</span> +</span><span id="L-3815"><a href="#L-3815"><span class="linenos">3815</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3816"><a href="#L-3816"><span class="linenos">3816</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3817"><a href="#L-3817"><span class="linenos">3817</span></a> +</span><span id="L-3818"><a href="#L-3818"><span class="linenos">3818</span></a> <span class="k">return</span> <span class="n">Except</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">)</span> +</span><span id="L-3819"><a href="#L-3819"><span class="linenos">3819</span></a> +</span><span id="L-3820"><a href="#L-3820"><span class="linenos">3820</span></a> +</span><span id="L-3821"><a href="#L-3821"><span class="linenos">3821</span></a><span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-3822"><a href="#L-3822"><span class="linenos">3822</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3823"><a href="#L-3823"><span class="linenos">3823</span></a><span class="sd"> Initializes a syntax tree from one or multiple SELECT expressions.</span> +</span><span id="L-3824"><a href="#L-3824"><span class="linenos">3824</span></a> +</span><span id="L-3825"><a href="#L-3825"><span class="linenos">3825</span></a><span class="sd"> Example:</span> +</span><span id="L-3826"><a href="#L-3826"><span class="linenos">3826</span></a><span class="sd"> >>> select("col1", "col2").from_("tbl").sql()</span> +</span><span id="L-3827"><a href="#L-3827"><span class="linenos">3827</span></a><span class="sd"> 'SELECT col1, col2 FROM tbl'</span> +</span><span id="L-3828"><a href="#L-3828"><span class="linenos">3828</span></a> +</span><span id="L-3829"><a href="#L-3829"><span class="linenos">3829</span></a><span class="sd"> Args:</span> +</span><span id="L-3830"><a href="#L-3830"><span class="linenos">3830</span></a><span class="sd"> *expressions (str | Expression): the SQL code string to parse as the expressions of a</span> +</span><span id="L-3831"><a href="#L-3831"><span class="linenos">3831</span></a><span class="sd"> SELECT statement. If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-3832"><a href="#L-3832"><span class="linenos">3832</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions (in the case that an</span> +</span><span id="L-3833"><a href="#L-3833"><span class="linenos">3833</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="L-3834"><a href="#L-3834"><span class="linenos">3834</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="L-3835"><a href="#L-3835"><span class="linenos">3835</span></a><span class="sd"> that an input expression is a SQL string).</span> +</span><span id="L-3836"><a href="#L-3836"><span class="linenos">3836</span></a> +</span><span id="L-3837"><a href="#L-3837"><span class="linenos">3837</span></a><span class="sd"> Returns:</span> +</span><span id="L-3838"><a href="#L-3838"><span class="linenos">3838</span></a><span class="sd"> Select: the syntax tree for the SELECT statement.</span> +</span><span id="L-3839"><a href="#L-3839"><span class="linenos">3839</span></a><span class="sd"> """</span> +</span><span id="L-3840"><a href="#L-3840"><span class="linenos">3840</span></a> <span class="k">return</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3841"><a href="#L-3841"><span class="linenos">3841</span></a> +</span><span id="L-3842"><a href="#L-3842"><span class="linenos">3842</span></a> +</span><span id="L-3843"><a href="#L-3843"><span class="linenos">3843</span></a><span class="k">def</span> <span class="nf">from_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="L-3844"><a href="#L-3844"><span class="linenos">3844</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3845"><a href="#L-3845"><span class="linenos">3845</span></a><span class="sd"> Initializes a syntax tree from a FROM expression.</span> +</span><span id="L-3846"><a href="#L-3846"><span class="linenos">3846</span></a> +</span><span id="L-3847"><a href="#L-3847"><span class="linenos">3847</span></a><span class="sd"> Example:</span> +</span><span id="L-3848"><a href="#L-3848"><span class="linenos">3848</span></a><span class="sd"> >>> from_("tbl").select("col1", "col2").sql()</span> +</span><span id="L-3849"><a href="#L-3849"><span class="linenos">3849</span></a><span class="sd"> 'SELECT col1, col2 FROM tbl'</span> +</span><span id="L-3850"><a href="#L-3850"><span class="linenos">3850</span></a> +</span><span id="L-3851"><a href="#L-3851"><span class="linenos">3851</span></a><span class="sd"> Args:</span> +</span><span id="L-3852"><a href="#L-3852"><span class="linenos">3852</span></a><span class="sd"> *expressions (str | Expression): the SQL code string to parse as the FROM expressions of a</span> +</span><span id="L-3853"><a href="#L-3853"><span class="linenos">3853</span></a><span class="sd"> SELECT statement. If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-3854"><a href="#L-3854"><span class="linenos">3854</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression (in the case that the</span> +</span><span id="L-3855"><a href="#L-3855"><span class="linenos">3855</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="L-3856"><a href="#L-3856"><span class="linenos">3856</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="L-3857"><a href="#L-3857"><span class="linenos">3857</span></a><span class="sd"> that the input expression is a SQL string).</span> +</span><span id="L-3858"><a href="#L-3858"><span class="linenos">3858</span></a> +</span><span id="L-3859"><a href="#L-3859"><span class="linenos">3859</span></a><span class="sd"> Returns:</span> +</span><span id="L-3860"><a href="#L-3860"><span class="linenos">3860</span></a><span class="sd"> Select: the syntax tree for the SELECT statement.</span> +</span><span id="L-3861"><a href="#L-3861"><span class="linenos">3861</span></a><span class="sd"> """</span> +</span><span id="L-3862"><a href="#L-3862"><span class="linenos">3862</span></a> <span class="k">return</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3863"><a href="#L-3863"><span class="linenos">3863</span></a> +</span><span id="L-3864"><a href="#L-3864"><span class="linenos">3864</span></a> +</span><span id="L-3865"><a href="#L-3865"><span class="linenos">3865</span></a><span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">properties</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">from_</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Update</span><span class="p">:</span> +</span><span id="L-3866"><a href="#L-3866"><span class="linenos">3866</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3867"><a href="#L-3867"><span class="linenos">3867</span></a><span class="sd"> Creates an update statement.</span> +</span><span id="L-3868"><a href="#L-3868"><span class="linenos">3868</span></a> +</span><span id="L-3869"><a href="#L-3869"><span class="linenos">3869</span></a><span class="sd"> Example:</span> +</span><span id="L-3870"><a href="#L-3870"><span class="linenos">3870</span></a><span class="sd"> >>> update("my_table", {"x": 1, "y": "2", "z": None}, from_="baz", where="id > 1").sql()</span> +</span><span id="L-3871"><a href="#L-3871"><span class="linenos">3871</span></a><span class="sd"> "UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz WHERE id > 1"</span> +</span><span id="L-3872"><a href="#L-3872"><span class="linenos">3872</span></a> +</span><span id="L-3873"><a href="#L-3873"><span class="linenos">3873</span></a><span class="sd"> Args:</span> +</span><span id="L-3874"><a href="#L-3874"><span class="linenos">3874</span></a><span class="sd"> *properties (Dict[str, Any]): dictionary of properties to set which are</span> +</span><span id="L-3875"><a href="#L-3875"><span class="linenos">3875</span></a><span class="sd"> auto converted to sql objects eg None -> NULL</span> +</span><span id="L-3876"><a href="#L-3876"><span class="linenos">3876</span></a><span class="sd"> where (str): sql conditional parsed into a WHERE statement</span> +</span><span id="L-3877"><a href="#L-3877"><span class="linenos">3877</span></a><span class="sd"> from_ (str): sql statement parsed into a FROM statement</span> +</span><span id="L-3878"><a href="#L-3878"><span class="linenos">3878</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-3879"><a href="#L-3879"><span class="linenos">3879</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-3880"><a href="#L-3880"><span class="linenos">3880</span></a> +</span><span id="L-3881"><a href="#L-3881"><span class="linenos">3881</span></a><span class="sd"> Returns:</span> +</span><span id="L-3882"><a href="#L-3882"><span class="linenos">3882</span></a><span class="sd"> Update: the syntax tree for the UPDATE statement.</span> +</span><span id="L-3883"><a href="#L-3883"><span class="linenos">3883</span></a><span class="sd"> """</span> +</span><span id="L-3884"><a href="#L-3884"><span class="linenos">3884</span></a> <span class="n">update</span> <span class="o">=</span> <span class="n">Update</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">))</span> +</span><span id="L-3885"><a href="#L-3885"><span class="linenos">3885</span></a> <span class="n">update</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-3886"><a href="#L-3886"><span class="linenos">3886</span></a> <span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="L-3887"><a href="#L-3887"><span class="linenos">3887</span></a> <span class="p">[</span> +</span><span id="L-3888"><a href="#L-3888"><span class="linenos">3888</span></a> <span class="n">EQ</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">))</span> +</span><span id="L-3889"><a href="#L-3889"><span class="linenos">3889</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">properties</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-3890"><a href="#L-3890"><span class="linenos">3890</span></a> <span class="p">],</span> +</span><span id="L-3891"><a href="#L-3891"><span class="linenos">3891</span></a> <span class="p">)</span> +</span><span id="L-3892"><a href="#L-3892"><span class="linenos">3892</span></a> <span class="k">if</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="L-3893"><a href="#L-3893"><span class="linenos">3893</span></a> <span class="n">update</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-3894"><a href="#L-3894"><span class="linenos">3894</span></a> <span class="s2">"from"</span><span class="p">,</span> +</span><span id="L-3895"><a href="#L-3895"><span class="linenos">3895</span></a> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">from_</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">From</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="L-3896"><a href="#L-3896"><span class="linenos">3896</span></a> <span class="p">)</span> +</span><span id="L-3897"><a href="#L-3897"><span class="linenos">3897</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="L-3898"><a href="#L-3898"><span class="linenos">3898</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">Where</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">where</span><span class="p">)</span> +</span><span id="L-3899"><a href="#L-3899"><span class="linenos">3899</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="L-3900"><a href="#L-3900"><span class="linenos">3900</span></a> <span class="n">update</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-3901"><a href="#L-3901"><span class="linenos">3901</span></a> <span class="s2">"where"</span><span class="p">,</span> +</span><span id="L-3902"><a href="#L-3902"><span class="linenos">3902</span></a> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WHERE"</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="L-3903"><a href="#L-3903"><span class="linenos">3903</span></a> <span class="p">)</span> +</span><span id="L-3904"><a href="#L-3904"><span class="linenos">3904</span></a> <span class="k">return</span> <span class="n">update</span> +</span><span id="L-3905"><a href="#L-3905"><span class="linenos">3905</span></a> +</span><span id="L-3906"><a href="#L-3906"><span class="linenos">3906</span></a> +</span><span id="L-3907"><a href="#L-3907"><span class="linenos">3907</span></a><span class="k">def</span> <span class="nf">delete</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Delete</span><span class="p">:</span> +</span><span id="L-3908"><a href="#L-3908"><span class="linenos">3908</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3909"><a href="#L-3909"><span class="linenos">3909</span></a><span class="sd"> Builds a delete statement.</span> +</span><span id="L-3910"><a href="#L-3910"><span class="linenos">3910</span></a> +</span><span id="L-3911"><a href="#L-3911"><span class="linenos">3911</span></a><span class="sd"> Example:</span> +</span><span id="L-3912"><a href="#L-3912"><span class="linenos">3912</span></a><span class="sd"> >>> delete("my_table", where="id > 1").sql()</span> +</span><span id="L-3913"><a href="#L-3913"><span class="linenos">3913</span></a><span class="sd"> 'DELETE FROM my_table WHERE id > 1'</span> +</span><span id="L-3914"><a href="#L-3914"><span class="linenos">3914</span></a> +</span><span id="L-3915"><a href="#L-3915"><span class="linenos">3915</span></a><span class="sd"> Args:</span> +</span><span id="L-3916"><a href="#L-3916"><span class="linenos">3916</span></a><span class="sd"> where (str|Condition): sql conditional parsed into a WHERE statement</span> +</span><span id="L-3917"><a href="#L-3917"><span class="linenos">3917</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="L-3918"><a href="#L-3918"><span class="linenos">3918</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-3919"><a href="#L-3919"><span class="linenos">3919</span></a> +</span><span id="L-3920"><a href="#L-3920"><span class="linenos">3920</span></a><span class="sd"> Returns:</span> +</span><span id="L-3921"><a href="#L-3921"><span class="linenos">3921</span></a><span class="sd"> Delete: the syntax tree for the DELETE statement.</span> +</span><span id="L-3922"><a href="#L-3922"><span class="linenos">3922</span></a><span class="sd"> """</span> +</span><span id="L-3923"><a href="#L-3923"><span class="linenos">3923</span></a> <span class="k">return</span> <span class="n">Delete</span><span class="p">(</span> +</span><span id="L-3924"><a href="#L-3924"><span class="linenos">3924</span></a> <span class="n">this</span><span class="o">=</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="L-3925"><a href="#L-3925"><span class="linenos">3925</span></a> <span class="n">where</span><span class="o">=</span><span class="n">Where</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">where</span><span class="p">)</span> +</span><span id="L-3926"><a href="#L-3926"><span class="linenos">3926</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">Condition</span><span class="p">)</span> +</span><span id="L-3927"><a href="#L-3927"><span class="linenos">3927</span></a> <span class="k">else</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WHERE"</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="L-3928"><a href="#L-3928"><span class="linenos">3928</span></a> <span class="p">)</span> +</span><span id="L-3929"><a href="#L-3929"><span class="linenos">3929</span></a> +</span><span id="L-3930"><a href="#L-3930"><span class="linenos">3930</span></a> +</span><span id="L-3931"><a href="#L-3931"><span class="linenos">3931</span></a><span class="k">def</span> <span class="nf">condition</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Condition</span><span class="p">:</span> +</span><span id="L-3932"><a href="#L-3932"><span class="linenos">3932</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3933"><a href="#L-3933"><span class="linenos">3933</span></a><span class="sd"> Initialize a logical condition expression.</span> +</span><span id="L-3934"><a href="#L-3934"><span class="linenos">3934</span></a> +</span><span id="L-3935"><a href="#L-3935"><span class="linenos">3935</span></a><span class="sd"> Example:</span> +</span><span id="L-3936"><a href="#L-3936"><span class="linenos">3936</span></a><span class="sd"> >>> condition("x=1").sql()</span> +</span><span id="L-3937"><a href="#L-3937"><span class="linenos">3937</span></a><span class="sd"> 'x = 1'</span> +</span><span id="L-3938"><a href="#L-3938"><span class="linenos">3938</span></a> +</span><span id="L-3939"><a href="#L-3939"><span class="linenos">3939</span></a><span class="sd"> This is helpful for composing larger logical syntax trees:</span> +</span><span id="L-3940"><a href="#L-3940"><span class="linenos">3940</span></a><span class="sd"> >>> where = condition("x=1")</span> +</span><span id="L-3941"><a href="#L-3941"><span class="linenos">3941</span></a><span class="sd"> >>> where = where.and_("y=1")</span> +</span><span id="L-3942"><a href="#L-3942"><span class="linenos">3942</span></a><span class="sd"> >>> Select().from_("tbl").select("*").where(where).sql()</span> +</span><span id="L-3943"><a href="#L-3943"><span class="linenos">3943</span></a><span class="sd"> 'SELECT * FROM tbl WHERE x = 1 AND y = 1'</span> +</span><span id="L-3944"><a href="#L-3944"><span class="linenos">3944</span></a> +</span><span id="L-3945"><a href="#L-3945"><span class="linenos">3945</span></a><span class="sd"> Args:</span> +</span><span id="L-3946"><a href="#L-3946"><span class="linenos">3946</span></a><span class="sd"> *expression (str | Expression): the SQL code string to parse.</span> +</span><span id="L-3947"><a href="#L-3947"><span class="linenos">3947</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-3948"><a href="#L-3948"><span class="linenos">3948</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression (in the case that the</span> +</span><span id="L-3949"><a href="#L-3949"><span class="linenos">3949</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="L-3950"><a href="#L-3950"><span class="linenos">3950</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="L-3951"><a href="#L-3951"><span class="linenos">3951</span></a><span class="sd"> that the input expression is a SQL string).</span> +</span><span id="L-3952"><a href="#L-3952"><span class="linenos">3952</span></a> +</span><span id="L-3953"><a href="#L-3953"><span class="linenos">3953</span></a><span class="sd"> Returns:</span> +</span><span id="L-3954"><a href="#L-3954"><span class="linenos">3954</span></a><span class="sd"> Condition: the expression</span> +</span><span id="L-3955"><a href="#L-3955"><span class="linenos">3955</span></a><span class="sd"> """</span> +</span><span id="L-3956"><a href="#L-3956"><span class="linenos">3956</span></a> <span class="k">return</span> <span class="n">maybe_parse</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="L-3957"><a href="#L-3957"><span class="linenos">3957</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-3958"><a href="#L-3958"><span class="linenos">3958</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Condition</span><span class="p">,</span> +</span><span id="L-3959"><a href="#L-3959"><span class="linenos">3959</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-3960"><a href="#L-3960"><span class="linenos">3960</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-3961"><a href="#L-3961"><span class="linenos">3961</span></a> <span class="p">)</span> +</span><span id="L-3962"><a href="#L-3962"><span class="linenos">3962</span></a> +</span><span id="L-3963"><a href="#L-3963"><span class="linenos">3963</span></a> +</span><span id="L-3964"><a href="#L-3964"><span class="linenos">3964</span></a><span class="k">def</span> <span class="nf">and_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">And</span><span class="p">:</span> +</span><span id="L-3965"><a href="#L-3965"><span class="linenos">3965</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3966"><a href="#L-3966"><span class="linenos">3966</span></a><span class="sd"> Combine multiple conditions with an AND logical operator.</span> +</span><span id="L-3967"><a href="#L-3967"><span class="linenos">3967</span></a> +</span><span id="L-3968"><a href="#L-3968"><span class="linenos">3968</span></a><span class="sd"> Example:</span> +</span><span id="L-3969"><a href="#L-3969"><span class="linenos">3969</span></a><span class="sd"> >>> and_("x=1", and_("y=1", "z=1")).sql()</span> +</span><span id="L-3970"><a href="#L-3970"><span class="linenos">3970</span></a><span class="sd"> 'x = 1 AND (y = 1 AND z = 1)'</span> +</span><span id="L-3971"><a href="#L-3971"><span class="linenos">3971</span></a> +</span><span id="L-3972"><a href="#L-3972"><span class="linenos">3972</span></a><span class="sd"> Args:</span> +</span><span id="L-3973"><a href="#L-3973"><span class="linenos">3973</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-3974"><a href="#L-3974"><span class="linenos">3974</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-3975"><a href="#L-3975"><span class="linenos">3975</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-3976"><a href="#L-3976"><span class="linenos">3976</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-3977"><a href="#L-3977"><span class="linenos">3977</span></a> +</span><span id="L-3978"><a href="#L-3978"><span class="linenos">3978</span></a><span class="sd"> Returns:</span> +</span><span id="L-3979"><a href="#L-3979"><span class="linenos">3979</span></a><span class="sd"> And: the new condition</span> +</span><span id="L-3980"><a href="#L-3980"><span class="linenos">3980</span></a><span class="sd"> """</span> +</span><span id="L-3981"><a href="#L-3981"><span class="linenos">3981</span></a> <span class="k">return</span> <span class="n">_combine</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="n">And</span><span class="p">,</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-3982"><a href="#L-3982"><span class="linenos">3982</span></a> +</span><span id="L-3983"><a href="#L-3983"><span class="linenos">3983</span></a> +</span><span id="L-3984"><a href="#L-3984"><span class="linenos">3984</span></a><span class="k">def</span> <span class="nf">or_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Or</span><span class="p">:</span> +</span><span id="L-3985"><a href="#L-3985"><span class="linenos">3985</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-3986"><a href="#L-3986"><span class="linenos">3986</span></a><span class="sd"> Combine multiple conditions with an OR logical operator.</span> +</span><span id="L-3987"><a href="#L-3987"><span class="linenos">3987</span></a> +</span><span id="L-3988"><a href="#L-3988"><span class="linenos">3988</span></a><span class="sd"> Example:</span> +</span><span id="L-3989"><a href="#L-3989"><span class="linenos">3989</span></a><span class="sd"> >>> or_("x=1", or_("y=1", "z=1")).sql()</span> +</span><span id="L-3990"><a href="#L-3990"><span class="linenos">3990</span></a><span class="sd"> 'x = 1 OR (y = 1 OR z = 1)'</span> +</span><span id="L-3991"><a href="#L-3991"><span class="linenos">3991</span></a> +</span><span id="L-3992"><a href="#L-3992"><span class="linenos">3992</span></a><span class="sd"> Args:</span> +</span><span id="L-3993"><a href="#L-3993"><span class="linenos">3993</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-3994"><a href="#L-3994"><span class="linenos">3994</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-3995"><a href="#L-3995"><span class="linenos">3995</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-3996"><a href="#L-3996"><span class="linenos">3996</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-3997"><a href="#L-3997"><span class="linenos">3997</span></a> +</span><span id="L-3998"><a href="#L-3998"><span class="linenos">3998</span></a><span class="sd"> Returns:</span> +</span><span id="L-3999"><a href="#L-3999"><span class="linenos">3999</span></a><span class="sd"> Or: the new condition</span> +</span><span id="L-4000"><a href="#L-4000"><span class="linenos">4000</span></a><span class="sd"> """</span> +</span><span id="L-4001"><a href="#L-4001"><span class="linenos">4001</span></a> <span class="k">return</span> <span class="n">_combine</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="n">Or</span><span class="p">,</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-4002"><a href="#L-4002"><span class="linenos">4002</span></a> +</span><span id="L-4003"><a href="#L-4003"><span class="linenos">4003</span></a> +</span><span id="L-4004"><a href="#L-4004"><span class="linenos">4004</span></a><span class="k">def</span> <span class="nf">not_</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Not</span><span class="p">:</span> +</span><span id="L-4005"><a href="#L-4005"><span class="linenos">4005</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4006"><a href="#L-4006"><span class="linenos">4006</span></a><span class="sd"> Wrap a condition with a NOT operator.</span> +</span><span id="L-4007"><a href="#L-4007"><span class="linenos">4007</span></a> +</span><span id="L-4008"><a href="#L-4008"><span class="linenos">4008</span></a><span class="sd"> Example:</span> +</span><span id="L-4009"><a href="#L-4009"><span class="linenos">4009</span></a><span class="sd"> >>> not_("this_suit='black'").sql()</span> +</span><span id="L-4010"><a href="#L-4010"><span class="linenos">4010</span></a><span class="sd"> "NOT this_suit = 'black'"</span> +</span><span id="L-4011"><a href="#L-4011"><span class="linenos">4011</span></a> +</span><span id="L-4012"><a href="#L-4012"><span class="linenos">4012</span></a><span class="sd"> Args:</span> +</span><span id="L-4013"><a href="#L-4013"><span class="linenos">4013</span></a><span class="sd"> expression (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-4014"><a href="#L-4014"><span class="linenos">4014</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-4015"><a href="#L-4015"><span class="linenos">4015</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-4016"><a href="#L-4016"><span class="linenos">4016</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-4017"><a href="#L-4017"><span class="linenos">4017</span></a> +</span><span id="L-4018"><a href="#L-4018"><span class="linenos">4018</span></a><span class="sd"> Returns:</span> +</span><span id="L-4019"><a href="#L-4019"><span class="linenos">4019</span></a><span class="sd"> Not: the new condition</span> +</span><span id="L-4020"><a href="#L-4020"><span class="linenos">4020</span></a><span class="sd"> """</span> +</span><span id="L-4021"><a href="#L-4021"><span class="linenos">4021</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">condition</span><span class="p">(</span> +</span><span id="L-4022"><a href="#L-4022"><span class="linenos">4022</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-4023"><a href="#L-4023"><span class="linenos">4023</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-4024"><a href="#L-4024"><span class="linenos">4024</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-4025"><a href="#L-4025"><span class="linenos">4025</span></a> <span class="p">)</span> +</span><span id="L-4026"><a href="#L-4026"><span class="linenos">4026</span></a> <span class="k">return</span> <span class="n">Not</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">_wrap_operator</span><span class="p">(</span><span class="n">this</span><span class="p">))</span> +</span><span id="L-4027"><a href="#L-4027"><span class="linenos">4027</span></a> +</span><span id="L-4028"><a href="#L-4028"><span class="linenos">4028</span></a> +</span><span id="L-4029"><a href="#L-4029"><span class="linenos">4029</span></a><span class="k">def</span> <span class="nf">paren</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">Paren</span><span class="p">:</span> +</span><span id="L-4030"><a href="#L-4030"><span class="linenos">4030</span></a> <span class="k">return</span> <span class="n">Paren</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-4031"><a href="#L-4031"><span class="linenos">4031</span></a> +</span><span id="L-4032"><a href="#L-4032"><span class="linenos">4032</span></a> +</span><span id="L-4033"><a href="#L-4033"><span class="linenos">4033</span></a><span class="n">SAFE_IDENTIFIER_RE</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">"^[_a-zA-Z][\w]*$"</span><span class="p">)</span> +</span><span id="L-4034"><a href="#L-4034"><span class="linenos">4034</span></a> +</span><span id="L-4035"><a href="#L-4035"><span class="linenos">4035</span></a> +</span><span id="L-4036"><a href="#L-4036"><span class="linenos">4036</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-4037"><a href="#L-4037"><span class="linenos">4037</span></a><span class="k">def</span> <span class="nf">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-4038"><a href="#L-4038"><span class="linenos">4038</span></a> <span class="o">...</span> +</span><span id="L-4039"><a href="#L-4039"><span class="linenos">4039</span></a> +</span><span id="L-4040"><a href="#L-4040"><span class="linenos">4040</span></a> +</span><span id="L-4041"><a href="#L-4041"><span class="linenos">4041</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-4042"><a href="#L-4042"><span class="linenos">4042</span></a><span class="k">def</span> <span class="nf">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Identifier</span><span class="p">,</span> <span class="n">quoted</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">Identifier</span><span class="p">:</span> +</span><span id="L-4043"><a href="#L-4043"><span class="linenos">4043</span></a> <span class="o">...</span> +</span><span id="L-4044"><a href="#L-4044"><span class="linenos">4044</span></a> +</span><span id="L-4045"><a href="#L-4045"><span class="linenos">4045</span></a> +</span><span id="L-4046"><a href="#L-4046"><span class="linenos">4046</span></a><span class="k">def</span> <span class="nf">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-4047"><a href="#L-4047"><span class="linenos">4047</span></a><span class="w"> </span><span class="sd">"""Builds an identifier.</span> +</span><span id="L-4048"><a href="#L-4048"><span class="linenos">4048</span></a> +</span><span id="L-4049"><a href="#L-4049"><span class="linenos">4049</span></a><span class="sd"> Args:</span> +</span><span id="L-4050"><a href="#L-4050"><span class="linenos">4050</span></a><span class="sd"> name: The name to turn into an identifier.</span> +</span><span id="L-4051"><a href="#L-4051"><span class="linenos">4051</span></a><span class="sd"> quoted: Whether or not force quote the identifier.</span> +</span><span id="L-4052"><a href="#L-4052"><span class="linenos">4052</span></a> +</span><span id="L-4053"><a href="#L-4053"><span class="linenos">4053</span></a><span class="sd"> Returns:</span> +</span><span id="L-4054"><a href="#L-4054"><span class="linenos">4054</span></a><span class="sd"> The identifier ast node.</span> +</span><span id="L-4055"><a href="#L-4055"><span class="linenos">4055</span></a><span class="sd"> """</span> +</span><span id="L-4056"><a href="#L-4056"><span class="linenos">4056</span></a> +</span><span id="L-4057"><a href="#L-4057"><span class="linenos">4057</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-4058"><a href="#L-4058"><span class="linenos">4058</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-4059"><a href="#L-4059"><span class="linenos">4059</span></a> +</span><span id="L-4060"><a href="#L-4060"><span class="linenos">4060</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">Identifier</span><span class="p">):</span> +</span><span id="L-4061"><a href="#L-4061"><span class="linenos">4061</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">name</span> +</span><span id="L-4062"><a href="#L-4062"><span class="linenos">4062</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-4063"><a href="#L-4063"><span class="linenos">4063</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">Identifier</span><span class="p">(</span> +</span><span id="L-4064"><a href="#L-4064"><span class="linenos">4064</span></a> <span class="n">this</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-4065"><a href="#L-4065"><span class="linenos">4065</span></a> <span class="n">quoted</span><span class="o">=</span><span class="ow">not</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">SAFE_IDENTIFIER_RE</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">if</span> <span class="n">quoted</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">quoted</span><span class="p">,</span> +</span><span id="L-4066"><a href="#L-4066"><span class="linenos">4066</span></a> <span class="p">)</span> +</span><span id="L-4067"><a href="#L-4067"><span class="linenos">4067</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-4068"><a href="#L-4068"><span class="linenos">4068</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Name needs to be a string or an Identifier, got: </span><span class="si">{</span><span class="n">name</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-4069"><a href="#L-4069"><span class="linenos">4069</span></a> <span class="k">return</span> <span class="n">identifier</span> +</span><span id="L-4070"><a href="#L-4070"><span class="linenos">4070</span></a> +</span><span id="L-4071"><a href="#L-4071"><span class="linenos">4071</span></a> +</span><span id="L-4072"><a href="#L-4072"><span class="linenos">4072</span></a><span class="n">INTERVAL_STRING_RE</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">"\s*([0-9]+)\s*([a-zA-Z]+)\s*"</span><span class="p">)</span> +</span><span id="L-4073"><a href="#L-4073"><span class="linenos">4073</span></a> +</span><span id="L-4074"><a href="#L-4074"><span class="linenos">4074</span></a> +</span><span id="L-4075"><a href="#L-4075"><span class="linenos">4075</span></a><span class="k">def</span> <span class="nf">to_interval</span><span class="p">(</span><span class="n">interval</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Literal</span><span class="p">)</span> <span class="o">-></span> <span class="n">Interval</span><span class="p">:</span> +</span><span id="L-4076"><a href="#L-4076"><span class="linenos">4076</span></a><span class="w"> </span><span class="sd">"""Builds an interval expression from a string like '1 day' or '5 months'."""</span> +</span><span id="L-4077"><a href="#L-4077"><span class="linenos">4077</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">interval</span><span class="p">,</span> <span class="n">Literal</span><span class="p">):</span> +</span><span id="L-4078"><a href="#L-4078"><span class="linenos">4078</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">interval</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-4079"><a href="#L-4079"><span class="linenos">4079</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid interval string."</span><span class="p">)</span> +</span><span id="L-4080"><a href="#L-4080"><span class="linenos">4080</span></a> +</span><span id="L-4081"><a href="#L-4081"><span class="linenos">4081</span></a> <span class="n">interval</span> <span class="o">=</span> <span class="n">interval</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-4082"><a href="#L-4082"><span class="linenos">4082</span></a> +</span><span id="L-4083"><a href="#L-4083"><span class="linenos">4083</span></a> <span class="n">interval_parts</span> <span class="o">=</span> <span class="n">INTERVAL_STRING_RE</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">interval</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-4084"><a href="#L-4084"><span class="linenos">4084</span></a> +</span><span id="L-4085"><a href="#L-4085"><span class="linenos">4085</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">interval_parts</span><span class="p">:</span> +</span><span id="L-4086"><a href="#L-4086"><span class="linenos">4086</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid interval string."</span><span class="p">)</span> +</span><span id="L-4087"><a href="#L-4087"><span class="linenos">4087</span></a> +</span><span id="L-4088"><a href="#L-4088"><span class="linenos">4088</span></a> <span class="k">return</span> <span class="n">Interval</span><span class="p">(</span> +</span><span id="L-4089"><a href="#L-4089"><span class="linenos">4089</span></a> <span class="n">this</span><span class="o">=</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">interval_parts</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span> +</span><span id="L-4090"><a href="#L-4090"><span class="linenos">4090</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">interval_parts</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">2</span><span class="p">)),</span> +</span><span id="L-4091"><a href="#L-4091"><span class="linenos">4091</span></a> <span class="p">)</span> +</span><span id="L-4092"><a href="#L-4092"><span class="linenos">4092</span></a> +</span><span id="L-4093"><a href="#L-4093"><span class="linenos">4093</span></a> +</span><span id="L-4094"><a href="#L-4094"><span class="linenos">4094</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-4095"><a href="#L-4095"><span class="linenos">4095</span></a><span class="k">def</span> <span class="nf">to_table</span><span class="p">(</span><span class="n">sql_path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="L-4096"><a href="#L-4096"><span class="linenos">4096</span></a> <span class="o">...</span> +</span><span id="L-4097"><a href="#L-4097"><span class="linenos">4097</span></a> +</span><span id="L-4098"><a href="#L-4098"><span class="linenos">4098</span></a> +</span><span id="L-4099"><a href="#L-4099"><span class="linenos">4099</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-4100"><a href="#L-4100"><span class="linenos">4100</span></a><span class="k">def</span> <span class="nf">to_table</span><span class="p">(</span><span class="n">sql_path</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-4101"><a href="#L-4101"><span class="linenos">4101</span></a> <span class="o">...</span> +</span><span id="L-4102"><a href="#L-4102"><span class="linenos">4102</span></a> +</span><span id="L-4103"><a href="#L-4103"><span class="linenos">4103</span></a> +</span><span id="L-4104"><a href="#L-4104"><span class="linenos">4104</span></a><span class="k">def</span> <span class="nf">to_table</span><span class="p">(</span><span class="n">sql_path</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Table</span><span class="p">]:</span> +</span><span id="L-4105"><a href="#L-4105"><span class="linenos">4105</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4106"><a href="#L-4106"><span class="linenos">4106</span></a><span class="sd"> Create a table expression from a `[catalog].[schema].[table]` sql path. Catalog and schema are optional.</span> +</span><span id="L-4107"><a href="#L-4107"><span class="linenos">4107</span></a><span class="sd"> If a table is passed in then that table is returned.</span> +</span><span id="L-4108"><a href="#L-4108"><span class="linenos">4108</span></a> +</span><span id="L-4109"><a href="#L-4109"><span class="linenos">4109</span></a><span class="sd"> Args:</span> +</span><span id="L-4110"><a href="#L-4110"><span class="linenos">4110</span></a><span class="sd"> sql_path: a `[catalog].[schema].[table]` string.</span> +</span><span id="L-4111"><a href="#L-4111"><span class="linenos">4111</span></a> +</span><span id="L-4112"><a href="#L-4112"><span class="linenos">4112</span></a><span class="sd"> Returns:</span> +</span><span id="L-4113"><a href="#L-4113"><span class="linenos">4113</span></a><span class="sd"> A table expression.</span> +</span><span id="L-4114"><a href="#L-4114"><span class="linenos">4114</span></a><span class="sd"> """</span> +</span><span id="L-4115"><a href="#L-4115"><span class="linenos">4115</span></a> <span class="k">if</span> <span class="n">sql_path</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="L-4116"><a href="#L-4116"><span class="linenos">4116</span></a> <span class="k">return</span> <span class="n">sql_path</span> +</span><span id="L-4117"><a href="#L-4117"><span class="linenos">4117</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-4118"><a href="#L-4118"><span class="linenos">4118</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid type provided for a table: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">sql_path</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-4119"><a href="#L-4119"><span class="linenos">4119</span></a> +</span><span id="L-4120"><a href="#L-4120"><span class="linenos">4120</span></a> <span class="n">catalog</span><span class="p">,</span> <span class="n">db</span><span class="p">,</span> <span class="n">table_name</span> <span class="o">=</span> <span class="p">(</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">split_num_words</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> +</span><span id="L-4121"><a href="#L-4121"><span class="linenos">4121</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">table_name</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="n">catalog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-4122"><a href="#L-4122"><span class="linenos">4122</span></a> +</span><span id="L-4123"><a href="#L-4123"><span class="linenos">4123</span></a> +</span><span id="L-4124"><a href="#L-4124"><span class="linenos">4124</span></a><span class="k">def</span> <span class="nf">to_column</span><span class="p">(</span><span class="n">sql_path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Column</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="L-4125"><a href="#L-4125"><span class="linenos">4125</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4126"><a href="#L-4126"><span class="linenos">4126</span></a><span class="sd"> Create a column from a `[table].[column]` sql path. Schema is optional.</span> +</span><span id="L-4127"><a href="#L-4127"><span class="linenos">4127</span></a> +</span><span id="L-4128"><a href="#L-4128"><span class="linenos">4128</span></a><span class="sd"> If a column is passed in then that column is returned.</span> +</span><span id="L-4129"><a href="#L-4129"><span class="linenos">4129</span></a> +</span><span id="L-4130"><a href="#L-4130"><span class="linenos">4130</span></a><span class="sd"> Args:</span> +</span><span id="L-4131"><a href="#L-4131"><span class="linenos">4131</span></a><span class="sd"> sql_path: `[table].[column]` string</span> +</span><span id="L-4132"><a href="#L-4132"><span class="linenos">4132</span></a><span class="sd"> Returns:</span> +</span><span id="L-4133"><a href="#L-4133"><span class="linenos">4133</span></a><span class="sd"> Table: A column expression</span> +</span><span id="L-4134"><a href="#L-4134"><span class="linenos">4134</span></a><span class="sd"> """</span> +</span><span id="L-4135"><a href="#L-4135"><span class="linenos">4135</span></a> <span class="k">if</span> <span class="n">sql_path</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="L-4136"><a href="#L-4136"><span class="linenos">4136</span></a> <span class="k">return</span> <span class="n">sql_path</span> +</span><span id="L-4137"><a href="#L-4137"><span class="linenos">4137</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-4138"><a href="#L-4138"><span class="linenos">4138</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid type provided for column: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">sql_path</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-4139"><a href="#L-4139"><span class="linenos">4139</span></a> <span class="n">table_name</span><span class="p">,</span> <span class="n">column_name</span> <span class="o">=</span> <span class="p">(</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">split_num_words</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> +</span><span id="L-4140"><a href="#L-4140"><span class="linenos">4140</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">column_name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">table_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-4141"><a href="#L-4141"><span class="linenos">4141</span></a> +</span><span id="L-4142"><a href="#L-4142"><span class="linenos">4142</span></a> +</span><span id="L-4143"><a href="#L-4143"><span class="linenos">4143</span></a><span class="k">def</span> <span class="nf">alias_</span><span class="p">(</span> +</span><span id="L-4144"><a href="#L-4144"><span class="linenos">4144</span></a> <span class="n">expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> +</span><span id="L-4145"><a href="#L-4145"><span class="linenos">4145</span></a> <span class="n">alias</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Identifier</span><span class="p">,</span> +</span><span id="L-4146"><a href="#L-4146"><span class="linenos">4146</span></a> <span class="n">table</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">Identifier</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-4147"><a href="#L-4147"><span class="linenos">4147</span></a> <span class="n">quoted</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-4148"><a href="#L-4148"><span class="linenos">4148</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-4149"><a href="#L-4149"><span class="linenos">4149</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-4150"><a href="#L-4150"><span class="linenos">4150</span></a><span class="p">):</span> +</span><span id="L-4151"><a href="#L-4151"><span class="linenos">4151</span></a><span class="w"> </span><span class="sd">"""Create an Alias expression.</span> +</span><span id="L-4152"><a href="#L-4152"><span class="linenos">4152</span></a> +</span><span id="L-4153"><a href="#L-4153"><span class="linenos">4153</span></a><span class="sd"> Example:</span> +</span><span id="L-4154"><a href="#L-4154"><span class="linenos">4154</span></a><span class="sd"> >>> alias_('foo', 'bar').sql()</span> +</span><span id="L-4155"><a href="#L-4155"><span class="linenos">4155</span></a><span class="sd"> 'foo AS bar'</span> +</span><span id="L-4156"><a href="#L-4156"><span class="linenos">4156</span></a> +</span><span id="L-4157"><a href="#L-4157"><span class="linenos">4157</span></a><span class="sd"> >>> alias_('(select 1, 2)', 'bar', table=['a', 'b']).sql()</span> +</span><span id="L-4158"><a href="#L-4158"><span class="linenos">4158</span></a><span class="sd"> '(SELECT 1, 2) AS bar(a, b)'</span> +</span><span id="L-4159"><a href="#L-4159"><span class="linenos">4159</span></a> +</span><span id="L-4160"><a href="#L-4160"><span class="linenos">4160</span></a><span class="sd"> Args:</span> +</span><span id="L-4161"><a href="#L-4161"><span class="linenos">4161</span></a><span class="sd"> expression: the SQL code strings to parse.</span> +</span><span id="L-4162"><a href="#L-4162"><span class="linenos">4162</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-4163"><a href="#L-4163"><span class="linenos">4163</span></a><span class="sd"> alias: the alias name to use. If the name has</span> +</span><span id="L-4164"><a href="#L-4164"><span class="linenos">4164</span></a><span class="sd"> special characters it is quoted.</span> +</span><span id="L-4165"><a href="#L-4165"><span class="linenos">4165</span></a><span class="sd"> table: Whether or not to create a table alias, can also be a list of columns.</span> +</span><span id="L-4166"><a href="#L-4166"><span class="linenos">4166</span></a><span class="sd"> quoted: whether or not to quote the alias</span> +</span><span id="L-4167"><a href="#L-4167"><span class="linenos">4167</span></a><span class="sd"> dialect: the dialect used to parse the input expression.</span> +</span><span id="L-4168"><a href="#L-4168"><span class="linenos">4168</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-4169"><a href="#L-4169"><span class="linenos">4169</span></a> +</span><span id="L-4170"><a href="#L-4170"><span class="linenos">4170</span></a><span class="sd"> Returns:</span> +</span><span id="L-4171"><a href="#L-4171"><span class="linenos">4171</span></a><span class="sd"> Alias: the aliased expression</span> +</span><span id="L-4172"><a href="#L-4172"><span class="linenos">4172</span></a><span class="sd"> """</span> +</span><span id="L-4173"><a href="#L-4173"><span class="linenos">4173</span></a> <span class="n">exp</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-4174"><a href="#L-4174"><span class="linenos">4174</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">)</span> +</span><span id="L-4175"><a href="#L-4175"><span class="linenos">4175</span></a> +</span><span id="L-4176"><a href="#L-4176"><span class="linenos">4176</span></a> <span class="k">if</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-4177"><a href="#L-4177"><span class="linenos">4177</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-4178"><a href="#L-4178"><span class="linenos">4178</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="L-4179"><a href="#L-4179"><span class="linenos">4179</span></a> +</span><span id="L-4180"><a href="#L-4180"><span class="linenos">4180</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="nb">bool</span><span class="p">):</span> +</span><span id="L-4181"><a href="#L-4181"><span class="linenos">4181</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-4182"><a href="#L-4182"><span class="linenos">4182</span></a> <span class="n">table_alias</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">to_identifier</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">))</span> +</span><span id="L-4183"><a href="#L-4183"><span class="linenos">4183</span></a> +</span><span id="L-4184"><a href="#L-4184"><span class="linenos">4184</span></a> <span class="k">return</span> <span class="n">exp</span> +</span><span id="L-4185"><a href="#L-4185"><span class="linenos">4185</span></a> +</span><span id="L-4186"><a href="#L-4186"><span class="linenos">4186</span></a> <span class="c1"># We don't set the "alias" arg for Window expressions, because that would add an IDENTIFIER node in</span> +</span><span id="L-4187"><a href="#L-4187"><span class="linenos">4187</span></a> <span class="c1"># the AST, representing a "named_window" [1] construct (eg. bigquery). What we want is an ALIAS node</span> +</span><span id="L-4188"><a href="#L-4188"><span class="linenos">4188</span></a> <span class="c1"># for the complete Window expression.</span> +</span><span id="L-4189"><a href="#L-4189"><span class="linenos">4189</span></a> <span class="c1">#</span> +</span><span id="L-4190"><a href="#L-4190"><span class="linenos">4190</span></a> <span class="c1"># [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls</span> +</span><span id="L-4191"><a href="#L-4191"><span class="linenos">4191</span></a> +</span><span id="L-4192"><a href="#L-4192"><span class="linenos">4192</span></a> <span class="k">if</span> <span class="s2">"alias"</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">arg_types</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exp</span><span class="p">,</span> <span class="n">Window</span><span class="p">):</span> +</span><span id="L-4193"><a href="#L-4193"><span class="linenos">4193</span></a> <span class="n">exp</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-4194"><a href="#L-4194"><span class="linenos">4194</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-4195"><a href="#L-4195"><span class="linenos">4195</span></a> <span class="k">return</span> <span class="n">exp</span> +</span><span id="L-4196"><a href="#L-4196"><span class="linenos">4196</span></a> <span class="k">return</span> <span class="n">Alias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-4197"><a href="#L-4197"><span class="linenos">4197</span></a> +</span><span id="L-4198"><a href="#L-4198"><span class="linenos">4198</span></a> +</span><span id="L-4199"><a href="#L-4199"><span class="linenos">4199</span></a><span class="k">def</span> <span class="nf">subquery</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="L-4200"><a href="#L-4200"><span class="linenos">4200</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4201"><a href="#L-4201"><span class="linenos">4201</span></a><span class="sd"> Build a subquery expression.</span> +</span><span id="L-4202"><a href="#L-4202"><span class="linenos">4202</span></a> +</span><span id="L-4203"><a href="#L-4203"><span class="linenos">4203</span></a><span class="sd"> Example:</span> +</span><span id="L-4204"><a href="#L-4204"><span class="linenos">4204</span></a><span class="sd"> >>> subquery('select x from tbl', 'bar').select('x').sql()</span> +</span><span id="L-4205"><a href="#L-4205"><span class="linenos">4205</span></a><span class="sd"> 'SELECT x FROM (SELECT x FROM tbl) AS bar'</span> +</span><span id="L-4206"><a href="#L-4206"><span class="linenos">4206</span></a> +</span><span id="L-4207"><a href="#L-4207"><span class="linenos">4207</span></a><span class="sd"> Args:</span> +</span><span id="L-4208"><a href="#L-4208"><span class="linenos">4208</span></a><span class="sd"> expression (str | Expression): the SQL code strings to parse.</span> +</span><span id="L-4209"><a href="#L-4209"><span class="linenos">4209</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="L-4210"><a href="#L-4210"><span class="linenos">4210</span></a><span class="sd"> alias (str | Expression): the alias name to use.</span> +</span><span id="L-4211"><a href="#L-4211"><span class="linenos">4211</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="L-4212"><a href="#L-4212"><span class="linenos">4212</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="L-4213"><a href="#L-4213"><span class="linenos">4213</span></a> +</span><span id="L-4214"><a href="#L-4214"><span class="linenos">4214</span></a><span class="sd"> Returns:</span> +</span><span id="L-4215"><a href="#L-4215"><span class="linenos">4215</span></a><span class="sd"> Select: a new select with the subquery expression included</span> +</span><span id="L-4216"><a href="#L-4216"><span class="linenos">4216</span></a><span class="sd"> """</span> +</span><span id="L-4217"><a href="#L-4217"><span class="linenos">4217</span></a> +</span><span id="L-4218"><a href="#L-4218"><span class="linenos">4218</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-4219"><a href="#L-4219"><span class="linenos">4219</span></a> <span class="k">return</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-4220"><a href="#L-4220"><span class="linenos">4220</span></a> +</span><span id="L-4221"><a href="#L-4221"><span class="linenos">4221</span></a> +</span><span id="L-4222"><a href="#L-4222"><span class="linenos">4222</span></a><span class="k">def</span> <span class="nf">column</span><span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="L-4223"><a href="#L-4223"><span class="linenos">4223</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4224"><a href="#L-4224"><span class="linenos">4224</span></a><span class="sd"> Build a Column.</span> +</span><span id="L-4225"><a href="#L-4225"><span class="linenos">4225</span></a> +</span><span id="L-4226"><a href="#L-4226"><span class="linenos">4226</span></a><span class="sd"> Args:</span> +</span><span id="L-4227"><a href="#L-4227"><span class="linenos">4227</span></a><span class="sd"> col (str | Expression): column name</span> +</span><span id="L-4228"><a href="#L-4228"><span class="linenos">4228</span></a><span class="sd"> table (str | Expression): table name</span> +</span><span id="L-4229"><a href="#L-4229"><span class="linenos">4229</span></a><span class="sd"> Returns:</span> +</span><span id="L-4230"><a href="#L-4230"><span class="linenos">4230</span></a><span class="sd"> Column: column instance</span> +</span><span id="L-4231"><a href="#L-4231"><span class="linenos">4231</span></a><span class="sd"> """</span> +</span><span id="L-4232"><a href="#L-4232"><span class="linenos">4232</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="L-4233"><a href="#L-4233"><span class="linenos">4233</span></a> <span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="L-4234"><a href="#L-4234"><span class="linenos">4234</span></a> <span class="n">table</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="L-4235"><a href="#L-4235"><span class="linenos">4235</span></a> <span class="p">)</span> +</span><span id="L-4236"><a href="#L-4236"><span class="linenos">4236</span></a> +</span><span id="L-4237"><a href="#L-4237"><span class="linenos">4237</span></a> +</span><span id="L-4238"><a href="#L-4238"><span class="linenos">4238</span></a><span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> <span class="n">to</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Cast</span><span class="p">:</span> +</span><span id="L-4239"><a href="#L-4239"><span class="linenos">4239</span></a><span class="w"> </span><span class="sd">"""Cast an expression to a data type.</span> +</span><span id="L-4240"><a href="#L-4240"><span class="linenos">4240</span></a> +</span><span id="L-4241"><a href="#L-4241"><span class="linenos">4241</span></a><span class="sd"> Example:</span> +</span><span id="L-4242"><a href="#L-4242"><span class="linenos">4242</span></a><span class="sd"> >>> cast('x + 1', 'int').sql()</span> +</span><span id="L-4243"><a href="#L-4243"><span class="linenos">4243</span></a><span class="sd"> 'CAST(x + 1 AS INT)'</span> +</span><span id="L-4244"><a href="#L-4244"><span class="linenos">4244</span></a> +</span><span id="L-4245"><a href="#L-4245"><span class="linenos">4245</span></a><span class="sd"> Args:</span> +</span><span id="L-4246"><a href="#L-4246"><span class="linenos">4246</span></a><span class="sd"> expression: The expression to cast.</span> +</span><span id="L-4247"><a href="#L-4247"><span class="linenos">4247</span></a><span class="sd"> to: The datatype to cast to.</span> +</span><span id="L-4248"><a href="#L-4248"><span class="linenos">4248</span></a> +</span><span id="L-4249"><a href="#L-4249"><span class="linenos">4249</span></a><span class="sd"> Returns:</span> +</span><span id="L-4250"><a href="#L-4250"><span class="linenos">4250</span></a><span class="sd"> A cast node.</span> +</span><span id="L-4251"><a href="#L-4251"><span class="linenos">4251</span></a><span class="sd"> """</span> +</span><span id="L-4252"><a href="#L-4252"><span class="linenos">4252</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-4253"><a href="#L-4253"><span class="linenos">4253</span></a> <span class="k">return</span> <span class="n">Cast</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">to</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">))</span> +</span><span id="L-4254"><a href="#L-4254"><span class="linenos">4254</span></a> +</span><span id="L-4255"><a href="#L-4255"><span class="linenos">4255</span></a> +</span><span id="L-4256"><a href="#L-4256"><span class="linenos">4256</span></a><span class="k">def</span> <span class="nf">table_</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="L-4257"><a href="#L-4257"><span class="linenos">4257</span></a><span class="w"> </span><span class="sd">"""Build a Table.</span> +</span><span id="L-4258"><a href="#L-4258"><span class="linenos">4258</span></a> +</span><span id="L-4259"><a href="#L-4259"><span class="linenos">4259</span></a><span class="sd"> Args:</span> +</span><span id="L-4260"><a href="#L-4260"><span class="linenos">4260</span></a><span class="sd"> table (str | Expression): column name</span> +</span><span id="L-4261"><a href="#L-4261"><span class="linenos">4261</span></a><span class="sd"> db (str | Expression): db name</span> +</span><span id="L-4262"><a href="#L-4262"><span class="linenos">4262</span></a><span class="sd"> catalog (str | Expression): catalog name</span> +</span><span id="L-4263"><a href="#L-4263"><span class="linenos">4263</span></a> +</span><span id="L-4264"><a href="#L-4264"><span class="linenos">4264</span></a><span class="sd"> Returns:</span> +</span><span id="L-4265"><a href="#L-4265"><span class="linenos">4265</span></a><span class="sd"> Table: table instance</span> +</span><span id="L-4266"><a href="#L-4266"><span class="linenos">4266</span></a><span class="sd"> """</span> +</span><span id="L-4267"><a href="#L-4267"><span class="linenos">4267</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="L-4268"><a href="#L-4268"><span class="linenos">4268</span></a> <span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="L-4269"><a href="#L-4269"><span class="linenos">4269</span></a> <span class="n">db</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="L-4270"><a href="#L-4270"><span class="linenos">4270</span></a> <span class="n">catalog</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">catalog</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="L-4271"><a href="#L-4271"><span class="linenos">4271</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">))</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-4272"><a href="#L-4272"><span class="linenos">4272</span></a> <span class="p">)</span> +</span><span id="L-4273"><a href="#L-4273"><span class="linenos">4273</span></a> +</span><span id="L-4274"><a href="#L-4274"><span class="linenos">4274</span></a> +</span><span id="L-4275"><a href="#L-4275"><span class="linenos">4275</span></a><span class="k">def</span> <span class="nf">values</span><span class="p">(</span> +</span><span id="L-4276"><a href="#L-4276"><span class="linenos">4276</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="o">...</span><span class="p">]],</span> +</span><span id="L-4277"><a href="#L-4277"><span class="linenos">4277</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-4278"><a href="#L-4278"><span class="linenos">4278</span></a> <span class="n">columns</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">DataType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-4279"><a href="#L-4279"><span class="linenos">4279</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Values</span><span class="p">:</span> +</span><span id="L-4280"><a href="#L-4280"><span class="linenos">4280</span></a><span class="w"> </span><span class="sd">"""Build VALUES statement.</span> +</span><span id="L-4281"><a href="#L-4281"><span class="linenos">4281</span></a> +</span><span id="L-4282"><a href="#L-4282"><span class="linenos">4282</span></a><span class="sd"> Example:</span> +</span><span id="L-4283"><a href="#L-4283"><span class="linenos">4283</span></a><span class="sd"> >>> values([(1, '2')]).sql()</span> +</span><span id="L-4284"><a href="#L-4284"><span class="linenos">4284</span></a><span class="sd"> "VALUES (1, '2')"</span> +</span><span id="L-4285"><a href="#L-4285"><span class="linenos">4285</span></a> +</span><span id="L-4286"><a href="#L-4286"><span class="linenos">4286</span></a><span class="sd"> Args:</span> +</span><span id="L-4287"><a href="#L-4287"><span class="linenos">4287</span></a><span class="sd"> values: values statements that will be converted to SQL</span> +</span><span id="L-4288"><a href="#L-4288"><span class="linenos">4288</span></a><span class="sd"> alias: optional alias</span> +</span><span id="L-4289"><a href="#L-4289"><span class="linenos">4289</span></a><span class="sd"> columns: Optional list of ordered column names or ordered dictionary of column names to types.</span> +</span><span id="L-4290"><a href="#L-4290"><span class="linenos">4290</span></a><span class="sd"> If either are provided then an alias is also required.</span> +</span><span id="L-4291"><a href="#L-4291"><span class="linenos">4291</span></a><span class="sd"> If a dictionary is provided then the first column of the values will be casted to the expected type</span> +</span><span id="L-4292"><a href="#L-4292"><span class="linenos">4292</span></a><span class="sd"> in order to help with type inference.</span> +</span><span id="L-4293"><a href="#L-4293"><span class="linenos">4293</span></a> +</span><span id="L-4294"><a href="#L-4294"><span class="linenos">4294</span></a><span class="sd"> Returns:</span> +</span><span id="L-4295"><a href="#L-4295"><span class="linenos">4295</span></a><span class="sd"> Values: the Values expression object</span> +</span><span id="L-4296"><a href="#L-4296"><span class="linenos">4296</span></a><span class="sd"> """</span> +</span><span id="L-4297"><a href="#L-4297"><span class="linenos">4297</span></a> <span class="k">if</span> <span class="n">columns</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-4298"><a href="#L-4298"><span class="linenos">4298</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Alias is required when providing columns"</span><span class="p">)</span> +</span><span id="L-4299"><a href="#L-4299"><span class="linenos">4299</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-4300"><a href="#L-4300"><span class="linenos">4300</span></a> <span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">),</span> <span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">])</span> +</span><span id="L-4301"><a href="#L-4301"><span class="linenos">4301</span></a> <span class="k">if</span> <span class="n">columns</span> +</span><span id="L-4302"><a href="#L-4302"><span class="linenos">4302</span></a> <span class="k">else</span> <span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-4303"><a href="#L-4303"><span class="linenos">4303</span></a> <span class="p">)</span> +</span><span id="L-4304"><a href="#L-4304"><span class="linenos">4304</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">tup</span><span class="p">)</span> <span class="k">for</span> <span class="n">tup</span> <span class="ow">in</span> <span class="n">values</span><span class="p">]</span> +</span><span id="L-4305"><a href="#L-4305"><span class="linenos">4305</span></a> <span class="k">if</span> <span class="n">columns</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="L-4306"><a href="#L-4306"><span class="linenos">4306</span></a> <span class="n">types</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">columns</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="L-4307"><a href="#L-4307"><span class="linenos">4307</span></a> <span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-4308"><a href="#L-4308"><span class="linenos">4308</span></a> <span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="L-4309"><a href="#L-4309"><span class="linenos">4309</span></a> <span class="p">[</span><span class="n">cast</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">types</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span><span class="p">)],</span> +</span><span id="L-4310"><a href="#L-4310"><span class="linenos">4310</span></a> <span class="p">)</span> +</span><span id="L-4311"><a href="#L-4311"><span class="linenos">4311</span></a> <span class="k">return</span> <span class="n">Values</span><span class="p">(</span> +</span><span id="L-4312"><a href="#L-4312"><span class="linenos">4312</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-4313"><a href="#L-4313"><span class="linenos">4313</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">table_alias</span><span class="p">,</span> +</span><span id="L-4314"><a href="#L-4314"><span class="linenos">4314</span></a> <span class="p">)</span> +</span><span id="L-4315"><a href="#L-4315"><span class="linenos">4315</span></a> +</span><span id="L-4316"><a href="#L-4316"><span class="linenos">4316</span></a> +</span><span id="L-4317"><a href="#L-4317"><span class="linenos">4317</span></a><span class="k">def</span> <span class="nf">rename_table</span><span class="p">(</span><span class="n">old_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">,</span> <span class="n">new_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">)</span> <span class="o">-></span> <span class="n">AlterTable</span><span class="p">:</span> +</span><span id="L-4318"><a href="#L-4318"><span class="linenos">4318</span></a><span class="w"> </span><span class="sd">"""Build ALTER TABLE... RENAME... expression</span> +</span><span id="L-4319"><a href="#L-4319"><span class="linenos">4319</span></a> +</span><span id="L-4320"><a href="#L-4320"><span class="linenos">4320</span></a><span class="sd"> Args:</span> +</span><span id="L-4321"><a href="#L-4321"><span class="linenos">4321</span></a><span class="sd"> old_name: The old name of the table</span> +</span><span id="L-4322"><a href="#L-4322"><span class="linenos">4322</span></a><span class="sd"> new_name: The new name of the table</span> +</span><span id="L-4323"><a href="#L-4323"><span class="linenos">4323</span></a> +</span><span id="L-4324"><a href="#L-4324"><span class="linenos">4324</span></a><span class="sd"> Returns:</span> +</span><span id="L-4325"><a href="#L-4325"><span class="linenos">4325</span></a><span class="sd"> Alter table expression</span> +</span><span id="L-4326"><a href="#L-4326"><span class="linenos">4326</span></a><span class="sd"> """</span> +</span><span id="L-4327"><a href="#L-4327"><span class="linenos">4327</span></a> <span class="n">old_table</span> <span class="o">=</span> <span class="n">to_table</span><span class="p">(</span><span class="n">old_name</span><span class="p">)</span> +</span><span id="L-4328"><a href="#L-4328"><span class="linenos">4328</span></a> <span class="n">new_table</span> <span class="o">=</span> <span class="n">to_table</span><span class="p">(</span><span class="n">new_name</span><span class="p">)</span> +</span><span id="L-4329"><a href="#L-4329"><span class="linenos">4329</span></a> <span class="k">return</span> <span class="n">AlterTable</span><span class="p">(</span> +</span><span id="L-4330"><a href="#L-4330"><span class="linenos">4330</span></a> <span class="n">this</span><span class="o">=</span><span class="n">old_table</span><span class="p">,</span> +</span><span id="L-4331"><a href="#L-4331"><span class="linenos">4331</span></a> <span class="n">actions</span><span class="o">=</span><span class="p">[</span> +</span><span id="L-4332"><a href="#L-4332"><span class="linenos">4332</span></a> <span class="n">RenameTable</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">new_table</span><span class="p">),</span> +</span><span id="L-4333"><a href="#L-4333"><span class="linenos">4333</span></a> <span class="p">],</span> +</span><span id="L-4334"><a href="#L-4334"><span class="linenos">4334</span></a> <span class="p">)</span> +</span><span id="L-4335"><a href="#L-4335"><span class="linenos">4335</span></a> +</span><span id="L-4336"><a href="#L-4336"><span class="linenos">4336</span></a> +</span><span id="L-4337"><a href="#L-4337"><span class="linenos">4337</span></a><span class="k">def</span> <span class="nf">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-4338"><a href="#L-4338"><span class="linenos">4338</span></a><span class="w"> </span><span class="sd">"""Convert a python value into an expression object.</span> +</span><span id="L-4339"><a href="#L-4339"><span class="linenos">4339</span></a> +</span><span id="L-4340"><a href="#L-4340"><span class="linenos">4340</span></a><span class="sd"> Raises an error if a conversion is not possible.</span> +</span><span id="L-4341"><a href="#L-4341"><span class="linenos">4341</span></a> +</span><span id="L-4342"><a href="#L-4342"><span class="linenos">4342</span></a><span class="sd"> Args:</span> +</span><span id="L-4343"><a href="#L-4343"><span class="linenos">4343</span></a><span class="sd"> value (Any): a python object</span> +</span><span id="L-4344"><a href="#L-4344"><span class="linenos">4344</span></a> +</span><span id="L-4345"><a href="#L-4345"><span class="linenos">4345</span></a><span class="sd"> Returns:</span> +</span><span id="L-4346"><a href="#L-4346"><span class="linenos">4346</span></a><span class="sd"> Expression: the equivalent expression object</span> +</span><span id="L-4347"><a href="#L-4347"><span class="linenos">4347</span></a><span class="sd"> """</span> +</span><span id="L-4348"><a href="#L-4348"><span class="linenos">4348</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-4349"><a href="#L-4349"><span class="linenos">4349</span></a> <span class="k">return</span> <span class="n">value</span> +</span><span id="L-4350"><a href="#L-4350"><span class="linenos">4350</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-4351"><a href="#L-4351"><span class="linenos">4351</span></a> <span class="k">return</span> <span class="n">NULL</span> +</span><span id="L-4352"><a href="#L-4352"><span class="linenos">4352</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">bool</span><span class="p">):</span> +</span><span id="L-4353"><a href="#L-4353"><span class="linenos">4353</span></a> <span class="k">return</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-4354"><a href="#L-4354"><span class="linenos">4354</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-4355"><a href="#L-4355"><span class="linenos">4355</span></a> <span class="k">return</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-4356"><a href="#L-4356"><span class="linenos">4356</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">float</span><span class="p">)</span> <span class="ow">and</span> <span class="n">math</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="L-4357"><a href="#L-4357"><span class="linenos">4357</span></a> <span class="k">return</span> <span class="n">NULL</span> +</span><span id="L-4358"><a href="#L-4358"><span class="linenos">4358</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">numbers</span><span class="o">.</span><span class="n">Number</span><span class="p">):</span> +</span><span id="L-4359"><a href="#L-4359"><span class="linenos">4359</span></a> <span class="k">return</span> <span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-4360"><a href="#L-4360"><span class="linenos">4360</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">):</span> +</span><span id="L-4361"><a href="#L-4361"><span class="linenos">4361</span></a> <span class="k">return</span> <span class="n">Tuple</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="p">])</span> +</span><span id="L-4362"><a href="#L-4362"><span class="linenos">4362</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-4363"><a href="#L-4363"><span class="linenos">4363</span></a> <span class="k">return</span> <span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="p">])</span> +</span><span id="L-4364"><a href="#L-4364"><span class="linenos">4364</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="L-4365"><a href="#L-4365"><span class="linenos">4365</span></a> <span class="k">return</span> <span class="n">Map</span><span class="p">(</span> +</span><span id="L-4366"><a href="#L-4366"><span class="linenos">4366</span></a> <span class="n">keys</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">value</span><span class="p">],</span> +</span><span id="L-4367"><a href="#L-4367"><span class="linenos">4367</span></a> <span class="n">values</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="o">.</span><span class="n">values</span><span class="p">()],</span> +</span><span id="L-4368"><a href="#L-4368"><span class="linenos">4368</span></a> <span class="p">)</span> +</span><span id="L-4369"><a href="#L-4369"><span class="linenos">4369</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">):</span> +</span><span id="L-4370"><a href="#L-4370"><span class="linenos">4370</span></a> <span class="n">datetime_literal</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="L-4371"><a href="#L-4371"><span class="linenos">4371</span></a> <span class="p">(</span><span class="n">value</span> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">tzinfo</span> <span class="k">else</span> <span class="n">value</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">tzinfo</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">timezone</span><span class="o">.</span><span class="n">utc</span><span class="p">))</span><span class="o">.</span><span class="n">isoformat</span><span class="p">()</span> +</span><span id="L-4372"><a href="#L-4372"><span class="linenos">4372</span></a> <span class="p">)</span> +</span><span id="L-4373"><a href="#L-4373"><span class="linenos">4373</span></a> <span class="k">return</span> <span class="n">TimeStrToTime</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">datetime_literal</span><span class="p">)</span> +</span><span id="L-4374"><a href="#L-4374"><span class="linenos">4374</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="p">):</span> +</span><span id="L-4375"><a href="#L-4375"><span class="linenos">4375</span></a> <span class="n">date_literal</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">"</span><span class="p">))</span> +</span><span id="L-4376"><a href="#L-4376"><span class="linenos">4376</span></a> <span class="k">return</span> <span class="n">DateStrToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">date_literal</span><span class="p">)</span> +</span><span id="L-4377"><a href="#L-4377"><span class="linenos">4377</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Cannot convert </span><span class="si">{</span><span class="n">value</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-4378"><a href="#L-4378"><span class="linenos">4378</span></a> +</span><span id="L-4379"><a href="#L-4379"><span class="linenos">4379</span></a> +</span><span id="L-4380"><a href="#L-4380"><span class="linenos">4380</span></a><span class="k">def</span> <span class="nf">replace_children</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">fun</span><span class="p">):</span> +</span><span id="L-4381"><a href="#L-4381"><span class="linenos">4381</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4382"><a href="#L-4382"><span class="linenos">4382</span></a><span class="sd"> Replace children of an expression with the result of a lambda fun(child) -> exp.</span> +</span><span id="L-4383"><a href="#L-4383"><span class="linenos">4383</span></a><span class="sd"> """</span> +</span><span id="L-4384"><a href="#L-4384"><span class="linenos">4384</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-4385"><a href="#L-4385"><span class="linenos">4385</span></a> <span class="n">is_list_arg</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> +</span><span id="L-4386"><a href="#L-4386"><span class="linenos">4386</span></a> +</span><span id="L-4387"><a href="#L-4387"><span class="linenos">4387</span></a> <span class="n">child_nodes</span> <span class="o">=</span> <span class="n">v</span> <span class="k">if</span> <span class="n">is_list_arg</span> <span class="k">else</span> <span class="p">[</span><span class="n">v</span><span class="p">]</span> +</span><span id="L-4388"><a href="#L-4388"><span class="linenos">4388</span></a> <span class="n">new_child_nodes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-4389"><a href="#L-4389"><span class="linenos">4389</span></a> +</span><span id="L-4390"><a href="#L-4390"><span class="linenos">4390</span></a> <span class="k">for</span> <span class="n">cn</span> <span class="ow">in</span> <span class="n">child_nodes</span><span class="p">:</span> +</span><span id="L-4391"><a href="#L-4391"><span class="linenos">4391</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cn</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-4392"><a href="#L-4392"><span class="linenos">4392</span></a> <span class="k">for</span> <span class="n">child_node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">fun</span><span class="p">(</span><span class="n">cn</span><span class="p">)):</span> +</span><span id="L-4393"><a href="#L-4393"><span class="linenos">4393</span></a> <span class="n">new_child_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">child_node</span><span class="p">)</span> +</span><span id="L-4394"><a href="#L-4394"><span class="linenos">4394</span></a> <span class="n">child_node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="L-4395"><a href="#L-4395"><span class="linenos">4395</span></a> <span class="n">child_node</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">=</span> <span class="n">k</span> +</span><span id="L-4396"><a href="#L-4396"><span class="linenos">4396</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-4397"><a href="#L-4397"><span class="linenos">4397</span></a> <span class="n">new_child_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn</span><span class="p">)</span> +</span><span id="L-4398"><a href="#L-4398"><span class="linenos">4398</span></a> +</span><span id="L-4399"><a href="#L-4399"><span class="linenos">4399</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">new_child_nodes</span> <span class="k">if</span> <span class="n">is_list_arg</span> <span class="k">else</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">new_child_nodes</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-4400"><a href="#L-4400"><span class="linenos">4400</span></a> +</span><span id="L-4401"><a href="#L-4401"><span class="linenos">4401</span></a> +</span><span id="L-4402"><a href="#L-4402"><span class="linenos">4402</span></a><span class="k">def</span> <span class="nf">column_table_names</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-4403"><a href="#L-4403"><span class="linenos">4403</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4404"><a href="#L-4404"><span class="linenos">4404</span></a><span class="sd"> Return all table names referenced through columns in an expression.</span> +</span><span id="L-4405"><a href="#L-4405"><span class="linenos">4405</span></a> +</span><span id="L-4406"><a href="#L-4406"><span class="linenos">4406</span></a><span class="sd"> Example:</span> +</span><span id="L-4407"><a href="#L-4407"><span class="linenos">4407</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-4408"><a href="#L-4408"><span class="linenos">4408</span></a><span class="sd"> >>> column_table_names(sqlglot.parse_one("a.b AND c.d AND c.e"))</span> +</span><span id="L-4409"><a href="#L-4409"><span class="linenos">4409</span></a><span class="sd"> ['c', 'a']</span> +</span><span id="L-4410"><a href="#L-4410"><span class="linenos">4410</span></a> +</span><span id="L-4411"><a href="#L-4411"><span class="linenos">4411</span></a><span class="sd"> Args:</span> +</span><span id="L-4412"><a href="#L-4412"><span class="linenos">4412</span></a><span class="sd"> expression (sqlglot.Expression): expression to find table names</span> +</span><span id="L-4413"><a href="#L-4413"><span class="linenos">4413</span></a> +</span><span id="L-4414"><a href="#L-4414"><span class="linenos">4414</span></a><span class="sd"> Returns:</span> +</span><span id="L-4415"><a href="#L-4415"><span class="linenos">4415</span></a><span class="sd"> list: A list of unique names</span> +</span><span id="L-4416"><a href="#L-4416"><span class="linenos">4416</span></a><span class="sd"> """</span> +</span><span id="L-4417"><a href="#L-4417"><span class="linenos">4417</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="nb">dict</span><span class="o">.</span><span class="n">fromkeys</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">Column</span><span class="p">)))</span> +</span><span id="L-4418"><a href="#L-4418"><span class="linenos">4418</span></a> +</span><span id="L-4419"><a href="#L-4419"><span class="linenos">4419</span></a> +</span><span id="L-4420"><a href="#L-4420"><span class="linenos">4420</span></a><span class="k">def</span> <span class="nf">table_name</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-4421"><a href="#L-4421"><span class="linenos">4421</span></a><span class="w"> </span><span class="sd">"""Get the full name of a table as a string.</span> +</span><span id="L-4422"><a href="#L-4422"><span class="linenos">4422</span></a> +</span><span id="L-4423"><a href="#L-4423"><span class="linenos">4423</span></a><span class="sd"> Args:</span> +</span><span id="L-4424"><a href="#L-4424"><span class="linenos">4424</span></a><span class="sd"> table (exp.Table | str): table expression node or string.</span> +</span><span id="L-4425"><a href="#L-4425"><span class="linenos">4425</span></a> +</span><span id="L-4426"><a href="#L-4426"><span class="linenos">4426</span></a><span class="sd"> Examples:</span> +</span><span id="L-4427"><a href="#L-4427"><span class="linenos">4427</span></a><span class="sd"> >>> from sqlglot import exp, parse_one</span> +</span><span id="L-4428"><a href="#L-4428"><span class="linenos">4428</span></a><span class="sd"> >>> table_name(parse_one("select * from a.b.c").find(exp.Table))</span> +</span><span id="L-4429"><a href="#L-4429"><span class="linenos">4429</span></a><span class="sd"> 'a.b.c'</span> +</span><span id="L-4430"><a href="#L-4430"><span class="linenos">4430</span></a> +</span><span id="L-4431"><a href="#L-4431"><span class="linenos">4431</span></a><span class="sd"> Returns:</span> +</span><span id="L-4432"><a href="#L-4432"><span class="linenos">4432</span></a><span class="sd"> The table name.</span> +</span><span id="L-4433"><a href="#L-4433"><span class="linenos">4433</span></a><span class="sd"> """</span> +</span><span id="L-4434"><a href="#L-4434"><span class="linenos">4434</span></a> +</span><span id="L-4435"><a href="#L-4435"><span class="linenos">4435</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">)</span> +</span><span id="L-4436"><a href="#L-4436"><span class="linenos">4436</span></a> +</span><span id="L-4437"><a href="#L-4437"><span class="linenos">4437</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-4438"><a href="#L-4438"><span class="linenos">4438</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Cannot parse </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-4439"><a href="#L-4439"><span class="linenos">4439</span></a> +</span><span id="L-4440"><a href="#L-4440"><span class="linenos">4440</span></a> <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-4441"><a href="#L-4441"><span class="linenos">4441</span></a> <span class="n">part</span> +</span><span id="L-4442"><a href="#L-4442"><span class="linenos">4442</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="L-4443"><a href="#L-4443"><span class="linenos">4443</span></a> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"catalog"</span><span class="p">),</span> +</span><span id="L-4444"><a href="#L-4444"><span class="linenos">4444</span></a> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"db"</span><span class="p">),</span> +</span><span id="L-4445"><a href="#L-4445"><span class="linenos">4445</span></a> <span class="n">table</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-4446"><a href="#L-4446"><span class="linenos">4446</span></a> <span class="p">)</span> +</span><span id="L-4447"><a href="#L-4447"><span class="linenos">4447</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="L-4448"><a href="#L-4448"><span class="linenos">4448</span></a> <span class="p">)</span> +</span><span id="L-4449"><a href="#L-4449"><span class="linenos">4449</span></a> +</span><span id="L-4450"><a href="#L-4450"><span class="linenos">4450</span></a> +</span><span id="L-4451"><a href="#L-4451"><span class="linenos">4451</span></a><span class="k">def</span> <span class="nf">replace_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">mapping</span><span class="p">):</span> +</span><span id="L-4452"><a href="#L-4452"><span class="linenos">4452</span></a><span class="w"> </span><span class="sd">"""Replace all tables in expression according to the mapping.</span> +</span><span id="L-4453"><a href="#L-4453"><span class="linenos">4453</span></a> +</span><span id="L-4454"><a href="#L-4454"><span class="linenos">4454</span></a><span class="sd"> Args:</span> +</span><span id="L-4455"><a href="#L-4455"><span class="linenos">4455</span></a><span class="sd"> expression (sqlglot.Expression): expression node to be transformed and replaced.</span> +</span><span id="L-4456"><a href="#L-4456"><span class="linenos">4456</span></a><span class="sd"> mapping (Dict[str, str]): mapping of table names.</span> +</span><span id="L-4457"><a href="#L-4457"><span class="linenos">4457</span></a> +</span><span id="L-4458"><a href="#L-4458"><span class="linenos">4458</span></a><span class="sd"> Examples:</span> +</span><span id="L-4459"><a href="#L-4459"><span class="linenos">4459</span></a><span class="sd"> >>> from sqlglot import exp, parse_one</span> +</span><span id="L-4460"><a href="#L-4460"><span class="linenos">4460</span></a><span class="sd"> >>> replace_tables(parse_one("select * from a.b"), {"a.b": "c"}).sql()</span> +</span><span id="L-4461"><a href="#L-4461"><span class="linenos">4461</span></a><span class="sd"> 'SELECT * FROM c'</span> +</span><span id="L-4462"><a href="#L-4462"><span class="linenos">4462</span></a> +</span><span id="L-4463"><a href="#L-4463"><span class="linenos">4463</span></a><span class="sd"> Returns:</span> +</span><span id="L-4464"><a href="#L-4464"><span class="linenos">4464</span></a><span class="sd"> The mapped expression.</span> +</span><span id="L-4465"><a href="#L-4465"><span class="linenos">4465</span></a><span class="sd"> """</span> +</span><span id="L-4466"><a href="#L-4466"><span class="linenos">4466</span></a> +</span><span id="L-4467"><a href="#L-4467"><span class="linenos">4467</span></a> <span class="k">def</span> <span class="nf">_replace_tables</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> +</span><span id="L-4468"><a href="#L-4468"><span class="linenos">4468</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="L-4469"><a href="#L-4469"><span class="linenos">4469</span></a> <span class="n">new_name</span> <span class="o">=</span> <span class="n">mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table_name</span><span class="p">(</span><span class="n">node</span><span class="p">))</span> +</span><span id="L-4470"><a href="#L-4470"><span class="linenos">4470</span></a> <span class="k">if</span> <span class="n">new_name</span><span class="p">:</span> +</span><span id="L-4471"><a href="#L-4471"><span class="linenos">4471</span></a> <span class="k">return</span> <span class="n">to_table</span><span class="p">(</span> +</span><span id="L-4472"><a href="#L-4472"><span class="linenos">4472</span></a> <span class="n">new_name</span><span class="p">,</span> +</span><span id="L-4473"><a href="#L-4473"><span class="linenos">4473</span></a> <span class="o">**</span><span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">v</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">k</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">)},</span> +</span><span id="L-4474"><a href="#L-4474"><span class="linenos">4474</span></a> <span class="p">)</span> +</span><span id="L-4475"><a href="#L-4475"><span class="linenos">4475</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-4476"><a href="#L-4476"><span class="linenos">4476</span></a> +</span><span id="L-4477"><a href="#L-4477"><span class="linenos">4477</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_replace_tables</span><span class="p">)</span> +</span><span id="L-4478"><a href="#L-4478"><span class="linenos">4478</span></a> +</span><span id="L-4479"><a href="#L-4479"><span class="linenos">4479</span></a> +</span><span id="L-4480"><a href="#L-4480"><span class="linenos">4480</span></a><span class="k">def</span> <span class="nf">replace_placeholders</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-4481"><a href="#L-4481"><span class="linenos">4481</span></a><span class="w"> </span><span class="sd">"""Replace placeholders in an expression.</span> +</span><span id="L-4482"><a href="#L-4482"><span class="linenos">4482</span></a> +</span><span id="L-4483"><a href="#L-4483"><span class="linenos">4483</span></a><span class="sd"> Args:</span> +</span><span id="L-4484"><a href="#L-4484"><span class="linenos">4484</span></a><span class="sd"> expression (sqlglot.Expression): expression node to be transformed and replaced.</span> +</span><span id="L-4485"><a href="#L-4485"><span class="linenos">4485</span></a><span class="sd"> args: positional names that will substitute unnamed placeholders in the given order.</span> +</span><span id="L-4486"><a href="#L-4486"><span class="linenos">4486</span></a><span class="sd"> kwargs: keyword arguments that will substitute named placeholders.</span> +</span><span id="L-4487"><a href="#L-4487"><span class="linenos">4487</span></a> +</span><span id="L-4488"><a href="#L-4488"><span class="linenos">4488</span></a><span class="sd"> Examples:</span> +</span><span id="L-4489"><a href="#L-4489"><span class="linenos">4489</span></a><span class="sd"> >>> from sqlglot import exp, parse_one</span> +</span><span id="L-4490"><a href="#L-4490"><span class="linenos">4490</span></a><span class="sd"> >>> replace_placeholders(</span> +</span><span id="L-4491"><a href="#L-4491"><span class="linenos">4491</span></a><span class="sd"> ... parse_one("select * from :tbl where ? = ?"), "a", "b", tbl="foo"</span> +</span><span id="L-4492"><a href="#L-4492"><span class="linenos">4492</span></a><span class="sd"> ... ).sql()</span> +</span><span id="L-4493"><a href="#L-4493"><span class="linenos">4493</span></a><span class="sd"> 'SELECT * FROM foo WHERE a = b'</span> +</span><span id="L-4494"><a href="#L-4494"><span class="linenos">4494</span></a> +</span><span id="L-4495"><a href="#L-4495"><span class="linenos">4495</span></a><span class="sd"> Returns:</span> +</span><span id="L-4496"><a href="#L-4496"><span class="linenos">4496</span></a><span class="sd"> The mapped expression.</span> +</span><span id="L-4497"><a href="#L-4497"><span class="linenos">4497</span></a><span class="sd"> """</span> +</span><span id="L-4498"><a href="#L-4498"><span class="linenos">4498</span></a> +</span><span id="L-4499"><a href="#L-4499"><span class="linenos">4499</span></a> <span class="k">def</span> <span class="nf">_replace_placeholders</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-4500"><a href="#L-4500"><span class="linenos">4500</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Placeholder</span><span class="p">):</span> +</span><span id="L-4501"><a href="#L-4501"><span class="linenos">4501</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> +</span><span id="L-4502"><a href="#L-4502"><span class="linenos">4502</span></a> <span class="n">new_name</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-4503"><a href="#L-4503"><span class="linenos">4503</span></a> <span class="k">if</span> <span class="n">new_name</span><span class="p">:</span> +</span><span id="L-4504"><a href="#L-4504"><span class="linenos">4504</span></a> <span class="k">return</span> <span class="n">to_identifier</span><span class="p">(</span><span class="n">new_name</span><span class="p">)</span> +</span><span id="L-4505"><a href="#L-4505"><span class="linenos">4505</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-4506"><a href="#L-4506"><span class="linenos">4506</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-4507"><a href="#L-4507"><span class="linenos">4507</span></a> <span class="k">return</span> <span class="n">to_identifier</span><span class="p">(</span><span class="nb">next</span><span class="p">(</span><span class="n">args</span><span class="p">))</span> +</span><span id="L-4508"><a href="#L-4508"><span class="linenos">4508</span></a> <span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span> +</span><span id="L-4509"><a href="#L-4509"><span class="linenos">4509</span></a> <span class="k">pass</span> +</span><span id="L-4510"><a href="#L-4510"><span class="linenos">4510</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-4511"><a href="#L-4511"><span class="linenos">4511</span></a> +</span><span id="L-4512"><a href="#L-4512"><span class="linenos">4512</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_replace_placeholders</span><span class="p">,</span> <span class="nb">iter</span><span class="p">(</span><span class="n">args</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-4513"><a href="#L-4513"><span class="linenos">4513</span></a> +</span><span id="L-4514"><a href="#L-4514"><span class="linenos">4514</span></a> +</span><span id="L-4515"><a href="#L-4515"><span class="linenos">4515</span></a><span class="k">def</span> <span class="nf">expand</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">Expression</span><span class="p">,</span> <span class="n">sources</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Subqueryable</span><span class="p">],</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="L-4516"><a href="#L-4516"><span class="linenos">4516</span></a><span class="w"> </span><span class="sd">"""Transforms an expression by expanding all referenced sources into subqueries.</span> +</span><span id="L-4517"><a href="#L-4517"><span class="linenos">4517</span></a> +</span><span id="L-4518"><a href="#L-4518"><span class="linenos">4518</span></a><span class="sd"> Examples:</span> +</span><span id="L-4519"><a href="#L-4519"><span class="linenos">4519</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="L-4520"><a href="#L-4520"><span class="linenos">4520</span></a><span class="sd"> >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y")}).sql()</span> +</span><span id="L-4521"><a href="#L-4521"><span class="linenos">4521</span></a><span class="sd"> 'SELECT * FROM (SELECT * FROM y) AS z /* source: x */'</span> +</span><span id="L-4522"><a href="#L-4522"><span class="linenos">4522</span></a> +</span><span id="L-4523"><a href="#L-4523"><span class="linenos">4523</span></a><span class="sd"> Args:</span> +</span><span id="L-4524"><a href="#L-4524"><span class="linenos">4524</span></a><span class="sd"> expression: The expression to expand.</span> +</span><span id="L-4525"><a href="#L-4525"><span class="linenos">4525</span></a><span class="sd"> sources: A dictionary of name to Subqueryables.</span> +</span><span id="L-4526"><a href="#L-4526"><span class="linenos">4526</span></a><span class="sd"> copy: Whether or not to copy the expression during transformation. Defaults to True.</span> +</span><span id="L-4527"><a href="#L-4527"><span class="linenos">4527</span></a> +</span><span id="L-4528"><a href="#L-4528"><span class="linenos">4528</span></a><span class="sd"> Returns:</span> +</span><span id="L-4529"><a href="#L-4529"><span class="linenos">4529</span></a><span class="sd"> The transformed expression.</span> +</span><span id="L-4530"><a href="#L-4530"><span class="linenos">4530</span></a><span class="sd"> """</span> +</span><span id="L-4531"><a href="#L-4531"><span class="linenos">4531</span></a> +</span><span id="L-4532"><a href="#L-4532"><span class="linenos">4532</span></a> <span class="k">def</span> <span class="nf">_expand</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="L-4533"><a href="#L-4533"><span class="linenos">4533</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="L-4534"><a href="#L-4534"><span class="linenos">4534</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">table_name</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-4535"><a href="#L-4535"><span class="linenos">4535</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-4536"><a href="#L-4536"><span class="linenos">4536</span></a> <span class="k">if</span> <span class="n">source</span><span class="p">:</span> +</span><span id="L-4537"><a href="#L-4537"><span class="linenos">4537</span></a> <span class="n">subquery</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">alias</span> <span class="ow">or</span> <span class="n">name</span><span class="p">)</span> +</span><span id="L-4538"><a href="#L-4538"><span class="linenos">4538</span></a> <span class="n">subquery</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"source: </span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span><span class="p">]</span> +</span><span id="L-4539"><a href="#L-4539"><span class="linenos">4539</span></a> <span class="k">return</span> <span class="n">subquery</span> +</span><span id="L-4540"><a href="#L-4540"><span class="linenos">4540</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-4541"><a href="#L-4541"><span class="linenos">4541</span></a> +</span><span id="L-4542"><a href="#L-4542"><span class="linenos">4542</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_expand</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">)</span> +</span><span id="L-4543"><a href="#L-4543"><span class="linenos">4543</span></a> +</span><span id="L-4544"><a href="#L-4544"><span class="linenos">4544</span></a> +</span><span id="L-4545"><a href="#L-4545"><span class="linenos">4545</span></a><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Func</span><span class="p">:</span> +</span><span id="L-4546"><a href="#L-4546"><span class="linenos">4546</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4547"><a href="#L-4547"><span class="linenos">4547</span></a><span class="sd"> Returns a Func expression.</span> +</span><span id="L-4548"><a href="#L-4548"><span class="linenos">4548</span></a> +</span><span id="L-4549"><a href="#L-4549"><span class="linenos">4549</span></a><span class="sd"> Examples:</span> +</span><span id="L-4550"><a href="#L-4550"><span class="linenos">4550</span></a><span class="sd"> >>> func("abs", 5).sql()</span> +</span><span id="L-4551"><a href="#L-4551"><span class="linenos">4551</span></a><span class="sd"> 'ABS(5)'</span> +</span><span id="L-4552"><a href="#L-4552"><span class="linenos">4552</span></a> +</span><span id="L-4553"><a href="#L-4553"><span class="linenos">4553</span></a><span class="sd"> >>> func("cast", this=5, to=DataType.build("DOUBLE")).sql()</span> +</span><span id="L-4554"><a href="#L-4554"><span class="linenos">4554</span></a><span class="sd"> 'CAST(5 AS DOUBLE)'</span> +</span><span id="L-4555"><a href="#L-4555"><span class="linenos">4555</span></a> +</span><span id="L-4556"><a href="#L-4556"><span class="linenos">4556</span></a><span class="sd"> Args:</span> +</span><span id="L-4557"><a href="#L-4557"><span class="linenos">4557</span></a><span class="sd"> name: the name of the function to build.</span> +</span><span id="L-4558"><a href="#L-4558"><span class="linenos">4558</span></a><span class="sd"> args: the args used to instantiate the function of interest.</span> +</span><span id="L-4559"><a href="#L-4559"><span class="linenos">4559</span></a><span class="sd"> dialect: the source dialect.</span> +</span><span id="L-4560"><a href="#L-4560"><span class="linenos">4560</span></a><span class="sd"> kwargs: the kwargs used to instantiate the function of interest.</span> +</span><span id="L-4561"><a href="#L-4561"><span class="linenos">4561</span></a> +</span><span id="L-4562"><a href="#L-4562"><span class="linenos">4562</span></a><span class="sd"> Note:</span> +</span><span id="L-4563"><a href="#L-4563"><span class="linenos">4563</span></a><span class="sd"> The arguments `args` and `kwargs` are mutually exclusive.</span> +</span><span id="L-4564"><a href="#L-4564"><span class="linenos">4564</span></a> +</span><span id="L-4565"><a href="#L-4565"><span class="linenos">4565</span></a><span class="sd"> Returns:</span> +</span><span id="L-4566"><a href="#L-4566"><span class="linenos">4566</span></a><span class="sd"> An instance of the function of interest, or an anonymous function, if `name` doesn't</span> +</span><span id="L-4567"><a href="#L-4567"><span class="linenos">4567</span></a><span class="sd"> correspond to an existing `sqlglot.expressions.Func` class.</span> +</span><span id="L-4568"><a href="#L-4568"><span class="linenos">4568</span></a><span class="sd"> """</span> +</span><span id="L-4569"><a href="#L-4569"><span class="linenos">4569</span></a> <span class="k">if</span> <span class="n">args</span> <span class="ow">and</span> <span class="n">kwargs</span><span class="p">:</span> +</span><span id="L-4570"><a href="#L-4570"><span class="linenos">4570</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Can't use both args and kwargs to instantiate a function."</span><span class="p">)</span> +</span><span id="L-4571"><a href="#L-4571"><span class="linenos">4571</span></a> +</span><span id="L-4572"><a href="#L-4572"><span class="linenos">4572</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="L-4573"><a href="#L-4573"><span class="linenos">4573</span></a> +</span><span id="L-4574"><a href="#L-4574"><span class="linenos">4574</span></a> <span class="n">args</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">convert</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-4575"><a href="#L-4575"><span class="linenos">4575</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="n">key</span><span class="p">:</span> <span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="L-4576"><a href="#L-4576"><span class="linenos">4576</span></a> +</span><span id="L-4577"><a href="#L-4577"><span class="linenos">4577</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">dialect</span><span class="p">)()</span><span class="o">.</span><span class="n">parser</span><span class="p">()</span> +</span><span id="L-4578"><a href="#L-4578"><span class="linenos">4578</span></a> <span class="n">from_args_list</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="L-4579"><a href="#L-4579"><span class="linenos">4579</span></a> +</span><span id="L-4580"><a href="#L-4580"><span class="linenos">4580</span></a> <span class="k">if</span> <span class="n">from_args_list</span><span class="p">:</span> +</span><span id="L-4581"><a href="#L-4581"><span class="linenos">4581</span></a> <span class="n">function</span> <span class="o">=</span> <span class="n">from_args_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="k">if</span> <span class="n">args</span> <span class="k">else</span> <span class="n">from_args_list</span><span class="o">.</span><span class="vm">__self__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-4582"><a href="#L-4582"><span class="linenos">4582</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-4583"><a href="#L-4583"><span class="linenos">4583</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="n">kwargs</span> <span class="ow">or</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="n">args</span><span class="p">}</span> +</span><span id="L-4584"><a href="#L-4584"><span class="linenos">4584</span></a> <span class="n">function</span> <span class="o">=</span> <span class="n">Anonymous</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-4585"><a href="#L-4585"><span class="linenos">4585</span></a> +</span><span id="L-4586"><a href="#L-4586"><span class="linenos">4586</span></a> <span class="k">for</span> <span class="n">error_message</span> <span class="ow">in</span> <span class="n">function</span><span class="o">.</span><span class="n">error_messages</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-4587"><a href="#L-4587"><span class="linenos">4587</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_message</span><span class="p">)</span> +</span><span id="L-4588"><a href="#L-4588"><span class="linenos">4588</span></a> +</span><span id="L-4589"><a href="#L-4589"><span class="linenos">4589</span></a> <span class="k">return</span> <span class="n">function</span> +</span><span id="L-4590"><a href="#L-4590"><span class="linenos">4590</span></a> +</span><span id="L-4591"><a href="#L-4591"><span class="linenos">4591</span></a> +</span><span id="L-4592"><a href="#L-4592"><span class="linenos">4592</span></a><span class="k">def</span> <span class="nf">true</span><span class="p">():</span> +</span><span id="L-4593"><a href="#L-4593"><span class="linenos">4593</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4594"><a href="#L-4594"><span class="linenos">4594</span></a><span class="sd"> Returns a true Boolean expression.</span> +</span><span id="L-4595"><a href="#L-4595"><span class="linenos">4595</span></a><span class="sd"> """</span> +</span><span id="L-4596"><a href="#L-4596"><span class="linenos">4596</span></a> <span class="k">return</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-4597"><a href="#L-4597"><span class="linenos">4597</span></a> +</span><span id="L-4598"><a href="#L-4598"><span class="linenos">4598</span></a> +</span><span id="L-4599"><a href="#L-4599"><span class="linenos">4599</span></a><span class="k">def</span> <span class="nf">false</span><span class="p">():</span> +</span><span id="L-4600"><a href="#L-4600"><span class="linenos">4600</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4601"><a href="#L-4601"><span class="linenos">4601</span></a><span class="sd"> Returns a false Boolean expression.</span> +</span><span id="L-4602"><a href="#L-4602"><span class="linenos">4602</span></a><span class="sd"> """</span> +</span><span id="L-4603"><a href="#L-4603"><span class="linenos">4603</span></a> <span class="k">return</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-4604"><a href="#L-4604"><span class="linenos">4604</span></a> +</span><span id="L-4605"><a href="#L-4605"><span class="linenos">4605</span></a> +</span><span id="L-4606"><a href="#L-4606"><span class="linenos">4606</span></a><span class="k">def</span> <span class="nf">null</span><span class="p">():</span> +</span><span id="L-4607"><a href="#L-4607"><span class="linenos">4607</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-4608"><a href="#L-4608"><span class="linenos">4608</span></a><span class="sd"> Returns a Null expression.</span> +</span><span id="L-4609"><a href="#L-4609"><span class="linenos">4609</span></a><span class="sd"> """</span> +</span><span id="L-4610"><a href="#L-4610"><span class="linenos">4610</span></a> <span class="k">return</span> <span class="n">Null</span><span class="p">()</span> +</span><span id="L-4611"><a href="#L-4611"><span class="linenos">4611</span></a> +</span><span id="L-4612"><a href="#L-4612"><span class="linenos">4612</span></a> +</span><span id="L-4613"><a href="#L-4613"><span class="linenos">4613</span></a><span class="c1"># TODO: deprecate this</span> +</span><span id="L-4614"><a href="#L-4614"><span class="linenos">4614</span></a><span class="n">TRUE</span> <span class="o">=</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-4615"><a href="#L-4615"><span class="linenos">4615</span></a><span class="n">FALSE</span> <span class="o">=</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-4616"><a href="#L-4616"><span class="linenos">4616</span></a><span class="n">NULL</span> <span class="o">=</span> <span class="n">Null</span><span class="p">()</span> +</span></pre></div> + + + </section> + <section id="Expression"> + <input id="Expression-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Expression</span>: + + <label class="view-source-button" for="Expression-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression-54"><a href="#Expression-54"><span class="linenos"> 54</span></a><span class="k">class</span> <span class="nc">Expression</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Expression</span><span class="p">):</span> +</span><span id="Expression-55"><a href="#Expression-55"><span class="linenos"> 55</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-56"><a href="#Expression-56"><span class="linenos"> 56</span></a><span class="sd"> The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary</span> +</span><span id="Expression-57"><a href="#Expression-57"><span class="linenos"> 57</span></a><span class="sd"> context, such as its child expressions, their names (arg keys), and whether a given child expression</span> +</span><span id="Expression-58"><a href="#Expression-58"><span class="linenos"> 58</span></a><span class="sd"> is optional or not.</span> +</span><span id="Expression-59"><a href="#Expression-59"><span class="linenos"> 59</span></a> +</span><span id="Expression-60"><a href="#Expression-60"><span class="linenos"> 60</span></a><span class="sd"> Attributes:</span> +</span><span id="Expression-61"><a href="#Expression-61"><span class="linenos"> 61</span></a><span class="sd"> key: a unique key for each class in the Expression hierarchy. This is useful for hashing</span> +</span><span id="Expression-62"><a href="#Expression-62"><span class="linenos"> 62</span></a><span class="sd"> and representing expressions as strings.</span> +</span><span id="Expression-63"><a href="#Expression-63"><span class="linenos"> 63</span></a><span class="sd"> arg_types: determines what arguments (child nodes) are supported by an expression. It</span> +</span><span id="Expression-64"><a href="#Expression-64"><span class="linenos"> 64</span></a><span class="sd"> maps arg keys to booleans that indicate whether the corresponding args are optional.</span> +</span><span id="Expression-65"><a href="#Expression-65"><span class="linenos"> 65</span></a> +</span><span id="Expression-66"><a href="#Expression-66"><span class="linenos"> 66</span></a><span class="sd"> Example:</span> +</span><span id="Expression-67"><a href="#Expression-67"><span class="linenos"> 67</span></a><span class="sd"> >>> class Foo(Expression):</span> +</span><span id="Expression-68"><a href="#Expression-68"><span class="linenos"> 68</span></a><span class="sd"> ... arg_types = {"this": True, "expression": False}</span> +</span><span id="Expression-69"><a href="#Expression-69"><span class="linenos"> 69</span></a> +</span><span id="Expression-70"><a href="#Expression-70"><span class="linenos"> 70</span></a><span class="sd"> The above definition informs us that Foo is an Expression that requires an argument called</span> +</span><span id="Expression-71"><a href="#Expression-71"><span class="linenos"> 71</span></a><span class="sd"> "this" and may also optionally receive an argument called "expression".</span> +</span><span id="Expression-72"><a href="#Expression-72"><span class="linenos"> 72</span></a> +</span><span id="Expression-73"><a href="#Expression-73"><span class="linenos"> 73</span></a><span class="sd"> Args:</span> +</span><span id="Expression-74"><a href="#Expression-74"><span class="linenos"> 74</span></a><span class="sd"> args: a mapping used for retrieving the arguments of an expression, given their arg keys.</span> +</span><span id="Expression-75"><a href="#Expression-75"><span class="linenos"> 75</span></a><span class="sd"> parent: a reference to the parent expression (or None, in case of root expressions).</span> +</span><span id="Expression-76"><a href="#Expression-76"><span class="linenos"> 76</span></a><span class="sd"> arg_key: the arg key an expression is associated with, i.e. the name its parent expression</span> +</span><span id="Expression-77"><a href="#Expression-77"><span class="linenos"> 77</span></a><span class="sd"> uses to refer to it.</span> +</span><span id="Expression-78"><a href="#Expression-78"><span class="linenos"> 78</span></a><span class="sd"> comments: a list of comments that are associated with a given expression. This is used in</span> +</span><span id="Expression-79"><a href="#Expression-79"><span class="linenos"> 79</span></a><span class="sd"> order to preserve comments when transpiling SQL code.</span> +</span><span id="Expression-80"><a href="#Expression-80"><span class="linenos"> 80</span></a><span class="sd"> _type: the `sqlglot.expressions.DataType` type of an expression. This is inferred by the</span> +</span><span id="Expression-81"><a href="#Expression-81"><span class="linenos"> 81</span></a><span class="sd"> optimizer, in order to enable some transformations that require type information.</span> +</span><span id="Expression-82"><a href="#Expression-82"><span class="linenos"> 82</span></a><span class="sd"> """</span> +</span><span id="Expression-83"><a href="#Expression-83"><span class="linenos"> 83</span></a> +</span><span id="Expression-84"><a href="#Expression-84"><span class="linenos"> 84</span></a> <span class="n">key</span> <span class="o">=</span> <span class="s2">"expression"</span> +</span><span id="Expression-85"><a href="#Expression-85"><span class="linenos"> 85</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Expression-86"><a href="#Expression-86"><span class="linenos"> 86</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"args"</span><span class="p">,</span> <span class="s2">"parent"</span><span class="p">,</span> <span class="s2">"arg_key"</span><span class="p">,</span> <span class="s2">"comments"</span><span class="p">,</span> <span class="s2">"_type"</span><span class="p">)</span> +</span><span id="Expression-87"><a href="#Expression-87"><span class="linenos"> 87</span></a> +</span><span id="Expression-88"><a href="#Expression-88"><span class="linenos"> 88</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="Expression-89"><a href="#Expression-89"><span class="linenos"> 89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="n">args</span> +</span><span id="Expression-90"><a href="#Expression-90"><span class="linenos"> 90</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression-91"><a href="#Expression-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression-92"><a href="#Expression-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression-93"><a href="#Expression-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression-94"><a href="#Expression-94"><span class="linenos"> 94</span></a> +</span><span id="Expression-95"><a href="#Expression-95"><span class="linenos"> 95</span></a> <span class="k">for</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression-96"><a href="#Expression-96"><span class="linenos"> 96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Expression-97"><a href="#Expression-97"><span class="linenos"> 97</span></a> +</span><span id="Expression-98"><a href="#Expression-98"><span class="linenos"> 98</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Expression-99"><a href="#Expression-99"><span class="linenos"> 99</span></a> <span class="k">return</span> <span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="ow">is</span> <span class="nb">type</span><span class="p">(</span><span class="n">other</span><span class="p">)</span> <span class="ow">and</span> <span class="n">_norm_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">==</span> <span class="n">_norm_args</span><span class="p">(</span><span class="n">other</span><span class="p">)</span> +</span><span id="Expression-100"><a href="#Expression-100"><span class="linenos">100</span></a> +</span><span id="Expression-101"><a href="#Expression-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="Expression-102"><a href="#Expression-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">(</span> +</span><span id="Expression-103"><a href="#Expression-103"><span class="linenos">103</span></a> <span class="p">(</span> +</span><span id="Expression-104"><a href="#Expression-104"><span class="linenos">104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">,</span> +</span><span id="Expression-105"><a href="#Expression-105"><span class="linenos">105</span></a> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="Expression-106"><a href="#Expression-106"><span class="linenos">106</span></a> <span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="k">else</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">_norm_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Expression-107"><a href="#Expression-107"><span class="linenos">107</span></a> <span class="p">),</span> +</span><span id="Expression-108"><a href="#Expression-108"><span class="linenos">108</span></a> <span class="p">)</span> +</span><span id="Expression-109"><a href="#Expression-109"><span class="linenos">109</span></a> <span class="p">)</span> +</span><span id="Expression-110"><a href="#Expression-110"><span class="linenos">110</span></a> +</span><span id="Expression-111"><a href="#Expression-111"><span class="linenos">111</span></a> <span class="nd">@property</span> +</span><span id="Expression-112"><a href="#Expression-112"><span class="linenos">112</span></a> <span class="k">def</span> <span class="nf">this</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-113"><a href="#Expression-113"><span class="linenos">113</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-114"><a href="#Expression-114"><span class="linenos">114</span></a><span class="sd"> Retrieves the argument with key "this".</span> +</span><span id="Expression-115"><a href="#Expression-115"><span class="linenos">115</span></a><span class="sd"> """</span> +</span><span id="Expression-116"><a href="#Expression-116"><span class="linenos">116</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="Expression-117"><a href="#Expression-117"><span class="linenos">117</span></a> +</span><span id="Expression-118"><a href="#Expression-118"><span class="linenos">118</span></a> <span class="nd">@property</span> +</span><span id="Expression-119"><a href="#Expression-119"><span class="linenos">119</span></a> <span class="k">def</span> <span class="nf">expression</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-120"><a href="#Expression-120"><span class="linenos">120</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-121"><a href="#Expression-121"><span class="linenos">121</span></a><span class="sd"> Retrieves the argument with key "expression".</span> +</span><span id="Expression-122"><a href="#Expression-122"><span class="linenos">122</span></a><span class="sd"> """</span> +</span><span id="Expression-123"><a href="#Expression-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Expression-124"><a href="#Expression-124"><span class="linenos">124</span></a> +</span><span id="Expression-125"><a href="#Expression-125"><span class="linenos">125</span></a> <span class="nd">@property</span> +</span><span id="Expression-126"><a href="#Expression-126"><span class="linenos">126</span></a> <span class="k">def</span> <span class="nf">expressions</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-127"><a href="#Expression-127"><span class="linenos">127</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-128"><a href="#Expression-128"><span class="linenos">128</span></a><span class="sd"> Retrieves the argument with key "expressions".</span> +</span><span id="Expression-129"><a href="#Expression-129"><span class="linenos">129</span></a><span class="sd"> """</span> +</span><span id="Expression-130"><a href="#Expression-130"><span class="linenos">130</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="Expression-131"><a href="#Expression-131"><span class="linenos">131</span></a> +</span><span id="Expression-132"><a href="#Expression-132"><span class="linenos">132</span></a> <span class="k">def</span> <span class="nf">text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="Expression-133"><a href="#Expression-133"><span class="linenos">133</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-134"><a href="#Expression-134"><span class="linenos">134</span></a><span class="sd"> Returns a textual representation of the argument corresponding to "key". This can only be used</span> +</span><span id="Expression-135"><a href="#Expression-135"><span class="linenos">135</span></a><span class="sd"> for args that are strings or leaf Expression instances, such as identifiers and literals.</span> +</span><span id="Expression-136"><a href="#Expression-136"><span class="linenos">136</span></a><span class="sd"> """</span> +</span><span id="Expression-137"><a href="#Expression-137"><span class="linenos">137</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="Expression-138"><a href="#Expression-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Expression-139"><a href="#Expression-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">field</span> +</span><span id="Expression-140"><a href="#Expression-140"><span class="linenos">140</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="p">(</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">Literal</span><span class="p">,</span> <span class="n">Var</span><span class="p">)):</span> +</span><span id="Expression-141"><a href="#Expression-141"><span class="linenos">141</span></a> <span class="k">return</span> <span class="n">field</span><span class="o">.</span><span class="n">this</span> +</span><span id="Expression-142"><a href="#Expression-142"><span class="linenos">142</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="p">(</span><span class="n">Star</span><span class="p">,</span> <span class="n">Null</span><span class="p">)):</span> +</span><span id="Expression-143"><a href="#Expression-143"><span class="linenos">143</span></a> <span class="k">return</span> <span class="n">field</span><span class="o">.</span><span class="n">name</span> +</span><span id="Expression-144"><a href="#Expression-144"><span class="linenos">144</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Expression-145"><a href="#Expression-145"><span class="linenos">145</span></a> +</span><span id="Expression-146"><a href="#Expression-146"><span class="linenos">146</span></a> <span class="nd">@property</span> +</span><span id="Expression-147"><a href="#Expression-147"><span class="linenos">147</span></a> <span class="k">def</span> <span class="nf">is_string</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-148"><a href="#Expression-148"><span class="linenos">148</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-149"><a href="#Expression-149"><span class="linenos">149</span></a><span class="sd"> Checks whether a Literal expression is a string.</span> +</span><span id="Expression-150"><a href="#Expression-150"><span class="linenos">150</span></a><span class="sd"> """</span> +</span><span id="Expression-151"><a href="#Expression-151"><span class="linenos">151</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Literal</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> +</span><span id="Expression-152"><a href="#Expression-152"><span class="linenos">152</span></a> +</span><span id="Expression-153"><a href="#Expression-153"><span class="linenos">153</span></a> <span class="nd">@property</span> +</span><span id="Expression-154"><a href="#Expression-154"><span class="linenos">154</span></a> <span class="k">def</span> <span class="nf">is_number</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-155"><a href="#Expression-155"><span class="linenos">155</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-156"><a href="#Expression-156"><span class="linenos">156</span></a><span class="sd"> Checks whether a Literal expression is a number.</span> +</span><span id="Expression-157"><a href="#Expression-157"><span class="linenos">157</span></a><span class="sd"> """</span> +</span><span id="Expression-158"><a href="#Expression-158"><span class="linenos">158</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Literal</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> +</span><span id="Expression-159"><a href="#Expression-159"><span class="linenos">159</span></a> +</span><span id="Expression-160"><a href="#Expression-160"><span class="linenos">160</span></a> <span class="nd">@property</span> +</span><span id="Expression-161"><a href="#Expression-161"><span class="linenos">161</span></a> <span class="k">def</span> <span class="nf">is_int</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-162"><a href="#Expression-162"><span class="linenos">162</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-163"><a href="#Expression-163"><span class="linenos">163</span></a><span class="sd"> Checks whether a Literal expression is an integer.</span> +</span><span id="Expression-164"><a href="#Expression-164"><span class="linenos">164</span></a><span class="sd"> """</span> +</span><span id="Expression-165"><a href="#Expression-165"><span class="linenos">165</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span> +</span><span id="Expression-166"><a href="#Expression-166"><span class="linenos">166</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Expression-167"><a href="#Expression-167"><span class="linenos">167</span></a> <span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="Expression-168"><a href="#Expression-168"><span class="linenos">168</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Expression-169"><a href="#Expression-169"><span class="linenos">169</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="Expression-170"><a href="#Expression-170"><span class="linenos">170</span></a> <span class="k">pass</span> +</span><span id="Expression-171"><a href="#Expression-171"><span class="linenos">171</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="Expression-172"><a href="#Expression-172"><span class="linenos">172</span></a> +</span><span id="Expression-173"><a href="#Expression-173"><span class="linenos">173</span></a> <span class="nd">@property</span> +</span><span id="Expression-174"><a href="#Expression-174"><span class="linenos">174</span></a> <span class="k">def</span> <span class="nf">alias</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-175"><a href="#Expression-175"><span class="linenos">175</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-176"><a href="#Expression-176"><span class="linenos">176</span></a><span class="sd"> Returns the alias of the expression, or an empty string if it's not aliased.</span> +</span><span id="Expression-177"><a href="#Expression-177"><span class="linenos">177</span></a><span class="sd"> """</span> +</span><span id="Expression-178"><a href="#Expression-178"><span class="linenos">178</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">TableAlias</span><span class="p">):</span> +</span><span id="Expression-179"><a href="#Expression-179"><span class="linenos">179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span><span class="o">.</span><span class="n">name</span> +</span><span id="Expression-180"><a href="#Expression-180"><span class="linenos">180</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Expression-181"><a href="#Expression-181"><span class="linenos">181</span></a> +</span><span id="Expression-182"><a href="#Expression-182"><span class="linenos">182</span></a> <span class="nd">@property</span> +</span><span id="Expression-183"><a href="#Expression-183"><span class="linenos">183</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Expression-184"><a href="#Expression-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="Expression-185"><a href="#Expression-185"><span class="linenos">185</span></a> +</span><span id="Expression-186"><a href="#Expression-186"><span class="linenos">186</span></a> <span class="nd">@property</span> +</span><span id="Expression-187"><a href="#Expression-187"><span class="linenos">187</span></a> <span class="k">def</span> <span class="nf">alias_or_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-188"><a href="#Expression-188"><span class="linenos">188</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="Expression-189"><a href="#Expression-189"><span class="linenos">189</span></a> +</span><span id="Expression-190"><a href="#Expression-190"><span class="linenos">190</span></a> <span class="nd">@property</span> +</span><span id="Expression-191"><a href="#Expression-191"><span class="linenos">191</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-192"><a href="#Expression-192"><span class="linenos">192</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-193"><a href="#Expression-193"><span class="linenos">193</span></a><span class="sd"> Name of the output column if this expression is a selection.</span> +</span><span id="Expression-194"><a href="#Expression-194"><span class="linenos">194</span></a> +</span><span id="Expression-195"><a href="#Expression-195"><span class="linenos">195</span></a><span class="sd"> If the Expression has no output name, an empty string is returned.</span> +</span><span id="Expression-196"><a href="#Expression-196"><span class="linenos">196</span></a> +</span><span id="Expression-197"><a href="#Expression-197"><span class="linenos">197</span></a><span class="sd"> Example:</span> +</span><span id="Expression-198"><a href="#Expression-198"><span class="linenos">198</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="Expression-199"><a href="#Expression-199"><span class="linenos">199</span></a><span class="sd"> >>> parse_one("SELECT a").expressions[0].output_name</span> +</span><span id="Expression-200"><a href="#Expression-200"><span class="linenos">200</span></a><span class="sd"> 'a'</span> +</span><span id="Expression-201"><a href="#Expression-201"><span class="linenos">201</span></a><span class="sd"> >>> parse_one("SELECT b AS c").expressions[0].output_name</span> +</span><span id="Expression-202"><a href="#Expression-202"><span class="linenos">202</span></a><span class="sd"> 'c'</span> +</span><span id="Expression-203"><a href="#Expression-203"><span class="linenos">203</span></a><span class="sd"> >>> parse_one("SELECT 1 + 2").expressions[0].output_name</span> +</span><span id="Expression-204"><a href="#Expression-204"><span class="linenos">204</span></a><span class="sd"> ''</span> +</span><span id="Expression-205"><a href="#Expression-205"><span class="linenos">205</span></a><span class="sd"> """</span> +</span><span id="Expression-206"><a href="#Expression-206"><span class="linenos">206</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Expression-207"><a href="#Expression-207"><span class="linenos">207</span></a> +</span><span id="Expression-208"><a href="#Expression-208"><span class="linenos">208</span></a> <span class="nd">@property</span> +</span><span id="Expression-209"><a href="#Expression-209"><span class="linenos">209</span></a> <span class="k">def</span> <span class="nf">type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span><span class="p">]:</span> +</span><span id="Expression-210"><a href="#Expression-210"><span class="linenos">210</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span> +</span><span id="Expression-211"><a href="#Expression-211"><span class="linenos">211</span></a> +</span><span id="Expression-212"><a href="#Expression-212"><span class="linenos">212</span></a> <span class="nd">@type</span><span class="o">.</span><span class="n">setter</span> +</span><span id="Expression-213"><a href="#Expression-213"><span class="linenos">213</span></a> <span class="k">def</span> <span class="nf">type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span> <span class="o">|</span> <span class="nb">str</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Expression-214"><a href="#Expression-214"><span class="linenos">214</span></a> <span class="k">if</span> <span class="n">dtype</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="Expression-215"><a href="#Expression-215"><span class="linenos">215</span></a> <span class="n">dtype</span> <span class="o">=</span> <span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> +</span><span id="Expression-216"><a href="#Expression-216"><span class="linenos">216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span> <span class="o">=</span> <span class="n">dtype</span> <span class="c1"># type: ignore</span> +</span><span id="Expression-217"><a href="#Expression-217"><span class="linenos">217</span></a> +</span><span id="Expression-218"><a href="#Expression-218"><span class="linenos">218</span></a> <span class="k">def</span> <span class="nf">__deepcopy__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">memo</span><span class="p">):</span> +</span><span id="Expression-219"><a href="#Expression-219"><span class="linenos">219</span></a> <span class="n">copy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="o">**</span><span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">))</span> +</span><span id="Expression-220"><a href="#Expression-220"><span class="linenos">220</span></a> <span class="n">copy</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> +</span><span id="Expression-221"><a href="#Expression-221"><span class="linenos">221</span></a> <span class="n">copy</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span> +</span><span id="Expression-222"><a href="#Expression-222"><span class="linenos">222</span></a> <span class="k">return</span> <span class="n">copy</span> +</span><span id="Expression-223"><a href="#Expression-223"><span class="linenos">223</span></a> +</span><span id="Expression-224"><a href="#Expression-224"><span class="linenos">224</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-225"><a href="#Expression-225"><span class="linenos">225</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-226"><a href="#Expression-226"><span class="linenos">226</span></a><span class="sd"> Returns a deep copy of the expression.</span> +</span><span id="Expression-227"><a href="#Expression-227"><span class="linenos">227</span></a><span class="sd"> """</span> +</span><span id="Expression-228"><a href="#Expression-228"><span class="linenos">228</span></a> <span class="n">new</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Expression-229"><a href="#Expression-229"><span class="linenos">229</span></a> <span class="n">new</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression-230"><a href="#Expression-230"><span class="linenos">230</span></a> <span class="k">for</span> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">new</span><span class="o">.</span><span class="n">bfs</span><span class="p">():</span> +</span><span id="Expression-231"><a href="#Expression-231"><span class="linenos">231</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Expression</span><span class="p">)</span> <span class="ow">and</span> <span class="n">parent</span><span class="p">:</span> +</span><span id="Expression-232"><a href="#Expression-232"><span class="linenos">232</span></a> <span class="n">item</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> +</span><span id="Expression-233"><a href="#Expression-233"><span class="linenos">233</span></a> <span class="k">return</span> <span class="n">new</span> +</span><span id="Expression-234"><a href="#Expression-234"><span class="linenos">234</span></a> +</span><span id="Expression-235"><a href="#Expression-235"><span class="linenos">235</span></a> <span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="Expression-236"><a href="#Expression-236"><span class="linenos">236</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-237"><a href="#Expression-237"><span class="linenos">237</span></a><span class="sd"> Appends value to arg_key if it's a list or sets it as a new list.</span> +</span><span id="Expression-238"><a href="#Expression-238"><span class="linenos">238</span></a> +</span><span id="Expression-239"><a href="#Expression-239"><span class="linenos">239</span></a><span class="sd"> Args:</span> +</span><span id="Expression-240"><a href="#Expression-240"><span class="linenos">240</span></a><span class="sd"> arg_key (str): name of the list expression arg</span> +</span><span id="Expression-241"><a href="#Expression-241"><span class="linenos">241</span></a><span class="sd"> value (Any): value to append to the list</span> +</span><span id="Expression-242"><a href="#Expression-242"><span class="linenos">242</span></a><span class="sd"> """</span> +</span><span id="Expression-243"><a href="#Expression-243"><span class="linenos">243</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg_key</span><span class="p">),</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="Expression-244"><a href="#Expression-244"><span class="linenos">244</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Expression-245"><a href="#Expression-245"><span class="linenos">245</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Expression-246"><a href="#Expression-246"><span class="linenos">246</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Expression-247"><a href="#Expression-247"><span class="linenos">247</span></a> +</span><span id="Expression-248"><a href="#Expression-248"><span class="linenos">248</span></a> <span class="k">def</span> <span class="nf">set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="Expression-249"><a href="#Expression-249"><span class="linenos">249</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-250"><a href="#Expression-250"><span class="linenos">250</span></a><span class="sd"> Sets `arg_key` to `value`.</span> +</span><span id="Expression-251"><a href="#Expression-251"><span class="linenos">251</span></a> +</span><span id="Expression-252"><a href="#Expression-252"><span class="linenos">252</span></a><span class="sd"> Args:</span> +</span><span id="Expression-253"><a href="#Expression-253"><span class="linenos">253</span></a><span class="sd"> arg_key (str): name of the expression arg.</span> +</span><span id="Expression-254"><a href="#Expression-254"><span class="linenos">254</span></a><span class="sd"> value: value to set the arg to.</span> +</span><span id="Expression-255"><a href="#Expression-255"><span class="linenos">255</span></a><span class="sd"> """</span> +</span><span id="Expression-256"><a href="#Expression-256"><span class="linenos">256</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="Expression-257"><a href="#Expression-257"><span class="linenos">257</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span><span id="Expression-258"><a href="#Expression-258"><span class="linenos">258</span></a> +</span><span id="Expression-259"><a href="#Expression-259"><span class="linenos">259</span></a> <span class="k">def</span> <span class="nf">_set_parent</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="Expression-260"><a href="#Expression-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression-261"><a href="#Expression-261"><span class="linenos">261</span></a> <span class="n">value</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="Expression-262"><a href="#Expression-262"><span class="linenos">262</span></a> <span class="n">value</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">=</span> <span class="n">arg_key</span> +</span><span id="Expression-263"><a href="#Expression-263"><span class="linenos">263</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="Expression-264"><a href="#Expression-264"><span class="linenos">264</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="p">:</span> +</span><span id="Expression-265"><a href="#Expression-265"><span class="linenos">265</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression-266"><a href="#Expression-266"><span class="linenos">266</span></a> <span class="n">v</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="Expression-267"><a href="#Expression-267"><span class="linenos">267</span></a> <span class="n">v</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">=</span> <span class="n">arg_key</span> +</span><span id="Expression-268"><a href="#Expression-268"><span class="linenos">268</span></a> +</span><span id="Expression-269"><a href="#Expression-269"><span class="linenos">269</span></a> <span class="nd">@property</span> +</span><span id="Expression-270"><a href="#Expression-270"><span class="linenos">270</span></a> <span class="k">def</span> <span class="nf">depth</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-271"><a href="#Expression-271"><span class="linenos">271</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-272"><a href="#Expression-272"><span class="linenos">272</span></a><span class="sd"> Returns the depth of this tree.</span> +</span><span id="Expression-273"><a href="#Expression-273"><span class="linenos">273</span></a><span class="sd"> """</span> +</span><span id="Expression-274"><a href="#Expression-274"><span class="linenos">274</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> +</span><span id="Expression-275"><a href="#Expression-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">depth</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="Expression-276"><a href="#Expression-276"><span class="linenos">276</span></a> <span class="k">return</span> <span class="mi">0</span> +</span><span id="Expression-277"><a href="#Expression-277"><span class="linenos">277</span></a> +</span><span id="Expression-278"><a href="#Expression-278"><span class="linenos">278</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Expression-279"><a href="#Expression-279"><span class="linenos">279</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-280"><a href="#Expression-280"><span class="linenos">280</span></a><span class="sd"> Returns the first node in this tree which matches at least one of</span> +</span><span id="Expression-281"><a href="#Expression-281"><span class="linenos">281</span></a><span class="sd"> the specified types.</span> +</span><span id="Expression-282"><a href="#Expression-282"><span class="linenos">282</span></a> +</span><span id="Expression-283"><a href="#Expression-283"><span class="linenos">283</span></a><span class="sd"> Args:</span> +</span><span id="Expression-284"><a href="#Expression-284"><span class="linenos">284</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Expression-285"><a href="#Expression-285"><span class="linenos">285</span></a> +</span><span id="Expression-286"><a href="#Expression-286"><span class="linenos">286</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-287"><a href="#Expression-287"><span class="linenos">287</span></a><span class="sd"> The node which matches the criteria or None if no such node was found.</span> +</span><span id="Expression-288"><a href="#Expression-288"><span class="linenos">288</span></a><span class="sd"> """</span> +</span><span id="Expression-289"><a href="#Expression-289"><span class="linenos">289</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Expression-290"><a href="#Expression-290"><span class="linenos">290</span></a> +</span><span id="Expression-291"><a href="#Expression-291"><span class="linenos">291</span></a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Expression-292"><a href="#Expression-292"><span class="linenos">292</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-293"><a href="#Expression-293"><span class="linenos">293</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree and only</span> +</span><span id="Expression-294"><a href="#Expression-294"><span class="linenos">294</span></a><span class="sd"> yields those that match at least one of the specified expression types.</span> +</span><span id="Expression-295"><a href="#Expression-295"><span class="linenos">295</span></a> +</span><span id="Expression-296"><a href="#Expression-296"><span class="linenos">296</span></a><span class="sd"> Args:</span> +</span><span id="Expression-297"><a href="#Expression-297"><span class="linenos">297</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Expression-298"><a href="#Expression-298"><span class="linenos">298</span></a> +</span><span id="Expression-299"><a href="#Expression-299"><span class="linenos">299</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-300"><a href="#Expression-300"><span class="linenos">300</span></a><span class="sd"> The generator object.</span> +</span><span id="Expression-301"><a href="#Expression-301"><span class="linenos">301</span></a><span class="sd"> """</span> +</span><span id="Expression-302"><a href="#Expression-302"><span class="linenos">302</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">):</span> +</span><span id="Expression-303"><a href="#Expression-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="Expression-304"><a href="#Expression-304"><span class="linenos">304</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span><span id="Expression-305"><a href="#Expression-305"><span class="linenos">305</span></a> +</span><span id="Expression-306"><a href="#Expression-306"><span class="linenos">306</span></a> <span class="k">def</span> <span class="nf">find_ancestor</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">):</span> +</span><span id="Expression-307"><a href="#Expression-307"><span class="linenos">307</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-308"><a href="#Expression-308"><span class="linenos">308</span></a><span class="sd"> Returns a nearest parent matching expression_types.</span> +</span><span id="Expression-309"><a href="#Expression-309"><span class="linenos">309</span></a> +</span><span id="Expression-310"><a href="#Expression-310"><span class="linenos">310</span></a><span class="sd"> Args:</span> +</span><span id="Expression-311"><a href="#Expression-311"><span class="linenos">311</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Expression-312"><a href="#Expression-312"><span class="linenos">312</span></a> +</span><span id="Expression-313"><a href="#Expression-313"><span class="linenos">313</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-314"><a href="#Expression-314"><span class="linenos">314</span></a><span class="sd"> The parent node.</span> +</span><span id="Expression-315"><a href="#Expression-315"><span class="linenos">315</span></a><span class="sd"> """</span> +</span><span id="Expression-316"><a href="#Expression-316"><span class="linenos">316</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression-317"><a href="#Expression-317"><span class="linenos">317</span></a> <span class="k">while</span> <span class="n">ancestor</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="Expression-318"><a href="#Expression-318"><span class="linenos">318</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="n">ancestor</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression-319"><a href="#Expression-319"><span class="linenos">319</span></a> <span class="k">return</span> <span class="n">ancestor</span> +</span><span id="Expression-320"><a href="#Expression-320"><span class="linenos">320</span></a> +</span><span id="Expression-321"><a href="#Expression-321"><span class="linenos">321</span></a> <span class="nd">@property</span> +</span><span id="Expression-322"><a href="#Expression-322"><span class="linenos">322</span></a> <span class="k">def</span> <span class="nf">parent_select</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-323"><a href="#Expression-323"><span class="linenos">323</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-324"><a href="#Expression-324"><span class="linenos">324</span></a><span class="sd"> Returns the parent select statement.</span> +</span><span id="Expression-325"><a href="#Expression-325"><span class="linenos">325</span></a><span class="sd"> """</span> +</span><span id="Expression-326"><a href="#Expression-326"><span class="linenos">326</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">Select</span><span class="p">)</span> +</span><span id="Expression-327"><a href="#Expression-327"><span class="linenos">327</span></a> +</span><span id="Expression-328"><a href="#Expression-328"><span class="linenos">328</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Expression-329"><a href="#Expression-329"><span class="linenos">329</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-330"><a href="#Expression-330"><span class="linenos">330</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree.</span> +</span><span id="Expression-331"><a href="#Expression-331"><span class="linenos">331</span></a> +</span><span id="Expression-332"><a href="#Expression-332"><span class="linenos">332</span></a><span class="sd"> Args:</span> +</span><span id="Expression-333"><a href="#Expression-333"><span class="linenos">333</span></a><span class="sd"> bfs (bool): if set to True the BFS traversal order will be applied,</span> +</span><span id="Expression-334"><a href="#Expression-334"><span class="linenos">334</span></a><span class="sd"> otherwise the DFS traversal will be used instead.</span> +</span><span id="Expression-335"><a href="#Expression-335"><span class="linenos">335</span></a><span class="sd"> prune ((node, parent, arg_key) -> bool): callable that returns True if</span> +</span><span id="Expression-336"><a href="#Expression-336"><span class="linenos">336</span></a><span class="sd"> the generator should stop traversing this branch of the tree.</span> +</span><span id="Expression-337"><a href="#Expression-337"><span class="linenos">337</span></a> +</span><span id="Expression-338"><a href="#Expression-338"><span class="linenos">338</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-339"><a href="#Expression-339"><span class="linenos">339</span></a><span class="sd"> the generator object.</span> +</span><span id="Expression-340"><a href="#Expression-340"><span class="linenos">340</span></a><span class="sd"> """</span> +</span><span id="Expression-341"><a href="#Expression-341"><span class="linenos">341</span></a> <span class="k">if</span> <span class="n">bfs</span><span class="p">:</span> +</span><span id="Expression-342"><a href="#Expression-342"><span class="linenos">342</span></a> <span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">bfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="n">prune</span><span class="p">)</span> +</span><span id="Expression-343"><a href="#Expression-343"><span class="linenos">343</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Expression-344"><a href="#Expression-344"><span class="linenos">344</span></a> <span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="n">prune</span><span class="p">)</span> +</span><span id="Expression-345"><a href="#Expression-345"><span class="linenos">345</span></a> +</span><span id="Expression-346"><a href="#Expression-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">dfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Expression-347"><a href="#Expression-347"><span class="linenos">347</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-348"><a href="#Expression-348"><span class="linenos">348</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree in</span> +</span><span id="Expression-349"><a href="#Expression-349"><span class="linenos">349</span></a><span class="sd"> the DFS (Depth-first) order.</span> +</span><span id="Expression-350"><a href="#Expression-350"><span class="linenos">350</span></a> +</span><span id="Expression-351"><a href="#Expression-351"><span class="linenos">351</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-352"><a href="#Expression-352"><span class="linenos">352</span></a><span class="sd"> The generator object.</span> +</span><span id="Expression-353"><a href="#Expression-353"><span class="linenos">353</span></a><span class="sd"> """</span> +</span><span id="Expression-354"><a href="#Expression-354"><span class="linenos">354</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression-355"><a href="#Expression-355"><span class="linenos">355</span></a> <span class="k">yield</span> <span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="Expression-356"><a href="#Expression-356"><span class="linenos">356</span></a> <span class="k">if</span> <span class="n">prune</span> <span class="ow">and</span> <span class="n">prune</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="Expression-357"><a href="#Expression-357"><span class="linenos">357</span></a> <span class="k">return</span> +</span><span id="Expression-358"><a href="#Expression-358"><span class="linenos">358</span></a> +</span><span id="Expression-359"><a href="#Expression-359"><span class="linenos">359</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression-360"><a href="#Expression-360"><span class="linenos">360</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="Expression-361"><a href="#Expression-361"><span class="linenos">361</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression-362"><a href="#Expression-362"><span class="linenos">362</span></a> <span class="k">yield from</span> <span class="n">node</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">prune</span><span class="p">)</span> +</span><span id="Expression-363"><a href="#Expression-363"><span class="linenos">363</span></a> +</span><span id="Expression-364"><a href="#Expression-364"><span class="linenos">364</span></a> <span class="k">def</span> <span class="nf">bfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Expression-365"><a href="#Expression-365"><span class="linenos">365</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-366"><a href="#Expression-366"><span class="linenos">366</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree in</span> +</span><span id="Expression-367"><a href="#Expression-367"><span class="linenos">367</span></a><span class="sd"> the BFS (Breadth-first) order.</span> +</span><span id="Expression-368"><a href="#Expression-368"><span class="linenos">368</span></a> +</span><span id="Expression-369"><a href="#Expression-369"><span class="linenos">369</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-370"><a href="#Expression-370"><span class="linenos">370</span></a><span class="sd"> The generator object.</span> +</span><span id="Expression-371"><a href="#Expression-371"><span class="linenos">371</span></a><span class="sd"> """</span> +</span><span id="Expression-372"><a href="#Expression-372"><span class="linenos">372</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="n">deque</span><span class="p">([(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="kc">None</span><span class="p">)])</span> +</span><span id="Expression-373"><a href="#Expression-373"><span class="linenos">373</span></a> +</span><span id="Expression-374"><a href="#Expression-374"><span class="linenos">374</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="Expression-375"><a href="#Expression-375"><span class="linenos">375</span></a> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">popleft</span><span class="p">()</span> +</span><span id="Expression-376"><a href="#Expression-376"><span class="linenos">376</span></a> +</span><span id="Expression-377"><a href="#Expression-377"><span class="linenos">377</span></a> <span class="k">yield</span> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="Expression-378"><a href="#Expression-378"><span class="linenos">378</span></a> <span class="k">if</span> <span class="n">prune</span> <span class="ow">and</span> <span class="n">prune</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="Expression-379"><a href="#Expression-379"><span class="linenos">379</span></a> <span class="k">continue</span> +</span><span id="Expression-380"><a href="#Expression-380"><span class="linenos">380</span></a> +</span><span id="Expression-381"><a href="#Expression-381"><span class="linenos">381</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression-382"><a href="#Expression-382"><span class="linenos">382</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">item</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression-383"><a href="#Expression-383"><span class="linenos">383</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="Expression-384"><a href="#Expression-384"><span class="linenos">384</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression-385"><a href="#Expression-385"><span class="linenos">385</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">node</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">k</span><span class="p">))</span> +</span><span id="Expression-386"><a href="#Expression-386"><span class="linenos">386</span></a> +</span><span id="Expression-387"><a href="#Expression-387"><span class="linenos">387</span></a> <span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-388"><a href="#Expression-388"><span class="linenos">388</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-389"><a href="#Expression-389"><span class="linenos">389</span></a><span class="sd"> Returns the first non parenthesis child or self.</span> +</span><span id="Expression-390"><a href="#Expression-390"><span class="linenos">390</span></a><span class="sd"> """</span> +</span><span id="Expression-391"><a href="#Expression-391"><span class="linenos">391</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="Expression-392"><a href="#Expression-392"><span class="linenos">392</span></a> <span class="k">while</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Paren</span><span class="p">):</span> +</span><span id="Expression-393"><a href="#Expression-393"><span class="linenos">393</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Expression-394"><a href="#Expression-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Expression-395"><a href="#Expression-395"><span class="linenos">395</span></a> +</span><span id="Expression-396"><a href="#Expression-396"><span class="linenos">396</span></a> <span class="k">def</span> <span class="nf">unalias</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-397"><a href="#Expression-397"><span class="linenos">397</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-398"><a href="#Expression-398"><span class="linenos">398</span></a><span class="sd"> Returns the inner expression if this is an Alias.</span> +</span><span id="Expression-399"><a href="#Expression-399"><span class="linenos">399</span></a><span class="sd"> """</span> +</span><span id="Expression-400"><a href="#Expression-400"><span class="linenos">400</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Alias</span><span class="p">):</span> +</span><span id="Expression-401"><a href="#Expression-401"><span class="linenos">401</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="Expression-402"><a href="#Expression-402"><span class="linenos">402</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="Expression-403"><a href="#Expression-403"><span class="linenos">403</span></a> +</span><span id="Expression-404"><a href="#Expression-404"><span class="linenos">404</span></a> <span class="k">def</span> <span class="nf">unnest_operands</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-405"><a href="#Expression-405"><span class="linenos">405</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-406"><a href="#Expression-406"><span class="linenos">406</span></a><span class="sd"> Returns unnested operands as a tuple.</span> +</span><span id="Expression-407"><a href="#Expression-407"><span class="linenos">407</span></a><span class="sd"> """</span> +</span><span id="Expression-408"><a href="#Expression-408"><span class="linenos">408</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">arg</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">if</span> <span class="n">arg</span><span class="p">)</span> +</span><span id="Expression-409"><a href="#Expression-409"><span class="linenos">409</span></a> +</span><span id="Expression-410"><a href="#Expression-410"><span class="linenos">410</span></a> <span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">unnest</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Expression-411"><a href="#Expression-411"><span class="linenos">411</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-412"><a href="#Expression-412"><span class="linenos">412</span></a><span class="sd"> Returns a generator which yields child nodes who's parents are the same class.</span> +</span><span id="Expression-413"><a href="#Expression-413"><span class="linenos">413</span></a> +</span><span id="Expression-414"><a href="#Expression-414"><span class="linenos">414</span></a><span class="sd"> A AND B AND C -> [A, B, C]</span> +</span><span id="Expression-415"><a href="#Expression-415"><span class="linenos">415</span></a><span class="sd"> """</span> +</span><span id="Expression-416"><a href="#Expression-416"><span class="linenos">416</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="k">lambda</span> <span class="n">n</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="n">p</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)):</span> +</span><span id="Expression-417"><a href="#Expression-417"><span class="linenos">417</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">):</span> +</span><span id="Expression-418"><a href="#Expression-418"><span class="linenos">418</span></a> <span class="k">yield</span> <span class="n">node</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> <span class="k">if</span> <span class="n">unnest</span> <span class="k">else</span> <span class="n">node</span> +</span><span id="Expression-419"><a href="#Expression-419"><span class="linenos">419</span></a> +</span><span id="Expression-420"><a href="#Expression-420"><span class="linenos">420</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-421"><a href="#Expression-421"><span class="linenos">421</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</span><span id="Expression-422"><a href="#Expression-422"><span class="linenos">422</span></a> +</span><span id="Expression-423"><a href="#Expression-423"><span class="linenos">423</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-424"><a href="#Expression-424"><span class="linenos">424</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_s</span><span class="p">()</span> +</span><span id="Expression-425"><a href="#Expression-425"><span class="linenos">425</span></a> +</span><span id="Expression-426"><a href="#Expression-426"><span class="linenos">426</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Expression-427"><a href="#Expression-427"><span class="linenos">427</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-428"><a href="#Expression-428"><span class="linenos">428</span></a><span class="sd"> Returns SQL string representation of this tree.</span> +</span><span id="Expression-429"><a href="#Expression-429"><span class="linenos">429</span></a> +</span><span id="Expression-430"><a href="#Expression-430"><span class="linenos">430</span></a><span class="sd"> Args:</span> +</span><span id="Expression-431"><a href="#Expression-431"><span class="linenos">431</span></a><span class="sd"> dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="Expression-432"><a href="#Expression-432"><span class="linenos">432</span></a><span class="sd"> opts: other `sqlglot.generator.Generator` options.</span> +</span><span id="Expression-433"><a href="#Expression-433"><span class="linenos">433</span></a> +</span><span id="Expression-434"><a href="#Expression-434"><span class="linenos">434</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-435"><a href="#Expression-435"><span class="linenos">435</span></a><span class="sd"> The SQL string.</span> +</span><span id="Expression-436"><a href="#Expression-436"><span class="linenos">436</span></a><span class="sd"> """</span> +</span><span id="Expression-437"><a href="#Expression-437"><span class="linenos">437</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="Expression-438"><a href="#Expression-438"><span class="linenos">438</span></a> +</span><span id="Expression-439"><a href="#Expression-439"><span class="linenos">439</span></a> <span class="k">return</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">dialect</span><span class="p">)()</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Expression-440"><a href="#Expression-440"><span class="linenos">440</span></a> +</span><span id="Expression-441"><a href="#Expression-441"><span class="linenos">441</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">hide_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Expression-442"><a href="#Expression-442"><span class="linenos">442</span></a> <span class="n">indent</span> <span class="o">=</span> <span class="s2">""</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">level</span> <span class="k">else</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> +</span><span id="Expression-443"><a href="#Expression-443"><span class="linenos">443</span></a> <span class="n">indent</span> <span class="o">+=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s2">" "</span><span class="p">]</span> <span class="o">*</span> <span class="n">level</span><span class="p">)</span> +</span><span id="Expression-444"><a href="#Expression-444"><span class="linenos">444</span></a> <span class="n">left</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> "</span> +</span><span id="Expression-445"><a href="#Expression-445"><span class="linenos">445</span></a> +</span><span id="Expression-446"><a href="#Expression-446"><span class="linenos">446</span></a> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Expression-447"><a href="#Expression-447"><span class="linenos">447</span></a> <span class="n">k</span><span class="p">:</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Expression-448"><a href="#Expression-448"><span class="linenos">448</span></a> <span class="n">v</span><span class="o">.</span><span class="n">_to_s</span><span class="p">(</span><span class="n">hide_missing</span><span class="o">=</span><span class="n">hide_missing</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Expression-449"><a href="#Expression-449"><span class="linenos">449</span></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="s2">"_to_s"</span><span class="p">)</span> +</span><span id="Expression-450"><a href="#Expression-450"><span class="linenos">450</span></a> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> +</span><span id="Expression-451"><a href="#Expression-451"><span class="linenos">451</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">vs</span><span class="p">)</span> +</span><span id="Expression-452"><a href="#Expression-452"><span class="linenos">452</span></a> <span class="k">if</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="Expression-453"><a href="#Expression-453"><span class="linenos">453</span></a> <span class="p">)</span> +</span><span id="Expression-454"><a href="#Expression-454"><span class="linenos">454</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">vs</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Expression-455"><a href="#Expression-455"><span class="linenos">455</span></a> <span class="p">}</span> +</span><span id="Expression-456"><a href="#Expression-456"><span class="linenos">456</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"comments"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> +</span><span id="Expression-457"><a href="#Expression-457"><span class="linenos">457</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span> +</span><span id="Expression-458"><a href="#Expression-458"><span class="linenos">458</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">v</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">hide_missing</span><span class="p">}</span> +</span><span id="Expression-459"><a href="#Expression-459"><span class="linenos">459</span></a> +</span><span id="Expression-460"><a href="#Expression-460"><span class="linenos">460</span></a> <span class="n">right</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">v</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> +</span><span id="Expression-461"><a href="#Expression-461"><span class="linenos">461</span></a> <span class="n">right</span> <span class="o">+=</span> <span class="s2">")"</span> +</span><span id="Expression-462"><a href="#Expression-462"><span class="linenos">462</span></a> +</span><span id="Expression-463"><a href="#Expression-463"><span class="linenos">463</span></a> <span class="k">return</span> <span class="n">indent</span> <span class="o">+</span> <span class="n">left</span> <span class="o">+</span> <span class="n">right</span> +</span><span id="Expression-464"><a href="#Expression-464"><span class="linenos">464</span></a> +</span><span id="Expression-465"><a href="#Expression-465"><span class="linenos">465</span></a> <span class="k">def</span> <span class="nf">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fun</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="Expression-466"><a href="#Expression-466"><span class="linenos">466</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-467"><a href="#Expression-467"><span class="linenos">467</span></a><span class="sd"> Recursively visits all tree nodes (excluding already transformed ones)</span> +</span><span id="Expression-468"><a href="#Expression-468"><span class="linenos">468</span></a><span class="sd"> and applies the given transformation function to each node.</span> +</span><span id="Expression-469"><a href="#Expression-469"><span class="linenos">469</span></a> +</span><span id="Expression-470"><a href="#Expression-470"><span class="linenos">470</span></a><span class="sd"> Args:</span> +</span><span id="Expression-471"><a href="#Expression-471"><span class="linenos">471</span></a><span class="sd"> fun (function): a function which takes a node as an argument and returns a</span> +</span><span id="Expression-472"><a href="#Expression-472"><span class="linenos">472</span></a><span class="sd"> new transformed node or the same node without modifications. If the function</span> +</span><span id="Expression-473"><a href="#Expression-473"><span class="linenos">473</span></a><span class="sd"> returns None, then the corresponding node will be removed from the syntax tree.</span> +</span><span id="Expression-474"><a href="#Expression-474"><span class="linenos">474</span></a><span class="sd"> copy (bool): if set to True a new tree instance is constructed, otherwise the tree is</span> +</span><span id="Expression-475"><a href="#Expression-475"><span class="linenos">475</span></a><span class="sd"> modified in place.</span> +</span><span id="Expression-476"><a href="#Expression-476"><span class="linenos">476</span></a> +</span><span id="Expression-477"><a href="#Expression-477"><span class="linenos">477</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-478"><a href="#Expression-478"><span class="linenos">478</span></a><span class="sd"> The transformed tree.</span> +</span><span id="Expression-479"><a href="#Expression-479"><span class="linenos">479</span></a><span class="sd"> """</span> +</span><span id="Expression-480"><a href="#Expression-480"><span class="linenos">480</span></a> <span class="n">node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="k">if</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span> +</span><span id="Expression-481"><a href="#Expression-481"><span class="linenos">481</span></a> <span class="n">new_node</span> <span class="o">=</span> <span class="n">fun</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Expression-482"><a href="#Expression-482"><span class="linenos">482</span></a> +</span><span id="Expression-483"><a href="#Expression-483"><span class="linenos">483</span></a> <span class="k">if</span> <span class="n">new_node</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">new_node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression-484"><a href="#Expression-484"><span class="linenos">484</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="Expression-485"><a href="#Expression-485"><span class="linenos">485</span></a> <span class="k">if</span> <span class="n">new_node</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">node</span><span class="p">:</span> +</span><span id="Expression-486"><a href="#Expression-486"><span class="linenos">486</span></a> <span class="n">new_node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression-487"><a href="#Expression-487"><span class="linenos">487</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="Expression-488"><a href="#Expression-488"><span class="linenos">488</span></a> +</span><span id="Expression-489"><a href="#Expression-489"><span class="linenos">489</span></a> <span class="n">replace_children</span><span class="p">(</span><span class="n">new_node</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">child</span><span class="p">:</span> <span class="n">child</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">fun</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span><span id="Expression-490"><a href="#Expression-490"><span class="linenos">490</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="Expression-491"><a href="#Expression-491"><span class="linenos">491</span></a> +</span><span id="Expression-492"><a href="#Expression-492"><span class="linenos">492</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Expression-493"><a href="#Expression-493"><span class="linenos">493</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-494"><a href="#Expression-494"><span class="linenos">494</span></a><span class="sd"> Swap out this expression with a new expression.</span> +</span><span id="Expression-495"><a href="#Expression-495"><span class="linenos">495</span></a> +</span><span id="Expression-496"><a href="#Expression-496"><span class="linenos">496</span></a><span class="sd"> For example::</span> +</span><span id="Expression-497"><a href="#Expression-497"><span class="linenos">497</span></a> +</span><span id="Expression-498"><a href="#Expression-498"><span class="linenos">498</span></a><span class="sd"> >>> tree = Select().select("x").from_("tbl")</span> +</span><span id="Expression-499"><a href="#Expression-499"><span class="linenos">499</span></a><span class="sd"> >>> tree.find(Column).replace(Column(this="y"))</span> +</span><span id="Expression-500"><a href="#Expression-500"><span class="linenos">500</span></a><span class="sd"> (COLUMN this: y)</span> +</span><span id="Expression-501"><a href="#Expression-501"><span class="linenos">501</span></a><span class="sd"> >>> tree.sql()</span> +</span><span id="Expression-502"><a href="#Expression-502"><span class="linenos">502</span></a><span class="sd"> 'SELECT y FROM tbl'</span> +</span><span id="Expression-503"><a href="#Expression-503"><span class="linenos">503</span></a> +</span><span id="Expression-504"><a href="#Expression-504"><span class="linenos">504</span></a><span class="sd"> Args:</span> +</span><span id="Expression-505"><a href="#Expression-505"><span class="linenos">505</span></a><span class="sd"> expression (Expression|None): new node</span> +</span><span id="Expression-506"><a href="#Expression-506"><span class="linenos">506</span></a> +</span><span id="Expression-507"><a href="#Expression-507"><span class="linenos">507</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-508"><a href="#Expression-508"><span class="linenos">508</span></a><span class="sd"> The new expression or expressions.</span> +</span><span id="Expression-509"><a href="#Expression-509"><span class="linenos">509</span></a><span class="sd"> """</span> +</span><span id="Expression-510"><a href="#Expression-510"><span class="linenos">510</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> +</span><span id="Expression-511"><a href="#Expression-511"><span class="linenos">511</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Expression-512"><a href="#Expression-512"><span class="linenos">512</span></a> +</span><span id="Expression-513"><a href="#Expression-513"><span class="linenos">513</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression-514"><a href="#Expression-514"><span class="linenos">514</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression-515"><a href="#Expression-515"><span class="linenos">515</span></a> +</span><span id="Expression-516"><a href="#Expression-516"><span class="linenos">516</span></a> <span class="n">replace_children</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">child</span><span class="p">:</span> <span class="n">expression</span> <span class="k">if</span> <span class="n">child</span> <span class="ow">is</span> <span class="bp">self</span> <span class="k">else</span> <span class="n">child</span><span class="p">)</span> +</span><span id="Expression-517"><a href="#Expression-517"><span class="linenos">517</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Expression-518"><a href="#Expression-518"><span class="linenos">518</span></a> +</span><span id="Expression-519"><a href="#Expression-519"><span class="linenos">519</span></a> <span class="k">def</span> <span class="nf">pop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-520"><a href="#Expression-520"><span class="linenos">520</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-521"><a href="#Expression-521"><span class="linenos">521</span></a><span class="sd"> Remove this expression from its AST.</span> +</span><span id="Expression-522"><a href="#Expression-522"><span class="linenos">522</span></a><span class="sd"> """</span> +</span><span id="Expression-523"><a href="#Expression-523"><span class="linenos">523</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> +</span><span id="Expression-524"><a href="#Expression-524"><span class="linenos">524</span></a> +</span><span id="Expression-525"><a href="#Expression-525"><span class="linenos">525</span></a> <span class="k">def</span> <span class="nf">assert_is</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_</span><span class="p">):</span> +</span><span id="Expression-526"><a href="#Expression-526"><span class="linenos">526</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-527"><a href="#Expression-527"><span class="linenos">527</span></a><span class="sd"> Assert that this `Expression` is an instance of `type_`.</span> +</span><span id="Expression-528"><a href="#Expression-528"><span class="linenos">528</span></a> +</span><span id="Expression-529"><a href="#Expression-529"><span class="linenos">529</span></a><span class="sd"> If it is NOT an instance of `type_`, this raises an assertion error.</span> +</span><span id="Expression-530"><a href="#Expression-530"><span class="linenos">530</span></a><span class="sd"> Otherwise, this returns this expression.</span> +</span><span id="Expression-531"><a href="#Expression-531"><span class="linenos">531</span></a> +</span><span id="Expression-532"><a href="#Expression-532"><span class="linenos">532</span></a><span class="sd"> Examples:</span> +</span><span id="Expression-533"><a href="#Expression-533"><span class="linenos">533</span></a><span class="sd"> This is useful for type security in chained expressions:</span> +</span><span id="Expression-534"><a href="#Expression-534"><span class="linenos">534</span></a> +</span><span id="Expression-535"><a href="#Expression-535"><span class="linenos">535</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Expression-536"><a href="#Expression-536"><span class="linenos">536</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql()</span> +</span><span id="Expression-537"><a href="#Expression-537"><span class="linenos">537</span></a><span class="sd"> 'SELECT x, z FROM y'</span> +</span><span id="Expression-538"><a href="#Expression-538"><span class="linenos">538</span></a><span class="sd"> """</span> +</span><span id="Expression-539"><a href="#Expression-539"><span class="linenos">539</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_</span><span class="p">)</span> +</span><span id="Expression-540"><a href="#Expression-540"><span class="linenos">540</span></a> <span class="k">return</span> <span class="bp">self</span> +</span><span id="Expression-541"><a href="#Expression-541"><span class="linenos">541</span></a> +</span><span id="Expression-542"><a href="#Expression-542"><span class="linenos">542</span></a> <span class="k">def</span> <span class="nf">error_messages</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Expression-543"><a href="#Expression-543"><span class="linenos">543</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-544"><a href="#Expression-544"><span class="linenos">544</span></a><span class="sd"> Checks if this expression is valid (e.g. all mandatory args are set).</span> +</span><span id="Expression-545"><a href="#Expression-545"><span class="linenos">545</span></a> +</span><span id="Expression-546"><a href="#Expression-546"><span class="linenos">546</span></a><span class="sd"> Args:</span> +</span><span id="Expression-547"><a href="#Expression-547"><span class="linenos">547</span></a><span class="sd"> args: a sequence of values that were used to instantiate a Func expression. This is used</span> +</span><span id="Expression-548"><a href="#Expression-548"><span class="linenos">548</span></a><span class="sd"> to check that the provided arguments don't exceed the function argument limit.</span> +</span><span id="Expression-549"><a href="#Expression-549"><span class="linenos">549</span></a> +</span><span id="Expression-550"><a href="#Expression-550"><span class="linenos">550</span></a><span class="sd"> Returns:</span> +</span><span id="Expression-551"><a href="#Expression-551"><span class="linenos">551</span></a><span class="sd"> A list of error messages for all possible errors that were found.</span> +</span><span id="Expression-552"><a href="#Expression-552"><span class="linenos">552</span></a><span class="sd"> """</span> +</span><span id="Expression-553"><a href="#Expression-553"><span class="linenos">553</span></a> <span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Expression-554"><a href="#Expression-554"><span class="linenos">554</span></a> +</span><span id="Expression-555"><a href="#Expression-555"><span class="linenos">555</span></a> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Expression-556"><a href="#Expression-556"><span class="linenos">556</span></a> <span class="k">if</span> <span class="n">k</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">:</span> +</span><span id="Expression-557"><a href="#Expression-557"><span class="linenos">557</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unexpected keyword: '</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">' for </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Expression-558"><a href="#Expression-558"><span class="linenos">558</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">mandatory</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression-559"><a href="#Expression-559"><span class="linenos">559</span></a> <span class="n">v</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> +</span><span id="Expression-560"><a href="#Expression-560"><span class="linenos">560</span></a> <span class="k">if</span> <span class="n">mandatory</span> <span class="ow">and</span> <span class="p">(</span><span class="n">v</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">v</span><span class="p">)):</span> +</span><span id="Expression-561"><a href="#Expression-561"><span class="linenos">561</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Required keyword: '</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">' missing for </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Expression-562"><a href="#Expression-562"><span class="linenos">562</span></a> +</span><span id="Expression-563"><a href="#Expression-563"><span class="linenos">563</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Expression-564"><a href="#Expression-564"><span class="linenos">564</span></a> <span class="n">args</span> +</span><span id="Expression-565"><a href="#Expression-565"><span class="linenos">565</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Func</span><span class="p">)</span> +</span><span id="Expression-566"><a href="#Expression-566"><span class="linenos">566</span></a> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> +</span><span id="Expression-567"><a href="#Expression-567"><span class="linenos">567</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_var_len_args</span> +</span><span id="Expression-568"><a href="#Expression-568"><span class="linenos">568</span></a> <span class="p">):</span> +</span><span id="Expression-569"><a href="#Expression-569"><span class="linenos">569</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Expression-570"><a href="#Expression-570"><span class="linenos">570</span></a> <span class="sa">f</span><span class="s2">"The number of provided arguments (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">) is greater than "</span> +</span><span id="Expression-571"><a href="#Expression-571"><span class="linenos">571</span></a> <span class="sa">f</span><span class="s2">"the maximum number of supported arguments (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Expression-572"><a href="#Expression-572"><span class="linenos">572</span></a> <span class="p">)</span> +</span><span id="Expression-573"><a href="#Expression-573"><span class="linenos">573</span></a> +</span><span id="Expression-574"><a href="#Expression-574"><span class="linenos">574</span></a> <span class="k">return</span> <span class="n">errors</span> +</span><span id="Expression-575"><a href="#Expression-575"><span class="linenos">575</span></a> +</span><span id="Expression-576"><a href="#Expression-576"><span class="linenos">576</span></a> <span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression-577"><a href="#Expression-577"><span class="linenos">577</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-578"><a href="#Expression-578"><span class="linenos">578</span></a><span class="sd"> Dump this Expression to a JSON-serializable dict.</span> +</span><span id="Expression-579"><a href="#Expression-579"><span class="linenos">579</span></a><span class="sd"> """</span> +</span><span id="Expression-580"><a href="#Expression-580"><span class="linenos">580</span></a> <span class="kn">from</span> <span class="nn">sqlglot.serde</span> <span class="kn">import</span> <span class="n">dump</span> +</span><span id="Expression-581"><a href="#Expression-581"><span class="linenos">581</span></a> +</span><span id="Expression-582"><a href="#Expression-582"><span class="linenos">582</span></a> <span class="k">return</span> <span class="n">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Expression-583"><a href="#Expression-583"><span class="linenos">583</span></a> +</span><span id="Expression-584"><a href="#Expression-584"><span class="linenos">584</span></a> <span class="nd">@classmethod</span> +</span><span id="Expression-585"><a href="#Expression-585"><span class="linenos">585</span></a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span> +</span><span id="Expression-586"><a href="#Expression-586"><span class="linenos">586</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression-587"><a href="#Expression-587"><span class="linenos">587</span></a><span class="sd"> Load a dict (as returned by `Expression.dump`) into an Expression instance.</span> +</span><span id="Expression-588"><a href="#Expression-588"><span class="linenos">588</span></a><span class="sd"> """</span> +</span><span id="Expression-589"><a href="#Expression-589"><span class="linenos">589</span></a> <span class="kn">from</span> <span class="nn">sqlglot.serde</span> <span class="kn">import</span> <span class="n">load</span> +</span><span id="Expression-590"><a href="#Expression-590"><span class="linenos">590</span></a> +</span><span id="Expression-591"><a href="#Expression-591"><span class="linenos">591</span></a> <span class="k">return</span> <span class="n">load</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>The base class for all expressions in a syntax tree. Each Expression encapsulates any necessary +context, such as its child expressions, their names (arg keys), and whether a given child expression +is optional or not.</p> + +<h6 id="attributes">Attributes:</h6> + +<ul> +<li><strong>key:</strong> a unique key for each class in the Expression hierarchy. This is useful for hashing +and representing expressions as strings.</li> +<li><strong>arg_types:</strong> determines what arguments (child nodes) are supported by an expression. It +maps arg keys to booleans that indicate whether the corresponding args are optional.</li> +</ul> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="k">class</span> <span class="nc">Foo</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +<span class="gp">... </span> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</code></pre> + </div> + + <p>The above definition informs us that Foo is an Expression that requires an argument called + "this" and may also optionally receive an argument called "expression".</p> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>args:</strong> a mapping used for retrieving the arguments of an expression, given their arg keys.</li> +<li><strong>parent:</strong> a reference to the parent expression (or None, in case of root expressions).</li> +<li><strong>arg_key:</strong> the arg key an expression is associated with, i.e. the name its parent expression +uses to refer to it.</li> +<li><strong>comments:</strong> a list of comments that are associated with a given expression. This is used in +order to preserve comments when transpiling SQL code.</li> +<li><strong>_type:</strong> the <code><a href="#DataType">sqlglot.expressions.DataType</a></code> type of an expression. This is inferred by the +optimizer, in order to enable some transformations that require type information.</li> +</ul> +</div> + + + <div id="Expression.__init__" class="classattr"> + <input id="Expression.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Expression</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">**</span><span class="n">args</span><span class="p">:</span> <span class="n">Any</span></span>)</span> + + <label class="view-source-button" for="Expression.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.__init__-88"><a href="#Expression.__init__-88"><span class="linenos">88</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="Expression.__init__-89"><a href="#Expression.__init__-89"><span class="linenos">89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="n">args</span> +</span><span id="Expression.__init__-90"><a href="#Expression.__init__-90"><span class="linenos">90</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression.__init__-91"><a href="#Expression.__init__-91"><span class="linenos">91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression.__init__-92"><a href="#Expression.__init__-92"><span class="linenos">92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression.__init__-93"><a href="#Expression.__init__-93"><span class="linenos">93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">DataType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression.__init__-94"><a href="#Expression.__init__-94"><span class="linenos">94</span></a> +</span><span id="Expression.__init__-95"><a href="#Expression.__init__-95"><span class="linenos">95</span></a> <span class="k">for</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression.__init__-96"><a href="#Expression.__init__-96"><span class="linenos">96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Expression.this" class="classattr"> + <div class="attr variable"> + <span class="name">this</span> + + + </div> + <a class="headerlink" href="#Expression.this"></a> + + <div class="docstring"><p>Retrieves the argument with key "this".</p> +</div> + + + </div> + <div id="Expression.expression" class="classattr"> + <div class="attr variable"> + <span class="name">expression</span> + + + </div> + <a class="headerlink" href="#Expression.expression"></a> + + <div class="docstring"><p>Retrieves the argument with key "expression".</p> +</div> + + + </div> + <div id="Expression.expressions" class="classattr"> + <div class="attr variable"> + <span class="name">expressions</span> + + + </div> + <a class="headerlink" href="#Expression.expressions"></a> + + <div class="docstring"><p>Retrieves the argument with key "expressions".</p> +</div> + + + </div> + <div id="Expression.text" class="classattr"> + <input id="Expression.text-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">text</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">key</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.text-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.text"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.text-132"><a href="#Expression.text-132"><span class="linenos">132</span></a> <span class="k">def</span> <span class="nf">text</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="Expression.text-133"><a href="#Expression.text-133"><span class="linenos">133</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.text-134"><a href="#Expression.text-134"><span class="linenos">134</span></a><span class="sd"> Returns a textual representation of the argument corresponding to "key". This can only be used</span> +</span><span id="Expression.text-135"><a href="#Expression.text-135"><span class="linenos">135</span></a><span class="sd"> for args that are strings or leaf Expression instances, such as identifiers and literals.</span> +</span><span id="Expression.text-136"><a href="#Expression.text-136"><span class="linenos">136</span></a><span class="sd"> """</span> +</span><span id="Expression.text-137"><a href="#Expression.text-137"><span class="linenos">137</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="Expression.text-138"><a href="#Expression.text-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Expression.text-139"><a href="#Expression.text-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">field</span> +</span><span id="Expression.text-140"><a href="#Expression.text-140"><span class="linenos">140</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="p">(</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">Literal</span><span class="p">,</span> <span class="n">Var</span><span class="p">)):</span> +</span><span id="Expression.text-141"><a href="#Expression.text-141"><span class="linenos">141</span></a> <span class="k">return</span> <span class="n">field</span><span class="o">.</span><span class="n">this</span> +</span><span id="Expression.text-142"><a href="#Expression.text-142"><span class="linenos">142</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="p">(</span><span class="n">Star</span><span class="p">,</span> <span class="n">Null</span><span class="p">)):</span> +</span><span id="Expression.text-143"><a href="#Expression.text-143"><span class="linenos">143</span></a> <span class="k">return</span> <span class="n">field</span><span class="o">.</span><span class="n">name</span> +</span><span id="Expression.text-144"><a href="#Expression.text-144"><span class="linenos">144</span></a> <span class="k">return</span> <span class="s2">""</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a textual representation of the argument corresponding to "key". This can only be used +for args that are strings or leaf Expression instances, such as identifiers and literals.</p> +</div> + + + </div> + <div id="Expression.is_string" class="classattr"> + <div class="attr variable"> + <span class="name">is_string</span> + + + </div> + <a class="headerlink" href="#Expression.is_string"></a> + + <div class="docstring"><p>Checks whether a Literal expression is a string.</p> +</div> + + + </div> + <div id="Expression.is_number" class="classattr"> + <div class="attr variable"> + <span class="name">is_number</span> + + + </div> + <a class="headerlink" href="#Expression.is_number"></a> + + <div class="docstring"><p>Checks whether a Literal expression is a number.</p> +</div> + + + </div> + <div id="Expression.is_int" class="classattr"> + <div class="attr variable"> + <span class="name">is_int</span> + + + </div> + <a class="headerlink" href="#Expression.is_int"></a> + + <div class="docstring"><p>Checks whether a Literal expression is an integer.</p> +</div> + + + </div> + <div id="Expression.alias" class="classattr"> + <div class="attr variable"> + <span class="name">alias</span> + + + </div> + <a class="headerlink" href="#Expression.alias"></a> + + <div class="docstring"><p>Returns the alias of the expression, or an empty string if it's not aliased.</p> +</div> + + + </div> + <div id="Expression.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Expression.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div id="Expression.copy" class="classattr"> + <input id="Expression.copy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">copy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.copy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.copy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.copy-224"><a href="#Expression.copy-224"><span class="linenos">224</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression.copy-225"><a href="#Expression.copy-225"><span class="linenos">225</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.copy-226"><a href="#Expression.copy-226"><span class="linenos">226</span></a><span class="sd"> Returns a deep copy of the expression.</span> +</span><span id="Expression.copy-227"><a href="#Expression.copy-227"><span class="linenos">227</span></a><span class="sd"> """</span> +</span><span id="Expression.copy-228"><a href="#Expression.copy-228"><span class="linenos">228</span></a> <span class="n">new</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Expression.copy-229"><a href="#Expression.copy-229"><span class="linenos">229</span></a> <span class="n">new</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression.copy-230"><a href="#Expression.copy-230"><span class="linenos">230</span></a> <span class="k">for</span> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">new</span><span class="o">.</span><span class="n">bfs</span><span class="p">():</span> +</span><span id="Expression.copy-231"><a href="#Expression.copy-231"><span class="linenos">231</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Expression</span><span class="p">)</span> <span class="ow">and</span> <span class="n">parent</span><span class="p">:</span> +</span><span id="Expression.copy-232"><a href="#Expression.copy-232"><span class="linenos">232</span></a> <span class="n">item</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> +</span><span id="Expression.copy-233"><a href="#Expression.copy-233"><span class="linenos">233</span></a> <span class="k">return</span> <span class="n">new</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a deep copy of the expression.</p> +</div> + + + </div> + <div id="Expression.append" class="classattr"> + <input id="Expression.append-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">append</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">arg_key</span>, </span><span class="param"><span class="n">value</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.append-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.append"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.append-235"><a href="#Expression.append-235"><span class="linenos">235</span></a> <span class="k">def</span> <span class="nf">append</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="Expression.append-236"><a href="#Expression.append-236"><span class="linenos">236</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.append-237"><a href="#Expression.append-237"><span class="linenos">237</span></a><span class="sd"> Appends value to arg_key if it's a list or sets it as a new list.</span> +</span><span id="Expression.append-238"><a href="#Expression.append-238"><span class="linenos">238</span></a> +</span><span id="Expression.append-239"><a href="#Expression.append-239"><span class="linenos">239</span></a><span class="sd"> Args:</span> +</span><span id="Expression.append-240"><a href="#Expression.append-240"><span class="linenos">240</span></a><span class="sd"> arg_key (str): name of the list expression arg</span> +</span><span id="Expression.append-241"><a href="#Expression.append-241"><span class="linenos">241</span></a><span class="sd"> value (Any): value to append to the list</span> +</span><span id="Expression.append-242"><a href="#Expression.append-242"><span class="linenos">242</span></a><span class="sd"> """</span> +</span><span id="Expression.append-243"><a href="#Expression.append-243"><span class="linenos">243</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg_key</span><span class="p">),</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="Expression.append-244"><a href="#Expression.append-244"><span class="linenos">244</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Expression.append-245"><a href="#Expression.append-245"><span class="linenos">245</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Expression.append-246"><a href="#Expression.append-246"><span class="linenos">246</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Appends value to arg_key if it's a list or sets it as a new list.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>arg_key (str):</strong> name of the list expression arg</li> +<li><strong>value (Any):</strong> value to append to the list</li> +</ul> +</div> + + + </div> + <div id="Expression.set" class="classattr"> + <input id="Expression.set-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">arg_key</span>, </span><span class="param"><span class="n">value</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.set-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.set"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.set-248"><a href="#Expression.set-248"><span class="linenos">248</span></a> <span class="k">def</span> <span class="nf">set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> +</span><span id="Expression.set-249"><a href="#Expression.set-249"><span class="linenos">249</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.set-250"><a href="#Expression.set-250"><span class="linenos">250</span></a><span class="sd"> Sets `arg_key` to `value`.</span> +</span><span id="Expression.set-251"><a href="#Expression.set-251"><span class="linenos">251</span></a> +</span><span id="Expression.set-252"><a href="#Expression.set-252"><span class="linenos">252</span></a><span class="sd"> Args:</span> +</span><span id="Expression.set-253"><a href="#Expression.set-253"><span class="linenos">253</span></a><span class="sd"> arg_key (str): name of the expression arg.</span> +</span><span id="Expression.set-254"><a href="#Expression.set-254"><span class="linenos">254</span></a><span class="sd"> value: value to set the arg to.</span> +</span><span id="Expression.set-255"><a href="#Expression.set-255"><span class="linenos">255</span></a><span class="sd"> """</span> +</span><span id="Expression.set-256"><a href="#Expression.set-256"><span class="linenos">256</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">arg_key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="Expression.set-257"><a href="#Expression.set-257"><span class="linenos">257</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_set_parent</span><span class="p">(</span><span class="n">arg_key</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Sets <code>arg_key</code> to <code>value</code>.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>arg_key (str):</strong> name of the expression arg.</li> +<li><strong>value:</strong> value to set the arg to.</li> +</ul> +</div> + + + </div> + <div id="Expression.depth" class="classattr"> + <div class="attr variable"> + <span class="name">depth</span> + + + </div> + <a class="headerlink" href="#Expression.depth"></a> + + <div class="docstring"><p>Returns the depth of this tree.</p> +</div> + + + </div> + <div id="Expression.find" class="classattr"> + <input id="Expression.find-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expression_types</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.find-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.find"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.find-278"><a href="#Expression.find-278"><span class="linenos">278</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Expression.find-279"><a href="#Expression.find-279"><span class="linenos">279</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.find-280"><a href="#Expression.find-280"><span class="linenos">280</span></a><span class="sd"> Returns the first node in this tree which matches at least one of</span> +</span><span id="Expression.find-281"><a href="#Expression.find-281"><span class="linenos">281</span></a><span class="sd"> the specified types.</span> +</span><span id="Expression.find-282"><a href="#Expression.find-282"><span class="linenos">282</span></a> +</span><span id="Expression.find-283"><a href="#Expression.find-283"><span class="linenos">283</span></a><span class="sd"> Args:</span> +</span><span id="Expression.find-284"><a href="#Expression.find-284"><span class="linenos">284</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Expression.find-285"><a href="#Expression.find-285"><span class="linenos">285</span></a> +</span><span id="Expression.find-286"><a href="#Expression.find-286"><span class="linenos">286</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.find-287"><a href="#Expression.find-287"><span class="linenos">287</span></a><span class="sd"> The node which matches the criteria or None if no such node was found.</span> +</span><span id="Expression.find-288"><a href="#Expression.find-288"><span class="linenos">288</span></a><span class="sd"> """</span> +</span><span id="Expression.find-289"><a href="#Expression.find-289"><span class="linenos">289</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the first node in this tree which matches at least one of +the specified types.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression_types (type):</strong> the expression type(s) to match.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The node which matches the criteria or None if no such node was found.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.find_all" class="classattr"> + <input id="Expression.find_all-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find_all</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expression_types</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.find_all-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.find_all"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.find_all-291"><a href="#Expression.find_all-291"><span class="linenos">291</span></a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Expression.find_all-292"><a href="#Expression.find_all-292"><span class="linenos">292</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.find_all-293"><a href="#Expression.find_all-293"><span class="linenos">293</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree and only</span> +</span><span id="Expression.find_all-294"><a href="#Expression.find_all-294"><span class="linenos">294</span></a><span class="sd"> yields those that match at least one of the specified expression types.</span> +</span><span id="Expression.find_all-295"><a href="#Expression.find_all-295"><span class="linenos">295</span></a> +</span><span id="Expression.find_all-296"><a href="#Expression.find_all-296"><span class="linenos">296</span></a><span class="sd"> Args:</span> +</span><span id="Expression.find_all-297"><a href="#Expression.find_all-297"><span class="linenos">297</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Expression.find_all-298"><a href="#Expression.find_all-298"><span class="linenos">298</span></a> +</span><span id="Expression.find_all-299"><a href="#Expression.find_all-299"><span class="linenos">299</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.find_all-300"><a href="#Expression.find_all-300"><span class="linenos">300</span></a><span class="sd"> The generator object.</span> +</span><span id="Expression.find_all-301"><a href="#Expression.find_all-301"><span class="linenos">301</span></a><span class="sd"> """</span> +</span><span id="Expression.find_all-302"><a href="#Expression.find_all-302"><span class="linenos">302</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">):</span> +</span><span id="Expression.find_all-303"><a href="#Expression.find_all-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="Expression.find_all-304"><a href="#Expression.find_all-304"><span class="linenos">304</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator object which visits all nodes in this tree and only +yields those that match at least one of the specified expression types.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression_types (type):</strong> the expression type(s) to match.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The generator object.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.find_ancestor" class="classattr"> + <input id="Expression.find_ancestor-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find_ancestor</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expression_types</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.find_ancestor-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.find_ancestor"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.find_ancestor-306"><a href="#Expression.find_ancestor-306"><span class="linenos">306</span></a> <span class="k">def</span> <span class="nf">find_ancestor</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">):</span> +</span><span id="Expression.find_ancestor-307"><a href="#Expression.find_ancestor-307"><span class="linenos">307</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.find_ancestor-308"><a href="#Expression.find_ancestor-308"><span class="linenos">308</span></a><span class="sd"> Returns a nearest parent matching expression_types.</span> +</span><span id="Expression.find_ancestor-309"><a href="#Expression.find_ancestor-309"><span class="linenos">309</span></a> +</span><span id="Expression.find_ancestor-310"><a href="#Expression.find_ancestor-310"><span class="linenos">310</span></a><span class="sd"> Args:</span> +</span><span id="Expression.find_ancestor-311"><a href="#Expression.find_ancestor-311"><span class="linenos">311</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Expression.find_ancestor-312"><a href="#Expression.find_ancestor-312"><span class="linenos">312</span></a> +</span><span id="Expression.find_ancestor-313"><a href="#Expression.find_ancestor-313"><span class="linenos">313</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.find_ancestor-314"><a href="#Expression.find_ancestor-314"><span class="linenos">314</span></a><span class="sd"> The parent node.</span> +</span><span id="Expression.find_ancestor-315"><a href="#Expression.find_ancestor-315"><span class="linenos">315</span></a><span class="sd"> """</span> +</span><span id="Expression.find_ancestor-316"><a href="#Expression.find_ancestor-316"><span class="linenos">316</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression.find_ancestor-317"><a href="#Expression.find_ancestor-317"><span class="linenos">317</span></a> <span class="k">while</span> <span class="n">ancestor</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="Expression.find_ancestor-318"><a href="#Expression.find_ancestor-318"><span class="linenos">318</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="n">ancestor</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression.find_ancestor-319"><a href="#Expression.find_ancestor-319"><span class="linenos">319</span></a> <span class="k">return</span> <span class="n">ancestor</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a nearest parent matching expression_types.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression_types (type):</strong> the expression type(s) to match.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The parent node.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.parent_select" class="classattr"> + <div class="attr variable"> + <span class="name">parent_select</span> + + + </div> + <a class="headerlink" href="#Expression.parent_select"></a> + + <div class="docstring"><p>Returns the parent select statement.</p> +</div> + + + </div> + <div id="Expression.walk" class="classattr"> + <input id="Expression.walk-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">walk</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">prune</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.walk-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.walk"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.walk-328"><a href="#Expression.walk-328"><span class="linenos">328</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Expression.walk-329"><a href="#Expression.walk-329"><span class="linenos">329</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.walk-330"><a href="#Expression.walk-330"><span class="linenos">330</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree.</span> +</span><span id="Expression.walk-331"><a href="#Expression.walk-331"><span class="linenos">331</span></a> +</span><span id="Expression.walk-332"><a href="#Expression.walk-332"><span class="linenos">332</span></a><span class="sd"> Args:</span> +</span><span id="Expression.walk-333"><a href="#Expression.walk-333"><span class="linenos">333</span></a><span class="sd"> bfs (bool): if set to True the BFS traversal order will be applied,</span> +</span><span id="Expression.walk-334"><a href="#Expression.walk-334"><span class="linenos">334</span></a><span class="sd"> otherwise the DFS traversal will be used instead.</span> +</span><span id="Expression.walk-335"><a href="#Expression.walk-335"><span class="linenos">335</span></a><span class="sd"> prune ((node, parent, arg_key) -> bool): callable that returns True if</span> +</span><span id="Expression.walk-336"><a href="#Expression.walk-336"><span class="linenos">336</span></a><span class="sd"> the generator should stop traversing this branch of the tree.</span> +</span><span id="Expression.walk-337"><a href="#Expression.walk-337"><span class="linenos">337</span></a> +</span><span id="Expression.walk-338"><a href="#Expression.walk-338"><span class="linenos">338</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.walk-339"><a href="#Expression.walk-339"><span class="linenos">339</span></a><span class="sd"> the generator object.</span> +</span><span id="Expression.walk-340"><a href="#Expression.walk-340"><span class="linenos">340</span></a><span class="sd"> """</span> +</span><span id="Expression.walk-341"><a href="#Expression.walk-341"><span class="linenos">341</span></a> <span class="k">if</span> <span class="n">bfs</span><span class="p">:</span> +</span><span id="Expression.walk-342"><a href="#Expression.walk-342"><span class="linenos">342</span></a> <span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">bfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="n">prune</span><span class="p">)</span> +</span><span id="Expression.walk-343"><a href="#Expression.walk-343"><span class="linenos">343</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Expression.walk-344"><a href="#Expression.walk-344"><span class="linenos">344</span></a> <span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="n">prune</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator object which visits all nodes in this tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>bfs (bool):</strong> if set to True the BFS traversal order will be applied, +otherwise the DFS traversal will be used instead.</li> +<li><strong>prune ((node, parent, arg_key) -> bool):</strong> callable that returns True if +the generator should stop traversing this branch of the tree.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>the generator object.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.dfs" class="classattr"> + <input id="Expression.dfs-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">dfs</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">parent</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">key</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">prune</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.dfs-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.dfs"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.dfs-346"><a href="#Expression.dfs-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">dfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Expression.dfs-347"><a href="#Expression.dfs-347"><span class="linenos">347</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.dfs-348"><a href="#Expression.dfs-348"><span class="linenos">348</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree in</span> +</span><span id="Expression.dfs-349"><a href="#Expression.dfs-349"><span class="linenos">349</span></a><span class="sd"> the DFS (Depth-first) order.</span> +</span><span id="Expression.dfs-350"><a href="#Expression.dfs-350"><span class="linenos">350</span></a> +</span><span id="Expression.dfs-351"><a href="#Expression.dfs-351"><span class="linenos">351</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.dfs-352"><a href="#Expression.dfs-352"><span class="linenos">352</span></a><span class="sd"> The generator object.</span> +</span><span id="Expression.dfs-353"><a href="#Expression.dfs-353"><span class="linenos">353</span></a><span class="sd"> """</span> +</span><span id="Expression.dfs-354"><a href="#Expression.dfs-354"><span class="linenos">354</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression.dfs-355"><a href="#Expression.dfs-355"><span class="linenos">355</span></a> <span class="k">yield</span> <span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="Expression.dfs-356"><a href="#Expression.dfs-356"><span class="linenos">356</span></a> <span class="k">if</span> <span class="n">prune</span> <span class="ow">and</span> <span class="n">prune</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="Expression.dfs-357"><a href="#Expression.dfs-357"><span class="linenos">357</span></a> <span class="k">return</span> +</span><span id="Expression.dfs-358"><a href="#Expression.dfs-358"><span class="linenos">358</span></a> +</span><span id="Expression.dfs-359"><a href="#Expression.dfs-359"><span class="linenos">359</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression.dfs-360"><a href="#Expression.dfs-360"><span class="linenos">360</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="Expression.dfs-361"><a href="#Expression.dfs-361"><span class="linenos">361</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression.dfs-362"><a href="#Expression.dfs-362"><span class="linenos">362</span></a> <span class="k">yield from</span> <span class="n">node</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">prune</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator object which visits all nodes in this tree in +the DFS (Depth-first) order.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The generator object.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.bfs" class="classattr"> + <input id="Expression.bfs-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bfs</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">prune</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.bfs-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.bfs"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.bfs-364"><a href="#Expression.bfs-364"><span class="linenos">364</span></a> <span class="k">def</span> <span class="nf">bfs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Expression.bfs-365"><a href="#Expression.bfs-365"><span class="linenos">365</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.bfs-366"><a href="#Expression.bfs-366"><span class="linenos">366</span></a><span class="sd"> Returns a generator object which visits all nodes in this tree in</span> +</span><span id="Expression.bfs-367"><a href="#Expression.bfs-367"><span class="linenos">367</span></a><span class="sd"> the BFS (Breadth-first) order.</span> +</span><span id="Expression.bfs-368"><a href="#Expression.bfs-368"><span class="linenos">368</span></a> +</span><span id="Expression.bfs-369"><a href="#Expression.bfs-369"><span class="linenos">369</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.bfs-370"><a href="#Expression.bfs-370"><span class="linenos">370</span></a><span class="sd"> The generator object.</span> +</span><span id="Expression.bfs-371"><a href="#Expression.bfs-371"><span class="linenos">371</span></a><span class="sd"> """</span> +</span><span id="Expression.bfs-372"><a href="#Expression.bfs-372"><span class="linenos">372</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="n">deque</span><span class="p">([(</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="kc">None</span><span class="p">)])</span> +</span><span id="Expression.bfs-373"><a href="#Expression.bfs-373"><span class="linenos">373</span></a> +</span><span id="Expression.bfs-374"><a href="#Expression.bfs-374"><span class="linenos">374</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="Expression.bfs-375"><a href="#Expression.bfs-375"><span class="linenos">375</span></a> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">popleft</span><span class="p">()</span> +</span><span id="Expression.bfs-376"><a href="#Expression.bfs-376"><span class="linenos">376</span></a> +</span><span id="Expression.bfs-377"><a href="#Expression.bfs-377"><span class="linenos">377</span></a> <span class="k">yield</span> <span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="Expression.bfs-378"><a href="#Expression.bfs-378"><span class="linenos">378</span></a> <span class="k">if</span> <span class="n">prune</span> <span class="ow">and</span> <span class="n">prune</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span><span class="p">):</span> +</span><span id="Expression.bfs-379"><a href="#Expression.bfs-379"><span class="linenos">379</span></a> <span class="k">continue</span> +</span><span id="Expression.bfs-380"><a href="#Expression.bfs-380"><span class="linenos">380</span></a> +</span><span id="Expression.bfs-381"><a href="#Expression.bfs-381"><span class="linenos">381</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression.bfs-382"><a href="#Expression.bfs-382"><span class="linenos">382</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">item</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression.bfs-383"><a href="#Expression.bfs-383"><span class="linenos">383</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="Expression.bfs-384"><a href="#Expression.bfs-384"><span class="linenos">384</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression.bfs-385"><a href="#Expression.bfs-385"><span class="linenos">385</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">node</span><span class="p">,</span> <span class="n">item</span><span class="p">,</span> <span class="n">k</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator object which visits all nodes in this tree in +the BFS (Breadth-first) order.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The generator object.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.unnest" class="classattr"> + <input id="Expression.unnest-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unnest</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.unnest-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.unnest"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.unnest-387"><a href="#Expression.unnest-387"><span class="linenos">387</span></a> <span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression.unnest-388"><a href="#Expression.unnest-388"><span class="linenos">388</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.unnest-389"><a href="#Expression.unnest-389"><span class="linenos">389</span></a><span class="sd"> Returns the first non parenthesis child or self.</span> +</span><span id="Expression.unnest-390"><a href="#Expression.unnest-390"><span class="linenos">390</span></a><span class="sd"> """</span> +</span><span id="Expression.unnest-391"><a href="#Expression.unnest-391"><span class="linenos">391</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="Expression.unnest-392"><a href="#Expression.unnest-392"><span class="linenos">392</span></a> <span class="k">while</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Paren</span><span class="p">):</span> +</span><span id="Expression.unnest-393"><a href="#Expression.unnest-393"><span class="linenos">393</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Expression.unnest-394"><a href="#Expression.unnest-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the first non parenthesis child or self.</p> +</div> + + + </div> + <div id="Expression.unalias" class="classattr"> + <input id="Expression.unalias-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unalias</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.unalias-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.unalias"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.unalias-396"><a href="#Expression.unalias-396"><span class="linenos">396</span></a> <span class="k">def</span> <span class="nf">unalias</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression.unalias-397"><a href="#Expression.unalias-397"><span class="linenos">397</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.unalias-398"><a href="#Expression.unalias-398"><span class="linenos">398</span></a><span class="sd"> Returns the inner expression if this is an Alias.</span> +</span><span id="Expression.unalias-399"><a href="#Expression.unalias-399"><span class="linenos">399</span></a><span class="sd"> """</span> +</span><span id="Expression.unalias-400"><a href="#Expression.unalias-400"><span class="linenos">400</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Alias</span><span class="p">):</span> +</span><span id="Expression.unalias-401"><a href="#Expression.unalias-401"><span class="linenos">401</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="Expression.unalias-402"><a href="#Expression.unalias-402"><span class="linenos">402</span></a> <span class="k">return</span> <span class="bp">self</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the inner expression if this is an Alias.</p> +</div> + + + </div> + <div id="Expression.unnest_operands" class="classattr"> + <input id="Expression.unnest_operands-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unnest_operands</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.unnest_operands-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.unnest_operands"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.unnest_operands-404"><a href="#Expression.unnest_operands-404"><span class="linenos">404</span></a> <span class="k">def</span> <span class="nf">unnest_operands</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression.unnest_operands-405"><a href="#Expression.unnest_operands-405"><span class="linenos">405</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.unnest_operands-406"><a href="#Expression.unnest_operands-406"><span class="linenos">406</span></a><span class="sd"> Returns unnested operands as a tuple.</span> +</span><span id="Expression.unnest_operands-407"><a href="#Expression.unnest_operands-407"><span class="linenos">407</span></a><span class="sd"> """</span> +</span><span id="Expression.unnest_operands-408"><a href="#Expression.unnest_operands-408"><span class="linenos">408</span></a> <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">arg</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">if</span> <span class="n">arg</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns unnested operands as a tuple.</p> +</div> + + + </div> + <div id="Expression.flatten" class="classattr"> + <input id="Expression.flatten-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">flatten</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">unnest</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.flatten-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.flatten"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.flatten-410"><a href="#Expression.flatten-410"><span class="linenos">410</span></a> <span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">unnest</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Expression.flatten-411"><a href="#Expression.flatten-411"><span class="linenos">411</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.flatten-412"><a href="#Expression.flatten-412"><span class="linenos">412</span></a><span class="sd"> Returns a generator which yields child nodes who's parents are the same class.</span> +</span><span id="Expression.flatten-413"><a href="#Expression.flatten-413"><span class="linenos">413</span></a> +</span><span id="Expression.flatten-414"><a href="#Expression.flatten-414"><span class="linenos">414</span></a><span class="sd"> A AND B AND C -> [A, B, C]</span> +</span><span id="Expression.flatten-415"><a href="#Expression.flatten-415"><span class="linenos">415</span></a><span class="sd"> """</span> +</span><span id="Expression.flatten-416"><a href="#Expression.flatten-416"><span class="linenos">416</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dfs</span><span class="p">(</span><span class="n">prune</span><span class="o">=</span><span class="k">lambda</span> <span class="n">n</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="n">p</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)):</span> +</span><span id="Expression.flatten-417"><a href="#Expression.flatten-417"><span class="linenos">417</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">):</span> +</span><span id="Expression.flatten-418"><a href="#Expression.flatten-418"><span class="linenos">418</span></a> <span class="k">yield</span> <span class="n">node</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> <span class="k">if</span> <span class="n">unnest</span> <span class="k">else</span> <span class="n">node</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator which yields child nodes who's parents are the same class.</p> + +<p>A AND B AND C -> [A, B, C]</p> +</div> + + + </div> + <div id="Expression.sql" class="classattr"> + <input id="Expression.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Expression.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.sql-426"><a href="#Expression.sql-426"><span class="linenos">426</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Expression.sql-427"><a href="#Expression.sql-427"><span class="linenos">427</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.sql-428"><a href="#Expression.sql-428"><span class="linenos">428</span></a><span class="sd"> Returns SQL string representation of this tree.</span> +</span><span id="Expression.sql-429"><a href="#Expression.sql-429"><span class="linenos">429</span></a> +</span><span id="Expression.sql-430"><a href="#Expression.sql-430"><span class="linenos">430</span></a><span class="sd"> Args:</span> +</span><span id="Expression.sql-431"><a href="#Expression.sql-431"><span class="linenos">431</span></a><span class="sd"> dialect: the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql").</span> +</span><span id="Expression.sql-432"><a href="#Expression.sql-432"><span class="linenos">432</span></a><span class="sd"> opts: other `sqlglot.generator.Generator` options.</span> +</span><span id="Expression.sql-433"><a href="#Expression.sql-433"><span class="linenos">433</span></a> +</span><span id="Expression.sql-434"><a href="#Expression.sql-434"><span class="linenos">434</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.sql-435"><a href="#Expression.sql-435"><span class="linenos">435</span></a><span class="sd"> The SQL string.</span> +</span><span id="Expression.sql-436"><a href="#Expression.sql-436"><span class="linenos">436</span></a><span class="sd"> """</span> +</span><span id="Expression.sql-437"><a href="#Expression.sql-437"><span class="linenos">437</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="Expression.sql-438"><a href="#Expression.sql-438"><span class="linenos">438</span></a> +</span><span id="Expression.sql-439"><a href="#Expression.sql-439"><span class="linenos">439</span></a> <span class="k">return</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">dialect</span><span class="p">)()</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns SQL string representation of this tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>dialect:</strong> the dialect of the output SQL string (eg. "spark", "hive", "presto", "mysql").</li> +<li><strong>opts:</strong> other <code><a href="generator.html#Generator">sqlglot.generator.Generator</a></code> options.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The SQL string.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.transform" class="classattr"> + <input id="Expression.transform-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transform</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">fun</span>, </span><span class="param"><span class="o">*</span><span class="n">args</span>, </span><span class="param"><span class="n">copy</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.transform-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.transform"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.transform-465"><a href="#Expression.transform-465"><span class="linenos">465</span></a> <span class="k">def</span> <span class="nf">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">fun</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="Expression.transform-466"><a href="#Expression.transform-466"><span class="linenos">466</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.transform-467"><a href="#Expression.transform-467"><span class="linenos">467</span></a><span class="sd"> Recursively visits all tree nodes (excluding already transformed ones)</span> +</span><span id="Expression.transform-468"><a href="#Expression.transform-468"><span class="linenos">468</span></a><span class="sd"> and applies the given transformation function to each node.</span> +</span><span id="Expression.transform-469"><a href="#Expression.transform-469"><span class="linenos">469</span></a> +</span><span id="Expression.transform-470"><a href="#Expression.transform-470"><span class="linenos">470</span></a><span class="sd"> Args:</span> +</span><span id="Expression.transform-471"><a href="#Expression.transform-471"><span class="linenos">471</span></a><span class="sd"> fun (function): a function which takes a node as an argument and returns a</span> +</span><span id="Expression.transform-472"><a href="#Expression.transform-472"><span class="linenos">472</span></a><span class="sd"> new transformed node or the same node without modifications. If the function</span> +</span><span id="Expression.transform-473"><a href="#Expression.transform-473"><span class="linenos">473</span></a><span class="sd"> returns None, then the corresponding node will be removed from the syntax tree.</span> +</span><span id="Expression.transform-474"><a href="#Expression.transform-474"><span class="linenos">474</span></a><span class="sd"> copy (bool): if set to True a new tree instance is constructed, otherwise the tree is</span> +</span><span id="Expression.transform-475"><a href="#Expression.transform-475"><span class="linenos">475</span></a><span class="sd"> modified in place.</span> +</span><span id="Expression.transform-476"><a href="#Expression.transform-476"><span class="linenos">476</span></a> +</span><span id="Expression.transform-477"><a href="#Expression.transform-477"><span class="linenos">477</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.transform-478"><a href="#Expression.transform-478"><span class="linenos">478</span></a><span class="sd"> The transformed tree.</span> +</span><span id="Expression.transform-479"><a href="#Expression.transform-479"><span class="linenos">479</span></a><span class="sd"> """</span> +</span><span id="Expression.transform-480"><a href="#Expression.transform-480"><span class="linenos">480</span></a> <span class="n">node</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> <span class="k">if</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span> +</span><span id="Expression.transform-481"><a href="#Expression.transform-481"><span class="linenos">481</span></a> <span class="n">new_node</span> <span class="o">=</span> <span class="n">fun</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Expression.transform-482"><a href="#Expression.transform-482"><span class="linenos">482</span></a> +</span><span id="Expression.transform-483"><a href="#Expression.transform-483"><span class="linenos">483</span></a> <span class="k">if</span> <span class="n">new_node</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">new_node</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="Expression.transform-484"><a href="#Expression.transform-484"><span class="linenos">484</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="Expression.transform-485"><a href="#Expression.transform-485"><span class="linenos">485</span></a> <span class="k">if</span> <span class="n">new_node</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">node</span><span class="p">:</span> +</span><span id="Expression.transform-486"><a href="#Expression.transform-486"><span class="linenos">486</span></a> <span class="n">new_node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression.transform-487"><a href="#Expression.transform-487"><span class="linenos">487</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span><span id="Expression.transform-488"><a href="#Expression.transform-488"><span class="linenos">488</span></a> +</span><span id="Expression.transform-489"><a href="#Expression.transform-489"><span class="linenos">489</span></a> <span class="n">replace_children</span><span class="p">(</span><span class="n">new_node</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">child</span><span class="p">:</span> <span class="n">child</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">fun</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">))</span> +</span><span id="Expression.transform-490"><a href="#Expression.transform-490"><span class="linenos">490</span></a> <span class="k">return</span> <span class="n">new_node</span> +</span></pre></div> + + + <div class="docstring"><p>Recursively visits all tree nodes (excluding already transformed ones) +and applies the given transformation function to each node.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>fun (function):</strong> a function which takes a node as an argument and returns a +new transformed node or the same node without modifications. If the function +returns None, then the corresponding node will be removed from the syntax tree.</li> +<li><strong>copy (bool):</strong> if set to True a new tree instance is constructed, otherwise the tree is +modified in place.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The transformed tree.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.replace" class="classattr"> + <input id="Expression.replace-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.replace-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.replace"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.replace-492"><a href="#Expression.replace-492"><span class="linenos">492</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="Expression.replace-493"><a href="#Expression.replace-493"><span class="linenos">493</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.replace-494"><a href="#Expression.replace-494"><span class="linenos">494</span></a><span class="sd"> Swap out this expression with a new expression.</span> +</span><span id="Expression.replace-495"><a href="#Expression.replace-495"><span class="linenos">495</span></a> +</span><span id="Expression.replace-496"><a href="#Expression.replace-496"><span class="linenos">496</span></a><span class="sd"> For example::</span> +</span><span id="Expression.replace-497"><a href="#Expression.replace-497"><span class="linenos">497</span></a> +</span><span id="Expression.replace-498"><a href="#Expression.replace-498"><span class="linenos">498</span></a><span class="sd"> >>> tree = Select().select("x").from_("tbl")</span> +</span><span id="Expression.replace-499"><a href="#Expression.replace-499"><span class="linenos">499</span></a><span class="sd"> >>> tree.find(Column).replace(Column(this="y"))</span> +</span><span id="Expression.replace-500"><a href="#Expression.replace-500"><span class="linenos">500</span></a><span class="sd"> (COLUMN this: y)</span> +</span><span id="Expression.replace-501"><a href="#Expression.replace-501"><span class="linenos">501</span></a><span class="sd"> >>> tree.sql()</span> +</span><span id="Expression.replace-502"><a href="#Expression.replace-502"><span class="linenos">502</span></a><span class="sd"> 'SELECT y FROM tbl'</span> +</span><span id="Expression.replace-503"><a href="#Expression.replace-503"><span class="linenos">503</span></a> +</span><span id="Expression.replace-504"><a href="#Expression.replace-504"><span class="linenos">504</span></a><span class="sd"> Args:</span> +</span><span id="Expression.replace-505"><a href="#Expression.replace-505"><span class="linenos">505</span></a><span class="sd"> expression (Expression|None): new node</span> +</span><span id="Expression.replace-506"><a href="#Expression.replace-506"><span class="linenos">506</span></a> +</span><span id="Expression.replace-507"><a href="#Expression.replace-507"><span class="linenos">507</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.replace-508"><a href="#Expression.replace-508"><span class="linenos">508</span></a><span class="sd"> The new expression or expressions.</span> +</span><span id="Expression.replace-509"><a href="#Expression.replace-509"><span class="linenos">509</span></a><span class="sd"> """</span> +</span><span id="Expression.replace-510"><a href="#Expression.replace-510"><span class="linenos">510</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span> +</span><span id="Expression.replace-511"><a href="#Expression.replace-511"><span class="linenos">511</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Expression.replace-512"><a href="#Expression.replace-512"><span class="linenos">512</span></a> +</span><span id="Expression.replace-513"><a href="#Expression.replace-513"><span class="linenos">513</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> +</span><span id="Expression.replace-514"><a href="#Expression.replace-514"><span class="linenos">514</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Expression.replace-515"><a href="#Expression.replace-515"><span class="linenos">515</span></a> +</span><span id="Expression.replace-516"><a href="#Expression.replace-516"><span class="linenos">516</span></a> <span class="n">replace_children</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">child</span><span class="p">:</span> <span class="n">expression</span> <span class="k">if</span> <span class="n">child</span> <span class="ow">is</span> <span class="bp">self</span> <span class="k">else</span> <span class="n">child</span><span class="p">)</span> +</span><span id="Expression.replace-517"><a href="#Expression.replace-517"><span class="linenos">517</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Swap out this expression with a new expression.</p> + +<p>For example::</p> + +<pre><code>>>> tree = Select().select("x").from_("tbl") +>>> tree.find(Column).replace(Column(this="y")) +(COLUMN this: y) +>>> tree.sql() +'SELECT y FROM tbl' +</code></pre> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (Expression|None):</strong> new node</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The new expression or expressions.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.pop" class="classattr"> + <input id="Expression.pop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pop</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.pop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.pop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.pop-519"><a href="#Expression.pop-519"><span class="linenos">519</span></a> <span class="k">def</span> <span class="nf">pop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression.pop-520"><a href="#Expression.pop-520"><span class="linenos">520</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.pop-521"><a href="#Expression.pop-521"><span class="linenos">521</span></a><span class="sd"> Remove this expression from its AST.</span> +</span><span id="Expression.pop-522"><a href="#Expression.pop-522"><span class="linenos">522</span></a><span class="sd"> """</span> +</span><span id="Expression.pop-523"><a href="#Expression.pop-523"><span class="linenos">523</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Remove this expression from its AST.</p> +</div> + + + </div> + <div id="Expression.assert_is" class="classattr"> + <input id="Expression.assert_is-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">assert_is</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">type_</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.assert_is-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.assert_is"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.assert_is-525"><a href="#Expression.assert_is-525"><span class="linenos">525</span></a> <span class="k">def</span> <span class="nf">assert_is</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_</span><span class="p">):</span> +</span><span id="Expression.assert_is-526"><a href="#Expression.assert_is-526"><span class="linenos">526</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.assert_is-527"><a href="#Expression.assert_is-527"><span class="linenos">527</span></a><span class="sd"> Assert that this `Expression` is an instance of `type_`.</span> +</span><span id="Expression.assert_is-528"><a href="#Expression.assert_is-528"><span class="linenos">528</span></a> +</span><span id="Expression.assert_is-529"><a href="#Expression.assert_is-529"><span class="linenos">529</span></a><span class="sd"> If it is NOT an instance of `type_`, this raises an assertion error.</span> +</span><span id="Expression.assert_is-530"><a href="#Expression.assert_is-530"><span class="linenos">530</span></a><span class="sd"> Otherwise, this returns this expression.</span> +</span><span id="Expression.assert_is-531"><a href="#Expression.assert_is-531"><span class="linenos">531</span></a> +</span><span id="Expression.assert_is-532"><a href="#Expression.assert_is-532"><span class="linenos">532</span></a><span class="sd"> Examples:</span> +</span><span id="Expression.assert_is-533"><a href="#Expression.assert_is-533"><span class="linenos">533</span></a><span class="sd"> This is useful for type security in chained expressions:</span> +</span><span id="Expression.assert_is-534"><a href="#Expression.assert_is-534"><span class="linenos">534</span></a> +</span><span id="Expression.assert_is-535"><a href="#Expression.assert_is-535"><span class="linenos">535</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Expression.assert_is-536"><a href="#Expression.assert_is-536"><span class="linenos">536</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT x from y").assert_is(Select).select("z").sql()</span> +</span><span id="Expression.assert_is-537"><a href="#Expression.assert_is-537"><span class="linenos">537</span></a><span class="sd"> 'SELECT x, z FROM y'</span> +</span><span id="Expression.assert_is-538"><a href="#Expression.assert_is-538"><span class="linenos">538</span></a><span class="sd"> """</span> +</span><span id="Expression.assert_is-539"><a href="#Expression.assert_is-539"><span class="linenos">539</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type_</span><span class="p">)</span> +</span><span id="Expression.assert_is-540"><a href="#Expression.assert_is-540"><span class="linenos">540</span></a> <span class="k">return</span> <span class="bp">self</span> +</span></pre></div> + + + <div class="docstring"><p>Assert that this <code><a href="#Expression">Expression</a></code> is an instance of <code>type_</code>.</p> + +<p>If it is NOT an instance of <code>type_</code>, this raises an assertion error. +Otherwise, this returns this expression.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <p>This is useful for type security in chained expressions:</p> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT x from y"</span><span class="p">)</span><span class="o">.</span><span class="n">assert_is</span><span class="p">(</span><span class="n">Select</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"z"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x, z FROM y'</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div id="Expression.error_messages" class="classattr"> + <input id="Expression.error_messages-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">error_messages</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">args</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Sequence</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Expression.error_messages-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.error_messages"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.error_messages-542"><a href="#Expression.error_messages-542"><span class="linenos">542</span></a> <span class="k">def</span> <span class="nf">error_messages</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Expression.error_messages-543"><a href="#Expression.error_messages-543"><span class="linenos">543</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.error_messages-544"><a href="#Expression.error_messages-544"><span class="linenos">544</span></a><span class="sd"> Checks if this expression is valid (e.g. all mandatory args are set).</span> +</span><span id="Expression.error_messages-545"><a href="#Expression.error_messages-545"><span class="linenos">545</span></a> +</span><span id="Expression.error_messages-546"><a href="#Expression.error_messages-546"><span class="linenos">546</span></a><span class="sd"> Args:</span> +</span><span id="Expression.error_messages-547"><a href="#Expression.error_messages-547"><span class="linenos">547</span></a><span class="sd"> args: a sequence of values that were used to instantiate a Func expression. This is used</span> +</span><span id="Expression.error_messages-548"><a href="#Expression.error_messages-548"><span class="linenos">548</span></a><span class="sd"> to check that the provided arguments don't exceed the function argument limit.</span> +</span><span id="Expression.error_messages-549"><a href="#Expression.error_messages-549"><span class="linenos">549</span></a> +</span><span id="Expression.error_messages-550"><a href="#Expression.error_messages-550"><span class="linenos">550</span></a><span class="sd"> Returns:</span> +</span><span id="Expression.error_messages-551"><a href="#Expression.error_messages-551"><span class="linenos">551</span></a><span class="sd"> A list of error messages for all possible errors that were found.</span> +</span><span id="Expression.error_messages-552"><a href="#Expression.error_messages-552"><span class="linenos">552</span></a><span class="sd"> """</span> +</span><span id="Expression.error_messages-553"><a href="#Expression.error_messages-553"><span class="linenos">553</span></a> <span class="n">errors</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Expression.error_messages-554"><a href="#Expression.error_messages-554"><span class="linenos">554</span></a> +</span><span id="Expression.error_messages-555"><a href="#Expression.error_messages-555"><span class="linenos">555</span></a> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Expression.error_messages-556"><a href="#Expression.error_messages-556"><span class="linenos">556</span></a> <span class="k">if</span> <span class="n">k</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">:</span> +</span><span id="Expression.error_messages-557"><a href="#Expression.error_messages-557"><span class="linenos">557</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unexpected keyword: '</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">' for </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Expression.error_messages-558"><a href="#Expression.error_messages-558"><span class="linenos">558</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">mandatory</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Expression.error_messages-559"><a href="#Expression.error_messages-559"><span class="linenos">559</span></a> <span class="n">v</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> +</span><span id="Expression.error_messages-560"><a href="#Expression.error_messages-560"><span class="linenos">560</span></a> <span class="k">if</span> <span class="n">mandatory</span> <span class="ow">and</span> <span class="p">(</span><span class="n">v</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">v</span><span class="p">)):</span> +</span><span id="Expression.error_messages-561"><a href="#Expression.error_messages-561"><span class="linenos">561</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Required keyword: '</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">' missing for </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Expression.error_messages-562"><a href="#Expression.error_messages-562"><span class="linenos">562</span></a> +</span><span id="Expression.error_messages-563"><a href="#Expression.error_messages-563"><span class="linenos">563</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Expression.error_messages-564"><a href="#Expression.error_messages-564"><span class="linenos">564</span></a> <span class="n">args</span> +</span><span id="Expression.error_messages-565"><a href="#Expression.error_messages-565"><span class="linenos">565</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Func</span><span class="p">)</span> +</span><span id="Expression.error_messages-566"><a href="#Expression.error_messages-566"><span class="linenos">566</span></a> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> +</span><span id="Expression.error_messages-567"><a href="#Expression.error_messages-567"><span class="linenos">567</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_var_len_args</span> +</span><span id="Expression.error_messages-568"><a href="#Expression.error_messages-568"><span class="linenos">568</span></a> <span class="p">):</span> +</span><span id="Expression.error_messages-569"><a href="#Expression.error_messages-569"><span class="linenos">569</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Expression.error_messages-570"><a href="#Expression.error_messages-570"><span class="linenos">570</span></a> <span class="sa">f</span><span class="s2">"The number of provided arguments (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">) is greater than "</span> +</span><span id="Expression.error_messages-571"><a href="#Expression.error_messages-571"><span class="linenos">571</span></a> <span class="sa">f</span><span class="s2">"the maximum number of supported arguments (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Expression.error_messages-572"><a href="#Expression.error_messages-572"><span class="linenos">572</span></a> <span class="p">)</span> +</span><span id="Expression.error_messages-573"><a href="#Expression.error_messages-573"><span class="linenos">573</span></a> +</span><span id="Expression.error_messages-574"><a href="#Expression.error_messages-574"><span class="linenos">574</span></a> <span class="k">return</span> <span class="n">errors</span> +</span></pre></div> + + + <div class="docstring"><p>Checks if this expression is valid (e.g. all mandatory args are set).</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>args:</strong> a sequence of values that were used to instantiate a Func expression. This is used +to check that the provided arguments don't exceed the function argument limit.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A list of error messages for all possible errors that were found.</p> +</blockquote> +</div> + + + </div> + <div id="Expression.dump" class="classattr"> + <input id="Expression.dump-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">dump</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.dump-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.dump"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.dump-576"><a href="#Expression.dump-576"><span class="linenos">576</span></a> <span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Expression.dump-577"><a href="#Expression.dump-577"><span class="linenos">577</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.dump-578"><a href="#Expression.dump-578"><span class="linenos">578</span></a><span class="sd"> Dump this Expression to a JSON-serializable dict.</span> +</span><span id="Expression.dump-579"><a href="#Expression.dump-579"><span class="linenos">579</span></a><span class="sd"> """</span> +</span><span id="Expression.dump-580"><a href="#Expression.dump-580"><span class="linenos">580</span></a> <span class="kn">from</span> <span class="nn">sqlglot.serde</span> <span class="kn">import</span> <span class="n">dump</span> +</span><span id="Expression.dump-581"><a href="#Expression.dump-581"><span class="linenos">581</span></a> +</span><span id="Expression.dump-582"><a href="#Expression.dump-582"><span class="linenos">582</span></a> <span class="k">return</span> <span class="n">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Dump this Expression to a JSON-serializable dict.</p> +</div> + + + </div> + <div id="Expression.load" class="classattr"> + <input id="Expression.load-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">load</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">obj</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Expression.load-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Expression.load"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Expression.load-584"><a href="#Expression.load-584"><span class="linenos">584</span></a> <span class="nd">@classmethod</span> +</span><span id="Expression.load-585"><a href="#Expression.load-585"><span class="linenos">585</span></a> <span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span> +</span><span id="Expression.load-586"><a href="#Expression.load-586"><span class="linenos">586</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Expression.load-587"><a href="#Expression.load-587"><span class="linenos">587</span></a><span class="sd"> Load a dict (as returned by `Expression.dump`) into an Expression instance.</span> +</span><span id="Expression.load-588"><a href="#Expression.load-588"><span class="linenos">588</span></a><span class="sd"> """</span> +</span><span id="Expression.load-589"><a href="#Expression.load-589"><span class="linenos">589</span></a> <span class="kn">from</span> <span class="nn">sqlglot.serde</span> <span class="kn">import</span> <span class="n">load</span> +</span><span id="Expression.load-590"><a href="#Expression.load-590"><span class="linenos">590</span></a> +</span><span id="Expression.load-591"><a href="#Expression.load-591"><span class="linenos">591</span></a> <span class="k">return</span> <span class="n">load</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Load a dict (as returned by <code><a href="#Expression.dump">Expression.dump</a></code>) into an Expression instance.</p> +</div> + + + </div> + </section> + <section id="Condition"> + <input id="Condition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Condition</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Condition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Condition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Condition-601"><a href="#Condition-601"><span class="linenos">601</span></a><span class="k">class</span> <span class="nc">Condition</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Condition-602"><a href="#Condition-602"><span class="linenos">602</span></a> <span class="k">def</span> <span class="nf">and_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Condition-603"><a href="#Condition-603"><span class="linenos">603</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Condition-604"><a href="#Condition-604"><span class="linenos">604</span></a><span class="sd"> AND this condition with one or multiple expressions.</span> +</span><span id="Condition-605"><a href="#Condition-605"><span class="linenos">605</span></a> +</span><span id="Condition-606"><a href="#Condition-606"><span class="linenos">606</span></a><span class="sd"> Example:</span> +</span><span id="Condition-607"><a href="#Condition-607"><span class="linenos">607</span></a><span class="sd"> >>> condition("x=1").and_("y=1").sql()</span> +</span><span id="Condition-608"><a href="#Condition-608"><span class="linenos">608</span></a><span class="sd"> 'x = 1 AND y = 1'</span> +</span><span id="Condition-609"><a href="#Condition-609"><span class="linenos">609</span></a> +</span><span id="Condition-610"><a href="#Condition-610"><span class="linenos">610</span></a><span class="sd"> Args:</span> +</span><span id="Condition-611"><a href="#Condition-611"><span class="linenos">611</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Condition-612"><a href="#Condition-612"><span class="linenos">612</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Condition-613"><a href="#Condition-613"><span class="linenos">613</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Condition-614"><a href="#Condition-614"><span class="linenos">614</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Condition-615"><a href="#Condition-615"><span class="linenos">615</span></a> +</span><span id="Condition-616"><a href="#Condition-616"><span class="linenos">616</span></a><span class="sd"> Returns:</span> +</span><span id="Condition-617"><a href="#Condition-617"><span class="linenos">617</span></a><span class="sd"> And: the new condition.</span> +</span><span id="Condition-618"><a href="#Condition-618"><span class="linenos">618</span></a><span class="sd"> """</span> +</span><span id="Condition-619"><a href="#Condition-619"><span class="linenos">619</span></a> <span class="k">return</span> <span class="n">and_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Condition-620"><a href="#Condition-620"><span class="linenos">620</span></a> +</span><span id="Condition-621"><a href="#Condition-621"><span class="linenos">621</span></a> <span class="k">def</span> <span class="nf">or_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Condition-622"><a href="#Condition-622"><span class="linenos">622</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Condition-623"><a href="#Condition-623"><span class="linenos">623</span></a><span class="sd"> OR this condition with one or multiple expressions.</span> +</span><span id="Condition-624"><a href="#Condition-624"><span class="linenos">624</span></a> +</span><span id="Condition-625"><a href="#Condition-625"><span class="linenos">625</span></a><span class="sd"> Example:</span> +</span><span id="Condition-626"><a href="#Condition-626"><span class="linenos">626</span></a><span class="sd"> >>> condition("x=1").or_("y=1").sql()</span> +</span><span id="Condition-627"><a href="#Condition-627"><span class="linenos">627</span></a><span class="sd"> 'x = 1 OR y = 1'</span> +</span><span id="Condition-628"><a href="#Condition-628"><span class="linenos">628</span></a> +</span><span id="Condition-629"><a href="#Condition-629"><span class="linenos">629</span></a><span class="sd"> Args:</span> +</span><span id="Condition-630"><a href="#Condition-630"><span class="linenos">630</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Condition-631"><a href="#Condition-631"><span class="linenos">631</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Condition-632"><a href="#Condition-632"><span class="linenos">632</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Condition-633"><a href="#Condition-633"><span class="linenos">633</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Condition-634"><a href="#Condition-634"><span class="linenos">634</span></a> +</span><span id="Condition-635"><a href="#Condition-635"><span class="linenos">635</span></a><span class="sd"> Returns:</span> +</span><span id="Condition-636"><a href="#Condition-636"><span class="linenos">636</span></a><span class="sd"> Or: the new condition.</span> +</span><span id="Condition-637"><a href="#Condition-637"><span class="linenos">637</span></a><span class="sd"> """</span> +</span><span id="Condition-638"><a href="#Condition-638"><span class="linenos">638</span></a> <span class="k">return</span> <span class="n">or_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Condition-639"><a href="#Condition-639"><span class="linenos">639</span></a> +</span><span id="Condition-640"><a href="#Condition-640"><span class="linenos">640</span></a> <span class="k">def</span> <span class="nf">not_</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Condition-641"><a href="#Condition-641"><span class="linenos">641</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Condition-642"><a href="#Condition-642"><span class="linenos">642</span></a><span class="sd"> Wrap this condition with NOT.</span> +</span><span id="Condition-643"><a href="#Condition-643"><span class="linenos">643</span></a> +</span><span id="Condition-644"><a href="#Condition-644"><span class="linenos">644</span></a><span class="sd"> Example:</span> +</span><span id="Condition-645"><a href="#Condition-645"><span class="linenos">645</span></a><span class="sd"> >>> condition("x=1").not_().sql()</span> +</span><span id="Condition-646"><a href="#Condition-646"><span class="linenos">646</span></a><span class="sd"> 'NOT x = 1'</span> +</span><span id="Condition-647"><a href="#Condition-647"><span class="linenos">647</span></a> +</span><span id="Condition-648"><a href="#Condition-648"><span class="linenos">648</span></a><span class="sd"> Returns:</span> +</span><span id="Condition-649"><a href="#Condition-649"><span class="linenos">649</span></a><span class="sd"> Not: the new condition.</span> +</span><span id="Condition-650"><a href="#Condition-650"><span class="linenos">650</span></a><span class="sd"> """</span> +</span><span id="Condition-651"><a href="#Condition-651"><span class="linenos">651</span></a> <span class="k">return</span> <span class="n">not_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Condition.and_" class="classattr"> + <input id="Condition.and_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">and_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Condition.and_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Condition.and_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Condition.and_-602"><a href="#Condition.and_-602"><span class="linenos">602</span></a> <span class="k">def</span> <span class="nf">and_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Condition.and_-603"><a href="#Condition.and_-603"><span class="linenos">603</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Condition.and_-604"><a href="#Condition.and_-604"><span class="linenos">604</span></a><span class="sd"> AND this condition with one or multiple expressions.</span> +</span><span id="Condition.and_-605"><a href="#Condition.and_-605"><span class="linenos">605</span></a> +</span><span id="Condition.and_-606"><a href="#Condition.and_-606"><span class="linenos">606</span></a><span class="sd"> Example:</span> +</span><span id="Condition.and_-607"><a href="#Condition.and_-607"><span class="linenos">607</span></a><span class="sd"> >>> condition("x=1").and_("y=1").sql()</span> +</span><span id="Condition.and_-608"><a href="#Condition.and_-608"><span class="linenos">608</span></a><span class="sd"> 'x = 1 AND y = 1'</span> +</span><span id="Condition.and_-609"><a href="#Condition.and_-609"><span class="linenos">609</span></a> +</span><span id="Condition.and_-610"><a href="#Condition.and_-610"><span class="linenos">610</span></a><span class="sd"> Args:</span> +</span><span id="Condition.and_-611"><a href="#Condition.and_-611"><span class="linenos">611</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Condition.and_-612"><a href="#Condition.and_-612"><span class="linenos">612</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Condition.and_-613"><a href="#Condition.and_-613"><span class="linenos">613</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Condition.and_-614"><a href="#Condition.and_-614"><span class="linenos">614</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Condition.and_-615"><a href="#Condition.and_-615"><span class="linenos">615</span></a> +</span><span id="Condition.and_-616"><a href="#Condition.and_-616"><span class="linenos">616</span></a><span class="sd"> Returns:</span> +</span><span id="Condition.and_-617"><a href="#Condition.and_-617"><span class="linenos">617</span></a><span class="sd"> And: the new condition.</span> +</span><span id="Condition.and_-618"><a href="#Condition.and_-618"><span class="linenos">618</span></a><span class="sd"> """</span> +</span><span id="Condition.and_-619"><a href="#Condition.and_-619"><span class="linenos">619</span></a> <span class="k">return</span> <span class="n">and_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>AND this condition with one or multiple expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">condition</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">)</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="s2">"y=1"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'x = 1 AND y = 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>And: the new condition.</p> +</blockquote> +</div> + + + </div> + <div id="Condition.or_" class="classattr"> + <input id="Condition.or_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">or_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Condition.or_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Condition.or_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Condition.or_-621"><a href="#Condition.or_-621"><span class="linenos">621</span></a> <span class="k">def</span> <span class="nf">or_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Condition.or_-622"><a href="#Condition.or_-622"><span class="linenos">622</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Condition.or_-623"><a href="#Condition.or_-623"><span class="linenos">623</span></a><span class="sd"> OR this condition with one or multiple expressions.</span> +</span><span id="Condition.or_-624"><a href="#Condition.or_-624"><span class="linenos">624</span></a> +</span><span id="Condition.or_-625"><a href="#Condition.or_-625"><span class="linenos">625</span></a><span class="sd"> Example:</span> +</span><span id="Condition.or_-626"><a href="#Condition.or_-626"><span class="linenos">626</span></a><span class="sd"> >>> condition("x=1").or_("y=1").sql()</span> +</span><span id="Condition.or_-627"><a href="#Condition.or_-627"><span class="linenos">627</span></a><span class="sd"> 'x = 1 OR y = 1'</span> +</span><span id="Condition.or_-628"><a href="#Condition.or_-628"><span class="linenos">628</span></a> +</span><span id="Condition.or_-629"><a href="#Condition.or_-629"><span class="linenos">629</span></a><span class="sd"> Args:</span> +</span><span id="Condition.or_-630"><a href="#Condition.or_-630"><span class="linenos">630</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Condition.or_-631"><a href="#Condition.or_-631"><span class="linenos">631</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Condition.or_-632"><a href="#Condition.or_-632"><span class="linenos">632</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Condition.or_-633"><a href="#Condition.or_-633"><span class="linenos">633</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Condition.or_-634"><a href="#Condition.or_-634"><span class="linenos">634</span></a> +</span><span id="Condition.or_-635"><a href="#Condition.or_-635"><span class="linenos">635</span></a><span class="sd"> Returns:</span> +</span><span id="Condition.or_-636"><a href="#Condition.or_-636"><span class="linenos">636</span></a><span class="sd"> Or: the new condition.</span> +</span><span id="Condition.or_-637"><a href="#Condition.or_-637"><span class="linenos">637</span></a><span class="sd"> """</span> +</span><span id="Condition.or_-638"><a href="#Condition.or_-638"><span class="linenos">638</span></a> <span class="k">return</span> <span class="n">or_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>OR this condition with one or multiple expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">condition</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">)</span><span class="o">.</span><span class="n">or_</span><span class="p">(</span><span class="s2">"y=1"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'x = 1 OR y = 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Or: the new condition.</p> +</blockquote> +</div> + + + </div> + <div id="Condition.not_" class="classattr"> + <input id="Condition.not_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">not_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Condition.not_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Condition.not_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Condition.not_-640"><a href="#Condition.not_-640"><span class="linenos">640</span></a> <span class="k">def</span> <span class="nf">not_</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Condition.not_-641"><a href="#Condition.not_-641"><span class="linenos">641</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Condition.not_-642"><a href="#Condition.not_-642"><span class="linenos">642</span></a><span class="sd"> Wrap this condition with NOT.</span> +</span><span id="Condition.not_-643"><a href="#Condition.not_-643"><span class="linenos">643</span></a> +</span><span id="Condition.not_-644"><a href="#Condition.not_-644"><span class="linenos">644</span></a><span class="sd"> Example:</span> +</span><span id="Condition.not_-645"><a href="#Condition.not_-645"><span class="linenos">645</span></a><span class="sd"> >>> condition("x=1").not_().sql()</span> +</span><span id="Condition.not_-646"><a href="#Condition.not_-646"><span class="linenos">646</span></a><span class="sd"> 'NOT x = 1'</span> +</span><span id="Condition.not_-647"><a href="#Condition.not_-647"><span class="linenos">647</span></a> +</span><span id="Condition.not_-648"><a href="#Condition.not_-648"><span class="linenos">648</span></a><span class="sd"> Returns:</span> +</span><span id="Condition.not_-649"><a href="#Condition.not_-649"><span class="linenos">649</span></a><span class="sd"> Not: the new condition.</span> +</span><span id="Condition.not_-650"><a href="#Condition.not_-650"><span class="linenos">650</span></a><span class="sd"> """</span> +</span><span id="Condition.not_-651"><a href="#Condition.not_-651"><span class="linenos">651</span></a> <span class="k">return</span> <span class="n">not_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Wrap this condition with NOT.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">condition</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">)</span><span class="o">.</span><span class="n">not_</span><span class="p">()</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'NOT x = 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Not: the new condition.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Condition.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Condition.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Condition.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Condition.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Condition.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Condition.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Condition.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Condition.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Condition.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Condition.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Condition.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Condition.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Condition.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Condition.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Condition.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Condition.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Condition.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Condition.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Condition.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Condition.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Condition.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Condition.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Condition.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Condition.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Condition.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Condition.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Condition.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Condition.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Condition.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Condition.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Condition.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Condition.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Condition.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Predicate"> + <input id="Predicate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Predicate</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Predicate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Predicate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Predicate-654"><a href="#Predicate-654"><span class="linenos">654</span></a><span class="k">class</span> <span class="nc">Predicate</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Predicate-655"><a href="#Predicate-655"><span class="linenos">655</span></a><span class="w"> </span><span class="sd">"""Relationships like x = y, x > 1, x >= y."""</span> +</span></pre></div> + + + <div class="docstring"><p>Relationships like x = y, x > 1, x >= y.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Predicate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Predicate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Predicate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Predicate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Predicate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Predicate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Predicate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Predicate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Predicate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Predicate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Predicate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Predicate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Predicate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Predicate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Predicate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Predicate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Predicate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Predicate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Predicate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Predicate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Predicate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Predicate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Predicate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Predicate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Predicate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Predicate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Predicate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Predicate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Predicate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Predicate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Predicate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Predicate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Predicate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Predicate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Predicate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Predicate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DerivedTable"> + <input id="DerivedTable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DerivedTable</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="DerivedTable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DerivedTable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DerivedTable-658"><a href="#DerivedTable-658"><span class="linenos">658</span></a><span class="k">class</span> <span class="nc">DerivedTable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="DerivedTable-659"><a href="#DerivedTable-659"><span class="linenos">659</span></a> <span class="nd">@property</span> +</span><span id="DerivedTable-660"><a href="#DerivedTable-660"><span class="linenos">660</span></a> <span class="k">def</span> <span class="nf">alias_column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DerivedTable-661"><a href="#DerivedTable-661"><span class="linenos">661</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="DerivedTable-662"><a href="#DerivedTable-662"><span class="linenos">662</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_alias</span><span class="p">:</span> +</span><span id="DerivedTable-663"><a href="#DerivedTable-663"><span class="linenos">663</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="DerivedTable-664"><a href="#DerivedTable-664"><span class="linenos">664</span></a> <span class="n">column_list</span> <span class="o">=</span> <span class="n">table_alias</span><span class="o">.</span><span class="n">assert_is</span><span class="p">(</span><span class="n">TableAlias</span><span class="p">)</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="DerivedTable-665"><a href="#DerivedTable-665"><span class="linenos">665</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">column_list</span><span class="p">]</span> +</span><span id="DerivedTable-666"><a href="#DerivedTable-666"><span class="linenos">666</span></a> +</span><span id="DerivedTable-667"><a href="#DerivedTable-667"><span class="linenos">667</span></a> <span class="nd">@property</span> +</span><span id="DerivedTable-668"><a href="#DerivedTable-668"><span class="linenos">668</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DerivedTable-669"><a href="#DerivedTable-669"><span class="linenos">669</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="DerivedTable-670"><a href="#DerivedTable-670"><span class="linenos">670</span></a> +</span><span id="DerivedTable-671"><a href="#DerivedTable-671"><span class="linenos">671</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="DerivedTable-672"><a href="#DerivedTable-672"><span class="linenos">672</span></a> <span class="k">return</span> <span class="n">alias</span><span class="o">.</span><span class="n">columns</span> +</span><span id="DerivedTable-673"><a href="#DerivedTable-673"><span class="linenos">673</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="DerivedTable-674"><a href="#DerivedTable-674"><span class="linenos">674</span></a> +</span><span id="DerivedTable-675"><a href="#DerivedTable-675"><span class="linenos">675</span></a> <span class="nd">@property</span> +</span><span id="DerivedTable-676"><a href="#DerivedTable-676"><span class="linenos">676</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="DerivedTable-677"><a href="#DerivedTable-677"><span class="linenos">677</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">select</span><span class="o">.</span><span class="n">output_name</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">selects</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DerivedTable.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DerivedTable.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DerivedTable.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DerivedTable.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DerivedTable.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DerivedTable.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DerivedTable.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DerivedTable.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DerivedTable.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DerivedTable.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DerivedTable.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DerivedTable.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DerivedTable.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DerivedTable.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DerivedTable.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DerivedTable.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DerivedTable.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DerivedTable.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DerivedTable.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DerivedTable.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DerivedTable.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DerivedTable.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DerivedTable.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DerivedTable.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DerivedTable.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DerivedTable.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DerivedTable.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DerivedTable.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DerivedTable.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DerivedTable.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DerivedTable.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DerivedTable.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DerivedTable.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Unionable"> + <input id="Unionable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Unionable</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Unionable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unionable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unionable-680"><a href="#Unionable-680"><span class="linenos">680</span></a><span class="k">class</span> <span class="nc">Unionable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Unionable-681"><a href="#Unionable-681"><span class="linenos">681</span></a> <span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Unionable-682"><a href="#Unionable-682"><span class="linenos">682</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Unionable-683"><a href="#Unionable-683"><span class="linenos">683</span></a><span class="sd"> Builds a UNION expression.</span> +</span><span id="Unionable-684"><a href="#Unionable-684"><span class="linenos">684</span></a> +</span><span id="Unionable-685"><a href="#Unionable-685"><span class="linenos">685</span></a><span class="sd"> Example:</span> +</span><span id="Unionable-686"><a href="#Unionable-686"><span class="linenos">686</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Unionable-687"><a href="#Unionable-687"><span class="linenos">687</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql()</span> +</span><span id="Unionable-688"><a href="#Unionable-688"><span class="linenos">688</span></a><span class="sd"> 'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</span><span id="Unionable-689"><a href="#Unionable-689"><span class="linenos">689</span></a> +</span><span id="Unionable-690"><a href="#Unionable-690"><span class="linenos">690</span></a><span class="sd"> Args:</span> +</span><span id="Unionable-691"><a href="#Unionable-691"><span class="linenos">691</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="Unionable-692"><a href="#Unionable-692"><span class="linenos">692</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Unionable-693"><a href="#Unionable-693"><span class="linenos">693</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="Unionable-694"><a href="#Unionable-694"><span class="linenos">694</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Unionable-695"><a href="#Unionable-695"><span class="linenos">695</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Unionable-696"><a href="#Unionable-696"><span class="linenos">696</span></a><span class="sd"> Returns:</span> +</span><span id="Unionable-697"><a href="#Unionable-697"><span class="linenos">697</span></a><span class="sd"> Union: the Union expression.</span> +</span><span id="Unionable-698"><a href="#Unionable-698"><span class="linenos">698</span></a><span class="sd"> """</span> +</span><span id="Unionable-699"><a href="#Unionable-699"><span class="linenos">699</span></a> <span class="k">return</span> <span class="n">union</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Unionable-700"><a href="#Unionable-700"><span class="linenos">700</span></a> +</span><span id="Unionable-701"><a href="#Unionable-701"><span class="linenos">701</span></a> <span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Unionable-702"><a href="#Unionable-702"><span class="linenos">702</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Unionable-703"><a href="#Unionable-703"><span class="linenos">703</span></a><span class="sd"> Builds an INTERSECT expression.</span> +</span><span id="Unionable-704"><a href="#Unionable-704"><span class="linenos">704</span></a> +</span><span id="Unionable-705"><a href="#Unionable-705"><span class="linenos">705</span></a><span class="sd"> Example:</span> +</span><span id="Unionable-706"><a href="#Unionable-706"><span class="linenos">706</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Unionable-707"><a href="#Unionable-707"><span class="linenos">707</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql()</span> +</span><span id="Unionable-708"><a href="#Unionable-708"><span class="linenos">708</span></a><span class="sd"> 'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</span><span id="Unionable-709"><a href="#Unionable-709"><span class="linenos">709</span></a> +</span><span id="Unionable-710"><a href="#Unionable-710"><span class="linenos">710</span></a><span class="sd"> Args:</span> +</span><span id="Unionable-711"><a href="#Unionable-711"><span class="linenos">711</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="Unionable-712"><a href="#Unionable-712"><span class="linenos">712</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Unionable-713"><a href="#Unionable-713"><span class="linenos">713</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="Unionable-714"><a href="#Unionable-714"><span class="linenos">714</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Unionable-715"><a href="#Unionable-715"><span class="linenos">715</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Unionable-716"><a href="#Unionable-716"><span class="linenos">716</span></a><span class="sd"> Returns:</span> +</span><span id="Unionable-717"><a href="#Unionable-717"><span class="linenos">717</span></a><span class="sd"> Intersect: the Intersect expression</span> +</span><span id="Unionable-718"><a href="#Unionable-718"><span class="linenos">718</span></a><span class="sd"> """</span> +</span><span id="Unionable-719"><a href="#Unionable-719"><span class="linenos">719</span></a> <span class="k">return</span> <span class="n">intersect</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Unionable-720"><a href="#Unionable-720"><span class="linenos">720</span></a> +</span><span id="Unionable-721"><a href="#Unionable-721"><span class="linenos">721</span></a> <span class="k">def</span> <span class="nf">except_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Unionable-722"><a href="#Unionable-722"><span class="linenos">722</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Unionable-723"><a href="#Unionable-723"><span class="linenos">723</span></a><span class="sd"> Builds an EXCEPT expression.</span> +</span><span id="Unionable-724"><a href="#Unionable-724"><span class="linenos">724</span></a> +</span><span id="Unionable-725"><a href="#Unionable-725"><span class="linenos">725</span></a><span class="sd"> Example:</span> +</span><span id="Unionable-726"><a href="#Unionable-726"><span class="linenos">726</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Unionable-727"><a href="#Unionable-727"><span class="linenos">727</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql()</span> +</span><span id="Unionable-728"><a href="#Unionable-728"><span class="linenos">728</span></a><span class="sd"> 'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</span><span id="Unionable-729"><a href="#Unionable-729"><span class="linenos">729</span></a> +</span><span id="Unionable-730"><a href="#Unionable-730"><span class="linenos">730</span></a><span class="sd"> Args:</span> +</span><span id="Unionable-731"><a href="#Unionable-731"><span class="linenos">731</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="Unionable-732"><a href="#Unionable-732"><span class="linenos">732</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Unionable-733"><a href="#Unionable-733"><span class="linenos">733</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="Unionable-734"><a href="#Unionable-734"><span class="linenos">734</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Unionable-735"><a href="#Unionable-735"><span class="linenos">735</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Unionable-736"><a href="#Unionable-736"><span class="linenos">736</span></a><span class="sd"> Returns:</span> +</span><span id="Unionable-737"><a href="#Unionable-737"><span class="linenos">737</span></a><span class="sd"> Except: the Except expression</span> +</span><span id="Unionable-738"><a href="#Unionable-738"><span class="linenos">738</span></a><span class="sd"> """</span> +</span><span id="Unionable-739"><a href="#Unionable-739"><span class="linenos">739</span></a> <span class="k">return</span> <span class="n">except_</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Unionable.union" class="classattr"> + <input id="Unionable.union-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">union</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Unionable.union-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unionable.union"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unionable.union-681"><a href="#Unionable.union-681"><span class="linenos">681</span></a> <span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Unionable.union-682"><a href="#Unionable.union-682"><span class="linenos">682</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Unionable.union-683"><a href="#Unionable.union-683"><span class="linenos">683</span></a><span class="sd"> Builds a UNION expression.</span> +</span><span id="Unionable.union-684"><a href="#Unionable.union-684"><span class="linenos">684</span></a> +</span><span id="Unionable.union-685"><a href="#Unionable.union-685"><span class="linenos">685</span></a><span class="sd"> Example:</span> +</span><span id="Unionable.union-686"><a href="#Unionable.union-686"><span class="linenos">686</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Unionable.union-687"><a href="#Unionable.union-687"><span class="linenos">687</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").union("SELECT * FROM bla").sql()</span> +</span><span id="Unionable.union-688"><a href="#Unionable.union-688"><span class="linenos">688</span></a><span class="sd"> 'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</span><span id="Unionable.union-689"><a href="#Unionable.union-689"><span class="linenos">689</span></a> +</span><span id="Unionable.union-690"><a href="#Unionable.union-690"><span class="linenos">690</span></a><span class="sd"> Args:</span> +</span><span id="Unionable.union-691"><a href="#Unionable.union-691"><span class="linenos">691</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="Unionable.union-692"><a href="#Unionable.union-692"><span class="linenos">692</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Unionable.union-693"><a href="#Unionable.union-693"><span class="linenos">693</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="Unionable.union-694"><a href="#Unionable.union-694"><span class="linenos">694</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Unionable.union-695"><a href="#Unionable.union-695"><span class="linenos">695</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Unionable.union-696"><a href="#Unionable.union-696"><span class="linenos">696</span></a><span class="sd"> Returns:</span> +</span><span id="Unionable.union-697"><a href="#Unionable.union-697"><span class="linenos">697</span></a><span class="sd"> Union: the Union expression.</span> +</span><span id="Unionable.union-698"><a href="#Unionable.union-698"><span class="linenos">698</span></a><span class="sd"> """</span> +</span><span id="Unionable.union-699"><a href="#Unionable.union-699"><span class="linenos">699</span></a> <span class="k">return</span> <span class="n">union</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Builds a UNION expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT * FROM foo"</span><span class="p">)</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="s2">"SELECT * FROM bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | Expression):</strong> the SQL code string. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Union: the Union expression.</p> +</blockquote> +</div> + + + </div> + <div id="Unionable.intersect" class="classattr"> + <input id="Unionable.intersect-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intersect</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Unionable.intersect-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unionable.intersect"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unionable.intersect-701"><a href="#Unionable.intersect-701"><span class="linenos">701</span></a> <span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Unionable.intersect-702"><a href="#Unionable.intersect-702"><span class="linenos">702</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Unionable.intersect-703"><a href="#Unionable.intersect-703"><span class="linenos">703</span></a><span class="sd"> Builds an INTERSECT expression.</span> +</span><span id="Unionable.intersect-704"><a href="#Unionable.intersect-704"><span class="linenos">704</span></a> +</span><span id="Unionable.intersect-705"><a href="#Unionable.intersect-705"><span class="linenos">705</span></a><span class="sd"> Example:</span> +</span><span id="Unionable.intersect-706"><a href="#Unionable.intersect-706"><span class="linenos">706</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Unionable.intersect-707"><a href="#Unionable.intersect-707"><span class="linenos">707</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").intersect("SELECT * FROM bla").sql()</span> +</span><span id="Unionable.intersect-708"><a href="#Unionable.intersect-708"><span class="linenos">708</span></a><span class="sd"> 'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</span><span id="Unionable.intersect-709"><a href="#Unionable.intersect-709"><span class="linenos">709</span></a> +</span><span id="Unionable.intersect-710"><a href="#Unionable.intersect-710"><span class="linenos">710</span></a><span class="sd"> Args:</span> +</span><span id="Unionable.intersect-711"><a href="#Unionable.intersect-711"><span class="linenos">711</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="Unionable.intersect-712"><a href="#Unionable.intersect-712"><span class="linenos">712</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Unionable.intersect-713"><a href="#Unionable.intersect-713"><span class="linenos">713</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="Unionable.intersect-714"><a href="#Unionable.intersect-714"><span class="linenos">714</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Unionable.intersect-715"><a href="#Unionable.intersect-715"><span class="linenos">715</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Unionable.intersect-716"><a href="#Unionable.intersect-716"><span class="linenos">716</span></a><span class="sd"> Returns:</span> +</span><span id="Unionable.intersect-717"><a href="#Unionable.intersect-717"><span class="linenos">717</span></a><span class="sd"> Intersect: the Intersect expression</span> +</span><span id="Unionable.intersect-718"><a href="#Unionable.intersect-718"><span class="linenos">718</span></a><span class="sd"> """</span> +</span><span id="Unionable.intersect-719"><a href="#Unionable.intersect-719"><span class="linenos">719</span></a> <span class="k">return</span> <span class="n">intersect</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Builds an INTERSECT expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT * FROM foo"</span><span class="p">)</span><span class="o">.</span><span class="n">intersect</span><span class="p">(</span><span class="s2">"SELECT * FROM bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | Expression):</strong> the SQL code string. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Intersect: the Intersect expression</p> +</blockquote> +</div> + + + </div> + <div id="Unionable.except_" class="classattr"> + <input id="Unionable.except_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">except_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Unionable.except_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unionable.except_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unionable.except_-721"><a href="#Unionable.except_-721"><span class="linenos">721</span></a> <span class="k">def</span> <span class="nf">except_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Unionable.except_-722"><a href="#Unionable.except_-722"><span class="linenos">722</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Unionable.except_-723"><a href="#Unionable.except_-723"><span class="linenos">723</span></a><span class="sd"> Builds an EXCEPT expression.</span> +</span><span id="Unionable.except_-724"><a href="#Unionable.except_-724"><span class="linenos">724</span></a> +</span><span id="Unionable.except_-725"><a href="#Unionable.except_-725"><span class="linenos">725</span></a><span class="sd"> Example:</span> +</span><span id="Unionable.except_-726"><a href="#Unionable.except_-726"><span class="linenos">726</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Unionable.except_-727"><a href="#Unionable.except_-727"><span class="linenos">727</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT * FROM foo").except_("SELECT * FROM bla").sql()</span> +</span><span id="Unionable.except_-728"><a href="#Unionable.except_-728"><span class="linenos">728</span></a><span class="sd"> 'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</span><span id="Unionable.except_-729"><a href="#Unionable.except_-729"><span class="linenos">729</span></a> +</span><span id="Unionable.except_-730"><a href="#Unionable.except_-730"><span class="linenos">730</span></a><span class="sd"> Args:</span> +</span><span id="Unionable.except_-731"><a href="#Unionable.except_-731"><span class="linenos">731</span></a><span class="sd"> expression (str | Expression): the SQL code string.</span> +</span><span id="Unionable.except_-732"><a href="#Unionable.except_-732"><span class="linenos">732</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Unionable.except_-733"><a href="#Unionable.except_-733"><span class="linenos">733</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="Unionable.except_-734"><a href="#Unionable.except_-734"><span class="linenos">734</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Unionable.except_-735"><a href="#Unionable.except_-735"><span class="linenos">735</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Unionable.except_-736"><a href="#Unionable.except_-736"><span class="linenos">736</span></a><span class="sd"> Returns:</span> +</span><span id="Unionable.except_-737"><a href="#Unionable.except_-737"><span class="linenos">737</span></a><span class="sd"> Except: the Except expression</span> +</span><span id="Unionable.except_-738"><a href="#Unionable.except_-738"><span class="linenos">738</span></a><span class="sd"> """</span> +</span><span id="Unionable.except_-739"><a href="#Unionable.except_-739"><span class="linenos">739</span></a> <span class="k">return</span> <span class="n">except_</span><span class="p">(</span><span class="n">left</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> <span class="n">right</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Builds an EXCEPT expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT * FROM foo"</span><span class="p">)</span><span class="o">.</span><span class="n">except_</span><span class="p">(</span><span class="s2">"SELECT * FROM bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | Expression):</strong> the SQL code string. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Except: the Except expression</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Unionable.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Unionable.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Unionable.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Unionable.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Unionable.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Unionable.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Unionable.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Unionable.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Unionable.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Unionable.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Unionable.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Unionable.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Unionable.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Unionable.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Unionable.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Unionable.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Unionable.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Unionable.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Unionable.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Unionable.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Unionable.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Unionable.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Unionable.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Unionable.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Unionable.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Unionable.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Unionable.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Unionable.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Unionable.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Unionable.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Unionable.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Unionable.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Unionable.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UDTF"> + <input id="UDTF-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UDTF</span><wbr>(<span class="base"><a href="#DerivedTable">DerivedTable</a></span>, <span class="base"><a href="#Unionable">Unionable</a></span>): + + <label class="view-source-button" for="UDTF-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UDTF"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UDTF-742"><a href="#UDTF-742"><span class="linenos">742</span></a><span class="k">class</span> <span class="nc">UDTF</span><span class="p">(</span><span class="n">DerivedTable</span><span class="p">,</span> <span class="n">Unionable</span><span class="p">):</span> +</span><span id="UDTF-743"><a href="#UDTF-743"><span class="linenos">743</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UDTF.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UDTF.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UDTF.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UDTF.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UDTF.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UDTF.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UDTF.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UDTF.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UDTF.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UDTF.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UDTF.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UDTF.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UDTF.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UDTF.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UDTF.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UDTF.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UDTF.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UDTF.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UDTF.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UDTF.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UDTF.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UDTF.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UDTF.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UDTF.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UDTF.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UDTF.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UDTF.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UDTF.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UDTF.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UDTF.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UDTF.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UDTF.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UDTF.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="UDTF.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="UDTF.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="UDTF.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Cache"> + <input id="Cache-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Cache</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Cache-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Cache"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Cache-746"><a href="#Cache-746"><span class="linenos">746</span></a><span class="k">class</span> <span class="nc">Cache</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Cache-747"><a href="#Cache-747"><span class="linenos">747</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Cache-748"><a href="#Cache-748"><span class="linenos">748</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Cache-749"><a href="#Cache-749"><span class="linenos">749</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Cache-750"><a href="#Cache-750"><span class="linenos">750</span></a> <span class="s2">"lazy"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Cache-751"><a href="#Cache-751"><span class="linenos">751</span></a> <span class="s2">"options"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Cache-752"><a href="#Cache-752"><span class="linenos">752</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Cache-753"><a href="#Cache-753"><span class="linenos">753</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Cache.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Cache.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Cache.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Cache.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Cache.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Cache.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Cache.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Cache.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Cache.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Cache.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Cache.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Cache.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Cache.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Cache.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Cache.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Cache.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Cache.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Cache.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Cache.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Cache.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Cache.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Cache.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Cache.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Cache.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Cache.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Cache.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Cache.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Cache.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Cache.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Cache.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Cache.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Cache.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Cache.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Uncache"> + <input id="Uncache-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Uncache</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Uncache-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Uncache"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Uncache-756"><a href="#Uncache-756"><span class="linenos">756</span></a><span class="k">class</span> <span class="nc">Uncache</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Uncache-757"><a href="#Uncache-757"><span class="linenos">757</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Uncache.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Uncache.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Uncache.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Uncache.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Uncache.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Uncache.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Uncache.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Uncache.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Uncache.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Uncache.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Uncache.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Uncache.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Uncache.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Uncache.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Uncache.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Uncache.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Uncache.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Uncache.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Uncache.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Uncache.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Uncache.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Uncache.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Uncache.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Uncache.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Uncache.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Uncache.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Uncache.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Uncache.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Uncache.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Uncache.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Uncache.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Uncache.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Uncache.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Create"> + <input id="Create-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Create</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Create-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Create"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Create-760"><a href="#Create-760"><span class="linenos">760</span></a><span class="k">class</span> <span class="nc">Create</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Create-761"><a href="#Create-761"><span class="linenos">761</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Create-762"><a href="#Create-762"><span class="linenos">762</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-763"><a href="#Create-763"><span class="linenos">763</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Create-764"><a href="#Create-764"><span class="linenos">764</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Create-765"><a href="#Create-765"><span class="linenos">765</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-766"><a href="#Create-766"><span class="linenos">766</span></a> <span class="s2">"set"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-767"><a href="#Create-767"><span class="linenos">767</span></a> <span class="s2">"multiset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-768"><a href="#Create-768"><span class="linenos">768</span></a> <span class="s2">"global_temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-769"><a href="#Create-769"><span class="linenos">769</span></a> <span class="s2">"volatile"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-770"><a href="#Create-770"><span class="linenos">770</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-771"><a href="#Create-771"><span class="linenos">771</span></a> <span class="s2">"properties"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-772"><a href="#Create-772"><span class="linenos">772</span></a> <span class="s2">"temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-773"><a href="#Create-773"><span class="linenos">773</span></a> <span class="s2">"transient"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-774"><a href="#Create-774"><span class="linenos">774</span></a> <span class="s2">"external"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-775"><a href="#Create-775"><span class="linenos">775</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-776"><a href="#Create-776"><span class="linenos">776</span></a> <span class="s2">"unique"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-777"><a href="#Create-777"><span class="linenos">777</span></a> <span class="s2">"materialized"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-778"><a href="#Create-778"><span class="linenos">778</span></a> <span class="s2">"data"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-779"><a href="#Create-779"><span class="linenos">779</span></a> <span class="s2">"statistics"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-780"><a href="#Create-780"><span class="linenos">780</span></a> <span class="s2">"no_primary_index"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-781"><a href="#Create-781"><span class="linenos">781</span></a> <span class="s2">"indexes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-782"><a href="#Create-782"><span class="linenos">782</span></a> <span class="s2">"no_schema_binding"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-783"><a href="#Create-783"><span class="linenos">783</span></a> <span class="s2">"begin"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Create-784"><a href="#Create-784"><span class="linenos">784</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Create.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Create.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Create.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Create.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Create.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Create.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Create.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Create.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Create.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Create.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Create.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Create.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Create.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Create.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Create.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Create.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Create.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Create.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Create.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Create.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Create.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Create.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Create.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Create.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Create.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Create.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Create.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Create.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Create.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Create.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Create.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Create.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Create.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Describe"> + <input id="Describe-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Describe</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Describe-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Describe"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Describe-787"><a href="#Describe-787"><span class="linenos">787</span></a><span class="k">class</span> <span class="nc">Describe</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Describe-788"><a href="#Describe-788"><span class="linenos">788</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Describe.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Describe.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Describe.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Describe.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Describe.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Describe.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Describe.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Describe.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Describe.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Describe.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Describe.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Describe.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Describe.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Describe.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Describe.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Describe.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Describe.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Describe.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Describe.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Describe.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Describe.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Describe.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Describe.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Describe.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Describe.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Describe.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Describe.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Describe.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Describe.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Describe.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Describe.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Describe.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Describe.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Set"> + <input id="Set-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Set</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Set-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Set"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Set-791"><a href="#Set-791"><span class="linenos">791</span></a><span class="k">class</span> <span class="nc">Set</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Set-792"><a href="#Set-792"><span class="linenos">792</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Set.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Set.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Set.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Set.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Set.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Set.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Set.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Set.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Set.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Set.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Set.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Set.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Set.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Set.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Set.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Set.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Set.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Set.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Set.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Set.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Set.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Set.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Set.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Set.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Set.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Set.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Set.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Set.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Set.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Set.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Set.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Set.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Set.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SetItem"> + <input id="SetItem-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SetItem</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="SetItem-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SetItem"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SetItem-795"><a href="#SetItem-795"><span class="linenos">795</span></a><span class="k">class</span> <span class="nc">SetItem</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="SetItem-796"><a href="#SetItem-796"><span class="linenos">796</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SetItem-797"><a href="#SetItem-797"><span class="linenos">797</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SetItem-798"><a href="#SetItem-798"><span class="linenos">798</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SetItem-799"><a href="#SetItem-799"><span class="linenos">799</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SetItem-800"><a href="#SetItem-800"><span class="linenos">800</span></a> <span class="s2">"collate"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># MySQL SET NAMES statement</span> +</span><span id="SetItem-801"><a href="#SetItem-801"><span class="linenos">801</span></a> <span class="s2">"global"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SetItem-802"><a href="#SetItem-802"><span class="linenos">802</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SetItem.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SetItem.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SetItem.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SetItem.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SetItem.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SetItem.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SetItem.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SetItem.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SetItem.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SetItem.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SetItem.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SetItem.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SetItem.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SetItem.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SetItem.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SetItem.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SetItem.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SetItem.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SetItem.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SetItem.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SetItem.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SetItem.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SetItem.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SetItem.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SetItem.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SetItem.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SetItem.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SetItem.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SetItem.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SetItem.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SetItem.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SetItem.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SetItem.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Show"> + <input id="Show-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Show</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Show-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Show"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Show-805"><a href="#Show-805"><span class="linenos">805</span></a><span class="k">class</span> <span class="nc">Show</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Show-806"><a href="#Show-806"><span class="linenos">806</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Show-807"><a href="#Show-807"><span class="linenos">807</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Show-808"><a href="#Show-808"><span class="linenos">808</span></a> <span class="s2">"target"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-809"><a href="#Show-809"><span class="linenos">809</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-810"><a href="#Show-810"><span class="linenos">810</span></a> <span class="s2">"limit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-811"><a href="#Show-811"><span class="linenos">811</span></a> <span class="s2">"like"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-812"><a href="#Show-812"><span class="linenos">812</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-813"><a href="#Show-813"><span class="linenos">813</span></a> <span class="s2">"db"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-814"><a href="#Show-814"><span class="linenos">814</span></a> <span class="s2">"full"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-815"><a href="#Show-815"><span class="linenos">815</span></a> <span class="s2">"mutex"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-816"><a href="#Show-816"><span class="linenos">816</span></a> <span class="s2">"query"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-817"><a href="#Show-817"><span class="linenos">817</span></a> <span class="s2">"channel"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-818"><a href="#Show-818"><span class="linenos">818</span></a> <span class="s2">"global"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-819"><a href="#Show-819"><span class="linenos">819</span></a> <span class="s2">"log"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-820"><a href="#Show-820"><span class="linenos">820</span></a> <span class="s2">"position"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-821"><a href="#Show-821"><span class="linenos">821</span></a> <span class="s2">"types"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Show-822"><a href="#Show-822"><span class="linenos">822</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Show.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Show.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Show.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Show.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Show.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Show.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Show.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Show.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Show.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Show.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Show.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Show.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Show.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Show.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Show.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Show.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Show.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Show.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Show.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Show.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Show.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Show.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Show.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Show.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Show.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Show.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Show.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Show.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Show.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Show.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Show.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Show.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Show.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UserDefinedFunction"> + <input id="UserDefinedFunction-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UserDefinedFunction</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="UserDefinedFunction-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UserDefinedFunction"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UserDefinedFunction-825"><a href="#UserDefinedFunction-825"><span class="linenos">825</span></a><span class="k">class</span> <span class="nc">UserDefinedFunction</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="UserDefinedFunction-826"><a href="#UserDefinedFunction-826"><span class="linenos">826</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"wrapped"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UserDefinedFunction.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UserDefinedFunction.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UserDefinedFunction.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UserDefinedFunction.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UserDefinedFunction.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UserDefinedFunction.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UserDefinedFunction.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UserDefinedFunction.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UserDefinedFunction.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UserDefinedFunction.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UserDefinedFunction.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UserDefinedFunction.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UserDefinedFunction.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UserDefinedFunction.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UserDefinedFunction.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UserDefinedFunction.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UserDefinedFunction.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UserDefinedFunction.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UserDefinedFunction.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UserDefinedFunction.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UserDefinedFunction.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UserDefinedFunction.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UserDefinedFunction.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UserDefinedFunction.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UserDefinedFunction.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UserDefinedFunction.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UserDefinedFunction.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UserDefinedFunction.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UserDefinedFunction.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UserDefinedFunction.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UserDefinedFunction.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UserDefinedFunction.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UserDefinedFunction.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UserDefinedFunctionKwarg"> + <input id="UserDefinedFunctionKwarg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UserDefinedFunctionKwarg</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="UserDefinedFunctionKwarg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UserDefinedFunctionKwarg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UserDefinedFunctionKwarg-829"><a href="#UserDefinedFunctionKwarg-829"><span class="linenos">829</span></a><span class="k">class</span> <span class="nc">UserDefinedFunctionKwarg</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="UserDefinedFunctionKwarg-830"><a href="#UserDefinedFunctionKwarg-830"><span class="linenos">830</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UserDefinedFunctionKwarg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UserDefinedFunctionKwarg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UserDefinedFunctionKwarg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UserDefinedFunctionKwarg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UserDefinedFunctionKwarg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UserDefinedFunctionKwarg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UserDefinedFunctionKwarg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UserDefinedFunctionKwarg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UserDefinedFunctionKwarg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UserDefinedFunctionKwarg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UserDefinedFunctionKwarg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UserDefinedFunctionKwarg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UserDefinedFunctionKwarg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UserDefinedFunctionKwarg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UserDefinedFunctionKwarg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UserDefinedFunctionKwarg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UserDefinedFunctionKwarg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UserDefinedFunctionKwarg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UserDefinedFunctionKwarg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UserDefinedFunctionKwarg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UserDefinedFunctionKwarg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UserDefinedFunctionKwarg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UserDefinedFunctionKwarg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UserDefinedFunctionKwarg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UserDefinedFunctionKwarg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UserDefinedFunctionKwarg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UserDefinedFunctionKwarg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UserDefinedFunctionKwarg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UserDefinedFunctionKwarg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UserDefinedFunctionKwarg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UserDefinedFunctionKwarg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UserDefinedFunctionKwarg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UserDefinedFunctionKwarg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CharacterSet"> + <input id="CharacterSet-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CharacterSet</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="CharacterSet-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CharacterSet"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CharacterSet-833"><a href="#CharacterSet-833"><span class="linenos">833</span></a><span class="k">class</span> <span class="nc">CharacterSet</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="CharacterSet-834"><a href="#CharacterSet-834"><span class="linenos">834</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CharacterSet.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CharacterSet.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CharacterSet.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CharacterSet.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CharacterSet.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CharacterSet.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CharacterSet.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CharacterSet.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CharacterSet.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CharacterSet.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CharacterSet.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CharacterSet.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CharacterSet.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CharacterSet.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CharacterSet.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CharacterSet.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CharacterSet.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CharacterSet.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CharacterSet.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CharacterSet.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CharacterSet.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CharacterSet.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CharacterSet.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CharacterSet.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CharacterSet.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CharacterSet.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CharacterSet.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CharacterSet.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CharacterSet.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CharacterSet.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CharacterSet.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CharacterSet.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CharacterSet.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="With"> + <input id="With-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">With</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="With-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#With"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="With-837"><a href="#With-837"><span class="linenos">837</span></a><span class="k">class</span> <span class="nc">With</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="With-838"><a href="#With-838"><span class="linenos">838</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"recursive"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="With-839"><a href="#With-839"><span class="linenos">839</span></a> +</span><span id="With-840"><a href="#With-840"><span class="linenos">840</span></a> <span class="nd">@property</span> +</span><span id="With-841"><a href="#With-841"><span class="linenos">841</span></a> <span class="k">def</span> <span class="nf">recursive</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="With-842"><a href="#With-842"><span class="linenos">842</span></a> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">))</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="With.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="With.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="With.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="With.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="With.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="With.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="With.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="With.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="With.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="With.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="With.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="With.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="With.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="With.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="With.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="With.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="With.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="With.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="With.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="With.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="With.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="With.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="With.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="With.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="With.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="With.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="With.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="With.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="With.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="With.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="With.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="With.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="With.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="WithinGroup"> + <input id="WithinGroup-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">WithinGroup</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="WithinGroup-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WithinGroup"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WithinGroup-845"><a href="#WithinGroup-845"><span class="linenos">845</span></a><span class="k">class</span> <span class="nc">WithinGroup</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="WithinGroup-846"><a href="#WithinGroup-846"><span class="linenos">846</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="WithinGroup.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="WithinGroup.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="WithinGroup.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="WithinGroup.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="WithinGroup.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="WithinGroup.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="WithinGroup.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="WithinGroup.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="WithinGroup.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="WithinGroup.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="WithinGroup.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="WithinGroup.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="WithinGroup.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="WithinGroup.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="WithinGroup.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="WithinGroup.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="WithinGroup.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="WithinGroup.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="WithinGroup.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="WithinGroup.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="WithinGroup.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="WithinGroup.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="WithinGroup.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="WithinGroup.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="WithinGroup.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="WithinGroup.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="WithinGroup.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="WithinGroup.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="WithinGroup.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="WithinGroup.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="WithinGroup.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="WithinGroup.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="WithinGroup.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CTE"> + <input id="CTE-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CTE</span><wbr>(<span class="base"><a href="#DerivedTable">DerivedTable</a></span>): + + <label class="view-source-button" for="CTE-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CTE"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CTE-849"><a href="#CTE-849"><span class="linenos">849</span></a><span class="k">class</span> <span class="nc">CTE</span><span class="p">(</span><span class="n">DerivedTable</span><span class="p">):</span> +</span><span id="CTE-850"><a href="#CTE-850"><span class="linenos">850</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CTE.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CTE.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CTE.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CTE.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CTE.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CTE.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CTE.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CTE.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CTE.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CTE.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CTE.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CTE.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CTE.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CTE.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CTE.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CTE.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CTE.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CTE.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CTE.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CTE.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CTE.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CTE.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CTE.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CTE.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CTE.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CTE.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CTE.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CTE.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CTE.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CTE.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CTE.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CTE.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CTE.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TableAlias"> + <input id="TableAlias-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TableAlias</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="TableAlias-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TableAlias"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TableAlias-853"><a href="#TableAlias-853"><span class="linenos">853</span></a><span class="k">class</span> <span class="nc">TableAlias</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="TableAlias-854"><a href="#TableAlias-854"><span class="linenos">854</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"columns"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="TableAlias-855"><a href="#TableAlias-855"><span class="linenos">855</span></a> +</span><span id="TableAlias-856"><a href="#TableAlias-856"><span class="linenos">856</span></a> <span class="nd">@property</span> +</span><span id="TableAlias-857"><a href="#TableAlias-857"><span class="linenos">857</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="TableAlias-858"><a href="#TableAlias-858"><span class="linenos">858</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TableAlias.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TableAlias.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TableAlias.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TableAlias.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TableAlias.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TableAlias.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TableAlias.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TableAlias.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TableAlias.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TableAlias.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TableAlias.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TableAlias.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TableAlias.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TableAlias.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TableAlias.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TableAlias.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TableAlias.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TableAlias.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TableAlias.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TableAlias.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TableAlias.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TableAlias.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TableAlias.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TableAlias.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TableAlias.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TableAlias.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TableAlias.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TableAlias.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TableAlias.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TableAlias.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TableAlias.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TableAlias.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TableAlias.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitString"> + <input id="BitString-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitString</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="BitString-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitString"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitString-861"><a href="#BitString-861"><span class="linenos">861</span></a><span class="k">class</span> <span class="nc">BitString</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="BitString-862"><a href="#BitString-862"><span class="linenos">862</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitString.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitString.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitString.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitString.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitString.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitString.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitString.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitString.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitString.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitString.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitString.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitString.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitString.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitString.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitString.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitString.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitString.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitString.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitString.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitString.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitString.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitString.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitString.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitString.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitString.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitString.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitString.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitString.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitString.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitString.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitString.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitString.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitString.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="BitString.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="BitString.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="BitString.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="HexString"> + <input id="HexString-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">HexString</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="HexString-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#HexString"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="HexString-865"><a href="#HexString-865"><span class="linenos">865</span></a><span class="k">class</span> <span class="nc">HexString</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="HexString-866"><a href="#HexString-866"><span class="linenos">866</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="HexString.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="HexString.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="HexString.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="HexString.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="HexString.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="HexString.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="HexString.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="HexString.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="HexString.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="HexString.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="HexString.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="HexString.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="HexString.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="HexString.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="HexString.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="HexString.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="HexString.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="HexString.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="HexString.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="HexString.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="HexString.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="HexString.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="HexString.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="HexString.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="HexString.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="HexString.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="HexString.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="HexString.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="HexString.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="HexString.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="HexString.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="HexString.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="HexString.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="HexString.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="HexString.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="HexString.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ByteString"> + <input id="ByteString-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ByteString</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="ByteString-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ByteString"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ByteString-869"><a href="#ByteString-869"><span class="linenos">869</span></a><span class="k">class</span> <span class="nc">ByteString</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="ByteString-870"><a href="#ByteString-870"><span class="linenos">870</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ByteString.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ByteString.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ByteString.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ByteString.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ByteString.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ByteString.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ByteString.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ByteString.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ByteString.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ByteString.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ByteString.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ByteString.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ByteString.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ByteString.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ByteString.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ByteString.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ByteString.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ByteString.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ByteString.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ByteString.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ByteString.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ByteString.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ByteString.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ByteString.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ByteString.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ByteString.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ByteString.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ByteString.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ByteString.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ByteString.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ByteString.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ByteString.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ByteString.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ByteString.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ByteString.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ByteString.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Column"> + <input id="Column-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Column</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Column-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Column"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Column-873"><a href="#Column-873"><span class="linenos">873</span></a><span class="k">class</span> <span class="nc">Column</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Column-874"><a href="#Column-874"><span class="linenos">874</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Column-875"><a href="#Column-875"><span class="linenos">875</span></a> +</span><span id="Column-876"><a href="#Column-876"><span class="linenos">876</span></a> <span class="nd">@property</span> +</span><span id="Column-877"><a href="#Column-877"><span class="linenos">877</span></a> <span class="k">def</span> <span class="nf">table</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-878"><a href="#Column-878"><span class="linenos">878</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="Column-879"><a href="#Column-879"><span class="linenos">879</span></a> +</span><span id="Column-880"><a href="#Column-880"><span class="linenos">880</span></a> <span class="nd">@property</span> +</span><span id="Column-881"><a href="#Column-881"><span class="linenos">881</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Column-882"><a href="#Column-882"><span class="linenos">882</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span></pre></div> + + + + + <div id="Column.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Column.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Column.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Column.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Column.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Column.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Column.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Column.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Column.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Column.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Column.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Column.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Column.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Column.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Column.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Column.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Column.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Column.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Column.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Column.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Column.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Column.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Column.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Column.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Column.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Column.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Column.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Column.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Column.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Column.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Column.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Column.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Column.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Column.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Column.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Column.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Column.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ColumnDef"> + <input id="ColumnDef-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ColumnDef</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="ColumnDef-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ColumnDef"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ColumnDef-885"><a href="#ColumnDef-885"><span class="linenos">885</span></a><span class="k">class</span> <span class="nc">ColumnDef</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="ColumnDef-886"><a href="#ColumnDef-886"><span class="linenos">886</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ColumnDef-887"><a href="#ColumnDef-887"><span class="linenos">887</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="ColumnDef-888"><a href="#ColumnDef-888"><span class="linenos">888</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="ColumnDef-889"><a href="#ColumnDef-889"><span class="linenos">889</span></a> <span class="s2">"constraints"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="ColumnDef-890"><a href="#ColumnDef-890"><span class="linenos">890</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="ColumnDef-891"><a href="#ColumnDef-891"><span class="linenos">891</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ColumnDef.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ColumnDef.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ColumnDef.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ColumnDef.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ColumnDef.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ColumnDef.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ColumnDef.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ColumnDef.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ColumnDef.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ColumnDef.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ColumnDef.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ColumnDef.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ColumnDef.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ColumnDef.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ColumnDef.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ColumnDef.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ColumnDef.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ColumnDef.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ColumnDef.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ColumnDef.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ColumnDef.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ColumnDef.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ColumnDef.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ColumnDef.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ColumnDef.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ColumnDef.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ColumnDef.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ColumnDef.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ColumnDef.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ColumnDef.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ColumnDef.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ColumnDef.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ColumnDef.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AlterColumn"> + <input id="AlterColumn-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AlterColumn</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="AlterColumn-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AlterColumn"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AlterColumn-894"><a href="#AlterColumn-894"><span class="linenos">894</span></a><span class="k">class</span> <span class="nc">AlterColumn</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="AlterColumn-895"><a href="#AlterColumn-895"><span class="linenos">895</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="AlterColumn-896"><a href="#AlterColumn-896"><span class="linenos">896</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="AlterColumn-897"><a href="#AlterColumn-897"><span class="linenos">897</span></a> <span class="s2">"dtype"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="AlterColumn-898"><a href="#AlterColumn-898"><span class="linenos">898</span></a> <span class="s2">"collate"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="AlterColumn-899"><a href="#AlterColumn-899"><span class="linenos">899</span></a> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="AlterColumn-900"><a href="#AlterColumn-900"><span class="linenos">900</span></a> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="AlterColumn-901"><a href="#AlterColumn-901"><span class="linenos">901</span></a> <span class="s2">"drop"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="AlterColumn-902"><a href="#AlterColumn-902"><span class="linenos">902</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AlterColumn.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AlterColumn.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AlterColumn.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AlterColumn.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AlterColumn.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AlterColumn.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AlterColumn.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AlterColumn.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AlterColumn.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AlterColumn.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AlterColumn.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AlterColumn.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AlterColumn.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AlterColumn.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AlterColumn.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AlterColumn.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AlterColumn.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AlterColumn.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AlterColumn.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AlterColumn.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AlterColumn.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AlterColumn.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AlterColumn.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AlterColumn.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AlterColumn.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AlterColumn.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AlterColumn.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AlterColumn.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AlterColumn.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AlterColumn.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AlterColumn.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AlterColumn.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AlterColumn.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RenameTable"> + <input id="RenameTable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RenameTable</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="RenameTable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RenameTable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RenameTable-905"><a href="#RenameTable-905"><span class="linenos">905</span></a><span class="k">class</span> <span class="nc">RenameTable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="RenameTable-906"><a href="#RenameTable-906"><span class="linenos">906</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RenameTable.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RenameTable.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RenameTable.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RenameTable.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RenameTable.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RenameTable.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RenameTable.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RenameTable.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RenameTable.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RenameTable.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RenameTable.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RenameTable.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RenameTable.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RenameTable.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RenameTable.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RenameTable.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RenameTable.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RenameTable.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RenameTable.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RenameTable.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RenameTable.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RenameTable.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RenameTable.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RenameTable.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RenameTable.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RenameTable.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RenameTable.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RenameTable.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RenameTable.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RenameTable.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RenameTable.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RenameTable.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RenameTable.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ColumnConstraint"> + <input id="ColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ColumnConstraint</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="ColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ColumnConstraint-909"><a href="#ColumnConstraint-909"><span class="linenos">909</span></a><span class="k">class</span> <span class="nc">ColumnConstraint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="ColumnConstraint-910"><a href="#ColumnConstraint-910"><span class="linenos">910</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ColumnConstraintKind"> + <input id="ColumnConstraintKind-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ColumnConstraintKind</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="ColumnConstraintKind-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ColumnConstraintKind"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ColumnConstraintKind-913"><a href="#ColumnConstraintKind-913"><span class="linenos">913</span></a><span class="k">class</span> <span class="nc">ColumnConstraintKind</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="ColumnConstraintKind-914"><a href="#ColumnConstraintKind-914"><span class="linenos">914</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ColumnConstraintKind.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ColumnConstraintKind.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ColumnConstraintKind.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ColumnConstraintKind.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ColumnConstraintKind.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ColumnConstraintKind.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ColumnConstraintKind.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ColumnConstraintKind.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ColumnConstraintKind.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ColumnConstraintKind.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ColumnConstraintKind.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ColumnConstraintKind.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ColumnConstraintKind.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ColumnConstraintKind.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ColumnConstraintKind.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ColumnConstraintKind.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ColumnConstraintKind.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ColumnConstraintKind.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ColumnConstraintKind.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ColumnConstraintKind.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ColumnConstraintKind.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ColumnConstraintKind.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ColumnConstraintKind.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ColumnConstraintKind.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ColumnConstraintKind.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ColumnConstraintKind.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ColumnConstraintKind.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ColumnConstraintKind.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ColumnConstraintKind.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ColumnConstraintKind.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ColumnConstraintKind.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ColumnConstraintKind.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ColumnConstraintKind.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AutoIncrementColumnConstraint"> + <input id="AutoIncrementColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AutoIncrementColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="AutoIncrementColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AutoIncrementColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AutoIncrementColumnConstraint-917"><a href="#AutoIncrementColumnConstraint-917"><span class="linenos">917</span></a><span class="k">class</span> <span class="nc">AutoIncrementColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="AutoIncrementColumnConstraint-918"><a href="#AutoIncrementColumnConstraint-918"><span class="linenos">918</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AutoIncrementColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AutoIncrementColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AutoIncrementColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AutoIncrementColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AutoIncrementColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AutoIncrementColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AutoIncrementColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AutoIncrementColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AutoIncrementColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AutoIncrementColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AutoIncrementColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AutoIncrementColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AutoIncrementColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AutoIncrementColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AutoIncrementColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AutoIncrementColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AutoIncrementColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AutoIncrementColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AutoIncrementColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AutoIncrementColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AutoIncrementColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AutoIncrementColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AutoIncrementColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AutoIncrementColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AutoIncrementColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AutoIncrementColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AutoIncrementColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AutoIncrementColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AutoIncrementColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AutoIncrementColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AutoIncrementColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AutoIncrementColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AutoIncrementColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CheckColumnConstraint"> + <input id="CheckColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CheckColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="CheckColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CheckColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CheckColumnConstraint-921"><a href="#CheckColumnConstraint-921"><span class="linenos">921</span></a><span class="k">class</span> <span class="nc">CheckColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="CheckColumnConstraint-922"><a href="#CheckColumnConstraint-922"><span class="linenos">922</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CheckColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CheckColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CheckColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CheckColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CheckColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CheckColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CheckColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CheckColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CheckColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CheckColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CheckColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CheckColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CheckColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CheckColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CheckColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CheckColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CheckColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CheckColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CheckColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CheckColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CheckColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CheckColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CheckColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CheckColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CheckColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CheckColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CheckColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CheckColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CheckColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CheckColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CheckColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CheckColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CheckColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CollateColumnConstraint"> + <input id="CollateColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CollateColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="CollateColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CollateColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CollateColumnConstraint-925"><a href="#CollateColumnConstraint-925"><span class="linenos">925</span></a><span class="k">class</span> <span class="nc">CollateColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="CollateColumnConstraint-926"><a href="#CollateColumnConstraint-926"><span class="linenos">926</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CollateColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CollateColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CollateColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CollateColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CollateColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CollateColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CollateColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CollateColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CollateColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CollateColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CollateColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CollateColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CollateColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CollateColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CollateColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CollateColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CollateColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CollateColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CollateColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CollateColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CollateColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CollateColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CollateColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CollateColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CollateColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CollateColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CollateColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CollateColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CollateColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CollateColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CollateColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CollateColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CollateColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CommentColumnConstraint"> + <input id="CommentColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CommentColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="CommentColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CommentColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CommentColumnConstraint-929"><a href="#CommentColumnConstraint-929"><span class="linenos">929</span></a><span class="k">class</span> <span class="nc">CommentColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="CommentColumnConstraint-930"><a href="#CommentColumnConstraint-930"><span class="linenos">930</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CommentColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CommentColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CommentColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CommentColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CommentColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CommentColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CommentColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CommentColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CommentColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CommentColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CommentColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CommentColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CommentColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CommentColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CommentColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CommentColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CommentColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CommentColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CommentColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CommentColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CommentColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CommentColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CommentColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CommentColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CommentColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CommentColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CommentColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CommentColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CommentColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CommentColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CommentColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CommentColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CommentColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DefaultColumnConstraint"> + <input id="DefaultColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DefaultColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="DefaultColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DefaultColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DefaultColumnConstraint-933"><a href="#DefaultColumnConstraint-933"><span class="linenos">933</span></a><span class="k">class</span> <span class="nc">DefaultColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="DefaultColumnConstraint-934"><a href="#DefaultColumnConstraint-934"><span class="linenos">934</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DefaultColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DefaultColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DefaultColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DefaultColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DefaultColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DefaultColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DefaultColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DefaultColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DefaultColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DefaultColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DefaultColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DefaultColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DefaultColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DefaultColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DefaultColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DefaultColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DefaultColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DefaultColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DefaultColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DefaultColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DefaultColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DefaultColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DefaultColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DefaultColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DefaultColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DefaultColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DefaultColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DefaultColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DefaultColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DefaultColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DefaultColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DefaultColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DefaultColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="EncodeColumnConstraint"> + <input id="EncodeColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">EncodeColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="EncodeColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#EncodeColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="EncodeColumnConstraint-937"><a href="#EncodeColumnConstraint-937"><span class="linenos">937</span></a><span class="k">class</span> <span class="nc">EncodeColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="EncodeColumnConstraint-938"><a href="#EncodeColumnConstraint-938"><span class="linenos">938</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="EncodeColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="EncodeColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="EncodeColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="EncodeColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="EncodeColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="EncodeColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="EncodeColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="EncodeColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="EncodeColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="EncodeColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="EncodeColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="EncodeColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="EncodeColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="EncodeColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="EncodeColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="EncodeColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="EncodeColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="EncodeColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="EncodeColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="EncodeColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="EncodeColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="EncodeColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="EncodeColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="EncodeColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="EncodeColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="EncodeColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="EncodeColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="EncodeColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="EncodeColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="EncodeColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="EncodeColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="EncodeColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="EncodeColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="GeneratedAsIdentityColumnConstraint"> + <input id="GeneratedAsIdentityColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">GeneratedAsIdentityColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="GeneratedAsIdentityColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GeneratedAsIdentityColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GeneratedAsIdentityColumnConstraint-941"><a href="#GeneratedAsIdentityColumnConstraint-941"><span class="linenos">941</span></a><span class="k">class</span> <span class="nc">GeneratedAsIdentityColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="GeneratedAsIdentityColumnConstraint-942"><a href="#GeneratedAsIdentityColumnConstraint-942"><span class="linenos">942</span></a> <span class="c1"># this: True -> ALWAYS, this: False -> BY DEFAULT</span> +</span><span id="GeneratedAsIdentityColumnConstraint-943"><a href="#GeneratedAsIdentityColumnConstraint-943"><span class="linenos">943</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"increment"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="GeneratedAsIdentityColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="GeneratedAsIdentityColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="NotNullColumnConstraint"> + <input id="NotNullColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">NotNullColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="NotNullColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#NotNullColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="NotNullColumnConstraint-946"><a href="#NotNullColumnConstraint-946"><span class="linenos">946</span></a><span class="k">class</span> <span class="nc">NotNullColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="NotNullColumnConstraint-947"><a href="#NotNullColumnConstraint-947"><span class="linenos">947</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"allow_null"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="NotNullColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="NotNullColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="NotNullColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="NotNullColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="NotNullColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="NotNullColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="NotNullColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="NotNullColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="NotNullColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="NotNullColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="NotNullColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="NotNullColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="NotNullColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="NotNullColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="NotNullColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="NotNullColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="NotNullColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="NotNullColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="NotNullColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="NotNullColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="NotNullColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="NotNullColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="NotNullColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="NotNullColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="NotNullColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="NotNullColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="NotNullColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="NotNullColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="NotNullColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="NotNullColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="NotNullColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="NotNullColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="NotNullColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="PrimaryKeyColumnConstraint"> + <input id="PrimaryKeyColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PrimaryKeyColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="PrimaryKeyColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PrimaryKeyColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PrimaryKeyColumnConstraint-950"><a href="#PrimaryKeyColumnConstraint-950"><span class="linenos">950</span></a><span class="k">class</span> <span class="nc">PrimaryKeyColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="PrimaryKeyColumnConstraint-951"><a href="#PrimaryKeyColumnConstraint-951"><span class="linenos">951</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"desc"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="PrimaryKeyColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="PrimaryKeyColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="PrimaryKeyColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="PrimaryKeyColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="PrimaryKeyColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="PrimaryKeyColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="PrimaryKeyColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="PrimaryKeyColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="PrimaryKeyColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="PrimaryKeyColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="PrimaryKeyColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="PrimaryKeyColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="PrimaryKeyColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="PrimaryKeyColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="PrimaryKeyColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="PrimaryKeyColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="PrimaryKeyColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="PrimaryKeyColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="PrimaryKeyColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="PrimaryKeyColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="PrimaryKeyColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="PrimaryKeyColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="PrimaryKeyColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="PrimaryKeyColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="PrimaryKeyColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="PrimaryKeyColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="PrimaryKeyColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="PrimaryKeyColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="PrimaryKeyColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="PrimaryKeyColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="PrimaryKeyColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="PrimaryKeyColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="PrimaryKeyColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UniqueColumnConstraint"> + <input id="UniqueColumnConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UniqueColumnConstraint</span><wbr>(<span class="base"><a href="#ColumnConstraintKind">ColumnConstraintKind</a></span>): + + <label class="view-source-button" for="UniqueColumnConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UniqueColumnConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UniqueColumnConstraint-954"><a href="#UniqueColumnConstraint-954"><span class="linenos">954</span></a><span class="k">class</span> <span class="nc">UniqueColumnConstraint</span><span class="p">(</span><span class="n">ColumnConstraintKind</span><span class="p">):</span> +</span><span id="UniqueColumnConstraint-955"><a href="#UniqueColumnConstraint-955"><span class="linenos">955</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UniqueColumnConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UniqueColumnConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UniqueColumnConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UniqueColumnConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UniqueColumnConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UniqueColumnConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UniqueColumnConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UniqueColumnConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UniqueColumnConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UniqueColumnConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UniqueColumnConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UniqueColumnConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UniqueColumnConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UniqueColumnConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UniqueColumnConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UniqueColumnConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UniqueColumnConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UniqueColumnConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UniqueColumnConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UniqueColumnConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UniqueColumnConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UniqueColumnConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UniqueColumnConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UniqueColumnConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UniqueColumnConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UniqueColumnConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UniqueColumnConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UniqueColumnConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UniqueColumnConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UniqueColumnConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UniqueColumnConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UniqueColumnConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UniqueColumnConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Constraint"> + <input id="Constraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Constraint</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Constraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Constraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Constraint-958"><a href="#Constraint-958"><span class="linenos">958</span></a><span class="k">class</span> <span class="nc">Constraint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Constraint-959"><a href="#Constraint-959"><span class="linenos">959</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Constraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Constraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Constraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Constraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Constraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Constraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Constraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Constraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Constraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Constraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Constraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Constraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Constraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Constraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Constraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Constraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Constraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Constraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Constraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Constraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Constraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Constraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Constraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Constraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Constraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Constraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Constraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Constraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Constraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Constraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Constraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Constraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Constraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Delete"> + <input id="Delete-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Delete</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Delete-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Delete"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Delete-962"><a href="#Delete-962"><span class="linenos">962</span></a><span class="k">class</span> <span class="nc">Delete</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Delete-963"><a href="#Delete-963"><span class="linenos">963</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Delete.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Delete.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Delete.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Delete.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Delete.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Delete.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Delete.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Delete.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Delete.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Delete.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Delete.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Delete.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Delete.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Delete.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Delete.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Delete.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Delete.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Delete.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Delete.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Delete.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Delete.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Delete.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Delete.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Delete.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Delete.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Delete.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Delete.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Delete.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Delete.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Delete.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Delete.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Delete.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Delete.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Drop"> + <input id="Drop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Drop</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Drop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Drop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Drop-966"><a href="#Drop-966"><span class="linenos">966</span></a><span class="k">class</span> <span class="nc">Drop</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Drop-967"><a href="#Drop-967"><span class="linenos">967</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Drop-968"><a href="#Drop-968"><span class="linenos">968</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Drop-969"><a href="#Drop-969"><span class="linenos">969</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Drop-970"><a href="#Drop-970"><span class="linenos">970</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Drop-971"><a href="#Drop-971"><span class="linenos">971</span></a> <span class="s2">"temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Drop-972"><a href="#Drop-972"><span class="linenos">972</span></a> <span class="s2">"materialized"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Drop-973"><a href="#Drop-973"><span class="linenos">973</span></a> <span class="s2">"cascade"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Drop-974"><a href="#Drop-974"><span class="linenos">974</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Drop.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Drop.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Drop.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Drop.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Drop.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Drop.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Drop.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Drop.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Drop.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Drop.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Drop.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Drop.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Drop.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Drop.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Drop.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Drop.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Drop.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Drop.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Drop.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Drop.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Drop.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Drop.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Drop.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Drop.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Drop.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Drop.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Drop.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Drop.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Drop.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Drop.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Drop.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Drop.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Drop.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Filter"> + <input id="Filter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Filter</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Filter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Filter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Filter-977"><a href="#Filter-977"><span class="linenos">977</span></a><span class="k">class</span> <span class="nc">Filter</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Filter-978"><a href="#Filter-978"><span class="linenos">978</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Filter.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Filter.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Filter.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Filter.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Filter.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Filter.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Filter.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Filter.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Filter.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Filter.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Filter.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Filter.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Filter.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Filter.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Filter.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Filter.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Filter.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Filter.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Filter.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Filter.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Filter.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Filter.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Filter.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Filter.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Filter.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Filter.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Filter.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Filter.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Filter.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Filter.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Filter.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Filter.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Filter.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Check"> + <input id="Check-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Check</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Check-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Check"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Check-981"><a href="#Check-981"><span class="linenos">981</span></a><span class="k">class</span> <span class="nc">Check</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Check-982"><a href="#Check-982"><span class="linenos">982</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Check.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Check.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Check.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Check.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Check.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Check.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Check.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Check.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Check.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Check.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Check.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Check.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Check.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Check.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Check.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Check.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Check.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Check.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Check.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Check.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Check.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Check.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Check.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Check.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Check.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Check.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Check.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Check.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Check.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Check.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Check.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Check.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Check.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Directory"> + <input id="Directory-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Directory</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Directory-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Directory"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Directory-985"><a href="#Directory-985"><span class="linenos">985</span></a><span class="k">class</span> <span class="nc">Directory</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Directory-986"><a href="#Directory-986"><span class="linenos">986</span></a> <span class="c1"># https://spark.apache.org/docs/3.0.0-preview/sql-ref-syntax-dml-insert-overwrite-directory-hive.html</span> +</span><span id="Directory-987"><a href="#Directory-987"><span class="linenos">987</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"local"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"row_format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Directory.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Directory.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Directory.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Directory.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Directory.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Directory.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Directory.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Directory.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Directory.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Directory.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Directory.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Directory.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Directory.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Directory.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Directory.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Directory.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Directory.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Directory.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Directory.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Directory.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Directory.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Directory.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Directory.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Directory.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Directory.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Directory.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Directory.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Directory.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Directory.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Directory.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Directory.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Directory.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Directory.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ForeignKey"> + <input id="ForeignKey-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ForeignKey</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="ForeignKey-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ForeignKey"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ForeignKey-990"><a href="#ForeignKey-990"><span class="linenos">990</span></a><span class="k">class</span> <span class="nc">ForeignKey</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="ForeignKey-991"><a href="#ForeignKey-991"><span class="linenos">991</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="ForeignKey-992"><a href="#ForeignKey-992"><span class="linenos">992</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="ForeignKey-993"><a href="#ForeignKey-993"><span class="linenos">993</span></a> <span class="s2">"reference"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="ForeignKey-994"><a href="#ForeignKey-994"><span class="linenos">994</span></a> <span class="s2">"delete"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="ForeignKey-995"><a href="#ForeignKey-995"><span class="linenos">995</span></a> <span class="s2">"update"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="ForeignKey-996"><a href="#ForeignKey-996"><span class="linenos">996</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ForeignKey.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ForeignKey.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ForeignKey.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ForeignKey.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ForeignKey.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ForeignKey.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ForeignKey.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ForeignKey.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ForeignKey.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ForeignKey.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ForeignKey.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ForeignKey.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ForeignKey.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ForeignKey.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ForeignKey.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ForeignKey.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ForeignKey.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ForeignKey.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ForeignKey.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ForeignKey.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ForeignKey.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ForeignKey.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ForeignKey.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ForeignKey.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ForeignKey.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ForeignKey.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ForeignKey.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ForeignKey.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ForeignKey.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ForeignKey.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ForeignKey.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ForeignKey.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ForeignKey.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="PrimaryKey"> + <input id="PrimaryKey-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PrimaryKey</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="PrimaryKey-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PrimaryKey"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PrimaryKey-999"><a href="#PrimaryKey-999"><span class="linenos"> 999</span></a><span class="k">class</span> <span class="nc">PrimaryKey</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="PrimaryKey-1000"><a href="#PrimaryKey-1000"><span class="linenos">1000</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="PrimaryKey.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="PrimaryKey.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="PrimaryKey.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="PrimaryKey.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="PrimaryKey.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="PrimaryKey.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="PrimaryKey.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="PrimaryKey.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="PrimaryKey.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="PrimaryKey.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="PrimaryKey.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="PrimaryKey.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="PrimaryKey.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="PrimaryKey.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="PrimaryKey.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="PrimaryKey.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="PrimaryKey.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="PrimaryKey.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="PrimaryKey.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="PrimaryKey.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="PrimaryKey.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="PrimaryKey.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="PrimaryKey.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="PrimaryKey.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="PrimaryKey.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="PrimaryKey.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="PrimaryKey.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="PrimaryKey.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="PrimaryKey.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="PrimaryKey.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="PrimaryKey.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="PrimaryKey.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="PrimaryKey.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Unique"> + <input id="Unique-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Unique</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Unique-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unique"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unique-1003"><a href="#Unique-1003"><span class="linenos">1003</span></a><span class="k">class</span> <span class="nc">Unique</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Unique-1004"><a href="#Unique-1004"><span class="linenos">1004</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Unique.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Unique.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Unique.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Unique.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Unique.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Unique.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Unique.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Unique.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Unique.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Unique.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Unique.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Unique.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Unique.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Unique.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Unique.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Unique.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Unique.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Unique.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Unique.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Unique.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Unique.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Unique.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Unique.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Unique.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Unique.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Unique.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Unique.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Unique.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Unique.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Unique.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Unique.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Unique.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Unique.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Into"> + <input id="Into-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Into</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Into-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Into"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Into-1009"><a href="#Into-1009"><span class="linenos">1009</span></a><span class="k">class</span> <span class="nc">Into</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Into-1010"><a href="#Into-1010"><span class="linenos">1010</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"temporary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"unlogged"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Into.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Into.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Into.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Into.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Into.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Into.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Into.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Into.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Into.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Into.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Into.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Into.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Into.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Into.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Into.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Into.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Into.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Into.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Into.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Into.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Into.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Into.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Into.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Into.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Into.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Into.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Into.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Into.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Into.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Into.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Into.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Into.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Into.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="From"> + <input id="From-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">From</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="From-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#From"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="From-1013"><a href="#From-1013"><span class="linenos">1013</span></a><span class="k">class</span> <span class="nc">From</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="From-1014"><a href="#From-1014"><span class="linenos">1014</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="From.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="From.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="From.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="From.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="From.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="From.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="From.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="From.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="From.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="From.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="From.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="From.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="From.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="From.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="From.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="From.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="From.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="From.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="From.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="From.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="From.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="From.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="From.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="From.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="From.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="From.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="From.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="From.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="From.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="From.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="From.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="From.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="From.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Having"> + <input id="Having-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Having</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Having-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Having"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Having-1017"><a href="#Having-1017"><span class="linenos">1017</span></a><span class="k">class</span> <span class="nc">Having</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Having-1018"><a href="#Having-1018"><span class="linenos">1018</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Having.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Having.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Having.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Having.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Having.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Having.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Having.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Having.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Having.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Having.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Having.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Having.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Having.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Having.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Having.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Having.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Having.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Having.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Having.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Having.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Having.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Having.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Having.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Having.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Having.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Having.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Having.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Having.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Having.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Having.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Having.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Having.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Having.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Hint"> + <input id="Hint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Hint</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Hint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hint-1021"><a href="#Hint-1021"><span class="linenos">1021</span></a><span class="k">class</span> <span class="nc">Hint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Hint-1022"><a href="#Hint-1022"><span class="linenos">1022</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Hint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Hint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Hint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Hint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Hint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Hint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Hint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Hint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Hint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Hint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Hint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Hint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Hint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Hint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Hint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Hint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Hint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Hint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Hint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Hint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Hint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Hint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Hint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Hint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Hint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Hint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Hint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Hint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Hint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Hint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Hint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Hint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Hint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JoinHint"> + <input id="JoinHint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JoinHint</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="JoinHint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JoinHint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JoinHint-1025"><a href="#JoinHint-1025"><span class="linenos">1025</span></a><span class="k">class</span> <span class="nc">JoinHint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="JoinHint-1026"><a href="#JoinHint-1026"><span class="linenos">1026</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JoinHint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JoinHint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JoinHint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JoinHint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JoinHint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JoinHint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JoinHint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JoinHint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JoinHint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JoinHint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JoinHint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JoinHint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JoinHint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JoinHint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JoinHint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JoinHint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JoinHint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JoinHint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JoinHint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JoinHint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JoinHint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JoinHint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JoinHint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JoinHint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JoinHint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JoinHint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JoinHint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JoinHint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JoinHint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JoinHint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JoinHint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JoinHint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JoinHint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Identifier"> + <input id="Identifier-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Identifier</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Identifier-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Identifier"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Identifier-1029"><a href="#Identifier-1029"><span class="linenos">1029</span></a><span class="k">class</span> <span class="nc">Identifier</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Identifier-1030"><a href="#Identifier-1030"><span class="linenos">1030</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"quoted"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Identifier-1031"><a href="#Identifier-1031"><span class="linenos">1031</span></a> +</span><span id="Identifier-1032"><a href="#Identifier-1032"><span class="linenos">1032</span></a> <span class="nd">@property</span> +</span><span id="Identifier-1033"><a href="#Identifier-1033"><span class="linenos">1033</span></a> <span class="k">def</span> <span class="nf">quoted</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Identifier-1034"><a href="#Identifier-1034"><span class="linenos">1034</span></a> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">))</span> +</span><span id="Identifier-1035"><a href="#Identifier-1035"><span class="linenos">1035</span></a> +</span><span id="Identifier-1036"><a href="#Identifier-1036"><span class="linenos">1036</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="Identifier-1037"><a href="#Identifier-1037"><span class="linenos">1037</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> <span class="ow">and</span> <span class="n">_norm_arg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="o">==</span> <span class="n">_norm_arg</span><span class="p">(</span><span class="n">other</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="Identifier-1038"><a href="#Identifier-1038"><span class="linenos">1038</span></a> +</span><span id="Identifier-1039"><a href="#Identifier-1039"><span class="linenos">1039</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Identifier-1040"><a href="#Identifier-1040"><span class="linenos">1040</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">lower</span><span class="p">()))</span> +</span><span id="Identifier-1041"><a href="#Identifier-1041"><span class="linenos">1041</span></a> +</span><span id="Identifier-1042"><a href="#Identifier-1042"><span class="linenos">1042</span></a> <span class="nd">@property</span> +</span><span id="Identifier-1043"><a href="#Identifier-1043"><span class="linenos">1043</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Identifier-1044"><a href="#Identifier-1044"><span class="linenos">1044</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span></pre></div> + + + + + <div id="Identifier.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Identifier.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Identifier.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Identifier.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Identifier.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Identifier.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Identifier.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Identifier.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Identifier.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Identifier.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Identifier.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Identifier.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Identifier.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Identifier.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Identifier.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Identifier.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Identifier.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Identifier.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Identifier.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Identifier.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Identifier.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Identifier.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Identifier.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Identifier.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Identifier.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Identifier.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Identifier.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Identifier.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Identifier.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Identifier.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Identifier.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Identifier.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Identifier.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Identifier.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Index"> + <input id="Index-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Index</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Index-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Index"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Index-1047"><a href="#Index-1047"><span class="linenos">1047</span></a><span class="k">class</span> <span class="nc">Index</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Index-1048"><a href="#Index-1048"><span class="linenos">1048</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Index-1049"><a href="#Index-1049"><span class="linenos">1049</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Index-1050"><a href="#Index-1050"><span class="linenos">1050</span></a> <span class="s2">"table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Index-1051"><a href="#Index-1051"><span class="linenos">1051</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Index-1052"><a href="#Index-1052"><span class="linenos">1052</span></a> <span class="s2">"columns"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Index-1053"><a href="#Index-1053"><span class="linenos">1053</span></a> <span class="s2">"unique"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Index-1054"><a href="#Index-1054"><span class="linenos">1054</span></a> <span class="s2">"primary"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Index-1055"><a href="#Index-1055"><span class="linenos">1055</span></a> <span class="s2">"amp"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="c1"># teradata</span> +</span><span id="Index-1056"><a href="#Index-1056"><span class="linenos">1056</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Index.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Index.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Index.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Index.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Index.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Index.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Index.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Index.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Index.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Index.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Index.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Index.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Index.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Index.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Index.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Index.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Index.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Index.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Index.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Index.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Index.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Index.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Index.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Index.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Index.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Index.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Index.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Index.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Index.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Index.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Index.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Index.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Index.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Insert"> + <input id="Insert-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Insert</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Insert-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Insert"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Insert-1059"><a href="#Insert-1059"><span class="linenos">1059</span></a><span class="k">class</span> <span class="nc">Insert</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Insert-1060"><a href="#Insert-1060"><span class="linenos">1060</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Insert-1061"><a href="#Insert-1061"><span class="linenos">1061</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Insert-1062"><a href="#Insert-1062"><span class="linenos">1062</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Insert-1063"><a href="#Insert-1063"><span class="linenos">1063</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Insert-1064"><a href="#Insert-1064"><span class="linenos">1064</span></a> <span class="s2">"overwrite"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Insert-1065"><a href="#Insert-1065"><span class="linenos">1065</span></a> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Insert-1066"><a href="#Insert-1066"><span class="linenos">1066</span></a> <span class="s2">"partition"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Insert-1067"><a href="#Insert-1067"><span class="linenos">1067</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Insert.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Insert.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Insert.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Insert.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Insert.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Insert.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Insert.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Insert.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Insert.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Insert.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Insert.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Insert.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Insert.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Insert.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Insert.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Insert.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Insert.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Insert.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Insert.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Insert.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Insert.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Insert.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Insert.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Insert.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Insert.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Insert.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Insert.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Insert.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Insert.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Insert.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Insert.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Insert.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Insert.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Introducer"> + <input id="Introducer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Introducer</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Introducer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Introducer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Introducer-1071"><a href="#Introducer-1071"><span class="linenos">1071</span></a><span class="k">class</span> <span class="nc">Introducer</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Introducer-1072"><a href="#Introducer-1072"><span class="linenos">1072</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Introducer.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Introducer.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Introducer.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Introducer.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Introducer.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Introducer.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Introducer.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Introducer.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Introducer.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Introducer.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Introducer.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Introducer.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Introducer.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Introducer.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Introducer.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Introducer.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Introducer.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Introducer.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Introducer.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Introducer.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Introducer.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Introducer.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Introducer.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Introducer.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Introducer.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Introducer.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Introducer.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Introducer.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Introducer.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Introducer.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Introducer.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Introducer.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Introducer.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="National"> + <input id="National-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">National</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="National-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#National"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="National-1076"><a href="#National-1076"><span class="linenos">1076</span></a><span class="k">class</span> <span class="nc">National</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="National-1077"><a href="#National-1077"><span class="linenos">1077</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="National.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="National.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="National.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="National.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="National.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="National.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="National.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="National.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="National.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="National.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="National.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="National.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="National.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="National.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="National.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="National.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="National.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="National.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="National.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="National.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="National.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="National.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="National.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="National.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="National.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="National.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="National.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="National.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="National.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="National.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="National.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="National.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="National.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LoadData"> + <input id="LoadData-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LoadData</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="LoadData-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LoadData"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LoadData-1080"><a href="#LoadData-1080"><span class="linenos">1080</span></a><span class="k">class</span> <span class="nc">LoadData</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="LoadData-1081"><a href="#LoadData-1081"><span class="linenos">1081</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="LoadData-1082"><a href="#LoadData-1082"><span class="linenos">1082</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="LoadData-1083"><a href="#LoadData-1083"><span class="linenos">1083</span></a> <span class="s2">"local"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LoadData-1084"><a href="#LoadData-1084"><span class="linenos">1084</span></a> <span class="s2">"overwrite"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LoadData-1085"><a href="#LoadData-1085"><span class="linenos">1085</span></a> <span class="s2">"inpath"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="LoadData-1086"><a href="#LoadData-1086"><span class="linenos">1086</span></a> <span class="s2">"partition"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LoadData-1087"><a href="#LoadData-1087"><span class="linenos">1087</span></a> <span class="s2">"input_format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LoadData-1088"><a href="#LoadData-1088"><span class="linenos">1088</span></a> <span class="s2">"serde"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LoadData-1089"><a href="#LoadData-1089"><span class="linenos">1089</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LoadData.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LoadData.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LoadData.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LoadData.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LoadData.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LoadData.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LoadData.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LoadData.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LoadData.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LoadData.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LoadData.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LoadData.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LoadData.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LoadData.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LoadData.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LoadData.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LoadData.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LoadData.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LoadData.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LoadData.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LoadData.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LoadData.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LoadData.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LoadData.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LoadData.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LoadData.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LoadData.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LoadData.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LoadData.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LoadData.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LoadData.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LoadData.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LoadData.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Partition"> + <input id="Partition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Partition</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Partition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Partition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Partition-1092"><a href="#Partition-1092"><span class="linenos">1092</span></a><span class="k">class</span> <span class="nc">Partition</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Partition-1093"><a href="#Partition-1093"><span class="linenos">1093</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Partition.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Partition.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Partition.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Partition.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Partition.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Partition.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Partition.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Partition.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Partition.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Partition.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Partition.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Partition.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Partition.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Partition.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Partition.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Partition.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Partition.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Partition.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Partition.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Partition.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Partition.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Partition.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Partition.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Partition.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Partition.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Partition.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Partition.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Partition.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Partition.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Partition.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Partition.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Partition.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Partition.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Fetch"> + <input id="Fetch-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Fetch</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Fetch-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Fetch"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Fetch-1096"><a href="#Fetch-1096"><span class="linenos">1096</span></a><span class="k">class</span> <span class="nc">Fetch</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Fetch-1097"><a href="#Fetch-1097"><span class="linenos">1097</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"direction"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"count"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Fetch.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Fetch.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Fetch.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Fetch.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Fetch.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Fetch.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Fetch.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Fetch.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Fetch.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Fetch.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Fetch.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Fetch.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Fetch.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Fetch.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Fetch.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Fetch.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Fetch.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Fetch.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Fetch.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Fetch.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Fetch.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Fetch.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Fetch.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Fetch.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Fetch.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Fetch.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Fetch.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Fetch.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Fetch.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Fetch.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Fetch.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Fetch.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Fetch.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Group"> + <input id="Group-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Group</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Group-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Group"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Group-1100"><a href="#Group-1100"><span class="linenos">1100</span></a><span class="k">class</span> <span class="nc">Group</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Group-1101"><a href="#Group-1101"><span class="linenos">1101</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Group-1102"><a href="#Group-1102"><span class="linenos">1102</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Group-1103"><a href="#Group-1103"><span class="linenos">1103</span></a> <span class="s2">"grouping_sets"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Group-1104"><a href="#Group-1104"><span class="linenos">1104</span></a> <span class="s2">"cube"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Group-1105"><a href="#Group-1105"><span class="linenos">1105</span></a> <span class="s2">"rollup"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Group-1106"><a href="#Group-1106"><span class="linenos">1106</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Group.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Group.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Group.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Group.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Group.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Group.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Group.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Group.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Group.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Group.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Group.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Group.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Group.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Group.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Group.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Group.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Group.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Group.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Group.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Group.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Group.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Group.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Group.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Group.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Group.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Group.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Group.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Group.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Group.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Group.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Group.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Group.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Group.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Lambda"> + <input id="Lambda-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Lambda</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Lambda-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Lambda"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Lambda-1109"><a href="#Lambda-1109"><span class="linenos">1109</span></a><span class="k">class</span> <span class="nc">Lambda</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Lambda-1110"><a href="#Lambda-1110"><span class="linenos">1110</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Lambda.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Lambda.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Lambda.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Lambda.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Lambda.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Lambda.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Lambda.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Lambda.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Lambda.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Lambda.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Lambda.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Lambda.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Lambda.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Lambda.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Lambda.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Lambda.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Lambda.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Lambda.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Lambda.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Lambda.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Lambda.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Lambda.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Lambda.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Lambda.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Lambda.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Lambda.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Lambda.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Lambda.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Lambda.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Lambda.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Lambda.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Lambda.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Lambda.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Limit"> + <input id="Limit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Limit</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Limit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Limit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Limit-1113"><a href="#Limit-1113"><span class="linenos">1113</span></a><span class="k">class</span> <span class="nc">Limit</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Limit-1114"><a href="#Limit-1114"><span class="linenos">1114</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Limit.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Limit.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Limit.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Limit.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Limit.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Limit.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Limit.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Limit.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Limit.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Limit.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Limit.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Limit.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Limit.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Limit.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Limit.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Limit.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Limit.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Limit.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Limit.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Limit.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Limit.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Limit.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Limit.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Limit.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Limit.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Limit.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Limit.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Limit.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Limit.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Limit.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Limit.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Limit.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Limit.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Literal"> + <input id="Literal-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Literal</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Literal-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Literal"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Literal-1117"><a href="#Literal-1117"><span class="linenos">1117</span></a><span class="k">class</span> <span class="nc">Literal</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Literal-1118"><a href="#Literal-1118"><span class="linenos">1118</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"is_string"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Literal-1119"><a href="#Literal-1119"><span class="linenos">1119</span></a> +</span><span id="Literal-1120"><a href="#Literal-1120"><span class="linenos">1120</span></a> <span class="k">def</span> <span class="fm">__eq__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">other</span><span class="p">):</span> +</span><span id="Literal-1121"><a href="#Literal-1121"><span class="linenos">1121</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="Literal-1122"><a href="#Literal-1122"><span class="linenos">1122</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="n">Literal</span><span class="p">)</span> +</span><span id="Literal-1123"><a href="#Literal-1123"><span class="linenos">1123</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">this</span> +</span><span id="Literal-1124"><a href="#Literal-1124"><span class="linenos">1124</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> <span class="o">==</span> <span class="n">other</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]</span> +</span><span id="Literal-1125"><a href="#Literal-1125"><span class="linenos">1125</span></a> <span class="p">)</span> +</span><span id="Literal-1126"><a href="#Literal-1126"><span class="linenos">1126</span></a> +</span><span id="Literal-1127"><a href="#Literal-1127"><span class="linenos">1127</span></a> <span class="k">def</span> <span class="fm">__hash__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Literal-1128"><a href="#Literal-1128"><span class="linenos">1128</span></a> <span class="k">return</span> <span class="nb">hash</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"is_string"</span><span class="p">]))</span> +</span><span id="Literal-1129"><a href="#Literal-1129"><span class="linenos">1129</span></a> +</span><span id="Literal-1130"><a href="#Literal-1130"><span class="linenos">1130</span></a> <span class="nd">@classmethod</span> +</span><span id="Literal-1131"><a href="#Literal-1131"><span class="linenos">1131</span></a> <span class="k">def</span> <span class="nf">number</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">number</span><span class="p">)</span> <span class="o">-></span> <span class="n">Literal</span><span class="p">:</span> +</span><span id="Literal-1132"><a href="#Literal-1132"><span class="linenos">1132</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">number</span><span class="p">),</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Literal-1133"><a href="#Literal-1133"><span class="linenos">1133</span></a> +</span><span id="Literal-1134"><a href="#Literal-1134"><span class="linenos">1134</span></a> <span class="nd">@classmethod</span> +</span><span id="Literal-1135"><a href="#Literal-1135"><span class="linenos">1135</span></a> <span class="k">def</span> <span class="nf">string</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">string</span><span class="p">)</span> <span class="o">-></span> <span class="n">Literal</span><span class="p">:</span> +</span><span id="Literal-1136"><a href="#Literal-1136"><span class="linenos">1136</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">string</span><span class="p">),</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Literal-1137"><a href="#Literal-1137"><span class="linenos">1137</span></a> +</span><span id="Literal-1138"><a href="#Literal-1138"><span class="linenos">1138</span></a> <span class="nd">@property</span> +</span><span id="Literal-1139"><a href="#Literal-1139"><span class="linenos">1139</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Literal-1140"><a href="#Literal-1140"><span class="linenos">1140</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span></pre></div> + + + + + <div id="Literal.number" class="classattr"> + <input id="Literal.number-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">number</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">number</span></span><span class="return-annotation">) -> <span class="n"><a href="#Literal">sqlglot.expressions.Literal</a></span>:</span></span> + + <label class="view-source-button" for="Literal.number-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Literal.number"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Literal.number-1130"><a href="#Literal.number-1130"><span class="linenos">1130</span></a> <span class="nd">@classmethod</span> +</span><span id="Literal.number-1131"><a href="#Literal.number-1131"><span class="linenos">1131</span></a> <span class="k">def</span> <span class="nf">number</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">number</span><span class="p">)</span> <span class="o">-></span> <span class="n">Literal</span><span class="p">:</span> +</span><span id="Literal.number-1132"><a href="#Literal.number-1132"><span class="linenos">1132</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">number</span><span class="p">),</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Literal.string" class="classattr"> + <input id="Literal.string-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">string</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">string</span></span><span class="return-annotation">) -> <span class="n"><a href="#Literal">sqlglot.expressions.Literal</a></span>:</span></span> + + <label class="view-source-button" for="Literal.string-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Literal.string"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Literal.string-1134"><a href="#Literal.string-1134"><span class="linenos">1134</span></a> <span class="nd">@classmethod</span> +</span><span id="Literal.string-1135"><a href="#Literal.string-1135"><span class="linenos">1135</span></a> <span class="k">def</span> <span class="nf">string</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">string</span><span class="p">)</span> <span class="o">-></span> <span class="n">Literal</span><span class="p">:</span> +</span><span id="Literal.string-1136"><a href="#Literal.string-1136"><span class="linenos">1136</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">string</span><span class="p">),</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Literal.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Literal.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Literal.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Literal.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Literal.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Literal.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Literal.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Literal.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Literal.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Literal.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Literal.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Literal.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Literal.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Literal.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Literal.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Literal.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Literal.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Literal.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Literal.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Literal.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Literal.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Literal.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Literal.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Literal.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Literal.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Literal.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Literal.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Literal.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Literal.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Literal.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Literal.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Literal.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Literal.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Literal.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Literal.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Literal.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Literal.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Join"> + <input id="Join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Join</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Join-1143"><a href="#Join-1143"><span class="linenos">1143</span></a><span class="k">class</span> <span class="nc">Join</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Join-1144"><a href="#Join-1144"><span class="linenos">1144</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Join-1145"><a href="#Join-1145"><span class="linenos">1145</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Join-1146"><a href="#Join-1146"><span class="linenos">1146</span></a> <span class="s2">"on"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Join-1147"><a href="#Join-1147"><span class="linenos">1147</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Join-1148"><a href="#Join-1148"><span class="linenos">1148</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Join-1149"><a href="#Join-1149"><span class="linenos">1149</span></a> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Join-1150"><a href="#Join-1150"><span class="linenos">1150</span></a> <span class="s2">"natural"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Join-1151"><a href="#Join-1151"><span class="linenos">1151</span></a> <span class="p">}</span> +</span><span id="Join-1152"><a href="#Join-1152"><span class="linenos">1152</span></a> +</span><span id="Join-1153"><a href="#Join-1153"><span class="linenos">1153</span></a> <span class="nd">@property</span> +</span><span id="Join-1154"><a href="#Join-1154"><span class="linenos">1154</span></a> <span class="k">def</span> <span class="nf">kind</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Join-1155"><a href="#Join-1155"><span class="linenos">1155</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Join-1156"><a href="#Join-1156"><span class="linenos">1156</span></a> +</span><span id="Join-1157"><a href="#Join-1157"><span class="linenos">1157</span></a> <span class="nd">@property</span> +</span><span id="Join-1158"><a href="#Join-1158"><span class="linenos">1158</span></a> <span class="k">def</span> <span class="nf">side</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Join-1159"><a href="#Join-1159"><span class="linenos">1159</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"side"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Join-1160"><a href="#Join-1160"><span class="linenos">1160</span></a> +</span><span id="Join-1161"><a href="#Join-1161"><span class="linenos">1161</span></a> <span class="nd">@property</span> +</span><span id="Join-1162"><a href="#Join-1162"><span class="linenos">1162</span></a> <span class="k">def</span> <span class="nf">alias_or_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Join-1163"><a href="#Join-1163"><span class="linenos">1163</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="Join-1164"><a href="#Join-1164"><span class="linenos">1164</span></a> +</span><span id="Join-1165"><a href="#Join-1165"><span class="linenos">1165</span></a> <span class="k">def</span> <span class="nf">on</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Join-1166"><a href="#Join-1166"><span class="linenos">1166</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Join-1167"><a href="#Join-1167"><span class="linenos">1167</span></a><span class="sd"> Append to or set the ON expressions.</span> +</span><span id="Join-1168"><a href="#Join-1168"><span class="linenos">1168</span></a> +</span><span id="Join-1169"><a href="#Join-1169"><span class="linenos">1169</span></a><span class="sd"> Example:</span> +</span><span id="Join-1170"><a href="#Join-1170"><span class="linenos">1170</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Join-1171"><a href="#Join-1171"><span class="linenos">1171</span></a><span class="sd"> >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql()</span> +</span><span id="Join-1172"><a href="#Join-1172"><span class="linenos">1172</span></a><span class="sd"> 'JOIN x ON y = 1'</span> +</span><span id="Join-1173"><a href="#Join-1173"><span class="linenos">1173</span></a> +</span><span id="Join-1174"><a href="#Join-1174"><span class="linenos">1174</span></a><span class="sd"> Args:</span> +</span><span id="Join-1175"><a href="#Join-1175"><span class="linenos">1175</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Join-1176"><a href="#Join-1176"><span class="linenos">1176</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Join-1177"><a href="#Join-1177"><span class="linenos">1177</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="Join-1178"><a href="#Join-1178"><span class="linenos">1178</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="Join-1179"><a href="#Join-1179"><span class="linenos">1179</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Join-1180"><a href="#Join-1180"><span class="linenos">1180</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Join-1181"><a href="#Join-1181"><span class="linenos">1181</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Join-1182"><a href="#Join-1182"><span class="linenos">1182</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Join-1183"><a href="#Join-1183"><span class="linenos">1183</span></a> +</span><span id="Join-1184"><a href="#Join-1184"><span class="linenos">1184</span></a><span class="sd"> Returns:</span> +</span><span id="Join-1185"><a href="#Join-1185"><span class="linenos">1185</span></a><span class="sd"> Join: the modified join expression.</span> +</span><span id="Join-1186"><a href="#Join-1186"><span class="linenos">1186</span></a><span class="sd"> """</span> +</span><span id="Join-1187"><a href="#Join-1187"><span class="linenos">1187</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="Join-1188"><a href="#Join-1188"><span class="linenos">1188</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Join-1189"><a href="#Join-1189"><span class="linenos">1189</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Join-1190"><a href="#Join-1190"><span class="linenos">1190</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"on"</span><span class="p">,</span> +</span><span id="Join-1191"><a href="#Join-1191"><span class="linenos">1191</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Join-1192"><a href="#Join-1192"><span class="linenos">1192</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Join-1193"><a href="#Join-1193"><span class="linenos">1193</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Join-1194"><a href="#Join-1194"><span class="linenos">1194</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Join-1195"><a href="#Join-1195"><span class="linenos">1195</span></a> <span class="p">)</span> +</span><span id="Join-1196"><a href="#Join-1196"><span class="linenos">1196</span></a> +</span><span id="Join-1197"><a href="#Join-1197"><span class="linenos">1197</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="Join-1198"><a href="#Join-1198"><span class="linenos">1198</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Join-1199"><a href="#Join-1199"><span class="linenos">1199</span></a> +</span><span id="Join-1200"><a href="#Join-1200"><span class="linenos">1200</span></a> <span class="k">return</span> <span class="n">join</span> +</span><span id="Join-1201"><a href="#Join-1201"><span class="linenos">1201</span></a> +</span><span id="Join-1202"><a href="#Join-1202"><span class="linenos">1202</span></a> <span class="k">def</span> <span class="nf">using</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Join-1203"><a href="#Join-1203"><span class="linenos">1203</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Join-1204"><a href="#Join-1204"><span class="linenos">1204</span></a><span class="sd"> Append to or set the USING expressions.</span> +</span><span id="Join-1205"><a href="#Join-1205"><span class="linenos">1205</span></a> +</span><span id="Join-1206"><a href="#Join-1206"><span class="linenos">1206</span></a><span class="sd"> Example:</span> +</span><span id="Join-1207"><a href="#Join-1207"><span class="linenos">1207</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Join-1208"><a href="#Join-1208"><span class="linenos">1208</span></a><span class="sd"> >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql()</span> +</span><span id="Join-1209"><a href="#Join-1209"><span class="linenos">1209</span></a><span class="sd"> 'JOIN x USING (foo, bla)'</span> +</span><span id="Join-1210"><a href="#Join-1210"><span class="linenos">1210</span></a> +</span><span id="Join-1211"><a href="#Join-1211"><span class="linenos">1211</span></a><span class="sd"> Args:</span> +</span><span id="Join-1212"><a href="#Join-1212"><span class="linenos">1212</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Join-1213"><a href="#Join-1213"><span class="linenos">1213</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Join-1214"><a href="#Join-1214"><span class="linenos">1214</span></a><span class="sd"> append (bool): if `True`, concatenate the new expressions to the existing "using" list.</span> +</span><span id="Join-1215"><a href="#Join-1215"><span class="linenos">1215</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Join-1216"><a href="#Join-1216"><span class="linenos">1216</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Join-1217"><a href="#Join-1217"><span class="linenos">1217</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Join-1218"><a href="#Join-1218"><span class="linenos">1218</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Join-1219"><a href="#Join-1219"><span class="linenos">1219</span></a> +</span><span id="Join-1220"><a href="#Join-1220"><span class="linenos">1220</span></a><span class="sd"> Returns:</span> +</span><span id="Join-1221"><a href="#Join-1221"><span class="linenos">1221</span></a><span class="sd"> Join: the modified join expression.</span> +</span><span id="Join-1222"><a href="#Join-1222"><span class="linenos">1222</span></a><span class="sd"> """</span> +</span><span id="Join-1223"><a href="#Join-1223"><span class="linenos">1223</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Join-1224"><a href="#Join-1224"><span class="linenos">1224</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Join-1225"><a href="#Join-1225"><span class="linenos">1225</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Join-1226"><a href="#Join-1226"><span class="linenos">1226</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"using"</span><span class="p">,</span> +</span><span id="Join-1227"><a href="#Join-1227"><span class="linenos">1227</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Join-1228"><a href="#Join-1228"><span class="linenos">1228</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Join-1229"><a href="#Join-1229"><span class="linenos">1229</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Join-1230"><a href="#Join-1230"><span class="linenos">1230</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Join-1231"><a href="#Join-1231"><span class="linenos">1231</span></a> <span class="p">)</span> +</span><span id="Join-1232"><a href="#Join-1232"><span class="linenos">1232</span></a> +</span><span id="Join-1233"><a href="#Join-1233"><span class="linenos">1233</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="Join-1234"><a href="#Join-1234"><span class="linenos">1234</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Join-1235"><a href="#Join-1235"><span class="linenos">1235</span></a> +</span><span id="Join-1236"><a href="#Join-1236"><span class="linenos">1236</span></a> <span class="k">return</span> <span class="n">join</span> +</span></pre></div> + + + + + <div id="Join.on" class="classattr"> + <input id="Join.on-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">on</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">append</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">copy</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Join.on-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Join.on"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Join.on-1165"><a href="#Join.on-1165"><span class="linenos">1165</span></a> <span class="k">def</span> <span class="nf">on</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Join.on-1166"><a href="#Join.on-1166"><span class="linenos">1166</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Join.on-1167"><a href="#Join.on-1167"><span class="linenos">1167</span></a><span class="sd"> Append to or set the ON expressions.</span> +</span><span id="Join.on-1168"><a href="#Join.on-1168"><span class="linenos">1168</span></a> +</span><span id="Join.on-1169"><a href="#Join.on-1169"><span class="linenos">1169</span></a><span class="sd"> Example:</span> +</span><span id="Join.on-1170"><a href="#Join.on-1170"><span class="linenos">1170</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Join.on-1171"><a href="#Join.on-1171"><span class="linenos">1171</span></a><span class="sd"> >>> sqlglot.parse_one("JOIN x", into=Join).on("y = 1").sql()</span> +</span><span id="Join.on-1172"><a href="#Join.on-1172"><span class="linenos">1172</span></a><span class="sd"> 'JOIN x ON y = 1'</span> +</span><span id="Join.on-1173"><a href="#Join.on-1173"><span class="linenos">1173</span></a> +</span><span id="Join.on-1174"><a href="#Join.on-1174"><span class="linenos">1174</span></a><span class="sd"> Args:</span> +</span><span id="Join.on-1175"><a href="#Join.on-1175"><span class="linenos">1175</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Join.on-1176"><a href="#Join.on-1176"><span class="linenos">1176</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Join.on-1177"><a href="#Join.on-1177"><span class="linenos">1177</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="Join.on-1178"><a href="#Join.on-1178"><span class="linenos">1178</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="Join.on-1179"><a href="#Join.on-1179"><span class="linenos">1179</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Join.on-1180"><a href="#Join.on-1180"><span class="linenos">1180</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Join.on-1181"><a href="#Join.on-1181"><span class="linenos">1181</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Join.on-1182"><a href="#Join.on-1182"><span class="linenos">1182</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Join.on-1183"><a href="#Join.on-1183"><span class="linenos">1183</span></a> +</span><span id="Join.on-1184"><a href="#Join.on-1184"><span class="linenos">1184</span></a><span class="sd"> Returns:</span> +</span><span id="Join.on-1185"><a href="#Join.on-1185"><span class="linenos">1185</span></a><span class="sd"> Join: the modified join expression.</span> +</span><span id="Join.on-1186"><a href="#Join.on-1186"><span class="linenos">1186</span></a><span class="sd"> """</span> +</span><span id="Join.on-1187"><a href="#Join.on-1187"><span class="linenos">1187</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="Join.on-1188"><a href="#Join.on-1188"><span class="linenos">1188</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Join.on-1189"><a href="#Join.on-1189"><span class="linenos">1189</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Join.on-1190"><a href="#Join.on-1190"><span class="linenos">1190</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"on"</span><span class="p">,</span> +</span><span id="Join.on-1191"><a href="#Join.on-1191"><span class="linenos">1191</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Join.on-1192"><a href="#Join.on-1192"><span class="linenos">1192</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Join.on-1193"><a href="#Join.on-1193"><span class="linenos">1193</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Join.on-1194"><a href="#Join.on-1194"><span class="linenos">1194</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Join.on-1195"><a href="#Join.on-1195"><span class="linenos">1195</span></a> <span class="p">)</span> +</span><span id="Join.on-1196"><a href="#Join.on-1196"><span class="linenos">1196</span></a> +</span><span id="Join.on-1197"><a href="#Join.on-1197"><span class="linenos">1197</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="Join.on-1198"><a href="#Join.on-1198"><span class="linenos">1198</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Join.on-1199"><a href="#Join.on-1199"><span class="linenos">1199</span></a> +</span><span id="Join.on-1200"><a href="#Join.on-1200"><span class="linenos">1200</span></a> <span class="k">return</span> <span class="n">join</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the ON expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"JOIN x"</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Join</span><span class="p">)</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="s2">"y = 1"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'JOIN x ON y = 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is. +Multiple expressions are combined with an AND operator.</li> +<li><strong>append (bool):</strong> if <code>True</code>, AND the new expressions to any existing expression. +Otherwise, this resets the expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Join: the modified join expression.</p> +</blockquote> +</div> + + + </div> + <div id="Join.using" class="classattr"> + <input id="Join.using-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">using</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">append</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">copy</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Join.using-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Join.using"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Join.using-1202"><a href="#Join.using-1202"><span class="linenos">1202</span></a> <span class="k">def</span> <span class="nf">using</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="Join.using-1203"><a href="#Join.using-1203"><span class="linenos">1203</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Join.using-1204"><a href="#Join.using-1204"><span class="linenos">1204</span></a><span class="sd"> Append to or set the USING expressions.</span> +</span><span id="Join.using-1205"><a href="#Join.using-1205"><span class="linenos">1205</span></a> +</span><span id="Join.using-1206"><a href="#Join.using-1206"><span class="linenos">1206</span></a><span class="sd"> Example:</span> +</span><span id="Join.using-1207"><a href="#Join.using-1207"><span class="linenos">1207</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="Join.using-1208"><a href="#Join.using-1208"><span class="linenos">1208</span></a><span class="sd"> >>> sqlglot.parse_one("JOIN x", into=Join).using("foo", "bla").sql()</span> +</span><span id="Join.using-1209"><a href="#Join.using-1209"><span class="linenos">1209</span></a><span class="sd"> 'JOIN x USING (foo, bla)'</span> +</span><span id="Join.using-1210"><a href="#Join.using-1210"><span class="linenos">1210</span></a> +</span><span id="Join.using-1211"><a href="#Join.using-1211"><span class="linenos">1211</span></a><span class="sd"> Args:</span> +</span><span id="Join.using-1212"><a href="#Join.using-1212"><span class="linenos">1212</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Join.using-1213"><a href="#Join.using-1213"><span class="linenos">1213</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Join.using-1214"><a href="#Join.using-1214"><span class="linenos">1214</span></a><span class="sd"> append (bool): if `True`, concatenate the new expressions to the existing "using" list.</span> +</span><span id="Join.using-1215"><a href="#Join.using-1215"><span class="linenos">1215</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Join.using-1216"><a href="#Join.using-1216"><span class="linenos">1216</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Join.using-1217"><a href="#Join.using-1217"><span class="linenos">1217</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Join.using-1218"><a href="#Join.using-1218"><span class="linenos">1218</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Join.using-1219"><a href="#Join.using-1219"><span class="linenos">1219</span></a> +</span><span id="Join.using-1220"><a href="#Join.using-1220"><span class="linenos">1220</span></a><span class="sd"> Returns:</span> +</span><span id="Join.using-1221"><a href="#Join.using-1221"><span class="linenos">1221</span></a><span class="sd"> Join: the modified join expression.</span> +</span><span id="Join.using-1222"><a href="#Join.using-1222"><span class="linenos">1222</span></a><span class="sd"> """</span> +</span><span id="Join.using-1223"><a href="#Join.using-1223"><span class="linenos">1223</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Join.using-1224"><a href="#Join.using-1224"><span class="linenos">1224</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Join.using-1225"><a href="#Join.using-1225"><span class="linenos">1225</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Join.using-1226"><a href="#Join.using-1226"><span class="linenos">1226</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"using"</span><span class="p">,</span> +</span><span id="Join.using-1227"><a href="#Join.using-1227"><span class="linenos">1227</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Join.using-1228"><a href="#Join.using-1228"><span class="linenos">1228</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Join.using-1229"><a href="#Join.using-1229"><span class="linenos">1229</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Join.using-1230"><a href="#Join.using-1230"><span class="linenos">1230</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Join.using-1231"><a href="#Join.using-1231"><span class="linenos">1231</span></a> <span class="p">)</span> +</span><span id="Join.using-1232"><a href="#Join.using-1232"><span class="linenos">1232</span></a> +</span><span id="Join.using-1233"><a href="#Join.using-1233"><span class="linenos">1233</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">==</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="Join.using-1234"><a href="#Join.using-1234"><span class="linenos">1234</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Join.using-1235"><a href="#Join.using-1235"><span class="linenos">1235</span></a> +</span><span id="Join.using-1236"><a href="#Join.using-1236"><span class="linenos">1236</span></a> <span class="k">return</span> <span class="n">join</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the USING expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"JOIN x"</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Join</span><span class="p">)</span><span class="o">.</span><span class="n">using</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">,</span> <span class="s2">"bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'JOIN x USING (foo, bla)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>append (bool):</strong> if <code>True</code>, concatenate the new expressions to the existing "using" list. +Otherwise, this resets the expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Join: the modified join expression.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Join.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Join.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Join.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Join.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Join.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Join.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Join.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Join.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Join.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Join.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Join.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Join.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Join.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Join.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Join.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Join.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Join.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Join.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Join.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Join.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Join.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Join.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Join.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Join.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Join.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Join.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Join.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Join.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Join.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Join.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Join.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Join.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Join.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Lateral"> + <input id="Lateral-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Lateral</span><wbr>(<span class="base"><a href="#UDTF">UDTF</a></span>): + + <label class="view-source-button" for="Lateral-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Lateral"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Lateral-1239"><a href="#Lateral-1239"><span class="linenos">1239</span></a><span class="k">class</span> <span class="nc">Lateral</span><span class="p">(</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="Lateral-1240"><a href="#Lateral-1240"><span class="linenos">1240</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"view"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"outer"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Lateral.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Lateral.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Lateral.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Lateral.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Lateral.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Lateral.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Lateral.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Lateral.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Lateral.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Lateral.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Lateral.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Lateral.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Lateral.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Lateral.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Lateral.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Lateral.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Lateral.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Lateral.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Lateral.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Lateral.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Lateral.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Lateral.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Lateral.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Lateral.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Lateral.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Lateral.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Lateral.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Lateral.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Lateral.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Lateral.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Lateral.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Lateral.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Lateral.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Lateral.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Lateral.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Lateral.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="MatchRecognize"> + <input id="MatchRecognize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MatchRecognize</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="MatchRecognize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MatchRecognize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MatchRecognize-1243"><a href="#MatchRecognize-1243"><span class="linenos">1243</span></a><span class="k">class</span> <span class="nc">MatchRecognize</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="MatchRecognize-1244"><a href="#MatchRecognize-1244"><span class="linenos">1244</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="MatchRecognize-1245"><a href="#MatchRecognize-1245"><span class="linenos">1245</span></a> <span class="s2">"partition_by"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1246"><a href="#MatchRecognize-1246"><span class="linenos">1246</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1247"><a href="#MatchRecognize-1247"><span class="linenos">1247</span></a> <span class="s2">"measures"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1248"><a href="#MatchRecognize-1248"><span class="linenos">1248</span></a> <span class="s2">"rows"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1249"><a href="#MatchRecognize-1249"><span class="linenos">1249</span></a> <span class="s2">"after"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1250"><a href="#MatchRecognize-1250"><span class="linenos">1250</span></a> <span class="s2">"pattern"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1251"><a href="#MatchRecognize-1251"><span class="linenos">1251</span></a> <span class="s2">"define"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="MatchRecognize-1252"><a href="#MatchRecognize-1252"><span class="linenos">1252</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="MatchRecognize.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="MatchRecognize.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="MatchRecognize.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="MatchRecognize.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="MatchRecognize.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="MatchRecognize.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="MatchRecognize.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="MatchRecognize.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="MatchRecognize.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="MatchRecognize.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="MatchRecognize.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="MatchRecognize.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="MatchRecognize.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="MatchRecognize.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="MatchRecognize.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="MatchRecognize.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="MatchRecognize.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="MatchRecognize.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="MatchRecognize.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="MatchRecognize.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="MatchRecognize.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="MatchRecognize.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="MatchRecognize.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="MatchRecognize.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="MatchRecognize.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="MatchRecognize.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="MatchRecognize.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="MatchRecognize.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="MatchRecognize.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="MatchRecognize.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="MatchRecognize.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="MatchRecognize.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="MatchRecognize.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Final"> + <input id="Final-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Final</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Final-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Final"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Final-1257"><a href="#Final-1257"><span class="linenos">1257</span></a><span class="k">class</span> <span class="nc">Final</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Final-1258"><a href="#Final-1258"><span class="linenos">1258</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Final.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Final.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Final.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Final.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Final.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Final.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Final.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Final.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Final.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Final.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Final.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Final.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Final.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Final.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Final.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Final.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Final.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Final.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Final.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Final.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Final.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Final.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Final.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Final.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Final.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Final.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Final.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Final.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Final.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Final.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Final.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Final.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Final.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Offset"> + <input id="Offset-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Offset</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Offset-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Offset"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Offset-1261"><a href="#Offset-1261"><span class="linenos">1261</span></a><span class="k">class</span> <span class="nc">Offset</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Offset-1262"><a href="#Offset-1262"><span class="linenos">1262</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Offset.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Offset.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Offset.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Offset.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Offset.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Offset.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Offset.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Offset.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Offset.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Offset.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Offset.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Offset.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Offset.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Offset.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Offset.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Offset.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Offset.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Offset.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Offset.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Offset.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Offset.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Offset.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Offset.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Offset.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Offset.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Offset.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Offset.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Offset.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Offset.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Offset.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Offset.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Offset.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Offset.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Order"> + <input id="Order-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Order</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Order-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Order"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Order-1265"><a href="#Order-1265"><span class="linenos">1265</span></a><span class="k">class</span> <span class="nc">Order</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Order-1266"><a href="#Order-1266"><span class="linenos">1266</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Order.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Order.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Order.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Order.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Order.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Order.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Order.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Order.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Order.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Order.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Order.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Order.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Order.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Order.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Order.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Order.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Order.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Order.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Order.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Order.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Order.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Order.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Order.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Order.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Order.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Order.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Order.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Order.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Order.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Order.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Order.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Order.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Order.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Cluster"> + <input id="Cluster-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Cluster</span><wbr>(<span class="base"><a href="#Order">Order</a></span>): + + <label class="view-source-button" for="Cluster-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Cluster"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Cluster-1271"><a href="#Cluster-1271"><span class="linenos">1271</span></a><span class="k">class</span> <span class="nc">Cluster</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span> +</span><span id="Cluster-1272"><a href="#Cluster-1272"><span class="linenos">1272</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Cluster.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Cluster.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Cluster.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Cluster.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Cluster.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Cluster.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Cluster.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Cluster.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Cluster.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Cluster.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Cluster.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Cluster.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Cluster.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Cluster.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Cluster.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Cluster.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Cluster.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Cluster.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Cluster.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Cluster.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Cluster.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Cluster.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Cluster.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Cluster.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Cluster.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Cluster.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Cluster.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Cluster.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Cluster.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Cluster.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Cluster.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Cluster.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Cluster.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Distribute"> + <input id="Distribute-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Distribute</span><wbr>(<span class="base"><a href="#Order">Order</a></span>): + + <label class="view-source-button" for="Distribute-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Distribute"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Distribute-1275"><a href="#Distribute-1275"><span class="linenos">1275</span></a><span class="k">class</span> <span class="nc">Distribute</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span> +</span><span id="Distribute-1276"><a href="#Distribute-1276"><span class="linenos">1276</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Distribute.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Distribute.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Distribute.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Distribute.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Distribute.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Distribute.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Distribute.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Distribute.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Distribute.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Distribute.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Distribute.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Distribute.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Distribute.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Distribute.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Distribute.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Distribute.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Distribute.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Distribute.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Distribute.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Distribute.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Distribute.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Distribute.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Distribute.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Distribute.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Distribute.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Distribute.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Distribute.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Distribute.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Distribute.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Distribute.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Distribute.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Distribute.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Distribute.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Sort"> + <input id="Sort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Sort</span><wbr>(<span class="base"><a href="#Order">Order</a></span>): + + <label class="view-source-button" for="Sort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Sort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Sort-1279"><a href="#Sort-1279"><span class="linenos">1279</span></a><span class="k">class</span> <span class="nc">Sort</span><span class="p">(</span><span class="n">Order</span><span class="p">):</span> +</span><span id="Sort-1280"><a href="#Sort-1280"><span class="linenos">1280</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Sort.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Sort.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Sort.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Sort.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Sort.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Sort.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Sort.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Sort.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Sort.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Sort.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Sort.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Sort.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Sort.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Sort.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Sort.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Sort.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Sort.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Sort.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Sort.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Sort.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Sort.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Sort.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Sort.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Sort.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Sort.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Sort.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Sort.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Sort.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Sort.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Sort.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Sort.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Sort.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Sort.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Ordered"> + <input id="Ordered-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Ordered</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Ordered-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Ordered"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Ordered-1283"><a href="#Ordered-1283"><span class="linenos">1283</span></a><span class="k">class</span> <span class="nc">Ordered</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Ordered-1284"><a href="#Ordered-1284"><span class="linenos">1284</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"desc"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"nulls_first"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Ordered.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Ordered.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Ordered.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Ordered.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Ordered.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Ordered.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Ordered.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Ordered.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Ordered.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Ordered.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Ordered.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Ordered.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Ordered.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Ordered.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Ordered.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Ordered.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Ordered.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Ordered.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Ordered.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Ordered.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Ordered.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Ordered.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Ordered.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Ordered.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Ordered.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Ordered.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Ordered.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Ordered.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Ordered.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Ordered.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Ordered.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Ordered.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Ordered.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Property"> + <input id="Property-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Property</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Property-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Property"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Property-1287"><a href="#Property-1287"><span class="linenos">1287</span></a><span class="k">class</span> <span class="nc">Property</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Property-1288"><a href="#Property-1288"><span class="linenos">1288</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"value"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Property.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Property.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Property.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Property.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Property.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Property.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Property.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Property.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Property.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Property.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Property.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Property.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Property.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Property.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Property.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Property.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Property.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Property.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Property.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Property.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Property.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Property.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Property.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Property.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Property.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Property.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Property.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Property.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Property.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Property.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Property.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Property.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Property.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AlgorithmProperty"> + <input id="AlgorithmProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AlgorithmProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="AlgorithmProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AlgorithmProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AlgorithmProperty-1291"><a href="#AlgorithmProperty-1291"><span class="linenos">1291</span></a><span class="k">class</span> <span class="nc">AlgorithmProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="AlgorithmProperty-1292"><a href="#AlgorithmProperty-1292"><span class="linenos">1292</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AlgorithmProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AlgorithmProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AlgorithmProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AlgorithmProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AlgorithmProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AlgorithmProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AlgorithmProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AlgorithmProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AlgorithmProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AlgorithmProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AlgorithmProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AlgorithmProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AlgorithmProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AlgorithmProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AlgorithmProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AlgorithmProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AlgorithmProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AlgorithmProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AlgorithmProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AlgorithmProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AlgorithmProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AlgorithmProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AlgorithmProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AlgorithmProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AlgorithmProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AlgorithmProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AlgorithmProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AlgorithmProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AlgorithmProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AlgorithmProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AlgorithmProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AlgorithmProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AlgorithmProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DefinerProperty"> + <input id="DefinerProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DefinerProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="DefinerProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DefinerProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DefinerProperty-1295"><a href="#DefinerProperty-1295"><span class="linenos">1295</span></a><span class="k">class</span> <span class="nc">DefinerProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="DefinerProperty-1296"><a href="#DefinerProperty-1296"><span class="linenos">1296</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DefinerProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DefinerProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DefinerProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DefinerProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DefinerProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DefinerProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DefinerProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DefinerProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DefinerProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DefinerProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DefinerProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DefinerProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DefinerProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DefinerProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DefinerProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DefinerProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DefinerProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DefinerProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DefinerProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DefinerProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DefinerProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DefinerProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DefinerProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DefinerProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DefinerProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DefinerProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DefinerProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DefinerProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DefinerProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DefinerProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DefinerProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DefinerProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DefinerProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SqlSecurityProperty"> + <input id="SqlSecurityProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SqlSecurityProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="SqlSecurityProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SqlSecurityProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SqlSecurityProperty-1299"><a href="#SqlSecurityProperty-1299"><span class="linenos">1299</span></a><span class="k">class</span> <span class="nc">SqlSecurityProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="SqlSecurityProperty-1300"><a href="#SqlSecurityProperty-1300"><span class="linenos">1300</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"definer"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SqlSecurityProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SqlSecurityProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SqlSecurityProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SqlSecurityProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SqlSecurityProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SqlSecurityProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SqlSecurityProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SqlSecurityProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SqlSecurityProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SqlSecurityProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SqlSecurityProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SqlSecurityProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SqlSecurityProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SqlSecurityProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SqlSecurityProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SqlSecurityProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SqlSecurityProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SqlSecurityProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SqlSecurityProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SqlSecurityProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SqlSecurityProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SqlSecurityProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SqlSecurityProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SqlSecurityProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SqlSecurityProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SqlSecurityProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SqlSecurityProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SqlSecurityProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SqlSecurityProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SqlSecurityProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SqlSecurityProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SqlSecurityProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SqlSecurityProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TableFormatProperty"> + <input id="TableFormatProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TableFormatProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="TableFormatProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TableFormatProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TableFormatProperty-1303"><a href="#TableFormatProperty-1303"><span class="linenos">1303</span></a><span class="k">class</span> <span class="nc">TableFormatProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="TableFormatProperty-1304"><a href="#TableFormatProperty-1304"><span class="linenos">1304</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TableFormatProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TableFormatProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TableFormatProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TableFormatProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TableFormatProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TableFormatProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TableFormatProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TableFormatProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TableFormatProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TableFormatProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TableFormatProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TableFormatProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TableFormatProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TableFormatProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TableFormatProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TableFormatProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TableFormatProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TableFormatProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TableFormatProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TableFormatProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TableFormatProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TableFormatProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TableFormatProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TableFormatProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TableFormatProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TableFormatProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TableFormatProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TableFormatProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TableFormatProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TableFormatProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TableFormatProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TableFormatProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TableFormatProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="PartitionedByProperty"> + <input id="PartitionedByProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PartitionedByProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="PartitionedByProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PartitionedByProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PartitionedByProperty-1307"><a href="#PartitionedByProperty-1307"><span class="linenos">1307</span></a><span class="k">class</span> <span class="nc">PartitionedByProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="PartitionedByProperty-1308"><a href="#PartitionedByProperty-1308"><span class="linenos">1308</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="PartitionedByProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="PartitionedByProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="PartitionedByProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="PartitionedByProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="PartitionedByProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="PartitionedByProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="PartitionedByProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="PartitionedByProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="PartitionedByProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="PartitionedByProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="PartitionedByProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="PartitionedByProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="PartitionedByProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="PartitionedByProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="PartitionedByProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="PartitionedByProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="PartitionedByProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="PartitionedByProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="PartitionedByProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="PartitionedByProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="PartitionedByProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="PartitionedByProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="PartitionedByProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="PartitionedByProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="PartitionedByProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="PartitionedByProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="PartitionedByProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="PartitionedByProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="PartitionedByProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="PartitionedByProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="PartitionedByProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="PartitionedByProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="PartitionedByProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="FileFormatProperty"> + <input id="FileFormatProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">FileFormatProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="FileFormatProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#FileFormatProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="FileFormatProperty-1311"><a href="#FileFormatProperty-1311"><span class="linenos">1311</span></a><span class="k">class</span> <span class="nc">FileFormatProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="FileFormatProperty-1312"><a href="#FileFormatProperty-1312"><span class="linenos">1312</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="FileFormatProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="FileFormatProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="FileFormatProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="FileFormatProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="FileFormatProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="FileFormatProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="FileFormatProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="FileFormatProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="FileFormatProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="FileFormatProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="FileFormatProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="FileFormatProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="FileFormatProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="FileFormatProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="FileFormatProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="FileFormatProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="FileFormatProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="FileFormatProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="FileFormatProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="FileFormatProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="FileFormatProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="FileFormatProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="FileFormatProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="FileFormatProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="FileFormatProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="FileFormatProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="FileFormatProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="FileFormatProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="FileFormatProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="FileFormatProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="FileFormatProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="FileFormatProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="FileFormatProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DistKeyProperty"> + <input id="DistKeyProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DistKeyProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="DistKeyProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DistKeyProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DistKeyProperty-1315"><a href="#DistKeyProperty-1315"><span class="linenos">1315</span></a><span class="k">class</span> <span class="nc">DistKeyProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="DistKeyProperty-1316"><a href="#DistKeyProperty-1316"><span class="linenos">1316</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DistKeyProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DistKeyProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DistKeyProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DistKeyProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DistKeyProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DistKeyProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DistKeyProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DistKeyProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DistKeyProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DistKeyProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DistKeyProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DistKeyProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DistKeyProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DistKeyProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DistKeyProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DistKeyProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DistKeyProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DistKeyProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DistKeyProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DistKeyProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DistKeyProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DistKeyProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DistKeyProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DistKeyProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DistKeyProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DistKeyProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DistKeyProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DistKeyProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DistKeyProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DistKeyProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DistKeyProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DistKeyProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DistKeyProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SortKeyProperty"> + <input id="SortKeyProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SortKeyProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="SortKeyProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SortKeyProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SortKeyProperty-1319"><a href="#SortKeyProperty-1319"><span class="linenos">1319</span></a><span class="k">class</span> <span class="nc">SortKeyProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="SortKeyProperty-1320"><a href="#SortKeyProperty-1320"><span class="linenos">1320</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"compound"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SortKeyProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SortKeyProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SortKeyProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SortKeyProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SortKeyProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SortKeyProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SortKeyProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SortKeyProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SortKeyProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SortKeyProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SortKeyProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SortKeyProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SortKeyProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SortKeyProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SortKeyProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SortKeyProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SortKeyProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SortKeyProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SortKeyProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SortKeyProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SortKeyProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SortKeyProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SortKeyProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SortKeyProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SortKeyProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SortKeyProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SortKeyProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SortKeyProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SortKeyProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SortKeyProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SortKeyProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SortKeyProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SortKeyProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DistStyleProperty"> + <input id="DistStyleProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DistStyleProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="DistStyleProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DistStyleProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DistStyleProperty-1323"><a href="#DistStyleProperty-1323"><span class="linenos">1323</span></a><span class="k">class</span> <span class="nc">DistStyleProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="DistStyleProperty-1324"><a href="#DistStyleProperty-1324"><span class="linenos">1324</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DistStyleProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DistStyleProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DistStyleProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DistStyleProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DistStyleProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DistStyleProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DistStyleProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DistStyleProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DistStyleProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DistStyleProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DistStyleProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DistStyleProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DistStyleProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DistStyleProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DistStyleProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DistStyleProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DistStyleProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DistStyleProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DistStyleProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DistStyleProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DistStyleProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DistStyleProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DistStyleProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DistStyleProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DistStyleProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DistStyleProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DistStyleProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DistStyleProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DistStyleProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DistStyleProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DistStyleProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DistStyleProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DistStyleProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LikeProperty"> + <input id="LikeProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LikeProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="LikeProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LikeProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LikeProperty-1327"><a href="#LikeProperty-1327"><span class="linenos">1327</span></a><span class="k">class</span> <span class="nc">LikeProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="LikeProperty-1328"><a href="#LikeProperty-1328"><span class="linenos">1328</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LikeProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LikeProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LikeProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LikeProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LikeProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LikeProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LikeProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LikeProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LikeProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LikeProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LikeProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LikeProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LikeProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LikeProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LikeProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LikeProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LikeProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LikeProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LikeProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LikeProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LikeProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LikeProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LikeProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LikeProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LikeProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LikeProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LikeProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LikeProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LikeProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LikeProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LikeProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LikeProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LikeProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LocationProperty"> + <input id="LocationProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LocationProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="LocationProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LocationProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LocationProperty-1331"><a href="#LocationProperty-1331"><span class="linenos">1331</span></a><span class="k">class</span> <span class="nc">LocationProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="LocationProperty-1332"><a href="#LocationProperty-1332"><span class="linenos">1332</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LocationProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LocationProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LocationProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LocationProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LocationProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LocationProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LocationProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LocationProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LocationProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LocationProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LocationProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LocationProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LocationProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LocationProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LocationProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LocationProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LocationProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LocationProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LocationProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LocationProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LocationProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LocationProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LocationProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LocationProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LocationProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LocationProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LocationProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LocationProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LocationProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LocationProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LocationProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LocationProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LocationProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="EngineProperty"> + <input id="EngineProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">EngineProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="EngineProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#EngineProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="EngineProperty-1335"><a href="#EngineProperty-1335"><span class="linenos">1335</span></a><span class="k">class</span> <span class="nc">EngineProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="EngineProperty-1336"><a href="#EngineProperty-1336"><span class="linenos">1336</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="EngineProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="EngineProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="EngineProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="EngineProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="EngineProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="EngineProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="EngineProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="EngineProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="EngineProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="EngineProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="EngineProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="EngineProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="EngineProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="EngineProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="EngineProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="EngineProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="EngineProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="EngineProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="EngineProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="EngineProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="EngineProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="EngineProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="EngineProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="EngineProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="EngineProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="EngineProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="EngineProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="EngineProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="EngineProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="EngineProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="EngineProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="EngineProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="EngineProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AutoIncrementProperty"> + <input id="AutoIncrementProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AutoIncrementProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="AutoIncrementProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AutoIncrementProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AutoIncrementProperty-1339"><a href="#AutoIncrementProperty-1339"><span class="linenos">1339</span></a><span class="k">class</span> <span class="nc">AutoIncrementProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="AutoIncrementProperty-1340"><a href="#AutoIncrementProperty-1340"><span class="linenos">1340</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AutoIncrementProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AutoIncrementProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AutoIncrementProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AutoIncrementProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AutoIncrementProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AutoIncrementProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AutoIncrementProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AutoIncrementProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AutoIncrementProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AutoIncrementProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AutoIncrementProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AutoIncrementProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AutoIncrementProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AutoIncrementProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AutoIncrementProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AutoIncrementProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AutoIncrementProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AutoIncrementProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AutoIncrementProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AutoIncrementProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AutoIncrementProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AutoIncrementProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AutoIncrementProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AutoIncrementProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AutoIncrementProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AutoIncrementProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AutoIncrementProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AutoIncrementProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AutoIncrementProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AutoIncrementProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AutoIncrementProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AutoIncrementProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AutoIncrementProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CharacterSetProperty"> + <input id="CharacterSetProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CharacterSetProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="CharacterSetProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CharacterSetProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CharacterSetProperty-1343"><a href="#CharacterSetProperty-1343"><span class="linenos">1343</span></a><span class="k">class</span> <span class="nc">CharacterSetProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="CharacterSetProperty-1344"><a href="#CharacterSetProperty-1344"><span class="linenos">1344</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CharacterSetProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CharacterSetProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CharacterSetProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CharacterSetProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CharacterSetProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CharacterSetProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CharacterSetProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CharacterSetProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CharacterSetProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CharacterSetProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CharacterSetProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CharacterSetProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CharacterSetProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CharacterSetProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CharacterSetProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CharacterSetProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CharacterSetProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CharacterSetProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CharacterSetProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CharacterSetProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CharacterSetProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CharacterSetProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CharacterSetProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CharacterSetProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CharacterSetProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CharacterSetProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CharacterSetProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CharacterSetProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CharacterSetProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CharacterSetProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CharacterSetProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CharacterSetProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CharacterSetProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CollateProperty"> + <input id="CollateProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CollateProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="CollateProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CollateProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CollateProperty-1347"><a href="#CollateProperty-1347"><span class="linenos">1347</span></a><span class="k">class</span> <span class="nc">CollateProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="CollateProperty-1348"><a href="#CollateProperty-1348"><span class="linenos">1348</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CollateProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CollateProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CollateProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CollateProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CollateProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CollateProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CollateProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CollateProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CollateProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CollateProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CollateProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CollateProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CollateProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CollateProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CollateProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CollateProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CollateProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CollateProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CollateProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CollateProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CollateProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CollateProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CollateProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CollateProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CollateProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CollateProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CollateProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CollateProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CollateProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CollateProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CollateProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CollateProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CollateProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SchemaCommentProperty"> + <input id="SchemaCommentProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SchemaCommentProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="SchemaCommentProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SchemaCommentProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SchemaCommentProperty-1351"><a href="#SchemaCommentProperty-1351"><span class="linenos">1351</span></a><span class="k">class</span> <span class="nc">SchemaCommentProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="SchemaCommentProperty-1352"><a href="#SchemaCommentProperty-1352"><span class="linenos">1352</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SchemaCommentProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SchemaCommentProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SchemaCommentProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SchemaCommentProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SchemaCommentProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SchemaCommentProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SchemaCommentProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SchemaCommentProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SchemaCommentProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SchemaCommentProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SchemaCommentProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SchemaCommentProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SchemaCommentProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SchemaCommentProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SchemaCommentProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SchemaCommentProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SchemaCommentProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SchemaCommentProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SchemaCommentProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SchemaCommentProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SchemaCommentProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SchemaCommentProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SchemaCommentProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SchemaCommentProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SchemaCommentProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SchemaCommentProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SchemaCommentProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SchemaCommentProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SchemaCommentProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SchemaCommentProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SchemaCommentProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SchemaCommentProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SchemaCommentProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ReturnsProperty"> + <input id="ReturnsProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ReturnsProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="ReturnsProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ReturnsProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ReturnsProperty-1355"><a href="#ReturnsProperty-1355"><span class="linenos">1355</span></a><span class="k">class</span> <span class="nc">ReturnsProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="ReturnsProperty-1356"><a href="#ReturnsProperty-1356"><span class="linenos">1356</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"is_table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ReturnsProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ReturnsProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ReturnsProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ReturnsProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ReturnsProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ReturnsProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ReturnsProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ReturnsProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ReturnsProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ReturnsProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ReturnsProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ReturnsProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ReturnsProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ReturnsProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ReturnsProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ReturnsProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ReturnsProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ReturnsProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ReturnsProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ReturnsProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ReturnsProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ReturnsProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ReturnsProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ReturnsProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ReturnsProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ReturnsProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ReturnsProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ReturnsProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ReturnsProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ReturnsProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ReturnsProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ReturnsProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ReturnsProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LanguageProperty"> + <input id="LanguageProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LanguageProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="LanguageProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LanguageProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LanguageProperty-1359"><a href="#LanguageProperty-1359"><span class="linenos">1359</span></a><span class="k">class</span> <span class="nc">LanguageProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="LanguageProperty-1360"><a href="#LanguageProperty-1360"><span class="linenos">1360</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LanguageProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LanguageProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LanguageProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LanguageProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LanguageProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LanguageProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LanguageProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LanguageProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LanguageProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LanguageProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LanguageProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LanguageProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LanguageProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LanguageProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LanguageProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LanguageProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LanguageProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LanguageProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LanguageProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LanguageProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LanguageProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LanguageProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LanguageProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LanguageProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LanguageProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LanguageProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LanguageProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LanguageProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LanguageProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LanguageProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LanguageProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LanguageProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LanguageProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ExecuteAsProperty"> + <input id="ExecuteAsProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ExecuteAsProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="ExecuteAsProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ExecuteAsProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ExecuteAsProperty-1363"><a href="#ExecuteAsProperty-1363"><span class="linenos">1363</span></a><span class="k">class</span> <span class="nc">ExecuteAsProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="ExecuteAsProperty-1364"><a href="#ExecuteAsProperty-1364"><span class="linenos">1364</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ExecuteAsProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ExecuteAsProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ExecuteAsProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ExecuteAsProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ExecuteAsProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ExecuteAsProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ExecuteAsProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ExecuteAsProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ExecuteAsProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ExecuteAsProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ExecuteAsProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ExecuteAsProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ExecuteAsProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ExecuteAsProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ExecuteAsProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ExecuteAsProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ExecuteAsProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ExecuteAsProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ExecuteAsProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ExecuteAsProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ExecuteAsProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ExecuteAsProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ExecuteAsProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ExecuteAsProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ExecuteAsProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ExecuteAsProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ExecuteAsProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ExecuteAsProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ExecuteAsProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ExecuteAsProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ExecuteAsProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ExecuteAsProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ExecuteAsProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="VolatilityProperty"> + <input id="VolatilityProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">VolatilityProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="VolatilityProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#VolatilityProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="VolatilityProperty-1367"><a href="#VolatilityProperty-1367"><span class="linenos">1367</span></a><span class="k">class</span> <span class="nc">VolatilityProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="VolatilityProperty-1368"><a href="#VolatilityProperty-1368"><span class="linenos">1368</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="VolatilityProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="VolatilityProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="VolatilityProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="VolatilityProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="VolatilityProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="VolatilityProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="VolatilityProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="VolatilityProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="VolatilityProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="VolatilityProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="VolatilityProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="VolatilityProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="VolatilityProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="VolatilityProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="VolatilityProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="VolatilityProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="VolatilityProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="VolatilityProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="VolatilityProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="VolatilityProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="VolatilityProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="VolatilityProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="VolatilityProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="VolatilityProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="VolatilityProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="VolatilityProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="VolatilityProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="VolatilityProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="VolatilityProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="VolatilityProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="VolatilityProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="VolatilityProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="VolatilityProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RowFormatDelimitedProperty"> + <input id="RowFormatDelimitedProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RowFormatDelimitedProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="RowFormatDelimitedProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RowFormatDelimitedProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RowFormatDelimitedProperty-1371"><a href="#RowFormatDelimitedProperty-1371"><span class="linenos">1371</span></a><span class="k">class</span> <span class="nc">RowFormatDelimitedProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="RowFormatDelimitedProperty-1372"><a href="#RowFormatDelimitedProperty-1372"><span class="linenos">1372</span></a> <span class="c1"># https://cwiki.apache.org/confluence/display/hive/languagemanual+dml</span> +</span><span id="RowFormatDelimitedProperty-1373"><a href="#RowFormatDelimitedProperty-1373"><span class="linenos">1373</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="RowFormatDelimitedProperty-1374"><a href="#RowFormatDelimitedProperty-1374"><span class="linenos">1374</span></a> <span class="s2">"fields"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1375"><a href="#RowFormatDelimitedProperty-1375"><span class="linenos">1375</span></a> <span class="s2">"escaped"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1376"><a href="#RowFormatDelimitedProperty-1376"><span class="linenos">1376</span></a> <span class="s2">"collection_items"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1377"><a href="#RowFormatDelimitedProperty-1377"><span class="linenos">1377</span></a> <span class="s2">"map_keys"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1378"><a href="#RowFormatDelimitedProperty-1378"><span class="linenos">1378</span></a> <span class="s2">"lines"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1379"><a href="#RowFormatDelimitedProperty-1379"><span class="linenos">1379</span></a> <span class="s2">"null"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1380"><a href="#RowFormatDelimitedProperty-1380"><span class="linenos">1380</span></a> <span class="s2">"serde"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="RowFormatDelimitedProperty-1381"><a href="#RowFormatDelimitedProperty-1381"><span class="linenos">1381</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RowFormatDelimitedProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RowFormatDelimitedProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RowFormatDelimitedProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RowFormatDelimitedProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RowFormatDelimitedProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RowFormatDelimitedProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RowFormatDelimitedProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RowFormatDelimitedProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RowFormatDelimitedProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RowFormatDelimitedProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RowFormatDelimitedProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RowFormatDelimitedProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RowFormatDelimitedProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RowFormatDelimitedProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RowFormatDelimitedProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RowFormatDelimitedProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RowFormatDelimitedProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RowFormatDelimitedProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RowFormatDelimitedProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RowFormatDelimitedProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RowFormatDelimitedProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RowFormatDelimitedProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RowFormatDelimitedProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RowFormatDelimitedProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RowFormatDelimitedProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RowFormatDelimitedProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RowFormatDelimitedProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RowFormatDelimitedProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RowFormatDelimitedProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RowFormatDelimitedProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RowFormatDelimitedProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RowFormatDelimitedProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RowFormatDelimitedProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RowFormatSerdeProperty"> + <input id="RowFormatSerdeProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RowFormatSerdeProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="RowFormatSerdeProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RowFormatSerdeProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RowFormatSerdeProperty-1384"><a href="#RowFormatSerdeProperty-1384"><span class="linenos">1384</span></a><span class="k">class</span> <span class="nc">RowFormatSerdeProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="RowFormatSerdeProperty-1385"><a href="#RowFormatSerdeProperty-1385"><span class="linenos">1385</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RowFormatSerdeProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RowFormatSerdeProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RowFormatSerdeProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RowFormatSerdeProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RowFormatSerdeProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RowFormatSerdeProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RowFormatSerdeProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RowFormatSerdeProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RowFormatSerdeProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RowFormatSerdeProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RowFormatSerdeProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RowFormatSerdeProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RowFormatSerdeProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RowFormatSerdeProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RowFormatSerdeProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RowFormatSerdeProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RowFormatSerdeProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RowFormatSerdeProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RowFormatSerdeProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RowFormatSerdeProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RowFormatSerdeProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RowFormatSerdeProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RowFormatSerdeProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RowFormatSerdeProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RowFormatSerdeProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RowFormatSerdeProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RowFormatSerdeProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RowFormatSerdeProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RowFormatSerdeProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RowFormatSerdeProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RowFormatSerdeProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RowFormatSerdeProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RowFormatSerdeProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SerdeProperties"> + <input id="SerdeProperties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SerdeProperties</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="SerdeProperties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SerdeProperties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SerdeProperties-1388"><a href="#SerdeProperties-1388"><span class="linenos">1388</span></a><span class="k">class</span> <span class="nc">SerdeProperties</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="SerdeProperties-1389"><a href="#SerdeProperties-1389"><span class="linenos">1389</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SerdeProperties.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SerdeProperties.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SerdeProperties.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SerdeProperties.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SerdeProperties.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SerdeProperties.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SerdeProperties.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SerdeProperties.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SerdeProperties.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SerdeProperties.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SerdeProperties.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SerdeProperties.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SerdeProperties.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SerdeProperties.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SerdeProperties.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SerdeProperties.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SerdeProperties.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SerdeProperties.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SerdeProperties.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SerdeProperties.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SerdeProperties.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SerdeProperties.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SerdeProperties.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SerdeProperties.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SerdeProperties.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SerdeProperties.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SerdeProperties.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SerdeProperties.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SerdeProperties.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SerdeProperties.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SerdeProperties.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SerdeProperties.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SerdeProperties.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="FallbackProperty"> + <input id="FallbackProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">FallbackProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="FallbackProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#FallbackProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="FallbackProperty-1392"><a href="#FallbackProperty-1392"><span class="linenos">1392</span></a><span class="k">class</span> <span class="nc">FallbackProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="FallbackProperty-1393"><a href="#FallbackProperty-1393"><span class="linenos">1393</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"protection"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="FallbackProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="FallbackProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="FallbackProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="FallbackProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="FallbackProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="FallbackProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="FallbackProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="FallbackProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="FallbackProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="FallbackProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="FallbackProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="FallbackProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="FallbackProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="FallbackProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="FallbackProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="FallbackProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="FallbackProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="FallbackProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="FallbackProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="FallbackProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="FallbackProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="FallbackProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="FallbackProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="FallbackProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="FallbackProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="FallbackProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="FallbackProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="FallbackProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="FallbackProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="FallbackProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="FallbackProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="FallbackProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="FallbackProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="WithJournalTableProperty"> + <input id="WithJournalTableProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">WithJournalTableProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="WithJournalTableProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WithJournalTableProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WithJournalTableProperty-1396"><a href="#WithJournalTableProperty-1396"><span class="linenos">1396</span></a><span class="k">class</span> <span class="nc">WithJournalTableProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="WithJournalTableProperty-1397"><a href="#WithJournalTableProperty-1397"><span class="linenos">1397</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="WithJournalTableProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="WithJournalTableProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="WithJournalTableProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="WithJournalTableProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="WithJournalTableProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="WithJournalTableProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="WithJournalTableProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="WithJournalTableProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="WithJournalTableProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="WithJournalTableProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="WithJournalTableProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="WithJournalTableProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="WithJournalTableProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="WithJournalTableProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="WithJournalTableProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="WithJournalTableProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="WithJournalTableProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="WithJournalTableProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="WithJournalTableProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="WithJournalTableProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="WithJournalTableProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="WithJournalTableProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="WithJournalTableProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="WithJournalTableProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="WithJournalTableProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="WithJournalTableProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="WithJournalTableProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="WithJournalTableProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="WithJournalTableProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="WithJournalTableProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="WithJournalTableProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="WithJournalTableProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="WithJournalTableProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LogProperty"> + <input id="LogProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LogProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="LogProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LogProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LogProperty-1400"><a href="#LogProperty-1400"><span class="linenos">1400</span></a><span class="k">class</span> <span class="nc">LogProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="LogProperty-1401"><a href="#LogProperty-1401"><span class="linenos">1401</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LogProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LogProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LogProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LogProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LogProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LogProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LogProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LogProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LogProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LogProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LogProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LogProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LogProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LogProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LogProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LogProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LogProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LogProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LogProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LogProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LogProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LogProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LogProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LogProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LogProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LogProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LogProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LogProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LogProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LogProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LogProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LogProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LogProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JournalProperty"> + <input id="JournalProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JournalProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="JournalProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JournalProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JournalProperty-1404"><a href="#JournalProperty-1404"><span class="linenos">1404</span></a><span class="k">class</span> <span class="nc">JournalProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="JournalProperty-1405"><a href="#JournalProperty-1405"><span class="linenos">1405</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"dual"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"before"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JournalProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JournalProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JournalProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JournalProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JournalProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JournalProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JournalProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JournalProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JournalProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JournalProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JournalProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JournalProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JournalProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JournalProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JournalProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JournalProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JournalProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JournalProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JournalProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JournalProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JournalProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JournalProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JournalProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JournalProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JournalProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JournalProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JournalProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JournalProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JournalProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JournalProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JournalProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JournalProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JournalProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AfterJournalProperty"> + <input id="AfterJournalProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AfterJournalProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="AfterJournalProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AfterJournalProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AfterJournalProperty-1408"><a href="#AfterJournalProperty-1408"><span class="linenos">1408</span></a><span class="k">class</span> <span class="nc">AfterJournalProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="AfterJournalProperty-1409"><a href="#AfterJournalProperty-1409"><span class="linenos">1409</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"dual"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"local"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AfterJournalProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AfterJournalProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AfterJournalProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AfterJournalProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AfterJournalProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AfterJournalProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AfterJournalProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AfterJournalProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AfterJournalProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AfterJournalProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AfterJournalProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AfterJournalProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AfterJournalProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AfterJournalProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AfterJournalProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AfterJournalProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AfterJournalProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AfterJournalProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AfterJournalProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AfterJournalProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AfterJournalProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AfterJournalProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AfterJournalProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AfterJournalProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AfterJournalProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AfterJournalProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AfterJournalProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AfterJournalProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AfterJournalProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AfterJournalProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AfterJournalProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AfterJournalProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AfterJournalProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ChecksumProperty"> + <input id="ChecksumProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ChecksumProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="ChecksumProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ChecksumProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ChecksumProperty-1412"><a href="#ChecksumProperty-1412"><span class="linenos">1412</span></a><span class="k">class</span> <span class="nc">ChecksumProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="ChecksumProperty-1413"><a href="#ChecksumProperty-1413"><span class="linenos">1413</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"on"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ChecksumProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ChecksumProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ChecksumProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ChecksumProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ChecksumProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ChecksumProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ChecksumProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ChecksumProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ChecksumProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ChecksumProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ChecksumProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ChecksumProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ChecksumProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ChecksumProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ChecksumProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ChecksumProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ChecksumProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ChecksumProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ChecksumProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ChecksumProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ChecksumProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ChecksumProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ChecksumProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ChecksumProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ChecksumProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ChecksumProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ChecksumProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ChecksumProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ChecksumProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ChecksumProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ChecksumProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ChecksumProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ChecksumProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="FreespaceProperty"> + <input id="FreespaceProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">FreespaceProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="FreespaceProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#FreespaceProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="FreespaceProperty-1416"><a href="#FreespaceProperty-1416"><span class="linenos">1416</span></a><span class="k">class</span> <span class="nc">FreespaceProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="FreespaceProperty-1417"><a href="#FreespaceProperty-1417"><span class="linenos">1417</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="FreespaceProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="FreespaceProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="FreespaceProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="FreespaceProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="FreespaceProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="FreespaceProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="FreespaceProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="FreespaceProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="FreespaceProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="FreespaceProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="FreespaceProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="FreespaceProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="FreespaceProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="FreespaceProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="FreespaceProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="FreespaceProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="FreespaceProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="FreespaceProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="FreespaceProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="FreespaceProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="FreespaceProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="FreespaceProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="FreespaceProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="FreespaceProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="FreespaceProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="FreespaceProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="FreespaceProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="FreespaceProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="FreespaceProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="FreespaceProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="FreespaceProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="FreespaceProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="FreespaceProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="MergeBlockRatioProperty"> + <input id="MergeBlockRatioProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MergeBlockRatioProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="MergeBlockRatioProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MergeBlockRatioProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MergeBlockRatioProperty-1420"><a href="#MergeBlockRatioProperty-1420"><span class="linenos">1420</span></a><span class="k">class</span> <span class="nc">MergeBlockRatioProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="MergeBlockRatioProperty-1421"><a href="#MergeBlockRatioProperty-1421"><span class="linenos">1421</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"no"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="MergeBlockRatioProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="MergeBlockRatioProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="MergeBlockRatioProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="MergeBlockRatioProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="MergeBlockRatioProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="MergeBlockRatioProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="MergeBlockRatioProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="MergeBlockRatioProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="MergeBlockRatioProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="MergeBlockRatioProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="MergeBlockRatioProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="MergeBlockRatioProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="MergeBlockRatioProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="MergeBlockRatioProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="MergeBlockRatioProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="MergeBlockRatioProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="MergeBlockRatioProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="MergeBlockRatioProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="MergeBlockRatioProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="MergeBlockRatioProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="MergeBlockRatioProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="MergeBlockRatioProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="MergeBlockRatioProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="MergeBlockRatioProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="MergeBlockRatioProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="MergeBlockRatioProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="MergeBlockRatioProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="MergeBlockRatioProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="MergeBlockRatioProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="MergeBlockRatioProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="MergeBlockRatioProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="MergeBlockRatioProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="MergeBlockRatioProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DataBlocksizeProperty"> + <input id="DataBlocksizeProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataBlocksizeProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="DataBlocksizeProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataBlocksizeProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataBlocksizeProperty-1424"><a href="#DataBlocksizeProperty-1424"><span class="linenos">1424</span></a><span class="k">class</span> <span class="nc">DataBlocksizeProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="DataBlocksizeProperty-1425"><a href="#DataBlocksizeProperty-1425"><span class="linenos">1425</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"size"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"units"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"min"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DataBlocksizeProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DataBlocksizeProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DataBlocksizeProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DataBlocksizeProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DataBlocksizeProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DataBlocksizeProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DataBlocksizeProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DataBlocksizeProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DataBlocksizeProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DataBlocksizeProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DataBlocksizeProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DataBlocksizeProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DataBlocksizeProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DataBlocksizeProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DataBlocksizeProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DataBlocksizeProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DataBlocksizeProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DataBlocksizeProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DataBlocksizeProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DataBlocksizeProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DataBlocksizeProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DataBlocksizeProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DataBlocksizeProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DataBlocksizeProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DataBlocksizeProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DataBlocksizeProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DataBlocksizeProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DataBlocksizeProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DataBlocksizeProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DataBlocksizeProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DataBlocksizeProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DataBlocksizeProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DataBlocksizeProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BlockCompressionProperty"> + <input id="BlockCompressionProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BlockCompressionProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="BlockCompressionProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BlockCompressionProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BlockCompressionProperty-1428"><a href="#BlockCompressionProperty-1428"><span class="linenos">1428</span></a><span class="k">class</span> <span class="nc">BlockCompressionProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="BlockCompressionProperty-1429"><a href="#BlockCompressionProperty-1429"><span class="linenos">1429</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"autotemp"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"always"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"manual"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"never"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BlockCompressionProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BlockCompressionProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BlockCompressionProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BlockCompressionProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BlockCompressionProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BlockCompressionProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BlockCompressionProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BlockCompressionProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BlockCompressionProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BlockCompressionProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BlockCompressionProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BlockCompressionProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BlockCompressionProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BlockCompressionProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BlockCompressionProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BlockCompressionProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BlockCompressionProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BlockCompressionProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BlockCompressionProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BlockCompressionProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BlockCompressionProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BlockCompressionProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BlockCompressionProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BlockCompressionProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BlockCompressionProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BlockCompressionProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BlockCompressionProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BlockCompressionProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BlockCompressionProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BlockCompressionProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BlockCompressionProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BlockCompressionProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BlockCompressionProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="IsolatedLoadingProperty"> + <input id="IsolatedLoadingProperty-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">IsolatedLoadingProperty</span><wbr>(<span class="base"><a href="#Property">Property</a></span>): + + <label class="view-source-button" for="IsolatedLoadingProperty-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#IsolatedLoadingProperty"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="IsolatedLoadingProperty-1432"><a href="#IsolatedLoadingProperty-1432"><span class="linenos">1432</span></a><span class="k">class</span> <span class="nc">IsolatedLoadingProperty</span><span class="p">(</span><span class="n">Property</span><span class="p">):</span> +</span><span id="IsolatedLoadingProperty-1433"><a href="#IsolatedLoadingProperty-1433"><span class="linenos">1433</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="IsolatedLoadingProperty-1434"><a href="#IsolatedLoadingProperty-1434"><span class="linenos">1434</span></a> <span class="s2">"no"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="IsolatedLoadingProperty-1435"><a href="#IsolatedLoadingProperty-1435"><span class="linenos">1435</span></a> <span class="s2">"concurrent"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="IsolatedLoadingProperty-1436"><a href="#IsolatedLoadingProperty-1436"><span class="linenos">1436</span></a> <span class="s2">"for_all"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="IsolatedLoadingProperty-1437"><a href="#IsolatedLoadingProperty-1437"><span class="linenos">1437</span></a> <span class="s2">"for_insert"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="IsolatedLoadingProperty-1438"><a href="#IsolatedLoadingProperty-1438"><span class="linenos">1438</span></a> <span class="s2">"for_none"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="IsolatedLoadingProperty-1439"><a href="#IsolatedLoadingProperty-1439"><span class="linenos">1439</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="IsolatedLoadingProperty.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="IsolatedLoadingProperty.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="IsolatedLoadingProperty.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="IsolatedLoadingProperty.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="IsolatedLoadingProperty.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="IsolatedLoadingProperty.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="IsolatedLoadingProperty.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="IsolatedLoadingProperty.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="IsolatedLoadingProperty.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="IsolatedLoadingProperty.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="IsolatedLoadingProperty.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="IsolatedLoadingProperty.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="IsolatedLoadingProperty.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="IsolatedLoadingProperty.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="IsolatedLoadingProperty.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="IsolatedLoadingProperty.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="IsolatedLoadingProperty.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="IsolatedLoadingProperty.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="IsolatedLoadingProperty.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="IsolatedLoadingProperty.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="IsolatedLoadingProperty.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="IsolatedLoadingProperty.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="IsolatedLoadingProperty.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="IsolatedLoadingProperty.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="IsolatedLoadingProperty.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="IsolatedLoadingProperty.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="IsolatedLoadingProperty.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="IsolatedLoadingProperty.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="IsolatedLoadingProperty.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="IsolatedLoadingProperty.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="IsolatedLoadingProperty.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="IsolatedLoadingProperty.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="IsolatedLoadingProperty.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Properties"> + <input id="Properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Properties</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Properties-1442"><a href="#Properties-1442"><span class="linenos">1442</span></a><span class="k">class</span> <span class="nc">Properties</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Properties-1443"><a href="#Properties-1443"><span class="linenos">1443</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Properties-1444"><a href="#Properties-1444"><span class="linenos">1444</span></a> +</span><span id="Properties-1445"><a href="#Properties-1445"><span class="linenos">1445</span></a> <span class="n">NAME_TO_PROPERTY</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Properties-1446"><a href="#Properties-1446"><span class="linenos">1446</span></a> <span class="s2">"ALGORITHM"</span><span class="p">:</span> <span class="n">AlgorithmProperty</span><span class="p">,</span> +</span><span id="Properties-1447"><a href="#Properties-1447"><span class="linenos">1447</span></a> <span class="s2">"AUTO_INCREMENT"</span><span class="p">:</span> <span class="n">AutoIncrementProperty</span><span class="p">,</span> +</span><span id="Properties-1448"><a href="#Properties-1448"><span class="linenos">1448</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">CharacterSetProperty</span><span class="p">,</span> +</span><span id="Properties-1449"><a href="#Properties-1449"><span class="linenos">1449</span></a> <span class="s2">"COLLATE"</span><span class="p">:</span> <span class="n">CollateProperty</span><span class="p">,</span> +</span><span id="Properties-1450"><a href="#Properties-1450"><span class="linenos">1450</span></a> <span class="s2">"COMMENT"</span><span class="p">:</span> <span class="n">SchemaCommentProperty</span><span class="p">,</span> +</span><span id="Properties-1451"><a href="#Properties-1451"><span class="linenos">1451</span></a> <span class="s2">"DEFINER"</span><span class="p">:</span> <span class="n">DefinerProperty</span><span class="p">,</span> +</span><span id="Properties-1452"><a href="#Properties-1452"><span class="linenos">1452</span></a> <span class="s2">"DISTKEY"</span><span class="p">:</span> <span class="n">DistKeyProperty</span><span class="p">,</span> +</span><span id="Properties-1453"><a href="#Properties-1453"><span class="linenos">1453</span></a> <span class="s2">"DISTSTYLE"</span><span class="p">:</span> <span class="n">DistStyleProperty</span><span class="p">,</span> +</span><span id="Properties-1454"><a href="#Properties-1454"><span class="linenos">1454</span></a> <span class="s2">"ENGINE"</span><span class="p">:</span> <span class="n">EngineProperty</span><span class="p">,</span> +</span><span id="Properties-1455"><a href="#Properties-1455"><span class="linenos">1455</span></a> <span class="s2">"EXECUTE AS"</span><span class="p">:</span> <span class="n">ExecuteAsProperty</span><span class="p">,</span> +</span><span id="Properties-1456"><a href="#Properties-1456"><span class="linenos">1456</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">FileFormatProperty</span><span class="p">,</span> +</span><span id="Properties-1457"><a href="#Properties-1457"><span class="linenos">1457</span></a> <span class="s2">"LANGUAGE"</span><span class="p">:</span> <span class="n">LanguageProperty</span><span class="p">,</span> +</span><span id="Properties-1458"><a href="#Properties-1458"><span class="linenos">1458</span></a> <span class="s2">"LOCATION"</span><span class="p">:</span> <span class="n">LocationProperty</span><span class="p">,</span> +</span><span id="Properties-1459"><a href="#Properties-1459"><span class="linenos">1459</span></a> <span class="s2">"PARTITIONED_BY"</span><span class="p">:</span> <span class="n">PartitionedByProperty</span><span class="p">,</span> +</span><span id="Properties-1460"><a href="#Properties-1460"><span class="linenos">1460</span></a> <span class="s2">"RETURNS"</span><span class="p">:</span> <span class="n">ReturnsProperty</span><span class="p">,</span> +</span><span id="Properties-1461"><a href="#Properties-1461"><span class="linenos">1461</span></a> <span class="s2">"SORTKEY"</span><span class="p">:</span> <span class="n">SortKeyProperty</span><span class="p">,</span> +</span><span id="Properties-1462"><a href="#Properties-1462"><span class="linenos">1462</span></a> <span class="s2">"TABLE_FORMAT"</span><span class="p">:</span> <span class="n">TableFormatProperty</span><span class="p">,</span> +</span><span id="Properties-1463"><a href="#Properties-1463"><span class="linenos">1463</span></a> <span class="p">}</span> +</span><span id="Properties-1464"><a href="#Properties-1464"><span class="linenos">1464</span></a> +</span><span id="Properties-1465"><a href="#Properties-1465"><span class="linenos">1465</span></a> <span class="n">PROPERTY_TO_NAME</span> <span class="o">=</span> <span class="p">{</span><span class="n">v</span><span class="p">:</span> <span class="n">k</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">NAME_TO_PROPERTY</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="Properties-1466"><a href="#Properties-1466"><span class="linenos">1466</span></a> +</span><span id="Properties-1467"><a href="#Properties-1467"><span class="linenos">1467</span></a> <span class="k">class</span> <span class="nc">Location</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="Properties-1468"><a href="#Properties-1468"><span class="linenos">1468</span></a> <span class="n">POST_CREATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties-1469"><a href="#Properties-1469"><span class="linenos">1469</span></a> <span class="n">PRE_SCHEMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties-1470"><a href="#Properties-1470"><span class="linenos">1470</span></a> <span class="n">POST_INDEX</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties-1471"><a href="#Properties-1471"><span class="linenos">1471</span></a> <span class="n">POST_SCHEMA_ROOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties-1472"><a href="#Properties-1472"><span class="linenos">1472</span></a> <span class="n">POST_SCHEMA_WITH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties-1473"><a href="#Properties-1473"><span class="linenos">1473</span></a> <span class="n">UNSUPPORTED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties-1474"><a href="#Properties-1474"><span class="linenos">1474</span></a> +</span><span id="Properties-1475"><a href="#Properties-1475"><span class="linenos">1475</span></a> <span class="nd">@classmethod</span> +</span><span id="Properties-1476"><a href="#Properties-1476"><span class="linenos">1476</span></a> <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">properties_dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">Properties</span><span class="p">:</span> +</span><span id="Properties-1477"><a href="#Properties-1477"><span class="linenos">1477</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Properties-1478"><a href="#Properties-1478"><span class="linenos">1478</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">properties_dict</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Properties-1479"><a href="#Properties-1479"><span class="linenos">1479</span></a> <span class="n">property_cls</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">NAME_TO_PROPERTY</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="Properties-1480"><a href="#Properties-1480"><span class="linenos">1480</span></a> <span class="k">if</span> <span class="n">property_cls</span><span class="p">:</span> +</span><span id="Properties-1481"><a href="#Properties-1481"><span class="linenos">1481</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">property_cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span> +</span><span id="Properties-1482"><a href="#Properties-1482"><span class="linenos">1482</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Properties-1483"><a href="#Properties-1483"><span class="linenos">1483</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Property</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">key</span><span class="p">),</span> <span class="n">value</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span> +</span><span id="Properties-1484"><a href="#Properties-1484"><span class="linenos">1484</span></a> +</span><span id="Properties-1485"><a href="#Properties-1485"><span class="linenos">1485</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Properties.from_dict" class="classattr"> + <input id="Properties.from_dict-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_dict</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">properties_dict</span></span><span class="return-annotation">) -> <span class="n"><a href="#Properties">sqlglot.expressions.Properties</a></span>:</span></span> + + <label class="view-source-button" for="Properties.from_dict-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Properties.from_dict"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Properties.from_dict-1475"><a href="#Properties.from_dict-1475"><span class="linenos">1475</span></a> <span class="nd">@classmethod</span> +</span><span id="Properties.from_dict-1476"><a href="#Properties.from_dict-1476"><span class="linenos">1476</span></a> <span class="k">def</span> <span class="nf">from_dict</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">properties_dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">Properties</span><span class="p">:</span> +</span><span id="Properties.from_dict-1477"><a href="#Properties.from_dict-1477"><span class="linenos">1477</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Properties.from_dict-1478"><a href="#Properties.from_dict-1478"><span class="linenos">1478</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">properties_dict</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Properties.from_dict-1479"><a href="#Properties.from_dict-1479"><span class="linenos">1479</span></a> <span class="n">property_cls</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">NAME_TO_PROPERTY</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="Properties.from_dict-1480"><a href="#Properties.from_dict-1480"><span class="linenos">1480</span></a> <span class="k">if</span> <span class="n">property_cls</span><span class="p">:</span> +</span><span id="Properties.from_dict-1481"><a href="#Properties.from_dict-1481"><span class="linenos">1481</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">property_cls</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span> +</span><span id="Properties.from_dict-1482"><a href="#Properties.from_dict-1482"><span class="linenos">1482</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Properties.from_dict-1483"><a href="#Properties.from_dict-1483"><span class="linenos">1483</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Property</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">key</span><span class="p">),</span> <span class="n">value</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)))</span> +</span><span id="Properties.from_dict-1484"><a href="#Properties.from_dict-1484"><span class="linenos">1484</span></a> +</span><span id="Properties.from_dict-1485"><a href="#Properties.from_dict-1485"><span class="linenos">1485</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Properties.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Properties.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Properties.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Properties.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Properties.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Properties.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Properties.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Properties.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Properties.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Properties.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Properties.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Properties.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Properties.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Properties.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Properties.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Properties.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Properties.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Properties.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Properties.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Properties.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Properties.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Properties.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Properties.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Properties.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Properties.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Properties.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Properties.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Properties.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Properties.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Properties.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Properties.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Properties.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Properties.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Properties.Location"> + <input id="Properties.Location-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Properties.Location</span><wbr>(<span class="base"><a href="helper.html#AutoName">sqlglot.helper.AutoName</a></span>): + + <label class="view-source-button" for="Properties.Location-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Properties.Location"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Properties.Location-1467"><a href="#Properties.Location-1467"><span class="linenos">1467</span></a> <span class="k">class</span> <span class="nc">Location</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="Properties.Location-1468"><a href="#Properties.Location-1468"><span class="linenos">1468</span></a> <span class="n">POST_CREATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties.Location-1469"><a href="#Properties.Location-1469"><span class="linenos">1469</span></a> <span class="n">PRE_SCHEMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties.Location-1470"><a href="#Properties.Location-1470"><span class="linenos">1470</span></a> <span class="n">POST_INDEX</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties.Location-1471"><a href="#Properties.Location-1471"><span class="linenos">1471</span></a> <span class="n">POST_SCHEMA_ROOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties.Location-1472"><a href="#Properties.Location-1472"><span class="linenos">1472</span></a> <span class="n">POST_SCHEMA_WITH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="Properties.Location-1473"><a href="#Properties.Location-1473"><span class="linenos">1473</span></a> <span class="n">UNSUPPORTED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>An enumeration.</p> +</div> + + + <div id="Properties.Location.POST_CREATE" class="classattr"> + <div class="attr variable"> + <span class="name">POST_CREATE</span><span class="default_value"> = <Location.POST_CREATE: 'POST_CREATE'></span> + + + </div> + <a class="headerlink" href="#Properties.Location.POST_CREATE"></a> + + + + </div> + <div id="Properties.Location.PRE_SCHEMA" class="classattr"> + <div class="attr variable"> + <span class="name">PRE_SCHEMA</span><span class="default_value"> = <Location.PRE_SCHEMA: 'PRE_SCHEMA'></span> + + + </div> + <a class="headerlink" href="#Properties.Location.PRE_SCHEMA"></a> + + + + </div> + <div id="Properties.Location.POST_INDEX" class="classattr"> + <div class="attr variable"> + <span class="name">POST_INDEX</span><span class="default_value"> = <Location.POST_INDEX: 'POST_INDEX'></span> + + + </div> + <a class="headerlink" href="#Properties.Location.POST_INDEX"></a> + + + + </div> + <div id="Properties.Location.POST_SCHEMA_ROOT" class="classattr"> + <div class="attr variable"> + <span class="name">POST_SCHEMA_ROOT</span><span class="default_value"> = <Location.POST_SCHEMA_ROOT: 'POST_SCHEMA_ROOT'></span> + + + </div> + <a class="headerlink" href="#Properties.Location.POST_SCHEMA_ROOT"></a> + + + + </div> + <div id="Properties.Location.POST_SCHEMA_WITH" class="classattr"> + <div class="attr variable"> + <span class="name">POST_SCHEMA_WITH</span><span class="default_value"> = <Location.POST_SCHEMA_WITH: 'POST_SCHEMA_WITH'></span> + + + </div> + <a class="headerlink" href="#Properties.Location.POST_SCHEMA_WITH"></a> + + + + </div> + <div id="Properties.Location.UNSUPPORTED" class="classattr"> + <div class="attr variable"> + <span class="name">UNSUPPORTED</span><span class="default_value"> = <Location.UNSUPPORTED: 'UNSUPPORTED'></span> + + + </div> + <a class="headerlink" href="#Properties.Location.UNSUPPORTED"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="Properties.Location.name" class="variable">name</dd> + <dd id="Properties.Location.value" class="variable">value</dd> + + </div> + </dl> + </div> + </section> + <section id="Qualify"> + <input id="Qualify-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Qualify</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Qualify-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Qualify"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Qualify-1488"><a href="#Qualify-1488"><span class="linenos">1488</span></a><span class="k">class</span> <span class="nc">Qualify</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Qualify-1489"><a href="#Qualify-1489"><span class="linenos">1489</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Qualify.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Qualify.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Qualify.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Qualify.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Qualify.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Qualify.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Qualify.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Qualify.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Qualify.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Qualify.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Qualify.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Qualify.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Qualify.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Qualify.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Qualify.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Qualify.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Qualify.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Qualify.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Qualify.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Qualify.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Qualify.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Qualify.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Qualify.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Qualify.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Qualify.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Qualify.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Qualify.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Qualify.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Qualify.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Qualify.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Qualify.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Qualify.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Qualify.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Return"> + <input id="Return-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Return</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Return-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Return"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Return-1493"><a href="#Return-1493"><span class="linenos">1493</span></a><span class="k">class</span> <span class="nc">Return</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Return-1494"><a href="#Return-1494"><span class="linenos">1494</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Return.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Return.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Return.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Return.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Return.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Return.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Return.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Return.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Return.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Return.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Return.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Return.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Return.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Return.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Return.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Return.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Return.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Return.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Return.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Return.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Return.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Return.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Return.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Return.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Return.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Return.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Return.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Return.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Return.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Return.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Return.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Return.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Return.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Reference"> + <input id="Reference-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Reference</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Reference-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Reference"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Reference-1497"><a href="#Reference-1497"><span class="linenos">1497</span></a><span class="k">class</span> <span class="nc">Reference</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Reference-1498"><a href="#Reference-1498"><span class="linenos">1498</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Reference.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Reference.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Reference.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Reference.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Reference.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Reference.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Reference.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Reference.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Reference.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Reference.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Reference.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Reference.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Reference.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Reference.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Reference.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Reference.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Reference.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Reference.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Reference.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Reference.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Reference.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Reference.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Reference.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Reference.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Reference.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Reference.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Reference.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Reference.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Reference.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Reference.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Reference.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Reference.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Reference.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Tuple"> + <input id="Tuple-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tuple</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Tuple-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tuple"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tuple-1501"><a href="#Tuple-1501"><span class="linenos">1501</span></a><span class="k">class</span> <span class="nc">Tuple</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Tuple-1502"><a href="#Tuple-1502"><span class="linenos">1502</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Tuple.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Tuple.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Tuple.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Tuple.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Tuple.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Tuple.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Tuple.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Tuple.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Tuple.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Tuple.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Tuple.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Tuple.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Tuple.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Tuple.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Tuple.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Tuple.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Tuple.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Tuple.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Tuple.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Tuple.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Tuple.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Tuple.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Tuple.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Tuple.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Tuple.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Tuple.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Tuple.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Tuple.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Tuple.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Tuple.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Tuple.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Tuple.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Tuple.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Subqueryable"> + <input id="Subqueryable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Subqueryable</span><wbr>(<span class="base"><a href="#Unionable">Unionable</a></span>): + + <label class="view-source-button" for="Subqueryable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Subqueryable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Subqueryable-1505"><a href="#Subqueryable-1505"><span class="linenos">1505</span></a><span class="k">class</span> <span class="nc">Subqueryable</span><span class="p">(</span><span class="n">Unionable</span><span class="p">):</span> +</span><span id="Subqueryable-1506"><a href="#Subqueryable-1506"><span class="linenos">1506</span></a> <span class="k">def</span> <span class="nf">subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Subquery</span><span class="p">:</span> +</span><span id="Subqueryable-1507"><a href="#Subqueryable-1507"><span class="linenos">1507</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Subqueryable-1508"><a href="#Subqueryable-1508"><span class="linenos">1508</span></a><span class="sd"> Convert this expression to an aliased expression that can be used as a Subquery.</span> +</span><span id="Subqueryable-1509"><a href="#Subqueryable-1509"><span class="linenos">1509</span></a> +</span><span id="Subqueryable-1510"><a href="#Subqueryable-1510"><span class="linenos">1510</span></a><span class="sd"> Example:</span> +</span><span id="Subqueryable-1511"><a href="#Subqueryable-1511"><span class="linenos">1511</span></a><span class="sd"> >>> subquery = Select().select("x").from_("tbl").subquery()</span> +</span><span id="Subqueryable-1512"><a href="#Subqueryable-1512"><span class="linenos">1512</span></a><span class="sd"> >>> Select().select("x").from_(subquery).sql()</span> +</span><span id="Subqueryable-1513"><a href="#Subqueryable-1513"><span class="linenos">1513</span></a><span class="sd"> 'SELECT x FROM (SELECT x FROM tbl)'</span> +</span><span id="Subqueryable-1514"><a href="#Subqueryable-1514"><span class="linenos">1514</span></a> +</span><span id="Subqueryable-1515"><a href="#Subqueryable-1515"><span class="linenos">1515</span></a><span class="sd"> Args:</span> +</span><span id="Subqueryable-1516"><a href="#Subqueryable-1516"><span class="linenos">1516</span></a><span class="sd"> alias (str | Identifier): an optional alias for the subquery</span> +</span><span id="Subqueryable-1517"><a href="#Subqueryable-1517"><span class="linenos">1517</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Subqueryable-1518"><a href="#Subqueryable-1518"><span class="linenos">1518</span></a> +</span><span id="Subqueryable-1519"><a href="#Subqueryable-1519"><span class="linenos">1519</span></a><span class="sd"> Returns:</span> +</span><span id="Subqueryable-1520"><a href="#Subqueryable-1520"><span class="linenos">1520</span></a><span class="sd"> Alias: the subquery</span> +</span><span id="Subqueryable-1521"><a href="#Subqueryable-1521"><span class="linenos">1521</span></a><span class="sd"> """</span> +</span><span id="Subqueryable-1522"><a href="#Subqueryable-1522"><span class="linenos">1522</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Subqueryable-1523"><a href="#Subqueryable-1523"><span class="linenos">1523</span></a> <span class="k">return</span> <span class="n">Subquery</span><span class="p">(</span> +</span><span id="Subqueryable-1524"><a href="#Subqueryable-1524"><span class="linenos">1524</span></a> <span class="n">this</span><span class="o">=</span><span class="n">instance</span><span class="p">,</span> +</span><span id="Subqueryable-1525"><a href="#Subqueryable-1525"><span class="linenos">1525</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">)),</span> +</span><span id="Subqueryable-1526"><a href="#Subqueryable-1526"><span class="linenos">1526</span></a> <span class="p">)</span> +</span><span id="Subqueryable-1527"><a href="#Subqueryable-1527"><span class="linenos">1527</span></a> +</span><span id="Subqueryable-1528"><a href="#Subqueryable-1528"><span class="linenos">1528</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Subqueryable-1529"><a href="#Subqueryable-1529"><span class="linenos">1529</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="Subqueryable-1530"><a href="#Subqueryable-1530"><span class="linenos">1530</span></a> +</span><span id="Subqueryable-1531"><a href="#Subqueryable-1531"><span class="linenos">1531</span></a> <span class="nd">@property</span> +</span><span id="Subqueryable-1532"><a href="#Subqueryable-1532"><span class="linenos">1532</span></a> <span class="k">def</span> <span class="nf">ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Subqueryable-1533"><a href="#Subqueryable-1533"><span class="linenos">1533</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="Subqueryable-1534"><a href="#Subqueryable-1534"><span class="linenos">1534</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="Subqueryable-1535"><a href="#Subqueryable-1535"><span class="linenos">1535</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="Subqueryable-1536"><a href="#Subqueryable-1536"><span class="linenos">1536</span></a> <span class="k">return</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Subqueryable-1537"><a href="#Subqueryable-1537"><span class="linenos">1537</span></a> +</span><span id="Subqueryable-1538"><a href="#Subqueryable-1538"><span class="linenos">1538</span></a> <span class="nd">@property</span> +</span><span id="Subqueryable-1539"><a href="#Subqueryable-1539"><span class="linenos">1539</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Subqueryable-1540"><a href="#Subqueryable-1540"><span class="linenos">1540</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Subqueryable objects must implement `selects`"</span><span class="p">)</span> +</span><span id="Subqueryable-1541"><a href="#Subqueryable-1541"><span class="linenos">1541</span></a> +</span><span id="Subqueryable-1542"><a href="#Subqueryable-1542"><span class="linenos">1542</span></a> <span class="nd">@property</span> +</span><span id="Subqueryable-1543"><a href="#Subqueryable-1543"><span class="linenos">1543</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Subqueryable-1544"><a href="#Subqueryable-1544"><span class="linenos">1544</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">"Subqueryable objects must implement `named_selects`"</span><span class="p">)</span> +</span><span id="Subqueryable-1545"><a href="#Subqueryable-1545"><span class="linenos">1545</span></a> +</span><span id="Subqueryable-1546"><a href="#Subqueryable-1546"><span class="linenos">1546</span></a> <span class="k">def</span> <span class="nf">with_</span><span class="p">(</span> +</span><span id="Subqueryable-1547"><a href="#Subqueryable-1547"><span class="linenos">1547</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Subqueryable-1548"><a href="#Subqueryable-1548"><span class="linenos">1548</span></a> <span class="n">alias</span><span class="p">,</span> +</span><span id="Subqueryable-1549"><a href="#Subqueryable-1549"><span class="linenos">1549</span></a> <span class="n">as_</span><span class="p">,</span> +</span><span id="Subqueryable-1550"><a href="#Subqueryable-1550"><span class="linenos">1550</span></a> <span class="n">recursive</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Subqueryable-1551"><a href="#Subqueryable-1551"><span class="linenos">1551</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Subqueryable-1552"><a href="#Subqueryable-1552"><span class="linenos">1552</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Subqueryable-1553"><a href="#Subqueryable-1553"><span class="linenos">1553</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Subqueryable-1554"><a href="#Subqueryable-1554"><span class="linenos">1554</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Subqueryable-1555"><a href="#Subqueryable-1555"><span class="linenos">1555</span></a> <span class="p">):</span> +</span><span id="Subqueryable-1556"><a href="#Subqueryable-1556"><span class="linenos">1556</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Subqueryable-1557"><a href="#Subqueryable-1557"><span class="linenos">1557</span></a><span class="sd"> Append to or set the common table expressions.</span> +</span><span id="Subqueryable-1558"><a href="#Subqueryable-1558"><span class="linenos">1558</span></a> +</span><span id="Subqueryable-1559"><a href="#Subqueryable-1559"><span class="linenos">1559</span></a><span class="sd"> Example:</span> +</span><span id="Subqueryable-1560"><a href="#Subqueryable-1560"><span class="linenos">1560</span></a><span class="sd"> >>> Select().with_("tbl2", as_="SELECT * FROM tbl").select("x").from_("tbl2").sql()</span> +</span><span id="Subqueryable-1561"><a href="#Subqueryable-1561"><span class="linenos">1561</span></a><span class="sd"> 'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2'</span> +</span><span id="Subqueryable-1562"><a href="#Subqueryable-1562"><span class="linenos">1562</span></a> +</span><span id="Subqueryable-1563"><a href="#Subqueryable-1563"><span class="linenos">1563</span></a><span class="sd"> Args:</span> +</span><span id="Subqueryable-1564"><a href="#Subqueryable-1564"><span class="linenos">1564</span></a><span class="sd"> alias (str | Expression): the SQL code string to parse as the table name.</span> +</span><span id="Subqueryable-1565"><a href="#Subqueryable-1565"><span class="linenos">1565</span></a><span class="sd"> If an `Expression` instance is passed, this is used as-is.</span> +</span><span id="Subqueryable-1566"><a href="#Subqueryable-1566"><span class="linenos">1566</span></a><span class="sd"> as_ (str | Expression): the SQL code string to parse as the table expression.</span> +</span><span id="Subqueryable-1567"><a href="#Subqueryable-1567"><span class="linenos">1567</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Subqueryable-1568"><a href="#Subqueryable-1568"><span class="linenos">1568</span></a><span class="sd"> recursive (bool): set the RECURSIVE part of the expression. Defaults to `False`.</span> +</span><span id="Subqueryable-1569"><a href="#Subqueryable-1569"><span class="linenos">1569</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Subqueryable-1570"><a href="#Subqueryable-1570"><span class="linenos">1570</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Subqueryable-1571"><a href="#Subqueryable-1571"><span class="linenos">1571</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Subqueryable-1572"><a href="#Subqueryable-1572"><span class="linenos">1572</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Subqueryable-1573"><a href="#Subqueryable-1573"><span class="linenos">1573</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Subqueryable-1574"><a href="#Subqueryable-1574"><span class="linenos">1574</span></a> +</span><span id="Subqueryable-1575"><a href="#Subqueryable-1575"><span class="linenos">1575</span></a><span class="sd"> Returns:</span> +</span><span id="Subqueryable-1576"><a href="#Subqueryable-1576"><span class="linenos">1576</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Subqueryable-1577"><a href="#Subqueryable-1577"><span class="linenos">1577</span></a><span class="sd"> """</span> +</span><span id="Subqueryable-1578"><a href="#Subqueryable-1578"><span class="linenos">1578</span></a> <span class="n">alias_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="Subqueryable-1579"><a href="#Subqueryable-1579"><span class="linenos">1579</span></a> <span class="n">alias</span><span class="p">,</span> +</span><span id="Subqueryable-1580"><a href="#Subqueryable-1580"><span class="linenos">1580</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Subqueryable-1581"><a href="#Subqueryable-1581"><span class="linenos">1581</span></a> <span class="n">into</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">,</span> +</span><span id="Subqueryable-1582"><a href="#Subqueryable-1582"><span class="linenos">1582</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Subqueryable-1583"><a href="#Subqueryable-1583"><span class="linenos">1583</span></a> <span class="p">)</span> +</span><span id="Subqueryable-1584"><a href="#Subqueryable-1584"><span class="linenos">1584</span></a> <span class="n">as_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="Subqueryable-1585"><a href="#Subqueryable-1585"><span class="linenos">1585</span></a> <span class="n">as_</span><span class="p">,</span> +</span><span id="Subqueryable-1586"><a href="#Subqueryable-1586"><span class="linenos">1586</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Subqueryable-1587"><a href="#Subqueryable-1587"><span class="linenos">1587</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Subqueryable-1588"><a href="#Subqueryable-1588"><span class="linenos">1588</span></a> <span class="p">)</span> +</span><span id="Subqueryable-1589"><a href="#Subqueryable-1589"><span class="linenos">1589</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="n">CTE</span><span class="p">(</span> +</span><span id="Subqueryable-1590"><a href="#Subqueryable-1590"><span class="linenos">1590</span></a> <span class="n">this</span><span class="o">=</span><span class="n">as_expression</span><span class="p">,</span> +</span><span id="Subqueryable-1591"><a href="#Subqueryable-1591"><span class="linenos">1591</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias_expression</span><span class="p">,</span> +</span><span id="Subqueryable-1592"><a href="#Subqueryable-1592"><span class="linenos">1592</span></a> <span class="p">)</span> +</span><span id="Subqueryable-1593"><a href="#Subqueryable-1593"><span class="linenos">1593</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Subqueryable-1594"><a href="#Subqueryable-1594"><span class="linenos">1594</span></a> <span class="n">cte</span><span class="p">,</span> +</span><span id="Subqueryable-1595"><a href="#Subqueryable-1595"><span class="linenos">1595</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Subqueryable-1596"><a href="#Subqueryable-1596"><span class="linenos">1596</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"with"</span><span class="p">,</span> +</span><span id="Subqueryable-1597"><a href="#Subqueryable-1597"><span class="linenos">1597</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Subqueryable-1598"><a href="#Subqueryable-1598"><span class="linenos">1598</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Subqueryable-1599"><a href="#Subqueryable-1599"><span class="linenos">1599</span></a> <span class="n">into</span><span class="o">=</span><span class="n">With</span><span class="p">,</span> +</span><span id="Subqueryable-1600"><a href="#Subqueryable-1600"><span class="linenos">1600</span></a> <span class="n">properties</span><span class="o">=</span><span class="p">{</span><span class="s2">"recursive"</span><span class="p">:</span> <span class="n">recursive</span> <span class="ow">or</span> <span class="kc">False</span><span class="p">},</span> +</span><span id="Subqueryable-1601"><a href="#Subqueryable-1601"><span class="linenos">1601</span></a> <span class="p">)</span> +</span></pre></div> + + + + + <div id="Subqueryable.subquery" class="classattr"> + <input id="Subqueryable.subquery-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">subquery</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">alias</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">copy</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">) -> <span class="n"><a href="#Subquery">sqlglot.expressions.Subquery</a></span>:</span></span> + + <label class="view-source-button" for="Subqueryable.subquery-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Subqueryable.subquery"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Subqueryable.subquery-1506"><a href="#Subqueryable.subquery-1506"><span class="linenos">1506</span></a> <span class="k">def</span> <span class="nf">subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Subquery</span><span class="p">:</span> +</span><span id="Subqueryable.subquery-1507"><a href="#Subqueryable.subquery-1507"><span class="linenos">1507</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Subqueryable.subquery-1508"><a href="#Subqueryable.subquery-1508"><span class="linenos">1508</span></a><span class="sd"> Convert this expression to an aliased expression that can be used as a Subquery.</span> +</span><span id="Subqueryable.subquery-1509"><a href="#Subqueryable.subquery-1509"><span class="linenos">1509</span></a> +</span><span id="Subqueryable.subquery-1510"><a href="#Subqueryable.subquery-1510"><span class="linenos">1510</span></a><span class="sd"> Example:</span> +</span><span id="Subqueryable.subquery-1511"><a href="#Subqueryable.subquery-1511"><span class="linenos">1511</span></a><span class="sd"> >>> subquery = Select().select("x").from_("tbl").subquery()</span> +</span><span id="Subqueryable.subquery-1512"><a href="#Subqueryable.subquery-1512"><span class="linenos">1512</span></a><span class="sd"> >>> Select().select("x").from_(subquery).sql()</span> +</span><span id="Subqueryable.subquery-1513"><a href="#Subqueryable.subquery-1513"><span class="linenos">1513</span></a><span class="sd"> 'SELECT x FROM (SELECT x FROM tbl)'</span> +</span><span id="Subqueryable.subquery-1514"><a href="#Subqueryable.subquery-1514"><span class="linenos">1514</span></a> +</span><span id="Subqueryable.subquery-1515"><a href="#Subqueryable.subquery-1515"><span class="linenos">1515</span></a><span class="sd"> Args:</span> +</span><span id="Subqueryable.subquery-1516"><a href="#Subqueryable.subquery-1516"><span class="linenos">1516</span></a><span class="sd"> alias (str | Identifier): an optional alias for the subquery</span> +</span><span id="Subqueryable.subquery-1517"><a href="#Subqueryable.subquery-1517"><span class="linenos">1517</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Subqueryable.subquery-1518"><a href="#Subqueryable.subquery-1518"><span class="linenos">1518</span></a> +</span><span id="Subqueryable.subquery-1519"><a href="#Subqueryable.subquery-1519"><span class="linenos">1519</span></a><span class="sd"> Returns:</span> +</span><span id="Subqueryable.subquery-1520"><a href="#Subqueryable.subquery-1520"><span class="linenos">1520</span></a><span class="sd"> Alias: the subquery</span> +</span><span id="Subqueryable.subquery-1521"><a href="#Subqueryable.subquery-1521"><span class="linenos">1521</span></a><span class="sd"> """</span> +</span><span id="Subqueryable.subquery-1522"><a href="#Subqueryable.subquery-1522"><span class="linenos">1522</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Subqueryable.subquery-1523"><a href="#Subqueryable.subquery-1523"><span class="linenos">1523</span></a> <span class="k">return</span> <span class="n">Subquery</span><span class="p">(</span> +</span><span id="Subqueryable.subquery-1524"><a href="#Subqueryable.subquery-1524"><span class="linenos">1524</span></a> <span class="n">this</span><span class="o">=</span><span class="n">instance</span><span class="p">,</span> +</span><span id="Subqueryable.subquery-1525"><a href="#Subqueryable.subquery-1525"><span class="linenos">1525</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">)),</span> +</span><span id="Subqueryable.subquery-1526"><a href="#Subqueryable.subquery-1526"><span class="linenos">1526</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Convert this expression to an aliased expression that can be used as a Subquery.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">subquery</span> <span class="o">=</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">subquery</span><span class="p">()</span> +<span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">subquery</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM (SELECT x FROM tbl)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>alias (str | Identifier):</strong> an optional alias for the subquery</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Alias: the subquery</p> +</blockquote> +</div> + + + </div> + <div id="Subqueryable.limit" class="classattr"> + <input id="Subqueryable.limit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">limit</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Subqueryable.limit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Subqueryable.limit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Subqueryable.limit-1528"><a href="#Subqueryable.limit-1528"><span class="linenos">1528</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Subqueryable.limit-1529"><a href="#Subqueryable.limit-1529"><span class="linenos">1529</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span></pre></div> + + + + + </div> + <div id="Subqueryable.with_" class="classattr"> + <input id="Subqueryable.with_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">with_</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">alias</span>,</span><span class="param"> <span class="n">as_</span>,</span><span class="param"> <span class="n">recursive</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Subqueryable.with_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Subqueryable.with_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Subqueryable.with_-1546"><a href="#Subqueryable.with_-1546"><span class="linenos">1546</span></a> <span class="k">def</span> <span class="nf">with_</span><span class="p">(</span> +</span><span id="Subqueryable.with_-1547"><a href="#Subqueryable.with_-1547"><span class="linenos">1547</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1548"><a href="#Subqueryable.with_-1548"><span class="linenos">1548</span></a> <span class="n">alias</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1549"><a href="#Subqueryable.with_-1549"><span class="linenos">1549</span></a> <span class="n">as_</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1550"><a href="#Subqueryable.with_-1550"><span class="linenos">1550</span></a> <span class="n">recursive</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1551"><a href="#Subqueryable.with_-1551"><span class="linenos">1551</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1552"><a href="#Subqueryable.with_-1552"><span class="linenos">1552</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1553"><a href="#Subqueryable.with_-1553"><span class="linenos">1553</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1554"><a href="#Subqueryable.with_-1554"><span class="linenos">1554</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1555"><a href="#Subqueryable.with_-1555"><span class="linenos">1555</span></a> <span class="p">):</span> +</span><span id="Subqueryable.with_-1556"><a href="#Subqueryable.with_-1556"><span class="linenos">1556</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Subqueryable.with_-1557"><a href="#Subqueryable.with_-1557"><span class="linenos">1557</span></a><span class="sd"> Append to or set the common table expressions.</span> +</span><span id="Subqueryable.with_-1558"><a href="#Subqueryable.with_-1558"><span class="linenos">1558</span></a> +</span><span id="Subqueryable.with_-1559"><a href="#Subqueryable.with_-1559"><span class="linenos">1559</span></a><span class="sd"> Example:</span> +</span><span id="Subqueryable.with_-1560"><a href="#Subqueryable.with_-1560"><span class="linenos">1560</span></a><span class="sd"> >>> Select().with_("tbl2", as_="SELECT * FROM tbl").select("x").from_("tbl2").sql()</span> +</span><span id="Subqueryable.with_-1561"><a href="#Subqueryable.with_-1561"><span class="linenos">1561</span></a><span class="sd"> 'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2'</span> +</span><span id="Subqueryable.with_-1562"><a href="#Subqueryable.with_-1562"><span class="linenos">1562</span></a> +</span><span id="Subqueryable.with_-1563"><a href="#Subqueryable.with_-1563"><span class="linenos">1563</span></a><span class="sd"> Args:</span> +</span><span id="Subqueryable.with_-1564"><a href="#Subqueryable.with_-1564"><span class="linenos">1564</span></a><span class="sd"> alias (str | Expression): the SQL code string to parse as the table name.</span> +</span><span id="Subqueryable.with_-1565"><a href="#Subqueryable.with_-1565"><span class="linenos">1565</span></a><span class="sd"> If an `Expression` instance is passed, this is used as-is.</span> +</span><span id="Subqueryable.with_-1566"><a href="#Subqueryable.with_-1566"><span class="linenos">1566</span></a><span class="sd"> as_ (str | Expression): the SQL code string to parse as the table expression.</span> +</span><span id="Subqueryable.with_-1567"><a href="#Subqueryable.with_-1567"><span class="linenos">1567</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Subqueryable.with_-1568"><a href="#Subqueryable.with_-1568"><span class="linenos">1568</span></a><span class="sd"> recursive (bool): set the RECURSIVE part of the expression. Defaults to `False`.</span> +</span><span id="Subqueryable.with_-1569"><a href="#Subqueryable.with_-1569"><span class="linenos">1569</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Subqueryable.with_-1570"><a href="#Subqueryable.with_-1570"><span class="linenos">1570</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Subqueryable.with_-1571"><a href="#Subqueryable.with_-1571"><span class="linenos">1571</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Subqueryable.with_-1572"><a href="#Subqueryable.with_-1572"><span class="linenos">1572</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Subqueryable.with_-1573"><a href="#Subqueryable.with_-1573"><span class="linenos">1573</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Subqueryable.with_-1574"><a href="#Subqueryable.with_-1574"><span class="linenos">1574</span></a> +</span><span id="Subqueryable.with_-1575"><a href="#Subqueryable.with_-1575"><span class="linenos">1575</span></a><span class="sd"> Returns:</span> +</span><span id="Subqueryable.with_-1576"><a href="#Subqueryable.with_-1576"><span class="linenos">1576</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Subqueryable.with_-1577"><a href="#Subqueryable.with_-1577"><span class="linenos">1577</span></a><span class="sd"> """</span> +</span><span id="Subqueryable.with_-1578"><a href="#Subqueryable.with_-1578"><span class="linenos">1578</span></a> <span class="n">alias_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="Subqueryable.with_-1579"><a href="#Subqueryable.with_-1579"><span class="linenos">1579</span></a> <span class="n">alias</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1580"><a href="#Subqueryable.with_-1580"><span class="linenos">1580</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1581"><a href="#Subqueryable.with_-1581"><span class="linenos">1581</span></a> <span class="n">into</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1582"><a href="#Subqueryable.with_-1582"><span class="linenos">1582</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1583"><a href="#Subqueryable.with_-1583"><span class="linenos">1583</span></a> <span class="p">)</span> +</span><span id="Subqueryable.with_-1584"><a href="#Subqueryable.with_-1584"><span class="linenos">1584</span></a> <span class="n">as_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="Subqueryable.with_-1585"><a href="#Subqueryable.with_-1585"><span class="linenos">1585</span></a> <span class="n">as_</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1586"><a href="#Subqueryable.with_-1586"><span class="linenos">1586</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1587"><a href="#Subqueryable.with_-1587"><span class="linenos">1587</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1588"><a href="#Subqueryable.with_-1588"><span class="linenos">1588</span></a> <span class="p">)</span> +</span><span id="Subqueryable.with_-1589"><a href="#Subqueryable.with_-1589"><span class="linenos">1589</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="n">CTE</span><span class="p">(</span> +</span><span id="Subqueryable.with_-1590"><a href="#Subqueryable.with_-1590"><span class="linenos">1590</span></a> <span class="n">this</span><span class="o">=</span><span class="n">as_expression</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1591"><a href="#Subqueryable.with_-1591"><span class="linenos">1591</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias_expression</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1592"><a href="#Subqueryable.with_-1592"><span class="linenos">1592</span></a> <span class="p">)</span> +</span><span id="Subqueryable.with_-1593"><a href="#Subqueryable.with_-1593"><span class="linenos">1593</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Subqueryable.with_-1594"><a href="#Subqueryable.with_-1594"><span class="linenos">1594</span></a> <span class="n">cte</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1595"><a href="#Subqueryable.with_-1595"><span class="linenos">1595</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1596"><a href="#Subqueryable.with_-1596"><span class="linenos">1596</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"with"</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1597"><a href="#Subqueryable.with_-1597"><span class="linenos">1597</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1598"><a href="#Subqueryable.with_-1598"><span class="linenos">1598</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1599"><a href="#Subqueryable.with_-1599"><span class="linenos">1599</span></a> <span class="n">into</span><span class="o">=</span><span class="n">With</span><span class="p">,</span> +</span><span id="Subqueryable.with_-1600"><a href="#Subqueryable.with_-1600"><span class="linenos">1600</span></a> <span class="n">properties</span><span class="o">=</span><span class="p">{</span><span class="s2">"recursive"</span><span class="p">:</span> <span class="n">recursive</span> <span class="ow">or</span> <span class="kc">False</span><span class="p">},</span> +</span><span id="Subqueryable.with_-1601"><a href="#Subqueryable.with_-1601"><span class="linenos">1601</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the common table expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">with_</span><span class="p">(</span><span class="s2">"tbl2"</span><span class="p">,</span> <span class="n">as_</span><span class="o">=</span><span class="s2">"SELECT * FROM tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl2"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'WITH tbl2 AS (SELECT * FROM tbl) SELECT x FROM tbl2'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>alias (str | Expression):</strong> the SQL code string to parse as the table name. +If an <code><a href="#Expression">Expression</a></code> instance is passed, this is used as-is.</li> +<li><strong>as_ (str | Expression):</strong> the SQL code string to parse as the table expression. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>recursive (bool):</strong> set the RECURSIVE part of the expression. Defaults to <code>False</code>.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this resets the expressions.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Subqueryable.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Subqueryable.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Subqueryable.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Subqueryable.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Subqueryable.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Subqueryable.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Subqueryable.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Subqueryable.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Subqueryable.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Subqueryable.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Subqueryable.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Subqueryable.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Subqueryable.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Subqueryable.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Subqueryable.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Subqueryable.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Subqueryable.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Subqueryable.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Subqueryable.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Subqueryable.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Subqueryable.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Subqueryable.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Subqueryable.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Subqueryable.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Subqueryable.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Subqueryable.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Subqueryable.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Subqueryable.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Subqueryable.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Subqueryable.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Subqueryable.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Subqueryable.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Subqueryable.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Subqueryable.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Subqueryable.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Subqueryable.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Table"> + <input id="Table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Table</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Table-1624"><a href="#Table-1624"><span class="linenos">1624</span></a><span class="k">class</span> <span class="nc">Table</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Table-1625"><a href="#Table-1625"><span class="linenos">1625</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Table-1626"><a href="#Table-1626"><span class="linenos">1626</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Table-1627"><a href="#Table-1627"><span class="linenos">1627</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1628"><a href="#Table-1628"><span class="linenos">1628</span></a> <span class="s2">"db"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1629"><a href="#Table-1629"><span class="linenos">1629</span></a> <span class="s2">"catalog"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1630"><a href="#Table-1630"><span class="linenos">1630</span></a> <span class="s2">"laterals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1631"><a href="#Table-1631"><span class="linenos">1631</span></a> <span class="s2">"joins"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1632"><a href="#Table-1632"><span class="linenos">1632</span></a> <span class="s2">"pivots"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1633"><a href="#Table-1633"><span class="linenos">1633</span></a> <span class="s2">"hints"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1634"><a href="#Table-1634"><span class="linenos">1634</span></a> <span class="s2">"system_time"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Table-1635"><a href="#Table-1635"><span class="linenos">1635</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Table.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Table.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Table.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Table.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Table.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Table.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Table.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Table.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Table.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Table.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Table.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Table.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Table.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Table.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Table.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Table.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Table.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Table.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Table.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Table.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Table.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Table.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Table.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Table.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Table.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Table.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Table.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Table.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Table.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Table.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Table.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Table.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Table.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SystemTime"> + <input id="SystemTime-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SystemTime</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="SystemTime-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SystemTime"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SystemTime-1639"><a href="#SystemTime-1639"><span class="linenos">1639</span></a><span class="k">class</span> <span class="nc">SystemTime</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="SystemTime-1640"><a href="#SystemTime-1640"><span class="linenos">1640</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="SystemTime-1641"><a href="#SystemTime-1641"><span class="linenos">1641</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SystemTime-1642"><a href="#SystemTime-1642"><span class="linenos">1642</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SystemTime-1643"><a href="#SystemTime-1643"><span class="linenos">1643</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="SystemTime-1644"><a href="#SystemTime-1644"><span class="linenos">1644</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SystemTime.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SystemTime.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SystemTime.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SystemTime.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SystemTime.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SystemTime.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SystemTime.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SystemTime.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SystemTime.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SystemTime.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SystemTime.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SystemTime.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SystemTime.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SystemTime.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SystemTime.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SystemTime.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SystemTime.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SystemTime.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SystemTime.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SystemTime.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SystemTime.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SystemTime.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SystemTime.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SystemTime.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SystemTime.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SystemTime.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SystemTime.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SystemTime.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SystemTime.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SystemTime.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SystemTime.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SystemTime.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SystemTime.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Union"> + <input id="Union-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Union</span><wbr>(<span class="base"><a href="#Subqueryable">Subqueryable</a></span>): + + <label class="view-source-button" for="Union-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Union"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Union-1647"><a href="#Union-1647"><span class="linenos">1647</span></a><span class="k">class</span> <span class="nc">Union</span><span class="p">(</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="Union-1648"><a href="#Union-1648"><span class="linenos">1648</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Union-1649"><a href="#Union-1649"><span class="linenos">1649</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Union-1650"><a href="#Union-1650"><span class="linenos">1650</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Union-1651"><a href="#Union-1651"><span class="linenos">1651</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Union-1652"><a href="#Union-1652"><span class="linenos">1652</span></a> <span class="s2">"distinct"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Union-1653"><a href="#Union-1653"><span class="linenos">1653</span></a> <span class="o">**</span><span class="n">QUERY_MODIFIERS</span><span class="p">,</span> +</span><span id="Union-1654"><a href="#Union-1654"><span class="linenos">1654</span></a> <span class="p">}</span> +</span><span id="Union-1655"><a href="#Union-1655"><span class="linenos">1655</span></a> +</span><span id="Union-1656"><a href="#Union-1656"><span class="linenos">1656</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Union-1657"><a href="#Union-1657"><span class="linenos">1657</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Union-1658"><a href="#Union-1658"><span class="linenos">1658</span></a><span class="sd"> Set the LIMIT expression.</span> +</span><span id="Union-1659"><a href="#Union-1659"><span class="linenos">1659</span></a> +</span><span id="Union-1660"><a href="#Union-1660"><span class="linenos">1660</span></a><span class="sd"> Example:</span> +</span><span id="Union-1661"><a href="#Union-1661"><span class="linenos">1661</span></a><span class="sd"> >>> select("1").union(select("1")).limit(1).sql()</span> +</span><span id="Union-1662"><a href="#Union-1662"><span class="linenos">1662</span></a><span class="sd"> 'SELECT * FROM (SELECT 1 UNION SELECT 1) AS _l_0 LIMIT 1'</span> +</span><span id="Union-1663"><a href="#Union-1663"><span class="linenos">1663</span></a> +</span><span id="Union-1664"><a href="#Union-1664"><span class="linenos">1664</span></a><span class="sd"> Args:</span> +</span><span id="Union-1665"><a href="#Union-1665"><span class="linenos">1665</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="Union-1666"><a href="#Union-1666"><span class="linenos">1666</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="Union-1667"><a href="#Union-1667"><span class="linenos">1667</span></a><span class="sd"> If a `Limit` instance is passed, this is used as-is.</span> +</span><span id="Union-1668"><a href="#Union-1668"><span class="linenos">1668</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Limit`.</span> +</span><span id="Union-1669"><a href="#Union-1669"><span class="linenos">1669</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Union-1670"><a href="#Union-1670"><span class="linenos">1670</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Union-1671"><a href="#Union-1671"><span class="linenos">1671</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Union-1672"><a href="#Union-1672"><span class="linenos">1672</span></a> +</span><span id="Union-1673"><a href="#Union-1673"><span class="linenos">1673</span></a><span class="sd"> Returns:</span> +</span><span id="Union-1674"><a href="#Union-1674"><span class="linenos">1674</span></a><span class="sd"> Select: The limited subqueryable.</span> +</span><span id="Union-1675"><a href="#Union-1675"><span class="linenos">1675</span></a><span class="sd"> """</span> +</span><span id="Union-1676"><a href="#Union-1676"><span class="linenos">1676</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="Union-1677"><a href="#Union-1677"><span class="linenos">1677</span></a> <span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span> +</span><span id="Union-1678"><a href="#Union-1678"><span class="linenos">1678</span></a> <span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">alias</span><span class="o">=</span><span class="s2">"_l_0"</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">))</span> +</span><span id="Union-1679"><a href="#Union-1679"><span class="linenos">1679</span></a> <span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Union-1680"><a href="#Union-1680"><span class="linenos">1680</span></a> <span class="p">)</span> +</span><span id="Union-1681"><a href="#Union-1681"><span class="linenos">1681</span></a> +</span><span id="Union-1682"><a href="#Union-1682"><span class="linenos">1682</span></a> <span class="nd">@property</span> +</span><span id="Union-1683"><a href="#Union-1683"><span class="linenos">1683</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Union-1684"><a href="#Union-1684"><span class="linenos">1684</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="Union-1685"><a href="#Union-1685"><span class="linenos">1685</span></a> +</span><span id="Union-1686"><a href="#Union-1686"><span class="linenos">1686</span></a> <span class="nd">@property</span> +</span><span id="Union-1687"><a href="#Union-1687"><span class="linenos">1687</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Union-1688"><a href="#Union-1688"><span class="linenos">1688</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">selects</span> +</span><span id="Union-1689"><a href="#Union-1689"><span class="linenos">1689</span></a> +</span><span id="Union-1690"><a href="#Union-1690"><span class="linenos">1690</span></a> <span class="nd">@property</span> +</span><span id="Union-1691"><a href="#Union-1691"><span class="linenos">1691</span></a> <span class="k">def</span> <span class="nf">left</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Union-1692"><a href="#Union-1692"><span class="linenos">1692</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="Union-1693"><a href="#Union-1693"><span class="linenos">1693</span></a> +</span><span id="Union-1694"><a href="#Union-1694"><span class="linenos">1694</span></a> <span class="nd">@property</span> +</span><span id="Union-1695"><a href="#Union-1695"><span class="linenos">1695</span></a> <span class="k">def</span> <span class="nf">right</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Union-1696"><a href="#Union-1696"><span class="linenos">1696</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> +</span></pre></div> + + + + + <div id="Union.limit" class="classattr"> + <input id="Union.limit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">limit</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Union.limit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Union.limit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Union.limit-1656"><a href="#Union.limit-1656"><span class="linenos">1656</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Union.limit-1657"><a href="#Union.limit-1657"><span class="linenos">1657</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Union.limit-1658"><a href="#Union.limit-1658"><span class="linenos">1658</span></a><span class="sd"> Set the LIMIT expression.</span> +</span><span id="Union.limit-1659"><a href="#Union.limit-1659"><span class="linenos">1659</span></a> +</span><span id="Union.limit-1660"><a href="#Union.limit-1660"><span class="linenos">1660</span></a><span class="sd"> Example:</span> +</span><span id="Union.limit-1661"><a href="#Union.limit-1661"><span class="linenos">1661</span></a><span class="sd"> >>> select("1").union(select("1")).limit(1).sql()</span> +</span><span id="Union.limit-1662"><a href="#Union.limit-1662"><span class="linenos">1662</span></a><span class="sd"> 'SELECT * FROM (SELECT 1 UNION SELECT 1) AS _l_0 LIMIT 1'</span> +</span><span id="Union.limit-1663"><a href="#Union.limit-1663"><span class="linenos">1663</span></a> +</span><span id="Union.limit-1664"><a href="#Union.limit-1664"><span class="linenos">1664</span></a><span class="sd"> Args:</span> +</span><span id="Union.limit-1665"><a href="#Union.limit-1665"><span class="linenos">1665</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="Union.limit-1666"><a href="#Union.limit-1666"><span class="linenos">1666</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="Union.limit-1667"><a href="#Union.limit-1667"><span class="linenos">1667</span></a><span class="sd"> If a `Limit` instance is passed, this is used as-is.</span> +</span><span id="Union.limit-1668"><a href="#Union.limit-1668"><span class="linenos">1668</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Limit`.</span> +</span><span id="Union.limit-1669"><a href="#Union.limit-1669"><span class="linenos">1669</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Union.limit-1670"><a href="#Union.limit-1670"><span class="linenos">1670</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Union.limit-1671"><a href="#Union.limit-1671"><span class="linenos">1671</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Union.limit-1672"><a href="#Union.limit-1672"><span class="linenos">1672</span></a> +</span><span id="Union.limit-1673"><a href="#Union.limit-1673"><span class="linenos">1673</span></a><span class="sd"> Returns:</span> +</span><span id="Union.limit-1674"><a href="#Union.limit-1674"><span class="linenos">1674</span></a><span class="sd"> Select: The limited subqueryable.</span> +</span><span id="Union.limit-1675"><a href="#Union.limit-1675"><span class="linenos">1675</span></a><span class="sd"> """</span> +</span><span id="Union.limit-1676"><a href="#Union.limit-1676"><span class="linenos">1676</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="Union.limit-1677"><a href="#Union.limit-1677"><span class="linenos">1677</span></a> <span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span> +</span><span id="Union.limit-1678"><a href="#Union.limit-1678"><span class="linenos">1678</span></a> <span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">alias</span><span class="o">=</span><span class="s2">"_l_0"</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">))</span> +</span><span id="Union.limit-1679"><a href="#Union.limit-1679"><span class="linenos">1679</span></a> <span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Union.limit-1680"><a href="#Union.limit-1680"><span class="linenos">1680</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the LIMIT expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">select</span><span class="p">(</span><span class="s2">"1"</span><span class="p">)</span><span class="o">.</span><span class="n">union</span><span class="p">(</span><span class="n">select</span><span class="p">(</span><span class="s2">"1"</span><span class="p">))</span><span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM (SELECT 1 UNION SELECT 1) AS _l_0 LIMIT 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | int | Expression):</strong> the SQL code string to parse. +This can also be an integer. +If a <code><a href="#Limit">Limit</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#Limit">Limit</a></code>.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: The limited subqueryable.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Union.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Union.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Union.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Union.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Union.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Union.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Union.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Union.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Union.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Union.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Union.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Union.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Union.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Union.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Union.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Union.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Union.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Union.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Union.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Union.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Union.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Union.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Union.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Union.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Union.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Union.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Union.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Union.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Union.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Union.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Union.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Union.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Union.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Subqueryable">Subqueryable</a></dt> + <dd id="Union.subquery" class="function"><a href="#Subqueryable.subquery">subquery</a></dd> + <dd id="Union.with_" class="function"><a href="#Subqueryable.with_">with_</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Union.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Union.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Union.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Except"> + <input id="Except-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Except</span><wbr>(<span class="base"><a href="#Union">Union</a></span>): + + <label class="view-source-button" for="Except-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Except"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Except-1699"><a href="#Except-1699"><span class="linenos">1699</span></a><span class="k">class</span> <span class="nc">Except</span><span class="p">(</span><span class="n">Union</span><span class="p">):</span> +</span><span id="Except-1700"><a href="#Except-1700"><span class="linenos">1700</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Except.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Except.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Except.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Except.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Except.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Except.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Except.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Except.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Except.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Except.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Except.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Except.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Except.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Except.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Except.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Except.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Except.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Except.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Except.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Except.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Except.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Except.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Except.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Except.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Except.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Except.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Except.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Except.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Except.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Except.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Except.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Except.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Except.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Union">Union</a></dt> + <dd id="Except.limit" class="function"><a href="#Union.limit">limit</a></dd> + + </div> + <div><dt><a href="#Subqueryable">Subqueryable</a></dt> + <dd id="Except.subquery" class="function"><a href="#Subqueryable.subquery">subquery</a></dd> + <dd id="Except.with_" class="function"><a href="#Subqueryable.with_">with_</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Except.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Except.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Except.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Intersect"> + <input id="Intersect-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Intersect</span><wbr>(<span class="base"><a href="#Union">Union</a></span>): + + <label class="view-source-button" for="Intersect-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Intersect"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Intersect-1703"><a href="#Intersect-1703"><span class="linenos">1703</span></a><span class="k">class</span> <span class="nc">Intersect</span><span class="p">(</span><span class="n">Union</span><span class="p">):</span> +</span><span id="Intersect-1704"><a href="#Intersect-1704"><span class="linenos">1704</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Intersect.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Intersect.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Intersect.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Intersect.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Intersect.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Intersect.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Intersect.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Intersect.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Intersect.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Intersect.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Intersect.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Intersect.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Intersect.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Intersect.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Intersect.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Intersect.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Intersect.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Intersect.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Intersect.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Intersect.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Intersect.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Intersect.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Intersect.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Intersect.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Intersect.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Intersect.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Intersect.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Intersect.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Intersect.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Intersect.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Intersect.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Intersect.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Intersect.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Union">Union</a></dt> + <dd id="Intersect.limit" class="function"><a href="#Union.limit">limit</a></dd> + + </div> + <div><dt><a href="#Subqueryable">Subqueryable</a></dt> + <dd id="Intersect.subquery" class="function"><a href="#Subqueryable.subquery">subquery</a></dd> + <dd id="Intersect.with_" class="function"><a href="#Subqueryable.with_">with_</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Intersect.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Intersect.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Intersect.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Unnest"> + <input id="Unnest-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Unnest</span><wbr>(<span class="base"><a href="#UDTF">UDTF</a></span>): + + <label class="view-source-button" for="Unnest-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unnest"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unnest-1707"><a href="#Unnest-1707"><span class="linenos">1707</span></a><span class="k">class</span> <span class="nc">Unnest</span><span class="p">(</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="Unnest-1708"><a href="#Unnest-1708"><span class="linenos">1708</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Unnest-1709"><a href="#Unnest-1709"><span class="linenos">1709</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Unnest-1710"><a href="#Unnest-1710"><span class="linenos">1710</span></a> <span class="s2">"ordinality"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Unnest-1711"><a href="#Unnest-1711"><span class="linenos">1711</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Unnest-1712"><a href="#Unnest-1712"><span class="linenos">1712</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Unnest-1713"><a href="#Unnest-1713"><span class="linenos">1713</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Unnest.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Unnest.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Unnest.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Unnest.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Unnest.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Unnest.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Unnest.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Unnest.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Unnest.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Unnest.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Unnest.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Unnest.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Unnest.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Unnest.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Unnest.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Unnest.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Unnest.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Unnest.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Unnest.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Unnest.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Unnest.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Unnest.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Unnest.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Unnest.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Unnest.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Unnest.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Unnest.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Unnest.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Unnest.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Unnest.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Unnest.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Unnest.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Unnest.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Unnest.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Unnest.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Unnest.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Update"> + <input id="Update-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Update</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Update-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Update"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Update-1716"><a href="#Update-1716"><span class="linenos">1716</span></a><span class="k">class</span> <span class="nc">Update</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Update-1717"><a href="#Update-1717"><span class="linenos">1717</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Update-1718"><a href="#Update-1718"><span class="linenos">1718</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Update-1719"><a href="#Update-1719"><span class="linenos">1719</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Update-1720"><a href="#Update-1720"><span class="linenos">1720</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Update-1721"><a href="#Update-1721"><span class="linenos">1721</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Update-1722"><a href="#Update-1722"><span class="linenos">1722</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Update-1723"><a href="#Update-1723"><span class="linenos">1723</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Update.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Update.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Update.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Update.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Update.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Update.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Update.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Update.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Update.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Update.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Update.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Update.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Update.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Update.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Update.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Update.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Update.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Update.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Update.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Update.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Update.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Update.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Update.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Update.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Update.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Update.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Update.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Update.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Update.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Update.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Update.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Update.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Update.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Values"> + <input id="Values-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Values</span><wbr>(<span class="base"><a href="#UDTF">UDTF</a></span>): + + <label class="view-source-button" for="Values-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Values"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Values-1726"><a href="#Values-1726"><span class="linenos">1726</span></a><span class="k">class</span> <span class="nc">Values</span><span class="p">(</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="Values-1727"><a href="#Values-1727"><span class="linenos">1727</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Values-1728"><a href="#Values-1728"><span class="linenos">1728</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Values-1729"><a href="#Values-1729"><span class="linenos">1729</span></a> <span class="s2">"ordinality"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Values-1730"><a href="#Values-1730"><span class="linenos">1730</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Values-1731"><a href="#Values-1731"><span class="linenos">1731</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Values.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Values.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Values.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Values.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Values.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Values.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Values.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Values.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Values.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Values.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Values.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Values.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Values.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Values.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Values.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Values.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Values.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Values.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Values.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Values.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Values.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Values.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Values.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Values.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Values.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Values.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Values.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Values.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Values.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Values.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Values.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Values.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Values.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Values.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Values.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Values.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Var"> + <input id="Var-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Var</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Var-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Var"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Var-1734"><a href="#Var-1734"><span class="linenos">1734</span></a><span class="k">class</span> <span class="nc">Var</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Var-1735"><a href="#Var-1735"><span class="linenos">1735</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Var.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Var.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Var.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Var.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Var.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Var.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Var.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Var.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Var.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Var.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Var.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Var.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Var.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Var.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Var.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Var.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Var.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Var.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Var.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Var.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Var.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Var.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Var.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Var.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Var.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Var.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Var.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Var.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Var.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Var.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Var.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Var.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Var.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Schema"> + <input id="Schema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Schema</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Schema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Schema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Schema-1738"><a href="#Schema-1738"><span class="linenos">1738</span></a><span class="k">class</span> <span class="nc">Schema</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Schema-1739"><a href="#Schema-1739"><span class="linenos">1739</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Schema.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Schema.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Schema.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Schema.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Schema.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Schema.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Schema.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Schema.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Schema.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Schema.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Schema.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Schema.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Schema.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Schema.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Schema.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Schema.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Schema.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Schema.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Schema.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Schema.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Schema.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Schema.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Schema.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Schema.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Schema.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Schema.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Schema.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Schema.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Schema.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Schema.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Schema.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Schema.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Schema.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Lock"> + <input id="Lock-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Lock</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Lock-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Lock"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Lock-1744"><a href="#Lock-1744"><span class="linenos">1744</span></a><span class="k">class</span> <span class="nc">Lock</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Lock-1745"><a href="#Lock-1745"><span class="linenos">1745</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"update"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Lock.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Lock.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Lock.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Lock.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Lock.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Lock.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Lock.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Lock.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Lock.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Lock.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Lock.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Lock.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Lock.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Lock.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Lock.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Lock.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Lock.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Lock.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Lock.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Lock.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Lock.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Lock.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Lock.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Lock.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Lock.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Lock.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Lock.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Lock.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Lock.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Lock.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Lock.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Lock.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Lock.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Select"> + <input id="Select-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Select</span><wbr>(<span class="base"><a href="#Subqueryable">Subqueryable</a></span>): + + <label class="view-source-button" for="Select-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select-1748"><a href="#Select-1748"><span class="linenos">1748</span></a><span class="k">class</span> <span class="nc">Select</span><span class="p">(</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="Select-1749"><a href="#Select-1749"><span class="linenos">1749</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Select-1750"><a href="#Select-1750"><span class="linenos">1750</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Select-1751"><a href="#Select-1751"><span class="linenos">1751</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Select-1752"><a href="#Select-1752"><span class="linenos">1752</span></a> <span class="s2">"hint"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Select-1753"><a href="#Select-1753"><span class="linenos">1753</span></a> <span class="s2">"distinct"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Select-1754"><a href="#Select-1754"><span class="linenos">1754</span></a> <span class="s2">"into"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Select-1755"><a href="#Select-1755"><span class="linenos">1755</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Select-1756"><a href="#Select-1756"><span class="linenos">1756</span></a> <span class="o">**</span><span class="n">QUERY_MODIFIERS</span><span class="p">,</span> +</span><span id="Select-1757"><a href="#Select-1757"><span class="linenos">1757</span></a> <span class="p">}</span> +</span><span id="Select-1758"><a href="#Select-1758"><span class="linenos">1758</span></a> +</span><span id="Select-1759"><a href="#Select-1759"><span class="linenos">1759</span></a> <span class="k">def</span> <span class="nf">from_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1760"><a href="#Select-1760"><span class="linenos">1760</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1761"><a href="#Select-1761"><span class="linenos">1761</span></a><span class="sd"> Set the FROM expression.</span> +</span><span id="Select-1762"><a href="#Select-1762"><span class="linenos">1762</span></a> +</span><span id="Select-1763"><a href="#Select-1763"><span class="linenos">1763</span></a><span class="sd"> Example:</span> +</span><span id="Select-1764"><a href="#Select-1764"><span class="linenos">1764</span></a><span class="sd"> >>> Select().from_("tbl").select("x").sql()</span> +</span><span id="Select-1765"><a href="#Select-1765"><span class="linenos">1765</span></a><span class="sd"> 'SELECT x FROM tbl'</span> +</span><span id="Select-1766"><a href="#Select-1766"><span class="linenos">1766</span></a> +</span><span id="Select-1767"><a href="#Select-1767"><span class="linenos">1767</span></a><span class="sd"> Args:</span> +</span><span id="Select-1768"><a href="#Select-1768"><span class="linenos">1768</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-1769"><a href="#Select-1769"><span class="linenos">1769</span></a><span class="sd"> If a `From` instance is passed, this is used as-is.</span> +</span><span id="Select-1770"><a href="#Select-1770"><span class="linenos">1770</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `From`.</span> +</span><span id="Select-1771"><a href="#Select-1771"><span class="linenos">1771</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-1772"><a href="#Select-1772"><span class="linenos">1772</span></a><span class="sd"> Otherwise, this flattens all the `From` expression into a single expression.</span> +</span><span id="Select-1773"><a href="#Select-1773"><span class="linenos">1773</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1774"><a href="#Select-1774"><span class="linenos">1774</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1775"><a href="#Select-1775"><span class="linenos">1775</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1776"><a href="#Select-1776"><span class="linenos">1776</span></a> +</span><span id="Select-1777"><a href="#Select-1777"><span class="linenos">1777</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1778"><a href="#Select-1778"><span class="linenos">1778</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1779"><a href="#Select-1779"><span class="linenos">1779</span></a><span class="sd"> """</span> +</span><span id="Select-1780"><a href="#Select-1780"><span class="linenos">1780</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select-1781"><a href="#Select-1781"><span class="linenos">1781</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-1782"><a href="#Select-1782"><span class="linenos">1782</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1783"><a href="#Select-1783"><span class="linenos">1783</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"from"</span><span class="p">,</span> +</span><span id="Select-1784"><a href="#Select-1784"><span class="linenos">1784</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-1785"><a href="#Select-1785"><span class="linenos">1785</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1786"><a href="#Select-1786"><span class="linenos">1786</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> +</span><span id="Select-1787"><a href="#Select-1787"><span class="linenos">1787</span></a> <span class="n">into</span><span class="o">=</span><span class="n">From</span><span class="p">,</span> +</span><span id="Select-1788"><a href="#Select-1788"><span class="linenos">1788</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1789"><a href="#Select-1789"><span class="linenos">1789</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1790"><a href="#Select-1790"><span class="linenos">1790</span></a> <span class="p">)</span> +</span><span id="Select-1791"><a href="#Select-1791"><span class="linenos">1791</span></a> +</span><span id="Select-1792"><a href="#Select-1792"><span class="linenos">1792</span></a> <span class="k">def</span> <span class="nf">group_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1793"><a href="#Select-1793"><span class="linenos">1793</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1794"><a href="#Select-1794"><span class="linenos">1794</span></a><span class="sd"> Set the GROUP BY expression.</span> +</span><span id="Select-1795"><a href="#Select-1795"><span class="linenos">1795</span></a> +</span><span id="Select-1796"><a href="#Select-1796"><span class="linenos">1796</span></a><span class="sd"> Example:</span> +</span><span id="Select-1797"><a href="#Select-1797"><span class="linenos">1797</span></a><span class="sd"> >>> Select().from_("tbl").select("x", "COUNT(1)").group_by("x").sql()</span> +</span><span id="Select-1798"><a href="#Select-1798"><span class="linenos">1798</span></a><span class="sd"> 'SELECT x, COUNT(1) FROM tbl GROUP BY x'</span> +</span><span id="Select-1799"><a href="#Select-1799"><span class="linenos">1799</span></a> +</span><span id="Select-1800"><a href="#Select-1800"><span class="linenos">1800</span></a><span class="sd"> Args:</span> +</span><span id="Select-1801"><a href="#Select-1801"><span class="linenos">1801</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-1802"><a href="#Select-1802"><span class="linenos">1802</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select-1803"><a href="#Select-1803"><span class="linenos">1803</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Group`.</span> +</span><span id="Select-1804"><a href="#Select-1804"><span class="linenos">1804</span></a><span class="sd"> If nothing is passed in then a group by is not applied to the expression</span> +</span><span id="Select-1805"><a href="#Select-1805"><span class="linenos">1805</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-1806"><a href="#Select-1806"><span class="linenos">1806</span></a><span class="sd"> Otherwise, this flattens all the `Group` expression into a single expression.</span> +</span><span id="Select-1807"><a href="#Select-1807"><span class="linenos">1807</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1808"><a href="#Select-1808"><span class="linenos">1808</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1809"><a href="#Select-1809"><span class="linenos">1809</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1810"><a href="#Select-1810"><span class="linenos">1810</span></a> +</span><span id="Select-1811"><a href="#Select-1811"><span class="linenos">1811</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1812"><a href="#Select-1812"><span class="linenos">1812</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1813"><a href="#Select-1813"><span class="linenos">1813</span></a><span class="sd"> """</span> +</span><span id="Select-1814"><a href="#Select-1814"><span class="linenos">1814</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="Select-1815"><a href="#Select-1815"><span class="linenos">1815</span></a> <span class="k">return</span> <span class="bp">self</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Select-1816"><a href="#Select-1816"><span class="linenos">1816</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select-1817"><a href="#Select-1817"><span class="linenos">1817</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-1818"><a href="#Select-1818"><span class="linenos">1818</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1819"><a href="#Select-1819"><span class="linenos">1819</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"group"</span><span class="p">,</span> +</span><span id="Select-1820"><a href="#Select-1820"><span class="linenos">1820</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-1821"><a href="#Select-1821"><span class="linenos">1821</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1822"><a href="#Select-1822"><span class="linenos">1822</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"GROUP BY"</span><span class="p">,</span> +</span><span id="Select-1823"><a href="#Select-1823"><span class="linenos">1823</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Group</span><span class="p">,</span> +</span><span id="Select-1824"><a href="#Select-1824"><span class="linenos">1824</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1825"><a href="#Select-1825"><span class="linenos">1825</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1826"><a href="#Select-1826"><span class="linenos">1826</span></a> <span class="p">)</span> +</span><span id="Select-1827"><a href="#Select-1827"><span class="linenos">1827</span></a> +</span><span id="Select-1828"><a href="#Select-1828"><span class="linenos">1828</span></a> <span class="k">def</span> <span class="nf">order_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1829"><a href="#Select-1829"><span class="linenos">1829</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1830"><a href="#Select-1830"><span class="linenos">1830</span></a><span class="sd"> Set the ORDER BY expression.</span> +</span><span id="Select-1831"><a href="#Select-1831"><span class="linenos">1831</span></a> +</span><span id="Select-1832"><a href="#Select-1832"><span class="linenos">1832</span></a><span class="sd"> Example:</span> +</span><span id="Select-1833"><a href="#Select-1833"><span class="linenos">1833</span></a><span class="sd"> >>> Select().from_("tbl").select("x").order_by("x DESC").sql()</span> +</span><span id="Select-1834"><a href="#Select-1834"><span class="linenos">1834</span></a><span class="sd"> 'SELECT x FROM tbl ORDER BY x DESC'</span> +</span><span id="Select-1835"><a href="#Select-1835"><span class="linenos">1835</span></a> +</span><span id="Select-1836"><a href="#Select-1836"><span class="linenos">1836</span></a><span class="sd"> Args:</span> +</span><span id="Select-1837"><a href="#Select-1837"><span class="linenos">1837</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-1838"><a href="#Select-1838"><span class="linenos">1838</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select-1839"><a href="#Select-1839"><span class="linenos">1839</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Order`.</span> +</span><span id="Select-1840"><a href="#Select-1840"><span class="linenos">1840</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-1841"><a href="#Select-1841"><span class="linenos">1841</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="Select-1842"><a href="#Select-1842"><span class="linenos">1842</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1843"><a href="#Select-1843"><span class="linenos">1843</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1844"><a href="#Select-1844"><span class="linenos">1844</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1845"><a href="#Select-1845"><span class="linenos">1845</span></a> +</span><span id="Select-1846"><a href="#Select-1846"><span class="linenos">1846</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1847"><a href="#Select-1847"><span class="linenos">1847</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1848"><a href="#Select-1848"><span class="linenos">1848</span></a><span class="sd"> """</span> +</span><span id="Select-1849"><a href="#Select-1849"><span class="linenos">1849</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select-1850"><a href="#Select-1850"><span class="linenos">1850</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-1851"><a href="#Select-1851"><span class="linenos">1851</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1852"><a href="#Select-1852"><span class="linenos">1852</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"order"</span><span class="p">,</span> +</span><span id="Select-1853"><a href="#Select-1853"><span class="linenos">1853</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-1854"><a href="#Select-1854"><span class="linenos">1854</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1855"><a href="#Select-1855"><span class="linenos">1855</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ORDER BY"</span><span class="p">,</span> +</span><span id="Select-1856"><a href="#Select-1856"><span class="linenos">1856</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Order</span><span class="p">,</span> +</span><span id="Select-1857"><a href="#Select-1857"><span class="linenos">1857</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1858"><a href="#Select-1858"><span class="linenos">1858</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1859"><a href="#Select-1859"><span class="linenos">1859</span></a> <span class="p">)</span> +</span><span id="Select-1860"><a href="#Select-1860"><span class="linenos">1860</span></a> +</span><span id="Select-1861"><a href="#Select-1861"><span class="linenos">1861</span></a> <span class="k">def</span> <span class="nf">sort_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1862"><a href="#Select-1862"><span class="linenos">1862</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1863"><a href="#Select-1863"><span class="linenos">1863</span></a><span class="sd"> Set the SORT BY expression.</span> +</span><span id="Select-1864"><a href="#Select-1864"><span class="linenos">1864</span></a> +</span><span id="Select-1865"><a href="#Select-1865"><span class="linenos">1865</span></a><span class="sd"> Example:</span> +</span><span id="Select-1866"><a href="#Select-1866"><span class="linenos">1866</span></a><span class="sd"> >>> Select().from_("tbl").select("x").sort_by("x DESC").sql()</span> +</span><span id="Select-1867"><a href="#Select-1867"><span class="linenos">1867</span></a><span class="sd"> 'SELECT x FROM tbl SORT BY x DESC'</span> +</span><span id="Select-1868"><a href="#Select-1868"><span class="linenos">1868</span></a> +</span><span id="Select-1869"><a href="#Select-1869"><span class="linenos">1869</span></a><span class="sd"> Args:</span> +</span><span id="Select-1870"><a href="#Select-1870"><span class="linenos">1870</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-1871"><a href="#Select-1871"><span class="linenos">1871</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select-1872"><a href="#Select-1872"><span class="linenos">1872</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `SORT`.</span> +</span><span id="Select-1873"><a href="#Select-1873"><span class="linenos">1873</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-1874"><a href="#Select-1874"><span class="linenos">1874</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="Select-1875"><a href="#Select-1875"><span class="linenos">1875</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1876"><a href="#Select-1876"><span class="linenos">1876</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1877"><a href="#Select-1877"><span class="linenos">1877</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1878"><a href="#Select-1878"><span class="linenos">1878</span></a> +</span><span id="Select-1879"><a href="#Select-1879"><span class="linenos">1879</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1880"><a href="#Select-1880"><span class="linenos">1880</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1881"><a href="#Select-1881"><span class="linenos">1881</span></a><span class="sd"> """</span> +</span><span id="Select-1882"><a href="#Select-1882"><span class="linenos">1882</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select-1883"><a href="#Select-1883"><span class="linenos">1883</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-1884"><a href="#Select-1884"><span class="linenos">1884</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1885"><a href="#Select-1885"><span class="linenos">1885</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"sort"</span><span class="p">,</span> +</span><span id="Select-1886"><a href="#Select-1886"><span class="linenos">1886</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-1887"><a href="#Select-1887"><span class="linenos">1887</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1888"><a href="#Select-1888"><span class="linenos">1888</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"SORT BY"</span><span class="p">,</span> +</span><span id="Select-1889"><a href="#Select-1889"><span class="linenos">1889</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Sort</span><span class="p">,</span> +</span><span id="Select-1890"><a href="#Select-1890"><span class="linenos">1890</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1891"><a href="#Select-1891"><span class="linenos">1891</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1892"><a href="#Select-1892"><span class="linenos">1892</span></a> <span class="p">)</span> +</span><span id="Select-1893"><a href="#Select-1893"><span class="linenos">1893</span></a> +</span><span id="Select-1894"><a href="#Select-1894"><span class="linenos">1894</span></a> <span class="k">def</span> <span class="nf">cluster_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1895"><a href="#Select-1895"><span class="linenos">1895</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1896"><a href="#Select-1896"><span class="linenos">1896</span></a><span class="sd"> Set the CLUSTER BY expression.</span> +</span><span id="Select-1897"><a href="#Select-1897"><span class="linenos">1897</span></a> +</span><span id="Select-1898"><a href="#Select-1898"><span class="linenos">1898</span></a><span class="sd"> Example:</span> +</span><span id="Select-1899"><a href="#Select-1899"><span class="linenos">1899</span></a><span class="sd"> >>> Select().from_("tbl").select("x").cluster_by("x DESC").sql()</span> +</span><span id="Select-1900"><a href="#Select-1900"><span class="linenos">1900</span></a><span class="sd"> 'SELECT x FROM tbl CLUSTER BY x DESC'</span> +</span><span id="Select-1901"><a href="#Select-1901"><span class="linenos">1901</span></a> +</span><span id="Select-1902"><a href="#Select-1902"><span class="linenos">1902</span></a><span class="sd"> Args:</span> +</span><span id="Select-1903"><a href="#Select-1903"><span class="linenos">1903</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-1904"><a href="#Select-1904"><span class="linenos">1904</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select-1905"><a href="#Select-1905"><span class="linenos">1905</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Cluster`.</span> +</span><span id="Select-1906"><a href="#Select-1906"><span class="linenos">1906</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-1907"><a href="#Select-1907"><span class="linenos">1907</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="Select-1908"><a href="#Select-1908"><span class="linenos">1908</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1909"><a href="#Select-1909"><span class="linenos">1909</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1910"><a href="#Select-1910"><span class="linenos">1910</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1911"><a href="#Select-1911"><span class="linenos">1911</span></a> +</span><span id="Select-1912"><a href="#Select-1912"><span class="linenos">1912</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1913"><a href="#Select-1913"><span class="linenos">1913</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1914"><a href="#Select-1914"><span class="linenos">1914</span></a><span class="sd"> """</span> +</span><span id="Select-1915"><a href="#Select-1915"><span class="linenos">1915</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select-1916"><a href="#Select-1916"><span class="linenos">1916</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-1917"><a href="#Select-1917"><span class="linenos">1917</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1918"><a href="#Select-1918"><span class="linenos">1918</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"cluster"</span><span class="p">,</span> +</span><span id="Select-1919"><a href="#Select-1919"><span class="linenos">1919</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-1920"><a href="#Select-1920"><span class="linenos">1920</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1921"><a href="#Select-1921"><span class="linenos">1921</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"CLUSTER BY"</span><span class="p">,</span> +</span><span id="Select-1922"><a href="#Select-1922"><span class="linenos">1922</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Cluster</span><span class="p">,</span> +</span><span id="Select-1923"><a href="#Select-1923"><span class="linenos">1923</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1924"><a href="#Select-1924"><span class="linenos">1924</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1925"><a href="#Select-1925"><span class="linenos">1925</span></a> <span class="p">)</span> +</span><span id="Select-1926"><a href="#Select-1926"><span class="linenos">1926</span></a> +</span><span id="Select-1927"><a href="#Select-1927"><span class="linenos">1927</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1928"><a href="#Select-1928"><span class="linenos">1928</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1929"><a href="#Select-1929"><span class="linenos">1929</span></a><span class="sd"> Set the LIMIT expression.</span> +</span><span id="Select-1930"><a href="#Select-1930"><span class="linenos">1930</span></a> +</span><span id="Select-1931"><a href="#Select-1931"><span class="linenos">1931</span></a><span class="sd"> Example:</span> +</span><span id="Select-1932"><a href="#Select-1932"><span class="linenos">1932</span></a><span class="sd"> >>> Select().from_("tbl").select("x").limit(10).sql()</span> +</span><span id="Select-1933"><a href="#Select-1933"><span class="linenos">1933</span></a><span class="sd"> 'SELECT x FROM tbl LIMIT 10'</span> +</span><span id="Select-1934"><a href="#Select-1934"><span class="linenos">1934</span></a> +</span><span id="Select-1935"><a href="#Select-1935"><span class="linenos">1935</span></a><span class="sd"> Args:</span> +</span><span id="Select-1936"><a href="#Select-1936"><span class="linenos">1936</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="Select-1937"><a href="#Select-1937"><span class="linenos">1937</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="Select-1938"><a href="#Select-1938"><span class="linenos">1938</span></a><span class="sd"> If a `Limit` instance is passed, this is used as-is.</span> +</span><span id="Select-1939"><a href="#Select-1939"><span class="linenos">1939</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Limit`.</span> +</span><span id="Select-1940"><a href="#Select-1940"><span class="linenos">1940</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1941"><a href="#Select-1941"><span class="linenos">1941</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1942"><a href="#Select-1942"><span class="linenos">1942</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1943"><a href="#Select-1943"><span class="linenos">1943</span></a> +</span><span id="Select-1944"><a href="#Select-1944"><span class="linenos">1944</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1945"><a href="#Select-1945"><span class="linenos">1945</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1946"><a href="#Select-1946"><span class="linenos">1946</span></a><span class="sd"> """</span> +</span><span id="Select-1947"><a href="#Select-1947"><span class="linenos">1947</span></a> <span class="k">return</span> <span class="n">_apply_builder</span><span class="p">(</span> +</span><span id="Select-1948"><a href="#Select-1948"><span class="linenos">1948</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Select-1949"><a href="#Select-1949"><span class="linenos">1949</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1950"><a href="#Select-1950"><span class="linenos">1950</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"limit"</span><span class="p">,</span> +</span><span id="Select-1951"><a href="#Select-1951"><span class="linenos">1951</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Limit</span><span class="p">,</span> +</span><span id="Select-1952"><a href="#Select-1952"><span class="linenos">1952</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"LIMIT"</span><span class="p">,</span> +</span><span id="Select-1953"><a href="#Select-1953"><span class="linenos">1953</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1954"><a href="#Select-1954"><span class="linenos">1954</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1955"><a href="#Select-1955"><span class="linenos">1955</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1956"><a href="#Select-1956"><span class="linenos">1956</span></a> <span class="p">)</span> +</span><span id="Select-1957"><a href="#Select-1957"><span class="linenos">1957</span></a> +</span><span id="Select-1958"><a href="#Select-1958"><span class="linenos">1958</span></a> <span class="k">def</span> <span class="nf">offset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1959"><a href="#Select-1959"><span class="linenos">1959</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1960"><a href="#Select-1960"><span class="linenos">1960</span></a><span class="sd"> Set the OFFSET expression.</span> +</span><span id="Select-1961"><a href="#Select-1961"><span class="linenos">1961</span></a> +</span><span id="Select-1962"><a href="#Select-1962"><span class="linenos">1962</span></a><span class="sd"> Example:</span> +</span><span id="Select-1963"><a href="#Select-1963"><span class="linenos">1963</span></a><span class="sd"> >>> Select().from_("tbl").select("x").offset(10).sql()</span> +</span><span id="Select-1964"><a href="#Select-1964"><span class="linenos">1964</span></a><span class="sd"> 'SELECT x FROM tbl OFFSET 10'</span> +</span><span id="Select-1965"><a href="#Select-1965"><span class="linenos">1965</span></a> +</span><span id="Select-1966"><a href="#Select-1966"><span class="linenos">1966</span></a><span class="sd"> Args:</span> +</span><span id="Select-1967"><a href="#Select-1967"><span class="linenos">1967</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="Select-1968"><a href="#Select-1968"><span class="linenos">1968</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="Select-1969"><a href="#Select-1969"><span class="linenos">1969</span></a><span class="sd"> If a `Offset` instance is passed, this is used as-is.</span> +</span><span id="Select-1970"><a href="#Select-1970"><span class="linenos">1970</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Offset`.</span> +</span><span id="Select-1971"><a href="#Select-1971"><span class="linenos">1971</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select-1972"><a href="#Select-1972"><span class="linenos">1972</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-1973"><a href="#Select-1973"><span class="linenos">1973</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-1974"><a href="#Select-1974"><span class="linenos">1974</span></a> +</span><span id="Select-1975"><a href="#Select-1975"><span class="linenos">1975</span></a><span class="sd"> Returns:</span> +</span><span id="Select-1976"><a href="#Select-1976"><span class="linenos">1976</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-1977"><a href="#Select-1977"><span class="linenos">1977</span></a><span class="sd"> """</span> +</span><span id="Select-1978"><a href="#Select-1978"><span class="linenos">1978</span></a> <span class="k">return</span> <span class="n">_apply_builder</span><span class="p">(</span> +</span><span id="Select-1979"><a href="#Select-1979"><span class="linenos">1979</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Select-1980"><a href="#Select-1980"><span class="linenos">1980</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-1981"><a href="#Select-1981"><span class="linenos">1981</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"offset"</span><span class="p">,</span> +</span><span id="Select-1982"><a href="#Select-1982"><span class="linenos">1982</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Offset</span><span class="p">,</span> +</span><span id="Select-1983"><a href="#Select-1983"><span class="linenos">1983</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"OFFSET"</span><span class="p">,</span> +</span><span id="Select-1984"><a href="#Select-1984"><span class="linenos">1984</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-1985"><a href="#Select-1985"><span class="linenos">1985</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-1986"><a href="#Select-1986"><span class="linenos">1986</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-1987"><a href="#Select-1987"><span class="linenos">1987</span></a> <span class="p">)</span> +</span><span id="Select-1988"><a href="#Select-1988"><span class="linenos">1988</span></a> +</span><span id="Select-1989"><a href="#Select-1989"><span class="linenos">1989</span></a> <span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-1990"><a href="#Select-1990"><span class="linenos">1990</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-1991"><a href="#Select-1991"><span class="linenos">1991</span></a><span class="sd"> Append to or set the SELECT expressions.</span> +</span><span id="Select-1992"><a href="#Select-1992"><span class="linenos">1992</span></a> +</span><span id="Select-1993"><a href="#Select-1993"><span class="linenos">1993</span></a><span class="sd"> Example:</span> +</span><span id="Select-1994"><a href="#Select-1994"><span class="linenos">1994</span></a><span class="sd"> >>> Select().select("x", "y").sql()</span> +</span><span id="Select-1995"><a href="#Select-1995"><span class="linenos">1995</span></a><span class="sd"> 'SELECT x, y'</span> +</span><span id="Select-1996"><a href="#Select-1996"><span class="linenos">1996</span></a> +</span><span id="Select-1997"><a href="#Select-1997"><span class="linenos">1997</span></a><span class="sd"> Args:</span> +</span><span id="Select-1998"><a href="#Select-1998"><span class="linenos">1998</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-1999"><a href="#Select-1999"><span class="linenos">1999</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2000"><a href="#Select-2000"><span class="linenos">2000</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-2001"><a href="#Select-2001"><span class="linenos">2001</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Select-2002"><a href="#Select-2002"><span class="linenos">2002</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select-2003"><a href="#Select-2003"><span class="linenos">2003</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2004"><a href="#Select-2004"><span class="linenos">2004</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-2005"><a href="#Select-2005"><span class="linenos">2005</span></a> +</span><span id="Select-2006"><a href="#Select-2006"><span class="linenos">2006</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2007"><a href="#Select-2007"><span class="linenos">2007</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-2008"><a href="#Select-2008"><span class="linenos">2008</span></a><span class="sd"> """</span> +</span><span id="Select-2009"><a href="#Select-2009"><span class="linenos">2009</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select-2010"><a href="#Select-2010"><span class="linenos">2010</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-2011"><a href="#Select-2011"><span class="linenos">2011</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2012"><a href="#Select-2012"><span class="linenos">2012</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="Select-2013"><a href="#Select-2013"><span class="linenos">2013</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2014"><a href="#Select-2014"><span class="linenos">2014</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-2015"><a href="#Select-2015"><span class="linenos">2015</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2016"><a href="#Select-2016"><span class="linenos">2016</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2017"><a href="#Select-2017"><span class="linenos">2017</span></a> <span class="p">)</span> +</span><span id="Select-2018"><a href="#Select-2018"><span class="linenos">2018</span></a> +</span><span id="Select-2019"><a href="#Select-2019"><span class="linenos">2019</span></a> <span class="k">def</span> <span class="nf">lateral</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2020"><a href="#Select-2020"><span class="linenos">2020</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2021"><a href="#Select-2021"><span class="linenos">2021</span></a><span class="sd"> Append to or set the LATERAL expressions.</span> +</span><span id="Select-2022"><a href="#Select-2022"><span class="linenos">2022</span></a> +</span><span id="Select-2023"><a href="#Select-2023"><span class="linenos">2023</span></a><span class="sd"> Example:</span> +</span><span id="Select-2024"><a href="#Select-2024"><span class="linenos">2024</span></a><span class="sd"> >>> Select().select("x").lateral("OUTER explode(y) tbl2 AS z").from_("tbl").sql()</span> +</span><span id="Select-2025"><a href="#Select-2025"><span class="linenos">2025</span></a><span class="sd"> 'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z'</span> +</span><span id="Select-2026"><a href="#Select-2026"><span class="linenos">2026</span></a> +</span><span id="Select-2027"><a href="#Select-2027"><span class="linenos">2027</span></a><span class="sd"> Args:</span> +</span><span id="Select-2028"><a href="#Select-2028"><span class="linenos">2028</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-2029"><a href="#Select-2029"><span class="linenos">2029</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2030"><a href="#Select-2030"><span class="linenos">2030</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-2031"><a href="#Select-2031"><span class="linenos">2031</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Select-2032"><a href="#Select-2032"><span class="linenos">2032</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select-2033"><a href="#Select-2033"><span class="linenos">2033</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2034"><a href="#Select-2034"><span class="linenos">2034</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-2035"><a href="#Select-2035"><span class="linenos">2035</span></a> +</span><span id="Select-2036"><a href="#Select-2036"><span class="linenos">2036</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2037"><a href="#Select-2037"><span class="linenos">2037</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-2038"><a href="#Select-2038"><span class="linenos">2038</span></a><span class="sd"> """</span> +</span><span id="Select-2039"><a href="#Select-2039"><span class="linenos">2039</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select-2040"><a href="#Select-2040"><span class="linenos">2040</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-2041"><a href="#Select-2041"><span class="linenos">2041</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2042"><a href="#Select-2042"><span class="linenos">2042</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"laterals"</span><span class="p">,</span> +</span><span id="Select-2043"><a href="#Select-2043"><span class="linenos">2043</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2044"><a href="#Select-2044"><span class="linenos">2044</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Lateral</span><span class="p">,</span> +</span><span id="Select-2045"><a href="#Select-2045"><span class="linenos">2045</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"LATERAL VIEW"</span><span class="p">,</span> +</span><span id="Select-2046"><a href="#Select-2046"><span class="linenos">2046</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-2047"><a href="#Select-2047"><span class="linenos">2047</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2048"><a href="#Select-2048"><span class="linenos">2048</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2049"><a href="#Select-2049"><span class="linenos">2049</span></a> <span class="p">)</span> +</span><span id="Select-2050"><a href="#Select-2050"><span class="linenos">2050</span></a> +</span><span id="Select-2051"><a href="#Select-2051"><span class="linenos">2051</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span> +</span><span id="Select-2052"><a href="#Select-2052"><span class="linenos">2052</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2053"><a href="#Select-2053"><span class="linenos">2053</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Select-2054"><a href="#Select-2054"><span class="linenos">2054</span></a> <span class="n">on</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select-2055"><a href="#Select-2055"><span class="linenos">2055</span></a> <span class="n">using</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select-2056"><a href="#Select-2056"><span class="linenos">2056</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Select-2057"><a href="#Select-2057"><span class="linenos">2057</span></a> <span class="n">join_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select-2058"><a href="#Select-2058"><span class="linenos">2058</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select-2059"><a href="#Select-2059"><span class="linenos">2059</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select-2060"><a href="#Select-2060"><span class="linenos">2060</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Select-2061"><a href="#Select-2061"><span class="linenos">2061</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2062"><a href="#Select-2062"><span class="linenos">2062</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2063"><a href="#Select-2063"><span class="linenos">2063</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2064"><a href="#Select-2064"><span class="linenos">2064</span></a><span class="sd"> Append to or set the JOIN expressions.</span> +</span><span id="Select-2065"><a href="#Select-2065"><span class="linenos">2065</span></a> +</span><span id="Select-2066"><a href="#Select-2066"><span class="linenos">2066</span></a><span class="sd"> Example:</span> +</span><span id="Select-2067"><a href="#Select-2067"><span class="linenos">2067</span></a><span class="sd"> >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql()</span> +</span><span id="Select-2068"><a href="#Select-2068"><span class="linenos">2068</span></a><span class="sd"> 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</span><span id="Select-2069"><a href="#Select-2069"><span class="linenos">2069</span></a> +</span><span id="Select-2070"><a href="#Select-2070"><span class="linenos">2070</span></a><span class="sd"> >>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql()</span> +</span><span id="Select-2071"><a href="#Select-2071"><span class="linenos">2071</span></a><span class="sd"> 'SELECT 1 FROM a JOIN b USING (x, y, z)'</span> +</span><span id="Select-2072"><a href="#Select-2072"><span class="linenos">2072</span></a> +</span><span id="Select-2073"><a href="#Select-2073"><span class="linenos">2073</span></a><span class="sd"> Use `join_type` to change the type of join:</span> +</span><span id="Select-2074"><a href="#Select-2074"><span class="linenos">2074</span></a> +</span><span id="Select-2075"><a href="#Select-2075"><span class="linenos">2075</span></a><span class="sd"> >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y", join_type="left outer").sql()</span> +</span><span id="Select-2076"><a href="#Select-2076"><span class="linenos">2076</span></a><span class="sd"> 'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</span><span id="Select-2077"><a href="#Select-2077"><span class="linenos">2077</span></a> +</span><span id="Select-2078"><a href="#Select-2078"><span class="linenos">2078</span></a><span class="sd"> Args:</span> +</span><span id="Select-2079"><a href="#Select-2079"><span class="linenos">2079</span></a><span class="sd"> expression (str | Expression): the SQL code string to parse.</span> +</span><span id="Select-2080"><a href="#Select-2080"><span class="linenos">2080</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2081"><a href="#Select-2081"><span class="linenos">2081</span></a><span class="sd"> on (str | Expression): optionally specify the join "on" criteria as a SQL string.</span> +</span><span id="Select-2082"><a href="#Select-2082"><span class="linenos">2082</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2083"><a href="#Select-2083"><span class="linenos">2083</span></a><span class="sd"> using (str | Expression): optionally specify the join "using" criteria as a SQL string.</span> +</span><span id="Select-2084"><a href="#Select-2084"><span class="linenos">2084</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2085"><a href="#Select-2085"><span class="linenos">2085</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select-2086"><a href="#Select-2086"><span class="linenos">2086</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Select-2087"><a href="#Select-2087"><span class="linenos">2087</span></a><span class="sd"> join_type (str): If set, alter the parsed join type</span> +</span><span id="Select-2088"><a href="#Select-2088"><span class="linenos">2088</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select-2089"><a href="#Select-2089"><span class="linenos">2089</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2090"><a href="#Select-2090"><span class="linenos">2090</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-2091"><a href="#Select-2091"><span class="linenos">2091</span></a> +</span><span id="Select-2092"><a href="#Select-2092"><span class="linenos">2092</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2093"><a href="#Select-2093"><span class="linenos">2093</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-2094"><a href="#Select-2094"><span class="linenos">2094</span></a><span class="sd"> """</span> +</span><span id="Select-2095"><a href="#Select-2095"><span class="linenos">2095</span></a> <span class="n">parse_args</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">}</span> +</span><span id="Select-2096"><a href="#Select-2096"><span class="linenos">2096</span></a> +</span><span id="Select-2097"><a href="#Select-2097"><span class="linenos">2097</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Select-2098"><a href="#Select-2098"><span class="linenos">2098</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Join</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"JOIN"</span><span class="p">,</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> +</span><span id="Select-2099"><a href="#Select-2099"><span class="linenos">2099</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="Select-2100"><a href="#Select-2100"><span class="linenos">2100</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="p">(</span><span class="n">Join</span><span class="p">,</span> <span class="n">Expression</span><span class="p">),</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> +</span><span id="Select-2101"><a href="#Select-2101"><span class="linenos">2101</span></a> +</span><span id="Select-2102"><a href="#Select-2102"><span class="linenos">2102</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">expression</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Join</span><span class="p">)</span> <span class="k">else</span> <span class="n">Join</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Select-2103"><a href="#Select-2103"><span class="linenos">2103</span></a> +</span><span id="Select-2104"><a href="#Select-2104"><span class="linenos">2104</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">Select</span><span class="p">):</span> +</span><span id="Select-2105"><a href="#Select-2105"><span class="linenos">2105</span></a> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">subquery</span><span class="p">())</span> +</span><span id="Select-2106"><a href="#Select-2106"><span class="linenos">2106</span></a> +</span><span id="Select-2107"><a href="#Select-2107"><span class="linenos">2107</span></a> <span class="k">if</span> <span class="n">join_type</span><span class="p">:</span> +</span><span id="Select-2108"><a href="#Select-2108"><span class="linenos">2108</span></a> <span class="n">natural</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="Select-2109"><a href="#Select-2109"><span class="linenos">2109</span></a> <span class="n">side</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="Select-2110"><a href="#Select-2110"><span class="linenos">2110</span></a> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="Select-2111"><a href="#Select-2111"><span class="linenos">2111</span></a> +</span><span id="Select-2112"><a href="#Select-2112"><span class="linenos">2112</span></a> <span class="n">natural</span><span class="p">,</span> <span class="n">side</span><span class="p">,</span> <span class="n">kind</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">join_type</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="s2">"JOIN_TYPE"</span><span class="p">,</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Select-2113"><a href="#Select-2113"><span class="linenos">2113</span></a> +</span><span id="Select-2114"><a href="#Select-2114"><span class="linenos">2114</span></a> <span class="k">if</span> <span class="n">natural</span><span class="p">:</span> +</span><span id="Select-2115"><a href="#Select-2115"><span class="linenos">2115</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"natural"</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span><span id="Select-2116"><a href="#Select-2116"><span class="linenos">2116</span></a> <span class="k">if</span> <span class="n">side</span><span class="p">:</span> +</span><span id="Select-2117"><a href="#Select-2117"><span class="linenos">2117</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"side"</span><span class="p">,</span> <span class="n">side</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Select-2118"><a href="#Select-2118"><span class="linenos">2118</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Select-2119"><a href="#Select-2119"><span class="linenos">2119</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="n">kind</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Select-2120"><a href="#Select-2120"><span class="linenos">2120</span></a> +</span><span id="Select-2121"><a href="#Select-2121"><span class="linenos">2121</span></a> <span class="k">if</span> <span class="n">on</span><span class="p">:</span> +</span><span id="Select-2122"><a href="#Select-2122"><span class="linenos">2122</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">and_</span><span class="p">(</span><span class="o">*</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">on</span><span class="p">),</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Select-2123"><a href="#Select-2123"><span class="linenos">2123</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="n">on</span><span class="p">)</span> +</span><span id="Select-2124"><a href="#Select-2124"><span class="linenos">2124</span></a> +</span><span id="Select-2125"><a href="#Select-2125"><span class="linenos">2125</span></a> <span class="k">if</span> <span class="n">using</span><span class="p">:</span> +</span><span id="Select-2126"><a href="#Select-2126"><span class="linenos">2126</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select-2127"><a href="#Select-2127"><span class="linenos">2127</span></a> <span class="o">*</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">using</span><span class="p">),</span> +</span><span id="Select-2128"><a href="#Select-2128"><span class="linenos">2128</span></a> <span class="n">instance</span><span class="o">=</span><span class="n">join</span><span class="p">,</span> +</span><span id="Select-2129"><a href="#Select-2129"><span class="linenos">2129</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"using"</span><span class="p">,</span> +</span><span id="Select-2130"><a href="#Select-2130"><span class="linenos">2130</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2131"><a href="#Select-2131"><span class="linenos">2131</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2132"><a href="#Select-2132"><span class="linenos">2132</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2133"><a href="#Select-2133"><span class="linenos">2133</span></a> <span class="p">)</span> +</span><span id="Select-2134"><a href="#Select-2134"><span class="linenos">2134</span></a> +</span><span id="Select-2135"><a href="#Select-2135"><span class="linenos">2135</span></a> <span class="k">if</span> <span class="n">join_alias</span><span class="p">:</span> +</span><span id="Select-2136"><a href="#Select-2136"><span class="linenos">2136</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">alias_</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">join_alias</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Select-2137"><a href="#Select-2137"><span class="linenos">2137</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select-2138"><a href="#Select-2138"><span class="linenos">2138</span></a> <span class="n">join</span><span class="p">,</span> +</span><span id="Select-2139"><a href="#Select-2139"><span class="linenos">2139</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2140"><a href="#Select-2140"><span class="linenos">2140</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"joins"</span><span class="p">,</span> +</span><span id="Select-2141"><a href="#Select-2141"><span class="linenos">2141</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2142"><a href="#Select-2142"><span class="linenos">2142</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2143"><a href="#Select-2143"><span class="linenos">2143</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2144"><a href="#Select-2144"><span class="linenos">2144</span></a> <span class="p">)</span> +</span><span id="Select-2145"><a href="#Select-2145"><span class="linenos">2145</span></a> +</span><span id="Select-2146"><a href="#Select-2146"><span class="linenos">2146</span></a> <span class="k">def</span> <span class="nf">where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2147"><a href="#Select-2147"><span class="linenos">2147</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2148"><a href="#Select-2148"><span class="linenos">2148</span></a><span class="sd"> Append to or set the WHERE expressions.</span> +</span><span id="Select-2149"><a href="#Select-2149"><span class="linenos">2149</span></a> +</span><span id="Select-2150"><a href="#Select-2150"><span class="linenos">2150</span></a><span class="sd"> Example:</span> +</span><span id="Select-2151"><a href="#Select-2151"><span class="linenos">2151</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a' OR x < 'b'").sql()</span> +</span><span id="Select-2152"><a href="#Select-2152"><span class="linenos">2152</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' OR x < 'b'"</span> +</span><span id="Select-2153"><a href="#Select-2153"><span class="linenos">2153</span></a> +</span><span id="Select-2154"><a href="#Select-2154"><span class="linenos">2154</span></a><span class="sd"> Args:</span> +</span><span id="Select-2155"><a href="#Select-2155"><span class="linenos">2155</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-2156"><a href="#Select-2156"><span class="linenos">2156</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2157"><a href="#Select-2157"><span class="linenos">2157</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="Select-2158"><a href="#Select-2158"><span class="linenos">2158</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="Select-2159"><a href="#Select-2159"><span class="linenos">2159</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Select-2160"><a href="#Select-2160"><span class="linenos">2160</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select-2161"><a href="#Select-2161"><span class="linenos">2161</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2162"><a href="#Select-2162"><span class="linenos">2162</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-2163"><a href="#Select-2163"><span class="linenos">2163</span></a> +</span><span id="Select-2164"><a href="#Select-2164"><span class="linenos">2164</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2165"><a href="#Select-2165"><span class="linenos">2165</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-2166"><a href="#Select-2166"><span class="linenos">2166</span></a><span class="sd"> """</span> +</span><span id="Select-2167"><a href="#Select-2167"><span class="linenos">2167</span></a> <span class="k">return</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="Select-2168"><a href="#Select-2168"><span class="linenos">2168</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-2169"><a href="#Select-2169"><span class="linenos">2169</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2170"><a href="#Select-2170"><span class="linenos">2170</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"where"</span><span class="p">,</span> +</span><span id="Select-2171"><a href="#Select-2171"><span class="linenos">2171</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2172"><a href="#Select-2172"><span class="linenos">2172</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> +</span><span id="Select-2173"><a href="#Select-2173"><span class="linenos">2173</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-2174"><a href="#Select-2174"><span class="linenos">2174</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2175"><a href="#Select-2175"><span class="linenos">2175</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2176"><a href="#Select-2176"><span class="linenos">2176</span></a> <span class="p">)</span> +</span><span id="Select-2177"><a href="#Select-2177"><span class="linenos">2177</span></a> +</span><span id="Select-2178"><a href="#Select-2178"><span class="linenos">2178</span></a> <span class="k">def</span> <span class="nf">having</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2179"><a href="#Select-2179"><span class="linenos">2179</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2180"><a href="#Select-2180"><span class="linenos">2180</span></a><span class="sd"> Append to or set the HAVING expressions.</span> +</span><span id="Select-2181"><a href="#Select-2181"><span class="linenos">2181</span></a> +</span><span id="Select-2182"><a href="#Select-2182"><span class="linenos">2182</span></a><span class="sd"> Example:</span> +</span><span id="Select-2183"><a href="#Select-2183"><span class="linenos">2183</span></a><span class="sd"> >>> Select().select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 3").sql()</span> +</span><span id="Select-2184"><a href="#Select-2184"><span class="linenos">2184</span></a><span class="sd"> 'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3'</span> +</span><span id="Select-2185"><a href="#Select-2185"><span class="linenos">2185</span></a> +</span><span id="Select-2186"><a href="#Select-2186"><span class="linenos">2186</span></a><span class="sd"> Args:</span> +</span><span id="Select-2187"><a href="#Select-2187"><span class="linenos">2187</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select-2188"><a href="#Select-2188"><span class="linenos">2188</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2189"><a href="#Select-2189"><span class="linenos">2189</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="Select-2190"><a href="#Select-2190"><span class="linenos">2190</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="Select-2191"><a href="#Select-2191"><span class="linenos">2191</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Select-2192"><a href="#Select-2192"><span class="linenos">2192</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select-2193"><a href="#Select-2193"><span class="linenos">2193</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2194"><a href="#Select-2194"><span class="linenos">2194</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select-2195"><a href="#Select-2195"><span class="linenos">2195</span></a> +</span><span id="Select-2196"><a href="#Select-2196"><span class="linenos">2196</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2197"><a href="#Select-2197"><span class="linenos">2197</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-2198"><a href="#Select-2198"><span class="linenos">2198</span></a><span class="sd"> """</span> +</span><span id="Select-2199"><a href="#Select-2199"><span class="linenos">2199</span></a> <span class="k">return</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="Select-2200"><a href="#Select-2200"><span class="linenos">2200</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-2201"><a href="#Select-2201"><span class="linenos">2201</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2202"><a href="#Select-2202"><span class="linenos">2202</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"having"</span><span class="p">,</span> +</span><span id="Select-2203"><a href="#Select-2203"><span class="linenos">2203</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2204"><a href="#Select-2204"><span class="linenos">2204</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Having</span><span class="p">,</span> +</span><span id="Select-2205"><a href="#Select-2205"><span class="linenos">2205</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-2206"><a href="#Select-2206"><span class="linenos">2206</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2207"><a href="#Select-2207"><span class="linenos">2207</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2208"><a href="#Select-2208"><span class="linenos">2208</span></a> <span class="p">)</span> +</span><span id="Select-2209"><a href="#Select-2209"><span class="linenos">2209</span></a> +</span><span id="Select-2210"><a href="#Select-2210"><span class="linenos">2210</span></a> <span class="k">def</span> <span class="nf">window</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2211"><a href="#Select-2211"><span class="linenos">2211</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select-2212"><a href="#Select-2212"><span class="linenos">2212</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select-2213"><a href="#Select-2213"><span class="linenos">2213</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select-2214"><a href="#Select-2214"><span class="linenos">2214</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"windows"</span><span class="p">,</span> +</span><span id="Select-2215"><a href="#Select-2215"><span class="linenos">2215</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select-2216"><a href="#Select-2216"><span class="linenos">2216</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Window</span><span class="p">,</span> +</span><span id="Select-2217"><a href="#Select-2217"><span class="linenos">2217</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-2218"><a href="#Select-2218"><span class="linenos">2218</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select-2219"><a href="#Select-2219"><span class="linenos">2219</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2220"><a href="#Select-2220"><span class="linenos">2220</span></a> <span class="p">)</span> +</span><span id="Select-2221"><a href="#Select-2221"><span class="linenos">2221</span></a> +</span><span id="Select-2222"><a href="#Select-2222"><span class="linenos">2222</span></a> <span class="k">def</span> <span class="nf">distinct</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2223"><a href="#Select-2223"><span class="linenos">2223</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2224"><a href="#Select-2224"><span class="linenos">2224</span></a><span class="sd"> Set the OFFSET expression.</span> +</span><span id="Select-2225"><a href="#Select-2225"><span class="linenos">2225</span></a> +</span><span id="Select-2226"><a href="#Select-2226"><span class="linenos">2226</span></a><span class="sd"> Example:</span> +</span><span id="Select-2227"><a href="#Select-2227"><span class="linenos">2227</span></a><span class="sd"> >>> Select().from_("tbl").select("x").distinct().sql()</span> +</span><span id="Select-2228"><a href="#Select-2228"><span class="linenos">2228</span></a><span class="sd"> 'SELECT DISTINCT x FROM tbl'</span> +</span><span id="Select-2229"><a href="#Select-2229"><span class="linenos">2229</span></a> +</span><span id="Select-2230"><a href="#Select-2230"><span class="linenos">2230</span></a><span class="sd"> Args:</span> +</span><span id="Select-2231"><a href="#Select-2231"><span class="linenos">2231</span></a><span class="sd"> distinct (bool): whether the Select should be distinct</span> +</span><span id="Select-2232"><a href="#Select-2232"><span class="linenos">2232</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2233"><a href="#Select-2233"><span class="linenos">2233</span></a> +</span><span id="Select-2234"><a href="#Select-2234"><span class="linenos">2234</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2235"><a href="#Select-2235"><span class="linenos">2235</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select-2236"><a href="#Select-2236"><span class="linenos">2236</span></a><span class="sd"> """</span> +</span><span id="Select-2237"><a href="#Select-2237"><span class="linenos">2237</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Select-2238"><a href="#Select-2238"><span class="linenos">2238</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="n">Distinct</span><span class="p">()</span> <span class="k">if</span> <span class="n">distinct</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Select-2239"><a href="#Select-2239"><span class="linenos">2239</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="Select-2240"><a href="#Select-2240"><span class="linenos">2240</span></a> +</span><span id="Select-2241"><a href="#Select-2241"><span class="linenos">2241</span></a> <span class="k">def</span> <span class="nf">ctas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">properties</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Create</span><span class="p">:</span> +</span><span id="Select-2242"><a href="#Select-2242"><span class="linenos">2242</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2243"><a href="#Select-2243"><span class="linenos">2243</span></a><span class="sd"> Convert this expression to a CREATE TABLE AS statement.</span> +</span><span id="Select-2244"><a href="#Select-2244"><span class="linenos">2244</span></a> +</span><span id="Select-2245"><a href="#Select-2245"><span class="linenos">2245</span></a><span class="sd"> Example:</span> +</span><span id="Select-2246"><a href="#Select-2246"><span class="linenos">2246</span></a><span class="sd"> >>> Select().select("*").from_("tbl").ctas("x").sql()</span> +</span><span id="Select-2247"><a href="#Select-2247"><span class="linenos">2247</span></a><span class="sd"> 'CREATE TABLE x AS SELECT * FROM tbl'</span> +</span><span id="Select-2248"><a href="#Select-2248"><span class="linenos">2248</span></a> +</span><span id="Select-2249"><a href="#Select-2249"><span class="linenos">2249</span></a><span class="sd"> Args:</span> +</span><span id="Select-2250"><a href="#Select-2250"><span class="linenos">2250</span></a><span class="sd"> table (str | Expression): the SQL code string to parse as the table name.</span> +</span><span id="Select-2251"><a href="#Select-2251"><span class="linenos">2251</span></a><span class="sd"> If another `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select-2252"><a href="#Select-2252"><span class="linenos">2252</span></a><span class="sd"> properties (dict): an optional mapping of table properties</span> +</span><span id="Select-2253"><a href="#Select-2253"><span class="linenos">2253</span></a><span class="sd"> dialect (str): the dialect used to parse the input table.</span> +</span><span id="Select-2254"><a href="#Select-2254"><span class="linenos">2254</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2255"><a href="#Select-2255"><span class="linenos">2255</span></a><span class="sd"> opts (kwargs): other options to use to parse the input table.</span> +</span><span id="Select-2256"><a href="#Select-2256"><span class="linenos">2256</span></a> +</span><span id="Select-2257"><a href="#Select-2257"><span class="linenos">2257</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2258"><a href="#Select-2258"><span class="linenos">2258</span></a><span class="sd"> Create: the CREATE TABLE AS expression</span> +</span><span id="Select-2259"><a href="#Select-2259"><span class="linenos">2259</span></a><span class="sd"> """</span> +</span><span id="Select-2260"><a href="#Select-2260"><span class="linenos">2260</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Select-2261"><a href="#Select-2261"><span class="linenos">2261</span></a> <span class="n">table_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="Select-2262"><a href="#Select-2262"><span class="linenos">2262</span></a> <span class="n">table</span><span class="p">,</span> +</span><span id="Select-2263"><a href="#Select-2263"><span class="linenos">2263</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> +</span><span id="Select-2264"><a href="#Select-2264"><span class="linenos">2264</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select-2265"><a href="#Select-2265"><span class="linenos">2265</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select-2266"><a href="#Select-2266"><span class="linenos">2266</span></a> <span class="p">)</span> +</span><span id="Select-2267"><a href="#Select-2267"><span class="linenos">2267</span></a> <span class="n">properties_expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Select-2268"><a href="#Select-2268"><span class="linenos">2268</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="Select-2269"><a href="#Select-2269"><span class="linenos">2269</span></a> <span class="n">properties_expression</span> <span class="o">=</span> <span class="n">Properties</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> +</span><span id="Select-2270"><a href="#Select-2270"><span class="linenos">2270</span></a> +</span><span id="Select-2271"><a href="#Select-2271"><span class="linenos">2271</span></a> <span class="k">return</span> <span class="n">Create</span><span class="p">(</span> +</span><span id="Select-2272"><a href="#Select-2272"><span class="linenos">2272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">table_expression</span><span class="p">,</span> +</span><span id="Select-2273"><a href="#Select-2273"><span class="linenos">2273</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"table"</span><span class="p">,</span> +</span><span id="Select-2274"><a href="#Select-2274"><span class="linenos">2274</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">instance</span><span class="p">,</span> +</span><span id="Select-2275"><a href="#Select-2275"><span class="linenos">2275</span></a> <span class="n">properties</span><span class="o">=</span><span class="n">properties_expression</span><span class="p">,</span> +</span><span id="Select-2276"><a href="#Select-2276"><span class="linenos">2276</span></a> <span class="p">)</span> +</span><span id="Select-2277"><a href="#Select-2277"><span class="linenos">2277</span></a> +</span><span id="Select-2278"><a href="#Select-2278"><span class="linenos">2278</span></a> <span class="k">def</span> <span class="nf">lock</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select-2279"><a href="#Select-2279"><span class="linenos">2279</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select-2280"><a href="#Select-2280"><span class="linenos">2280</span></a><span class="sd"> Set the locking read mode for this expression.</span> +</span><span id="Select-2281"><a href="#Select-2281"><span class="linenos">2281</span></a> +</span><span id="Select-2282"><a href="#Select-2282"><span class="linenos">2282</span></a><span class="sd"> Examples:</span> +</span><span id="Select-2283"><a href="#Select-2283"><span class="linenos">2283</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a'").lock().sql("mysql")</span> +</span><span id="Select-2284"><a href="#Select-2284"><span class="linenos">2284</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' FOR UPDATE"</span> +</span><span id="Select-2285"><a href="#Select-2285"><span class="linenos">2285</span></a> +</span><span id="Select-2286"><a href="#Select-2286"><span class="linenos">2286</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a'").lock(update=False).sql("mysql")</span> +</span><span id="Select-2287"><a href="#Select-2287"><span class="linenos">2287</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' FOR SHARE"</span> +</span><span id="Select-2288"><a href="#Select-2288"><span class="linenos">2288</span></a> +</span><span id="Select-2289"><a href="#Select-2289"><span class="linenos">2289</span></a><span class="sd"> Args:</span> +</span><span id="Select-2290"><a href="#Select-2290"><span class="linenos">2290</span></a><span class="sd"> update: if `True`, the locking type will be `FOR UPDATE`, else it will be `FOR SHARE`.</span> +</span><span id="Select-2291"><a href="#Select-2291"><span class="linenos">2291</span></a><span class="sd"> copy: if `False`, modify this expression instance in-place.</span> +</span><span id="Select-2292"><a href="#Select-2292"><span class="linenos">2292</span></a> +</span><span id="Select-2293"><a href="#Select-2293"><span class="linenos">2293</span></a><span class="sd"> Returns:</span> +</span><span id="Select-2294"><a href="#Select-2294"><span class="linenos">2294</span></a><span class="sd"> The modified expression.</span> +</span><span id="Select-2295"><a href="#Select-2295"><span class="linenos">2295</span></a><span class="sd"> """</span> +</span><span id="Select-2296"><a href="#Select-2296"><span class="linenos">2296</span></a> +</span><span id="Select-2297"><a href="#Select-2297"><span class="linenos">2297</span></a> <span class="n">inst</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Select-2298"><a href="#Select-2298"><span class="linenos">2298</span></a> <span class="n">inst</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"lock"</span><span class="p">,</span> <span class="n">Lock</span><span class="p">(</span><span class="n">update</span><span class="o">=</span><span class="n">update</span><span class="p">))</span> +</span><span id="Select-2299"><a href="#Select-2299"><span class="linenos">2299</span></a> +</span><span id="Select-2300"><a href="#Select-2300"><span class="linenos">2300</span></a> <span class="k">return</span> <span class="n">inst</span> +</span><span id="Select-2301"><a href="#Select-2301"><span class="linenos">2301</span></a> +</span><span id="Select-2302"><a href="#Select-2302"><span class="linenos">2302</span></a> <span class="nd">@property</span> +</span><span id="Select-2303"><a href="#Select-2303"><span class="linenos">2303</span></a> <span class="k">def</span> <span class="nf">named_selects</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Select-2304"><a href="#Select-2304"><span class="linenos">2304</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">e</span><span class="o">.</span><span class="n">output_name</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> +</span><span id="Select-2305"><a href="#Select-2305"><span class="linenos">2305</span></a> +</span><span id="Select-2306"><a href="#Select-2306"><span class="linenos">2306</span></a> <span class="nd">@property</span> +</span><span id="Select-2307"><a href="#Select-2307"><span class="linenos">2307</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Select-2308"><a href="#Select-2308"><span class="linenos">2308</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span> +</span></pre></div> + + + + + <div id="Select.from_" class="classattr"> + <input id="Select.from_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">from_</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.from_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.from_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.from_-1759"><a href="#Select.from_-1759"><span class="linenos">1759</span></a> <span class="k">def</span> <span class="nf">from_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.from_-1760"><a href="#Select.from_-1760"><span class="linenos">1760</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.from_-1761"><a href="#Select.from_-1761"><span class="linenos">1761</span></a><span class="sd"> Set the FROM expression.</span> +</span><span id="Select.from_-1762"><a href="#Select.from_-1762"><span class="linenos">1762</span></a> +</span><span id="Select.from_-1763"><a href="#Select.from_-1763"><span class="linenos">1763</span></a><span class="sd"> Example:</span> +</span><span id="Select.from_-1764"><a href="#Select.from_-1764"><span class="linenos">1764</span></a><span class="sd"> >>> Select().from_("tbl").select("x").sql()</span> +</span><span id="Select.from_-1765"><a href="#Select.from_-1765"><span class="linenos">1765</span></a><span class="sd"> 'SELECT x FROM tbl'</span> +</span><span id="Select.from_-1766"><a href="#Select.from_-1766"><span class="linenos">1766</span></a> +</span><span id="Select.from_-1767"><a href="#Select.from_-1767"><span class="linenos">1767</span></a><span class="sd"> Args:</span> +</span><span id="Select.from_-1768"><a href="#Select.from_-1768"><span class="linenos">1768</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.from_-1769"><a href="#Select.from_-1769"><span class="linenos">1769</span></a><span class="sd"> If a `From` instance is passed, this is used as-is.</span> +</span><span id="Select.from_-1770"><a href="#Select.from_-1770"><span class="linenos">1770</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `From`.</span> +</span><span id="Select.from_-1771"><a href="#Select.from_-1771"><span class="linenos">1771</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.from_-1772"><a href="#Select.from_-1772"><span class="linenos">1772</span></a><span class="sd"> Otherwise, this flattens all the `From` expression into a single expression.</span> +</span><span id="Select.from_-1773"><a href="#Select.from_-1773"><span class="linenos">1773</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.from_-1774"><a href="#Select.from_-1774"><span class="linenos">1774</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.from_-1775"><a href="#Select.from_-1775"><span class="linenos">1775</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.from_-1776"><a href="#Select.from_-1776"><span class="linenos">1776</span></a> +</span><span id="Select.from_-1777"><a href="#Select.from_-1777"><span class="linenos">1777</span></a><span class="sd"> Returns:</span> +</span><span id="Select.from_-1778"><a href="#Select.from_-1778"><span class="linenos">1778</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.from_-1779"><a href="#Select.from_-1779"><span class="linenos">1779</span></a><span class="sd"> """</span> +</span><span id="Select.from_-1780"><a href="#Select.from_-1780"><span class="linenos">1780</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select.from_-1781"><a href="#Select.from_-1781"><span class="linenos">1781</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.from_-1782"><a href="#Select.from_-1782"><span class="linenos">1782</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.from_-1783"><a href="#Select.from_-1783"><span class="linenos">1783</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"from"</span><span class="p">,</span> +</span><span id="Select.from_-1784"><a href="#Select.from_-1784"><span class="linenos">1784</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.from_-1785"><a href="#Select.from_-1785"><span class="linenos">1785</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.from_-1786"><a href="#Select.from_-1786"><span class="linenos">1786</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> +</span><span id="Select.from_-1787"><a href="#Select.from_-1787"><span class="linenos">1787</span></a> <span class="n">into</span><span class="o">=</span><span class="n">From</span><span class="p">,</span> +</span><span id="Select.from_-1788"><a href="#Select.from_-1788"><span class="linenos">1788</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.from_-1789"><a href="#Select.from_-1789"><span class="linenos">1789</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.from_-1790"><a href="#Select.from_-1790"><span class="linenos">1790</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the FROM expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If a <code><a href="#From">From</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#From">From</a></code>.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this flattens all the <code><a href="#From">From</a></code> expression into a single expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.group_by" class="classattr"> + <input id="Select.group_by-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">group_by</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.group_by-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.group_by"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.group_by-1792"><a href="#Select.group_by-1792"><span class="linenos">1792</span></a> <span class="k">def</span> <span class="nf">group_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.group_by-1793"><a href="#Select.group_by-1793"><span class="linenos">1793</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.group_by-1794"><a href="#Select.group_by-1794"><span class="linenos">1794</span></a><span class="sd"> Set the GROUP BY expression.</span> +</span><span id="Select.group_by-1795"><a href="#Select.group_by-1795"><span class="linenos">1795</span></a> +</span><span id="Select.group_by-1796"><a href="#Select.group_by-1796"><span class="linenos">1796</span></a><span class="sd"> Example:</span> +</span><span id="Select.group_by-1797"><a href="#Select.group_by-1797"><span class="linenos">1797</span></a><span class="sd"> >>> Select().from_("tbl").select("x", "COUNT(1)").group_by("x").sql()</span> +</span><span id="Select.group_by-1798"><a href="#Select.group_by-1798"><span class="linenos">1798</span></a><span class="sd"> 'SELECT x, COUNT(1) FROM tbl GROUP BY x'</span> +</span><span id="Select.group_by-1799"><a href="#Select.group_by-1799"><span class="linenos">1799</span></a> +</span><span id="Select.group_by-1800"><a href="#Select.group_by-1800"><span class="linenos">1800</span></a><span class="sd"> Args:</span> +</span><span id="Select.group_by-1801"><a href="#Select.group_by-1801"><span class="linenos">1801</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.group_by-1802"><a href="#Select.group_by-1802"><span class="linenos">1802</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select.group_by-1803"><a href="#Select.group_by-1803"><span class="linenos">1803</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Group`.</span> +</span><span id="Select.group_by-1804"><a href="#Select.group_by-1804"><span class="linenos">1804</span></a><span class="sd"> If nothing is passed in then a group by is not applied to the expression</span> +</span><span id="Select.group_by-1805"><a href="#Select.group_by-1805"><span class="linenos">1805</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.group_by-1806"><a href="#Select.group_by-1806"><span class="linenos">1806</span></a><span class="sd"> Otherwise, this flattens all the `Group` expression into a single expression.</span> +</span><span id="Select.group_by-1807"><a href="#Select.group_by-1807"><span class="linenos">1807</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.group_by-1808"><a href="#Select.group_by-1808"><span class="linenos">1808</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.group_by-1809"><a href="#Select.group_by-1809"><span class="linenos">1809</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.group_by-1810"><a href="#Select.group_by-1810"><span class="linenos">1810</span></a> +</span><span id="Select.group_by-1811"><a href="#Select.group_by-1811"><span class="linenos">1811</span></a><span class="sd"> Returns:</span> +</span><span id="Select.group_by-1812"><a href="#Select.group_by-1812"><span class="linenos">1812</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.group_by-1813"><a href="#Select.group_by-1813"><span class="linenos">1813</span></a><span class="sd"> """</span> +</span><span id="Select.group_by-1814"><a href="#Select.group_by-1814"><span class="linenos">1814</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="Select.group_by-1815"><a href="#Select.group_by-1815"><span class="linenos">1815</span></a> <span class="k">return</span> <span class="bp">self</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">copy</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Select.group_by-1816"><a href="#Select.group_by-1816"><span class="linenos">1816</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select.group_by-1817"><a href="#Select.group_by-1817"><span class="linenos">1817</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.group_by-1818"><a href="#Select.group_by-1818"><span class="linenos">1818</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.group_by-1819"><a href="#Select.group_by-1819"><span class="linenos">1819</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"group"</span><span class="p">,</span> +</span><span id="Select.group_by-1820"><a href="#Select.group_by-1820"><span class="linenos">1820</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.group_by-1821"><a href="#Select.group_by-1821"><span class="linenos">1821</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.group_by-1822"><a href="#Select.group_by-1822"><span class="linenos">1822</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"GROUP BY"</span><span class="p">,</span> +</span><span id="Select.group_by-1823"><a href="#Select.group_by-1823"><span class="linenos">1823</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Group</span><span class="p">,</span> +</span><span id="Select.group_by-1824"><a href="#Select.group_by-1824"><span class="linenos">1824</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.group_by-1825"><a href="#Select.group_by-1825"><span class="linenos">1825</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.group_by-1826"><a href="#Select.group_by-1826"><span class="linenos">1826</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the GROUP BY expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"COUNT(1)"</span><span class="p">)</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x, COUNT(1) FROM tbl GROUP BY x'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If a <code><a href="#Group">Group</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#Group">Group</a></code>. +If nothing is passed in then a group by is not applied to the expression</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this flattens all the <code><a href="#Group">Group</a></code> expression into a single expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.order_by" class="classattr"> + <input id="Select.order_by-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">order_by</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.order_by-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.order_by"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.order_by-1828"><a href="#Select.order_by-1828"><span class="linenos">1828</span></a> <span class="k">def</span> <span class="nf">order_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.order_by-1829"><a href="#Select.order_by-1829"><span class="linenos">1829</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.order_by-1830"><a href="#Select.order_by-1830"><span class="linenos">1830</span></a><span class="sd"> Set the ORDER BY expression.</span> +</span><span id="Select.order_by-1831"><a href="#Select.order_by-1831"><span class="linenos">1831</span></a> +</span><span id="Select.order_by-1832"><a href="#Select.order_by-1832"><span class="linenos">1832</span></a><span class="sd"> Example:</span> +</span><span id="Select.order_by-1833"><a href="#Select.order_by-1833"><span class="linenos">1833</span></a><span class="sd"> >>> Select().from_("tbl").select("x").order_by("x DESC").sql()</span> +</span><span id="Select.order_by-1834"><a href="#Select.order_by-1834"><span class="linenos">1834</span></a><span class="sd"> 'SELECT x FROM tbl ORDER BY x DESC'</span> +</span><span id="Select.order_by-1835"><a href="#Select.order_by-1835"><span class="linenos">1835</span></a> +</span><span id="Select.order_by-1836"><a href="#Select.order_by-1836"><span class="linenos">1836</span></a><span class="sd"> Args:</span> +</span><span id="Select.order_by-1837"><a href="#Select.order_by-1837"><span class="linenos">1837</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.order_by-1838"><a href="#Select.order_by-1838"><span class="linenos">1838</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select.order_by-1839"><a href="#Select.order_by-1839"><span class="linenos">1839</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Order`.</span> +</span><span id="Select.order_by-1840"><a href="#Select.order_by-1840"><span class="linenos">1840</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.order_by-1841"><a href="#Select.order_by-1841"><span class="linenos">1841</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="Select.order_by-1842"><a href="#Select.order_by-1842"><span class="linenos">1842</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.order_by-1843"><a href="#Select.order_by-1843"><span class="linenos">1843</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.order_by-1844"><a href="#Select.order_by-1844"><span class="linenos">1844</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.order_by-1845"><a href="#Select.order_by-1845"><span class="linenos">1845</span></a> +</span><span id="Select.order_by-1846"><a href="#Select.order_by-1846"><span class="linenos">1846</span></a><span class="sd"> Returns:</span> +</span><span id="Select.order_by-1847"><a href="#Select.order_by-1847"><span class="linenos">1847</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.order_by-1848"><a href="#Select.order_by-1848"><span class="linenos">1848</span></a><span class="sd"> """</span> +</span><span id="Select.order_by-1849"><a href="#Select.order_by-1849"><span class="linenos">1849</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select.order_by-1850"><a href="#Select.order_by-1850"><span class="linenos">1850</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.order_by-1851"><a href="#Select.order_by-1851"><span class="linenos">1851</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.order_by-1852"><a href="#Select.order_by-1852"><span class="linenos">1852</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"order"</span><span class="p">,</span> +</span><span id="Select.order_by-1853"><a href="#Select.order_by-1853"><span class="linenos">1853</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.order_by-1854"><a href="#Select.order_by-1854"><span class="linenos">1854</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.order_by-1855"><a href="#Select.order_by-1855"><span class="linenos">1855</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ORDER BY"</span><span class="p">,</span> +</span><span id="Select.order_by-1856"><a href="#Select.order_by-1856"><span class="linenos">1856</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Order</span><span class="p">,</span> +</span><span id="Select.order_by-1857"><a href="#Select.order_by-1857"><span class="linenos">1857</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.order_by-1858"><a href="#Select.order_by-1858"><span class="linenos">1858</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.order_by-1859"><a href="#Select.order_by-1859"><span class="linenos">1859</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the ORDER BY expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="s2">"x DESC"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl ORDER BY x DESC'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If a <code><a href="#Group">Group</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#Order">Order</a></code>.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this flattens all the <code><a href="#Order">Order</a></code> expression into a single expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.sort_by" class="classattr"> + <input id="Select.sort_by-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sort_by</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.sort_by-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.sort_by"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.sort_by-1861"><a href="#Select.sort_by-1861"><span class="linenos">1861</span></a> <span class="k">def</span> <span class="nf">sort_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.sort_by-1862"><a href="#Select.sort_by-1862"><span class="linenos">1862</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.sort_by-1863"><a href="#Select.sort_by-1863"><span class="linenos">1863</span></a><span class="sd"> Set the SORT BY expression.</span> +</span><span id="Select.sort_by-1864"><a href="#Select.sort_by-1864"><span class="linenos">1864</span></a> +</span><span id="Select.sort_by-1865"><a href="#Select.sort_by-1865"><span class="linenos">1865</span></a><span class="sd"> Example:</span> +</span><span id="Select.sort_by-1866"><a href="#Select.sort_by-1866"><span class="linenos">1866</span></a><span class="sd"> >>> Select().from_("tbl").select("x").sort_by("x DESC").sql()</span> +</span><span id="Select.sort_by-1867"><a href="#Select.sort_by-1867"><span class="linenos">1867</span></a><span class="sd"> 'SELECT x FROM tbl SORT BY x DESC'</span> +</span><span id="Select.sort_by-1868"><a href="#Select.sort_by-1868"><span class="linenos">1868</span></a> +</span><span id="Select.sort_by-1869"><a href="#Select.sort_by-1869"><span class="linenos">1869</span></a><span class="sd"> Args:</span> +</span><span id="Select.sort_by-1870"><a href="#Select.sort_by-1870"><span class="linenos">1870</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.sort_by-1871"><a href="#Select.sort_by-1871"><span class="linenos">1871</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select.sort_by-1872"><a href="#Select.sort_by-1872"><span class="linenos">1872</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `SORT`.</span> +</span><span id="Select.sort_by-1873"><a href="#Select.sort_by-1873"><span class="linenos">1873</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.sort_by-1874"><a href="#Select.sort_by-1874"><span class="linenos">1874</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="Select.sort_by-1875"><a href="#Select.sort_by-1875"><span class="linenos">1875</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.sort_by-1876"><a href="#Select.sort_by-1876"><span class="linenos">1876</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.sort_by-1877"><a href="#Select.sort_by-1877"><span class="linenos">1877</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.sort_by-1878"><a href="#Select.sort_by-1878"><span class="linenos">1878</span></a> +</span><span id="Select.sort_by-1879"><a href="#Select.sort_by-1879"><span class="linenos">1879</span></a><span class="sd"> Returns:</span> +</span><span id="Select.sort_by-1880"><a href="#Select.sort_by-1880"><span class="linenos">1880</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.sort_by-1881"><a href="#Select.sort_by-1881"><span class="linenos">1881</span></a><span class="sd"> """</span> +</span><span id="Select.sort_by-1882"><a href="#Select.sort_by-1882"><span class="linenos">1882</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select.sort_by-1883"><a href="#Select.sort_by-1883"><span class="linenos">1883</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.sort_by-1884"><a href="#Select.sort_by-1884"><span class="linenos">1884</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.sort_by-1885"><a href="#Select.sort_by-1885"><span class="linenos">1885</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"sort"</span><span class="p">,</span> +</span><span id="Select.sort_by-1886"><a href="#Select.sort_by-1886"><span class="linenos">1886</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.sort_by-1887"><a href="#Select.sort_by-1887"><span class="linenos">1887</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.sort_by-1888"><a href="#Select.sort_by-1888"><span class="linenos">1888</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"SORT BY"</span><span class="p">,</span> +</span><span id="Select.sort_by-1889"><a href="#Select.sort_by-1889"><span class="linenos">1889</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Sort</span><span class="p">,</span> +</span><span id="Select.sort_by-1890"><a href="#Select.sort_by-1890"><span class="linenos">1890</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.sort_by-1891"><a href="#Select.sort_by-1891"><span class="linenos">1891</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.sort_by-1892"><a href="#Select.sort_by-1892"><span class="linenos">1892</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the SORT BY expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">sort_by</span><span class="p">(</span><span class="s2">"x DESC"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl SORT BY x DESC'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If a <code><a href="#Group">Group</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code>SORT</code>.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this flattens all the <code><a href="#Order">Order</a></code> expression into a single expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.cluster_by" class="classattr"> + <input id="Select.cluster_by-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cluster_by</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.cluster_by-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.cluster_by"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.cluster_by-1894"><a href="#Select.cluster_by-1894"><span class="linenos">1894</span></a> <span class="k">def</span> <span class="nf">cluster_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.cluster_by-1895"><a href="#Select.cluster_by-1895"><span class="linenos">1895</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.cluster_by-1896"><a href="#Select.cluster_by-1896"><span class="linenos">1896</span></a><span class="sd"> Set the CLUSTER BY expression.</span> +</span><span id="Select.cluster_by-1897"><a href="#Select.cluster_by-1897"><span class="linenos">1897</span></a> +</span><span id="Select.cluster_by-1898"><a href="#Select.cluster_by-1898"><span class="linenos">1898</span></a><span class="sd"> Example:</span> +</span><span id="Select.cluster_by-1899"><a href="#Select.cluster_by-1899"><span class="linenos">1899</span></a><span class="sd"> >>> Select().from_("tbl").select("x").cluster_by("x DESC").sql()</span> +</span><span id="Select.cluster_by-1900"><a href="#Select.cluster_by-1900"><span class="linenos">1900</span></a><span class="sd"> 'SELECT x FROM tbl CLUSTER BY x DESC'</span> +</span><span id="Select.cluster_by-1901"><a href="#Select.cluster_by-1901"><span class="linenos">1901</span></a> +</span><span id="Select.cluster_by-1902"><a href="#Select.cluster_by-1902"><span class="linenos">1902</span></a><span class="sd"> Args:</span> +</span><span id="Select.cluster_by-1903"><a href="#Select.cluster_by-1903"><span class="linenos">1903</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.cluster_by-1904"><a href="#Select.cluster_by-1904"><span class="linenos">1904</span></a><span class="sd"> If a `Group` instance is passed, this is used as-is.</span> +</span><span id="Select.cluster_by-1905"><a href="#Select.cluster_by-1905"><span class="linenos">1905</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Cluster`.</span> +</span><span id="Select.cluster_by-1906"><a href="#Select.cluster_by-1906"><span class="linenos">1906</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.cluster_by-1907"><a href="#Select.cluster_by-1907"><span class="linenos">1907</span></a><span class="sd"> Otherwise, this flattens all the `Order` expression into a single expression.</span> +</span><span id="Select.cluster_by-1908"><a href="#Select.cluster_by-1908"><span class="linenos">1908</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.cluster_by-1909"><a href="#Select.cluster_by-1909"><span class="linenos">1909</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.cluster_by-1910"><a href="#Select.cluster_by-1910"><span class="linenos">1910</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.cluster_by-1911"><a href="#Select.cluster_by-1911"><span class="linenos">1911</span></a> +</span><span id="Select.cluster_by-1912"><a href="#Select.cluster_by-1912"><span class="linenos">1912</span></a><span class="sd"> Returns:</span> +</span><span id="Select.cluster_by-1913"><a href="#Select.cluster_by-1913"><span class="linenos">1913</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.cluster_by-1914"><a href="#Select.cluster_by-1914"><span class="linenos">1914</span></a><span class="sd"> """</span> +</span><span id="Select.cluster_by-1915"><a href="#Select.cluster_by-1915"><span class="linenos">1915</span></a> <span class="k">return</span> <span class="n">_apply_child_list_builder</span><span class="p">(</span> +</span><span id="Select.cluster_by-1916"><a href="#Select.cluster_by-1916"><span class="linenos">1916</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.cluster_by-1917"><a href="#Select.cluster_by-1917"><span class="linenos">1917</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.cluster_by-1918"><a href="#Select.cluster_by-1918"><span class="linenos">1918</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"cluster"</span><span class="p">,</span> +</span><span id="Select.cluster_by-1919"><a href="#Select.cluster_by-1919"><span class="linenos">1919</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.cluster_by-1920"><a href="#Select.cluster_by-1920"><span class="linenos">1920</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.cluster_by-1921"><a href="#Select.cluster_by-1921"><span class="linenos">1921</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"CLUSTER BY"</span><span class="p">,</span> +</span><span id="Select.cluster_by-1922"><a href="#Select.cluster_by-1922"><span class="linenos">1922</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Cluster</span><span class="p">,</span> +</span><span id="Select.cluster_by-1923"><a href="#Select.cluster_by-1923"><span class="linenos">1923</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.cluster_by-1924"><a href="#Select.cluster_by-1924"><span class="linenos">1924</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.cluster_by-1925"><a href="#Select.cluster_by-1925"><span class="linenos">1925</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the CLUSTER BY expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">cluster_by</span><span class="p">(</span><span class="s2">"x DESC"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl CLUSTER BY x DESC'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If a <code><a href="#Group">Group</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#Cluster">Cluster</a></code>.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this flattens all the <code><a href="#Order">Order</a></code> expression into a single expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.limit" class="classattr"> + <input id="Select.limit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">limit</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.limit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.limit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.limit-1927"><a href="#Select.limit-1927"><span class="linenos">1927</span></a> <span class="k">def</span> <span class="nf">limit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.limit-1928"><a href="#Select.limit-1928"><span class="linenos">1928</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.limit-1929"><a href="#Select.limit-1929"><span class="linenos">1929</span></a><span class="sd"> Set the LIMIT expression.</span> +</span><span id="Select.limit-1930"><a href="#Select.limit-1930"><span class="linenos">1930</span></a> +</span><span id="Select.limit-1931"><a href="#Select.limit-1931"><span class="linenos">1931</span></a><span class="sd"> Example:</span> +</span><span id="Select.limit-1932"><a href="#Select.limit-1932"><span class="linenos">1932</span></a><span class="sd"> >>> Select().from_("tbl").select("x").limit(10).sql()</span> +</span><span id="Select.limit-1933"><a href="#Select.limit-1933"><span class="linenos">1933</span></a><span class="sd"> 'SELECT x FROM tbl LIMIT 10'</span> +</span><span id="Select.limit-1934"><a href="#Select.limit-1934"><span class="linenos">1934</span></a> +</span><span id="Select.limit-1935"><a href="#Select.limit-1935"><span class="linenos">1935</span></a><span class="sd"> Args:</span> +</span><span id="Select.limit-1936"><a href="#Select.limit-1936"><span class="linenos">1936</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="Select.limit-1937"><a href="#Select.limit-1937"><span class="linenos">1937</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="Select.limit-1938"><a href="#Select.limit-1938"><span class="linenos">1938</span></a><span class="sd"> If a `Limit` instance is passed, this is used as-is.</span> +</span><span id="Select.limit-1939"><a href="#Select.limit-1939"><span class="linenos">1939</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Limit`.</span> +</span><span id="Select.limit-1940"><a href="#Select.limit-1940"><span class="linenos">1940</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.limit-1941"><a href="#Select.limit-1941"><span class="linenos">1941</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.limit-1942"><a href="#Select.limit-1942"><span class="linenos">1942</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.limit-1943"><a href="#Select.limit-1943"><span class="linenos">1943</span></a> +</span><span id="Select.limit-1944"><a href="#Select.limit-1944"><span class="linenos">1944</span></a><span class="sd"> Returns:</span> +</span><span id="Select.limit-1945"><a href="#Select.limit-1945"><span class="linenos">1945</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.limit-1946"><a href="#Select.limit-1946"><span class="linenos">1946</span></a><span class="sd"> """</span> +</span><span id="Select.limit-1947"><a href="#Select.limit-1947"><span class="linenos">1947</span></a> <span class="k">return</span> <span class="n">_apply_builder</span><span class="p">(</span> +</span><span id="Select.limit-1948"><a href="#Select.limit-1948"><span class="linenos">1948</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Select.limit-1949"><a href="#Select.limit-1949"><span class="linenos">1949</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.limit-1950"><a href="#Select.limit-1950"><span class="linenos">1950</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"limit"</span><span class="p">,</span> +</span><span id="Select.limit-1951"><a href="#Select.limit-1951"><span class="linenos">1951</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Limit</span><span class="p">,</span> +</span><span id="Select.limit-1952"><a href="#Select.limit-1952"><span class="linenos">1952</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"LIMIT"</span><span class="p">,</span> +</span><span id="Select.limit-1953"><a href="#Select.limit-1953"><span class="linenos">1953</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.limit-1954"><a href="#Select.limit-1954"><span class="linenos">1954</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.limit-1955"><a href="#Select.limit-1955"><span class="linenos">1955</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.limit-1956"><a href="#Select.limit-1956"><span class="linenos">1956</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the LIMIT expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">limit</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl LIMIT 10'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | int | Expression):</strong> the SQL code string to parse. +This can also be an integer. +If a <code><a href="#Limit">Limit</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#Limit">Limit</a></code>.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.offset" class="classattr"> + <input id="Select.offset-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">offset</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.offset-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.offset"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.offset-1958"><a href="#Select.offset-1958"><span class="linenos">1958</span></a> <span class="k">def</span> <span class="nf">offset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.offset-1959"><a href="#Select.offset-1959"><span class="linenos">1959</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.offset-1960"><a href="#Select.offset-1960"><span class="linenos">1960</span></a><span class="sd"> Set the OFFSET expression.</span> +</span><span id="Select.offset-1961"><a href="#Select.offset-1961"><span class="linenos">1961</span></a> +</span><span id="Select.offset-1962"><a href="#Select.offset-1962"><span class="linenos">1962</span></a><span class="sd"> Example:</span> +</span><span id="Select.offset-1963"><a href="#Select.offset-1963"><span class="linenos">1963</span></a><span class="sd"> >>> Select().from_("tbl").select("x").offset(10).sql()</span> +</span><span id="Select.offset-1964"><a href="#Select.offset-1964"><span class="linenos">1964</span></a><span class="sd"> 'SELECT x FROM tbl OFFSET 10'</span> +</span><span id="Select.offset-1965"><a href="#Select.offset-1965"><span class="linenos">1965</span></a> +</span><span id="Select.offset-1966"><a href="#Select.offset-1966"><span class="linenos">1966</span></a><span class="sd"> Args:</span> +</span><span id="Select.offset-1967"><a href="#Select.offset-1967"><span class="linenos">1967</span></a><span class="sd"> expression (str | int | Expression): the SQL code string to parse.</span> +</span><span id="Select.offset-1968"><a href="#Select.offset-1968"><span class="linenos">1968</span></a><span class="sd"> This can also be an integer.</span> +</span><span id="Select.offset-1969"><a href="#Select.offset-1969"><span class="linenos">1969</span></a><span class="sd"> If a `Offset` instance is passed, this is used as-is.</span> +</span><span id="Select.offset-1970"><a href="#Select.offset-1970"><span class="linenos">1970</span></a><span class="sd"> If another `Expression` instance is passed, it will be wrapped in a `Offset`.</span> +</span><span id="Select.offset-1971"><a href="#Select.offset-1971"><span class="linenos">1971</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="Select.offset-1972"><a href="#Select.offset-1972"><span class="linenos">1972</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.offset-1973"><a href="#Select.offset-1973"><span class="linenos">1973</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.offset-1974"><a href="#Select.offset-1974"><span class="linenos">1974</span></a> +</span><span id="Select.offset-1975"><a href="#Select.offset-1975"><span class="linenos">1975</span></a><span class="sd"> Returns:</span> +</span><span id="Select.offset-1976"><a href="#Select.offset-1976"><span class="linenos">1976</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.offset-1977"><a href="#Select.offset-1977"><span class="linenos">1977</span></a><span class="sd"> """</span> +</span><span id="Select.offset-1978"><a href="#Select.offset-1978"><span class="linenos">1978</span></a> <span class="k">return</span> <span class="n">_apply_builder</span><span class="p">(</span> +</span><span id="Select.offset-1979"><a href="#Select.offset-1979"><span class="linenos">1979</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Select.offset-1980"><a href="#Select.offset-1980"><span class="linenos">1980</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.offset-1981"><a href="#Select.offset-1981"><span class="linenos">1981</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"offset"</span><span class="p">,</span> +</span><span id="Select.offset-1982"><a href="#Select.offset-1982"><span class="linenos">1982</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Offset</span><span class="p">,</span> +</span><span id="Select.offset-1983"><a href="#Select.offset-1983"><span class="linenos">1983</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"OFFSET"</span><span class="p">,</span> +</span><span id="Select.offset-1984"><a href="#Select.offset-1984"><span class="linenos">1984</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.offset-1985"><a href="#Select.offset-1985"><span class="linenos">1985</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.offset-1986"><a href="#Select.offset-1986"><span class="linenos">1986</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.offset-1987"><a href="#Select.offset-1987"><span class="linenos">1987</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Set the OFFSET expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">offset</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl OFFSET 10'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | int | Expression):</strong> the SQL code string to parse. +This can also be an integer. +If a <code><a href="#Offset">Offset</a></code> instance is passed, this is used as-is. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be wrapped in a <code><a href="#Offset">Offset</a></code>.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.select" class="classattr"> + <input id="Select.select-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">select</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.select-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.select"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.select-1989"><a href="#Select.select-1989"><span class="linenos">1989</span></a> <span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.select-1990"><a href="#Select.select-1990"><span class="linenos">1990</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.select-1991"><a href="#Select.select-1991"><span class="linenos">1991</span></a><span class="sd"> Append to or set the SELECT expressions.</span> +</span><span id="Select.select-1992"><a href="#Select.select-1992"><span class="linenos">1992</span></a> +</span><span id="Select.select-1993"><a href="#Select.select-1993"><span class="linenos">1993</span></a><span class="sd"> Example:</span> +</span><span id="Select.select-1994"><a href="#Select.select-1994"><span class="linenos">1994</span></a><span class="sd"> >>> Select().select("x", "y").sql()</span> +</span><span id="Select.select-1995"><a href="#Select.select-1995"><span class="linenos">1995</span></a><span class="sd"> 'SELECT x, y'</span> +</span><span id="Select.select-1996"><a href="#Select.select-1996"><span class="linenos">1996</span></a> +</span><span id="Select.select-1997"><a href="#Select.select-1997"><span class="linenos">1997</span></a><span class="sd"> Args:</span> +</span><span id="Select.select-1998"><a href="#Select.select-1998"><span class="linenos">1998</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.select-1999"><a href="#Select.select-1999"><span class="linenos">1999</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.select-2000"><a href="#Select.select-2000"><span class="linenos">2000</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.select-2001"><a href="#Select.select-2001"><span class="linenos">2001</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Select.select-2002"><a href="#Select.select-2002"><span class="linenos">2002</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select.select-2003"><a href="#Select.select-2003"><span class="linenos">2003</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.select-2004"><a href="#Select.select-2004"><span class="linenos">2004</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.select-2005"><a href="#Select.select-2005"><span class="linenos">2005</span></a> +</span><span id="Select.select-2006"><a href="#Select.select-2006"><span class="linenos">2006</span></a><span class="sd"> Returns:</span> +</span><span id="Select.select-2007"><a href="#Select.select-2007"><span class="linenos">2007</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.select-2008"><a href="#Select.select-2008"><span class="linenos">2008</span></a><span class="sd"> """</span> +</span><span id="Select.select-2009"><a href="#Select.select-2009"><span class="linenos">2009</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select.select-2010"><a href="#Select.select-2010"><span class="linenos">2010</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.select-2011"><a href="#Select.select-2011"><span class="linenos">2011</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.select-2012"><a href="#Select.select-2012"><span class="linenos">2012</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="Select.select-2013"><a href="#Select.select-2013"><span class="linenos">2013</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.select-2014"><a href="#Select.select-2014"><span class="linenos">2014</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.select-2015"><a href="#Select.select-2015"><span class="linenos">2015</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.select-2016"><a href="#Select.select-2016"><span class="linenos">2016</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.select-2017"><a href="#Select.select-2017"><span class="linenos">2017</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the SELECT expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x, y'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this resets the expressions.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.lateral" class="classattr"> + <input id="Select.lateral-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lateral</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.lateral-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.lateral"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.lateral-2019"><a href="#Select.lateral-2019"><span class="linenos">2019</span></a> <span class="k">def</span> <span class="nf">lateral</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.lateral-2020"><a href="#Select.lateral-2020"><span class="linenos">2020</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.lateral-2021"><a href="#Select.lateral-2021"><span class="linenos">2021</span></a><span class="sd"> Append to or set the LATERAL expressions.</span> +</span><span id="Select.lateral-2022"><a href="#Select.lateral-2022"><span class="linenos">2022</span></a> +</span><span id="Select.lateral-2023"><a href="#Select.lateral-2023"><span class="linenos">2023</span></a><span class="sd"> Example:</span> +</span><span id="Select.lateral-2024"><a href="#Select.lateral-2024"><span class="linenos">2024</span></a><span class="sd"> >>> Select().select("x").lateral("OUTER explode(y) tbl2 AS z").from_("tbl").sql()</span> +</span><span id="Select.lateral-2025"><a href="#Select.lateral-2025"><span class="linenos">2025</span></a><span class="sd"> 'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z'</span> +</span><span id="Select.lateral-2026"><a href="#Select.lateral-2026"><span class="linenos">2026</span></a> +</span><span id="Select.lateral-2027"><a href="#Select.lateral-2027"><span class="linenos">2027</span></a><span class="sd"> Args:</span> +</span><span id="Select.lateral-2028"><a href="#Select.lateral-2028"><span class="linenos">2028</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.lateral-2029"><a href="#Select.lateral-2029"><span class="linenos">2029</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.lateral-2030"><a href="#Select.lateral-2030"><span class="linenos">2030</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.lateral-2031"><a href="#Select.lateral-2031"><span class="linenos">2031</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Select.lateral-2032"><a href="#Select.lateral-2032"><span class="linenos">2032</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select.lateral-2033"><a href="#Select.lateral-2033"><span class="linenos">2033</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.lateral-2034"><a href="#Select.lateral-2034"><span class="linenos">2034</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.lateral-2035"><a href="#Select.lateral-2035"><span class="linenos">2035</span></a> +</span><span id="Select.lateral-2036"><a href="#Select.lateral-2036"><span class="linenos">2036</span></a><span class="sd"> Returns:</span> +</span><span id="Select.lateral-2037"><a href="#Select.lateral-2037"><span class="linenos">2037</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.lateral-2038"><a href="#Select.lateral-2038"><span class="linenos">2038</span></a><span class="sd"> """</span> +</span><span id="Select.lateral-2039"><a href="#Select.lateral-2039"><span class="linenos">2039</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select.lateral-2040"><a href="#Select.lateral-2040"><span class="linenos">2040</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.lateral-2041"><a href="#Select.lateral-2041"><span class="linenos">2041</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.lateral-2042"><a href="#Select.lateral-2042"><span class="linenos">2042</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"laterals"</span><span class="p">,</span> +</span><span id="Select.lateral-2043"><a href="#Select.lateral-2043"><span class="linenos">2043</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.lateral-2044"><a href="#Select.lateral-2044"><span class="linenos">2044</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Lateral</span><span class="p">,</span> +</span><span id="Select.lateral-2045"><a href="#Select.lateral-2045"><span class="linenos">2045</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">"LATERAL VIEW"</span><span class="p">,</span> +</span><span id="Select.lateral-2046"><a href="#Select.lateral-2046"><span class="linenos">2046</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.lateral-2047"><a href="#Select.lateral-2047"><span class="linenos">2047</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.lateral-2048"><a href="#Select.lateral-2048"><span class="linenos">2048</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.lateral-2049"><a href="#Select.lateral-2049"><span class="linenos">2049</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the LATERAL expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">lateral</span><span class="p">(</span><span class="s2">"OUTER explode(y) tbl2 AS z"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM tbl LATERAL VIEW OUTER EXPLODE(y) tbl2 AS z'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this resets the expressions.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.join" class="classattr"> + <input id="Select.join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">join</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">on</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">using</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">join_type</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">join_alias</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.join-2051"><a href="#Select.join-2051"><span class="linenos">2051</span></a> <span class="k">def</span> <span class="nf">join</span><span class="p">(</span> +</span><span id="Select.join-2052"><a href="#Select.join-2052"><span class="linenos">2052</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Select.join-2053"><a href="#Select.join-2053"><span class="linenos">2053</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Select.join-2054"><a href="#Select.join-2054"><span class="linenos">2054</span></a> <span class="n">on</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select.join-2055"><a href="#Select.join-2055"><span class="linenos">2055</span></a> <span class="n">using</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select.join-2056"><a href="#Select.join-2056"><span class="linenos">2056</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Select.join-2057"><a href="#Select.join-2057"><span class="linenos">2057</span></a> <span class="n">join_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select.join-2058"><a href="#Select.join-2058"><span class="linenos">2058</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select.join-2059"><a href="#Select.join-2059"><span class="linenos">2059</span></a> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Select.join-2060"><a href="#Select.join-2060"><span class="linenos">2060</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Select.join-2061"><a href="#Select.join-2061"><span class="linenos">2061</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.join-2062"><a href="#Select.join-2062"><span class="linenos">2062</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.join-2063"><a href="#Select.join-2063"><span class="linenos">2063</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.join-2064"><a href="#Select.join-2064"><span class="linenos">2064</span></a><span class="sd"> Append to or set the JOIN expressions.</span> +</span><span id="Select.join-2065"><a href="#Select.join-2065"><span class="linenos">2065</span></a> +</span><span id="Select.join-2066"><a href="#Select.join-2066"><span class="linenos">2066</span></a><span class="sd"> Example:</span> +</span><span id="Select.join-2067"><a href="#Select.join-2067"><span class="linenos">2067</span></a><span class="sd"> >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y").sql()</span> +</span><span id="Select.join-2068"><a href="#Select.join-2068"><span class="linenos">2068</span></a><span class="sd"> 'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</span><span id="Select.join-2069"><a href="#Select.join-2069"><span class="linenos">2069</span></a> +</span><span id="Select.join-2070"><a href="#Select.join-2070"><span class="linenos">2070</span></a><span class="sd"> >>> Select().select("1").from_("a").join("b", using=["x", "y", "z"]).sql()</span> +</span><span id="Select.join-2071"><a href="#Select.join-2071"><span class="linenos">2071</span></a><span class="sd"> 'SELECT 1 FROM a JOIN b USING (x, y, z)'</span> +</span><span id="Select.join-2072"><a href="#Select.join-2072"><span class="linenos">2072</span></a> +</span><span id="Select.join-2073"><a href="#Select.join-2073"><span class="linenos">2073</span></a><span class="sd"> Use `join_type` to change the type of join:</span> +</span><span id="Select.join-2074"><a href="#Select.join-2074"><span class="linenos">2074</span></a> +</span><span id="Select.join-2075"><a href="#Select.join-2075"><span class="linenos">2075</span></a><span class="sd"> >>> Select().select("*").from_("tbl").join("tbl2", on="tbl1.y = tbl2.y", join_type="left outer").sql()</span> +</span><span id="Select.join-2076"><a href="#Select.join-2076"><span class="linenos">2076</span></a><span class="sd"> 'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</span><span id="Select.join-2077"><a href="#Select.join-2077"><span class="linenos">2077</span></a> +</span><span id="Select.join-2078"><a href="#Select.join-2078"><span class="linenos">2078</span></a><span class="sd"> Args:</span> +</span><span id="Select.join-2079"><a href="#Select.join-2079"><span class="linenos">2079</span></a><span class="sd"> expression (str | Expression): the SQL code string to parse.</span> +</span><span id="Select.join-2080"><a href="#Select.join-2080"><span class="linenos">2080</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.join-2081"><a href="#Select.join-2081"><span class="linenos">2081</span></a><span class="sd"> on (str | Expression): optionally specify the join "on" criteria as a SQL string.</span> +</span><span id="Select.join-2082"><a href="#Select.join-2082"><span class="linenos">2082</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.join-2083"><a href="#Select.join-2083"><span class="linenos">2083</span></a><span class="sd"> using (str | Expression): optionally specify the join "using" criteria as a SQL string.</span> +</span><span id="Select.join-2084"><a href="#Select.join-2084"><span class="linenos">2084</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.join-2085"><a href="#Select.join-2085"><span class="linenos">2085</span></a><span class="sd"> append (bool): if `True`, add to any existing expressions.</span> +</span><span id="Select.join-2086"><a href="#Select.join-2086"><span class="linenos">2086</span></a><span class="sd"> Otherwise, this resets the expressions.</span> +</span><span id="Select.join-2087"><a href="#Select.join-2087"><span class="linenos">2087</span></a><span class="sd"> join_type (str): If set, alter the parsed join type</span> +</span><span id="Select.join-2088"><a href="#Select.join-2088"><span class="linenos">2088</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select.join-2089"><a href="#Select.join-2089"><span class="linenos">2089</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.join-2090"><a href="#Select.join-2090"><span class="linenos">2090</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.join-2091"><a href="#Select.join-2091"><span class="linenos">2091</span></a> +</span><span id="Select.join-2092"><a href="#Select.join-2092"><span class="linenos">2092</span></a><span class="sd"> Returns:</span> +</span><span id="Select.join-2093"><a href="#Select.join-2093"><span class="linenos">2093</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.join-2094"><a href="#Select.join-2094"><span class="linenos">2094</span></a><span class="sd"> """</span> +</span><span id="Select.join-2095"><a href="#Select.join-2095"><span class="linenos">2095</span></a> <span class="n">parse_args</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"dialect"</span><span class="p">:</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">}</span> +</span><span id="Select.join-2096"><a href="#Select.join-2096"><span class="linenos">2096</span></a> +</span><span id="Select.join-2097"><a href="#Select.join-2097"><span class="linenos">2097</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Select.join-2098"><a href="#Select.join-2098"><span class="linenos">2098</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Join</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"JOIN"</span><span class="p">,</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> +</span><span id="Select.join-2099"><a href="#Select.join-2099"><span class="linenos">2099</span></a> <span class="k">except</span> <span class="n">ParseError</span><span class="p">:</span> +</span><span id="Select.join-2100"><a href="#Select.join-2100"><span class="linenos">2100</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="p">(</span><span class="n">Join</span><span class="p">,</span> <span class="n">Expression</span><span class="p">),</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> +</span><span id="Select.join-2101"><a href="#Select.join-2101"><span class="linenos">2101</span></a> +</span><span id="Select.join-2102"><a href="#Select.join-2102"><span class="linenos">2102</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">expression</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Join</span><span class="p">)</span> <span class="k">else</span> <span class="n">Join</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Select.join-2103"><a href="#Select.join-2103"><span class="linenos">2103</span></a> +</span><span id="Select.join-2104"><a href="#Select.join-2104"><span class="linenos">2104</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">Select</span><span class="p">):</span> +</span><span id="Select.join-2105"><a href="#Select.join-2105"><span class="linenos">2105</span></a> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">subquery</span><span class="p">())</span> +</span><span id="Select.join-2106"><a href="#Select.join-2106"><span class="linenos">2106</span></a> +</span><span id="Select.join-2107"><a href="#Select.join-2107"><span class="linenos">2107</span></a> <span class="k">if</span> <span class="n">join_type</span><span class="p">:</span> +</span><span id="Select.join-2108"><a href="#Select.join-2108"><span class="linenos">2108</span></a> <span class="n">natural</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="Select.join-2109"><a href="#Select.join-2109"><span class="linenos">2109</span></a> <span class="n">side</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="Select.join-2110"><a href="#Select.join-2110"><span class="linenos">2110</span></a> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> +</span><span id="Select.join-2111"><a href="#Select.join-2111"><span class="linenos">2111</span></a> +</span><span id="Select.join-2112"><a href="#Select.join-2112"><span class="linenos">2112</span></a> <span class="n">natural</span><span class="p">,</span> <span class="n">side</span><span class="p">,</span> <span class="n">kind</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">join_type</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="s2">"JOIN_TYPE"</span><span class="p">,</span> <span class="o">**</span><span class="n">parse_args</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Select.join-2113"><a href="#Select.join-2113"><span class="linenos">2113</span></a> +</span><span id="Select.join-2114"><a href="#Select.join-2114"><span class="linenos">2114</span></a> <span class="k">if</span> <span class="n">natural</span><span class="p">:</span> +</span><span id="Select.join-2115"><a href="#Select.join-2115"><span class="linenos">2115</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"natural"</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span><span id="Select.join-2116"><a href="#Select.join-2116"><span class="linenos">2116</span></a> <span class="k">if</span> <span class="n">side</span><span class="p">:</span> +</span><span id="Select.join-2117"><a href="#Select.join-2117"><span class="linenos">2117</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"side"</span><span class="p">,</span> <span class="n">side</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Select.join-2118"><a href="#Select.join-2118"><span class="linenos">2118</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Select.join-2119"><a href="#Select.join-2119"><span class="linenos">2119</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="n">kind</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Select.join-2120"><a href="#Select.join-2120"><span class="linenos">2120</span></a> +</span><span id="Select.join-2121"><a href="#Select.join-2121"><span class="linenos">2121</span></a> <span class="k">if</span> <span class="n">on</span><span class="p">:</span> +</span><span id="Select.join-2122"><a href="#Select.join-2122"><span class="linenos">2122</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">and_</span><span class="p">(</span><span class="o">*</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">on</span><span class="p">),</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="Select.join-2123"><a href="#Select.join-2123"><span class="linenos">2123</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="n">on</span><span class="p">)</span> +</span><span id="Select.join-2124"><a href="#Select.join-2124"><span class="linenos">2124</span></a> +</span><span id="Select.join-2125"><a href="#Select.join-2125"><span class="linenos">2125</span></a> <span class="k">if</span> <span class="n">using</span><span class="p">:</span> +</span><span id="Select.join-2126"><a href="#Select.join-2126"><span class="linenos">2126</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select.join-2127"><a href="#Select.join-2127"><span class="linenos">2127</span></a> <span class="o">*</span><span class="n">ensure_collection</span><span class="p">(</span><span class="n">using</span><span class="p">),</span> +</span><span id="Select.join-2128"><a href="#Select.join-2128"><span class="linenos">2128</span></a> <span class="n">instance</span><span class="o">=</span><span class="n">join</span><span class="p">,</span> +</span><span id="Select.join-2129"><a href="#Select.join-2129"><span class="linenos">2129</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"using"</span><span class="p">,</span> +</span><span id="Select.join-2130"><a href="#Select.join-2130"><span class="linenos">2130</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.join-2131"><a href="#Select.join-2131"><span class="linenos">2131</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.join-2132"><a href="#Select.join-2132"><span class="linenos">2132</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.join-2133"><a href="#Select.join-2133"><span class="linenos">2133</span></a> <span class="p">)</span> +</span><span id="Select.join-2134"><a href="#Select.join-2134"><span class="linenos">2134</span></a> +</span><span id="Select.join-2135"><a href="#Select.join-2135"><span class="linenos">2135</span></a> <span class="k">if</span> <span class="n">join_alias</span><span class="p">:</span> +</span><span id="Select.join-2136"><a href="#Select.join-2136"><span class="linenos">2136</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">alias_</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">join_alias</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Select.join-2137"><a href="#Select.join-2137"><span class="linenos">2137</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select.join-2138"><a href="#Select.join-2138"><span class="linenos">2138</span></a> <span class="n">join</span><span class="p">,</span> +</span><span id="Select.join-2139"><a href="#Select.join-2139"><span class="linenos">2139</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.join-2140"><a href="#Select.join-2140"><span class="linenos">2140</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"joins"</span><span class="p">,</span> +</span><span id="Select.join-2141"><a href="#Select.join-2141"><span class="linenos">2141</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.join-2142"><a href="#Select.join-2142"><span class="linenos">2142</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.join-2143"><a href="#Select.join-2143"><span class="linenos">2143</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.join-2144"><a href="#Select.join-2144"><span class="linenos">2144</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the JOIN expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"tbl2"</span><span class="p">,</span> <span class="n">on</span><span class="o">=</span><span class="s2">"tbl1.y = tbl2.y"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM tbl JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</code></pre> + </div> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"1"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"b"</span><span class="p">,</span> <span class="n">using</span><span class="o">=</span><span class="p">[</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">,</span> <span class="s2">"z"</span><span class="p">])</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT 1 FROM a JOIN b USING (x, y, z)'</span> +</code></pre> + </div> + + <p>Use <code>join_type</code> to change the type of join:</p> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"tbl2"</span><span class="p">,</span> <span class="n">on</span><span class="o">=</span><span class="s2">"tbl1.y = tbl2.y"</span><span class="p">,</span> <span class="n">join_type</span><span class="o">=</span><span class="s2">"left outer"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM tbl LEFT OUTER JOIN tbl2 ON tbl1.y = tbl2.y'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | Expression):</strong> the SQL code string to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>on (str | Expression):</strong> optionally specify the join "on" criteria as a SQL string. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>using (str | Expression):</strong> optionally specify the join "using" criteria as a SQL string. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>append (bool):</strong> if <code>True</code>, add to any existing expressions. +Otherwise, this resets the expressions.</li> +<li><strong>join_type (str):</strong> If set, alter the parsed join type</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.where" class="classattr"> + <input id="Select.where-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">where</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.where-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.where"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.where-2146"><a href="#Select.where-2146"><span class="linenos">2146</span></a> <span class="k">def</span> <span class="nf">where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.where-2147"><a href="#Select.where-2147"><span class="linenos">2147</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.where-2148"><a href="#Select.where-2148"><span class="linenos">2148</span></a><span class="sd"> Append to or set the WHERE expressions.</span> +</span><span id="Select.where-2149"><a href="#Select.where-2149"><span class="linenos">2149</span></a> +</span><span id="Select.where-2150"><a href="#Select.where-2150"><span class="linenos">2150</span></a><span class="sd"> Example:</span> +</span><span id="Select.where-2151"><a href="#Select.where-2151"><span class="linenos">2151</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a' OR x < 'b'").sql()</span> +</span><span id="Select.where-2152"><a href="#Select.where-2152"><span class="linenos">2152</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' OR x < 'b'"</span> +</span><span id="Select.where-2153"><a href="#Select.where-2153"><span class="linenos">2153</span></a> +</span><span id="Select.where-2154"><a href="#Select.where-2154"><span class="linenos">2154</span></a><span class="sd"> Args:</span> +</span><span id="Select.where-2155"><a href="#Select.where-2155"><span class="linenos">2155</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.where-2156"><a href="#Select.where-2156"><span class="linenos">2156</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.where-2157"><a href="#Select.where-2157"><span class="linenos">2157</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="Select.where-2158"><a href="#Select.where-2158"><span class="linenos">2158</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="Select.where-2159"><a href="#Select.where-2159"><span class="linenos">2159</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Select.where-2160"><a href="#Select.where-2160"><span class="linenos">2160</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select.where-2161"><a href="#Select.where-2161"><span class="linenos">2161</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.where-2162"><a href="#Select.where-2162"><span class="linenos">2162</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.where-2163"><a href="#Select.where-2163"><span class="linenos">2163</span></a> +</span><span id="Select.where-2164"><a href="#Select.where-2164"><span class="linenos">2164</span></a><span class="sd"> Returns:</span> +</span><span id="Select.where-2165"><a href="#Select.where-2165"><span class="linenos">2165</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.where-2166"><a href="#Select.where-2166"><span class="linenos">2166</span></a><span class="sd"> """</span> +</span><span id="Select.where-2167"><a href="#Select.where-2167"><span class="linenos">2167</span></a> <span class="k">return</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="Select.where-2168"><a href="#Select.where-2168"><span class="linenos">2168</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.where-2169"><a href="#Select.where-2169"><span class="linenos">2169</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.where-2170"><a href="#Select.where-2170"><span class="linenos">2170</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"where"</span><span class="p">,</span> +</span><span id="Select.where-2171"><a href="#Select.where-2171"><span class="linenos">2171</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.where-2172"><a href="#Select.where-2172"><span class="linenos">2172</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> +</span><span id="Select.where-2173"><a href="#Select.where-2173"><span class="linenos">2173</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.where-2174"><a href="#Select.where-2174"><span class="linenos">2174</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.where-2175"><a href="#Select.where-2175"><span class="linenos">2175</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.where-2176"><a href="#Select.where-2176"><span class="linenos">2176</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the WHERE expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="s2">"x = 'a' OR x < 'b'"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">"SELECT x FROM tbl WHERE x = 'a' OR x < 'b'"</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is. +Multiple expressions are combined with an AND operator.</li> +<li><strong>append (bool):</strong> if <code>True</code>, AND the new expressions to any existing expression. +Otherwise, this resets the expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.having" class="classattr"> + <input id="Select.having-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">having</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.having-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.having"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.having-2178"><a href="#Select.having-2178"><span class="linenos">2178</span></a> <span class="k">def</span> <span class="nf">having</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.having-2179"><a href="#Select.having-2179"><span class="linenos">2179</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.having-2180"><a href="#Select.having-2180"><span class="linenos">2180</span></a><span class="sd"> Append to or set the HAVING expressions.</span> +</span><span id="Select.having-2181"><a href="#Select.having-2181"><span class="linenos">2181</span></a> +</span><span id="Select.having-2182"><a href="#Select.having-2182"><span class="linenos">2182</span></a><span class="sd"> Example:</span> +</span><span id="Select.having-2183"><a href="#Select.having-2183"><span class="linenos">2183</span></a><span class="sd"> >>> Select().select("x", "COUNT(y)").from_("tbl").group_by("x").having("COUNT(y) > 3").sql()</span> +</span><span id="Select.having-2184"><a href="#Select.having-2184"><span class="linenos">2184</span></a><span class="sd"> 'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3'</span> +</span><span id="Select.having-2185"><a href="#Select.having-2185"><span class="linenos">2185</span></a> +</span><span id="Select.having-2186"><a href="#Select.having-2186"><span class="linenos">2186</span></a><span class="sd"> Args:</span> +</span><span id="Select.having-2187"><a href="#Select.having-2187"><span class="linenos">2187</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="Select.having-2188"><a href="#Select.having-2188"><span class="linenos">2188</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.having-2189"><a href="#Select.having-2189"><span class="linenos">2189</span></a><span class="sd"> Multiple expressions are combined with an AND operator.</span> +</span><span id="Select.having-2190"><a href="#Select.having-2190"><span class="linenos">2190</span></a><span class="sd"> append (bool): if `True`, AND the new expressions to any existing expression.</span> +</span><span id="Select.having-2191"><a href="#Select.having-2191"><span class="linenos">2191</span></a><span class="sd"> Otherwise, this resets the expression.</span> +</span><span id="Select.having-2192"><a href="#Select.having-2192"><span class="linenos">2192</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="Select.having-2193"><a href="#Select.having-2193"><span class="linenos">2193</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.having-2194"><a href="#Select.having-2194"><span class="linenos">2194</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="Select.having-2195"><a href="#Select.having-2195"><span class="linenos">2195</span></a> +</span><span id="Select.having-2196"><a href="#Select.having-2196"><span class="linenos">2196</span></a><span class="sd"> Returns:</span> +</span><span id="Select.having-2197"><a href="#Select.having-2197"><span class="linenos">2197</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.having-2198"><a href="#Select.having-2198"><span class="linenos">2198</span></a><span class="sd"> """</span> +</span><span id="Select.having-2199"><a href="#Select.having-2199"><span class="linenos">2199</span></a> <span class="k">return</span> <span class="n">_apply_conjunction_builder</span><span class="p">(</span> +</span><span id="Select.having-2200"><a href="#Select.having-2200"><span class="linenos">2200</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.having-2201"><a href="#Select.having-2201"><span class="linenos">2201</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.having-2202"><a href="#Select.having-2202"><span class="linenos">2202</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"having"</span><span class="p">,</span> +</span><span id="Select.having-2203"><a href="#Select.having-2203"><span class="linenos">2203</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.having-2204"><a href="#Select.having-2204"><span class="linenos">2204</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Having</span><span class="p">,</span> +</span><span id="Select.having-2205"><a href="#Select.having-2205"><span class="linenos">2205</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.having-2206"><a href="#Select.having-2206"><span class="linenos">2206</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.having-2207"><a href="#Select.having-2207"><span class="linenos">2207</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.having-2208"><a href="#Select.having-2208"><span class="linenos">2208</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Append to or set the HAVING expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">,</span> <span class="s2">"COUNT(y)"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">having</span><span class="p">(</span><span class="s2">"COUNT(y) > 3"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x, COUNT(y) FROM tbl GROUP BY x HAVING COUNT(y) > 3'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is. +Multiple expressions are combined with an AND operator.</li> +<li><strong>append (bool):</strong> if <code>True</code>, AND the new expressions to any existing expression. +Otherwise, this resets the expression.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.window" class="classattr"> + <input id="Select.window-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">window</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="o">*</span><span class="n">expressions</span>,</span><span class="param"> <span class="n">append</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.window-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.window"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.window-2210"><a href="#Select.window-2210"><span class="linenos">2210</span></a> <span class="k">def</span> <span class="nf">window</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.window-2211"><a href="#Select.window-2211"><span class="linenos">2211</span></a> <span class="k">return</span> <span class="n">_apply_list_builder</span><span class="p">(</span> +</span><span id="Select.window-2212"><a href="#Select.window-2212"><span class="linenos">2212</span></a> <span class="o">*</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Select.window-2213"><a href="#Select.window-2213"><span class="linenos">2213</span></a> <span class="n">instance</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Select.window-2214"><a href="#Select.window-2214"><span class="linenos">2214</span></a> <span class="n">arg</span><span class="o">=</span><span class="s2">"windows"</span><span class="p">,</span> +</span><span id="Select.window-2215"><a href="#Select.window-2215"><span class="linenos">2215</span></a> <span class="n">append</span><span class="o">=</span><span class="n">append</span><span class="p">,</span> +</span><span id="Select.window-2216"><a href="#Select.window-2216"><span class="linenos">2216</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Window</span><span class="p">,</span> +</span><span id="Select.window-2217"><a href="#Select.window-2217"><span class="linenos">2217</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.window-2218"><a href="#Select.window-2218"><span class="linenos">2218</span></a> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">,</span> +</span><span id="Select.window-2219"><a href="#Select.window-2219"><span class="linenos">2219</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.window-2220"><a href="#Select.window-2220"><span class="linenos">2220</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Select.distinct" class="classattr"> + <input id="Select.distinct-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">distinct</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">copy</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.distinct-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.distinct"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.distinct-2222"><a href="#Select.distinct-2222"><span class="linenos">2222</span></a> <span class="k">def</span> <span class="nf">distinct</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.distinct-2223"><a href="#Select.distinct-2223"><span class="linenos">2223</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.distinct-2224"><a href="#Select.distinct-2224"><span class="linenos">2224</span></a><span class="sd"> Set the OFFSET expression.</span> +</span><span id="Select.distinct-2225"><a href="#Select.distinct-2225"><span class="linenos">2225</span></a> +</span><span id="Select.distinct-2226"><a href="#Select.distinct-2226"><span class="linenos">2226</span></a><span class="sd"> Example:</span> +</span><span id="Select.distinct-2227"><a href="#Select.distinct-2227"><span class="linenos">2227</span></a><span class="sd"> >>> Select().from_("tbl").select("x").distinct().sql()</span> +</span><span id="Select.distinct-2228"><a href="#Select.distinct-2228"><span class="linenos">2228</span></a><span class="sd"> 'SELECT DISTINCT x FROM tbl'</span> +</span><span id="Select.distinct-2229"><a href="#Select.distinct-2229"><span class="linenos">2229</span></a> +</span><span id="Select.distinct-2230"><a href="#Select.distinct-2230"><span class="linenos">2230</span></a><span class="sd"> Args:</span> +</span><span id="Select.distinct-2231"><a href="#Select.distinct-2231"><span class="linenos">2231</span></a><span class="sd"> distinct (bool): whether the Select should be distinct</span> +</span><span id="Select.distinct-2232"><a href="#Select.distinct-2232"><span class="linenos">2232</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.distinct-2233"><a href="#Select.distinct-2233"><span class="linenos">2233</span></a> +</span><span id="Select.distinct-2234"><a href="#Select.distinct-2234"><span class="linenos">2234</span></a><span class="sd"> Returns:</span> +</span><span id="Select.distinct-2235"><a href="#Select.distinct-2235"><span class="linenos">2235</span></a><span class="sd"> Select: the modified expression.</span> +</span><span id="Select.distinct-2236"><a href="#Select.distinct-2236"><span class="linenos">2236</span></a><span class="sd"> """</span> +</span><span id="Select.distinct-2237"><a href="#Select.distinct-2237"><span class="linenos">2237</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Select.distinct-2238"><a href="#Select.distinct-2238"><span class="linenos">2238</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">,</span> <span class="n">Distinct</span><span class="p">()</span> <span class="k">if</span> <span class="n">distinct</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Select.distinct-2239"><a href="#Select.distinct-2239"><span class="linenos">2239</span></a> <span class="k">return</span> <span class="n">instance</span> +</span></pre></div> + + + <div class="docstring"><p>Set the OFFSET expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">distinct</span><span class="p">()</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT DISTINCT x FROM tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>distinct (bool):</strong> whether the Select should be distinct</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the modified expression.</p> +</blockquote> +</div> + + + </div> + <div id="Select.ctas" class="classattr"> + <input id="Select.ctas-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ctas</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span>,</span><span class="param"> <span class="n">properties</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Create">sqlglot.expressions.Create</a></span>:</span></span> + + <label class="view-source-button" for="Select.ctas-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.ctas"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.ctas-2241"><a href="#Select.ctas-2241"><span class="linenos">2241</span></a> <span class="k">def</span> <span class="nf">ctas</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">properties</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Create</span><span class="p">:</span> +</span><span id="Select.ctas-2242"><a href="#Select.ctas-2242"><span class="linenos">2242</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.ctas-2243"><a href="#Select.ctas-2243"><span class="linenos">2243</span></a><span class="sd"> Convert this expression to a CREATE TABLE AS statement.</span> +</span><span id="Select.ctas-2244"><a href="#Select.ctas-2244"><span class="linenos">2244</span></a> +</span><span id="Select.ctas-2245"><a href="#Select.ctas-2245"><span class="linenos">2245</span></a><span class="sd"> Example:</span> +</span><span id="Select.ctas-2246"><a href="#Select.ctas-2246"><span class="linenos">2246</span></a><span class="sd"> >>> Select().select("*").from_("tbl").ctas("x").sql()</span> +</span><span id="Select.ctas-2247"><a href="#Select.ctas-2247"><span class="linenos">2247</span></a><span class="sd"> 'CREATE TABLE x AS SELECT * FROM tbl'</span> +</span><span id="Select.ctas-2248"><a href="#Select.ctas-2248"><span class="linenos">2248</span></a> +</span><span id="Select.ctas-2249"><a href="#Select.ctas-2249"><span class="linenos">2249</span></a><span class="sd"> Args:</span> +</span><span id="Select.ctas-2250"><a href="#Select.ctas-2250"><span class="linenos">2250</span></a><span class="sd"> table (str | Expression): the SQL code string to parse as the table name.</span> +</span><span id="Select.ctas-2251"><a href="#Select.ctas-2251"><span class="linenos">2251</span></a><span class="sd"> If another `Expression` instance is passed, it will be used as-is.</span> +</span><span id="Select.ctas-2252"><a href="#Select.ctas-2252"><span class="linenos">2252</span></a><span class="sd"> properties (dict): an optional mapping of table properties</span> +</span><span id="Select.ctas-2253"><a href="#Select.ctas-2253"><span class="linenos">2253</span></a><span class="sd"> dialect (str): the dialect used to parse the input table.</span> +</span><span id="Select.ctas-2254"><a href="#Select.ctas-2254"><span class="linenos">2254</span></a><span class="sd"> copy (bool): if `False`, modify this expression instance in-place.</span> +</span><span id="Select.ctas-2255"><a href="#Select.ctas-2255"><span class="linenos">2255</span></a><span class="sd"> opts (kwargs): other options to use to parse the input table.</span> +</span><span id="Select.ctas-2256"><a href="#Select.ctas-2256"><span class="linenos">2256</span></a> +</span><span id="Select.ctas-2257"><a href="#Select.ctas-2257"><span class="linenos">2257</span></a><span class="sd"> Returns:</span> +</span><span id="Select.ctas-2258"><a href="#Select.ctas-2258"><span class="linenos">2258</span></a><span class="sd"> Create: the CREATE TABLE AS expression</span> +</span><span id="Select.ctas-2259"><a href="#Select.ctas-2259"><span class="linenos">2259</span></a><span class="sd"> """</span> +</span><span id="Select.ctas-2260"><a href="#Select.ctas-2260"><span class="linenos">2260</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Select.ctas-2261"><a href="#Select.ctas-2261"><span class="linenos">2261</span></a> <span class="n">table_expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span> +</span><span id="Select.ctas-2262"><a href="#Select.ctas-2262"><span class="linenos">2262</span></a> <span class="n">table</span><span class="p">,</span> +</span><span id="Select.ctas-2263"><a href="#Select.ctas-2263"><span class="linenos">2263</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> +</span><span id="Select.ctas-2264"><a href="#Select.ctas-2264"><span class="linenos">2264</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="Select.ctas-2265"><a href="#Select.ctas-2265"><span class="linenos">2265</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="Select.ctas-2266"><a href="#Select.ctas-2266"><span class="linenos">2266</span></a> <span class="p">)</span> +</span><span id="Select.ctas-2267"><a href="#Select.ctas-2267"><span class="linenos">2267</span></a> <span class="n">properties_expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Select.ctas-2268"><a href="#Select.ctas-2268"><span class="linenos">2268</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="Select.ctas-2269"><a href="#Select.ctas-2269"><span class="linenos">2269</span></a> <span class="n">properties_expression</span> <span class="o">=</span> <span class="n">Properties</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> +</span><span id="Select.ctas-2270"><a href="#Select.ctas-2270"><span class="linenos">2270</span></a> +</span><span id="Select.ctas-2271"><a href="#Select.ctas-2271"><span class="linenos">2271</span></a> <span class="k">return</span> <span class="n">Create</span><span class="p">(</span> +</span><span id="Select.ctas-2272"><a href="#Select.ctas-2272"><span class="linenos">2272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">table_expression</span><span class="p">,</span> +</span><span id="Select.ctas-2273"><a href="#Select.ctas-2273"><span class="linenos">2273</span></a> <span class="n">kind</span><span class="o">=</span><span class="s2">"table"</span><span class="p">,</span> +</span><span id="Select.ctas-2274"><a href="#Select.ctas-2274"><span class="linenos">2274</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">instance</span><span class="p">,</span> +</span><span id="Select.ctas-2275"><a href="#Select.ctas-2275"><span class="linenos">2275</span></a> <span class="n">properties</span><span class="o">=</span><span class="n">properties_expression</span><span class="p">,</span> +</span><span id="Select.ctas-2276"><a href="#Select.ctas-2276"><span class="linenos">2276</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Convert this expression to a CREATE TABLE AS statement.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">ctas</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'CREATE TABLE x AS SELECT * FROM tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table (str | Expression):</strong> the SQL code string to parse as the table name. +If another <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>properties (dict):</strong> an optional mapping of table properties</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input table.</li> +<li><strong>copy (bool):</strong> if <code>False</code>, modify this expression instance in-place.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input table.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Create: the CREATE TABLE AS expression</p> +</blockquote> +</div> + + + </div> + <div id="Select.lock" class="classattr"> + <input id="Select.lock-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lock</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">update</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>,</span><span class="param"> <span class="n">copy</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="Select.lock-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Select.lock"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Select.lock-2278"><a href="#Select.lock-2278"><span class="linenos">2278</span></a> <span class="k">def</span> <span class="nf">lock</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">update</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">copy</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="Select.lock-2279"><a href="#Select.lock-2279"><span class="linenos">2279</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Select.lock-2280"><a href="#Select.lock-2280"><span class="linenos">2280</span></a><span class="sd"> Set the locking read mode for this expression.</span> +</span><span id="Select.lock-2281"><a href="#Select.lock-2281"><span class="linenos">2281</span></a> +</span><span id="Select.lock-2282"><a href="#Select.lock-2282"><span class="linenos">2282</span></a><span class="sd"> Examples:</span> +</span><span id="Select.lock-2283"><a href="#Select.lock-2283"><span class="linenos">2283</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a'").lock().sql("mysql")</span> +</span><span id="Select.lock-2284"><a href="#Select.lock-2284"><span class="linenos">2284</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' FOR UPDATE"</span> +</span><span id="Select.lock-2285"><a href="#Select.lock-2285"><span class="linenos">2285</span></a> +</span><span id="Select.lock-2286"><a href="#Select.lock-2286"><span class="linenos">2286</span></a><span class="sd"> >>> Select().select("x").from_("tbl").where("x = 'a'").lock(update=False).sql("mysql")</span> +</span><span id="Select.lock-2287"><a href="#Select.lock-2287"><span class="linenos">2287</span></a><span class="sd"> "SELECT x FROM tbl WHERE x = 'a' FOR SHARE"</span> +</span><span id="Select.lock-2288"><a href="#Select.lock-2288"><span class="linenos">2288</span></a> +</span><span id="Select.lock-2289"><a href="#Select.lock-2289"><span class="linenos">2289</span></a><span class="sd"> Args:</span> +</span><span id="Select.lock-2290"><a href="#Select.lock-2290"><span class="linenos">2290</span></a><span class="sd"> update: if `True`, the locking type will be `FOR UPDATE`, else it will be `FOR SHARE`.</span> +</span><span id="Select.lock-2291"><a href="#Select.lock-2291"><span class="linenos">2291</span></a><span class="sd"> copy: if `False`, modify this expression instance in-place.</span> +</span><span id="Select.lock-2292"><a href="#Select.lock-2292"><span class="linenos">2292</span></a> +</span><span id="Select.lock-2293"><a href="#Select.lock-2293"><span class="linenos">2293</span></a><span class="sd"> Returns:</span> +</span><span id="Select.lock-2294"><a href="#Select.lock-2294"><span class="linenos">2294</span></a><span class="sd"> The modified expression.</span> +</span><span id="Select.lock-2295"><a href="#Select.lock-2295"><span class="linenos">2295</span></a><span class="sd"> """</span> +</span><span id="Select.lock-2296"><a href="#Select.lock-2296"><span class="linenos">2296</span></a> +</span><span id="Select.lock-2297"><a href="#Select.lock-2297"><span class="linenos">2297</span></a> <span class="n">inst</span> <span class="o">=</span> <span class="n">_maybe_copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">copy</span><span class="p">)</span> +</span><span id="Select.lock-2298"><a href="#Select.lock-2298"><span class="linenos">2298</span></a> <span class="n">inst</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"lock"</span><span class="p">,</span> <span class="n">Lock</span><span class="p">(</span><span class="n">update</span><span class="o">=</span><span class="n">update</span><span class="p">))</span> +</span><span id="Select.lock-2299"><a href="#Select.lock-2299"><span class="linenos">2299</span></a> +</span><span id="Select.lock-2300"><a href="#Select.lock-2300"><span class="linenos">2300</span></a> <span class="k">return</span> <span class="n">inst</span> +</span></pre></div> + + + <div class="docstring"><p>Set the locking read mode for this expression.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="s2">"x = 'a'"</span><span class="p">)</span><span class="o">.</span><span class="n">lock</span><span class="p">()</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="s2">"mysql"</span><span class="p">)</span> +<span class="go">"SELECT x FROM tbl WHERE x = 'a' FOR UPDATE"</span> +</code></pre> + </div> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"x"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="s2">"x = 'a'"</span><span class="p">)</span><span class="o">.</span><span class="n">lock</span><span class="p">(</span><span class="n">update</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="s2">"mysql"</span><span class="p">)</span> +<span class="go">"SELECT x FROM tbl WHERE x = 'a' FOR SHARE"</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>update:</strong> if <code>True</code>, the locking type will be <code>FOR UPDATE</code>, else it will be <code>FOR SHARE</code>.</li> +<li><strong>copy:</strong> if <code>False</code>, modify this expression instance in-place.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The modified expression.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Select.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Select.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Select.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Select.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Select.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Select.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Select.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Select.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Select.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Select.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Select.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Select.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Select.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Select.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Select.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Select.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Select.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Select.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Select.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Select.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Select.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Select.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Select.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Select.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Select.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Select.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Select.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Select.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Select.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Select.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Select.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Select.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Select.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Subqueryable">Subqueryable</a></dt> + <dd id="Select.subquery" class="function"><a href="#Subqueryable.subquery">subquery</a></dd> + <dd id="Select.with_" class="function"><a href="#Subqueryable.with_">with_</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Select.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Select.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Select.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Subquery"> + <input id="Subquery-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Subquery</span><wbr>(<span class="base"><a href="#DerivedTable">DerivedTable</a></span>, <span class="base"><a href="#Unionable">Unionable</a></span>): + + <label class="view-source-button" for="Subquery-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Subquery"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Subquery-2311"><a href="#Subquery-2311"><span class="linenos">2311</span></a><span class="k">class</span> <span class="nc">Subquery</span><span class="p">(</span><span class="n">DerivedTable</span><span class="p">,</span> <span class="n">Unionable</span><span class="p">):</span> +</span><span id="Subquery-2312"><a href="#Subquery-2312"><span class="linenos">2312</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Subquery-2313"><a href="#Subquery-2313"><span class="linenos">2313</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Subquery-2314"><a href="#Subquery-2314"><span class="linenos">2314</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Subquery-2315"><a href="#Subquery-2315"><span class="linenos">2315</span></a> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Subquery-2316"><a href="#Subquery-2316"><span class="linenos">2316</span></a> <span class="o">**</span><span class="n">QUERY_MODIFIERS</span><span class="p">,</span> +</span><span id="Subquery-2317"><a href="#Subquery-2317"><span class="linenos">2317</span></a> <span class="p">}</span> +</span><span id="Subquery-2318"><a href="#Subquery-2318"><span class="linenos">2318</span></a> +</span><span id="Subquery-2319"><a href="#Subquery-2319"><span class="linenos">2319</span></a> <span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Subquery-2320"><a href="#Subquery-2320"><span class="linenos">2320</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Subquery-2321"><a href="#Subquery-2321"><span class="linenos">2321</span></a><span class="sd"> Returns the first non subquery.</span> +</span><span id="Subquery-2322"><a href="#Subquery-2322"><span class="linenos">2322</span></a><span class="sd"> """</span> +</span><span id="Subquery-2323"><a href="#Subquery-2323"><span class="linenos">2323</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="Subquery-2324"><a href="#Subquery-2324"><span class="linenos">2324</span></a> <span class="k">while</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Subquery</span><span class="p">):</span> +</span><span id="Subquery-2325"><a href="#Subquery-2325"><span class="linenos">2325</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Subquery-2326"><a href="#Subquery-2326"><span class="linenos">2326</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Subquery-2327"><a href="#Subquery-2327"><span class="linenos">2327</span></a> +</span><span id="Subquery-2328"><a href="#Subquery-2328"><span class="linenos">2328</span></a> <span class="nd">@property</span> +</span><span id="Subquery-2329"><a href="#Subquery-2329"><span class="linenos">2329</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Subquery-2330"><a href="#Subquery-2330"><span class="linenos">2330</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias</span> +</span></pre></div> + + + + + <div id="Subquery.unnest" class="classattr"> + <input id="Subquery.unnest-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unnest</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Subquery.unnest-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Subquery.unnest"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Subquery.unnest-2319"><a href="#Subquery.unnest-2319"><span class="linenos">2319</span></a> <span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Subquery.unnest-2320"><a href="#Subquery.unnest-2320"><span class="linenos">2320</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Subquery.unnest-2321"><a href="#Subquery.unnest-2321"><span class="linenos">2321</span></a><span class="sd"> Returns the first non subquery.</span> +</span><span id="Subquery.unnest-2322"><a href="#Subquery.unnest-2322"><span class="linenos">2322</span></a><span class="sd"> """</span> +</span><span id="Subquery.unnest-2323"><a href="#Subquery.unnest-2323"><span class="linenos">2323</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span> +</span><span id="Subquery.unnest-2324"><a href="#Subquery.unnest-2324"><span class="linenos">2324</span></a> <span class="k">while</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">Subquery</span><span class="p">):</span> +</span><span id="Subquery.unnest-2325"><a href="#Subquery.unnest-2325"><span class="linenos">2325</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Subquery.unnest-2326"><a href="#Subquery.unnest-2326"><span class="linenos">2326</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the first non subquery.</p> +</div> + + + </div> + <div id="Subquery.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Subquery.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Subquery.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Subquery.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Subquery.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Subquery.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Subquery.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Subquery.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Subquery.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Subquery.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Subquery.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Subquery.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Subquery.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Subquery.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Subquery.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Subquery.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Subquery.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Subquery.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Subquery.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Subquery.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Subquery.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Subquery.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Subquery.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Subquery.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Subquery.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Subquery.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Subquery.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Subquery.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Subquery.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Subquery.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Subquery.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Subquery.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Subquery.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Unionable">Unionable</a></dt> + <dd id="Subquery.union" class="function"><a href="#Unionable.union">union</a></dd> + <dd id="Subquery.intersect" class="function"><a href="#Unionable.intersect">intersect</a></dd> + <dd id="Subquery.except_" class="function"><a href="#Unionable.except_">except_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TableSample"> + <input id="TableSample-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TableSample</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="TableSample-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TableSample"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TableSample-2333"><a href="#TableSample-2333"><span class="linenos">2333</span></a><span class="k">class</span> <span class="nc">TableSample</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="TableSample-2334"><a href="#TableSample-2334"><span class="linenos">2334</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TableSample-2335"><a href="#TableSample-2335"><span class="linenos">2335</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2336"><a href="#TableSample-2336"><span class="linenos">2336</span></a> <span class="s2">"method"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2337"><a href="#TableSample-2337"><span class="linenos">2337</span></a> <span class="s2">"bucket_numerator"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2338"><a href="#TableSample-2338"><span class="linenos">2338</span></a> <span class="s2">"bucket_denominator"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2339"><a href="#TableSample-2339"><span class="linenos">2339</span></a> <span class="s2">"bucket_field"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2340"><a href="#TableSample-2340"><span class="linenos">2340</span></a> <span class="s2">"percent"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2341"><a href="#TableSample-2341"><span class="linenos">2341</span></a> <span class="s2">"rows"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2342"><a href="#TableSample-2342"><span class="linenos">2342</span></a> <span class="s2">"size"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2343"><a href="#TableSample-2343"><span class="linenos">2343</span></a> <span class="s2">"seed"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="TableSample-2344"><a href="#TableSample-2344"><span class="linenos">2344</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TableSample.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TableSample.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TableSample.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TableSample.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TableSample.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TableSample.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TableSample.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TableSample.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TableSample.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TableSample.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TableSample.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TableSample.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TableSample.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TableSample.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TableSample.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TableSample.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TableSample.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TableSample.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TableSample.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TableSample.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TableSample.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TableSample.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TableSample.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TableSample.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TableSample.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TableSample.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TableSample.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TableSample.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TableSample.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TableSample.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TableSample.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TableSample.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TableSample.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Tag"> + <input id="Tag-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tag</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Tag-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tag"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tag-2347"><a href="#Tag-2347"><span class="linenos">2347</span></a><span class="k">class</span> <span class="nc">Tag</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Tag-2348"><a href="#Tag-2348"><span class="linenos">2348</span></a><span class="w"> </span><span class="sd">"""Tags are used for generating arbitrary sql like SELECT <span>x</span>."""</span> +</span><span id="Tag-2349"><a href="#Tag-2349"><span class="linenos">2349</span></a> +</span><span id="Tag-2350"><a href="#Tag-2350"><span class="linenos">2350</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tag-2351"><a href="#Tag-2351"><span class="linenos">2351</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Tag-2352"><a href="#Tag-2352"><span class="linenos">2352</span></a> <span class="s2">"prefix"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Tag-2353"><a href="#Tag-2353"><span class="linenos">2353</span></a> <span class="s2">"postfix"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Tag-2354"><a href="#Tag-2354"><span class="linenos">2354</span></a> <span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Tags are used for generating arbitrary sql like SELECT <span>x</span>.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Tag.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Tag.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Tag.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Tag.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Tag.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Tag.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Tag.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Tag.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Tag.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Tag.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Tag.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Tag.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Tag.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Tag.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Tag.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Tag.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Tag.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Tag.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Tag.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Tag.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Tag.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Tag.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Tag.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Tag.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Tag.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Tag.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Tag.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Tag.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Tag.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Tag.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Tag.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Tag.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Tag.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Pivot"> + <input id="Pivot-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Pivot</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Pivot-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Pivot"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Pivot-2357"><a href="#Pivot-2357"><span class="linenos">2357</span></a><span class="k">class</span> <span class="nc">Pivot</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Pivot-2358"><a href="#Pivot-2358"><span class="linenos">2358</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Pivot-2359"><a href="#Pivot-2359"><span class="linenos">2359</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Pivot-2360"><a href="#Pivot-2360"><span class="linenos">2360</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Pivot-2361"><a href="#Pivot-2361"><span class="linenos">2361</span></a> <span class="s2">"field"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Pivot-2362"><a href="#Pivot-2362"><span class="linenos">2362</span></a> <span class="s2">"unpivot"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Pivot-2363"><a href="#Pivot-2363"><span class="linenos">2363</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Pivot.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Pivot.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Pivot.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Pivot.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Pivot.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Pivot.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Pivot.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Pivot.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Pivot.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Pivot.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Pivot.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Pivot.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Pivot.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Pivot.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Pivot.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Pivot.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Pivot.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Pivot.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Pivot.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Pivot.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Pivot.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Pivot.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Pivot.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Pivot.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Pivot.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Pivot.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Pivot.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Pivot.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Pivot.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Pivot.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Pivot.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Pivot.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Pivot.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Window"> + <input id="Window-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Window</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Window-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Window"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Window-2366"><a href="#Window-2366"><span class="linenos">2366</span></a><span class="k">class</span> <span class="nc">Window</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Window-2367"><a href="#Window-2367"><span class="linenos">2367</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Window-2368"><a href="#Window-2368"><span class="linenos">2368</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Window-2369"><a href="#Window-2369"><span class="linenos">2369</span></a> <span class="s2">"partition_by"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Window-2370"><a href="#Window-2370"><span class="linenos">2370</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Window-2371"><a href="#Window-2371"><span class="linenos">2371</span></a> <span class="s2">"spec"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Window-2372"><a href="#Window-2372"><span class="linenos">2372</span></a> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Window-2373"><a href="#Window-2373"><span class="linenos">2373</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Window.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Window.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Window.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Window.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Window.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Window.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Window.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Window.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Window.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Window.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Window.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Window.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Window.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Window.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Window.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Window.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Window.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Window.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Window.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Window.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Window.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Window.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Window.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Window.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Window.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Window.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Window.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Window.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Window.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Window.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Window.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Window.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Window.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="WindowSpec"> + <input id="WindowSpec-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">WindowSpec</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="WindowSpec-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WindowSpec"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WindowSpec-2376"><a href="#WindowSpec-2376"><span class="linenos">2376</span></a><span class="k">class</span> <span class="nc">WindowSpec</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="WindowSpec-2377"><a href="#WindowSpec-2377"><span class="linenos">2377</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="WindowSpec-2378"><a href="#WindowSpec-2378"><span class="linenos">2378</span></a> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="WindowSpec-2379"><a href="#WindowSpec-2379"><span class="linenos">2379</span></a> <span class="s2">"start"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="WindowSpec-2380"><a href="#WindowSpec-2380"><span class="linenos">2380</span></a> <span class="s2">"start_side"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="WindowSpec-2381"><a href="#WindowSpec-2381"><span class="linenos">2381</span></a> <span class="s2">"end"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="WindowSpec-2382"><a href="#WindowSpec-2382"><span class="linenos">2382</span></a> <span class="s2">"end_side"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="WindowSpec-2383"><a href="#WindowSpec-2383"><span class="linenos">2383</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="WindowSpec.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="WindowSpec.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="WindowSpec.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="WindowSpec.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="WindowSpec.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="WindowSpec.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="WindowSpec.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="WindowSpec.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="WindowSpec.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="WindowSpec.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="WindowSpec.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="WindowSpec.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="WindowSpec.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="WindowSpec.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="WindowSpec.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="WindowSpec.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="WindowSpec.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="WindowSpec.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="WindowSpec.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="WindowSpec.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="WindowSpec.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="WindowSpec.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="WindowSpec.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="WindowSpec.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="WindowSpec.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="WindowSpec.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="WindowSpec.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="WindowSpec.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="WindowSpec.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="WindowSpec.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="WindowSpec.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="WindowSpec.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="WindowSpec.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Where"> + <input id="Where-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Where</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Where-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Where"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Where-2386"><a href="#Where-2386"><span class="linenos">2386</span></a><span class="k">class</span> <span class="nc">Where</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Where-2387"><a href="#Where-2387"><span class="linenos">2387</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Where.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Where.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Where.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Where.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Where.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Where.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Where.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Where.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Where.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Where.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Where.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Where.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Where.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Where.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Where.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Where.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Where.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Where.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Where.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Where.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Where.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Where.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Where.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Where.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Where.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Where.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Where.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Where.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Where.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Where.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Where.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Where.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Where.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Star"> + <input id="Star-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Star</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Star-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Star"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Star-2390"><a href="#Star-2390"><span class="linenos">2390</span></a><span class="k">class</span> <span class="nc">Star</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Star-2391"><a href="#Star-2391"><span class="linenos">2391</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"except"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"replace"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Star-2392"><a href="#Star-2392"><span class="linenos">2392</span></a> +</span><span id="Star-2393"><a href="#Star-2393"><span class="linenos">2393</span></a> <span class="nd">@property</span> +</span><span id="Star-2394"><a href="#Star-2394"><span class="linenos">2394</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Star-2395"><a href="#Star-2395"><span class="linenos">2395</span></a> <span class="k">return</span> <span class="s2">"*"</span> +</span><span id="Star-2396"><a href="#Star-2396"><span class="linenos">2396</span></a> +</span><span id="Star-2397"><a href="#Star-2397"><span class="linenos">2397</span></a> <span class="nd">@property</span> +</span><span id="Star-2398"><a href="#Star-2398"><span class="linenos">2398</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Star-2399"><a href="#Star-2399"><span class="linenos">2399</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span></pre></div> + + + + + <div id="Star.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Star.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Star.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Star.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Star.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Star.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Star.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Star.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Star.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Star.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Star.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Star.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Star.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Star.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Star.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Star.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Star.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Star.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Star.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Star.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Star.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Star.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Star.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Star.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Star.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Star.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Star.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Star.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Star.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Star.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Star.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Star.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Star.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Star.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Parameter"> + <input id="Parameter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Parameter</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Parameter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parameter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parameter-2402"><a href="#Parameter-2402"><span class="linenos">2402</span></a><span class="k">class</span> <span class="nc">Parameter</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Parameter-2403"><a href="#Parameter-2403"><span class="linenos">2403</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Parameter.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Parameter.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Parameter.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Parameter.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Parameter.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Parameter.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Parameter.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Parameter.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Parameter.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Parameter.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Parameter.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Parameter.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Parameter.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Parameter.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Parameter.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Parameter.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Parameter.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Parameter.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Parameter.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Parameter.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Parameter.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Parameter.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Parameter.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Parameter.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Parameter.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Parameter.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Parameter.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Parameter.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Parameter.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Parameter.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Parameter.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Parameter.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Parameter.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SessionParameter"> + <input id="SessionParameter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SessionParameter</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="SessionParameter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SessionParameter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SessionParameter-2406"><a href="#SessionParameter-2406"><span class="linenos">2406</span></a><span class="k">class</span> <span class="nc">SessionParameter</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="SessionParameter-2407"><a href="#SessionParameter-2407"><span class="linenos">2407</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SessionParameter.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SessionParameter.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SessionParameter.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SessionParameter.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SessionParameter.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SessionParameter.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SessionParameter.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SessionParameter.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SessionParameter.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SessionParameter.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SessionParameter.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SessionParameter.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SessionParameter.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SessionParameter.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SessionParameter.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SessionParameter.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SessionParameter.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SessionParameter.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SessionParameter.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SessionParameter.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SessionParameter.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SessionParameter.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SessionParameter.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SessionParameter.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SessionParameter.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SessionParameter.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SessionParameter.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SessionParameter.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SessionParameter.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SessionParameter.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SessionParameter.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SessionParameter.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SessionParameter.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Placeholder"> + <input id="Placeholder-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Placeholder</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Placeholder-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Placeholder"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Placeholder-2410"><a href="#Placeholder-2410"><span class="linenos">2410</span></a><span class="k">class</span> <span class="nc">Placeholder</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Placeholder-2411"><a href="#Placeholder-2411"><span class="linenos">2411</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Placeholder.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Placeholder.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Placeholder.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Placeholder.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Placeholder.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Placeholder.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Placeholder.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Placeholder.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Placeholder.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Placeholder.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Placeholder.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Placeholder.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Placeholder.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Placeholder.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Placeholder.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Placeholder.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Placeholder.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Placeholder.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Placeholder.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Placeholder.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Placeholder.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Placeholder.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Placeholder.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Placeholder.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Placeholder.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Placeholder.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Placeholder.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Placeholder.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Placeholder.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Placeholder.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Placeholder.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Placeholder.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Placeholder.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Null"> + <input id="Null-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Null</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Null-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Null"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Null-2414"><a href="#Null-2414"><span class="linenos">2414</span></a><span class="k">class</span> <span class="nc">Null</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Null-2415"><a href="#Null-2415"><span class="linenos">2415</span></a> <span class="n">arg_types</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Null-2416"><a href="#Null-2416"><span class="linenos">2416</span></a> +</span><span id="Null-2417"><a href="#Null-2417"><span class="linenos">2417</span></a> <span class="nd">@property</span> +</span><span id="Null-2418"><a href="#Null-2418"><span class="linenos">2418</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Null-2419"><a href="#Null-2419"><span class="linenos">2419</span></a> <span class="k">return</span> <span class="s2">"NULL"</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Null.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Null.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Null.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Null.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Null.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Null.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Null.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Null.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Null.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Null.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Null.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Null.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Null.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Null.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Null.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Null.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Null.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Null.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Null.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Null.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Null.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Null.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Null.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Null.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Null.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Null.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Null.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Null.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Null.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Null.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Null.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Null.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Null.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Null.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Null.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Null.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Boolean"> + <input id="Boolean-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Boolean</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Boolean-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Boolean"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Boolean-2422"><a href="#Boolean-2422"><span class="linenos">2422</span></a><span class="k">class</span> <span class="nc">Boolean</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Boolean-2423"><a href="#Boolean-2423"><span class="linenos">2423</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Boolean.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Boolean.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Boolean.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Boolean.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Boolean.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Boolean.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Boolean.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Boolean.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Boolean.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Boolean.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Boolean.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Boolean.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Boolean.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Boolean.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Boolean.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Boolean.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Boolean.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Boolean.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Boolean.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Boolean.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Boolean.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Boolean.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Boolean.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Boolean.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Boolean.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Boolean.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Boolean.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Boolean.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Boolean.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Boolean.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Boolean.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Boolean.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Boolean.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Boolean.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Boolean.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Boolean.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DataType"> + <input id="DataType-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataType</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="DataType-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataType"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataType-2426"><a href="#DataType-2426"><span class="linenos">2426</span></a><span class="k">class</span> <span class="nc">DataType</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="DataType-2427"><a href="#DataType-2427"><span class="linenos">2427</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataType-2428"><a href="#DataType-2428"><span class="linenos">2428</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="DataType-2429"><a href="#DataType-2429"><span class="linenos">2429</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="DataType-2430"><a href="#DataType-2430"><span class="linenos">2430</span></a> <span class="s2">"nested"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="DataType-2431"><a href="#DataType-2431"><span class="linenos">2431</span></a> <span class="s2">"values"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="DataType-2432"><a href="#DataType-2432"><span class="linenos">2432</span></a> <span class="p">}</span> +</span><span id="DataType-2433"><a href="#DataType-2433"><span class="linenos">2433</span></a> +</span><span id="DataType-2434"><a href="#DataType-2434"><span class="linenos">2434</span></a> <span class="k">class</span> <span class="nc">Type</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="DataType-2435"><a href="#DataType-2435"><span class="linenos">2435</span></a> <span class="n">CHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2436"><a href="#DataType-2436"><span class="linenos">2436</span></a> <span class="n">NCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2437"><a href="#DataType-2437"><span class="linenos">2437</span></a> <span class="n">VARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2438"><a href="#DataType-2438"><span class="linenos">2438</span></a> <span class="n">NVARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2439"><a href="#DataType-2439"><span class="linenos">2439</span></a> <span class="n">TEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2440"><a href="#DataType-2440"><span class="linenos">2440</span></a> <span class="n">MEDIUMTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2441"><a href="#DataType-2441"><span class="linenos">2441</span></a> <span class="n">LONGTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2442"><a href="#DataType-2442"><span class="linenos">2442</span></a> <span class="n">MEDIUMBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2443"><a href="#DataType-2443"><span class="linenos">2443</span></a> <span class="n">LONGBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2444"><a href="#DataType-2444"><span class="linenos">2444</span></a> <span class="n">BINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2445"><a href="#DataType-2445"><span class="linenos">2445</span></a> <span class="n">VARBINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2446"><a href="#DataType-2446"><span class="linenos">2446</span></a> <span class="n">INT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2447"><a href="#DataType-2447"><span class="linenos">2447</span></a> <span class="n">TINYINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2448"><a href="#DataType-2448"><span class="linenos">2448</span></a> <span class="n">SMALLINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2449"><a href="#DataType-2449"><span class="linenos">2449</span></a> <span class="n">BIGINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2450"><a href="#DataType-2450"><span class="linenos">2450</span></a> <span class="n">FLOAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2451"><a href="#DataType-2451"><span class="linenos">2451</span></a> <span class="n">DOUBLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2452"><a href="#DataType-2452"><span class="linenos">2452</span></a> <span class="n">DECIMAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2453"><a href="#DataType-2453"><span class="linenos">2453</span></a> <span class="n">BOOLEAN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2454"><a href="#DataType-2454"><span class="linenos">2454</span></a> <span class="n">JSON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2455"><a href="#DataType-2455"><span class="linenos">2455</span></a> <span class="n">JSONB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2456"><a href="#DataType-2456"><span class="linenos">2456</span></a> <span class="n">INTERVAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2457"><a href="#DataType-2457"><span class="linenos">2457</span></a> <span class="n">TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2458"><a href="#DataType-2458"><span class="linenos">2458</span></a> <span class="n">TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2459"><a href="#DataType-2459"><span class="linenos">2459</span></a> <span class="n">TIMESTAMPTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2460"><a href="#DataType-2460"><span class="linenos">2460</span></a> <span class="n">TIMESTAMPLTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2461"><a href="#DataType-2461"><span class="linenos">2461</span></a> <span class="n">DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2462"><a href="#DataType-2462"><span class="linenos">2462</span></a> <span class="n">DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2463"><a href="#DataType-2463"><span class="linenos">2463</span></a> <span class="n">ARRAY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2464"><a href="#DataType-2464"><span class="linenos">2464</span></a> <span class="n">MAP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2465"><a href="#DataType-2465"><span class="linenos">2465</span></a> <span class="n">UUID</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2466"><a href="#DataType-2466"><span class="linenos">2466</span></a> <span class="n">GEOGRAPHY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2467"><a href="#DataType-2467"><span class="linenos">2467</span></a> <span class="n">GEOMETRY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2468"><a href="#DataType-2468"><span class="linenos">2468</span></a> <span class="n">STRUCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2469"><a href="#DataType-2469"><span class="linenos">2469</span></a> <span class="n">NULLABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2470"><a href="#DataType-2470"><span class="linenos">2470</span></a> <span class="n">HLLSKETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2471"><a href="#DataType-2471"><span class="linenos">2471</span></a> <span class="n">HSTORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2472"><a href="#DataType-2472"><span class="linenos">2472</span></a> <span class="n">SUPER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2473"><a href="#DataType-2473"><span class="linenos">2473</span></a> <span class="n">SERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2474"><a href="#DataType-2474"><span class="linenos">2474</span></a> <span class="n">SMALLSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2475"><a href="#DataType-2475"><span class="linenos">2475</span></a> <span class="n">BIGSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2476"><a href="#DataType-2476"><span class="linenos">2476</span></a> <span class="n">XML</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2477"><a href="#DataType-2477"><span class="linenos">2477</span></a> <span class="n">UNIQUEIDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2478"><a href="#DataType-2478"><span class="linenos">2478</span></a> <span class="n">MONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2479"><a href="#DataType-2479"><span class="linenos">2479</span></a> <span class="n">SMALLMONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2480"><a href="#DataType-2480"><span class="linenos">2480</span></a> <span class="n">ROWVERSION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2481"><a href="#DataType-2481"><span class="linenos">2481</span></a> <span class="n">IMAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2482"><a href="#DataType-2482"><span class="linenos">2482</span></a> <span class="n">VARIANT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2483"><a href="#DataType-2483"><span class="linenos">2483</span></a> <span class="n">OBJECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2484"><a href="#DataType-2484"><span class="linenos">2484</span></a> <span class="n">NULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType-2485"><a href="#DataType-2485"><span class="linenos">2485</span></a> <span class="n">UNKNOWN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> <span class="c1"># Sentinel value, useful for type annotation</span> +</span><span id="DataType-2486"><a href="#DataType-2486"><span class="linenos">2486</span></a> +</span><span id="DataType-2487"><a href="#DataType-2487"><span class="linenos">2487</span></a> <span class="n">TEXT_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataType-2488"><a href="#DataType-2488"><span class="linenos">2488</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="DataType-2489"><a href="#DataType-2489"><span class="linenos">2489</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="DataType-2490"><a href="#DataType-2490"><span class="linenos">2490</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="DataType-2491"><a href="#DataType-2491"><span class="linenos">2491</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="DataType-2492"><a href="#DataType-2492"><span class="linenos">2492</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="DataType-2493"><a href="#DataType-2493"><span class="linenos">2493</span></a> <span class="p">}</span> +</span><span id="DataType-2494"><a href="#DataType-2494"><span class="linenos">2494</span></a> +</span><span id="DataType-2495"><a href="#DataType-2495"><span class="linenos">2495</span></a> <span class="n">INTEGER_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataType-2496"><a href="#DataType-2496"><span class="linenos">2496</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="DataType-2497"><a href="#DataType-2497"><span class="linenos">2497</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="DataType-2498"><a href="#DataType-2498"><span class="linenos">2498</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="DataType-2499"><a href="#DataType-2499"><span class="linenos">2499</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="DataType-2500"><a href="#DataType-2500"><span class="linenos">2500</span></a> <span class="p">}</span> +</span><span id="DataType-2501"><a href="#DataType-2501"><span class="linenos">2501</span></a> +</span><span id="DataType-2502"><a href="#DataType-2502"><span class="linenos">2502</span></a> <span class="n">FLOAT_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataType-2503"><a href="#DataType-2503"><span class="linenos">2503</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="DataType-2504"><a href="#DataType-2504"><span class="linenos">2504</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="DataType-2505"><a href="#DataType-2505"><span class="linenos">2505</span></a> <span class="p">}</span> +</span><span id="DataType-2506"><a href="#DataType-2506"><span class="linenos">2506</span></a> +</span><span id="DataType-2507"><a href="#DataType-2507"><span class="linenos">2507</span></a> <span class="n">NUMERIC_TYPES</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">INTEGER_TYPES</span><span class="p">,</span> <span class="o">*</span><span class="n">FLOAT_TYPES</span><span class="p">}</span> +</span><span id="DataType-2508"><a href="#DataType-2508"><span class="linenos">2508</span></a> +</span><span id="DataType-2509"><a href="#DataType-2509"><span class="linenos">2509</span></a> <span class="n">TEMPORAL_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="DataType-2510"><a href="#DataType-2510"><span class="linenos">2510</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="DataType-2511"><a href="#DataType-2511"><span class="linenos">2511</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="DataType-2512"><a href="#DataType-2512"><span class="linenos">2512</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="DataType-2513"><a href="#DataType-2513"><span class="linenos">2513</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="DataType-2514"><a href="#DataType-2514"><span class="linenos">2514</span></a> <span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="DataType-2515"><a href="#DataType-2515"><span class="linenos">2515</span></a> <span class="p">}</span> +</span><span id="DataType-2516"><a href="#DataType-2516"><span class="linenos">2516</span></a> +</span><span id="DataType-2517"><a href="#DataType-2517"><span class="linenos">2517</span></a> <span class="nd">@classmethod</span> +</span><span id="DataType-2518"><a href="#DataType-2518"><span class="linenos">2518</span></a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span> +</span><span id="DataType-2519"><a href="#DataType-2519"><span class="linenos">2519</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="DataType-2520"><a href="#DataType-2520"><span class="linenos">2520</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataType</span><span class="p">:</span> +</span><span id="DataType-2521"><a href="#DataType-2521"><span class="linenos">2521</span></a> <span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +</span><span id="DataType-2522"><a href="#DataType-2522"><span class="linenos">2522</span></a> +</span><span id="DataType-2523"><a href="#DataType-2523"><span class="linenos">2523</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="DataType-2524"><a href="#DataType-2524"><span class="linenos">2524</span></a> <span class="k">if</span> <span class="n">dtype</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">__members__</span><span class="p">:</span> +</span><span id="DataType-2525"><a href="#DataType-2525"><span class="linenos">2525</span></a> <span class="n">data_type_exp</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">dtype</span><span class="o">.</span><span class="n">upper</span><span class="p">()])</span> +</span><span id="DataType-2526"><a href="#DataType-2526"><span class="linenos">2526</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataType-2527"><a href="#DataType-2527"><span class="linenos">2527</span></a> <span class="n">data_type_exp</span> <span class="o">=</span> <span class="n">parse_one</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="DataType-2528"><a href="#DataType-2528"><span class="linenos">2528</span></a> <span class="k">if</span> <span class="n">data_type_exp</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataType-2529"><a href="#DataType-2529"><span class="linenos">2529</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unparsable data type value: </span><span class="si">{</span><span class="n">dtype</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="DataType-2530"><a href="#DataType-2530"><span class="linenos">2530</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">):</span> +</span><span id="DataType-2531"><a href="#DataType-2531"><span class="linenos">2531</span></a> <span class="n">data_type_exp</span> <span class="o">=</span> <span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">dtype</span><span class="p">)</span> +</span><span id="DataType-2532"><a href="#DataType-2532"><span class="linenos">2532</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="DataType-2533"><a href="#DataType-2533"><span class="linenos">2533</span></a> <span class="k">return</span> <span class="n">dtype</span> +</span><span id="DataType-2534"><a href="#DataType-2534"><span class="linenos">2534</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataType-2535"><a href="#DataType-2535"><span class="linenos">2535</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid data type: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span><span class="si">}</span><span class="s2">. Expected str or DataType.Type"</span><span class="p">)</span> +</span><span id="DataType-2536"><a href="#DataType-2536"><span class="linenos">2536</span></a> <span class="k">return</span> <span class="n">DataType</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">data_type_exp</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> +</span><span id="DataType-2537"><a href="#DataType-2537"><span class="linenos">2537</span></a> +</span><span id="DataType-2538"><a href="#DataType-2538"><span class="linenos">2538</span></a> <span class="k">def</span> <span class="nf">is_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="DataType-2539"><a href="#DataType-2539"><span class="linenos">2539</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">dtype</span> +</span></pre></div> + + + + + <div id="DataType.build" class="classattr"> + <input id="DataType.build-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">build</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">dtype</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#DataType">sqlglot.expressions.DataType</a></span> <span class="o">|</span> <span class="n"><a href="#DataType.Type">sqlglot.expressions.DataType.Type</a></span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#DataType">sqlglot.expressions.DataType</a></span>:</span></span> + + <label class="view-source-button" for="DataType.build-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataType.build"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataType.build-2517"><a href="#DataType.build-2517"><span class="linenos">2517</span></a> <span class="nd">@classmethod</span> +</span><span id="DataType.build-2518"><a href="#DataType.build-2518"><span class="linenos">2518</span></a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span> +</span><span id="DataType.build-2519"><a href="#DataType.build-2519"><span class="linenos">2519</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="DataType.build-2520"><a href="#DataType.build-2520"><span class="linenos">2520</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">DataType</span><span class="p">:</span> +</span><span id="DataType.build-2521"><a href="#DataType.build-2521"><span class="linenos">2521</span></a> <span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +</span><span id="DataType.build-2522"><a href="#DataType.build-2522"><span class="linenos">2522</span></a> +</span><span id="DataType.build-2523"><a href="#DataType.build-2523"><span class="linenos">2523</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="DataType.build-2524"><a href="#DataType.build-2524"><span class="linenos">2524</span></a> <span class="k">if</span> <span class="n">dtype</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">__members__</span><span class="p">:</span> +</span><span id="DataType.build-2525"><a href="#DataType.build-2525"><span class="linenos">2525</span></a> <span class="n">data_type_exp</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">dtype</span><span class="o">.</span><span class="n">upper</span><span class="p">()])</span> +</span><span id="DataType.build-2526"><a href="#DataType.build-2526"><span class="linenos">2526</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataType.build-2527"><a href="#DataType.build-2527"><span class="linenos">2527</span></a> <span class="n">data_type_exp</span> <span class="o">=</span> <span class="n">parse_one</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="DataType.build-2528"><a href="#DataType.build-2528"><span class="linenos">2528</span></a> <span class="k">if</span> <span class="n">data_type_exp</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="DataType.build-2529"><a href="#DataType.build-2529"><span class="linenos">2529</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unparsable data type value: </span><span class="si">{</span><span class="n">dtype</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="DataType.build-2530"><a href="#DataType.build-2530"><span class="linenos">2530</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">):</span> +</span><span id="DataType.build-2531"><a href="#DataType.build-2531"><span class="linenos">2531</span></a> <span class="n">data_type_exp</span> <span class="o">=</span> <span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">dtype</span><span class="p">)</span> +</span><span id="DataType.build-2532"><a href="#DataType.build-2532"><span class="linenos">2532</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">dtype</span><span class="p">,</span> <span class="n">DataType</span><span class="p">):</span> +</span><span id="DataType.build-2533"><a href="#DataType.build-2533"><span class="linenos">2533</span></a> <span class="k">return</span> <span class="n">dtype</span> +</span><span id="DataType.build-2534"><a href="#DataType.build-2534"><span class="linenos">2534</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="DataType.build-2535"><a href="#DataType.build-2535"><span class="linenos">2535</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid data type: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span><span class="si">}</span><span class="s2">. Expected str or DataType.Type"</span><span class="p">)</span> +</span><span id="DataType.build-2536"><a href="#DataType.build-2536"><span class="linenos">2536</span></a> <span class="k">return</span> <span class="n">DataType</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="o">**</span><span class="n">data_type_exp</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">})</span> +</span></pre></div> + + + + + </div> + <div id="DataType.is_type" class="classattr"> + <input id="DataType.is_type-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">is_type</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">dtype</span><span class="p">:</span> <span class="n"><a href="#DataType.Type">sqlglot.expressions.DataType.Type</a></span></span><span class="return-annotation">) -> <span class="nb">bool</span>:</span></span> + + <label class="view-source-button" for="DataType.is_type-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataType.is_type"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataType.is_type-2538"><a href="#DataType.is_type-2538"><span class="linenos">2538</span></a> <span class="k">def</span> <span class="nf">is_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="DataType.is_type-2539"><a href="#DataType.is_type-2539"><span class="linenos">2539</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">dtype</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DataType.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DataType.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DataType.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DataType.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DataType.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DataType.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DataType.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DataType.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DataType.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DataType.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DataType.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DataType.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DataType.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DataType.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DataType.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DataType.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DataType.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DataType.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DataType.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DataType.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DataType.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DataType.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DataType.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DataType.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DataType.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DataType.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DataType.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DataType.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DataType.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DataType.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DataType.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DataType.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DataType.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DataType.Type"> + <input id="DataType.Type-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DataType.Type</span><wbr>(<span class="base"><a href="helper.html#AutoName">sqlglot.helper.AutoName</a></span>): + + <label class="view-source-button" for="DataType.Type-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DataType.Type"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DataType.Type-2434"><a href="#DataType.Type-2434"><span class="linenos">2434</span></a> <span class="k">class</span> <span class="nc">Type</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="DataType.Type-2435"><a href="#DataType.Type-2435"><span class="linenos">2435</span></a> <span class="n">CHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2436"><a href="#DataType.Type-2436"><span class="linenos">2436</span></a> <span class="n">NCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2437"><a href="#DataType.Type-2437"><span class="linenos">2437</span></a> <span class="n">VARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2438"><a href="#DataType.Type-2438"><span class="linenos">2438</span></a> <span class="n">NVARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2439"><a href="#DataType.Type-2439"><span class="linenos">2439</span></a> <span class="n">TEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2440"><a href="#DataType.Type-2440"><span class="linenos">2440</span></a> <span class="n">MEDIUMTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2441"><a href="#DataType.Type-2441"><span class="linenos">2441</span></a> <span class="n">LONGTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2442"><a href="#DataType.Type-2442"><span class="linenos">2442</span></a> <span class="n">MEDIUMBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2443"><a href="#DataType.Type-2443"><span class="linenos">2443</span></a> <span class="n">LONGBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2444"><a href="#DataType.Type-2444"><span class="linenos">2444</span></a> <span class="n">BINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2445"><a href="#DataType.Type-2445"><span class="linenos">2445</span></a> <span class="n">VARBINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2446"><a href="#DataType.Type-2446"><span class="linenos">2446</span></a> <span class="n">INT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2447"><a href="#DataType.Type-2447"><span class="linenos">2447</span></a> <span class="n">TINYINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2448"><a href="#DataType.Type-2448"><span class="linenos">2448</span></a> <span class="n">SMALLINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2449"><a href="#DataType.Type-2449"><span class="linenos">2449</span></a> <span class="n">BIGINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2450"><a href="#DataType.Type-2450"><span class="linenos">2450</span></a> <span class="n">FLOAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2451"><a href="#DataType.Type-2451"><span class="linenos">2451</span></a> <span class="n">DOUBLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2452"><a href="#DataType.Type-2452"><span class="linenos">2452</span></a> <span class="n">DECIMAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2453"><a href="#DataType.Type-2453"><span class="linenos">2453</span></a> <span class="n">BOOLEAN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2454"><a href="#DataType.Type-2454"><span class="linenos">2454</span></a> <span class="n">JSON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2455"><a href="#DataType.Type-2455"><span class="linenos">2455</span></a> <span class="n">JSONB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2456"><a href="#DataType.Type-2456"><span class="linenos">2456</span></a> <span class="n">INTERVAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2457"><a href="#DataType.Type-2457"><span class="linenos">2457</span></a> <span class="n">TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2458"><a href="#DataType.Type-2458"><span class="linenos">2458</span></a> <span class="n">TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2459"><a href="#DataType.Type-2459"><span class="linenos">2459</span></a> <span class="n">TIMESTAMPTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2460"><a href="#DataType.Type-2460"><span class="linenos">2460</span></a> <span class="n">TIMESTAMPLTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2461"><a href="#DataType.Type-2461"><span class="linenos">2461</span></a> <span class="n">DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2462"><a href="#DataType.Type-2462"><span class="linenos">2462</span></a> <span class="n">DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2463"><a href="#DataType.Type-2463"><span class="linenos">2463</span></a> <span class="n">ARRAY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2464"><a href="#DataType.Type-2464"><span class="linenos">2464</span></a> <span class="n">MAP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2465"><a href="#DataType.Type-2465"><span class="linenos">2465</span></a> <span class="n">UUID</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2466"><a href="#DataType.Type-2466"><span class="linenos">2466</span></a> <span class="n">GEOGRAPHY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2467"><a href="#DataType.Type-2467"><span class="linenos">2467</span></a> <span class="n">GEOMETRY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2468"><a href="#DataType.Type-2468"><span class="linenos">2468</span></a> <span class="n">STRUCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2469"><a href="#DataType.Type-2469"><span class="linenos">2469</span></a> <span class="n">NULLABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2470"><a href="#DataType.Type-2470"><span class="linenos">2470</span></a> <span class="n">HLLSKETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2471"><a href="#DataType.Type-2471"><span class="linenos">2471</span></a> <span class="n">HSTORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2472"><a href="#DataType.Type-2472"><span class="linenos">2472</span></a> <span class="n">SUPER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2473"><a href="#DataType.Type-2473"><span class="linenos">2473</span></a> <span class="n">SERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2474"><a href="#DataType.Type-2474"><span class="linenos">2474</span></a> <span class="n">SMALLSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2475"><a href="#DataType.Type-2475"><span class="linenos">2475</span></a> <span class="n">BIGSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2476"><a href="#DataType.Type-2476"><span class="linenos">2476</span></a> <span class="n">XML</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2477"><a href="#DataType.Type-2477"><span class="linenos">2477</span></a> <span class="n">UNIQUEIDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2478"><a href="#DataType.Type-2478"><span class="linenos">2478</span></a> <span class="n">MONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2479"><a href="#DataType.Type-2479"><span class="linenos">2479</span></a> <span class="n">SMALLMONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2480"><a href="#DataType.Type-2480"><span class="linenos">2480</span></a> <span class="n">ROWVERSION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2481"><a href="#DataType.Type-2481"><span class="linenos">2481</span></a> <span class="n">IMAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2482"><a href="#DataType.Type-2482"><span class="linenos">2482</span></a> <span class="n">VARIANT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2483"><a href="#DataType.Type-2483"><span class="linenos">2483</span></a> <span class="n">OBJECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2484"><a href="#DataType.Type-2484"><span class="linenos">2484</span></a> <span class="n">NULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="DataType.Type-2485"><a href="#DataType.Type-2485"><span class="linenos">2485</span></a> <span class="n">UNKNOWN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> <span class="c1"># Sentinel value, useful for type annotation</span> +</span></pre></div> + + + <div class="docstring"><p>An enumeration.</p> +</div> + + + <div id="DataType.Type.CHAR" class="classattr"> + <div class="attr variable"> + <span class="name">CHAR</span><span class="default_value"> = <Type.CHAR: 'CHAR'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.CHAR"></a> + + + + </div> + <div id="DataType.Type.NCHAR" class="classattr"> + <div class="attr variable"> + <span class="name">NCHAR</span><span class="default_value"> = <Type.NCHAR: 'NCHAR'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.NCHAR"></a> + + + + </div> + <div id="DataType.Type.VARCHAR" class="classattr"> + <div class="attr variable"> + <span class="name">VARCHAR</span><span class="default_value"> = <Type.VARCHAR: 'VARCHAR'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.VARCHAR"></a> + + + + </div> + <div id="DataType.Type.NVARCHAR" class="classattr"> + <div class="attr variable"> + <span class="name">NVARCHAR</span><span class="default_value"> = <Type.NVARCHAR: 'NVARCHAR'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.NVARCHAR"></a> + + + + </div> + <div id="DataType.Type.TEXT" class="classattr"> + <div class="attr variable"> + <span class="name">TEXT</span><span class="default_value"> = <Type.TEXT: 'TEXT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.TEXT"></a> + + + + </div> + <div id="DataType.Type.MEDIUMTEXT" class="classattr"> + <div class="attr variable"> + <span class="name">MEDIUMTEXT</span><span class="default_value"> = <Type.MEDIUMTEXT: 'MEDIUMTEXT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.MEDIUMTEXT"></a> + + + + </div> + <div id="DataType.Type.LONGTEXT" class="classattr"> + <div class="attr variable"> + <span class="name">LONGTEXT</span><span class="default_value"> = <Type.LONGTEXT: 'LONGTEXT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.LONGTEXT"></a> + + + + </div> + <div id="DataType.Type.MEDIUMBLOB" class="classattr"> + <div class="attr variable"> + <span class="name">MEDIUMBLOB</span><span class="default_value"> = <Type.MEDIUMBLOB: 'MEDIUMBLOB'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.MEDIUMBLOB"></a> + + + + </div> + <div id="DataType.Type.LONGBLOB" class="classattr"> + <div class="attr variable"> + <span class="name">LONGBLOB</span><span class="default_value"> = <Type.LONGBLOB: 'LONGBLOB'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.LONGBLOB"></a> + + + + </div> + <div id="DataType.Type.BINARY" class="classattr"> + <div class="attr variable"> + <span class="name">BINARY</span><span class="default_value"> = <Type.BINARY: 'BINARY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.BINARY"></a> + + + + </div> + <div id="DataType.Type.VARBINARY" class="classattr"> + <div class="attr variable"> + <span class="name">VARBINARY</span><span class="default_value"> = <Type.VARBINARY: 'VARBINARY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.VARBINARY"></a> + + + + </div> + <div id="DataType.Type.INT" class="classattr"> + <div class="attr variable"> + <span class="name">INT</span><span class="default_value"> = <Type.INT: 'INT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.INT"></a> + + + + </div> + <div id="DataType.Type.TINYINT" class="classattr"> + <div class="attr variable"> + <span class="name">TINYINT</span><span class="default_value"> = <Type.TINYINT: 'TINYINT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.TINYINT"></a> + + + + </div> + <div id="DataType.Type.SMALLINT" class="classattr"> + <div class="attr variable"> + <span class="name">SMALLINT</span><span class="default_value"> = <Type.SMALLINT: 'SMALLINT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.SMALLINT"></a> + + + + </div> + <div id="DataType.Type.BIGINT" class="classattr"> + <div class="attr variable"> + <span class="name">BIGINT</span><span class="default_value"> = <Type.BIGINT: 'BIGINT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.BIGINT"></a> + + + + </div> + <div id="DataType.Type.FLOAT" class="classattr"> + <div class="attr variable"> + <span class="name">FLOAT</span><span class="default_value"> = <Type.FLOAT: 'FLOAT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.FLOAT"></a> + + + + </div> + <div id="DataType.Type.DOUBLE" class="classattr"> + <div class="attr variable"> + <span class="name">DOUBLE</span><span class="default_value"> = <Type.DOUBLE: 'DOUBLE'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.DOUBLE"></a> + + + + </div> + <div id="DataType.Type.DECIMAL" class="classattr"> + <div class="attr variable"> + <span class="name">DECIMAL</span><span class="default_value"> = <Type.DECIMAL: 'DECIMAL'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.DECIMAL"></a> + + + + </div> + <div id="DataType.Type.BOOLEAN" class="classattr"> + <div class="attr variable"> + <span class="name">BOOLEAN</span><span class="default_value"> = <Type.BOOLEAN: 'BOOLEAN'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.BOOLEAN"></a> + + + + </div> + <div id="DataType.Type.JSON" class="classattr"> + <div class="attr variable"> + <span class="name">JSON</span><span class="default_value"> = <Type.JSON: 'JSON'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.JSON"></a> + + + + </div> + <div id="DataType.Type.JSONB" class="classattr"> + <div class="attr variable"> + <span class="name">JSONB</span><span class="default_value"> = <Type.JSONB: 'JSONB'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.JSONB"></a> + + + + </div> + <div id="DataType.Type.INTERVAL" class="classattr"> + <div class="attr variable"> + <span class="name">INTERVAL</span><span class="default_value"> = <Type.INTERVAL: 'INTERVAL'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.INTERVAL"></a> + + + + </div> + <div id="DataType.Type.TIME" class="classattr"> + <div class="attr variable"> + <span class="name">TIME</span><span class="default_value"> = <Type.TIME: 'TIME'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.TIME"></a> + + + + </div> + <div id="DataType.Type.TIMESTAMP" class="classattr"> + <div class="attr variable"> + <span class="name">TIMESTAMP</span><span class="default_value"> = <Type.TIMESTAMP: 'TIMESTAMP'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.TIMESTAMP"></a> + + + + </div> + <div id="DataType.Type.TIMESTAMPTZ" class="classattr"> + <div class="attr variable"> + <span class="name">TIMESTAMPTZ</span><span class="default_value"> = <Type.TIMESTAMPTZ: 'TIMESTAMPTZ'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.TIMESTAMPTZ"></a> + + + + </div> + <div id="DataType.Type.TIMESTAMPLTZ" class="classattr"> + <div class="attr variable"> + <span class="name">TIMESTAMPLTZ</span><span class="default_value"> = <Type.TIMESTAMPLTZ: 'TIMESTAMPLTZ'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.TIMESTAMPLTZ"></a> + + + + </div> + <div id="DataType.Type.DATE" class="classattr"> + <div class="attr variable"> + <span class="name">DATE</span><span class="default_value"> = <Type.DATE: 'DATE'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.DATE"></a> + + + + </div> + <div id="DataType.Type.DATETIME" class="classattr"> + <div class="attr variable"> + <span class="name">DATETIME</span><span class="default_value"> = <Type.DATETIME: 'DATETIME'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.DATETIME"></a> + + + + </div> + <div id="DataType.Type.ARRAY" class="classattr"> + <div class="attr variable"> + <span class="name">ARRAY</span><span class="default_value"> = <Type.ARRAY: 'ARRAY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.ARRAY"></a> + + + + </div> + <div id="DataType.Type.MAP" class="classattr"> + <div class="attr variable"> + <span class="name">MAP</span><span class="default_value"> = <Type.MAP: 'MAP'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.MAP"></a> + + + + </div> + <div id="DataType.Type.UUID" class="classattr"> + <div class="attr variable"> + <span class="name">UUID</span><span class="default_value"> = <Type.UUID: 'UUID'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.UUID"></a> + + + + </div> + <div id="DataType.Type.GEOGRAPHY" class="classattr"> + <div class="attr variable"> + <span class="name">GEOGRAPHY</span><span class="default_value"> = <Type.GEOGRAPHY: 'GEOGRAPHY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.GEOGRAPHY"></a> + + + + </div> + <div id="DataType.Type.GEOMETRY" class="classattr"> + <div class="attr variable"> + <span class="name">GEOMETRY</span><span class="default_value"> = <Type.GEOMETRY: 'GEOMETRY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.GEOMETRY"></a> + + + + </div> + <div id="DataType.Type.STRUCT" class="classattr"> + <div class="attr variable"> + <span class="name">STRUCT</span><span class="default_value"> = <Type.STRUCT: 'STRUCT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.STRUCT"></a> + + + + </div> + <div id="DataType.Type.NULLABLE" class="classattr"> + <div class="attr variable"> + <span class="name">NULLABLE</span><span class="default_value"> = <Type.NULLABLE: 'NULLABLE'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.NULLABLE"></a> + + + + </div> + <div id="DataType.Type.HLLSKETCH" class="classattr"> + <div class="attr variable"> + <span class="name">HLLSKETCH</span><span class="default_value"> = <Type.HLLSKETCH: 'HLLSKETCH'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.HLLSKETCH"></a> + + + + </div> + <div id="DataType.Type.HSTORE" class="classattr"> + <div class="attr variable"> + <span class="name">HSTORE</span><span class="default_value"> = <Type.HSTORE: 'HSTORE'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.HSTORE"></a> + + + + </div> + <div id="DataType.Type.SUPER" class="classattr"> + <div class="attr variable"> + <span class="name">SUPER</span><span class="default_value"> = <Type.SUPER: 'SUPER'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.SUPER"></a> + + + + </div> + <div id="DataType.Type.SERIAL" class="classattr"> + <div class="attr variable"> + <span class="name">SERIAL</span><span class="default_value"> = <Type.SERIAL: 'SERIAL'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.SERIAL"></a> + + + + </div> + <div id="DataType.Type.SMALLSERIAL" class="classattr"> + <div class="attr variable"> + <span class="name">SMALLSERIAL</span><span class="default_value"> = <Type.SMALLSERIAL: 'SMALLSERIAL'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.SMALLSERIAL"></a> + + + + </div> + <div id="DataType.Type.BIGSERIAL" class="classattr"> + <div class="attr variable"> + <span class="name">BIGSERIAL</span><span class="default_value"> = <Type.BIGSERIAL: 'BIGSERIAL'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.BIGSERIAL"></a> + + + + </div> + <div id="DataType.Type.XML" class="classattr"> + <div class="attr variable"> + <span class="name">XML</span><span class="default_value"> = <Type.XML: 'XML'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.XML"></a> + + + + </div> + <div id="DataType.Type.UNIQUEIDENTIFIER" class="classattr"> + <div class="attr variable"> + <span class="name">UNIQUEIDENTIFIER</span><span class="default_value"> = <Type.UNIQUEIDENTIFIER: 'UNIQUEIDENTIFIER'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.UNIQUEIDENTIFIER"></a> + + + + </div> + <div id="DataType.Type.MONEY" class="classattr"> + <div class="attr variable"> + <span class="name">MONEY</span><span class="default_value"> = <Type.MONEY: 'MONEY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.MONEY"></a> + + + + </div> + <div id="DataType.Type.SMALLMONEY" class="classattr"> + <div class="attr variable"> + <span class="name">SMALLMONEY</span><span class="default_value"> = <Type.SMALLMONEY: 'SMALLMONEY'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.SMALLMONEY"></a> + + + + </div> + <div id="DataType.Type.ROWVERSION" class="classattr"> + <div class="attr variable"> + <span class="name">ROWVERSION</span><span class="default_value"> = <Type.ROWVERSION: 'ROWVERSION'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.ROWVERSION"></a> + + + + </div> + <div id="DataType.Type.IMAGE" class="classattr"> + <div class="attr variable"> + <span class="name">IMAGE</span><span class="default_value"> = <Type.IMAGE: 'IMAGE'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.IMAGE"></a> + + + + </div> + <div id="DataType.Type.VARIANT" class="classattr"> + <div class="attr variable"> + <span class="name">VARIANT</span><span class="default_value"> = <Type.VARIANT: 'VARIANT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.VARIANT"></a> + + + + </div> + <div id="DataType.Type.OBJECT" class="classattr"> + <div class="attr variable"> + <span class="name">OBJECT</span><span class="default_value"> = <Type.OBJECT: 'OBJECT'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.OBJECT"></a> + + + + </div> + <div id="DataType.Type.NULL" class="classattr"> + <div class="attr variable"> + <span class="name">NULL</span><span class="default_value"> = <Type.NULL: 'NULL'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.NULL"></a> + + + + </div> + <div id="DataType.Type.UNKNOWN" class="classattr"> + <div class="attr variable"> + <span class="name">UNKNOWN</span><span class="default_value"> = <Type.UNKNOWN: 'UNKNOWN'></span> + + + </div> + <a class="headerlink" href="#DataType.Type.UNKNOWN"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="DataType.Type.name" class="variable">name</dd> + <dd id="DataType.Type.value" class="variable">value</dd> + + </div> + </dl> + </div> + </section> + <section id="PseudoType"> + <input id="PseudoType-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PseudoType</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="PseudoType-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PseudoType"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PseudoType-2543"><a href="#PseudoType-2543"><span class="linenos">2543</span></a><span class="k">class</span> <span class="nc">PseudoType</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="PseudoType-2544"><a href="#PseudoType-2544"><span class="linenos">2544</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="PseudoType.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="PseudoType.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="PseudoType.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="PseudoType.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="PseudoType.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="PseudoType.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="PseudoType.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="PseudoType.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="PseudoType.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="PseudoType.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="PseudoType.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="PseudoType.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="PseudoType.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="PseudoType.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="PseudoType.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="PseudoType.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="PseudoType.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="PseudoType.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="PseudoType.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="PseudoType.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="PseudoType.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="PseudoType.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="PseudoType.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="PseudoType.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="PseudoType.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="PseudoType.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="PseudoType.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="PseudoType.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="PseudoType.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="PseudoType.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="PseudoType.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="PseudoType.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="PseudoType.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StructKwarg"> + <input id="StructKwarg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StructKwarg</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="StructKwarg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StructKwarg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StructKwarg-2547"><a href="#StructKwarg-2547"><span class="linenos">2547</span></a><span class="k">class</span> <span class="nc">StructKwarg</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="StructKwarg-2548"><a href="#StructKwarg-2548"><span class="linenos">2548</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StructKwarg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StructKwarg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StructKwarg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StructKwarg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StructKwarg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StructKwarg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StructKwarg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StructKwarg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StructKwarg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StructKwarg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StructKwarg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StructKwarg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StructKwarg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StructKwarg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StructKwarg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StructKwarg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StructKwarg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StructKwarg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StructKwarg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StructKwarg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StructKwarg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StructKwarg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StructKwarg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StructKwarg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StructKwarg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StructKwarg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StructKwarg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StructKwarg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StructKwarg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StructKwarg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StructKwarg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StructKwarg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StructKwarg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SubqueryPredicate"> + <input id="SubqueryPredicate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SubqueryPredicate</span><wbr>(<span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="SubqueryPredicate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SubqueryPredicate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SubqueryPredicate-2552"><a href="#SubqueryPredicate-2552"><span class="linenos">2552</span></a><span class="k">class</span> <span class="nc">SubqueryPredicate</span><span class="p">(</span><span class="n">Predicate</span><span class="p">):</span> +</span><span id="SubqueryPredicate-2553"><a href="#SubqueryPredicate-2553"><span class="linenos">2553</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SubqueryPredicate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SubqueryPredicate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SubqueryPredicate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SubqueryPredicate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SubqueryPredicate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SubqueryPredicate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SubqueryPredicate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SubqueryPredicate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SubqueryPredicate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SubqueryPredicate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SubqueryPredicate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SubqueryPredicate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SubqueryPredicate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SubqueryPredicate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SubqueryPredicate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SubqueryPredicate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SubqueryPredicate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SubqueryPredicate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SubqueryPredicate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SubqueryPredicate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SubqueryPredicate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SubqueryPredicate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SubqueryPredicate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SubqueryPredicate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SubqueryPredicate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SubqueryPredicate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SubqueryPredicate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SubqueryPredicate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SubqueryPredicate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SubqueryPredicate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SubqueryPredicate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SubqueryPredicate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SubqueryPredicate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="SubqueryPredicate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="SubqueryPredicate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="SubqueryPredicate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="All"> + <input id="All-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">All</span><wbr>(<span class="base"><a href="#SubqueryPredicate">SubqueryPredicate</a></span>): + + <label class="view-source-button" for="All-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#All"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="All-2556"><a href="#All-2556"><span class="linenos">2556</span></a><span class="k">class</span> <span class="nc">All</span><span class="p">(</span><span class="n">SubqueryPredicate</span><span class="p">):</span> +</span><span id="All-2557"><a href="#All-2557"><span class="linenos">2557</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="All.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="All.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="All.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="All.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="All.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="All.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="All.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="All.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="All.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="All.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="All.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="All.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="All.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="All.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="All.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="All.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="All.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="All.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="All.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="All.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="All.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="All.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="All.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="All.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="All.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="All.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="All.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="All.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="All.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="All.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="All.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="All.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="All.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="All.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="All.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="All.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Any"> + <input id="Any-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Any</span><wbr>(<span class="base"><a href="#SubqueryPredicate">SubqueryPredicate</a></span>): + + <label class="view-source-button" for="Any-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Any"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Any-2560"><a href="#Any-2560"><span class="linenos">2560</span></a><span class="k">class</span> <span class="nc">Any</span><span class="p">(</span><span class="n">SubqueryPredicate</span><span class="p">):</span> +</span><span id="Any-2561"><a href="#Any-2561"><span class="linenos">2561</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Any.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Any.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Any.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Any.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Any.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Any.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Any.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Any.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Any.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Any.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Any.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Any.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Any.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Any.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Any.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Any.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Any.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Any.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Any.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Any.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Any.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Any.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Any.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Any.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Any.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Any.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Any.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Any.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Any.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Any.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Any.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Any.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Any.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Any.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Any.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Any.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Exists"> + <input id="Exists-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Exists</span><wbr>(<span class="base"><a href="#SubqueryPredicate">SubqueryPredicate</a></span>): + + <label class="view-source-button" for="Exists-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Exists"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Exists-2564"><a href="#Exists-2564"><span class="linenos">2564</span></a><span class="k">class</span> <span class="nc">Exists</span><span class="p">(</span><span class="n">SubqueryPredicate</span><span class="p">):</span> +</span><span id="Exists-2565"><a href="#Exists-2565"><span class="linenos">2565</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Exists.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Exists.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Exists.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Exists.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Exists.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Exists.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Exists.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Exists.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Exists.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Exists.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Exists.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Exists.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Exists.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Exists.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Exists.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Exists.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Exists.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Exists.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Exists.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Exists.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Exists.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Exists.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Exists.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Exists.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Exists.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Exists.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Exists.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Exists.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Exists.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Exists.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Exists.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Exists.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Exists.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Exists.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Exists.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Exists.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Command"> + <input id="Command-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Command</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Command-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Command"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Command-2570"><a href="#Command-2570"><span class="linenos">2570</span></a><span class="k">class</span> <span class="nc">Command</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Command-2571"><a href="#Command-2571"><span class="linenos">2571</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Command.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Command.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Command.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Command.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Command.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Command.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Command.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Command.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Command.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Command.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Command.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Command.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Command.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Command.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Command.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Command.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Command.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Command.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Command.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Command.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Command.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Command.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Command.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Command.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Command.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Command.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Command.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Command.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Command.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Command.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Command.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Command.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Command.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Transaction"> + <input id="Transaction-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Transaction</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Transaction-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Transaction"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Transaction-2574"><a href="#Transaction-2574"><span class="linenos">2574</span></a><span class="k">class</span> <span class="nc">Transaction</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Transaction-2575"><a href="#Transaction-2575"><span class="linenos">2575</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"modes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Transaction.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Transaction.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Transaction.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Transaction.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Transaction.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Transaction.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Transaction.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Transaction.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Transaction.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Transaction.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Transaction.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Transaction.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Transaction.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Transaction.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Transaction.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Transaction.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Transaction.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Transaction.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Transaction.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Transaction.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Transaction.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Transaction.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Transaction.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Transaction.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Transaction.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Transaction.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Transaction.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Transaction.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Transaction.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Transaction.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Transaction.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Transaction.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Transaction.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Commit"> + <input id="Commit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Commit</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Commit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Commit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Commit-2578"><a href="#Commit-2578"><span class="linenos">2578</span></a><span class="k">class</span> <span class="nc">Commit</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Commit-2579"><a href="#Commit-2579"><span class="linenos">2579</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"chain"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Commit.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Commit.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Commit.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Commit.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Commit.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Commit.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Commit.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Commit.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Commit.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Commit.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Commit.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Commit.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Commit.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Commit.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Commit.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Commit.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Commit.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Commit.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Commit.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Commit.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Commit.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Commit.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Commit.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Commit.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Commit.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Commit.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Commit.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Commit.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Commit.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Commit.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Commit.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Commit.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Commit.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Rollback"> + <input id="Rollback-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Rollback</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Rollback-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Rollback"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Rollback-2582"><a href="#Rollback-2582"><span class="linenos">2582</span></a><span class="k">class</span> <span class="nc">Rollback</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Rollback-2583"><a href="#Rollback-2583"><span class="linenos">2583</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"savepoint"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Rollback.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Rollback.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Rollback.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Rollback.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Rollback.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Rollback.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Rollback.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Rollback.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Rollback.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Rollback.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Rollback.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Rollback.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Rollback.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Rollback.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Rollback.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Rollback.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Rollback.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Rollback.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Rollback.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Rollback.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Rollback.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Rollback.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Rollback.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Rollback.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Rollback.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Rollback.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Rollback.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Rollback.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Rollback.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Rollback.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Rollback.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Rollback.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Rollback.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AlterTable"> + <input id="AlterTable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AlterTable</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="AlterTable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AlterTable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AlterTable-2586"><a href="#AlterTable-2586"><span class="linenos">2586</span></a><span class="k">class</span> <span class="nc">AlterTable</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="AlterTable-2587"><a href="#AlterTable-2587"><span class="linenos">2587</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AlterTable.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AlterTable.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AlterTable.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AlterTable.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AlterTable.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AlterTable.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AlterTable.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AlterTable.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AlterTable.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AlterTable.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AlterTable.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AlterTable.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AlterTable.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AlterTable.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AlterTable.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AlterTable.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AlterTable.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AlterTable.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AlterTable.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AlterTable.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AlterTable.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AlterTable.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AlterTable.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AlterTable.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AlterTable.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AlterTable.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AlterTable.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AlterTable.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AlterTable.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AlterTable.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AlterTable.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AlterTable.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AlterTable.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AddConstraint"> + <input id="AddConstraint-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AddConstraint</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="AddConstraint-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AddConstraint"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AddConstraint-2590"><a href="#AddConstraint-2590"><span class="linenos">2590</span></a><span class="k">class</span> <span class="nc">AddConstraint</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="AddConstraint-2591"><a href="#AddConstraint-2591"><span class="linenos">2591</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"enforced"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AddConstraint.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AddConstraint.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AddConstraint.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AddConstraint.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AddConstraint.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AddConstraint.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AddConstraint.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AddConstraint.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AddConstraint.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AddConstraint.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AddConstraint.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AddConstraint.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AddConstraint.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AddConstraint.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AddConstraint.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AddConstraint.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AddConstraint.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AddConstraint.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AddConstraint.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AddConstraint.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AddConstraint.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AddConstraint.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AddConstraint.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AddConstraint.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AddConstraint.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AddConstraint.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AddConstraint.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AddConstraint.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AddConstraint.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AddConstraint.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AddConstraint.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AddConstraint.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AddConstraint.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DropPartition"> + <input id="DropPartition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DropPartition</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="DropPartition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DropPartition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DropPartition-2594"><a href="#DropPartition-2594"><span class="linenos">2594</span></a><span class="k">class</span> <span class="nc">DropPartition</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="DropPartition-2595"><a href="#DropPartition-2595"><span class="linenos">2595</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"exists"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DropPartition.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DropPartition.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DropPartition.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DropPartition.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DropPartition.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DropPartition.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DropPartition.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DropPartition.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DropPartition.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DropPartition.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DropPartition.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DropPartition.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DropPartition.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DropPartition.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DropPartition.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DropPartition.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DropPartition.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DropPartition.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DropPartition.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DropPartition.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DropPartition.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DropPartition.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DropPartition.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DropPartition.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DropPartition.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DropPartition.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DropPartition.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DropPartition.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DropPartition.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DropPartition.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DropPartition.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DropPartition.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DropPartition.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Binary"> + <input id="Binary-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Binary</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Binary-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Binary"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Binary-2599"><a href="#Binary-2599"><span class="linenos">2599</span></a><span class="k">class</span> <span class="nc">Binary</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Binary-2600"><a href="#Binary-2600"><span class="linenos">2600</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Binary-2601"><a href="#Binary-2601"><span class="linenos">2601</span></a> +</span><span id="Binary-2602"><a href="#Binary-2602"><span class="linenos">2602</span></a> <span class="nd">@property</span> +</span><span id="Binary-2603"><a href="#Binary-2603"><span class="linenos">2603</span></a> <span class="k">def</span> <span class="nf">left</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Binary-2604"><a href="#Binary-2604"><span class="linenos">2604</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span> +</span><span id="Binary-2605"><a href="#Binary-2605"><span class="linenos">2605</span></a> +</span><span id="Binary-2606"><a href="#Binary-2606"><span class="linenos">2606</span></a> <span class="nd">@property</span> +</span><span id="Binary-2607"><a href="#Binary-2607"><span class="linenos">2607</span></a> <span class="k">def</span> <span class="nf">right</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Binary-2608"><a href="#Binary-2608"><span class="linenos">2608</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Binary.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Binary.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Binary.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Binary.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Binary.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Binary.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Binary.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Binary.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Binary.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Binary.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Binary.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Binary.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Binary.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Binary.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Binary.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Binary.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Binary.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Binary.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Binary.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Binary.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Binary.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Binary.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Binary.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Binary.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Binary.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Binary.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Binary.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Binary.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Binary.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Binary.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Binary.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Binary.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Binary.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Add"> + <input id="Add-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Add</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Add-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Add"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Add-2611"><a href="#Add-2611"><span class="linenos">2611</span></a><span class="k">class</span> <span class="nc">Add</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Add-2612"><a href="#Add-2612"><span class="linenos">2612</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Add.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Add.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Add.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Add.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Add.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Add.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Add.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Add.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Add.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Add.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Add.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Add.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Add.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Add.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Add.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Add.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Add.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Add.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Add.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Add.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Add.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Add.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Add.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Add.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Add.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Add.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Add.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Add.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Add.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Add.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Add.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Add.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Add.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Connector"> + <input id="Connector-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Connector</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Connector-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Connector"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Connector-2615"><a href="#Connector-2615"><span class="linenos">2615</span></a><span class="k">class</span> <span class="nc">Connector</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="Connector-2616"><a href="#Connector-2616"><span class="linenos">2616</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Connector.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Connector.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Connector.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Connector.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Connector.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Connector.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Connector.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Connector.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Connector.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Connector.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Connector.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Connector.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Connector.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Connector.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Connector.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Connector.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Connector.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Connector.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Connector.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Connector.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Connector.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Connector.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Connector.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Connector.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Connector.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Connector.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Connector.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Connector.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Connector.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Connector.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Connector.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Connector.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Connector.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Connector.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Connector.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Connector.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="And"> + <input id="And-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">And</span><wbr>(<span class="base"><a href="#Connector">Connector</a></span>): + + <label class="view-source-button" for="And-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#And"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="And-2619"><a href="#And-2619"><span class="linenos">2619</span></a><span class="k">class</span> <span class="nc">And</span><span class="p">(</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="And-2620"><a href="#And-2620"><span class="linenos">2620</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="And.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="And.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="And.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="And.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="And.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="And.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="And.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="And.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="And.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="And.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="And.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="And.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="And.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="And.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="And.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="And.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="And.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="And.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="And.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="And.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="And.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="And.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="And.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="And.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="And.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="And.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="And.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="And.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="And.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="And.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="And.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="And.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="And.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="And.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="And.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="And.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Or"> + <input id="Or-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Or</span><wbr>(<span class="base"><a href="#Connector">Connector</a></span>): + + <label class="view-source-button" for="Or-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Or"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Or-2623"><a href="#Or-2623"><span class="linenos">2623</span></a><span class="k">class</span> <span class="nc">Or</span><span class="p">(</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="Or-2624"><a href="#Or-2624"><span class="linenos">2624</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Or.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Or.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Or.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Or.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Or.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Or.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Or.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Or.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Or.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Or.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Or.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Or.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Or.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Or.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Or.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Or.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Or.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Or.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Or.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Or.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Or.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Or.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Or.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Or.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Or.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Or.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Or.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Or.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Or.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Or.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Or.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Or.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Or.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Or.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Or.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Or.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitwiseAnd"> + <input id="BitwiseAnd-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitwiseAnd</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="BitwiseAnd-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitwiseAnd"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitwiseAnd-2627"><a href="#BitwiseAnd-2627"><span class="linenos">2627</span></a><span class="k">class</span> <span class="nc">BitwiseAnd</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="BitwiseAnd-2628"><a href="#BitwiseAnd-2628"><span class="linenos">2628</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitwiseAnd.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitwiseAnd.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitwiseAnd.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitwiseAnd.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitwiseAnd.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitwiseAnd.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitwiseAnd.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitwiseAnd.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitwiseAnd.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitwiseAnd.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitwiseAnd.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitwiseAnd.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitwiseAnd.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitwiseAnd.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitwiseAnd.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitwiseAnd.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitwiseAnd.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitwiseAnd.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitwiseAnd.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitwiseAnd.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitwiseAnd.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitwiseAnd.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitwiseAnd.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitwiseAnd.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitwiseAnd.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitwiseAnd.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitwiseAnd.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitwiseAnd.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitwiseAnd.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitwiseAnd.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitwiseAnd.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitwiseAnd.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitwiseAnd.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitwiseLeftShift"> + <input id="BitwiseLeftShift-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitwiseLeftShift</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="BitwiseLeftShift-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitwiseLeftShift"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitwiseLeftShift-2631"><a href="#BitwiseLeftShift-2631"><span class="linenos">2631</span></a><span class="k">class</span> <span class="nc">BitwiseLeftShift</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="BitwiseLeftShift-2632"><a href="#BitwiseLeftShift-2632"><span class="linenos">2632</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitwiseLeftShift.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitwiseLeftShift.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitwiseLeftShift.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitwiseLeftShift.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitwiseLeftShift.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitwiseLeftShift.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitwiseLeftShift.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitwiseLeftShift.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitwiseLeftShift.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitwiseLeftShift.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitwiseLeftShift.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitwiseLeftShift.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitwiseLeftShift.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitwiseLeftShift.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitwiseLeftShift.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitwiseLeftShift.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitwiseLeftShift.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitwiseLeftShift.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitwiseLeftShift.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitwiseLeftShift.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitwiseLeftShift.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitwiseLeftShift.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitwiseLeftShift.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitwiseLeftShift.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitwiseLeftShift.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitwiseLeftShift.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitwiseLeftShift.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitwiseLeftShift.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitwiseLeftShift.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitwiseLeftShift.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitwiseLeftShift.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitwiseLeftShift.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitwiseLeftShift.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitwiseOr"> + <input id="BitwiseOr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitwiseOr</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="BitwiseOr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitwiseOr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitwiseOr-2635"><a href="#BitwiseOr-2635"><span class="linenos">2635</span></a><span class="k">class</span> <span class="nc">BitwiseOr</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="BitwiseOr-2636"><a href="#BitwiseOr-2636"><span class="linenos">2636</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitwiseOr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitwiseOr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitwiseOr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitwiseOr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitwiseOr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitwiseOr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitwiseOr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitwiseOr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitwiseOr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitwiseOr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitwiseOr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitwiseOr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitwiseOr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitwiseOr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitwiseOr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitwiseOr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitwiseOr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitwiseOr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitwiseOr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitwiseOr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitwiseOr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitwiseOr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitwiseOr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitwiseOr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitwiseOr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitwiseOr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitwiseOr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitwiseOr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitwiseOr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitwiseOr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitwiseOr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitwiseOr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitwiseOr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitwiseRightShift"> + <input id="BitwiseRightShift-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitwiseRightShift</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="BitwiseRightShift-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitwiseRightShift"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitwiseRightShift-2639"><a href="#BitwiseRightShift-2639"><span class="linenos">2639</span></a><span class="k">class</span> <span class="nc">BitwiseRightShift</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="BitwiseRightShift-2640"><a href="#BitwiseRightShift-2640"><span class="linenos">2640</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitwiseRightShift.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitwiseRightShift.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitwiseRightShift.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitwiseRightShift.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitwiseRightShift.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitwiseRightShift.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitwiseRightShift.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitwiseRightShift.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitwiseRightShift.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitwiseRightShift.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitwiseRightShift.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitwiseRightShift.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitwiseRightShift.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitwiseRightShift.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitwiseRightShift.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitwiseRightShift.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitwiseRightShift.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitwiseRightShift.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitwiseRightShift.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitwiseRightShift.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitwiseRightShift.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitwiseRightShift.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitwiseRightShift.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitwiseRightShift.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitwiseRightShift.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitwiseRightShift.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitwiseRightShift.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitwiseRightShift.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitwiseRightShift.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitwiseRightShift.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitwiseRightShift.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitwiseRightShift.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitwiseRightShift.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitwiseXor"> + <input id="BitwiseXor-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitwiseXor</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="BitwiseXor-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitwiseXor"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitwiseXor-2643"><a href="#BitwiseXor-2643"><span class="linenos">2643</span></a><span class="k">class</span> <span class="nc">BitwiseXor</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="BitwiseXor-2644"><a href="#BitwiseXor-2644"><span class="linenos">2644</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitwiseXor.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitwiseXor.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitwiseXor.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitwiseXor.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitwiseXor.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitwiseXor.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitwiseXor.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitwiseXor.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitwiseXor.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitwiseXor.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitwiseXor.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitwiseXor.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitwiseXor.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitwiseXor.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitwiseXor.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitwiseXor.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitwiseXor.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitwiseXor.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitwiseXor.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitwiseXor.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitwiseXor.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitwiseXor.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitwiseXor.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitwiseXor.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitwiseXor.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitwiseXor.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitwiseXor.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitwiseXor.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitwiseXor.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitwiseXor.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitwiseXor.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitwiseXor.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitwiseXor.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Div"> + <input id="Div-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Div</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Div-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Div"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Div-2647"><a href="#Div-2647"><span class="linenos">2647</span></a><span class="k">class</span> <span class="nc">Div</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Div-2648"><a href="#Div-2648"><span class="linenos">2648</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Div.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Div.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Div.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Div.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Div.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Div.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Div.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Div.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Div.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Div.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Div.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Div.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Div.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Div.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Div.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Div.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Div.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Div.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Div.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Div.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Div.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Div.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Div.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Div.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Div.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Div.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Div.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Div.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Div.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Div.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Div.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Div.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Div.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Dot"> + <input id="Dot-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Dot</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Dot-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Dot"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Dot-2651"><a href="#Dot-2651"><span class="linenos">2651</span></a><span class="k">class</span> <span class="nc">Dot</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Dot-2652"><a href="#Dot-2652"><span class="linenos">2652</span></a> <span class="nd">@property</span> +</span><span id="Dot-2653"><a href="#Dot-2653"><span class="linenos">2653</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Dot-2654"><a href="#Dot-2654"><span class="linenos">2654</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Dot.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Dot.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Dot.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Dot.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Dot.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Dot.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Dot.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Dot.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Dot.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Dot.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Dot.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Dot.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Dot.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Dot.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Dot.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Dot.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Dot.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Dot.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Dot.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Dot.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Dot.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Dot.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Dot.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Dot.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Dot.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Dot.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Dot.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Dot.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Dot.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Dot.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Dot.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Dot.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Dot.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DPipe"> + <input id="DPipe-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DPipe</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="DPipe-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DPipe"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DPipe-2657"><a href="#DPipe-2657"><span class="linenos">2657</span></a><span class="k">class</span> <span class="nc">DPipe</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="DPipe-2658"><a href="#DPipe-2658"><span class="linenos">2658</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DPipe.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DPipe.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DPipe.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DPipe.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DPipe.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DPipe.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DPipe.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DPipe.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DPipe.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DPipe.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DPipe.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DPipe.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DPipe.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DPipe.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DPipe.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DPipe.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DPipe.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DPipe.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DPipe.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DPipe.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DPipe.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DPipe.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DPipe.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DPipe.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DPipe.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DPipe.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DPipe.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DPipe.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DPipe.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DPipe.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DPipe.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DPipe.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DPipe.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="EQ"> + <input id="EQ-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">EQ</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="EQ-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#EQ"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="EQ-2661"><a href="#EQ-2661"><span class="linenos">2661</span></a><span class="k">class</span> <span class="nc">EQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="EQ-2662"><a href="#EQ-2662"><span class="linenos">2662</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="EQ.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="EQ.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="EQ.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="EQ.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="EQ.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="EQ.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="EQ.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="EQ.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="EQ.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="EQ.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="EQ.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="EQ.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="EQ.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="EQ.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="EQ.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="EQ.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="EQ.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="EQ.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="EQ.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="EQ.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="EQ.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="EQ.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="EQ.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="EQ.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="EQ.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="EQ.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="EQ.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="EQ.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="EQ.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="EQ.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="EQ.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="EQ.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="EQ.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="EQ.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="EQ.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="EQ.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="NullSafeEQ"> + <input id="NullSafeEQ-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">NullSafeEQ</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="NullSafeEQ-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#NullSafeEQ"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="NullSafeEQ-2665"><a href="#NullSafeEQ-2665"><span class="linenos">2665</span></a><span class="k">class</span> <span class="nc">NullSafeEQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="NullSafeEQ-2666"><a href="#NullSafeEQ-2666"><span class="linenos">2666</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="NullSafeEQ.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="NullSafeEQ.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="NullSafeEQ.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="NullSafeEQ.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="NullSafeEQ.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="NullSafeEQ.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="NullSafeEQ.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="NullSafeEQ.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="NullSafeEQ.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="NullSafeEQ.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="NullSafeEQ.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="NullSafeEQ.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="NullSafeEQ.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="NullSafeEQ.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="NullSafeEQ.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="NullSafeEQ.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="NullSafeEQ.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="NullSafeEQ.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="NullSafeEQ.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="NullSafeEQ.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="NullSafeEQ.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="NullSafeEQ.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="NullSafeEQ.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="NullSafeEQ.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="NullSafeEQ.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="NullSafeEQ.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="NullSafeEQ.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="NullSafeEQ.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="NullSafeEQ.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="NullSafeEQ.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="NullSafeEQ.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="NullSafeEQ.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="NullSafeEQ.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="NullSafeEQ.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="NullSafeEQ.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="NullSafeEQ.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="NullSafeNEQ"> + <input id="NullSafeNEQ-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">NullSafeNEQ</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="NullSafeNEQ-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#NullSafeNEQ"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="NullSafeNEQ-2669"><a href="#NullSafeNEQ-2669"><span class="linenos">2669</span></a><span class="k">class</span> <span class="nc">NullSafeNEQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="NullSafeNEQ-2670"><a href="#NullSafeNEQ-2670"><span class="linenos">2670</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="NullSafeNEQ.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="NullSafeNEQ.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="NullSafeNEQ.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="NullSafeNEQ.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="NullSafeNEQ.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="NullSafeNEQ.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="NullSafeNEQ.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="NullSafeNEQ.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="NullSafeNEQ.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="NullSafeNEQ.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="NullSafeNEQ.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="NullSafeNEQ.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="NullSafeNEQ.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="NullSafeNEQ.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="NullSafeNEQ.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="NullSafeNEQ.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="NullSafeNEQ.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="NullSafeNEQ.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="NullSafeNEQ.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="NullSafeNEQ.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="NullSafeNEQ.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="NullSafeNEQ.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="NullSafeNEQ.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="NullSafeNEQ.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="NullSafeNEQ.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="NullSafeNEQ.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="NullSafeNEQ.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="NullSafeNEQ.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="NullSafeNEQ.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="NullSafeNEQ.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="NullSafeNEQ.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="NullSafeNEQ.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="NullSafeNEQ.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="NullSafeNEQ.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="NullSafeNEQ.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="NullSafeNEQ.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Distance"> + <input id="Distance-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Distance</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Distance-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Distance"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Distance-2673"><a href="#Distance-2673"><span class="linenos">2673</span></a><span class="k">class</span> <span class="nc">Distance</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Distance-2674"><a href="#Distance-2674"><span class="linenos">2674</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Distance.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Distance.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Distance.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Distance.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Distance.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Distance.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Distance.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Distance.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Distance.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Distance.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Distance.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Distance.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Distance.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Distance.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Distance.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Distance.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Distance.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Distance.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Distance.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Distance.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Distance.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Distance.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Distance.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Distance.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Distance.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Distance.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Distance.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Distance.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Distance.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Distance.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Distance.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Distance.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Distance.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Escape"> + <input id="Escape-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Escape</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Escape-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Escape"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Escape-2677"><a href="#Escape-2677"><span class="linenos">2677</span></a><span class="k">class</span> <span class="nc">Escape</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Escape-2678"><a href="#Escape-2678"><span class="linenos">2678</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Escape.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Escape.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Escape.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Escape.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Escape.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Escape.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Escape.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Escape.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Escape.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Escape.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Escape.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Escape.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Escape.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Escape.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Escape.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Escape.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Escape.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Escape.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Escape.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Escape.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Escape.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Escape.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Escape.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Escape.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Escape.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Escape.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Escape.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Escape.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Escape.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Escape.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Escape.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Escape.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Escape.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Glob"> + <input id="Glob-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Glob</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="Glob-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Glob"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Glob-2681"><a href="#Glob-2681"><span class="linenos">2681</span></a><span class="k">class</span> <span class="nc">Glob</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="Glob-2682"><a href="#Glob-2682"><span class="linenos">2682</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Glob.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Glob.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Glob.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Glob.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Glob.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Glob.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Glob.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Glob.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Glob.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Glob.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Glob.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Glob.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Glob.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Glob.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Glob.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Glob.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Glob.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Glob.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Glob.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Glob.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Glob.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Glob.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Glob.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Glob.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Glob.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Glob.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Glob.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Glob.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Glob.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Glob.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Glob.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Glob.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Glob.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Glob.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Glob.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Glob.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="GT"> + <input id="GT-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">GT</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="GT-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GT"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GT-2685"><a href="#GT-2685"><span class="linenos">2685</span></a><span class="k">class</span> <span class="nc">GT</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="GT-2686"><a href="#GT-2686"><span class="linenos">2686</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="GT.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="GT.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="GT.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="GT.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="GT.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="GT.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="GT.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="GT.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="GT.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="GT.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="GT.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="GT.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="GT.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="GT.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="GT.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="GT.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="GT.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="GT.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="GT.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="GT.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="GT.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="GT.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="GT.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="GT.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="GT.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="GT.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="GT.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="GT.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="GT.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="GT.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="GT.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="GT.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="GT.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="GT.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="GT.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="GT.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="GTE"> + <input id="GTE-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">GTE</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="GTE-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GTE"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GTE-2689"><a href="#GTE-2689"><span class="linenos">2689</span></a><span class="k">class</span> <span class="nc">GTE</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="GTE-2690"><a href="#GTE-2690"><span class="linenos">2690</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="GTE.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="GTE.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="GTE.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="GTE.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="GTE.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="GTE.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="GTE.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="GTE.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="GTE.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="GTE.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="GTE.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="GTE.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="GTE.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="GTE.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="GTE.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="GTE.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="GTE.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="GTE.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="GTE.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="GTE.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="GTE.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="GTE.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="GTE.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="GTE.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="GTE.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="GTE.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="GTE.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="GTE.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="GTE.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="GTE.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="GTE.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="GTE.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="GTE.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="GTE.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="GTE.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="GTE.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ILike"> + <input id="ILike-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ILike</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="ILike-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ILike"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ILike-2693"><a href="#ILike-2693"><span class="linenos">2693</span></a><span class="k">class</span> <span class="nc">ILike</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="ILike-2694"><a href="#ILike-2694"><span class="linenos">2694</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ILike.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ILike.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ILike.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ILike.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ILike.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ILike.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ILike.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ILike.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ILike.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ILike.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ILike.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ILike.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ILike.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ILike.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ILike.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ILike.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ILike.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ILike.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ILike.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ILike.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ILike.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ILike.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ILike.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ILike.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ILike.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ILike.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ILike.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ILike.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ILike.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ILike.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ILike.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ILike.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ILike.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ILike.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ILike.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ILike.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="IntDiv"> + <input id="IntDiv-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">IntDiv</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="IntDiv-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#IntDiv"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="IntDiv-2697"><a href="#IntDiv-2697"><span class="linenos">2697</span></a><span class="k">class</span> <span class="nc">IntDiv</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="IntDiv-2698"><a href="#IntDiv-2698"><span class="linenos">2698</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="IntDiv.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="IntDiv.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="IntDiv.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="IntDiv.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="IntDiv.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="IntDiv.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="IntDiv.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="IntDiv.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="IntDiv.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="IntDiv.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="IntDiv.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="IntDiv.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="IntDiv.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="IntDiv.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="IntDiv.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="IntDiv.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="IntDiv.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="IntDiv.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="IntDiv.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="IntDiv.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="IntDiv.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="IntDiv.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="IntDiv.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="IntDiv.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="IntDiv.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="IntDiv.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="IntDiv.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="IntDiv.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="IntDiv.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="IntDiv.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="IntDiv.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="IntDiv.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="IntDiv.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Is"> + <input id="Is-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Is</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="Is-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Is"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Is-2701"><a href="#Is-2701"><span class="linenos">2701</span></a><span class="k">class</span> <span class="nc">Is</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="Is-2702"><a href="#Is-2702"><span class="linenos">2702</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Is.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Is.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Is.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Is.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Is.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Is.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Is.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Is.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Is.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Is.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Is.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Is.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Is.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Is.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Is.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Is.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Is.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Is.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Is.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Is.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Is.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Is.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Is.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Is.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Is.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Is.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Is.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Is.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Is.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Is.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Is.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Is.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Is.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Is.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Is.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Is.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Kwarg"> + <input id="Kwarg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Kwarg</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Kwarg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Kwarg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Kwarg-2705"><a href="#Kwarg-2705"><span class="linenos">2705</span></a><span class="k">class</span> <span class="nc">Kwarg</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Kwarg-2706"><a href="#Kwarg-2706"><span class="linenos">2706</span></a><span class="w"> </span><span class="sd">"""Kwarg in special functions like func(kwarg => y)."""</span> +</span></pre></div> + + + <div class="docstring"><p>Kwarg in special functions like func(kwarg => y).</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Kwarg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Kwarg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Kwarg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Kwarg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Kwarg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Kwarg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Kwarg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Kwarg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Kwarg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Kwarg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Kwarg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Kwarg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Kwarg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Kwarg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Kwarg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Kwarg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Kwarg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Kwarg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Kwarg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Kwarg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Kwarg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Kwarg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Kwarg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Kwarg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Kwarg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Kwarg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Kwarg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Kwarg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Kwarg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Kwarg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Kwarg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Kwarg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Kwarg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Like"> + <input id="Like-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Like</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="Like-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Like"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Like-2709"><a href="#Like-2709"><span class="linenos">2709</span></a><span class="k">class</span> <span class="nc">Like</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="Like-2710"><a href="#Like-2710"><span class="linenos">2710</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Like.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Like.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Like.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Like.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Like.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Like.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Like.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Like.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Like.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Like.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Like.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Like.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Like.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Like.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Like.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Like.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Like.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Like.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Like.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Like.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Like.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Like.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Like.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Like.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Like.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Like.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Like.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Like.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Like.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Like.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Like.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Like.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Like.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Like.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Like.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Like.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LT"> + <input id="LT-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LT</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="LT-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LT"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LT-2713"><a href="#LT-2713"><span class="linenos">2713</span></a><span class="k">class</span> <span class="nc">LT</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="LT-2714"><a href="#LT-2714"><span class="linenos">2714</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LT.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LT.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LT.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LT.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LT.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LT.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LT.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LT.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LT.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LT.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LT.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LT.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LT.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LT.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LT.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LT.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LT.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LT.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LT.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LT.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LT.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LT.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LT.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LT.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LT.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LT.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LT.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LT.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LT.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LT.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LT.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LT.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LT.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="LT.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="LT.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="LT.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LTE"> + <input id="LTE-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LTE</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="LTE-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LTE"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LTE-2717"><a href="#LTE-2717"><span class="linenos">2717</span></a><span class="k">class</span> <span class="nc">LTE</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="LTE-2718"><a href="#LTE-2718"><span class="linenos">2718</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LTE.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LTE.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LTE.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LTE.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LTE.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LTE.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LTE.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LTE.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LTE.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LTE.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LTE.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LTE.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LTE.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LTE.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LTE.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LTE.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LTE.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LTE.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LTE.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LTE.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LTE.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LTE.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LTE.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LTE.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LTE.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LTE.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LTE.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LTE.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LTE.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LTE.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LTE.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LTE.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LTE.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="LTE.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="LTE.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="LTE.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Mod"> + <input id="Mod-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Mod</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Mod-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Mod"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Mod-2721"><a href="#Mod-2721"><span class="linenos">2721</span></a><span class="k">class</span> <span class="nc">Mod</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Mod-2722"><a href="#Mod-2722"><span class="linenos">2722</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Mod.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Mod.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Mod.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Mod.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Mod.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Mod.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Mod.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Mod.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Mod.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Mod.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Mod.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Mod.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Mod.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Mod.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Mod.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Mod.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Mod.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Mod.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Mod.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Mod.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Mod.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Mod.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Mod.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Mod.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Mod.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Mod.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Mod.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Mod.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Mod.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Mod.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Mod.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Mod.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Mod.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Mul"> + <input id="Mul-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Mul</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Mul-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Mul"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Mul-2725"><a href="#Mul-2725"><span class="linenos">2725</span></a><span class="k">class</span> <span class="nc">Mul</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Mul-2726"><a href="#Mul-2726"><span class="linenos">2726</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Mul.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Mul.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Mul.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Mul.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Mul.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Mul.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Mul.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Mul.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Mul.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Mul.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Mul.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Mul.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Mul.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Mul.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Mul.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Mul.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Mul.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Mul.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Mul.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Mul.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Mul.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Mul.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Mul.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Mul.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Mul.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Mul.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Mul.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Mul.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Mul.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Mul.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Mul.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Mul.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Mul.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="NEQ"> + <input id="NEQ-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">NEQ</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="NEQ-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#NEQ"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="NEQ-2729"><a href="#NEQ-2729"><span class="linenos">2729</span></a><span class="k">class</span> <span class="nc">NEQ</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="NEQ-2730"><a href="#NEQ-2730"><span class="linenos">2730</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="NEQ.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="NEQ.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="NEQ.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="NEQ.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="NEQ.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="NEQ.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="NEQ.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="NEQ.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="NEQ.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="NEQ.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="NEQ.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="NEQ.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="NEQ.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="NEQ.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="NEQ.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="NEQ.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="NEQ.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="NEQ.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="NEQ.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="NEQ.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="NEQ.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="NEQ.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="NEQ.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="NEQ.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="NEQ.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="NEQ.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="NEQ.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="NEQ.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="NEQ.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="NEQ.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="NEQ.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="NEQ.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="NEQ.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="NEQ.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="NEQ.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="NEQ.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SimilarTo"> + <input id="SimilarTo-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SimilarTo</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="SimilarTo-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SimilarTo"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SimilarTo-2733"><a href="#SimilarTo-2733"><span class="linenos">2733</span></a><span class="k">class</span> <span class="nc">SimilarTo</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Predicate</span><span class="p">):</span> +</span><span id="SimilarTo-2734"><a href="#SimilarTo-2734"><span class="linenos">2734</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SimilarTo.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SimilarTo.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SimilarTo.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SimilarTo.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SimilarTo.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SimilarTo.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SimilarTo.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SimilarTo.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SimilarTo.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SimilarTo.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SimilarTo.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SimilarTo.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SimilarTo.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SimilarTo.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SimilarTo.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SimilarTo.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SimilarTo.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SimilarTo.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SimilarTo.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SimilarTo.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SimilarTo.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SimilarTo.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SimilarTo.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SimilarTo.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SimilarTo.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SimilarTo.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SimilarTo.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SimilarTo.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SimilarTo.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SimilarTo.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SimilarTo.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SimilarTo.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SimilarTo.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="SimilarTo.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="SimilarTo.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="SimilarTo.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Slice"> + <input id="Slice-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Slice</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Slice-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Slice"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Slice-2737"><a href="#Slice-2737"><span class="linenos">2737</span></a><span class="k">class</span> <span class="nc">Slice</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Slice-2738"><a href="#Slice-2738"><span class="linenos">2738</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Slice.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Slice.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Slice.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Slice.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Slice.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Slice.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Slice.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Slice.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Slice.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Slice.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Slice.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Slice.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Slice.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Slice.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Slice.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Slice.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Slice.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Slice.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Slice.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Slice.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Slice.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Slice.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Slice.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Slice.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Slice.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Slice.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Slice.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Slice.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Slice.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Slice.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Slice.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Slice.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Slice.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Sub"> + <input id="Sub-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Sub</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Sub-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Sub"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Sub-2741"><a href="#Sub-2741"><span class="linenos">2741</span></a><span class="k">class</span> <span class="nc">Sub</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Sub-2742"><a href="#Sub-2742"><span class="linenos">2742</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Sub.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Sub.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Sub.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Sub.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Sub.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Sub.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Sub.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Sub.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Sub.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Sub.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Sub.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Sub.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Sub.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Sub.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Sub.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Sub.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Sub.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Sub.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Sub.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Sub.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Sub.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Sub.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Sub.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Sub.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Sub.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Sub.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Sub.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Sub.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Sub.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Sub.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Sub.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Sub.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Sub.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Unary"> + <input id="Unary-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Unary</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Unary-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unary"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unary-2747"><a href="#Unary-2747"><span class="linenos">2747</span></a><span class="k">class</span> <span class="nc">Unary</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Unary-2748"><a href="#Unary-2748"><span class="linenos">2748</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Unary.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Unary.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Unary.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Unary.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Unary.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Unary.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Unary.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Unary.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Unary.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Unary.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Unary.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Unary.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Unary.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Unary.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Unary.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Unary.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Unary.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Unary.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Unary.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Unary.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Unary.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Unary.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Unary.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Unary.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Unary.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Unary.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Unary.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Unary.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Unary.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Unary.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Unary.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Unary.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Unary.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="BitwiseNot"> + <input id="BitwiseNot-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">BitwiseNot</span><wbr>(<span class="base"><a href="#Unary">Unary</a></span>): + + <label class="view-source-button" for="BitwiseNot-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#BitwiseNot"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="BitwiseNot-2751"><a href="#BitwiseNot-2751"><span class="linenos">2751</span></a><span class="k">class</span> <span class="nc">BitwiseNot</span><span class="p">(</span><span class="n">Unary</span><span class="p">):</span> +</span><span id="BitwiseNot-2752"><a href="#BitwiseNot-2752"><span class="linenos">2752</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="BitwiseNot.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="BitwiseNot.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="BitwiseNot.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="BitwiseNot.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="BitwiseNot.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="BitwiseNot.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="BitwiseNot.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="BitwiseNot.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="BitwiseNot.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="BitwiseNot.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="BitwiseNot.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="BitwiseNot.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="BitwiseNot.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="BitwiseNot.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="BitwiseNot.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="BitwiseNot.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="BitwiseNot.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="BitwiseNot.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="BitwiseNot.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="BitwiseNot.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="BitwiseNot.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="BitwiseNot.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="BitwiseNot.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="BitwiseNot.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="BitwiseNot.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="BitwiseNot.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="BitwiseNot.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="BitwiseNot.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="BitwiseNot.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="BitwiseNot.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="BitwiseNot.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="BitwiseNot.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="BitwiseNot.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Not"> + <input id="Not-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Not</span><wbr>(<span class="base"><a href="#Unary">Unary</a></span>, <span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Not-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Not"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Not-2755"><a href="#Not-2755"><span class="linenos">2755</span></a><span class="k">class</span> <span class="nc">Not</span><span class="p">(</span><span class="n">Unary</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="Not-2756"><a href="#Not-2756"><span class="linenos">2756</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Not.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Not.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Not.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Not.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Not.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Not.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Not.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Not.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Not.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Not.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Not.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Not.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Not.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Not.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Not.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Not.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Not.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Not.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Not.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Not.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Not.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Not.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Not.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Not.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Not.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Not.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Not.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Not.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Not.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Not.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Not.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Not.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Not.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Not.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Not.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Not.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Paren"> + <input id="Paren-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Paren</span><wbr>(<span class="base"><a href="#Unary">Unary</a></span>, <span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Paren-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Paren"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Paren-2759"><a href="#Paren-2759"><span class="linenos">2759</span></a><span class="k">class</span> <span class="nc">Paren</span><span class="p">(</span><span class="n">Unary</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="Paren-2760"><a href="#Paren-2760"><span class="linenos">2760</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"with"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Paren.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Paren.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Paren.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Paren.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Paren.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Paren.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Paren.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Paren.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Paren.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Paren.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Paren.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Paren.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Paren.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Paren.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Paren.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Paren.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Paren.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Paren.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Paren.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Paren.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Paren.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Paren.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Paren.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Paren.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Paren.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Paren.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Paren.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Paren.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Paren.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Paren.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Paren.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Paren.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Paren.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Paren.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Paren.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Paren.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Neg"> + <input id="Neg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Neg</span><wbr>(<span class="base"><a href="#Unary">Unary</a></span>): + + <label class="view-source-button" for="Neg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Neg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Neg-2763"><a href="#Neg-2763"><span class="linenos">2763</span></a><span class="k">class</span> <span class="nc">Neg</span><span class="p">(</span><span class="n">Unary</span><span class="p">):</span> +</span><span id="Neg-2764"><a href="#Neg-2764"><span class="linenos">2764</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Neg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Neg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Neg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Neg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Neg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Neg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Neg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Neg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Neg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Neg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Neg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Neg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Neg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Neg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Neg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Neg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Neg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Neg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Neg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Neg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Neg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Neg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Neg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Neg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Neg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Neg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Neg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Neg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Neg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Neg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Neg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Neg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Neg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Alias"> + <input id="Alias-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Alias</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Alias-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Alias"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Alias-2768"><a href="#Alias-2768"><span class="linenos">2768</span></a><span class="k">class</span> <span class="nc">Alias</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Alias-2769"><a href="#Alias-2769"><span class="linenos">2769</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Alias-2770"><a href="#Alias-2770"><span class="linenos">2770</span></a> +</span><span id="Alias-2771"><a href="#Alias-2771"><span class="linenos">2771</span></a> <span class="nd">@property</span> +</span><span id="Alias-2772"><a href="#Alias-2772"><span class="linenos">2772</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Alias-2773"><a href="#Alias-2773"><span class="linenos">2773</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias</span> +</span></pre></div> + + + + + <div id="Alias.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Alias.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Alias.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Alias.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Alias.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Alias.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Alias.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Alias.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Alias.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Alias.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Alias.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Alias.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Alias.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Alias.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Alias.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Alias.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Alias.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Alias.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Alias.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Alias.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Alias.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Alias.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Alias.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Alias.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Alias.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Alias.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Alias.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Alias.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Alias.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Alias.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Alias.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Alias.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Alias.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Alias.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Aliases"> + <input id="Aliases-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Aliases</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Aliases-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Aliases"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Aliases-2776"><a href="#Aliases-2776"><span class="linenos">2776</span></a><span class="k">class</span> <span class="nc">Aliases</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Aliases-2777"><a href="#Aliases-2777"><span class="linenos">2777</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Aliases-2778"><a href="#Aliases-2778"><span class="linenos">2778</span></a> +</span><span id="Aliases-2779"><a href="#Aliases-2779"><span class="linenos">2779</span></a> <span class="nd">@property</span> +</span><span id="Aliases-2780"><a href="#Aliases-2780"><span class="linenos">2780</span></a> <span class="k">def</span> <span class="nf">aliases</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Aliases-2781"><a href="#Aliases-2781"><span class="linenos">2781</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Aliases.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Aliases.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Aliases.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Aliases.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Aliases.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Aliases.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Aliases.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Aliases.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Aliases.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Aliases.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Aliases.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Aliases.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Aliases.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Aliases.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Aliases.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Aliases.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Aliases.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Aliases.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Aliases.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Aliases.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Aliases.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Aliases.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Aliases.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Aliases.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Aliases.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Aliases.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Aliases.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Aliases.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Aliases.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Aliases.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Aliases.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Aliases.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Aliases.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AtTimeZone"> + <input id="AtTimeZone-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AtTimeZone</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="AtTimeZone-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AtTimeZone"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AtTimeZone-2784"><a href="#AtTimeZone-2784"><span class="linenos">2784</span></a><span class="k">class</span> <span class="nc">AtTimeZone</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="AtTimeZone-2785"><a href="#AtTimeZone-2785"><span class="linenos">2785</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AtTimeZone.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AtTimeZone.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AtTimeZone.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AtTimeZone.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AtTimeZone.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AtTimeZone.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AtTimeZone.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AtTimeZone.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AtTimeZone.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AtTimeZone.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AtTimeZone.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AtTimeZone.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AtTimeZone.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AtTimeZone.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AtTimeZone.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AtTimeZone.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AtTimeZone.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AtTimeZone.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AtTimeZone.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AtTimeZone.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AtTimeZone.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AtTimeZone.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AtTimeZone.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AtTimeZone.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AtTimeZone.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AtTimeZone.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AtTimeZone.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AtTimeZone.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AtTimeZone.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AtTimeZone.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AtTimeZone.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AtTimeZone.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AtTimeZone.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Between"> + <input id="Between-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Between</span><wbr>(<span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="Between-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Between"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Between-2788"><a href="#Between-2788"><span class="linenos">2788</span></a><span class="k">class</span> <span class="nc">Between</span><span class="p">(</span><span class="n">Predicate</span><span class="p">):</span> +</span><span id="Between-2789"><a href="#Between-2789"><span class="linenos">2789</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"low"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"high"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Between.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Between.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Between.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Between.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Between.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Between.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Between.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Between.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Between.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Between.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Between.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Between.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Between.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Between.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Between.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Between.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Between.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Between.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Between.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Between.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Between.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Between.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Between.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Between.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Between.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Between.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Between.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Between.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Between.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Between.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Between.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Between.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Between.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Between.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Between.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Between.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Bracket"> + <input id="Bracket-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Bracket</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Bracket-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Bracket"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Bracket-2792"><a href="#Bracket-2792"><span class="linenos">2792</span></a><span class="k">class</span> <span class="nc">Bracket</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Bracket-2793"><a href="#Bracket-2793"><span class="linenos">2793</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Bracket.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Bracket.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Bracket.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Bracket.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Bracket.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Bracket.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Bracket.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Bracket.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Bracket.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Bracket.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Bracket.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Bracket.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Bracket.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Bracket.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Bracket.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Bracket.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Bracket.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Bracket.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Bracket.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Bracket.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Bracket.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Bracket.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Bracket.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Bracket.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Bracket.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Bracket.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Bracket.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Bracket.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Bracket.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Bracket.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Bracket.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Bracket.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Bracket.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Bracket.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Bracket.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Bracket.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Distinct"> + <input id="Distinct-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Distinct</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Distinct-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Distinct"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Distinct-2796"><a href="#Distinct-2796"><span class="linenos">2796</span></a><span class="k">class</span> <span class="nc">Distinct</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Distinct-2797"><a href="#Distinct-2797"><span class="linenos">2797</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Distinct.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Distinct.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Distinct.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Distinct.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Distinct.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Distinct.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Distinct.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Distinct.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Distinct.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Distinct.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Distinct.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Distinct.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Distinct.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Distinct.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Distinct.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Distinct.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Distinct.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Distinct.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Distinct.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Distinct.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Distinct.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Distinct.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Distinct.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Distinct.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Distinct.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Distinct.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Distinct.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Distinct.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Distinct.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Distinct.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Distinct.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Distinct.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Distinct.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="In"> + <input id="In-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">In</span><wbr>(<span class="base"><a href="#Predicate">Predicate</a></span>): + + <label class="view-source-button" for="In-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#In"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="In-2800"><a href="#In-2800"><span class="linenos">2800</span></a><span class="k">class</span> <span class="nc">In</span><span class="p">(</span><span class="n">Predicate</span><span class="p">):</span> +</span><span id="In-2801"><a href="#In-2801"><span class="linenos">2801</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="In-2802"><a href="#In-2802"><span class="linenos">2802</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="In-2803"><a href="#In-2803"><span class="linenos">2803</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="In-2804"><a href="#In-2804"><span class="linenos">2804</span></a> <span class="s2">"query"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="In-2805"><a href="#In-2805"><span class="linenos">2805</span></a> <span class="s2">"unnest"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="In-2806"><a href="#In-2806"><span class="linenos">2806</span></a> <span class="s2">"field"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="In-2807"><a href="#In-2807"><span class="linenos">2807</span></a> <span class="s2">"is_global"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="In-2808"><a href="#In-2808"><span class="linenos">2808</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="In.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="In.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="In.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="In.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="In.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="In.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="In.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="In.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="In.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="In.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="In.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="In.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="In.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="In.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="In.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="In.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="In.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="In.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="In.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="In.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="In.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="In.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="In.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="In.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="In.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="In.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="In.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="In.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="In.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="In.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="In.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="In.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="In.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="In.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="In.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="In.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeUnit"> + <input id="TimeUnit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeUnit</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="TimeUnit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeUnit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeUnit-2811"><a href="#TimeUnit-2811"><span class="linenos">2811</span></a><span class="k">class</span> <span class="nc">TimeUnit</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="TimeUnit-2812"><a href="#TimeUnit-2812"><span class="linenos">2812</span></a><span class="w"> </span><span class="sd">"""Automatically converts unit arg into a var."""</span> +</span><span id="TimeUnit-2813"><a href="#TimeUnit-2813"><span class="linenos">2813</span></a> +</span><span id="TimeUnit-2814"><a href="#TimeUnit-2814"><span class="linenos">2814</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="TimeUnit-2815"><a href="#TimeUnit-2815"><span class="linenos">2815</span></a> +</span><span id="TimeUnit-2816"><a href="#TimeUnit-2816"><span class="linenos">2816</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">args</span><span class="p">):</span> +</span><span id="TimeUnit-2817"><a href="#TimeUnit-2817"><span class="linenos">2817</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="TimeUnit-2818"><a href="#TimeUnit-2818"><span class="linenos">2818</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="TimeUnit-2819"><a href="#TimeUnit-2819"><span class="linenos">2819</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"unit"</span><span class="p">]</span> <span class="o">=</span> <span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="TimeUnit-2820"><a href="#TimeUnit-2820"><span class="linenos">2820</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">Week</span><span class="p">):</span> +</span><span id="TimeUnit-2821"><a href="#TimeUnit-2821"><span class="linenos">2821</span></a> <span class="n">unit</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> +</span><span id="TimeUnit-2822"><a href="#TimeUnit-2822"><span class="linenos">2822</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Automatically converts unit arg into a var.</p> +</div> + + + <div id="TimeUnit.__init__" class="classattr"> + <input id="TimeUnit.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">TimeUnit</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">**</span><span class="n">args</span></span>)</span> + + <label class="view-source-button" for="TimeUnit.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeUnit.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeUnit.__init__-2816"><a href="#TimeUnit.__init__-2816"><span class="linenos">2816</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">args</span><span class="p">):</span> +</span><span id="TimeUnit.__init__-2817"><a href="#TimeUnit.__init__-2817"><span class="linenos">2817</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="TimeUnit.__init__-2818"><a href="#TimeUnit.__init__-2818"><span class="linenos">2818</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="TimeUnit.__init__-2819"><a href="#TimeUnit.__init__-2819"><span class="linenos">2819</span></a> <span class="n">args</span><span class="p">[</span><span class="s2">"unit"</span><span class="p">]</span> <span class="o">=</span> <span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="TimeUnit.__init__-2820"><a href="#TimeUnit.__init__-2820"><span class="linenos">2820</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">unit</span><span class="p">,</span> <span class="n">Week</span><span class="p">):</span> +</span><span id="TimeUnit.__init__-2821"><a href="#TimeUnit.__init__-2821"><span class="linenos">2821</span></a> <span class="n">unit</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">unit</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> +</span><span id="TimeUnit.__init__-2822"><a href="#TimeUnit.__init__-2822"><span class="linenos">2822</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeUnit.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeUnit.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeUnit.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeUnit.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeUnit.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeUnit.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeUnit.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeUnit.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeUnit.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeUnit.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeUnit.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeUnit.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeUnit.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeUnit.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeUnit.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeUnit.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeUnit.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeUnit.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeUnit.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeUnit.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeUnit.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeUnit.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeUnit.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeUnit.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeUnit.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeUnit.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeUnit.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeUnit.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeUnit.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeUnit.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeUnit.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeUnit.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Interval"> + <input id="Interval-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Interval</span><wbr>(<span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="Interval-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Interval"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Interval-2825"><a href="#Interval-2825"><span class="linenos">2825</span></a><span class="k">class</span> <span class="nc">Interval</span><span class="p">(</span><span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="Interval-2826"><a href="#Interval-2826"><span class="linenos">2826</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="Interval.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Interval.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Interval.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Interval.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Interval.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Interval.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Interval.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Interval.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Interval.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Interval.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Interval.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Interval.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Interval.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Interval.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Interval.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Interval.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Interval.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Interval.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Interval.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Interval.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Interval.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Interval.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Interval.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Interval.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Interval.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Interval.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Interval.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Interval.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Interval.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Interval.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Interval.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Interval.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Interval.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="IgnoreNulls"> + <input id="IgnoreNulls-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">IgnoreNulls</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="IgnoreNulls-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#IgnoreNulls"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="IgnoreNulls-2829"><a href="#IgnoreNulls-2829"><span class="linenos">2829</span></a><span class="k">class</span> <span class="nc">IgnoreNulls</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="IgnoreNulls-2830"><a href="#IgnoreNulls-2830"><span class="linenos">2830</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="IgnoreNulls.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="IgnoreNulls.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="IgnoreNulls.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="IgnoreNulls.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="IgnoreNulls.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="IgnoreNulls.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="IgnoreNulls.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="IgnoreNulls.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="IgnoreNulls.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="IgnoreNulls.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="IgnoreNulls.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="IgnoreNulls.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="IgnoreNulls.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="IgnoreNulls.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="IgnoreNulls.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="IgnoreNulls.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="IgnoreNulls.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="IgnoreNulls.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="IgnoreNulls.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="IgnoreNulls.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="IgnoreNulls.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="IgnoreNulls.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="IgnoreNulls.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="IgnoreNulls.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="IgnoreNulls.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="IgnoreNulls.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="IgnoreNulls.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="IgnoreNulls.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="IgnoreNulls.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="IgnoreNulls.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="IgnoreNulls.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="IgnoreNulls.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="IgnoreNulls.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RespectNulls"> + <input id="RespectNulls-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RespectNulls</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="RespectNulls-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RespectNulls"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RespectNulls-2833"><a href="#RespectNulls-2833"><span class="linenos">2833</span></a><span class="k">class</span> <span class="nc">RespectNulls</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="RespectNulls-2834"><a href="#RespectNulls-2834"><span class="linenos">2834</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RespectNulls.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RespectNulls.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RespectNulls.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RespectNulls.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RespectNulls.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RespectNulls.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RespectNulls.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RespectNulls.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RespectNulls.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RespectNulls.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RespectNulls.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RespectNulls.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RespectNulls.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RespectNulls.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RespectNulls.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RespectNulls.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RespectNulls.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RespectNulls.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RespectNulls.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RespectNulls.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RespectNulls.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RespectNulls.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RespectNulls.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RespectNulls.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RespectNulls.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RespectNulls.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RespectNulls.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RespectNulls.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RespectNulls.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RespectNulls.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RespectNulls.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RespectNulls.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RespectNulls.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Func"> + <input id="Func-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Func</span><wbr>(<span class="base"><a href="#Condition">Condition</a></span>): + + <label class="view-source-button" for="Func-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Func"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Func-2838"><a href="#Func-2838"><span class="linenos">2838</span></a><span class="k">class</span> <span class="nc">Func</span><span class="p">(</span><span class="n">Condition</span><span class="p">):</span> +</span><span id="Func-2839"><a href="#Func-2839"><span class="linenos">2839</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Func-2840"><a href="#Func-2840"><span class="linenos">2840</span></a><span class="sd"> The base class for all function expressions.</span> +</span><span id="Func-2841"><a href="#Func-2841"><span class="linenos">2841</span></a> +</span><span id="Func-2842"><a href="#Func-2842"><span class="linenos">2842</span></a><span class="sd"> Attributes:</span> +</span><span id="Func-2843"><a href="#Func-2843"><span class="linenos">2843</span></a><span class="sd"> is_var_len_args (bool): if set to True the last argument defined in arg_types will be</span> +</span><span id="Func-2844"><a href="#Func-2844"><span class="linenos">2844</span></a><span class="sd"> treated as a variable length argument and the argument's value will be stored as a list.</span> +</span><span id="Func-2845"><a href="#Func-2845"><span class="linenos">2845</span></a><span class="sd"> _sql_names (list): determines the SQL name (1st item in the list) and aliases (subsequent items)</span> +</span><span id="Func-2846"><a href="#Func-2846"><span class="linenos">2846</span></a><span class="sd"> for this function expression. These values are used to map this node to a name during parsing</span> +</span><span id="Func-2847"><a href="#Func-2847"><span class="linenos">2847</span></a><span class="sd"> as well as to provide the function's name during SQL string generation. By default the SQL</span> +</span><span id="Func-2848"><a href="#Func-2848"><span class="linenos">2848</span></a><span class="sd"> name is set to the expression's class name transformed to snake case.</span> +</span><span id="Func-2849"><a href="#Func-2849"><span class="linenos">2849</span></a><span class="sd"> """</span> +</span><span id="Func-2850"><a href="#Func-2850"><span class="linenos">2850</span></a> +</span><span id="Func-2851"><a href="#Func-2851"><span class="linenos">2851</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Func-2852"><a href="#Func-2852"><span class="linenos">2852</span></a> +</span><span id="Func-2853"><a href="#Func-2853"><span class="linenos">2853</span></a> <span class="nd">@classmethod</span> +</span><span id="Func-2854"><a href="#Func-2854"><span class="linenos">2854</span></a> <span class="k">def</span> <span class="nf">from_arg_list</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span> +</span><span id="Func-2855"><a href="#Func-2855"><span class="linenos">2855</span></a> <span class="k">if</span> <span class="bp">cls</span><span class="o">.</span><span class="n">is_var_len_args</span><span class="p">:</span> +</span><span id="Func-2856"><a href="#Func-2856"><span class="linenos">2856</span></a> <span class="n">all_arg_keys</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> +</span><span id="Func-2857"><a href="#Func-2857"><span class="linenos">2857</span></a> <span class="c1"># If this function supports variable length argument treat the last argument as such.</span> +</span><span id="Func-2858"><a href="#Func-2858"><span class="linenos">2858</span></a> <span class="n">non_var_len_arg_keys</span> <span class="o">=</span> <span class="n">all_arg_keys</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="k">if</span> <span class="bp">cls</span><span class="o">.</span><span class="n">is_var_len_args</span> <span class="k">else</span> <span class="n">all_arg_keys</span> +</span><span id="Func-2859"><a href="#Func-2859"><span class="linenos">2859</span></a> <span class="n">num_non_var</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">non_var_len_arg_keys</span><span class="p">)</span> +</span><span id="Func-2860"><a href="#Func-2860"><span class="linenos">2860</span></a> +</span><span id="Func-2861"><a href="#Func-2861"><span class="linenos">2861</span></a> <span class="n">args_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span><span class="p">,</span> <span class="n">arg_key</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">non_var_len_arg_keys</span><span class="p">)}</span> +</span><span id="Func-2862"><a href="#Func-2862"><span class="linenos">2862</span></a> <span class="n">args_dict</span><span class="p">[</span><span class="n">all_arg_keys</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="n">num_non_var</span><span class="p">:]</span> +</span><span id="Func-2863"><a href="#Func-2863"><span class="linenos">2863</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Func-2864"><a href="#Func-2864"><span class="linenos">2864</span></a> <span class="n">args_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span><span class="p">,</span> <span class="n">arg_key</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="bp">cls</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)}</span> +</span><span id="Func-2865"><a href="#Func-2865"><span class="linenos">2865</span></a> +</span><span id="Func-2866"><a href="#Func-2866"><span class="linenos">2866</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="o">**</span><span class="n">args_dict</span><span class="p">)</span> +</span><span id="Func-2867"><a href="#Func-2867"><span class="linenos">2867</span></a> +</span><span id="Func-2868"><a href="#Func-2868"><span class="linenos">2868</span></a> <span class="nd">@classmethod</span> +</span><span id="Func-2869"><a href="#Func-2869"><span class="linenos">2869</span></a> <span class="k">def</span> <span class="nf">sql_names</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="Func-2870"><a href="#Func-2870"><span class="linenos">2870</span></a> <span class="k">if</span> <span class="bp">cls</span> <span class="ow">is</span> <span class="n">Func</span><span class="p">:</span> +</span><span id="Func-2871"><a href="#Func-2871"><span class="linenos">2871</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span> +</span><span id="Func-2872"><a href="#Func-2872"><span class="linenos">2872</span></a> <span class="s2">"SQL name is only supported by concrete function implementations"</span> +</span><span id="Func-2873"><a href="#Func-2873"><span class="linenos">2873</span></a> <span class="p">)</span> +</span><span id="Func-2874"><a href="#Func-2874"><span class="linenos">2874</span></a> <span class="k">if</span> <span class="s2">"_sql_names"</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">:</span> +</span><span id="Func-2875"><a href="#Func-2875"><span class="linenos">2875</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="n">camel_to_snake_case</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)]</span> +</span><span id="Func-2876"><a href="#Func-2876"><span class="linenos">2876</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_sql_names</span> +</span><span id="Func-2877"><a href="#Func-2877"><span class="linenos">2877</span></a> +</span><span id="Func-2878"><a href="#Func-2878"><span class="linenos">2878</span></a> <span class="nd">@classmethod</span> +</span><span id="Func-2879"><a href="#Func-2879"><span class="linenos">2879</span></a> <span class="k">def</span> <span class="nf">sql_name</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="Func-2880"><a href="#Func-2880"><span class="linenos">2880</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="Func-2881"><a href="#Func-2881"><span class="linenos">2881</span></a> +</span><span id="Func-2882"><a href="#Func-2882"><span class="linenos">2882</span></a> <span class="nd">@classmethod</span> +</span><span id="Func-2883"><a href="#Func-2883"><span class="linenos">2883</span></a> <span class="k">def</span> <span class="nf">default_parser_mappings</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="Func-2884"><a href="#Func-2884"><span class="linenos">2884</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="bp">cls</span><span class="o">.</span><span class="n">from_arg_list</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()}</span> +</span></pre></div> + + + <div class="docstring"><p>The base class for all function expressions.</p> + +<h6 id="attributes">Attributes:</h6> + +<ul> +<li><strong>is_var_len_args (bool):</strong> if set to True the last argument defined in arg_types will be +treated as a variable length argument and the argument's value will be stored as a list.</li> +<li><strong>_sql_names (list):</strong> determines the SQL name (1st item in the list) and aliases (subsequent items) +for this function expression. These values are used to map this node to a name during parsing +as well as to provide the function's name during SQL string generation. By default the SQL +name is set to the expression's class name transformed to snake case.</li> +</ul> +</div> + + + <div id="Func.from_arg_list" class="classattr"> + <input id="Func.from_arg_list-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_arg_list</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">args</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Func.from_arg_list-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Func.from_arg_list"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Func.from_arg_list-2853"><a href="#Func.from_arg_list-2853"><span class="linenos">2853</span></a> <span class="nd">@classmethod</span> +</span><span id="Func.from_arg_list-2854"><a href="#Func.from_arg_list-2854"><span class="linenos">2854</span></a> <span class="k">def</span> <span class="nf">from_arg_list</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span> +</span><span id="Func.from_arg_list-2855"><a href="#Func.from_arg_list-2855"><span class="linenos">2855</span></a> <span class="k">if</span> <span class="bp">cls</span><span class="o">.</span><span class="n">is_var_len_args</span><span class="p">:</span> +</span><span id="Func.from_arg_list-2856"><a href="#Func.from_arg_list-2856"><span class="linenos">2856</span></a> <span class="n">all_arg_keys</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> +</span><span id="Func.from_arg_list-2857"><a href="#Func.from_arg_list-2857"><span class="linenos">2857</span></a> <span class="c1"># If this function supports variable length argument treat the last argument as such.</span> +</span><span id="Func.from_arg_list-2858"><a href="#Func.from_arg_list-2858"><span class="linenos">2858</span></a> <span class="n">non_var_len_arg_keys</span> <span class="o">=</span> <span class="n">all_arg_keys</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="k">if</span> <span class="bp">cls</span><span class="o">.</span><span class="n">is_var_len_args</span> <span class="k">else</span> <span class="n">all_arg_keys</span> +</span><span id="Func.from_arg_list-2859"><a href="#Func.from_arg_list-2859"><span class="linenos">2859</span></a> <span class="n">num_non_var</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">non_var_len_arg_keys</span><span class="p">)</span> +</span><span id="Func.from_arg_list-2860"><a href="#Func.from_arg_list-2860"><span class="linenos">2860</span></a> +</span><span id="Func.from_arg_list-2861"><a href="#Func.from_arg_list-2861"><span class="linenos">2861</span></a> <span class="n">args_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span><span class="p">,</span> <span class="n">arg_key</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">non_var_len_arg_keys</span><span class="p">)}</span> +</span><span id="Func.from_arg_list-2862"><a href="#Func.from_arg_list-2862"><span class="linenos">2862</span></a> <span class="n">args_dict</span><span class="p">[</span><span class="n">all_arg_keys</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="n">num_non_var</span><span class="p">:]</span> +</span><span id="Func.from_arg_list-2863"><a href="#Func.from_arg_list-2863"><span class="linenos">2863</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Func.from_arg_list-2864"><a href="#Func.from_arg_list-2864"><span class="linenos">2864</span></a> <span class="n">args_dict</span> <span class="o">=</span> <span class="p">{</span><span class="n">arg_key</span><span class="p">:</span> <span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span><span class="p">,</span> <span class="n">arg_key</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="bp">cls</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)}</span> +</span><span id="Func.from_arg_list-2865"><a href="#Func.from_arg_list-2865"><span class="linenos">2865</span></a> +</span><span id="Func.from_arg_list-2866"><a href="#Func.from_arg_list-2866"><span class="linenos">2866</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="o">**</span><span class="n">args_dict</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Func.sql_names" class="classattr"> + <input id="Func.sql_names-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">sql_names</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Func.sql_names-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Func.sql_names"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Func.sql_names-2868"><a href="#Func.sql_names-2868"><span class="linenos">2868</span></a> <span class="nd">@classmethod</span> +</span><span id="Func.sql_names-2869"><a href="#Func.sql_names-2869"><span class="linenos">2869</span></a> <span class="k">def</span> <span class="nf">sql_names</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="Func.sql_names-2870"><a href="#Func.sql_names-2870"><span class="linenos">2870</span></a> <span class="k">if</span> <span class="bp">cls</span> <span class="ow">is</span> <span class="n">Func</span><span class="p">:</span> +</span><span id="Func.sql_names-2871"><a href="#Func.sql_names-2871"><span class="linenos">2871</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span> +</span><span id="Func.sql_names-2872"><a href="#Func.sql_names-2872"><span class="linenos">2872</span></a> <span class="s2">"SQL name is only supported by concrete function implementations"</span> +</span><span id="Func.sql_names-2873"><a href="#Func.sql_names-2873"><span class="linenos">2873</span></a> <span class="p">)</span> +</span><span id="Func.sql_names-2874"><a href="#Func.sql_names-2874"><span class="linenos">2874</span></a> <span class="k">if</span> <span class="s2">"_sql_names"</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="vm">__dict__</span><span class="p">:</span> +</span><span id="Func.sql_names-2875"><a href="#Func.sql_names-2875"><span class="linenos">2875</span></a> <span class="bp">cls</span><span class="o">.</span><span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="n">camel_to_snake_case</span><span class="p">(</span><span class="bp">cls</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)]</span> +</span><span id="Func.sql_names-2876"><a href="#Func.sql_names-2876"><span class="linenos">2876</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_sql_names</span> +</span></pre></div> + + + + + </div> + <div id="Func.sql_name" class="classattr"> + <input id="Func.sql_name-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">sql_name</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Func.sql_name-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Func.sql_name"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Func.sql_name-2878"><a href="#Func.sql_name-2878"><span class="linenos">2878</span></a> <span class="nd">@classmethod</span> +</span><span id="Func.sql_name-2879"><a href="#Func.sql_name-2879"><span class="linenos">2879</span></a> <span class="k">def</span> <span class="nf">sql_name</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="Func.sql_name-2880"><a href="#Func.sql_name-2880"><span class="linenos">2880</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span> +</span></pre></div> + + + + + </div> + <div id="Func.default_parser_mappings" class="classattr"> + <input id="Func.default_parser_mappings-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">default_parser_mappings</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Func.default_parser_mappings-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Func.default_parser_mappings"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Func.default_parser_mappings-2882"><a href="#Func.default_parser_mappings-2882"><span class="linenos">2882</span></a> <span class="nd">@classmethod</span> +</span><span id="Func.default_parser_mappings-2883"><a href="#Func.default_parser_mappings-2883"><span class="linenos">2883</span></a> <span class="k">def</span> <span class="nf">default_parser_mappings</span><span class="p">(</span><span class="bp">cls</span><span class="p">):</span> +</span><span id="Func.default_parser_mappings-2884"><a href="#Func.default_parser_mappings-2884"><span class="linenos">2884</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="bp">cls</span><span class="o">.</span><span class="n">from_arg_list</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()}</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Func.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Func.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Func.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Func.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Func.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Func.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Func.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Func.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Func.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Func.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Func.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Func.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Func.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Func.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Func.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Func.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Func.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Func.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Func.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Func.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Func.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Func.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Func.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Func.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Func.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Func.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Func.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Func.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Func.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Func.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Func.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Func.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Func.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Func.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Func.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Func.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AggFunc"> + <input id="AggFunc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AggFunc</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="AggFunc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AggFunc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AggFunc-2887"><a href="#AggFunc-2887"><span class="linenos">2887</span></a><span class="k">class</span> <span class="nc">AggFunc</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="AggFunc-2888"><a href="#AggFunc-2888"><span class="linenos">2888</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AggFunc.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AggFunc.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AggFunc.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AggFunc.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AggFunc.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AggFunc.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AggFunc.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AggFunc.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AggFunc.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AggFunc.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AggFunc.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AggFunc.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AggFunc.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AggFunc.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AggFunc.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AggFunc.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AggFunc.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AggFunc.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AggFunc.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AggFunc.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AggFunc.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AggFunc.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AggFunc.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AggFunc.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AggFunc.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AggFunc.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AggFunc.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AggFunc.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AggFunc.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AggFunc.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AggFunc.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AggFunc.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AggFunc.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="AggFunc.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="AggFunc.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="AggFunc.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="AggFunc.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="AggFunc.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="AggFunc.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="AggFunc.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Abs"> + <input id="Abs-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Abs</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Abs-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Abs"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Abs-2891"><a href="#Abs-2891"><span class="linenos">2891</span></a><span class="k">class</span> <span class="nc">Abs</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Abs-2892"><a href="#Abs-2892"><span class="linenos">2892</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Abs.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Abs.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Abs.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Abs.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Abs.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Abs.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Abs.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Abs.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Abs.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Abs.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Abs.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Abs.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Abs.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Abs.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Abs.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Abs.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Abs.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Abs.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Abs.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Abs.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Abs.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Abs.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Abs.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Abs.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Abs.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Abs.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Abs.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Abs.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Abs.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Abs.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Abs.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Abs.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Abs.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Abs.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Abs.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Abs.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Abs.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Abs.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Abs.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Abs.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Anonymous"> + <input id="Anonymous-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Anonymous</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Anonymous-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Anonymous"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Anonymous-2895"><a href="#Anonymous-2895"><span class="linenos">2895</span></a><span class="k">class</span> <span class="nc">Anonymous</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Anonymous-2896"><a href="#Anonymous-2896"><span class="linenos">2896</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Anonymous-2897"><a href="#Anonymous-2897"><span class="linenos">2897</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Anonymous.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Anonymous.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Anonymous.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Anonymous.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Anonymous.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Anonymous.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Anonymous.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Anonymous.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Anonymous.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Anonymous.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Anonymous.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Anonymous.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Anonymous.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Anonymous.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Anonymous.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Anonymous.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Anonymous.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Anonymous.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Anonymous.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Anonymous.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Anonymous.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Anonymous.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Anonymous.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Anonymous.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Anonymous.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Anonymous.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Anonymous.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Anonymous.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Anonymous.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Anonymous.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Anonymous.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Anonymous.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Anonymous.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Anonymous.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Anonymous.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Anonymous.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Anonymous.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Anonymous.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Anonymous.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Anonymous.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ApproxDistinct"> + <input id="ApproxDistinct-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ApproxDistinct</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="ApproxDistinct-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ApproxDistinct"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ApproxDistinct-2900"><a href="#ApproxDistinct-2900"><span class="linenos">2900</span></a><span class="k">class</span> <span class="nc">ApproxDistinct</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="ApproxDistinct-2901"><a href="#ApproxDistinct-2901"><span class="linenos">2901</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"accuracy"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ApproxDistinct.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ApproxDistinct.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ApproxDistinct.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ApproxDistinct.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ApproxDistinct.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ApproxDistinct.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ApproxDistinct.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ApproxDistinct.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ApproxDistinct.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ApproxDistinct.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ApproxDistinct.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ApproxDistinct.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ApproxDistinct.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ApproxDistinct.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ApproxDistinct.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ApproxDistinct.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ApproxDistinct.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ApproxDistinct.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ApproxDistinct.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ApproxDistinct.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ApproxDistinct.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ApproxDistinct.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ApproxDistinct.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ApproxDistinct.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ApproxDistinct.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ApproxDistinct.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ApproxDistinct.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ApproxDistinct.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ApproxDistinct.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ApproxDistinct.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ApproxDistinct.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ApproxDistinct.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ApproxDistinct.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ApproxDistinct.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ApproxDistinct.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ApproxDistinct.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ApproxDistinct.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ApproxDistinct.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ApproxDistinct.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ApproxDistinct.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Array"> + <input id="Array-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Array</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Array-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Array"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Array-2904"><a href="#Array-2904"><span class="linenos">2904</span></a><span class="k">class</span> <span class="nc">Array</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Array-2905"><a href="#Array-2905"><span class="linenos">2905</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Array-2906"><a href="#Array-2906"><span class="linenos">2906</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Array.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Array.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Array.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Array.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Array.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Array.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Array.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Array.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Array.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Array.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Array.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Array.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Array.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Array.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Array.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Array.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Array.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Array.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Array.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Array.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Array.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Array.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Array.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Array.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Array.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Array.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Array.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Array.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Array.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Array.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Array.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Array.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Array.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Array.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Array.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Array.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Array.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Array.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Array.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Array.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="GenerateSeries"> + <input id="GenerateSeries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">GenerateSeries</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="GenerateSeries-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GenerateSeries"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GenerateSeries-2909"><a href="#GenerateSeries-2909"><span class="linenos">2909</span></a><span class="k">class</span> <span class="nc">GenerateSeries</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="GenerateSeries-2910"><a href="#GenerateSeries-2910"><span class="linenos">2910</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"start"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"end"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"step"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="GenerateSeries.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="GenerateSeries.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="GenerateSeries.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="GenerateSeries.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="GenerateSeries.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="GenerateSeries.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="GenerateSeries.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="GenerateSeries.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="GenerateSeries.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="GenerateSeries.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="GenerateSeries.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="GenerateSeries.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="GenerateSeries.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="GenerateSeries.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="GenerateSeries.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="GenerateSeries.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="GenerateSeries.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="GenerateSeries.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="GenerateSeries.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="GenerateSeries.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="GenerateSeries.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="GenerateSeries.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="GenerateSeries.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="GenerateSeries.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="GenerateSeries.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="GenerateSeries.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="GenerateSeries.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="GenerateSeries.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="GenerateSeries.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="GenerateSeries.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="GenerateSeries.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="GenerateSeries.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="GenerateSeries.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="GenerateSeries.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="GenerateSeries.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="GenerateSeries.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="GenerateSeries.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="GenerateSeries.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="GenerateSeries.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="GenerateSeries.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayAgg"> + <input id="ArrayAgg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayAgg</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="ArrayAgg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayAgg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayAgg-2913"><a href="#ArrayAgg-2913"><span class="linenos">2913</span></a><span class="k">class</span> <span class="nc">ArrayAgg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="ArrayAgg-2914"><a href="#ArrayAgg-2914"><span class="linenos">2914</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayAgg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayAgg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayAgg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayAgg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayAgg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayAgg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayAgg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayAgg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayAgg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayAgg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayAgg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayAgg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayAgg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayAgg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayAgg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayAgg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayAgg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayAgg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayAgg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayAgg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayAgg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayAgg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayAgg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayAgg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayAgg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayAgg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayAgg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayAgg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayAgg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayAgg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayAgg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayAgg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayAgg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayAgg.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayAgg.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayAgg.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayAgg.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayAgg.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayAgg.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayAgg.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayAll"> + <input id="ArrayAll-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayAll</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArrayAll-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayAll"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayAll-2917"><a href="#ArrayAll-2917"><span class="linenos">2917</span></a><span class="k">class</span> <span class="nc">ArrayAll</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArrayAll-2918"><a href="#ArrayAll-2918"><span class="linenos">2918</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayAll.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayAll.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayAll.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayAll.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayAll.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayAll.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayAll.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayAll.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayAll.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayAll.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayAll.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayAll.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayAll.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayAll.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayAll.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayAll.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayAll.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayAll.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayAll.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayAll.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayAll.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayAll.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayAll.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayAll.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayAll.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayAll.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayAll.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayAll.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayAll.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayAll.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayAll.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayAll.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayAll.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayAll.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayAll.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayAll.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayAll.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayAll.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayAll.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayAll.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayAny"> + <input id="ArrayAny-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayAny</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArrayAny-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayAny"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayAny-2921"><a href="#ArrayAny-2921"><span class="linenos">2921</span></a><span class="k">class</span> <span class="nc">ArrayAny</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArrayAny-2922"><a href="#ArrayAny-2922"><span class="linenos">2922</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayAny.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayAny.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayAny.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayAny.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayAny.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayAny.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayAny.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayAny.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayAny.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayAny.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayAny.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayAny.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayAny.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayAny.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayAny.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayAny.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayAny.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayAny.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayAny.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayAny.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayAny.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayAny.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayAny.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayAny.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayAny.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayAny.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayAny.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayAny.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayAny.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayAny.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayAny.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayAny.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayAny.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayAny.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayAny.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayAny.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayAny.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayAny.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayAny.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayAny.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayConcat"> + <input id="ArrayConcat-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayConcat</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArrayConcat-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayConcat"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayConcat-2925"><a href="#ArrayConcat-2925"><span class="linenos">2925</span></a><span class="k">class</span> <span class="nc">ArrayConcat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArrayConcat-2926"><a href="#ArrayConcat-2926"><span class="linenos">2926</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="ArrayConcat-2927"><a href="#ArrayConcat-2927"><span class="linenos">2927</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayConcat.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayConcat.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayConcat.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayConcat.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayConcat.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayConcat.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayConcat.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayConcat.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayConcat.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayConcat.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayConcat.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayConcat.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayConcat.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayConcat.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayConcat.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayConcat.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayConcat.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayConcat.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayConcat.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayConcat.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayConcat.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayConcat.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayConcat.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayConcat.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayConcat.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayConcat.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayConcat.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayConcat.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayConcat.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayConcat.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayConcat.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayConcat.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayConcat.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayConcat.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayConcat.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayConcat.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayConcat.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayConcat.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayConcat.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayConcat.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayContains"> + <input id="ArrayContains-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayContains</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArrayContains-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayContains"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayContains-2930"><a href="#ArrayContains-2930"><span class="linenos">2930</span></a><span class="k">class</span> <span class="nc">ArrayContains</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArrayContains-2931"><a href="#ArrayContains-2931"><span class="linenos">2931</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayContains.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayContains.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayContains.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayContains.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayContains.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayContains.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayContains.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayContains.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayContains.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayContains.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayContains.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayContains.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayContains.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayContains.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayContains.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayContains.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayContains.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayContains.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayContains.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayContains.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayContains.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayContains.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayContains.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayContains.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayContains.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayContains.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayContains.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayContains.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayContains.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayContains.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayContains.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayContains.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayContains.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayContains.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayContains.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayContains.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayContains.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayContains.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayContains.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayContains.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayFilter"> + <input id="ArrayFilter-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayFilter</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArrayFilter-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayFilter"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayFilter-2934"><a href="#ArrayFilter-2934"><span class="linenos">2934</span></a><span class="k">class</span> <span class="nc">ArrayFilter</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArrayFilter-2935"><a href="#ArrayFilter-2935"><span class="linenos">2935</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="ArrayFilter-2936"><a href="#ArrayFilter-2936"><span class="linenos">2936</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"FILTER"</span><span class="p">,</span> <span class="s2">"ARRAY_FILTER"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayFilter.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayFilter.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayFilter.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayFilter.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayFilter.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayFilter.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayFilter.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayFilter.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayFilter.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayFilter.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayFilter.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayFilter.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayFilter.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayFilter.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayFilter.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayFilter.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayFilter.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayFilter.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayFilter.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayFilter.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayFilter.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayFilter.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayFilter.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayFilter.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayFilter.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayFilter.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayFilter.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayFilter.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayFilter.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayFilter.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayFilter.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayFilter.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayFilter.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayFilter.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayFilter.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayFilter.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayFilter.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayFilter.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayFilter.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayFilter.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArraySize"> + <input id="ArraySize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArraySize</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArraySize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArraySize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArraySize-2939"><a href="#ArraySize-2939"><span class="linenos">2939</span></a><span class="k">class</span> <span class="nc">ArraySize</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArraySize-2940"><a href="#ArraySize-2940"><span class="linenos">2940</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArraySize.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArraySize.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArraySize.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArraySize.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArraySize.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArraySize.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArraySize.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArraySize.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArraySize.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArraySize.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArraySize.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArraySize.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArraySize.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArraySize.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArraySize.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArraySize.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArraySize.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArraySize.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArraySize.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArraySize.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArraySize.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArraySize.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArraySize.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArraySize.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArraySize.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArraySize.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArraySize.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArraySize.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArraySize.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArraySize.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArraySize.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArraySize.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArraySize.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArraySize.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArraySize.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArraySize.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArraySize.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArraySize.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArraySize.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArraySize.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArraySort"> + <input id="ArraySort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArraySort</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArraySort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArraySort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArraySort-2943"><a href="#ArraySort-2943"><span class="linenos">2943</span></a><span class="k">class</span> <span class="nc">ArraySort</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArraySort-2944"><a href="#ArraySort-2944"><span class="linenos">2944</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArraySort.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArraySort.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArraySort.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArraySort.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArraySort.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArraySort.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArraySort.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArraySort.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArraySort.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArraySort.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArraySort.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArraySort.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArraySort.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArraySort.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArraySort.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArraySort.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArraySort.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArraySort.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArraySort.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArraySort.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArraySort.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArraySort.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArraySort.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArraySort.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArraySort.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArraySort.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArraySort.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArraySort.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArraySort.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArraySort.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArraySort.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArraySort.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArraySort.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArraySort.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArraySort.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArraySort.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArraySort.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArraySort.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArraySort.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArraySort.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArraySum"> + <input id="ArraySum-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArraySum</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ArraySum-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArraySum"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArraySum-2947"><a href="#ArraySum-2947"><span class="linenos">2947</span></a><span class="k">class</span> <span class="nc">ArraySum</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ArraySum-2948"><a href="#ArraySum-2948"><span class="linenos">2948</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArraySum.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArraySum.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArraySum.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArraySum.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArraySum.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArraySum.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArraySum.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArraySum.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArraySum.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArraySum.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArraySum.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArraySum.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArraySum.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArraySum.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArraySum.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArraySum.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArraySum.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArraySum.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArraySum.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArraySum.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArraySum.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArraySum.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArraySum.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArraySum.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArraySum.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArraySum.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArraySum.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArraySum.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArraySum.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArraySum.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArraySum.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArraySum.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArraySum.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArraySum.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArraySum.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArraySum.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArraySum.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArraySum.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArraySum.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArraySum.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ArrayUnionAgg"> + <input id="ArrayUnionAgg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ArrayUnionAgg</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="ArrayUnionAgg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ArrayUnionAgg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ArrayUnionAgg-2951"><a href="#ArrayUnionAgg-2951"><span class="linenos">2951</span></a><span class="k">class</span> <span class="nc">ArrayUnionAgg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="ArrayUnionAgg-2952"><a href="#ArrayUnionAgg-2952"><span class="linenos">2952</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ArrayUnionAgg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ArrayUnionAgg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ArrayUnionAgg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ArrayUnionAgg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ArrayUnionAgg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ArrayUnionAgg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ArrayUnionAgg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ArrayUnionAgg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ArrayUnionAgg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ArrayUnionAgg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ArrayUnionAgg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ArrayUnionAgg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ArrayUnionAgg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ArrayUnionAgg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ArrayUnionAgg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ArrayUnionAgg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ArrayUnionAgg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ArrayUnionAgg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ArrayUnionAgg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ArrayUnionAgg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ArrayUnionAgg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ArrayUnionAgg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ArrayUnionAgg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ArrayUnionAgg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ArrayUnionAgg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ArrayUnionAgg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ArrayUnionAgg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ArrayUnionAgg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ArrayUnionAgg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ArrayUnionAgg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ArrayUnionAgg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ArrayUnionAgg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ArrayUnionAgg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ArrayUnionAgg.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ArrayUnionAgg.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ArrayUnionAgg.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ArrayUnionAgg.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ArrayUnionAgg.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ArrayUnionAgg.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ArrayUnionAgg.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Avg"> + <input id="Avg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Avg</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Avg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Avg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Avg-2955"><a href="#Avg-2955"><span class="linenos">2955</span></a><span class="k">class</span> <span class="nc">Avg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Avg-2956"><a href="#Avg-2956"><span class="linenos">2956</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Avg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Avg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Avg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Avg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Avg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Avg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Avg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Avg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Avg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Avg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Avg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Avg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Avg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Avg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Avg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Avg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Avg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Avg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Avg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Avg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Avg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Avg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Avg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Avg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Avg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Avg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Avg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Avg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Avg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Avg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Avg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Avg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Avg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Avg.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Avg.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Avg.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Avg.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Avg.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Avg.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Avg.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="AnyValue"> + <input id="AnyValue-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AnyValue</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="AnyValue-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AnyValue"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AnyValue-2959"><a href="#AnyValue-2959"><span class="linenos">2959</span></a><span class="k">class</span> <span class="nc">AnyValue</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="AnyValue-2960"><a href="#AnyValue-2960"><span class="linenos">2960</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="AnyValue.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="AnyValue.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="AnyValue.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="AnyValue.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="AnyValue.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="AnyValue.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="AnyValue.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="AnyValue.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="AnyValue.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="AnyValue.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="AnyValue.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="AnyValue.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="AnyValue.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="AnyValue.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="AnyValue.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="AnyValue.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="AnyValue.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="AnyValue.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="AnyValue.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="AnyValue.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="AnyValue.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="AnyValue.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="AnyValue.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="AnyValue.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="AnyValue.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="AnyValue.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="AnyValue.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="AnyValue.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="AnyValue.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="AnyValue.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="AnyValue.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="AnyValue.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="AnyValue.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="AnyValue.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="AnyValue.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="AnyValue.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="AnyValue.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="AnyValue.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="AnyValue.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="AnyValue.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Case"> + <input id="Case-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Case</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Case-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Case"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Case-2963"><a href="#Case-2963"><span class="linenos">2963</span></a><span class="k">class</span> <span class="nc">Case</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Case-2964"><a href="#Case-2964"><span class="linenos">2964</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"ifs"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Case.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Case.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Case.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Case.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Case.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Case.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Case.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Case.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Case.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Case.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Case.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Case.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Case.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Case.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Case.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Case.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Case.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Case.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Case.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Case.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Case.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Case.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Case.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Case.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Case.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Case.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Case.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Case.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Case.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Case.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Case.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Case.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Case.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Case.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Case.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Case.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Case.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Case.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Case.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Case.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Cast"> + <input id="Cast-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Cast</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Cast-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Cast"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Cast-2967"><a href="#Cast-2967"><span class="linenos">2967</span></a><span class="k">class</span> <span class="nc">Cast</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Cast-2968"><a href="#Cast-2968"><span class="linenos">2968</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"to"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Cast-2969"><a href="#Cast-2969"><span class="linenos">2969</span></a> +</span><span id="Cast-2970"><a href="#Cast-2970"><span class="linenos">2970</span></a> <span class="nd">@property</span> +</span><span id="Cast-2971"><a href="#Cast-2971"><span class="linenos">2971</span></a> <span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Cast-2972"><a href="#Cast-2972"><span class="linenos">2972</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span> +</span><span id="Cast-2973"><a href="#Cast-2973"><span class="linenos">2973</span></a> +</span><span id="Cast-2974"><a href="#Cast-2974"><span class="linenos">2974</span></a> <span class="nd">@property</span> +</span><span id="Cast-2975"><a href="#Cast-2975"><span class="linenos">2975</span></a> <span class="k">def</span> <span class="nf">to</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Cast-2976"><a href="#Cast-2976"><span class="linenos">2976</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]</span> +</span><span id="Cast-2977"><a href="#Cast-2977"><span class="linenos">2977</span></a> +</span><span id="Cast-2978"><a href="#Cast-2978"><span class="linenos">2978</span></a> <span class="nd">@property</span> +</span><span id="Cast-2979"><a href="#Cast-2979"><span class="linenos">2979</span></a> <span class="k">def</span> <span class="nf">output_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Cast-2980"><a href="#Cast-2980"><span class="linenos">2980</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="Cast-2981"><a href="#Cast-2981"><span class="linenos">2981</span></a> +</span><span id="Cast-2982"><a href="#Cast-2982"><span class="linenos">2982</span></a> <span class="k">def</span> <span class="nf">is_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Cast-2983"><a href="#Cast-2983"><span class="linenos">2983</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Cast.output_name" class="classattr"> + <div class="attr variable"> + <span class="name">output_name</span> + + + </div> + <a class="headerlink" href="#Cast.output_name"></a> + + <div class="docstring"><p>Name of the output column if this expression is a selection.</p> + +<p>If the Expression has no output name, an empty string is returned.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT a"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'a'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT b AS c"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">'c'</span> +<span class="gp">>>> </span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT 1 + 2"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">output_name</span> +<span class="go">''</span> +</code></pre> + </div> +</blockquote> +</div> + + + </div> + <div id="Cast.is_type" class="classattr"> + <input id="Cast.is_type-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">is_type</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">dtype</span><span class="p">:</span> <span class="n"><a href="#DataType.Type">sqlglot.expressions.DataType.Type</a></span></span><span class="return-annotation">) -> <span class="nb">bool</span>:</span></span> + + <label class="view-source-button" for="Cast.is_type-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Cast.is_type"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Cast.is_type-2982"><a href="#Cast.is_type-2982"><span class="linenos">2982</span></a> <span class="k">def</span> <span class="nf">is_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dtype</span><span class="p">:</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Cast.is_type-2983"><a href="#Cast.is_type-2983"><span class="linenos">2983</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="n">dtype</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Cast.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Cast.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Cast.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Cast.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Cast.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Cast.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Cast.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Cast.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Cast.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Cast.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Cast.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Cast.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Cast.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Cast.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Cast.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Cast.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Cast.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Cast.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Cast.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Cast.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Cast.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Cast.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Cast.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Cast.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Cast.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Cast.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Cast.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Cast.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Cast.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Cast.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Cast.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Cast.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Cast.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Cast.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Cast.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Cast.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Cast.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Cast.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Cast.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Collate"> + <input id="Collate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Collate</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="Collate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Collate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Collate-2986"><a href="#Collate-2986"><span class="linenos">2986</span></a><span class="k">class</span> <span class="nc">Collate</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="Collate-2987"><a href="#Collate-2987"><span class="linenos">2987</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Collate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Collate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Collate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Collate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Collate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Collate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Collate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Collate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Collate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Collate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Collate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Collate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Collate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Collate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Collate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Collate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Collate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Collate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Collate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Collate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Collate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Collate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Collate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Collate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Collate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Collate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Collate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Collate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Collate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Collate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Collate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Collate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Collate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TryCast"> + <input id="TryCast-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TryCast</span><wbr>(<span class="base"><a href="#Cast">Cast</a></span>): + + <label class="view-source-button" for="TryCast-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TryCast"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TryCast-2990"><a href="#TryCast-2990"><span class="linenos">2990</span></a><span class="k">class</span> <span class="nc">TryCast</span><span class="p">(</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="TryCast-2991"><a href="#TryCast-2991"><span class="linenos">2991</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TryCast.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TryCast.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TryCast.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TryCast.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TryCast.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TryCast.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TryCast.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TryCast.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TryCast.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TryCast.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TryCast.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TryCast.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TryCast.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TryCast.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TryCast.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TryCast.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TryCast.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TryCast.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TryCast.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TryCast.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TryCast.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TryCast.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TryCast.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TryCast.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TryCast.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TryCast.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TryCast.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TryCast.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TryCast.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TryCast.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TryCast.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TryCast.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Cast">Cast</a></dt> + <dd id="TryCast.output_name" class="variable"><a href="#Cast.output_name">output_name</a></dd> + <dd id="TryCast.is_type" class="function"><a href="#Cast.is_type">is_type</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TryCast.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TryCast.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TryCast.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TryCast.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TryCast.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TryCast.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TryCast.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Ceil"> + <input id="Ceil-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Ceil</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Ceil-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Ceil"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Ceil-2994"><a href="#Ceil-2994"><span class="linenos">2994</span></a><span class="k">class</span> <span class="nc">Ceil</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Ceil-2995"><a href="#Ceil-2995"><span class="linenos">2995</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"decimals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Ceil-2996"><a href="#Ceil-2996"><span class="linenos">2996</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"CEIL"</span><span class="p">,</span> <span class="s2">"CEILING"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Ceil.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Ceil.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Ceil.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Ceil.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Ceil.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Ceil.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Ceil.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Ceil.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Ceil.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Ceil.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Ceil.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Ceil.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Ceil.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Ceil.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Ceil.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Ceil.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Ceil.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Ceil.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Ceil.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Ceil.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Ceil.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Ceil.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Ceil.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Ceil.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Ceil.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Ceil.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Ceil.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Ceil.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Ceil.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Ceil.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Ceil.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Ceil.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Ceil.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Ceil.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Ceil.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Ceil.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Ceil.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Ceil.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Ceil.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Ceil.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Coalesce"> + <input id="Coalesce-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Coalesce</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Coalesce-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Coalesce"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Coalesce-2999"><a href="#Coalesce-2999"><span class="linenos">2999</span></a><span class="k">class</span> <span class="nc">Coalesce</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Coalesce-3000"><a href="#Coalesce-3000"><span class="linenos">3000</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Coalesce-3001"><a href="#Coalesce-3001"><span class="linenos">3001</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Coalesce.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Coalesce.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Coalesce.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Coalesce.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Coalesce.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Coalesce.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Coalesce.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Coalesce.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Coalesce.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Coalesce.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Coalesce.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Coalesce.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Coalesce.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Coalesce.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Coalesce.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Coalesce.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Coalesce.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Coalesce.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Coalesce.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Coalesce.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Coalesce.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Coalesce.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Coalesce.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Coalesce.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Coalesce.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Coalesce.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Coalesce.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Coalesce.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Coalesce.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Coalesce.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Coalesce.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Coalesce.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Coalesce.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Coalesce.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Coalesce.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Coalesce.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Coalesce.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Coalesce.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Coalesce.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Coalesce.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Concat"> + <input id="Concat-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Concat</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Concat-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Concat"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Concat-3004"><a href="#Concat-3004"><span class="linenos">3004</span></a><span class="k">class</span> <span class="nc">Concat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Concat-3005"><a href="#Concat-3005"><span class="linenos">3005</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Concat-3006"><a href="#Concat-3006"><span class="linenos">3006</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Concat.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Concat.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Concat.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Concat.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Concat.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Concat.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Concat.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Concat.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Concat.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Concat.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Concat.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Concat.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Concat.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Concat.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Concat.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Concat.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Concat.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Concat.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Concat.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Concat.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Concat.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Concat.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Concat.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Concat.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Concat.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Concat.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Concat.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Concat.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Concat.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Concat.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Concat.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Concat.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Concat.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Concat.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Concat.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Concat.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Concat.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Concat.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Concat.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Concat.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ConcatWs"> + <input id="ConcatWs-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ConcatWs</span><wbr>(<span class="base"><a href="#Concat">Concat</a></span>): + + <label class="view-source-button" for="ConcatWs-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ConcatWs"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ConcatWs-3009"><a href="#ConcatWs-3009"><span class="linenos">3009</span></a><span class="k">class</span> <span class="nc">ConcatWs</span><span class="p">(</span><span class="n">Concat</span><span class="p">):</span> +</span><span id="ConcatWs-3010"><a href="#ConcatWs-3010"><span class="linenos">3010</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"CONCAT_WS"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ConcatWs.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ConcatWs.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ConcatWs.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ConcatWs.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ConcatWs.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ConcatWs.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ConcatWs.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ConcatWs.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ConcatWs.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ConcatWs.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ConcatWs.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ConcatWs.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ConcatWs.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ConcatWs.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ConcatWs.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ConcatWs.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ConcatWs.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ConcatWs.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ConcatWs.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ConcatWs.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ConcatWs.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ConcatWs.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ConcatWs.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ConcatWs.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ConcatWs.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ConcatWs.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ConcatWs.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ConcatWs.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ConcatWs.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ConcatWs.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ConcatWs.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ConcatWs.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ConcatWs.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ConcatWs.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ConcatWs.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ConcatWs.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ConcatWs.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ConcatWs.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ConcatWs.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ConcatWs.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Count"> + <input id="Count-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Count</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Count-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Count"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Count-3013"><a href="#Count-3013"><span class="linenos">3013</span></a><span class="k">class</span> <span class="nc">Count</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Count-3014"><a href="#Count-3014"><span class="linenos">3014</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Count.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Count.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Count.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Count.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Count.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Count.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Count.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Count.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Count.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Count.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Count.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Count.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Count.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Count.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Count.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Count.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Count.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Count.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Count.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Count.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Count.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Count.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Count.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Count.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Count.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Count.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Count.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Count.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Count.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Count.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Count.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Count.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Count.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Count.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Count.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Count.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Count.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Count.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Count.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Count.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CurrentDate"> + <input id="CurrentDate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CurrentDate</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="CurrentDate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CurrentDate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CurrentDate-3017"><a href="#CurrentDate-3017"><span class="linenos">3017</span></a><span class="k">class</span> <span class="nc">CurrentDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="CurrentDate-3018"><a href="#CurrentDate-3018"><span class="linenos">3018</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CurrentDate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CurrentDate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CurrentDate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CurrentDate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CurrentDate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CurrentDate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CurrentDate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CurrentDate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CurrentDate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CurrentDate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CurrentDate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CurrentDate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CurrentDate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CurrentDate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CurrentDate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CurrentDate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CurrentDate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CurrentDate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CurrentDate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CurrentDate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CurrentDate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CurrentDate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CurrentDate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CurrentDate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CurrentDate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CurrentDate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CurrentDate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CurrentDate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CurrentDate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CurrentDate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CurrentDate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CurrentDate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CurrentDate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="CurrentDate.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="CurrentDate.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="CurrentDate.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="CurrentDate.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="CurrentDate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="CurrentDate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="CurrentDate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CurrentDatetime"> + <input id="CurrentDatetime-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CurrentDatetime</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="CurrentDatetime-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CurrentDatetime"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CurrentDatetime-3021"><a href="#CurrentDatetime-3021"><span class="linenos">3021</span></a><span class="k">class</span> <span class="nc">CurrentDatetime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="CurrentDatetime-3022"><a href="#CurrentDatetime-3022"><span class="linenos">3022</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CurrentDatetime.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CurrentDatetime.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CurrentDatetime.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CurrentDatetime.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CurrentDatetime.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CurrentDatetime.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CurrentDatetime.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CurrentDatetime.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CurrentDatetime.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CurrentDatetime.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CurrentDatetime.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CurrentDatetime.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CurrentDatetime.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CurrentDatetime.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CurrentDatetime.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CurrentDatetime.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CurrentDatetime.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CurrentDatetime.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CurrentDatetime.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CurrentDatetime.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CurrentDatetime.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CurrentDatetime.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CurrentDatetime.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CurrentDatetime.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CurrentDatetime.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CurrentDatetime.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CurrentDatetime.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CurrentDatetime.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CurrentDatetime.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CurrentDatetime.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CurrentDatetime.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CurrentDatetime.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CurrentDatetime.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="CurrentDatetime.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="CurrentDatetime.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="CurrentDatetime.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="CurrentDatetime.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="CurrentDatetime.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="CurrentDatetime.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="CurrentDatetime.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CurrentTime"> + <input id="CurrentTime-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CurrentTime</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="CurrentTime-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CurrentTime"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CurrentTime-3025"><a href="#CurrentTime-3025"><span class="linenos">3025</span></a><span class="k">class</span> <span class="nc">CurrentTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="CurrentTime-3026"><a href="#CurrentTime-3026"><span class="linenos">3026</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CurrentTime.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CurrentTime.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CurrentTime.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CurrentTime.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CurrentTime.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CurrentTime.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CurrentTime.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CurrentTime.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CurrentTime.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CurrentTime.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CurrentTime.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CurrentTime.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CurrentTime.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CurrentTime.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CurrentTime.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CurrentTime.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CurrentTime.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CurrentTime.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CurrentTime.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CurrentTime.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CurrentTime.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CurrentTime.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CurrentTime.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CurrentTime.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CurrentTime.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CurrentTime.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CurrentTime.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CurrentTime.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CurrentTime.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CurrentTime.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CurrentTime.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CurrentTime.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CurrentTime.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="CurrentTime.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="CurrentTime.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="CurrentTime.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="CurrentTime.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="CurrentTime.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="CurrentTime.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="CurrentTime.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="CurrentTimestamp"> + <input id="CurrentTimestamp-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">CurrentTimestamp</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="CurrentTimestamp-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#CurrentTimestamp"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="CurrentTimestamp-3029"><a href="#CurrentTimestamp-3029"><span class="linenos">3029</span></a><span class="k">class</span> <span class="nc">CurrentTimestamp</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="CurrentTimestamp-3030"><a href="#CurrentTimestamp-3030"><span class="linenos">3030</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="CurrentTimestamp.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="CurrentTimestamp.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="CurrentTimestamp.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="CurrentTimestamp.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="CurrentTimestamp.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="CurrentTimestamp.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="CurrentTimestamp.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="CurrentTimestamp.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="CurrentTimestamp.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="CurrentTimestamp.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="CurrentTimestamp.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="CurrentTimestamp.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="CurrentTimestamp.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="CurrentTimestamp.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="CurrentTimestamp.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="CurrentTimestamp.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="CurrentTimestamp.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="CurrentTimestamp.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="CurrentTimestamp.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="CurrentTimestamp.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="CurrentTimestamp.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="CurrentTimestamp.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="CurrentTimestamp.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="CurrentTimestamp.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="CurrentTimestamp.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="CurrentTimestamp.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="CurrentTimestamp.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="CurrentTimestamp.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="CurrentTimestamp.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="CurrentTimestamp.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="CurrentTimestamp.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="CurrentTimestamp.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="CurrentTimestamp.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="CurrentTimestamp.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="CurrentTimestamp.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="CurrentTimestamp.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="CurrentTimestamp.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="CurrentTimestamp.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="CurrentTimestamp.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="CurrentTimestamp.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateAdd"> + <input id="DateAdd-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateAdd</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DateAdd-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateAdd"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateAdd-3033"><a href="#DateAdd-3033"><span class="linenos">3033</span></a><span class="k">class</span> <span class="nc">DateAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DateAdd-3034"><a href="#DateAdd-3034"><span class="linenos">3034</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DateAdd.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateAdd.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateAdd.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateAdd.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateAdd.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateAdd.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateAdd.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateAdd.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateAdd.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateAdd.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateAdd.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateAdd.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateAdd.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateAdd.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateAdd.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateAdd.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateAdd.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateAdd.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateAdd.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateAdd.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateAdd.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateAdd.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateAdd.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateAdd.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateAdd.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateAdd.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateAdd.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateAdd.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateAdd.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateAdd.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateAdd.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateAdd.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateAdd.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateAdd.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateAdd.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateAdd.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateAdd.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateAdd.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateAdd.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateAdd.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateSub"> + <input id="DateSub-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateSub</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DateSub-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateSub"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateSub-3037"><a href="#DateSub-3037"><span class="linenos">3037</span></a><span class="k">class</span> <span class="nc">DateSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DateSub-3038"><a href="#DateSub-3038"><span class="linenos">3038</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DateSub.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateSub.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateSub.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateSub.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateSub.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateSub.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateSub.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateSub.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateSub.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateSub.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateSub.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateSub.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateSub.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateSub.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateSub.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateSub.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateSub.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateSub.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateSub.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateSub.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateSub.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateSub.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateSub.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateSub.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateSub.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateSub.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateSub.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateSub.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateSub.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateSub.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateSub.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateSub.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateSub.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateSub.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateSub.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateSub.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateSub.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateSub.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateSub.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateSub.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateDiff"> + <input id="DateDiff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateDiff</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DateDiff-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateDiff"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateDiff-3041"><a href="#DateDiff-3041"><span class="linenos">3041</span></a><span class="k">class</span> <span class="nc">DateDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DateDiff-3042"><a href="#DateDiff-3042"><span class="linenos">3042</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DateDiff.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateDiff.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateDiff.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateDiff.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateDiff.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateDiff.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateDiff.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateDiff.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateDiff.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateDiff.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateDiff.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateDiff.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateDiff.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateDiff.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateDiff.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateDiff.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateDiff.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateDiff.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateDiff.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateDiff.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateDiff.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateDiff.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateDiff.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateDiff.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateDiff.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateDiff.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateDiff.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateDiff.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateDiff.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateDiff.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateDiff.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateDiff.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateDiff.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateDiff.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateDiff.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateDiff.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateDiff.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateDiff.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateDiff.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateDiff.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateTrunc"> + <input id="DateTrunc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateTrunc</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DateTrunc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateTrunc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateTrunc-3045"><a href="#DateTrunc-3045"><span class="linenos">3045</span></a><span class="k">class</span> <span class="nc">DateTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DateTrunc-3046"><a href="#DateTrunc-3046"><span class="linenos">3046</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateTrunc.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DateTrunc.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateTrunc.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateTrunc.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateTrunc.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateTrunc.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateTrunc.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateTrunc.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateTrunc.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateTrunc.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateTrunc.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateTrunc.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateTrunc.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateTrunc.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateTrunc.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateTrunc.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateTrunc.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateTrunc.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateTrunc.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateTrunc.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateTrunc.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateTrunc.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateTrunc.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateTrunc.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateTrunc.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateTrunc.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateTrunc.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateTrunc.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateTrunc.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateTrunc.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateTrunc.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateTrunc.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateTrunc.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateTrunc.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateTrunc.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateTrunc.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateTrunc.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateTrunc.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateTrunc.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateTrunc.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DatetimeAdd"> + <input id="DatetimeAdd-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DatetimeAdd</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DatetimeAdd-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DatetimeAdd"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DatetimeAdd-3049"><a href="#DatetimeAdd-3049"><span class="linenos">3049</span></a><span class="k">class</span> <span class="nc">DatetimeAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DatetimeAdd-3050"><a href="#DatetimeAdd-3050"><span class="linenos">3050</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DatetimeAdd.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DatetimeAdd.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DatetimeAdd.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DatetimeAdd.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DatetimeAdd.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DatetimeAdd.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DatetimeAdd.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DatetimeAdd.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DatetimeAdd.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DatetimeAdd.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DatetimeAdd.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DatetimeAdd.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DatetimeAdd.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DatetimeAdd.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DatetimeAdd.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DatetimeAdd.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DatetimeAdd.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DatetimeAdd.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DatetimeAdd.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DatetimeAdd.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DatetimeAdd.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DatetimeAdd.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DatetimeAdd.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DatetimeAdd.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DatetimeAdd.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DatetimeAdd.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DatetimeAdd.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DatetimeAdd.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DatetimeAdd.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DatetimeAdd.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DatetimeAdd.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DatetimeAdd.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DatetimeAdd.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DatetimeAdd.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DatetimeAdd.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DatetimeAdd.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DatetimeAdd.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DatetimeAdd.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DatetimeAdd.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DatetimeAdd.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DatetimeSub"> + <input id="DatetimeSub-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DatetimeSub</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DatetimeSub-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DatetimeSub"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DatetimeSub-3053"><a href="#DatetimeSub-3053"><span class="linenos">3053</span></a><span class="k">class</span> <span class="nc">DatetimeSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DatetimeSub-3054"><a href="#DatetimeSub-3054"><span class="linenos">3054</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DatetimeSub.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DatetimeSub.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DatetimeSub.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DatetimeSub.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DatetimeSub.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DatetimeSub.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DatetimeSub.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DatetimeSub.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DatetimeSub.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DatetimeSub.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DatetimeSub.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DatetimeSub.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DatetimeSub.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DatetimeSub.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DatetimeSub.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DatetimeSub.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DatetimeSub.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DatetimeSub.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DatetimeSub.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DatetimeSub.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DatetimeSub.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DatetimeSub.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DatetimeSub.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DatetimeSub.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DatetimeSub.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DatetimeSub.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DatetimeSub.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DatetimeSub.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DatetimeSub.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DatetimeSub.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DatetimeSub.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DatetimeSub.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DatetimeSub.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DatetimeSub.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DatetimeSub.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DatetimeSub.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DatetimeSub.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DatetimeSub.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DatetimeSub.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DatetimeSub.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DatetimeDiff"> + <input id="DatetimeDiff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DatetimeDiff</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DatetimeDiff-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DatetimeDiff"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DatetimeDiff-3057"><a href="#DatetimeDiff-3057"><span class="linenos">3057</span></a><span class="k">class</span> <span class="nc">DatetimeDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DatetimeDiff-3058"><a href="#DatetimeDiff-3058"><span class="linenos">3058</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DatetimeDiff.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DatetimeDiff.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DatetimeDiff.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DatetimeDiff.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DatetimeDiff.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DatetimeDiff.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DatetimeDiff.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DatetimeDiff.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DatetimeDiff.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DatetimeDiff.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DatetimeDiff.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DatetimeDiff.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DatetimeDiff.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DatetimeDiff.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DatetimeDiff.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DatetimeDiff.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DatetimeDiff.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DatetimeDiff.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DatetimeDiff.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DatetimeDiff.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DatetimeDiff.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DatetimeDiff.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DatetimeDiff.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DatetimeDiff.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DatetimeDiff.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DatetimeDiff.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DatetimeDiff.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DatetimeDiff.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DatetimeDiff.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DatetimeDiff.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DatetimeDiff.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DatetimeDiff.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DatetimeDiff.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DatetimeDiff.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DatetimeDiff.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DatetimeDiff.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DatetimeDiff.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DatetimeDiff.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DatetimeDiff.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DatetimeDiff.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DatetimeTrunc"> + <input id="DatetimeTrunc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DatetimeTrunc</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="DatetimeTrunc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DatetimeTrunc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DatetimeTrunc-3061"><a href="#DatetimeTrunc-3061"><span class="linenos">3061</span></a><span class="k">class</span> <span class="nc">DatetimeTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="DatetimeTrunc-3062"><a href="#DatetimeTrunc-3062"><span class="linenos">3062</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="DatetimeTrunc.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DatetimeTrunc.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DatetimeTrunc.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DatetimeTrunc.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DatetimeTrunc.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DatetimeTrunc.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DatetimeTrunc.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DatetimeTrunc.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DatetimeTrunc.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DatetimeTrunc.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DatetimeTrunc.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DatetimeTrunc.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DatetimeTrunc.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DatetimeTrunc.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DatetimeTrunc.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DatetimeTrunc.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DatetimeTrunc.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DatetimeTrunc.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DatetimeTrunc.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DatetimeTrunc.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DatetimeTrunc.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DatetimeTrunc.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DatetimeTrunc.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DatetimeTrunc.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DatetimeTrunc.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DatetimeTrunc.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DatetimeTrunc.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DatetimeTrunc.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DatetimeTrunc.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DatetimeTrunc.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DatetimeTrunc.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DatetimeTrunc.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DatetimeTrunc.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DatetimeTrunc.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DatetimeTrunc.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DatetimeTrunc.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DatetimeTrunc.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DatetimeTrunc.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DatetimeTrunc.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DatetimeTrunc.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DayOfWeek"> + <input id="DayOfWeek-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DayOfWeek</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DayOfWeek-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DayOfWeek"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DayOfWeek-3065"><a href="#DayOfWeek-3065"><span class="linenos">3065</span></a><span class="k">class</span> <span class="nc">DayOfWeek</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DayOfWeek-3066"><a href="#DayOfWeek-3066"><span class="linenos">3066</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DAY_OF_WEEK"</span><span class="p">,</span> <span class="s2">"DAYOFWEEK"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DayOfWeek.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DayOfWeek.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DayOfWeek.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DayOfWeek.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DayOfWeek.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DayOfWeek.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DayOfWeek.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DayOfWeek.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DayOfWeek.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DayOfWeek.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DayOfWeek.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DayOfWeek.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DayOfWeek.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DayOfWeek.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DayOfWeek.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DayOfWeek.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DayOfWeek.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DayOfWeek.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DayOfWeek.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DayOfWeek.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DayOfWeek.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DayOfWeek.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DayOfWeek.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DayOfWeek.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DayOfWeek.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DayOfWeek.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DayOfWeek.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DayOfWeek.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DayOfWeek.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DayOfWeek.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DayOfWeek.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DayOfWeek.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DayOfWeek.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DayOfWeek.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DayOfWeek.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DayOfWeek.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DayOfWeek.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DayOfWeek.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DayOfWeek.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DayOfWeek.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DayOfMonth"> + <input id="DayOfMonth-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DayOfMonth</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DayOfMonth-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DayOfMonth"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DayOfMonth-3069"><a href="#DayOfMonth-3069"><span class="linenos">3069</span></a><span class="k">class</span> <span class="nc">DayOfMonth</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DayOfMonth-3070"><a href="#DayOfMonth-3070"><span class="linenos">3070</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DAY_OF_MONTH"</span><span class="p">,</span> <span class="s2">"DAYOFMONTH"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DayOfMonth.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DayOfMonth.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DayOfMonth.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DayOfMonth.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DayOfMonth.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DayOfMonth.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DayOfMonth.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DayOfMonth.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DayOfMonth.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DayOfMonth.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DayOfMonth.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DayOfMonth.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DayOfMonth.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DayOfMonth.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DayOfMonth.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DayOfMonth.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DayOfMonth.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DayOfMonth.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DayOfMonth.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DayOfMonth.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DayOfMonth.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DayOfMonth.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DayOfMonth.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DayOfMonth.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DayOfMonth.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DayOfMonth.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DayOfMonth.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DayOfMonth.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DayOfMonth.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DayOfMonth.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DayOfMonth.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DayOfMonth.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DayOfMonth.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DayOfMonth.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DayOfMonth.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DayOfMonth.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DayOfMonth.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DayOfMonth.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DayOfMonth.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DayOfMonth.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DayOfYear"> + <input id="DayOfYear-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DayOfYear</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DayOfYear-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DayOfYear"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DayOfYear-3073"><a href="#DayOfYear-3073"><span class="linenos">3073</span></a><span class="k">class</span> <span class="nc">DayOfYear</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DayOfYear-3074"><a href="#DayOfYear-3074"><span class="linenos">3074</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DAY_OF_YEAR"</span><span class="p">,</span> <span class="s2">"DAYOFYEAR"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DayOfYear.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DayOfYear.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DayOfYear.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DayOfYear.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DayOfYear.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DayOfYear.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DayOfYear.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DayOfYear.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DayOfYear.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DayOfYear.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DayOfYear.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DayOfYear.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DayOfYear.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DayOfYear.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DayOfYear.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DayOfYear.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DayOfYear.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DayOfYear.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DayOfYear.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DayOfYear.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DayOfYear.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DayOfYear.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DayOfYear.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DayOfYear.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DayOfYear.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DayOfYear.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DayOfYear.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DayOfYear.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DayOfYear.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DayOfYear.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DayOfYear.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DayOfYear.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DayOfYear.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DayOfYear.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DayOfYear.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DayOfYear.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DayOfYear.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DayOfYear.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DayOfYear.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DayOfYear.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="WeekOfYear"> + <input id="WeekOfYear-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">WeekOfYear</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="WeekOfYear-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#WeekOfYear"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="WeekOfYear-3077"><a href="#WeekOfYear-3077"><span class="linenos">3077</span></a><span class="k">class</span> <span class="nc">WeekOfYear</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="WeekOfYear-3078"><a href="#WeekOfYear-3078"><span class="linenos">3078</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"WEEK_OF_YEAR"</span><span class="p">,</span> <span class="s2">"WEEKOFYEAR"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="WeekOfYear.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="WeekOfYear.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="WeekOfYear.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="WeekOfYear.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="WeekOfYear.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="WeekOfYear.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="WeekOfYear.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="WeekOfYear.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="WeekOfYear.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="WeekOfYear.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="WeekOfYear.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="WeekOfYear.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="WeekOfYear.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="WeekOfYear.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="WeekOfYear.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="WeekOfYear.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="WeekOfYear.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="WeekOfYear.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="WeekOfYear.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="WeekOfYear.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="WeekOfYear.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="WeekOfYear.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="WeekOfYear.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="WeekOfYear.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="WeekOfYear.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="WeekOfYear.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="WeekOfYear.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="WeekOfYear.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="WeekOfYear.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="WeekOfYear.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="WeekOfYear.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="WeekOfYear.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="WeekOfYear.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="WeekOfYear.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="WeekOfYear.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="WeekOfYear.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="WeekOfYear.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="WeekOfYear.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="WeekOfYear.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="WeekOfYear.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LastDateOfMonth"> + <input id="LastDateOfMonth-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LastDateOfMonth</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="LastDateOfMonth-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LastDateOfMonth"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LastDateOfMonth-3081"><a href="#LastDateOfMonth-3081"><span class="linenos">3081</span></a><span class="k">class</span> <span class="nc">LastDateOfMonth</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="LastDateOfMonth-3082"><a href="#LastDateOfMonth-3082"><span class="linenos">3082</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LastDateOfMonth.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LastDateOfMonth.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LastDateOfMonth.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LastDateOfMonth.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LastDateOfMonth.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LastDateOfMonth.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LastDateOfMonth.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LastDateOfMonth.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LastDateOfMonth.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LastDateOfMonth.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LastDateOfMonth.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LastDateOfMonth.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LastDateOfMonth.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LastDateOfMonth.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LastDateOfMonth.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LastDateOfMonth.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LastDateOfMonth.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LastDateOfMonth.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LastDateOfMonth.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LastDateOfMonth.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LastDateOfMonth.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LastDateOfMonth.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LastDateOfMonth.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LastDateOfMonth.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LastDateOfMonth.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LastDateOfMonth.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LastDateOfMonth.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LastDateOfMonth.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LastDateOfMonth.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LastDateOfMonth.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LastDateOfMonth.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LastDateOfMonth.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LastDateOfMonth.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="LastDateOfMonth.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="LastDateOfMonth.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="LastDateOfMonth.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="LastDateOfMonth.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="LastDateOfMonth.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="LastDateOfMonth.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="LastDateOfMonth.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Extract"> + <input id="Extract-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Extract</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Extract-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Extract"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Extract-3085"><a href="#Extract-3085"><span class="linenos">3085</span></a><span class="k">class</span> <span class="nc">Extract</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Extract-3086"><a href="#Extract-3086"><span class="linenos">3086</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Extract.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Extract.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Extract.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Extract.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Extract.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Extract.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Extract.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Extract.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Extract.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Extract.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Extract.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Extract.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Extract.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Extract.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Extract.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Extract.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Extract.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Extract.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Extract.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Extract.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Extract.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Extract.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Extract.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Extract.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Extract.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Extract.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Extract.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Extract.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Extract.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Extract.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Extract.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Extract.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Extract.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Extract.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Extract.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Extract.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Extract.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Extract.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Extract.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Extract.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimestampAdd"> + <input id="TimestampAdd-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimestampAdd</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimestampAdd-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimestampAdd"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimestampAdd-3089"><a href="#TimestampAdd-3089"><span class="linenos">3089</span></a><span class="k">class</span> <span class="nc">TimestampAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimestampAdd-3090"><a href="#TimestampAdd-3090"><span class="linenos">3090</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimestampAdd.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimestampAdd.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimestampAdd.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimestampAdd.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimestampAdd.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimestampAdd.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimestampAdd.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimestampAdd.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimestampAdd.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimestampAdd.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimestampAdd.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimestampAdd.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimestampAdd.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimestampAdd.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimestampAdd.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimestampAdd.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimestampAdd.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimestampAdd.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimestampAdd.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimestampAdd.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimestampAdd.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimestampAdd.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimestampAdd.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimestampAdd.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimestampAdd.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimestampAdd.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimestampAdd.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimestampAdd.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimestampAdd.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimestampAdd.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimestampAdd.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimestampAdd.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimestampAdd.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimestampAdd.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimestampAdd.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimestampAdd.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimestampAdd.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimestampAdd.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimestampAdd.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimestampAdd.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimestampSub"> + <input id="TimestampSub-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimestampSub</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimestampSub-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimestampSub"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimestampSub-3093"><a href="#TimestampSub-3093"><span class="linenos">3093</span></a><span class="k">class</span> <span class="nc">TimestampSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimestampSub-3094"><a href="#TimestampSub-3094"><span class="linenos">3094</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimestampSub.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimestampSub.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimestampSub.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimestampSub.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimestampSub.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimestampSub.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimestampSub.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimestampSub.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimestampSub.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimestampSub.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimestampSub.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimestampSub.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimestampSub.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimestampSub.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimestampSub.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimestampSub.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimestampSub.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimestampSub.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimestampSub.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimestampSub.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimestampSub.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimestampSub.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimestampSub.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimestampSub.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimestampSub.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimestampSub.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimestampSub.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimestampSub.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimestampSub.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimestampSub.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimestampSub.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimestampSub.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimestampSub.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimestampSub.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimestampSub.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimestampSub.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimestampSub.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimestampSub.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimestampSub.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimestampSub.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimestampDiff"> + <input id="TimestampDiff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimestampDiff</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimestampDiff-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimestampDiff"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimestampDiff-3097"><a href="#TimestampDiff-3097"><span class="linenos">3097</span></a><span class="k">class</span> <span class="nc">TimestampDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimestampDiff-3098"><a href="#TimestampDiff-3098"><span class="linenos">3098</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimestampDiff.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimestampDiff.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimestampDiff.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimestampDiff.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimestampDiff.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimestampDiff.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimestampDiff.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimestampDiff.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimestampDiff.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimestampDiff.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimestampDiff.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimestampDiff.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimestampDiff.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimestampDiff.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimestampDiff.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimestampDiff.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimestampDiff.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimestampDiff.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimestampDiff.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimestampDiff.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimestampDiff.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimestampDiff.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimestampDiff.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimestampDiff.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimestampDiff.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimestampDiff.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimestampDiff.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimestampDiff.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimestampDiff.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimestampDiff.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimestampDiff.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimestampDiff.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimestampDiff.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimestampDiff.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimestampDiff.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimestampDiff.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimestampDiff.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimestampDiff.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimestampDiff.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimestampDiff.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimestampTrunc"> + <input id="TimestampTrunc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimestampTrunc</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimestampTrunc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimestampTrunc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimestampTrunc-3101"><a href="#TimestampTrunc-3101"><span class="linenos">3101</span></a><span class="k">class</span> <span class="nc">TimestampTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimestampTrunc-3102"><a href="#TimestampTrunc-3102"><span class="linenos">3102</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimestampTrunc.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimestampTrunc.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimestampTrunc.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimestampTrunc.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimestampTrunc.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimestampTrunc.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimestampTrunc.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimestampTrunc.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimestampTrunc.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimestampTrunc.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimestampTrunc.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimestampTrunc.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimestampTrunc.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimestampTrunc.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimestampTrunc.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimestampTrunc.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimestampTrunc.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimestampTrunc.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimestampTrunc.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimestampTrunc.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimestampTrunc.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimestampTrunc.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimestampTrunc.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimestampTrunc.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimestampTrunc.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimestampTrunc.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimestampTrunc.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimestampTrunc.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimestampTrunc.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimestampTrunc.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimestampTrunc.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimestampTrunc.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimestampTrunc.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimestampTrunc.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimestampTrunc.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimestampTrunc.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimestampTrunc.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimestampTrunc.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimestampTrunc.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimestampTrunc.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeAdd"> + <input id="TimeAdd-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeAdd</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimeAdd-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeAdd"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeAdd-3105"><a href="#TimeAdd-3105"><span class="linenos">3105</span></a><span class="k">class</span> <span class="nc">TimeAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimeAdd-3106"><a href="#TimeAdd-3106"><span class="linenos">3106</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimeAdd.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeAdd.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeAdd.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeAdd.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeAdd.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeAdd.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeAdd.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeAdd.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeAdd.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeAdd.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeAdd.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeAdd.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeAdd.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeAdd.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeAdd.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeAdd.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeAdd.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeAdd.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeAdd.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeAdd.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeAdd.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeAdd.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeAdd.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeAdd.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeAdd.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeAdd.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeAdd.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeAdd.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeAdd.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeAdd.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeAdd.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeAdd.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeAdd.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeAdd.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeAdd.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeAdd.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeAdd.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeAdd.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeAdd.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeAdd.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeSub"> + <input id="TimeSub-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeSub</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimeSub-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeSub"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeSub-3109"><a href="#TimeSub-3109"><span class="linenos">3109</span></a><span class="k">class</span> <span class="nc">TimeSub</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimeSub-3110"><a href="#TimeSub-3110"><span class="linenos">3110</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimeSub.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeSub.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeSub.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeSub.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeSub.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeSub.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeSub.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeSub.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeSub.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeSub.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeSub.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeSub.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeSub.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeSub.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeSub.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeSub.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeSub.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeSub.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeSub.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeSub.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeSub.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeSub.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeSub.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeSub.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeSub.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeSub.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeSub.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeSub.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeSub.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeSub.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeSub.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeSub.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeSub.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeSub.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeSub.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeSub.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeSub.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeSub.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeSub.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeSub.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeDiff"> + <input id="TimeDiff-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeDiff</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimeDiff-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeDiff"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeDiff-3113"><a href="#TimeDiff-3113"><span class="linenos">3113</span></a><span class="k">class</span> <span class="nc">TimeDiff</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimeDiff-3114"><a href="#TimeDiff-3114"><span class="linenos">3114</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimeDiff.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeDiff.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeDiff.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeDiff.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeDiff.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeDiff.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeDiff.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeDiff.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeDiff.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeDiff.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeDiff.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeDiff.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeDiff.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeDiff.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeDiff.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeDiff.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeDiff.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeDiff.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeDiff.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeDiff.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeDiff.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeDiff.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeDiff.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeDiff.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeDiff.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeDiff.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeDiff.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeDiff.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeDiff.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeDiff.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeDiff.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeDiff.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeDiff.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeDiff.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeDiff.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeDiff.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeDiff.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeDiff.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeDiff.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeDiff.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeTrunc"> + <input id="TimeTrunc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeTrunc</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TimeTrunc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeTrunc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeTrunc-3117"><a href="#TimeTrunc-3117"><span class="linenos">3117</span></a><span class="k">class</span> <span class="nc">TimeTrunc</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TimeTrunc-3118"><a href="#TimeTrunc-3118"><span class="linenos">3118</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TimeTrunc.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeTrunc.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeTrunc.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeTrunc.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeTrunc.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeTrunc.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeTrunc.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeTrunc.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeTrunc.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeTrunc.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeTrunc.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeTrunc.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeTrunc.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeTrunc.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeTrunc.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeTrunc.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeTrunc.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeTrunc.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeTrunc.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeTrunc.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeTrunc.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeTrunc.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeTrunc.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeTrunc.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeTrunc.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeTrunc.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeTrunc.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeTrunc.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeTrunc.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeTrunc.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeTrunc.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeTrunc.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeTrunc.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeTrunc.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeTrunc.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeTrunc.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeTrunc.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeTrunc.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeTrunc.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeTrunc.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateFromParts"> + <input id="DateFromParts-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateFromParts</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DateFromParts-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateFromParts"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateFromParts-3121"><a href="#DateFromParts-3121"><span class="linenos">3121</span></a><span class="k">class</span> <span class="nc">DateFromParts</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DateFromParts-3122"><a href="#DateFromParts-3122"><span class="linenos">3122</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"DATEFROMPARTS"</span><span class="p">]</span> +</span><span id="DateFromParts-3123"><a href="#DateFromParts-3123"><span class="linenos">3123</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"year"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"month"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"day"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateFromParts.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DateFromParts.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateFromParts.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateFromParts.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateFromParts.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateFromParts.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateFromParts.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateFromParts.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateFromParts.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateFromParts.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateFromParts.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateFromParts.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateFromParts.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateFromParts.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateFromParts.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateFromParts.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateFromParts.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateFromParts.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateFromParts.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateFromParts.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateFromParts.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateFromParts.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateFromParts.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateFromParts.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateFromParts.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateFromParts.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateFromParts.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateFromParts.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateFromParts.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateFromParts.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateFromParts.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateFromParts.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateFromParts.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateFromParts.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateFromParts.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateFromParts.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateFromParts.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateFromParts.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateFromParts.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateFromParts.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateStrToDate"> + <input id="DateStrToDate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateStrToDate</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DateStrToDate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateStrToDate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateStrToDate-3126"><a href="#DateStrToDate-3126"><span class="linenos">3126</span></a><span class="k">class</span> <span class="nc">DateStrToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DateStrToDate-3127"><a href="#DateStrToDate-3127"><span class="linenos">3127</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateStrToDate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DateStrToDate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateStrToDate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateStrToDate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateStrToDate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateStrToDate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateStrToDate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateStrToDate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateStrToDate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateStrToDate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateStrToDate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateStrToDate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateStrToDate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateStrToDate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateStrToDate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateStrToDate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateStrToDate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateStrToDate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateStrToDate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateStrToDate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateStrToDate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateStrToDate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateStrToDate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateStrToDate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateStrToDate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateStrToDate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateStrToDate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateStrToDate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateStrToDate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateStrToDate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateStrToDate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateStrToDate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateStrToDate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateStrToDate.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateStrToDate.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateStrToDate.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateStrToDate.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateStrToDate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateStrToDate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateStrToDate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateToDateStr"> + <input id="DateToDateStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateToDateStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DateToDateStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateToDateStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateToDateStr-3130"><a href="#DateToDateStr-3130"><span class="linenos">3130</span></a><span class="k">class</span> <span class="nc">DateToDateStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DateToDateStr-3131"><a href="#DateToDateStr-3131"><span class="linenos">3131</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateToDateStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DateToDateStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateToDateStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateToDateStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateToDateStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateToDateStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateToDateStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateToDateStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateToDateStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateToDateStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateToDateStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateToDateStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateToDateStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateToDateStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateToDateStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateToDateStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateToDateStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateToDateStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateToDateStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateToDateStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateToDateStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateToDateStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateToDateStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateToDateStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateToDateStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateToDateStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateToDateStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateToDateStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateToDateStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateToDateStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateToDateStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateToDateStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateToDateStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateToDateStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateToDateStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateToDateStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateToDateStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateToDateStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateToDateStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateToDateStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DateToDi"> + <input id="DateToDi-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DateToDi</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DateToDi-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DateToDi"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DateToDi-3134"><a href="#DateToDi-3134"><span class="linenos">3134</span></a><span class="k">class</span> <span class="nc">DateToDi</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DateToDi-3135"><a href="#DateToDi-3135"><span class="linenos">3135</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DateToDi.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DateToDi.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DateToDi.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DateToDi.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DateToDi.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DateToDi.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DateToDi.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DateToDi.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DateToDi.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DateToDi.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DateToDi.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DateToDi.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DateToDi.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DateToDi.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DateToDi.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DateToDi.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DateToDi.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DateToDi.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DateToDi.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DateToDi.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DateToDi.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DateToDi.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DateToDi.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DateToDi.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DateToDi.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DateToDi.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DateToDi.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DateToDi.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DateToDi.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DateToDi.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DateToDi.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DateToDi.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DateToDi.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DateToDi.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DateToDi.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DateToDi.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DateToDi.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DateToDi.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DateToDi.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DateToDi.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Day"> + <input id="Day-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Day</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Day-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Day"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Day-3138"><a href="#Day-3138"><span class="linenos">3138</span></a><span class="k">class</span> <span class="nc">Day</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Day-3139"><a href="#Day-3139"><span class="linenos">3139</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Day.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Day.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Day.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Day.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Day.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Day.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Day.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Day.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Day.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Day.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Day.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Day.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Day.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Day.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Day.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Day.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Day.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Day.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Day.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Day.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Day.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Day.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Day.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Day.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Day.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Day.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Day.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Day.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Day.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Day.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Day.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Day.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Day.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Day.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Day.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Day.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Day.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Day.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Day.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Day.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Decode"> + <input id="Decode-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Decode</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Decode-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Decode"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Decode-3142"><a href="#Decode-3142"><span class="linenos">3142</span></a><span class="k">class</span> <span class="nc">Decode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Decode-3143"><a href="#Decode-3143"><span class="linenos">3143</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"charset"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"replace"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Decode.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Decode.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Decode.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Decode.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Decode.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Decode.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Decode.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Decode.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Decode.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Decode.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Decode.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Decode.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Decode.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Decode.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Decode.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Decode.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Decode.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Decode.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Decode.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Decode.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Decode.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Decode.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Decode.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Decode.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Decode.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Decode.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Decode.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Decode.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Decode.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Decode.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Decode.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Decode.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Decode.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Decode.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Decode.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Decode.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Decode.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Decode.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Decode.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Decode.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="DiToDate"> + <input id="DiToDate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">DiToDate</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="DiToDate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DiToDate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DiToDate-3146"><a href="#DiToDate-3146"><span class="linenos">3146</span></a><span class="k">class</span> <span class="nc">DiToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="DiToDate-3147"><a href="#DiToDate-3147"><span class="linenos">3147</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="DiToDate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="DiToDate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="DiToDate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="DiToDate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="DiToDate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="DiToDate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="DiToDate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="DiToDate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="DiToDate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="DiToDate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="DiToDate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="DiToDate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="DiToDate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="DiToDate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="DiToDate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="DiToDate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="DiToDate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="DiToDate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="DiToDate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="DiToDate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="DiToDate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="DiToDate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="DiToDate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="DiToDate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="DiToDate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="DiToDate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="DiToDate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="DiToDate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="DiToDate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="DiToDate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="DiToDate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="DiToDate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="DiToDate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="DiToDate.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="DiToDate.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="DiToDate.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="DiToDate.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="DiToDate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="DiToDate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="DiToDate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Encode"> + <input id="Encode-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Encode</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Encode-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Encode"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Encode-3150"><a href="#Encode-3150"><span class="linenos">3150</span></a><span class="k">class</span> <span class="nc">Encode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Encode-3151"><a href="#Encode-3151"><span class="linenos">3151</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"charset"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Encode.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Encode.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Encode.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Encode.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Encode.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Encode.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Encode.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Encode.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Encode.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Encode.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Encode.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Encode.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Encode.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Encode.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Encode.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Encode.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Encode.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Encode.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Encode.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Encode.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Encode.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Encode.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Encode.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Encode.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Encode.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Encode.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Encode.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Encode.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Encode.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Encode.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Encode.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Encode.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Encode.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Encode.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Encode.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Encode.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Encode.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Encode.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Encode.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Encode.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Exp"> + <input id="Exp-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Exp</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Exp-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Exp"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Exp-3154"><a href="#Exp-3154"><span class="linenos">3154</span></a><span class="k">class</span> <span class="nc">Exp</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Exp-3155"><a href="#Exp-3155"><span class="linenos">3155</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Exp.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Exp.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Exp.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Exp.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Exp.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Exp.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Exp.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Exp.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Exp.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Exp.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Exp.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Exp.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Exp.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Exp.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Exp.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Exp.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Exp.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Exp.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Exp.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Exp.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Exp.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Exp.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Exp.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Exp.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Exp.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Exp.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Exp.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Exp.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Exp.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Exp.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Exp.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Exp.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Exp.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Exp.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Exp.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Exp.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Exp.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Exp.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Exp.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Exp.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Explode"> + <input id="Explode-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Explode</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Explode-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Explode"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Explode-3158"><a href="#Explode-3158"><span class="linenos">3158</span></a><span class="k">class</span> <span class="nc">Explode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Explode-3159"><a href="#Explode-3159"><span class="linenos">3159</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Explode.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Explode.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Explode.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Explode.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Explode.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Explode.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Explode.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Explode.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Explode.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Explode.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Explode.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Explode.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Explode.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Explode.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Explode.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Explode.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Explode.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Explode.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Explode.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Explode.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Explode.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Explode.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Explode.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Explode.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Explode.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Explode.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Explode.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Explode.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Explode.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Explode.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Explode.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Explode.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Explode.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Explode.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Explode.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Explode.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Explode.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Explode.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Explode.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Explode.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Floor"> + <input id="Floor-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Floor</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Floor-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Floor"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Floor-3162"><a href="#Floor-3162"><span class="linenos">3162</span></a><span class="k">class</span> <span class="nc">Floor</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Floor-3163"><a href="#Floor-3163"><span class="linenos">3163</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"decimals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Floor.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Floor.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Floor.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Floor.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Floor.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Floor.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Floor.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Floor.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Floor.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Floor.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Floor.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Floor.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Floor.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Floor.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Floor.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Floor.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Floor.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Floor.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Floor.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Floor.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Floor.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Floor.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Floor.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Floor.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Floor.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Floor.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Floor.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Floor.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Floor.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Floor.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Floor.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Floor.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Floor.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Floor.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Floor.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Floor.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Floor.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Floor.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Floor.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Floor.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Greatest"> + <input id="Greatest-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Greatest</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Greatest-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Greatest"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Greatest-3166"><a href="#Greatest-3166"><span class="linenos">3166</span></a><span class="k">class</span> <span class="nc">Greatest</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Greatest-3167"><a href="#Greatest-3167"><span class="linenos">3167</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Greatest-3168"><a href="#Greatest-3168"><span class="linenos">3168</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Greatest.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Greatest.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Greatest.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Greatest.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Greatest.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Greatest.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Greatest.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Greatest.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Greatest.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Greatest.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Greatest.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Greatest.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Greatest.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Greatest.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Greatest.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Greatest.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Greatest.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Greatest.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Greatest.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Greatest.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Greatest.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Greatest.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Greatest.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Greatest.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Greatest.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Greatest.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Greatest.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Greatest.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Greatest.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Greatest.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Greatest.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Greatest.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Greatest.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Greatest.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Greatest.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Greatest.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Greatest.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Greatest.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Greatest.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Greatest.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="GroupConcat"> + <input id="GroupConcat-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">GroupConcat</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="GroupConcat-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#GroupConcat"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="GroupConcat-3171"><a href="#GroupConcat-3171"><span class="linenos">3171</span></a><span class="k">class</span> <span class="nc">GroupConcat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="GroupConcat-3172"><a href="#GroupConcat-3172"><span class="linenos">3172</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"separator"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="GroupConcat.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="GroupConcat.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="GroupConcat.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="GroupConcat.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="GroupConcat.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="GroupConcat.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="GroupConcat.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="GroupConcat.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="GroupConcat.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="GroupConcat.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="GroupConcat.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="GroupConcat.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="GroupConcat.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="GroupConcat.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="GroupConcat.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="GroupConcat.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="GroupConcat.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="GroupConcat.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="GroupConcat.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="GroupConcat.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="GroupConcat.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="GroupConcat.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="GroupConcat.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="GroupConcat.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="GroupConcat.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="GroupConcat.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="GroupConcat.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="GroupConcat.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="GroupConcat.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="GroupConcat.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="GroupConcat.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="GroupConcat.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="GroupConcat.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="GroupConcat.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="GroupConcat.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="GroupConcat.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="GroupConcat.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="GroupConcat.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="GroupConcat.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="GroupConcat.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Hex"> + <input id="Hex-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Hex</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Hex-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Hex"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Hex-3175"><a href="#Hex-3175"><span class="linenos">3175</span></a><span class="k">class</span> <span class="nc">Hex</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Hex-3176"><a href="#Hex-3176"><span class="linenos">3176</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Hex.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Hex.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Hex.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Hex.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Hex.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Hex.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Hex.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Hex.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Hex.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Hex.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Hex.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Hex.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Hex.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Hex.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Hex.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Hex.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Hex.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Hex.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Hex.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Hex.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Hex.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Hex.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Hex.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Hex.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Hex.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Hex.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Hex.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Hex.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Hex.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Hex.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Hex.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Hex.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Hex.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Hex.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Hex.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Hex.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Hex.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Hex.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Hex.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Hex.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="If"> + <input id="If-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">If</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="If-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#If"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="If-3179"><a href="#If-3179"><span class="linenos">3179</span></a><span class="k">class</span> <span class="nc">If</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="If-3180"><a href="#If-3180"><span class="linenos">3180</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="If.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="If.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="If.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="If.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="If.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="If.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="If.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="If.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="If.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="If.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="If.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="If.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="If.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="If.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="If.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="If.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="If.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="If.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="If.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="If.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="If.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="If.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="If.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="If.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="If.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="If.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="If.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="If.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="If.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="If.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="If.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="If.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="If.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="If.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="If.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="If.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="If.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="If.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="If.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="If.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="IfNull"> + <input id="IfNull-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">IfNull</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="IfNull-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#IfNull"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="IfNull-3183"><a href="#IfNull-3183"><span class="linenos">3183</span></a><span class="k">class</span> <span class="nc">IfNull</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="IfNull-3184"><a href="#IfNull-3184"><span class="linenos">3184</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="IfNull-3185"><a href="#IfNull-3185"><span class="linenos">3185</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"IFNULL"</span><span class="p">,</span> <span class="s2">"NVL"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="IfNull.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="IfNull.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="IfNull.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="IfNull.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="IfNull.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="IfNull.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="IfNull.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="IfNull.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="IfNull.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="IfNull.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="IfNull.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="IfNull.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="IfNull.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="IfNull.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="IfNull.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="IfNull.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="IfNull.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="IfNull.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="IfNull.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="IfNull.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="IfNull.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="IfNull.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="IfNull.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="IfNull.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="IfNull.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="IfNull.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="IfNull.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="IfNull.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="IfNull.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="IfNull.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="IfNull.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="IfNull.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="IfNull.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="IfNull.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="IfNull.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="IfNull.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="IfNull.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="IfNull.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="IfNull.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="IfNull.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Initcap"> + <input id="Initcap-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Initcap</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Initcap-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Initcap"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Initcap-3188"><a href="#Initcap-3188"><span class="linenos">3188</span></a><span class="k">class</span> <span class="nc">Initcap</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Initcap-3189"><a href="#Initcap-3189"><span class="linenos">3189</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Initcap.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Initcap.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Initcap.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Initcap.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Initcap.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Initcap.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Initcap.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Initcap.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Initcap.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Initcap.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Initcap.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Initcap.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Initcap.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Initcap.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Initcap.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Initcap.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Initcap.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Initcap.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Initcap.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Initcap.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Initcap.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Initcap.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Initcap.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Initcap.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Initcap.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Initcap.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Initcap.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Initcap.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Initcap.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Initcap.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Initcap.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Initcap.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Initcap.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Initcap.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Initcap.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Initcap.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Initcap.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Initcap.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Initcap.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Initcap.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JSONBContains"> + <input id="JSONBContains-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JSONBContains</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>): + + <label class="view-source-button" for="JSONBContains-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JSONBContains"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JSONBContains-3192"><a href="#JSONBContains-3192"><span class="linenos">3192</span></a><span class="k">class</span> <span class="nc">JSONBContains</span><span class="p">(</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="JSONBContains-3193"><a href="#JSONBContains-3193"><span class="linenos">3193</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSONB_CONTAINS"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JSONBContains.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JSONBContains.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JSONBContains.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JSONBContains.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JSONBContains.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JSONBContains.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JSONBContains.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JSONBContains.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JSONBContains.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JSONBContains.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JSONBContains.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JSONBContains.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JSONBContains.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JSONBContains.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JSONBContains.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JSONBContains.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JSONBContains.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JSONBContains.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JSONBContains.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JSONBContains.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JSONBContains.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JSONBContains.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JSONBContains.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JSONBContains.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JSONBContains.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JSONBContains.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JSONBContains.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JSONBContains.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JSONBContains.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JSONBContains.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JSONBContains.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JSONBContains.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JSONBContains.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JSONExtract"> + <input id="JSONExtract-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JSONExtract</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="JSONExtract-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JSONExtract"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JSONExtract-3196"><a href="#JSONExtract-3196"><span class="linenos">3196</span></a><span class="k">class</span> <span class="nc">JSONExtract</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Func</span><span class="p">):</span> +</span><span id="JSONExtract-3197"><a href="#JSONExtract-3197"><span class="linenos">3197</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSON_EXTRACT"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JSONExtract.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JSONExtract.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JSONExtract.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JSONExtract.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JSONExtract.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JSONExtract.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JSONExtract.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JSONExtract.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JSONExtract.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JSONExtract.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JSONExtract.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JSONExtract.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JSONExtract.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JSONExtract.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JSONExtract.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JSONExtract.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JSONExtract.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JSONExtract.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JSONExtract.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JSONExtract.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JSONExtract.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JSONExtract.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JSONExtract.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JSONExtract.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JSONExtract.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JSONExtract.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JSONExtract.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JSONExtract.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JSONExtract.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JSONExtract.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JSONExtract.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JSONExtract.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JSONExtract.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="JSONExtract.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="JSONExtract.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="JSONExtract.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="JSONExtract.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="JSONExtract.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="JSONExtract.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="JSONExtract.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JSONExtractScalar"> + <input id="JSONExtractScalar-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JSONExtractScalar</span><wbr>(<span class="base"><a href="#JSONExtract">JSONExtract</a></span>): + + <label class="view-source-button" for="JSONExtractScalar-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JSONExtractScalar"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JSONExtractScalar-3200"><a href="#JSONExtractScalar-3200"><span class="linenos">3200</span></a><span class="k">class</span> <span class="nc">JSONExtractScalar</span><span class="p">(</span><span class="n">JSONExtract</span><span class="p">):</span> +</span><span id="JSONExtractScalar-3201"><a href="#JSONExtractScalar-3201"><span class="linenos">3201</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSON_EXTRACT_SCALAR"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JSONExtractScalar.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JSONExtractScalar.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JSONExtractScalar.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JSONExtractScalar.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JSONExtractScalar.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JSONExtractScalar.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JSONExtractScalar.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JSONExtractScalar.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JSONExtractScalar.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JSONExtractScalar.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JSONExtractScalar.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JSONExtractScalar.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JSONExtractScalar.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JSONExtractScalar.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JSONExtractScalar.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JSONExtractScalar.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JSONExtractScalar.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JSONExtractScalar.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JSONExtractScalar.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JSONExtractScalar.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JSONExtractScalar.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JSONExtractScalar.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JSONExtractScalar.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JSONExtractScalar.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JSONExtractScalar.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JSONExtractScalar.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JSONExtractScalar.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JSONExtractScalar.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JSONExtractScalar.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JSONExtractScalar.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JSONExtractScalar.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JSONExtractScalar.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JSONExtractScalar.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="JSONExtractScalar.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="JSONExtractScalar.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="JSONExtractScalar.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="JSONExtractScalar.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="JSONExtractScalar.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="JSONExtractScalar.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="JSONExtractScalar.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JSONBExtract"> + <input id="JSONBExtract-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JSONBExtract</span><wbr>(<span class="base"><a href="#JSONExtract">JSONExtract</a></span>): + + <label class="view-source-button" for="JSONBExtract-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JSONBExtract"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JSONBExtract-3204"><a href="#JSONBExtract-3204"><span class="linenos">3204</span></a><span class="k">class</span> <span class="nc">JSONBExtract</span><span class="p">(</span><span class="n">JSONExtract</span><span class="p">):</span> +</span><span id="JSONBExtract-3205"><a href="#JSONBExtract-3205"><span class="linenos">3205</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSONB_EXTRACT"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JSONBExtract.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JSONBExtract.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JSONBExtract.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JSONBExtract.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JSONBExtract.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JSONBExtract.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JSONBExtract.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JSONBExtract.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JSONBExtract.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JSONBExtract.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JSONBExtract.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JSONBExtract.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JSONBExtract.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JSONBExtract.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JSONBExtract.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JSONBExtract.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JSONBExtract.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JSONBExtract.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JSONBExtract.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JSONBExtract.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JSONBExtract.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JSONBExtract.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JSONBExtract.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JSONBExtract.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JSONBExtract.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JSONBExtract.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JSONBExtract.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JSONBExtract.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JSONBExtract.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JSONBExtract.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JSONBExtract.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JSONBExtract.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JSONBExtract.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="JSONBExtract.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="JSONBExtract.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="JSONBExtract.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="JSONBExtract.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="JSONBExtract.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="JSONBExtract.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="JSONBExtract.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="JSONBExtractScalar"> + <input id="JSONBExtractScalar-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">JSONBExtractScalar</span><wbr>(<span class="base"><a href="#JSONExtract">JSONExtract</a></span>): + + <label class="view-source-button" for="JSONBExtractScalar-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#JSONBExtractScalar"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="JSONBExtractScalar-3208"><a href="#JSONBExtractScalar-3208"><span class="linenos">3208</span></a><span class="k">class</span> <span class="nc">JSONBExtractScalar</span><span class="p">(</span><span class="n">JSONExtract</span><span class="p">):</span> +</span><span id="JSONBExtractScalar-3209"><a href="#JSONBExtractScalar-3209"><span class="linenos">3209</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"JSONB_EXTRACT_SCALAR"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="JSONBExtractScalar.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="JSONBExtractScalar.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="JSONBExtractScalar.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="JSONBExtractScalar.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="JSONBExtractScalar.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="JSONBExtractScalar.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="JSONBExtractScalar.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="JSONBExtractScalar.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="JSONBExtractScalar.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="JSONBExtractScalar.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="JSONBExtractScalar.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="JSONBExtractScalar.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="JSONBExtractScalar.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="JSONBExtractScalar.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="JSONBExtractScalar.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="JSONBExtractScalar.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="JSONBExtractScalar.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="JSONBExtractScalar.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="JSONBExtractScalar.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="JSONBExtractScalar.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="JSONBExtractScalar.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="JSONBExtractScalar.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="JSONBExtractScalar.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="JSONBExtractScalar.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="JSONBExtractScalar.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="JSONBExtractScalar.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="JSONBExtractScalar.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="JSONBExtractScalar.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="JSONBExtractScalar.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="JSONBExtractScalar.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="JSONBExtractScalar.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="JSONBExtractScalar.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="JSONBExtractScalar.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="JSONBExtractScalar.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="JSONBExtractScalar.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="JSONBExtractScalar.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="JSONBExtractScalar.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="JSONBExtractScalar.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="JSONBExtractScalar.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="JSONBExtractScalar.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Least"> + <input id="Least-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Least</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Least-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Least"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Least-3212"><a href="#Least-3212"><span class="linenos">3212</span></a><span class="k">class</span> <span class="nc">Least</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Least-3213"><a href="#Least-3213"><span class="linenos">3213</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="Least-3214"><a href="#Least-3214"><span class="linenos">3214</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Least.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Least.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Least.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Least.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Least.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Least.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Least.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Least.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Least.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Least.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Least.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Least.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Least.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Least.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Least.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Least.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Least.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Least.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Least.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Least.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Least.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Least.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Least.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Least.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Least.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Least.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Least.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Least.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Least.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Least.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Least.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Least.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Least.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Least.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Least.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Least.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Least.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Least.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Least.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Least.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Length"> + <input id="Length-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Length</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Length-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Length"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Length-3217"><a href="#Length-3217"><span class="linenos">3217</span></a><span class="k">class</span> <span class="nc">Length</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Length-3218"><a href="#Length-3218"><span class="linenos">3218</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Length.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Length.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Length.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Length.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Length.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Length.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Length.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Length.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Length.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Length.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Length.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Length.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Length.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Length.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Length.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Length.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Length.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Length.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Length.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Length.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Length.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Length.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Length.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Length.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Length.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Length.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Length.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Length.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Length.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Length.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Length.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Length.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Length.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Length.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Length.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Length.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Length.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Length.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Length.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Length.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Levenshtein"> + <input id="Levenshtein-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Levenshtein</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Levenshtein-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Levenshtein"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Levenshtein-3221"><a href="#Levenshtein-3221"><span class="linenos">3221</span></a><span class="k">class</span> <span class="nc">Levenshtein</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Levenshtein-3222"><a href="#Levenshtein-3222"><span class="linenos">3222</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Levenshtein-3223"><a href="#Levenshtein-3223"><span class="linenos">3223</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Levenshtein-3224"><a href="#Levenshtein-3224"><span class="linenos">3224</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Levenshtein-3225"><a href="#Levenshtein-3225"><span class="linenos">3225</span></a> <span class="s2">"ins_cost"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Levenshtein-3226"><a href="#Levenshtein-3226"><span class="linenos">3226</span></a> <span class="s2">"del_cost"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Levenshtein-3227"><a href="#Levenshtein-3227"><span class="linenos">3227</span></a> <span class="s2">"sub_cost"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Levenshtein-3228"><a href="#Levenshtein-3228"><span class="linenos">3228</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Levenshtein.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Levenshtein.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Levenshtein.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Levenshtein.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Levenshtein.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Levenshtein.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Levenshtein.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Levenshtein.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Levenshtein.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Levenshtein.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Levenshtein.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Levenshtein.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Levenshtein.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Levenshtein.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Levenshtein.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Levenshtein.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Levenshtein.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Levenshtein.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Levenshtein.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Levenshtein.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Levenshtein.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Levenshtein.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Levenshtein.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Levenshtein.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Levenshtein.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Levenshtein.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Levenshtein.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Levenshtein.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Levenshtein.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Levenshtein.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Levenshtein.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Levenshtein.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Levenshtein.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Levenshtein.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Levenshtein.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Levenshtein.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Levenshtein.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Levenshtein.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Levenshtein.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Levenshtein.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Ln"> + <input id="Ln-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Ln</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Ln-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Ln"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Ln-3231"><a href="#Ln-3231"><span class="linenos">3231</span></a><span class="k">class</span> <span class="nc">Ln</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Ln-3232"><a href="#Ln-3232"><span class="linenos">3232</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Ln.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Ln.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Ln.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Ln.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Ln.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Ln.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Ln.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Ln.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Ln.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Ln.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Ln.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Ln.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Ln.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Ln.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Ln.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Ln.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Ln.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Ln.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Ln.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Ln.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Ln.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Ln.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Ln.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Ln.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Ln.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Ln.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Ln.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Ln.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Ln.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Ln.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Ln.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Ln.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Ln.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Ln.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Ln.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Ln.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Ln.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Ln.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Ln.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Ln.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Log"> + <input id="Log-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Log</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Log-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Log"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Log-3235"><a href="#Log-3235"><span class="linenos">3235</span></a><span class="k">class</span> <span class="nc">Log</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Log-3236"><a href="#Log-3236"><span class="linenos">3236</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Log.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Log.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Log.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Log.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Log.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Log.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Log.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Log.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Log.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Log.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Log.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Log.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Log.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Log.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Log.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Log.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Log.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Log.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Log.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Log.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Log.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Log.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Log.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Log.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Log.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Log.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Log.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Log.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Log.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Log.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Log.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Log.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Log.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Log.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Log.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Log.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Log.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Log.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Log.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Log.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Log2"> + <input id="Log2-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Log2</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Log2-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Log2"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Log2-3239"><a href="#Log2-3239"><span class="linenos">3239</span></a><span class="k">class</span> <span class="nc">Log2</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Log2-3240"><a href="#Log2-3240"><span class="linenos">3240</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Log2.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Log2.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Log2.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Log2.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Log2.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Log2.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Log2.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Log2.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Log2.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Log2.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Log2.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Log2.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Log2.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Log2.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Log2.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Log2.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Log2.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Log2.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Log2.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Log2.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Log2.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Log2.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Log2.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Log2.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Log2.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Log2.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Log2.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Log2.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Log2.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Log2.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Log2.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Log2.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Log2.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Log2.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Log2.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Log2.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Log2.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Log2.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Log2.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Log2.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Log10"> + <input id="Log10-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Log10</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Log10-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Log10"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Log10-3243"><a href="#Log10-3243"><span class="linenos">3243</span></a><span class="k">class</span> <span class="nc">Log10</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Log10-3244"><a href="#Log10-3244"><span class="linenos">3244</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Log10.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Log10.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Log10.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Log10.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Log10.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Log10.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Log10.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Log10.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Log10.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Log10.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Log10.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Log10.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Log10.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Log10.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Log10.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Log10.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Log10.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Log10.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Log10.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Log10.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Log10.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Log10.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Log10.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Log10.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Log10.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Log10.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Log10.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Log10.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Log10.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Log10.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Log10.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Log10.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Log10.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Log10.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Log10.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Log10.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Log10.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Log10.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Log10.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Log10.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="LogicalOr"> + <input id="LogicalOr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LogicalOr</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="LogicalOr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LogicalOr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LogicalOr-3247"><a href="#LogicalOr-3247"><span class="linenos">3247</span></a><span class="k">class</span> <span class="nc">LogicalOr</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="LogicalOr-3248"><a href="#LogicalOr-3248"><span class="linenos">3248</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"LOGICAL_OR"</span><span class="p">,</span> <span class="s2">"BOOL_OR"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="LogicalOr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="LogicalOr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="LogicalOr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="LogicalOr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="LogicalOr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="LogicalOr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="LogicalOr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="LogicalOr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="LogicalOr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="LogicalOr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="LogicalOr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="LogicalOr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="LogicalOr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="LogicalOr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="LogicalOr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="LogicalOr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="LogicalOr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="LogicalOr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="LogicalOr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="LogicalOr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="LogicalOr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="LogicalOr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="LogicalOr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="LogicalOr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="LogicalOr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="LogicalOr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="LogicalOr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="LogicalOr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="LogicalOr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="LogicalOr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="LogicalOr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="LogicalOr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="LogicalOr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="LogicalOr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="LogicalOr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="LogicalOr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="LogicalOr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="LogicalOr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="LogicalOr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="LogicalOr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Lower"> + <input id="Lower-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Lower</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Lower-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Lower"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Lower-3251"><a href="#Lower-3251"><span class="linenos">3251</span></a><span class="k">class</span> <span class="nc">Lower</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Lower-3252"><a href="#Lower-3252"><span class="linenos">3252</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"LOWER"</span><span class="p">,</span> <span class="s2">"LCASE"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Lower.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Lower.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Lower.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Lower.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Lower.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Lower.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Lower.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Lower.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Lower.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Lower.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Lower.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Lower.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Lower.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Lower.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Lower.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Lower.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Lower.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Lower.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Lower.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Lower.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Lower.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Lower.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Lower.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Lower.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Lower.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Lower.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Lower.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Lower.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Lower.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Lower.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Lower.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Lower.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Lower.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Lower.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Lower.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Lower.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Lower.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Lower.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Lower.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Lower.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Map"> + <input id="Map-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Map</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Map-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Map"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Map-3255"><a href="#Map-3255"><span class="linenos">3255</span></a><span class="k">class</span> <span class="nc">Map</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Map-3256"><a href="#Map-3256"><span class="linenos">3256</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"keys"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"values"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Map.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Map.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Map.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Map.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Map.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Map.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Map.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Map.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Map.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Map.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Map.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Map.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Map.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Map.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Map.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Map.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Map.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Map.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Map.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Map.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Map.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Map.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Map.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Map.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Map.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Map.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Map.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Map.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Map.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Map.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Map.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Map.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Map.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Map.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Map.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Map.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Map.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Map.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Map.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Map.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="VarMap"> + <input id="VarMap-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">VarMap</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="VarMap-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#VarMap"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="VarMap-3259"><a href="#VarMap-3259"><span class="linenos">3259</span></a><span class="k">class</span> <span class="nc">VarMap</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="VarMap-3260"><a href="#VarMap-3260"><span class="linenos">3260</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"keys"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"values"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="VarMap-3261"><a href="#VarMap-3261"><span class="linenos">3261</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="VarMap.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="VarMap.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="VarMap.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="VarMap.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="VarMap.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="VarMap.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="VarMap.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="VarMap.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="VarMap.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="VarMap.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="VarMap.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="VarMap.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="VarMap.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="VarMap.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="VarMap.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="VarMap.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="VarMap.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="VarMap.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="VarMap.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="VarMap.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="VarMap.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="VarMap.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="VarMap.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="VarMap.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="VarMap.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="VarMap.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="VarMap.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="VarMap.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="VarMap.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="VarMap.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="VarMap.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="VarMap.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="VarMap.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="VarMap.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="VarMap.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="VarMap.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="VarMap.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="VarMap.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="VarMap.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="VarMap.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Matches"> + <input id="Matches-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Matches</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Matches-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Matches"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Matches-3264"><a href="#Matches-3264"><span class="linenos">3264</span></a><span class="k">class</span> <span class="nc">Matches</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Matches-3265"><a href="#Matches-3265"><span class="linenos">3265</span></a><span class="w"> </span><span class="sd">"""Oracle/Snowflake decode.</span> +</span><span id="Matches-3266"><a href="#Matches-3266"><span class="linenos">3266</span></a><span class="sd"> https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm</span> +</span><span id="Matches-3267"><a href="#Matches-3267"><span class="linenos">3267</span></a><span class="sd"> Pattern matching MATCHES(value, search1, result1, ...searchN, resultN, else)</span> +</span><span id="Matches-3268"><a href="#Matches-3268"><span class="linenos">3268</span></a><span class="sd"> """</span> +</span><span id="Matches-3269"><a href="#Matches-3269"><span class="linenos">3269</span></a> +</span><span id="Matches-3270"><a href="#Matches-3270"><span class="linenos">3270</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Matches-3271"><a href="#Matches-3271"><span class="linenos">3271</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + <div class="docstring"><p>Oracle/Snowflake decode. +<a href="https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm">https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm</a> +Pattern matching MATCHES(value, search1, result1, ...searchN, resultN, else)</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Matches.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Matches.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Matches.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Matches.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Matches.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Matches.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Matches.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Matches.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Matches.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Matches.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Matches.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Matches.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Matches.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Matches.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Matches.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Matches.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Matches.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Matches.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Matches.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Matches.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Matches.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Matches.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Matches.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Matches.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Matches.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Matches.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Matches.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Matches.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Matches.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Matches.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Matches.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Matches.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Matches.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Matches.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Matches.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Matches.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Matches.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Matches.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Matches.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Matches.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Max"> + <input id="Max-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Max</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Max-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Max"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Max-3274"><a href="#Max-3274"><span class="linenos">3274</span></a><span class="k">class</span> <span class="nc">Max</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Max-3275"><a href="#Max-3275"><span class="linenos">3275</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Max.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Max.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Max.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Max.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Max.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Max.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Max.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Max.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Max.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Max.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Max.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Max.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Max.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Max.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Max.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Max.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Max.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Max.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Max.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Max.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Max.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Max.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Max.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Max.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Max.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Max.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Max.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Max.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Max.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Max.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Max.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Max.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Max.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Max.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Max.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Max.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Max.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Max.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Max.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Max.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Min"> + <input id="Min-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Min</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Min-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Min"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Min-3278"><a href="#Min-3278"><span class="linenos">3278</span></a><span class="k">class</span> <span class="nc">Min</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Min-3279"><a href="#Min-3279"><span class="linenos">3279</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Min.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Min.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Min.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Min.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Min.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Min.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Min.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Min.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Min.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Min.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Min.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Min.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Min.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Min.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Min.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Min.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Min.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Min.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Min.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Min.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Min.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Min.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Min.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Min.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Min.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Min.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Min.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Min.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Min.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Min.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Min.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Min.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Min.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Min.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Min.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Min.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Min.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Min.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Min.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Min.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Month"> + <input id="Month-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Month</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Month-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Month"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Month-3282"><a href="#Month-3282"><span class="linenos">3282</span></a><span class="k">class</span> <span class="nc">Month</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Month-3283"><a href="#Month-3283"><span class="linenos">3283</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Month.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Month.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Month.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Month.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Month.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Month.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Month.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Month.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Month.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Month.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Month.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Month.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Month.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Month.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Month.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Month.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Month.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Month.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Month.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Month.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Month.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Month.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Month.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Month.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Month.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Month.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Month.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Month.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Month.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Month.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Month.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Month.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Month.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Month.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Month.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Month.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Month.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Month.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Month.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Month.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Nvl2"> + <input id="Nvl2-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Nvl2</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Nvl2-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Nvl2"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Nvl2-3286"><a href="#Nvl2-3286"><span class="linenos">3286</span></a><span class="k">class</span> <span class="nc">Nvl2</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Nvl2-3287"><a href="#Nvl2-3287"><span class="linenos">3287</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Nvl2.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Nvl2.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Nvl2.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Nvl2.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Nvl2.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Nvl2.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Nvl2.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Nvl2.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Nvl2.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Nvl2.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Nvl2.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Nvl2.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Nvl2.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Nvl2.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Nvl2.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Nvl2.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Nvl2.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Nvl2.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Nvl2.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Nvl2.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Nvl2.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Nvl2.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Nvl2.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Nvl2.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Nvl2.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Nvl2.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Nvl2.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Nvl2.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Nvl2.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Nvl2.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Nvl2.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Nvl2.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Nvl2.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Nvl2.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Nvl2.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Nvl2.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Nvl2.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Nvl2.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Nvl2.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Nvl2.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Posexplode"> + <input id="Posexplode-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Posexplode</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Posexplode-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Posexplode"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Posexplode-3290"><a href="#Posexplode-3290"><span class="linenos">3290</span></a><span class="k">class</span> <span class="nc">Posexplode</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Posexplode-3291"><a href="#Posexplode-3291"><span class="linenos">3291</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Posexplode.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Posexplode.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Posexplode.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Posexplode.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Posexplode.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Posexplode.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Posexplode.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Posexplode.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Posexplode.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Posexplode.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Posexplode.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Posexplode.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Posexplode.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Posexplode.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Posexplode.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Posexplode.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Posexplode.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Posexplode.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Posexplode.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Posexplode.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Posexplode.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Posexplode.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Posexplode.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Posexplode.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Posexplode.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Posexplode.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Posexplode.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Posexplode.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Posexplode.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Posexplode.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Posexplode.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Posexplode.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Posexplode.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Posexplode.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Posexplode.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Posexplode.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Posexplode.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Posexplode.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Posexplode.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Posexplode.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Pow"> + <input id="Pow-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Pow</span><wbr>(<span class="base"><a href="#Binary">Binary</a></span>, <span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Pow-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Pow"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Pow-3294"><a href="#Pow-3294"><span class="linenos">3294</span></a><span class="k">class</span> <span class="nc">Pow</span><span class="p">(</span><span class="n">Binary</span><span class="p">,</span> <span class="n">Func</span><span class="p">):</span> +</span><span id="Pow-3295"><a href="#Pow-3295"><span class="linenos">3295</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"POWER"</span><span class="p">,</span> <span class="s2">"POW"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Pow.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Pow.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Pow.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Pow.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Pow.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Pow.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Pow.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Pow.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Pow.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Pow.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Pow.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Pow.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Pow.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Pow.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Pow.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Pow.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Pow.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Pow.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Pow.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Pow.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Pow.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Pow.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Pow.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Pow.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Pow.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Pow.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Pow.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Pow.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Pow.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Pow.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Pow.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Pow.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Pow.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Pow.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Pow.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Pow.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Pow.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Pow.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Pow.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Pow.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="PercentileCont"> + <input id="PercentileCont-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PercentileCont</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="PercentileCont-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PercentileCont"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PercentileCont-3298"><a href="#PercentileCont-3298"><span class="linenos">3298</span></a><span class="k">class</span> <span class="nc">PercentileCont</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="PercentileCont-3299"><a href="#PercentileCont-3299"><span class="linenos">3299</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="PercentileCont.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="PercentileCont.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="PercentileCont.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="PercentileCont.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="PercentileCont.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="PercentileCont.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="PercentileCont.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="PercentileCont.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="PercentileCont.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="PercentileCont.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="PercentileCont.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="PercentileCont.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="PercentileCont.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="PercentileCont.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="PercentileCont.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="PercentileCont.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="PercentileCont.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="PercentileCont.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="PercentileCont.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="PercentileCont.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="PercentileCont.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="PercentileCont.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="PercentileCont.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="PercentileCont.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="PercentileCont.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="PercentileCont.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="PercentileCont.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="PercentileCont.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="PercentileCont.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="PercentileCont.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="PercentileCont.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="PercentileCont.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="PercentileCont.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="PercentileCont.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="PercentileCont.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="PercentileCont.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="PercentileCont.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="PercentileCont.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="PercentileCont.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="PercentileCont.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="PercentileDisc"> + <input id="PercentileDisc-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">PercentileDisc</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="PercentileDisc-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#PercentileDisc"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="PercentileDisc-3302"><a href="#PercentileDisc-3302"><span class="linenos">3302</span></a><span class="k">class</span> <span class="nc">PercentileDisc</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="PercentileDisc-3303"><a href="#PercentileDisc-3303"><span class="linenos">3303</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="PercentileDisc.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="PercentileDisc.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="PercentileDisc.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="PercentileDisc.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="PercentileDisc.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="PercentileDisc.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="PercentileDisc.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="PercentileDisc.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="PercentileDisc.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="PercentileDisc.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="PercentileDisc.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="PercentileDisc.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="PercentileDisc.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="PercentileDisc.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="PercentileDisc.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="PercentileDisc.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="PercentileDisc.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="PercentileDisc.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="PercentileDisc.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="PercentileDisc.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="PercentileDisc.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="PercentileDisc.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="PercentileDisc.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="PercentileDisc.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="PercentileDisc.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="PercentileDisc.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="PercentileDisc.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="PercentileDisc.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="PercentileDisc.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="PercentileDisc.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="PercentileDisc.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="PercentileDisc.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="PercentileDisc.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="PercentileDisc.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="PercentileDisc.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="PercentileDisc.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="PercentileDisc.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="PercentileDisc.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="PercentileDisc.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="PercentileDisc.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Quantile"> + <input id="Quantile-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Quantile</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Quantile-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Quantile"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Quantile-3306"><a href="#Quantile-3306"><span class="linenos">3306</span></a><span class="k">class</span> <span class="nc">Quantile</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Quantile-3307"><a href="#Quantile-3307"><span class="linenos">3307</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"quantile"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Quantile.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Quantile.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Quantile.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Quantile.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Quantile.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Quantile.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Quantile.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Quantile.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Quantile.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Quantile.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Quantile.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Quantile.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Quantile.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Quantile.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Quantile.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Quantile.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Quantile.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Quantile.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Quantile.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Quantile.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Quantile.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Quantile.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Quantile.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Quantile.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Quantile.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Quantile.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Quantile.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Quantile.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Quantile.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Quantile.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Quantile.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Quantile.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Quantile.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Quantile.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Quantile.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Quantile.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Quantile.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Quantile.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Quantile.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Quantile.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Quantiles"> + <input id="Quantiles-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Quantiles</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Quantiles-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Quantiles"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Quantiles-3312"><a href="#Quantiles-3312"><span class="linenos">3312</span></a><span class="k">class</span> <span class="nc">Quantiles</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Quantiles-3313"><a href="#Quantiles-3313"><span class="linenos">3313</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"parameters"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Quantiles.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Quantiles.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Quantiles.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Quantiles.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Quantiles.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Quantiles.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Quantiles.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Quantiles.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Quantiles.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Quantiles.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Quantiles.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Quantiles.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Quantiles.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Quantiles.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Quantiles.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Quantiles.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Quantiles.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Quantiles.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Quantiles.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Quantiles.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Quantiles.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Quantiles.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Quantiles.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Quantiles.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Quantiles.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Quantiles.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Quantiles.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Quantiles.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Quantiles.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Quantiles.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Quantiles.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Quantiles.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Quantiles.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Quantiles.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Quantiles.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Quantiles.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Quantiles.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Quantiles.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Quantiles.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Quantiles.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="QuantileIf"> + <input id="QuantileIf-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">QuantileIf</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="QuantileIf-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#QuantileIf"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="QuantileIf-3316"><a href="#QuantileIf-3316"><span class="linenos">3316</span></a><span class="k">class</span> <span class="nc">QuantileIf</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="QuantileIf-3317"><a href="#QuantileIf-3317"><span class="linenos">3317</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"parameters"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="QuantileIf.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="QuantileIf.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="QuantileIf.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="QuantileIf.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="QuantileIf.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="QuantileIf.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="QuantileIf.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="QuantileIf.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="QuantileIf.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="QuantileIf.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="QuantileIf.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="QuantileIf.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="QuantileIf.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="QuantileIf.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="QuantileIf.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="QuantileIf.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="QuantileIf.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="QuantileIf.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="QuantileIf.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="QuantileIf.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="QuantileIf.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="QuantileIf.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="QuantileIf.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="QuantileIf.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="QuantileIf.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="QuantileIf.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="QuantileIf.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="QuantileIf.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="QuantileIf.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="QuantileIf.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="QuantileIf.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="QuantileIf.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="QuantileIf.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="QuantileIf.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="QuantileIf.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="QuantileIf.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="QuantileIf.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="QuantileIf.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="QuantileIf.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="QuantileIf.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ApproxQuantile"> + <input id="ApproxQuantile-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ApproxQuantile</span><wbr>(<span class="base"><a href="#Quantile">Quantile</a></span>): + + <label class="view-source-button" for="ApproxQuantile-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ApproxQuantile"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ApproxQuantile-3320"><a href="#ApproxQuantile-3320"><span class="linenos">3320</span></a><span class="k">class</span> <span class="nc">ApproxQuantile</span><span class="p">(</span><span class="n">Quantile</span><span class="p">):</span> +</span><span id="ApproxQuantile-3321"><a href="#ApproxQuantile-3321"><span class="linenos">3321</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"quantile"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"accuracy"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"weight"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ApproxQuantile.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ApproxQuantile.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ApproxQuantile.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ApproxQuantile.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ApproxQuantile.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ApproxQuantile.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ApproxQuantile.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ApproxQuantile.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ApproxQuantile.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ApproxQuantile.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ApproxQuantile.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ApproxQuantile.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ApproxQuantile.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ApproxQuantile.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ApproxQuantile.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ApproxQuantile.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ApproxQuantile.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ApproxQuantile.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ApproxQuantile.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ApproxQuantile.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ApproxQuantile.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ApproxQuantile.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ApproxQuantile.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ApproxQuantile.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ApproxQuantile.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ApproxQuantile.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ApproxQuantile.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ApproxQuantile.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ApproxQuantile.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ApproxQuantile.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ApproxQuantile.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ApproxQuantile.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ApproxQuantile.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ApproxQuantile.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ApproxQuantile.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ApproxQuantile.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ApproxQuantile.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ApproxQuantile.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ApproxQuantile.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ApproxQuantile.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ReadCSV"> + <input id="ReadCSV-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ReadCSV</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="ReadCSV-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ReadCSV"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ReadCSV-3324"><a href="#ReadCSV-3324"><span class="linenos">3324</span></a><span class="k">class</span> <span class="nc">ReadCSV</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="ReadCSV-3325"><a href="#ReadCSV-3325"><span class="linenos">3325</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"READ_CSV"</span><span class="p">]</span> +</span><span id="ReadCSV-3326"><a href="#ReadCSV-3326"><span class="linenos">3326</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="ReadCSV-3327"><a href="#ReadCSV-3327"><span class="linenos">3327</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="ReadCSV.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="ReadCSV.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="ReadCSV.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="ReadCSV.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="ReadCSV.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="ReadCSV.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="ReadCSV.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="ReadCSV.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="ReadCSV.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="ReadCSV.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="ReadCSV.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="ReadCSV.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="ReadCSV.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="ReadCSV.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="ReadCSV.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="ReadCSV.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="ReadCSV.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="ReadCSV.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="ReadCSV.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="ReadCSV.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="ReadCSV.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="ReadCSV.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="ReadCSV.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="ReadCSV.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="ReadCSV.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="ReadCSV.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="ReadCSV.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="ReadCSV.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="ReadCSV.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="ReadCSV.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="ReadCSV.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="ReadCSV.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="ReadCSV.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="ReadCSV.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="ReadCSV.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="ReadCSV.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="ReadCSV.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="ReadCSV.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="ReadCSV.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="ReadCSV.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Reduce"> + <input id="Reduce-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Reduce</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Reduce-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Reduce"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Reduce-3330"><a href="#Reduce-3330"><span class="linenos">3330</span></a><span class="k">class</span> <span class="nc">Reduce</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Reduce-3331"><a href="#Reduce-3331"><span class="linenos">3331</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"initial"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"merge"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"finish"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Reduce.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Reduce.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Reduce.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Reduce.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Reduce.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Reduce.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Reduce.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Reduce.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Reduce.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Reduce.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Reduce.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Reduce.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Reduce.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Reduce.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Reduce.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Reduce.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Reduce.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Reduce.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Reduce.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Reduce.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Reduce.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Reduce.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Reduce.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Reduce.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Reduce.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Reduce.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Reduce.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Reduce.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Reduce.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Reduce.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Reduce.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Reduce.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Reduce.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Reduce.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Reduce.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Reduce.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Reduce.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Reduce.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Reduce.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Reduce.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RegexpLike"> + <input id="RegexpLike-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RegexpLike</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="RegexpLike-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RegexpLike"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RegexpLike-3334"><a href="#RegexpLike-3334"><span class="linenos">3334</span></a><span class="k">class</span> <span class="nc">RegexpLike</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="RegexpLike-3335"><a href="#RegexpLike-3335"><span class="linenos">3335</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"flag"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RegexpLike.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RegexpLike.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RegexpLike.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RegexpLike.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RegexpLike.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RegexpLike.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RegexpLike.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RegexpLike.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RegexpLike.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RegexpLike.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RegexpLike.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RegexpLike.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RegexpLike.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RegexpLike.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RegexpLike.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RegexpLike.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RegexpLike.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RegexpLike.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RegexpLike.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RegexpLike.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RegexpLike.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RegexpLike.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RegexpLike.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RegexpLike.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RegexpLike.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RegexpLike.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RegexpLike.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RegexpLike.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RegexpLike.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RegexpLike.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RegexpLike.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RegexpLike.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RegexpLike.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="RegexpLike.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="RegexpLike.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="RegexpLike.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="RegexpLike.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="RegexpLike.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="RegexpLike.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="RegexpLike.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RegexpILike"> + <input id="RegexpILike-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RegexpILike</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="RegexpILike-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RegexpILike"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RegexpILike-3338"><a href="#RegexpILike-3338"><span class="linenos">3338</span></a><span class="k">class</span> <span class="nc">RegexpILike</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="RegexpILike-3339"><a href="#RegexpILike-3339"><span class="linenos">3339</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"flag"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RegexpILike.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RegexpILike.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RegexpILike.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RegexpILike.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RegexpILike.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RegexpILike.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RegexpILike.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RegexpILike.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RegexpILike.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RegexpILike.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RegexpILike.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RegexpILike.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RegexpILike.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RegexpILike.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RegexpILike.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RegexpILike.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RegexpILike.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RegexpILike.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RegexpILike.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RegexpILike.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RegexpILike.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RegexpILike.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RegexpILike.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RegexpILike.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RegexpILike.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RegexpILike.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RegexpILike.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RegexpILike.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RegexpILike.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RegexpILike.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RegexpILike.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RegexpILike.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RegexpILike.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="RegexpILike.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="RegexpILike.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="RegexpILike.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="RegexpILike.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="RegexpILike.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="RegexpILike.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="RegexpILike.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RegexpSplit"> + <input id="RegexpSplit-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RegexpSplit</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="RegexpSplit-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RegexpSplit"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RegexpSplit-3342"><a href="#RegexpSplit-3342"><span class="linenos">3342</span></a><span class="k">class</span> <span class="nc">RegexpSplit</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="RegexpSplit-3343"><a href="#RegexpSplit-3343"><span class="linenos">3343</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RegexpSplit.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RegexpSplit.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RegexpSplit.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RegexpSplit.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RegexpSplit.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RegexpSplit.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RegexpSplit.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RegexpSplit.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RegexpSplit.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RegexpSplit.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RegexpSplit.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RegexpSplit.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RegexpSplit.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RegexpSplit.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RegexpSplit.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RegexpSplit.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RegexpSplit.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RegexpSplit.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RegexpSplit.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RegexpSplit.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RegexpSplit.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RegexpSplit.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RegexpSplit.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RegexpSplit.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RegexpSplit.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RegexpSplit.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RegexpSplit.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RegexpSplit.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RegexpSplit.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RegexpSplit.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RegexpSplit.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RegexpSplit.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RegexpSplit.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="RegexpSplit.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="RegexpSplit.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="RegexpSplit.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="RegexpSplit.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="RegexpSplit.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="RegexpSplit.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="RegexpSplit.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Repeat"> + <input id="Repeat-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Repeat</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Repeat-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Repeat"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Repeat-3346"><a href="#Repeat-3346"><span class="linenos">3346</span></a><span class="k">class</span> <span class="nc">Repeat</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Repeat-3347"><a href="#Repeat-3347"><span class="linenos">3347</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"times"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Repeat.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Repeat.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Repeat.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Repeat.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Repeat.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Repeat.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Repeat.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Repeat.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Repeat.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Repeat.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Repeat.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Repeat.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Repeat.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Repeat.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Repeat.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Repeat.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Repeat.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Repeat.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Repeat.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Repeat.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Repeat.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Repeat.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Repeat.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Repeat.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Repeat.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Repeat.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Repeat.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Repeat.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Repeat.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Repeat.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Repeat.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Repeat.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Repeat.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Repeat.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Repeat.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Repeat.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Repeat.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Repeat.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Repeat.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Repeat.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Round"> + <input id="Round-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Round</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Round-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Round"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Round-3350"><a href="#Round-3350"><span class="linenos">3350</span></a><span class="k">class</span> <span class="nc">Round</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Round-3351"><a href="#Round-3351"><span class="linenos">3351</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"decimals"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Round.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Round.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Round.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Round.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Round.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Round.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Round.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Round.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Round.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Round.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Round.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Round.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Round.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Round.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Round.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Round.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Round.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Round.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Round.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Round.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Round.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Round.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Round.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Round.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Round.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Round.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Round.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Round.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Round.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Round.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Round.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Round.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Round.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Round.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Round.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Round.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Round.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Round.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Round.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Round.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="RowNumber"> + <input id="RowNumber-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">RowNumber</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="RowNumber-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#RowNumber"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="RowNumber-3354"><a href="#RowNumber-3354"><span class="linenos">3354</span></a><span class="k">class</span> <span class="nc">RowNumber</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="RowNumber-3355"><a href="#RowNumber-3355"><span class="linenos">3355</span></a> <span class="n">arg_types</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="RowNumber.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="RowNumber.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="RowNumber.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="RowNumber.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="RowNumber.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="RowNumber.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="RowNumber.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="RowNumber.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="RowNumber.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="RowNumber.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="RowNumber.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="RowNumber.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="RowNumber.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="RowNumber.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="RowNumber.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="RowNumber.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="RowNumber.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="RowNumber.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="RowNumber.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="RowNumber.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="RowNumber.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="RowNumber.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="RowNumber.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="RowNumber.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="RowNumber.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="RowNumber.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="RowNumber.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="RowNumber.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="RowNumber.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="RowNumber.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="RowNumber.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="RowNumber.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="RowNumber.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="RowNumber.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="RowNumber.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="RowNumber.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="RowNumber.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="RowNumber.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="RowNumber.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="RowNumber.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SafeDivide"> + <input id="SafeDivide-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SafeDivide</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="SafeDivide-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SafeDivide"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SafeDivide-3358"><a href="#SafeDivide-3358"><span class="linenos">3358</span></a><span class="k">class</span> <span class="nc">SafeDivide</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="SafeDivide-3359"><a href="#SafeDivide-3359"><span class="linenos">3359</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SafeDivide.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SafeDivide.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SafeDivide.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SafeDivide.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SafeDivide.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SafeDivide.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SafeDivide.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SafeDivide.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SafeDivide.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SafeDivide.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SafeDivide.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SafeDivide.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SafeDivide.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SafeDivide.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SafeDivide.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SafeDivide.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SafeDivide.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SafeDivide.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SafeDivide.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SafeDivide.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SafeDivide.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SafeDivide.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SafeDivide.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SafeDivide.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SafeDivide.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SafeDivide.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SafeDivide.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SafeDivide.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SafeDivide.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SafeDivide.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SafeDivide.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SafeDivide.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SafeDivide.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="SafeDivide.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="SafeDivide.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="SafeDivide.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="SafeDivide.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="SafeDivide.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="SafeDivide.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="SafeDivide.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SetAgg"> + <input id="SetAgg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SetAgg</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="SetAgg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SetAgg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SetAgg-3362"><a href="#SetAgg-3362"><span class="linenos">3362</span></a><span class="k">class</span> <span class="nc">SetAgg</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="SetAgg-3363"><a href="#SetAgg-3363"><span class="linenos">3363</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SetAgg.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SetAgg.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SetAgg.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SetAgg.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SetAgg.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SetAgg.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SetAgg.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SetAgg.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SetAgg.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SetAgg.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SetAgg.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SetAgg.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SetAgg.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SetAgg.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SetAgg.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SetAgg.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SetAgg.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SetAgg.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SetAgg.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SetAgg.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SetAgg.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SetAgg.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SetAgg.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SetAgg.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SetAgg.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SetAgg.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SetAgg.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SetAgg.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SetAgg.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SetAgg.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SetAgg.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SetAgg.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SetAgg.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="SetAgg.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="SetAgg.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="SetAgg.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="SetAgg.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="SetAgg.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="SetAgg.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="SetAgg.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SortArray"> + <input id="SortArray-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SortArray</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="SortArray-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SortArray"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SortArray-3366"><a href="#SortArray-3366"><span class="linenos">3366</span></a><span class="k">class</span> <span class="nc">SortArray</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="SortArray-3367"><a href="#SortArray-3367"><span class="linenos">3367</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"asc"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="SortArray.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="SortArray.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="SortArray.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="SortArray.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="SortArray.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="SortArray.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="SortArray.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="SortArray.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="SortArray.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="SortArray.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="SortArray.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="SortArray.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="SortArray.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="SortArray.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="SortArray.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="SortArray.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="SortArray.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="SortArray.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="SortArray.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="SortArray.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="SortArray.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="SortArray.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="SortArray.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="SortArray.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="SortArray.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="SortArray.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="SortArray.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="SortArray.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="SortArray.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="SortArray.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="SortArray.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="SortArray.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="SortArray.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="SortArray.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="SortArray.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="SortArray.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="SortArray.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="SortArray.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="SortArray.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="SortArray.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Split"> + <input id="Split-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Split</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Split-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Split"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Split-3370"><a href="#Split-3370"><span class="linenos">3370</span></a><span class="k">class</span> <span class="nc">Split</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Split-3371"><a href="#Split-3371"><span class="linenos">3371</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Split.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Split.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Split.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Split.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Split.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Split.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Split.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Split.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Split.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Split.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Split.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Split.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Split.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Split.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Split.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Split.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Split.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Split.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Split.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Split.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Split.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Split.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Split.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Split.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Split.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Split.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Split.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Split.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Split.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Split.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Split.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Split.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Split.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Split.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Split.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Split.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Split.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Split.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Split.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Split.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Substring"> + <input id="Substring-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Substring</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Substring-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Substring"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Substring-3376"><a href="#Substring-3376"><span class="linenos">3376</span></a><span class="k">class</span> <span class="nc">Substring</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Substring-3377"><a href="#Substring-3377"><span class="linenos">3377</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"length"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Substring.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Substring.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Substring.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Substring.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Substring.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Substring.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Substring.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Substring.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Substring.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Substring.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Substring.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Substring.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Substring.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Substring.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Substring.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Substring.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Substring.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Substring.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Substring.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Substring.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Substring.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Substring.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Substring.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Substring.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Substring.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Substring.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Substring.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Substring.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Substring.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Substring.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Substring.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Substring.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Substring.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Substring.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Substring.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Substring.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Substring.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Substring.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Substring.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Substring.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StrPosition"> + <input id="StrPosition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StrPosition</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="StrPosition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StrPosition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StrPosition-3380"><a href="#StrPosition-3380"><span class="linenos">3380</span></a><span class="k">class</span> <span class="nc">StrPosition</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="StrPosition-3381"><a href="#StrPosition-3381"><span class="linenos">3381</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="StrPosition-3382"><a href="#StrPosition-3382"><span class="linenos">3382</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="StrPosition-3383"><a href="#StrPosition-3383"><span class="linenos">3383</span></a> <span class="s2">"substr"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="StrPosition-3384"><a href="#StrPosition-3384"><span class="linenos">3384</span></a> <span class="s2">"position"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="StrPosition-3385"><a href="#StrPosition-3385"><span class="linenos">3385</span></a> <span class="s2">"instance"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="StrPosition-3386"><a href="#StrPosition-3386"><span class="linenos">3386</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StrPosition.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StrPosition.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StrPosition.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StrPosition.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StrPosition.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StrPosition.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StrPosition.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StrPosition.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StrPosition.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StrPosition.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StrPosition.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StrPosition.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StrPosition.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StrPosition.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StrPosition.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StrPosition.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StrPosition.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StrPosition.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StrPosition.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StrPosition.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StrPosition.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StrPosition.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StrPosition.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StrPosition.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StrPosition.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StrPosition.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StrPosition.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StrPosition.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StrPosition.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StrPosition.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StrPosition.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StrPosition.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StrPosition.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StrPosition.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StrPosition.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StrPosition.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StrPosition.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StrPosition.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StrPosition.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StrPosition.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StrToDate"> + <input id="StrToDate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StrToDate</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="StrToDate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StrToDate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StrToDate-3389"><a href="#StrToDate-3389"><span class="linenos">3389</span></a><span class="k">class</span> <span class="nc">StrToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="StrToDate-3390"><a href="#StrToDate-3390"><span class="linenos">3390</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StrToDate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StrToDate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StrToDate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StrToDate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StrToDate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StrToDate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StrToDate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StrToDate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StrToDate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StrToDate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StrToDate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StrToDate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StrToDate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StrToDate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StrToDate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StrToDate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StrToDate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StrToDate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StrToDate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StrToDate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StrToDate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StrToDate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StrToDate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StrToDate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StrToDate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StrToDate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StrToDate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StrToDate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StrToDate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StrToDate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StrToDate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StrToDate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StrToDate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StrToDate.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StrToDate.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StrToDate.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StrToDate.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StrToDate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StrToDate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StrToDate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StrToTime"> + <input id="StrToTime-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StrToTime</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="StrToTime-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StrToTime"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StrToTime-3393"><a href="#StrToTime-3393"><span class="linenos">3393</span></a><span class="k">class</span> <span class="nc">StrToTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="StrToTime-3394"><a href="#StrToTime-3394"><span class="linenos">3394</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StrToTime.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StrToTime.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StrToTime.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StrToTime.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StrToTime.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StrToTime.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StrToTime.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StrToTime.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StrToTime.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StrToTime.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StrToTime.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StrToTime.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StrToTime.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StrToTime.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StrToTime.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StrToTime.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StrToTime.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StrToTime.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StrToTime.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StrToTime.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StrToTime.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StrToTime.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StrToTime.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StrToTime.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StrToTime.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StrToTime.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StrToTime.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StrToTime.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StrToTime.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StrToTime.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StrToTime.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StrToTime.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StrToTime.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StrToTime.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StrToTime.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StrToTime.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StrToTime.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StrToTime.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StrToTime.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StrToTime.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StrToUnix"> + <input id="StrToUnix-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StrToUnix</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="StrToUnix-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StrToUnix"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StrToUnix-3399"><a href="#StrToUnix-3399"><span class="linenos">3399</span></a><span class="k">class</span> <span class="nc">StrToUnix</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="StrToUnix-3400"><a href="#StrToUnix-3400"><span class="linenos">3400</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StrToUnix.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StrToUnix.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StrToUnix.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StrToUnix.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StrToUnix.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StrToUnix.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StrToUnix.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StrToUnix.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StrToUnix.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StrToUnix.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StrToUnix.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StrToUnix.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StrToUnix.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StrToUnix.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StrToUnix.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StrToUnix.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StrToUnix.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StrToUnix.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StrToUnix.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StrToUnix.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StrToUnix.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StrToUnix.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StrToUnix.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StrToUnix.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StrToUnix.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StrToUnix.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StrToUnix.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StrToUnix.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StrToUnix.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StrToUnix.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StrToUnix.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StrToUnix.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StrToUnix.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StrToUnix.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StrToUnix.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StrToUnix.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StrToUnix.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StrToUnix.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StrToUnix.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StrToUnix.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="NumberToStr"> + <input id="NumberToStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">NumberToStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="NumberToStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#NumberToStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="NumberToStr-3403"><a href="#NumberToStr-3403"><span class="linenos">3403</span></a><span class="k">class</span> <span class="nc">NumberToStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="NumberToStr-3404"><a href="#NumberToStr-3404"><span class="linenos">3404</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="NumberToStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="NumberToStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="NumberToStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="NumberToStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="NumberToStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="NumberToStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="NumberToStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="NumberToStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="NumberToStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="NumberToStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="NumberToStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="NumberToStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="NumberToStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="NumberToStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="NumberToStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="NumberToStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="NumberToStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="NumberToStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="NumberToStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="NumberToStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="NumberToStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="NumberToStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="NumberToStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="NumberToStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="NumberToStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="NumberToStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="NumberToStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="NumberToStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="NumberToStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="NumberToStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="NumberToStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="NumberToStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="NumberToStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="NumberToStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="NumberToStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="NumberToStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="NumberToStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="NumberToStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="NumberToStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="NumberToStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Struct"> + <input id="Struct-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Struct</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Struct-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Struct"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Struct-3407"><a href="#Struct-3407"><span class="linenos">3407</span></a><span class="k">class</span> <span class="nc">Struct</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Struct-3408"><a href="#Struct-3408"><span class="linenos">3408</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span><span id="Struct-3409"><a href="#Struct-3409"><span class="linenos">3409</span></a> <span class="n">is_var_len_args</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Struct.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Struct.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Struct.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Struct.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Struct.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Struct.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Struct.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Struct.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Struct.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Struct.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Struct.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Struct.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Struct.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Struct.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Struct.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Struct.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Struct.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Struct.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Struct.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Struct.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Struct.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Struct.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Struct.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Struct.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Struct.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Struct.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Struct.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Struct.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Struct.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Struct.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Struct.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Struct.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Struct.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Struct.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Struct.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Struct.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Struct.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Struct.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Struct.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Struct.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StructExtract"> + <input id="StructExtract-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StructExtract</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="StructExtract-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StructExtract"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StructExtract-3412"><a href="#StructExtract-3412"><span class="linenos">3412</span></a><span class="k">class</span> <span class="nc">StructExtract</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="StructExtract-3413"><a href="#StructExtract-3413"><span class="linenos">3413</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StructExtract.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StructExtract.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StructExtract.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StructExtract.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StructExtract.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StructExtract.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StructExtract.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StructExtract.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StructExtract.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StructExtract.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StructExtract.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StructExtract.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StructExtract.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StructExtract.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StructExtract.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StructExtract.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StructExtract.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StructExtract.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StructExtract.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StructExtract.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StructExtract.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StructExtract.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StructExtract.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StructExtract.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StructExtract.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StructExtract.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StructExtract.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StructExtract.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StructExtract.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StructExtract.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StructExtract.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StructExtract.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StructExtract.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StructExtract.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StructExtract.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StructExtract.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StructExtract.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StructExtract.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StructExtract.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StructExtract.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Sum"> + <input id="Sum-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Sum</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Sum-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Sum"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Sum-3416"><a href="#Sum-3416"><span class="linenos">3416</span></a><span class="k">class</span> <span class="nc">Sum</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Sum-3417"><a href="#Sum-3417"><span class="linenos">3417</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Sum.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Sum.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Sum.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Sum.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Sum.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Sum.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Sum.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Sum.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Sum.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Sum.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Sum.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Sum.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Sum.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Sum.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Sum.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Sum.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Sum.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Sum.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Sum.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Sum.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Sum.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Sum.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Sum.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Sum.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Sum.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Sum.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Sum.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Sum.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Sum.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Sum.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Sum.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Sum.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Sum.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Sum.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Sum.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Sum.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Sum.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Sum.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Sum.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Sum.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Sqrt"> + <input id="Sqrt-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Sqrt</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Sqrt-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Sqrt"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Sqrt-3420"><a href="#Sqrt-3420"><span class="linenos">3420</span></a><span class="k">class</span> <span class="nc">Sqrt</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Sqrt-3421"><a href="#Sqrt-3421"><span class="linenos">3421</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Sqrt.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Sqrt.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Sqrt.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Sqrt.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Sqrt.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Sqrt.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Sqrt.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Sqrt.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Sqrt.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Sqrt.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Sqrt.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Sqrt.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Sqrt.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Sqrt.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Sqrt.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Sqrt.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Sqrt.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Sqrt.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Sqrt.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Sqrt.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Sqrt.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Sqrt.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Sqrt.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Sqrt.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Sqrt.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Sqrt.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Sqrt.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Sqrt.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Sqrt.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Sqrt.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Sqrt.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Sqrt.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Sqrt.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Sqrt.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Sqrt.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Sqrt.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Sqrt.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Sqrt.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Sqrt.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Sqrt.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Stddev"> + <input id="Stddev-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Stddev</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Stddev-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Stddev"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Stddev-3424"><a href="#Stddev-3424"><span class="linenos">3424</span></a><span class="k">class</span> <span class="nc">Stddev</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Stddev-3425"><a href="#Stddev-3425"><span class="linenos">3425</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Stddev.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Stddev.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Stddev.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Stddev.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Stddev.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Stddev.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Stddev.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Stddev.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Stddev.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Stddev.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Stddev.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Stddev.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Stddev.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Stddev.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Stddev.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Stddev.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Stddev.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Stddev.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Stddev.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Stddev.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Stddev.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Stddev.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Stddev.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Stddev.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Stddev.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Stddev.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Stddev.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Stddev.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Stddev.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Stddev.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Stddev.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Stddev.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Stddev.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Stddev.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Stddev.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Stddev.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Stddev.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Stddev.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Stddev.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Stddev.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StddevPop"> + <input id="StddevPop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StddevPop</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="StddevPop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StddevPop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StddevPop-3428"><a href="#StddevPop-3428"><span class="linenos">3428</span></a><span class="k">class</span> <span class="nc">StddevPop</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="StddevPop-3429"><a href="#StddevPop-3429"><span class="linenos">3429</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StddevPop.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StddevPop.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StddevPop.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StddevPop.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StddevPop.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StddevPop.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StddevPop.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StddevPop.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StddevPop.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StddevPop.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StddevPop.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StddevPop.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StddevPop.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StddevPop.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StddevPop.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StddevPop.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StddevPop.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StddevPop.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StddevPop.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StddevPop.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StddevPop.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StddevPop.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StddevPop.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StddevPop.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StddevPop.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StddevPop.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StddevPop.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StddevPop.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StddevPop.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StddevPop.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StddevPop.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StddevPop.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StddevPop.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StddevPop.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StddevPop.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StddevPop.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StddevPop.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StddevPop.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StddevPop.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StddevPop.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="StddevSamp"> + <input id="StddevSamp-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">StddevSamp</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="StddevSamp-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#StddevSamp"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="StddevSamp-3432"><a href="#StddevSamp-3432"><span class="linenos">3432</span></a><span class="k">class</span> <span class="nc">StddevSamp</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="StddevSamp-3433"><a href="#StddevSamp-3433"><span class="linenos">3433</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="StddevSamp.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="StddevSamp.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="StddevSamp.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="StddevSamp.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="StddevSamp.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="StddevSamp.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="StddevSamp.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="StddevSamp.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="StddevSamp.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="StddevSamp.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="StddevSamp.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="StddevSamp.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="StddevSamp.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="StddevSamp.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="StddevSamp.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="StddevSamp.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="StddevSamp.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="StddevSamp.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="StddevSamp.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="StddevSamp.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="StddevSamp.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="StddevSamp.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="StddevSamp.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="StddevSamp.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="StddevSamp.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="StddevSamp.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="StddevSamp.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="StddevSamp.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="StddevSamp.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="StddevSamp.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="StddevSamp.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="StddevSamp.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="StddevSamp.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="StddevSamp.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="StddevSamp.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="StddevSamp.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="StddevSamp.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="StddevSamp.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="StddevSamp.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="StddevSamp.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeToStr"> + <input id="TimeToStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeToStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TimeToStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeToStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeToStr-3436"><a href="#TimeToStr-3436"><span class="linenos">3436</span></a><span class="k">class</span> <span class="nc">TimeToStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TimeToStr-3437"><a href="#TimeToStr-3437"><span class="linenos">3437</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeToStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TimeToStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeToStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeToStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeToStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeToStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeToStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeToStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeToStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeToStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeToStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeToStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeToStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeToStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeToStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeToStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeToStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeToStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeToStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeToStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeToStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeToStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeToStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeToStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeToStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeToStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeToStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeToStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeToStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeToStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeToStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeToStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeToStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeToStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeToStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeToStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeToStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeToStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeToStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeToStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeToTimeStr"> + <input id="TimeToTimeStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeToTimeStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TimeToTimeStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeToTimeStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeToTimeStr-3440"><a href="#TimeToTimeStr-3440"><span class="linenos">3440</span></a><span class="k">class</span> <span class="nc">TimeToTimeStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TimeToTimeStr-3441"><a href="#TimeToTimeStr-3441"><span class="linenos">3441</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeToTimeStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TimeToTimeStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeToTimeStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeToTimeStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeToTimeStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeToTimeStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeToTimeStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeToTimeStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeToTimeStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeToTimeStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeToTimeStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeToTimeStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeToTimeStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeToTimeStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeToTimeStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeToTimeStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeToTimeStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeToTimeStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeToTimeStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeToTimeStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeToTimeStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeToTimeStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeToTimeStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeToTimeStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeToTimeStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeToTimeStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeToTimeStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeToTimeStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeToTimeStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeToTimeStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeToTimeStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeToTimeStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeToTimeStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeToTimeStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeToTimeStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeToTimeStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeToTimeStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeToTimeStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeToTimeStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeToTimeStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeToUnix"> + <input id="TimeToUnix-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeToUnix</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TimeToUnix-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeToUnix"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeToUnix-3444"><a href="#TimeToUnix-3444"><span class="linenos">3444</span></a><span class="k">class</span> <span class="nc">TimeToUnix</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TimeToUnix-3445"><a href="#TimeToUnix-3445"><span class="linenos">3445</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeToUnix.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TimeToUnix.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeToUnix.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeToUnix.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeToUnix.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeToUnix.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeToUnix.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeToUnix.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeToUnix.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeToUnix.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeToUnix.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeToUnix.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeToUnix.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeToUnix.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeToUnix.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeToUnix.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeToUnix.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeToUnix.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeToUnix.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeToUnix.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeToUnix.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeToUnix.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeToUnix.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeToUnix.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeToUnix.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeToUnix.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeToUnix.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeToUnix.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeToUnix.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeToUnix.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeToUnix.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeToUnix.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeToUnix.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeToUnix.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeToUnix.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeToUnix.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeToUnix.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeToUnix.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeToUnix.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeToUnix.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeStrToDate"> + <input id="TimeStrToDate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeStrToDate</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TimeStrToDate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeStrToDate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeStrToDate-3448"><a href="#TimeStrToDate-3448"><span class="linenos">3448</span></a><span class="k">class</span> <span class="nc">TimeStrToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TimeStrToDate-3449"><a href="#TimeStrToDate-3449"><span class="linenos">3449</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeStrToDate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TimeStrToDate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeStrToDate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeStrToDate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeStrToDate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeStrToDate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeStrToDate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeStrToDate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeStrToDate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeStrToDate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeStrToDate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeStrToDate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeStrToDate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeStrToDate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeStrToDate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeStrToDate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeStrToDate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeStrToDate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeStrToDate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeStrToDate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeStrToDate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeStrToDate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeStrToDate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeStrToDate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeStrToDate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeStrToDate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeStrToDate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeStrToDate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeStrToDate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeStrToDate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeStrToDate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeStrToDate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeStrToDate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeStrToDate.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeStrToDate.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeStrToDate.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeStrToDate.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeStrToDate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeStrToDate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeStrToDate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeStrToTime"> + <input id="TimeStrToTime-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeStrToTime</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TimeStrToTime-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeStrToTime"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeStrToTime-3452"><a href="#TimeStrToTime-3452"><span class="linenos">3452</span></a><span class="k">class</span> <span class="nc">TimeStrToTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TimeStrToTime-3453"><a href="#TimeStrToTime-3453"><span class="linenos">3453</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeStrToTime.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TimeStrToTime.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeStrToTime.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeStrToTime.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeStrToTime.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeStrToTime.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeStrToTime.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeStrToTime.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeStrToTime.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeStrToTime.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeStrToTime.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeStrToTime.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeStrToTime.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeStrToTime.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeStrToTime.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeStrToTime.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeStrToTime.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeStrToTime.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeStrToTime.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeStrToTime.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeStrToTime.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeStrToTime.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeStrToTime.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeStrToTime.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeStrToTime.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeStrToTime.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeStrToTime.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeStrToTime.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeStrToTime.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeStrToTime.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeStrToTime.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeStrToTime.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeStrToTime.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeStrToTime.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeStrToTime.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeStrToTime.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeStrToTime.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeStrToTime.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeStrToTime.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeStrToTime.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TimeStrToUnix"> + <input id="TimeStrToUnix-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TimeStrToUnix</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TimeStrToUnix-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TimeStrToUnix"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TimeStrToUnix-3456"><a href="#TimeStrToUnix-3456"><span class="linenos">3456</span></a><span class="k">class</span> <span class="nc">TimeStrToUnix</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TimeStrToUnix-3457"><a href="#TimeStrToUnix-3457"><span class="linenos">3457</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TimeStrToUnix.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TimeStrToUnix.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TimeStrToUnix.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TimeStrToUnix.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TimeStrToUnix.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TimeStrToUnix.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TimeStrToUnix.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TimeStrToUnix.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TimeStrToUnix.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TimeStrToUnix.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TimeStrToUnix.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TimeStrToUnix.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TimeStrToUnix.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TimeStrToUnix.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TimeStrToUnix.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TimeStrToUnix.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TimeStrToUnix.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TimeStrToUnix.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TimeStrToUnix.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TimeStrToUnix.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TimeStrToUnix.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TimeStrToUnix.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TimeStrToUnix.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TimeStrToUnix.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TimeStrToUnix.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TimeStrToUnix.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TimeStrToUnix.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TimeStrToUnix.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TimeStrToUnix.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TimeStrToUnix.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TimeStrToUnix.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TimeStrToUnix.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TimeStrToUnix.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TimeStrToUnix.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TimeStrToUnix.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TimeStrToUnix.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TimeStrToUnix.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TimeStrToUnix.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TimeStrToUnix.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TimeStrToUnix.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Trim"> + <input id="Trim-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Trim</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Trim-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Trim"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Trim-3460"><a href="#Trim-3460"><span class="linenos">3460</span></a><span class="k">class</span> <span class="nc">Trim</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Trim-3461"><a href="#Trim-3461"><span class="linenos">3461</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Trim-3462"><a href="#Trim-3462"><span class="linenos">3462</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Trim-3463"><a href="#Trim-3463"><span class="linenos">3463</span></a> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Trim-3464"><a href="#Trim-3464"><span class="linenos">3464</span></a> <span class="s2">"position"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Trim-3465"><a href="#Trim-3465"><span class="linenos">3465</span></a> <span class="s2">"collation"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Trim-3466"><a href="#Trim-3466"><span class="linenos">3466</span></a> <span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Trim.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Trim.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Trim.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Trim.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Trim.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Trim.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Trim.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Trim.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Trim.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Trim.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Trim.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Trim.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Trim.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Trim.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Trim.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Trim.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Trim.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Trim.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Trim.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Trim.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Trim.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Trim.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Trim.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Trim.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Trim.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Trim.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Trim.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Trim.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Trim.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Trim.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Trim.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Trim.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Trim.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Trim.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Trim.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Trim.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Trim.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Trim.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Trim.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Trim.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TsOrDsAdd"> + <input id="TsOrDsAdd-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TsOrDsAdd</span><wbr>(<span class="base"><a href="#Func">Func</a></span>, <span class="base"><a href="#TimeUnit">TimeUnit</a></span>): + + <label class="view-source-button" for="TsOrDsAdd-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TsOrDsAdd"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TsOrDsAdd-3469"><a href="#TsOrDsAdd-3469"><span class="linenos">3469</span></a><span class="k">class</span> <span class="nc">TsOrDsAdd</span><span class="p">(</span><span class="n">Func</span><span class="p">,</span> <span class="n">TimeUnit</span><span class="p">):</span> +</span><span id="TsOrDsAdd-3470"><a href="#TsOrDsAdd-3470"><span class="linenos">3470</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"unit"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#TimeUnit">TimeUnit</a></dt> + <dd id="TsOrDsAdd.__init__" class="function"><a href="#TimeUnit.__init__">TimeUnit</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TsOrDsAdd.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TsOrDsAdd.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TsOrDsAdd.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TsOrDsAdd.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TsOrDsAdd.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TsOrDsAdd.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TsOrDsAdd.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TsOrDsAdd.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TsOrDsAdd.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TsOrDsAdd.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TsOrDsAdd.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TsOrDsAdd.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TsOrDsAdd.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TsOrDsAdd.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TsOrDsAdd.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TsOrDsAdd.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TsOrDsAdd.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TsOrDsAdd.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TsOrDsAdd.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TsOrDsAdd.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TsOrDsAdd.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TsOrDsAdd.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TsOrDsAdd.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TsOrDsAdd.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TsOrDsAdd.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TsOrDsAdd.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TsOrDsAdd.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TsOrDsAdd.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TsOrDsAdd.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TsOrDsAdd.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TsOrDsAdd.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TsOrDsAdd.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TsOrDsAdd.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TsOrDsAdd.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TsOrDsAdd.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TsOrDsAdd.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TsOrDsAdd.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TsOrDsAdd.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TsOrDsAdd.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TsOrDsToDateStr"> + <input id="TsOrDsToDateStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TsOrDsToDateStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TsOrDsToDateStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TsOrDsToDateStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TsOrDsToDateStr-3473"><a href="#TsOrDsToDateStr-3473"><span class="linenos">3473</span></a><span class="k">class</span> <span class="nc">TsOrDsToDateStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TsOrDsToDateStr-3474"><a href="#TsOrDsToDateStr-3474"><span class="linenos">3474</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TsOrDsToDateStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TsOrDsToDateStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TsOrDsToDateStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TsOrDsToDateStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TsOrDsToDateStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TsOrDsToDateStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TsOrDsToDateStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TsOrDsToDateStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TsOrDsToDateStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TsOrDsToDateStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TsOrDsToDateStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TsOrDsToDateStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TsOrDsToDateStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TsOrDsToDateStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TsOrDsToDateStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TsOrDsToDateStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TsOrDsToDateStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TsOrDsToDateStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TsOrDsToDateStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TsOrDsToDateStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TsOrDsToDateStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TsOrDsToDateStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TsOrDsToDateStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TsOrDsToDateStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TsOrDsToDateStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TsOrDsToDateStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TsOrDsToDateStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TsOrDsToDateStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TsOrDsToDateStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TsOrDsToDateStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TsOrDsToDateStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TsOrDsToDateStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TsOrDsToDateStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TsOrDsToDateStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TsOrDsToDateStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TsOrDsToDateStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TsOrDsToDateStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TsOrDsToDateStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TsOrDsToDateStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TsOrDsToDateStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TsOrDsToDate"> + <input id="TsOrDsToDate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TsOrDsToDate</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TsOrDsToDate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TsOrDsToDate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TsOrDsToDate-3477"><a href="#TsOrDsToDate-3477"><span class="linenos">3477</span></a><span class="k">class</span> <span class="nc">TsOrDsToDate</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TsOrDsToDate-3478"><a href="#TsOrDsToDate-3478"><span class="linenos">3478</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TsOrDsToDate.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TsOrDsToDate.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TsOrDsToDate.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TsOrDsToDate.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TsOrDsToDate.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TsOrDsToDate.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TsOrDsToDate.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TsOrDsToDate.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TsOrDsToDate.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TsOrDsToDate.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TsOrDsToDate.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TsOrDsToDate.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TsOrDsToDate.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TsOrDsToDate.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TsOrDsToDate.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TsOrDsToDate.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TsOrDsToDate.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TsOrDsToDate.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TsOrDsToDate.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TsOrDsToDate.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TsOrDsToDate.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TsOrDsToDate.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TsOrDsToDate.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TsOrDsToDate.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TsOrDsToDate.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TsOrDsToDate.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TsOrDsToDate.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TsOrDsToDate.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TsOrDsToDate.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TsOrDsToDate.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TsOrDsToDate.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TsOrDsToDate.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TsOrDsToDate.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TsOrDsToDate.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TsOrDsToDate.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TsOrDsToDate.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TsOrDsToDate.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TsOrDsToDate.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TsOrDsToDate.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TsOrDsToDate.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="TsOrDiToDi"> + <input id="TsOrDiToDi-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TsOrDiToDi</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="TsOrDiToDi-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TsOrDiToDi"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TsOrDiToDi-3481"><a href="#TsOrDiToDi-3481"><span class="linenos">3481</span></a><span class="k">class</span> <span class="nc">TsOrDiToDi</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="TsOrDiToDi-3482"><a href="#TsOrDiToDi-3482"><span class="linenos">3482</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="TsOrDiToDi.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="TsOrDiToDi.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="TsOrDiToDi.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="TsOrDiToDi.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="TsOrDiToDi.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="TsOrDiToDi.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="TsOrDiToDi.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="TsOrDiToDi.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="TsOrDiToDi.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="TsOrDiToDi.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="TsOrDiToDi.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="TsOrDiToDi.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="TsOrDiToDi.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="TsOrDiToDi.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="TsOrDiToDi.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="TsOrDiToDi.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="TsOrDiToDi.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="TsOrDiToDi.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="TsOrDiToDi.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="TsOrDiToDi.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="TsOrDiToDi.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="TsOrDiToDi.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="TsOrDiToDi.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="TsOrDiToDi.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="TsOrDiToDi.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="TsOrDiToDi.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="TsOrDiToDi.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="TsOrDiToDi.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="TsOrDiToDi.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="TsOrDiToDi.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="TsOrDiToDi.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="TsOrDiToDi.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="TsOrDiToDi.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="TsOrDiToDi.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="TsOrDiToDi.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="TsOrDiToDi.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="TsOrDiToDi.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="TsOrDiToDi.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="TsOrDiToDi.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="TsOrDiToDi.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Unhex"> + <input id="Unhex-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Unhex</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Unhex-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Unhex"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Unhex-3485"><a href="#Unhex-3485"><span class="linenos">3485</span></a><span class="k">class</span> <span class="nc">Unhex</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Unhex-3486"><a href="#Unhex-3486"><span class="linenos">3486</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Unhex.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Unhex.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Unhex.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Unhex.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Unhex.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Unhex.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Unhex.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Unhex.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Unhex.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Unhex.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Unhex.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Unhex.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Unhex.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Unhex.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Unhex.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Unhex.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Unhex.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Unhex.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Unhex.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Unhex.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Unhex.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Unhex.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Unhex.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Unhex.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Unhex.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Unhex.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Unhex.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Unhex.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Unhex.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Unhex.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Unhex.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Unhex.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Unhex.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Unhex.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Unhex.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Unhex.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Unhex.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Unhex.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Unhex.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Unhex.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UnixToStr"> + <input id="UnixToStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UnixToStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="UnixToStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UnixToStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UnixToStr-3489"><a href="#UnixToStr-3489"><span class="linenos">3489</span></a><span class="k">class</span> <span class="nc">UnixToStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="UnixToStr-3490"><a href="#UnixToStr-3490"><span class="linenos">3490</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UnixToStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UnixToStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UnixToStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UnixToStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UnixToStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UnixToStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UnixToStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UnixToStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UnixToStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UnixToStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UnixToStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UnixToStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UnixToStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UnixToStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UnixToStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UnixToStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UnixToStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UnixToStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UnixToStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UnixToStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UnixToStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UnixToStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UnixToStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UnixToStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UnixToStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UnixToStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UnixToStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UnixToStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UnixToStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UnixToStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UnixToStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UnixToStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UnixToStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="UnixToStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="UnixToStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="UnixToStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="UnixToStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="UnixToStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="UnixToStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="UnixToStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UnixToTime"> + <input id="UnixToTime-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UnixToTime</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="UnixToTime-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UnixToTime"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UnixToTime-3495"><a href="#UnixToTime-3495"><span class="linenos">3495</span></a><span class="k">class</span> <span class="nc">UnixToTime</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="UnixToTime-3496"><a href="#UnixToTime-3496"><span class="linenos">3496</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"scale"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"hours"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> <span class="s2">"minutes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span><span id="UnixToTime-3497"><a href="#UnixToTime-3497"><span class="linenos">3497</span></a> +</span><span id="UnixToTime-3498"><a href="#UnixToTime-3498"><span class="linenos">3498</span></a> <span class="n">SECONDS</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"seconds"</span><span class="p">)</span> +</span><span id="UnixToTime-3499"><a href="#UnixToTime-3499"><span class="linenos">3499</span></a> <span class="n">MILLIS</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"millis"</span><span class="p">)</span> +</span><span id="UnixToTime-3500"><a href="#UnixToTime-3500"><span class="linenos">3500</span></a> <span class="n">MICROS</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"micros"</span><span class="p">)</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UnixToTime.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UnixToTime.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UnixToTime.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UnixToTime.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UnixToTime.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UnixToTime.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UnixToTime.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UnixToTime.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UnixToTime.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UnixToTime.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UnixToTime.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UnixToTime.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UnixToTime.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UnixToTime.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UnixToTime.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UnixToTime.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UnixToTime.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UnixToTime.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UnixToTime.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UnixToTime.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UnixToTime.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UnixToTime.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UnixToTime.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UnixToTime.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UnixToTime.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UnixToTime.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UnixToTime.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UnixToTime.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UnixToTime.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UnixToTime.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UnixToTime.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UnixToTime.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UnixToTime.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="UnixToTime.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="UnixToTime.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="UnixToTime.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="UnixToTime.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="UnixToTime.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="UnixToTime.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="UnixToTime.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="UnixToTimeStr"> + <input id="UnixToTimeStr-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">UnixToTimeStr</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="UnixToTimeStr-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#UnixToTimeStr"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="UnixToTimeStr-3503"><a href="#UnixToTimeStr-3503"><span class="linenos">3503</span></a><span class="k">class</span> <span class="nc">UnixToTimeStr</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="UnixToTimeStr-3504"><a href="#UnixToTimeStr-3504"><span class="linenos">3504</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="UnixToTimeStr.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="UnixToTimeStr.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="UnixToTimeStr.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="UnixToTimeStr.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="UnixToTimeStr.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="UnixToTimeStr.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="UnixToTimeStr.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="UnixToTimeStr.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="UnixToTimeStr.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="UnixToTimeStr.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="UnixToTimeStr.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="UnixToTimeStr.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="UnixToTimeStr.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="UnixToTimeStr.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="UnixToTimeStr.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="UnixToTimeStr.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="UnixToTimeStr.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="UnixToTimeStr.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="UnixToTimeStr.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="UnixToTimeStr.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="UnixToTimeStr.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="UnixToTimeStr.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="UnixToTimeStr.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="UnixToTimeStr.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="UnixToTimeStr.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="UnixToTimeStr.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="UnixToTimeStr.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="UnixToTimeStr.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="UnixToTimeStr.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="UnixToTimeStr.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="UnixToTimeStr.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="UnixToTimeStr.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="UnixToTimeStr.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="UnixToTimeStr.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="UnixToTimeStr.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="UnixToTimeStr.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="UnixToTimeStr.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="UnixToTimeStr.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="UnixToTimeStr.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="UnixToTimeStr.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Upper"> + <input id="Upper-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Upper</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Upper-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Upper"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Upper-3507"><a href="#Upper-3507"><span class="linenos">3507</span></a><span class="k">class</span> <span class="nc">Upper</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Upper-3508"><a href="#Upper-3508"><span class="linenos">3508</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"UPPER"</span><span class="p">,</span> <span class="s2">"UCASE"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Upper.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Upper.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Upper.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Upper.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Upper.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Upper.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Upper.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Upper.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Upper.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Upper.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Upper.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Upper.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Upper.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Upper.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Upper.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Upper.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Upper.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Upper.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Upper.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Upper.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Upper.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Upper.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Upper.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Upper.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Upper.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Upper.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Upper.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Upper.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Upper.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Upper.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Upper.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Upper.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Upper.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Upper.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Upper.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Upper.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Upper.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Upper.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Upper.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Upper.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Variance"> + <input id="Variance-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Variance</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="Variance-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Variance"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Variance-3511"><a href="#Variance-3511"><span class="linenos">3511</span></a><span class="k">class</span> <span class="nc">Variance</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Variance-3512"><a href="#Variance-3512"><span class="linenos">3512</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"VARIANCE"</span><span class="p">,</span> <span class="s2">"VARIANCE_SAMP"</span><span class="p">,</span> <span class="s2">"VAR_SAMP"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Variance.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Variance.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Variance.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Variance.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Variance.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Variance.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Variance.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Variance.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Variance.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Variance.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Variance.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Variance.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Variance.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Variance.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Variance.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Variance.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Variance.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Variance.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Variance.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Variance.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Variance.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Variance.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Variance.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Variance.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Variance.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Variance.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Variance.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Variance.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Variance.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Variance.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Variance.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Variance.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Variance.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Variance.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Variance.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Variance.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Variance.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Variance.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Variance.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Variance.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="VariancePop"> + <input id="VariancePop-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">VariancePop</span><wbr>(<span class="base"><a href="#AggFunc">AggFunc</a></span>): + + <label class="view-source-button" for="VariancePop-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#VariancePop"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="VariancePop-3515"><a href="#VariancePop-3515"><span class="linenos">3515</span></a><span class="k">class</span> <span class="nc">VariancePop</span><span class="p">(</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="VariancePop-3516"><a href="#VariancePop-3516"><span class="linenos">3516</span></a> <span class="n">_sql_names</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"VARIANCE_POP"</span><span class="p">,</span> <span class="s2">"VAR_POP"</span><span class="p">]</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="VariancePop.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="VariancePop.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="VariancePop.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="VariancePop.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="VariancePop.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="VariancePop.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="VariancePop.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="VariancePop.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="VariancePop.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="VariancePop.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="VariancePop.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="VariancePop.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="VariancePop.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="VariancePop.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="VariancePop.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="VariancePop.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="VariancePop.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="VariancePop.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="VariancePop.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="VariancePop.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="VariancePop.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="VariancePop.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="VariancePop.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="VariancePop.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="VariancePop.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="VariancePop.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="VariancePop.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="VariancePop.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="VariancePop.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="VariancePop.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="VariancePop.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="VariancePop.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="VariancePop.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="VariancePop.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="VariancePop.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="VariancePop.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="VariancePop.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="VariancePop.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="VariancePop.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="VariancePop.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Week"> + <input id="Week-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Week</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Week-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Week"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Week-3519"><a href="#Week-3519"><span class="linenos">3519</span></a><span class="k">class</span> <span class="nc">Week</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Week-3520"><a href="#Week-3520"><span class="linenos">3520</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"mode"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Week.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Week.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Week.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Week.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Week.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Week.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Week.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Week.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Week.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Week.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Week.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Week.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Week.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Week.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Week.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Week.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Week.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Week.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Week.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Week.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Week.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Week.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Week.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Week.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Week.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Week.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Week.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Week.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Week.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Week.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Week.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Week.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Week.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Week.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Week.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Week.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Week.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Week.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Week.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Week.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Year"> + <input id="Year-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Year</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="Year-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Year"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Year-3523"><a href="#Year-3523"><span class="linenos">3523</span></a><span class="k">class</span> <span class="nc">Year</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Year-3524"><a href="#Year-3524"><span class="linenos">3524</span></a> <span class="k">pass</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Year.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Year.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Year.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Year.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Year.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Year.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Year.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Year.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Year.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Year.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Year.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Year.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Year.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Year.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Year.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Year.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Year.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Year.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Year.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Year.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Year.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Year.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Year.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Year.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Year.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Year.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Year.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Year.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Year.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Year.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Year.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Year.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Year.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="Year.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="Year.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="Year.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="Year.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="Year.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="Year.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="Year.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Use"> + <input id="Use-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Use</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Use-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Use"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Use-3527"><a href="#Use-3527"><span class="linenos">3527</span></a><span class="k">class</span> <span class="nc">Use</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Use-3528"><a href="#Use-3528"><span class="linenos">3528</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Use.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Use.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Use.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Use.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Use.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Use.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Use.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Use.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Use.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Use.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Use.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Use.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Use.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Use.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Use.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Use.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Use.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Use.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Use.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Use.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Use.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Use.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Use.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Use.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Use.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Use.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Use.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Use.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Use.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Use.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Use.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Use.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Use.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Merge"> + <input id="Merge-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Merge</span><wbr>(<span class="base"><a href="#Expression">Expression</a></span>): + + <label class="view-source-button" for="Merge-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Merge"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Merge-3531"><a href="#Merge-3531"><span class="linenos">3531</span></a><span class="k">class</span> <span class="nc">Merge</span><span class="p">(</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Merge-3532"><a href="#Merge-3532"><span class="linenos">3532</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="Merge.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="Merge.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="Merge.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="Merge.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="Merge.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="Merge.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="Merge.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="Merge.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="Merge.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="Merge.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="Merge.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="Merge.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="Merge.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="Merge.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="Merge.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="Merge.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="Merge.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="Merge.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="Merge.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="Merge.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="Merge.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="Merge.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="Merge.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="Merge.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="Merge.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="Merge.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="Merge.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="Merge.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="Merge.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="Merge.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="Merge.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="Merge.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="Merge.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + </dl> + </div> + </section> + <section id="When"> + <input id="When-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">When</span><wbr>(<span class="base"><a href="#Func">Func</a></span>): + + <label class="view-source-button" for="When-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#When"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="When-3535"><a href="#When-3535"><span class="linenos">3535</span></a><span class="k">class</span> <span class="nc">When</span><span class="p">(</span><span class="n">Func</span><span class="p">):</span> +</span><span id="When-3536"><a href="#When-3536"><span class="linenos">3536</span></a> <span class="n">arg_types</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="s2">"then"</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span> +</span></pre></div> + + + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Expression">Expression</a></dt> + <dd id="When.__init__" class="function"><a href="#Expression.__init__">Expression</a></dd> + <dd id="When.this" class="variable"><a href="#Expression.this">this</a></dd> + <dd id="When.expression" class="variable"><a href="#Expression.expression">expression</a></dd> + <dd id="When.expressions" class="variable"><a href="#Expression.expressions">expressions</a></dd> + <dd id="When.text" class="function"><a href="#Expression.text">text</a></dd> + <dd id="When.is_string" class="variable"><a href="#Expression.is_string">is_string</a></dd> + <dd id="When.is_number" class="variable"><a href="#Expression.is_number">is_number</a></dd> + <dd id="When.is_int" class="variable"><a href="#Expression.is_int">is_int</a></dd> + <dd id="When.alias" class="variable"><a href="#Expression.alias">alias</a></dd> + <dd id="When.output_name" class="variable"><a href="#Expression.output_name">output_name</a></dd> + <dd id="When.copy" class="function"><a href="#Expression.copy">copy</a></dd> + <dd id="When.append" class="function"><a href="#Expression.append">append</a></dd> + <dd id="When.set" class="function"><a href="#Expression.set">set</a></dd> + <dd id="When.depth" class="variable"><a href="#Expression.depth">depth</a></dd> + <dd id="When.find" class="function"><a href="#Expression.find">find</a></dd> + <dd id="When.find_all" class="function"><a href="#Expression.find_all">find_all</a></dd> + <dd id="When.find_ancestor" class="function"><a href="#Expression.find_ancestor">find_ancestor</a></dd> + <dd id="When.parent_select" class="variable"><a href="#Expression.parent_select">parent_select</a></dd> + <dd id="When.walk" class="function"><a href="#Expression.walk">walk</a></dd> + <dd id="When.dfs" class="function"><a href="#Expression.dfs">dfs</a></dd> + <dd id="When.bfs" class="function"><a href="#Expression.bfs">bfs</a></dd> + <dd id="When.unnest" class="function"><a href="#Expression.unnest">unnest</a></dd> + <dd id="When.unalias" class="function"><a href="#Expression.unalias">unalias</a></dd> + <dd id="When.unnest_operands" class="function"><a href="#Expression.unnest_operands">unnest_operands</a></dd> + <dd id="When.flatten" class="function"><a href="#Expression.flatten">flatten</a></dd> + <dd id="When.sql" class="function"><a href="#Expression.sql">sql</a></dd> + <dd id="When.transform" class="function"><a href="#Expression.transform">transform</a></dd> + <dd id="When.replace" class="function"><a href="#Expression.replace">replace</a></dd> + <dd id="When.pop" class="function"><a href="#Expression.pop">pop</a></dd> + <dd id="When.assert_is" class="function"><a href="#Expression.assert_is">assert_is</a></dd> + <dd id="When.error_messages" class="function"><a href="#Expression.error_messages">error_messages</a></dd> + <dd id="When.dump" class="function"><a href="#Expression.dump">dump</a></dd> + <dd id="When.load" class="function"><a href="#Expression.load">load</a></dd> + + </div> + <div><dt><a href="#Func">Func</a></dt> + <dd id="When.from_arg_list" class="function"><a href="#Func.from_arg_list">from_arg_list</a></dd> + <dd id="When.sql_names" class="function"><a href="#Func.sql_names">sql_names</a></dd> + <dd id="When.sql_name" class="function"><a href="#Func.sql_name">sql_name</a></dd> + <dd id="When.default_parser_mappings" class="function"><a href="#Func.default_parser_mappings">default_parser_mappings</a></dd> + + </div> + <div><dt><a href="#Condition">Condition</a></dt> + <dd id="When.and_" class="function"><a href="#Condition.and_">and_</a></dd> + <dd id="When.or_" class="function"><a href="#Condition.or_">or_</a></dd> + <dd id="When.not_" class="function"><a href="#Condition.not_">not_</a></dd> + + </div> + </dl> + </div> + </section> + <section id="maybe_parse"> + <input id="maybe_parse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">maybe_parse</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql_or_expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="o">*</span>,</span><span class="param"> <span class="n">into</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="n">Collection</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">prefix</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="maybe_parse-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#maybe_parse"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="maybe_parse-3564"><a href="#maybe_parse-3564"><span class="linenos">3564</span></a><span class="k">def</span> <span class="nf">maybe_parse</span><span class="p">(</span> +</span><span id="maybe_parse-3565"><a href="#maybe_parse-3565"><span class="linenos">3565</span></a> <span class="n">sql_or_expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> +</span><span id="maybe_parse-3566"><a href="#maybe_parse-3566"><span class="linenos">3566</span></a> <span class="o">*</span><span class="p">,</span> +</span><span id="maybe_parse-3567"><a href="#maybe_parse-3567"><span class="linenos">3567</span></a> <span class="n">into</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">IntoType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="maybe_parse-3568"><a href="#maybe_parse-3568"><span class="linenos">3568</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="maybe_parse-3569"><a href="#maybe_parse-3569"><span class="linenos">3569</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="maybe_parse-3570"><a href="#maybe_parse-3570"><span class="linenos">3570</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="maybe_parse-3571"><a href="#maybe_parse-3571"><span class="linenos">3571</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="maybe_parse-3572"><a href="#maybe_parse-3572"><span class="linenos">3572</span></a><span class="w"> </span><span class="sd">"""Gracefully handle a possible string or expression.</span> +</span><span id="maybe_parse-3573"><a href="#maybe_parse-3573"><span class="linenos">3573</span></a> +</span><span id="maybe_parse-3574"><a href="#maybe_parse-3574"><span class="linenos">3574</span></a><span class="sd"> Example:</span> +</span><span id="maybe_parse-3575"><a href="#maybe_parse-3575"><span class="linenos">3575</span></a><span class="sd"> >>> maybe_parse("1")</span> +</span><span id="maybe_parse-3576"><a href="#maybe_parse-3576"><span class="linenos">3576</span></a><span class="sd"> (LITERAL this: 1, is_string: False)</span> +</span><span id="maybe_parse-3577"><a href="#maybe_parse-3577"><span class="linenos">3577</span></a><span class="sd"> >>> maybe_parse(to_identifier("x"))</span> +</span><span id="maybe_parse-3578"><a href="#maybe_parse-3578"><span class="linenos">3578</span></a><span class="sd"> (IDENTIFIER this: x, quoted: False)</span> +</span><span id="maybe_parse-3579"><a href="#maybe_parse-3579"><span class="linenos">3579</span></a> +</span><span id="maybe_parse-3580"><a href="#maybe_parse-3580"><span class="linenos">3580</span></a><span class="sd"> Args:</span> +</span><span id="maybe_parse-3581"><a href="#maybe_parse-3581"><span class="linenos">3581</span></a><span class="sd"> sql_or_expression: the SQL code string or an expression</span> +</span><span id="maybe_parse-3582"><a href="#maybe_parse-3582"><span class="linenos">3582</span></a><span class="sd"> into: the SQLGlot Expression to parse into</span> +</span><span id="maybe_parse-3583"><a href="#maybe_parse-3583"><span class="linenos">3583</span></a><span class="sd"> dialect: the dialect used to parse the input expressions (in the case that an</span> +</span><span id="maybe_parse-3584"><a href="#maybe_parse-3584"><span class="linenos">3584</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="maybe_parse-3585"><a href="#maybe_parse-3585"><span class="linenos">3585</span></a><span class="sd"> prefix: a string to prefix the sql with before it gets parsed</span> +</span><span id="maybe_parse-3586"><a href="#maybe_parse-3586"><span class="linenos">3586</span></a><span class="sd"> (automatically includes a space)</span> +</span><span id="maybe_parse-3587"><a href="#maybe_parse-3587"><span class="linenos">3587</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="maybe_parse-3588"><a href="#maybe_parse-3588"><span class="linenos">3588</span></a><span class="sd"> that an input expression is a SQL string).</span> +</span><span id="maybe_parse-3589"><a href="#maybe_parse-3589"><span class="linenos">3589</span></a> +</span><span id="maybe_parse-3590"><a href="#maybe_parse-3590"><span class="linenos">3590</span></a><span class="sd"> Returns:</span> +</span><span id="maybe_parse-3591"><a href="#maybe_parse-3591"><span class="linenos">3591</span></a><span class="sd"> Expression: the parsed or given expression.</span> +</span><span id="maybe_parse-3592"><a href="#maybe_parse-3592"><span class="linenos">3592</span></a><span class="sd"> """</span> +</span><span id="maybe_parse-3593"><a href="#maybe_parse-3593"><span class="linenos">3593</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="maybe_parse-3594"><a href="#maybe_parse-3594"><span class="linenos">3594</span></a> <span class="k">return</span> <span class="n">sql_or_expression</span> +</span><span id="maybe_parse-3595"><a href="#maybe_parse-3595"><span class="linenos">3595</span></a> +</span><span id="maybe_parse-3596"><a href="#maybe_parse-3596"><span class="linenos">3596</span></a> <span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="maybe_parse-3597"><a href="#maybe_parse-3597"><span class="linenos">3597</span></a> +</span><span id="maybe_parse-3598"><a href="#maybe_parse-3598"><span class="linenos">3598</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="p">)</span> +</span><span id="maybe_parse-3599"><a href="#maybe_parse-3599"><span class="linenos">3599</span></a> <span class="k">if</span> <span class="n">prefix</span><span class="p">:</span> +</span><span id="maybe_parse-3600"><a href="#maybe_parse-3600"><span class="linenos">3600</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="maybe_parse-3601"><a href="#maybe_parse-3601"><span class="linenos">3601</span></a> <span class="k">return</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">parse_one</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">into</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Gracefully handle a possible string or expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">maybe_parse</span><span class="p">(</span><span class="s2">"1"</span><span class="p">)</span> +<span class="go">(LITERAL this: 1, is_string: False)</span> +<span class="gp">>>> </span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">to_identifier</span><span class="p">(</span><span class="s2">"x"</span><span class="p">))</span> +<span class="go">(IDENTIFIER this: x, quoted: False)</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql_or_expression:</strong> the SQL code string or an expression</li> +<li><strong>into:</strong> the SQLGlot Expression to parse into</li> +<li><strong>dialect:</strong> the dialect used to parse the input expressions (in the case that an +input expression is a SQL string).</li> +<li><strong>prefix:</strong> a string to prefix the sql with before it gets parsed +(automatically includes a space)</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case +that an input expression is a SQL string).</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Expression: the parsed or given expression.</p> +</blockquote> +</div> + + + </section> + <section id="union"> + <input id="union-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">union</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">left</span>, </span><span class="param"><span class="n">right</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="union-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#union"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="union-3747"><a href="#union-3747"><span class="linenos">3747</span></a><span class="k">def</span> <span class="nf">union</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="union-3748"><a href="#union-3748"><span class="linenos">3748</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="union-3749"><a href="#union-3749"><span class="linenos">3749</span></a><span class="sd"> Initializes a syntax tree from one UNION expression.</span> +</span><span id="union-3750"><a href="#union-3750"><span class="linenos">3750</span></a> +</span><span id="union-3751"><a href="#union-3751"><span class="linenos">3751</span></a><span class="sd"> Example:</span> +</span><span id="union-3752"><a href="#union-3752"><span class="linenos">3752</span></a><span class="sd"> >>> union("SELECT * FROM foo", "SELECT * FROM bla").sql()</span> +</span><span id="union-3753"><a href="#union-3753"><span class="linenos">3753</span></a><span class="sd"> 'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</span><span id="union-3754"><a href="#union-3754"><span class="linenos">3754</span></a> +</span><span id="union-3755"><a href="#union-3755"><span class="linenos">3755</span></a><span class="sd"> Args:</span> +</span><span id="union-3756"><a href="#union-3756"><span class="linenos">3756</span></a><span class="sd"> left (str | Expression): the SQL code string corresponding to the left-hand side.</span> +</span><span id="union-3757"><a href="#union-3757"><span class="linenos">3757</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="union-3758"><a href="#union-3758"><span class="linenos">3758</span></a><span class="sd"> right (str | Expression): the SQL code string corresponding to the right-hand side.</span> +</span><span id="union-3759"><a href="#union-3759"><span class="linenos">3759</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="union-3760"><a href="#union-3760"><span class="linenos">3760</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="union-3761"><a href="#union-3761"><span class="linenos">3761</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="union-3762"><a href="#union-3762"><span class="linenos">3762</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="union-3763"><a href="#union-3763"><span class="linenos">3763</span></a><span class="sd"> Returns:</span> +</span><span id="union-3764"><a href="#union-3764"><span class="linenos">3764</span></a><span class="sd"> Union: the syntax tree for the UNION expression.</span> +</span><span id="union-3765"><a href="#union-3765"><span class="linenos">3765</span></a><span class="sd"> """</span> +</span><span id="union-3766"><a href="#union-3766"><span class="linenos">3766</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="union-3767"><a href="#union-3767"><span class="linenos">3767</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="union-3768"><a href="#union-3768"><span class="linenos">3768</span></a> +</span><span id="union-3769"><a href="#union-3769"><span class="linenos">3769</span></a> <span class="k">return</span> <span class="n">Union</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Initializes a syntax tree from one UNION expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">union</span><span class="p">(</span><span class="s2">"SELECT * FROM foo"</span><span class="p">,</span> <span class="s2">"SELECT * FROM bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo UNION SELECT * FROM bla'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>left (str | Expression):</strong> the SQL code string corresponding to the left-hand side. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>right (str | Expression):</strong> the SQL code string corresponding to the right-hand side. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Union: the syntax tree for the UNION expression.</p> +</blockquote> +</div> + + + </section> + <section id="intersect"> + <input id="intersect-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intersect</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">left</span>, </span><span class="param"><span class="n">right</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="intersect-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#intersect"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="intersect-3772"><a href="#intersect-3772"><span class="linenos">3772</span></a><span class="k">def</span> <span class="nf">intersect</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="intersect-3773"><a href="#intersect-3773"><span class="linenos">3773</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="intersect-3774"><a href="#intersect-3774"><span class="linenos">3774</span></a><span class="sd"> Initializes a syntax tree from one INTERSECT expression.</span> +</span><span id="intersect-3775"><a href="#intersect-3775"><span class="linenos">3775</span></a> +</span><span id="intersect-3776"><a href="#intersect-3776"><span class="linenos">3776</span></a><span class="sd"> Example:</span> +</span><span id="intersect-3777"><a href="#intersect-3777"><span class="linenos">3777</span></a><span class="sd"> >>> intersect("SELECT * FROM foo", "SELECT * FROM bla").sql()</span> +</span><span id="intersect-3778"><a href="#intersect-3778"><span class="linenos">3778</span></a><span class="sd"> 'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</span><span id="intersect-3779"><a href="#intersect-3779"><span class="linenos">3779</span></a> +</span><span id="intersect-3780"><a href="#intersect-3780"><span class="linenos">3780</span></a><span class="sd"> Args:</span> +</span><span id="intersect-3781"><a href="#intersect-3781"><span class="linenos">3781</span></a><span class="sd"> left (str | Expression): the SQL code string corresponding to the left-hand side.</span> +</span><span id="intersect-3782"><a href="#intersect-3782"><span class="linenos">3782</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="intersect-3783"><a href="#intersect-3783"><span class="linenos">3783</span></a><span class="sd"> right (str | Expression): the SQL code string corresponding to the right-hand side.</span> +</span><span id="intersect-3784"><a href="#intersect-3784"><span class="linenos">3784</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="intersect-3785"><a href="#intersect-3785"><span class="linenos">3785</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="intersect-3786"><a href="#intersect-3786"><span class="linenos">3786</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="intersect-3787"><a href="#intersect-3787"><span class="linenos">3787</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="intersect-3788"><a href="#intersect-3788"><span class="linenos">3788</span></a><span class="sd"> Returns:</span> +</span><span id="intersect-3789"><a href="#intersect-3789"><span class="linenos">3789</span></a><span class="sd"> Intersect: the syntax tree for the INTERSECT expression.</span> +</span><span id="intersect-3790"><a href="#intersect-3790"><span class="linenos">3790</span></a><span class="sd"> """</span> +</span><span id="intersect-3791"><a href="#intersect-3791"><span class="linenos">3791</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="intersect-3792"><a href="#intersect-3792"><span class="linenos">3792</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="intersect-3793"><a href="#intersect-3793"><span class="linenos">3793</span></a> +</span><span id="intersect-3794"><a href="#intersect-3794"><span class="linenos">3794</span></a> <span class="k">return</span> <span class="n">Intersect</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Initializes a syntax tree from one INTERSECT expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">intersect</span><span class="p">(</span><span class="s2">"SELECT * FROM foo"</span><span class="p">,</span> <span class="s2">"SELECT * FROM bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo INTERSECT SELECT * FROM bla'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>left (str | Expression):</strong> the SQL code string corresponding to the left-hand side. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>right (str | Expression):</strong> the SQL code string corresponding to the right-hand side. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Intersect: the syntax tree for the INTERSECT expression.</p> +</blockquote> +</div> + + + </section> + <section id="except_"> + <input id="except_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">except_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">left</span>, </span><span class="param"><span class="n">right</span>, </span><span class="param"><span class="n">distinct</span><span class="o">=</span><span class="kc">True</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="except_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#except_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="except_-3797"><a href="#except_-3797"><span class="linenos">3797</span></a><span class="k">def</span> <span class="nf">except_</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="except_-3798"><a href="#except_-3798"><span class="linenos">3798</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="except_-3799"><a href="#except_-3799"><span class="linenos">3799</span></a><span class="sd"> Initializes a syntax tree from one EXCEPT expression.</span> +</span><span id="except_-3800"><a href="#except_-3800"><span class="linenos">3800</span></a> +</span><span id="except_-3801"><a href="#except_-3801"><span class="linenos">3801</span></a><span class="sd"> Example:</span> +</span><span id="except_-3802"><a href="#except_-3802"><span class="linenos">3802</span></a><span class="sd"> >>> except_("SELECT * FROM foo", "SELECT * FROM bla").sql()</span> +</span><span id="except_-3803"><a href="#except_-3803"><span class="linenos">3803</span></a><span class="sd"> 'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</span><span id="except_-3804"><a href="#except_-3804"><span class="linenos">3804</span></a> +</span><span id="except_-3805"><a href="#except_-3805"><span class="linenos">3805</span></a><span class="sd"> Args:</span> +</span><span id="except_-3806"><a href="#except_-3806"><span class="linenos">3806</span></a><span class="sd"> left (str | Expression): the SQL code string corresponding to the left-hand side.</span> +</span><span id="except_-3807"><a href="#except_-3807"><span class="linenos">3807</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="except_-3808"><a href="#except_-3808"><span class="linenos">3808</span></a><span class="sd"> right (str | Expression): the SQL code string corresponding to the right-hand side.</span> +</span><span id="except_-3809"><a href="#except_-3809"><span class="linenos">3809</span></a><span class="sd"> If an `Expression` instance is passed, it will be used as-is.</span> +</span><span id="except_-3810"><a href="#except_-3810"><span class="linenos">3810</span></a><span class="sd"> distinct (bool): set the DISTINCT flag if and only if this is true.</span> +</span><span id="except_-3811"><a href="#except_-3811"><span class="linenos">3811</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="except_-3812"><a href="#except_-3812"><span class="linenos">3812</span></a><span class="sd"> opts (kwargs): other options to use to parse the input expressions.</span> +</span><span id="except_-3813"><a href="#except_-3813"><span class="linenos">3813</span></a><span class="sd"> Returns:</span> +</span><span id="except_-3814"><a href="#except_-3814"><span class="linenos">3814</span></a><span class="sd"> Except: the syntax tree for the EXCEPT statement.</span> +</span><span id="except_-3815"><a href="#except_-3815"><span class="linenos">3815</span></a><span class="sd"> """</span> +</span><span id="except_-3816"><a href="#except_-3816"><span class="linenos">3816</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="except_-3817"><a href="#except_-3817"><span class="linenos">3817</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql_or_expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="except_-3818"><a href="#except_-3818"><span class="linenos">3818</span></a> +</span><span id="except_-3819"><a href="#except_-3819"><span class="linenos">3819</span></a> <span class="k">return</span> <span class="n">Except</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">left</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">right</span><span class="p">,</span> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Initializes a syntax tree from one EXCEPT expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">except_</span><span class="p">(</span><span class="s2">"SELECT * FROM foo"</span><span class="p">,</span> <span class="s2">"SELECT * FROM bla"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo EXCEPT SELECT * FROM bla'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>left (str | Expression):</strong> the SQL code string corresponding to the left-hand side. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>right (str | Expression):</strong> the SQL code string corresponding to the right-hand side. +If an <code><a href="#Expression">Expression</a></code> instance is passed, it will be used as-is.</li> +<li><strong>distinct (bool):</strong> set the DISTINCT flag if and only if this is true.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>opts (kwargs):</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Except: the syntax tree for the EXCEPT statement.</p> +</blockquote> +</div> + + + </section> + <section id="select"> + <input id="select-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">select</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="select-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#select"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="select-3822"><a href="#select-3822"><span class="linenos">3822</span></a><span class="k">def</span> <span class="nf">select</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="select-3823"><a href="#select-3823"><span class="linenos">3823</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="select-3824"><a href="#select-3824"><span class="linenos">3824</span></a><span class="sd"> Initializes a syntax tree from one or multiple SELECT expressions.</span> +</span><span id="select-3825"><a href="#select-3825"><span class="linenos">3825</span></a> +</span><span id="select-3826"><a href="#select-3826"><span class="linenos">3826</span></a><span class="sd"> Example:</span> +</span><span id="select-3827"><a href="#select-3827"><span class="linenos">3827</span></a><span class="sd"> >>> select("col1", "col2").from_("tbl").sql()</span> +</span><span id="select-3828"><a href="#select-3828"><span class="linenos">3828</span></a><span class="sd"> 'SELECT col1, col2 FROM tbl'</span> +</span><span id="select-3829"><a href="#select-3829"><span class="linenos">3829</span></a> +</span><span id="select-3830"><a href="#select-3830"><span class="linenos">3830</span></a><span class="sd"> Args:</span> +</span><span id="select-3831"><a href="#select-3831"><span class="linenos">3831</span></a><span class="sd"> *expressions (str | Expression): the SQL code string to parse as the expressions of a</span> +</span><span id="select-3832"><a href="#select-3832"><span class="linenos">3832</span></a><span class="sd"> SELECT statement. If an Expression instance is passed, this is used as-is.</span> +</span><span id="select-3833"><a href="#select-3833"><span class="linenos">3833</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions (in the case that an</span> +</span><span id="select-3834"><a href="#select-3834"><span class="linenos">3834</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="select-3835"><a href="#select-3835"><span class="linenos">3835</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="select-3836"><a href="#select-3836"><span class="linenos">3836</span></a><span class="sd"> that an input expression is a SQL string).</span> +</span><span id="select-3837"><a href="#select-3837"><span class="linenos">3837</span></a> +</span><span id="select-3838"><a href="#select-3838"><span class="linenos">3838</span></a><span class="sd"> Returns:</span> +</span><span id="select-3839"><a href="#select-3839"><span class="linenos">3839</span></a><span class="sd"> Select: the syntax tree for the SELECT statement.</span> +</span><span id="select-3840"><a href="#select-3840"><span class="linenos">3840</span></a><span class="sd"> """</span> +</span><span id="select-3841"><a href="#select-3841"><span class="linenos">3841</span></a> <span class="k">return</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Initializes a syntax tree from one or multiple SELECT expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">select</span><span class="p">(</span><span class="s2">"col1"</span><span class="p">,</span> <span class="s2">"col2"</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT col1, col2 FROM tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code string to parse as the expressions of a +SELECT statement. If an Expression instance is passed, this is used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions (in the case that an +input expression is a SQL string).</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case +that an input expression is a SQL string).</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the syntax tree for the SELECT statement.</p> +</blockquote> +</div> + + + </section> + <section id="from_"> + <input id="from_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">from_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Select">sqlglot.expressions.Select</a></span>:</span></span> + + <label class="view-source-button" for="from_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#from_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="from_-3844"><a href="#from_-3844"><span class="linenos">3844</span></a><span class="k">def</span> <span class="nf">from_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Select</span><span class="p">:</span> +</span><span id="from_-3845"><a href="#from_-3845"><span class="linenos">3845</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="from_-3846"><a href="#from_-3846"><span class="linenos">3846</span></a><span class="sd"> Initializes a syntax tree from a FROM expression.</span> +</span><span id="from_-3847"><a href="#from_-3847"><span class="linenos">3847</span></a> +</span><span id="from_-3848"><a href="#from_-3848"><span class="linenos">3848</span></a><span class="sd"> Example:</span> +</span><span id="from_-3849"><a href="#from_-3849"><span class="linenos">3849</span></a><span class="sd"> >>> from_("tbl").select("col1", "col2").sql()</span> +</span><span id="from_-3850"><a href="#from_-3850"><span class="linenos">3850</span></a><span class="sd"> 'SELECT col1, col2 FROM tbl'</span> +</span><span id="from_-3851"><a href="#from_-3851"><span class="linenos">3851</span></a> +</span><span id="from_-3852"><a href="#from_-3852"><span class="linenos">3852</span></a><span class="sd"> Args:</span> +</span><span id="from_-3853"><a href="#from_-3853"><span class="linenos">3853</span></a><span class="sd"> *expressions (str | Expression): the SQL code string to parse as the FROM expressions of a</span> +</span><span id="from_-3854"><a href="#from_-3854"><span class="linenos">3854</span></a><span class="sd"> SELECT statement. If an Expression instance is passed, this is used as-is.</span> +</span><span id="from_-3855"><a href="#from_-3855"><span class="linenos">3855</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression (in the case that the</span> +</span><span id="from_-3856"><a href="#from_-3856"><span class="linenos">3856</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="from_-3857"><a href="#from_-3857"><span class="linenos">3857</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="from_-3858"><a href="#from_-3858"><span class="linenos">3858</span></a><span class="sd"> that the input expression is a SQL string).</span> +</span><span id="from_-3859"><a href="#from_-3859"><span class="linenos">3859</span></a> +</span><span id="from_-3860"><a href="#from_-3860"><span class="linenos">3860</span></a><span class="sd"> Returns:</span> +</span><span id="from_-3861"><a href="#from_-3861"><span class="linenos">3861</span></a><span class="sd"> Select: the syntax tree for the SELECT statement.</span> +</span><span id="from_-3862"><a href="#from_-3862"><span class="linenos">3862</span></a><span class="sd"> """</span> +</span><span id="from_-3863"><a href="#from_-3863"><span class="linenos">3863</span></a> <span class="k">return</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Initializes a syntax tree from a FROM expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"col1"</span><span class="p">,</span> <span class="s2">"col2"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT col1, col2 FROM tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code string to parse as the FROM expressions of a +SELECT statement. If an Expression instance is passed, this is used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression (in the case that the +input expression is a SQL string).</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case +that the input expression is a SQL string).</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: the syntax tree for the SELECT statement.</p> +</blockquote> +</div> + + + </section> + <section id="update"> + <input id="update-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">update</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">table</span>,</span><span class="param"> <span class="n">properties</span>,</span><span class="param"> <span class="n">where</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">from_</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Update">sqlglot.expressions.Update</a></span>:</span></span> + + <label class="view-source-button" for="update-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#update"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="update-3866"><a href="#update-3866"><span class="linenos">3866</span></a><span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">properties</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">from_</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Update</span><span class="p">:</span> +</span><span id="update-3867"><a href="#update-3867"><span class="linenos">3867</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="update-3868"><a href="#update-3868"><span class="linenos">3868</span></a><span class="sd"> Creates an update statement.</span> +</span><span id="update-3869"><a href="#update-3869"><span class="linenos">3869</span></a> +</span><span id="update-3870"><a href="#update-3870"><span class="linenos">3870</span></a><span class="sd"> Example:</span> +</span><span id="update-3871"><a href="#update-3871"><span class="linenos">3871</span></a><span class="sd"> >>> update("my_table", {"x": 1, "y": "2", "z": None}, from_="baz", where="id > 1").sql()</span> +</span><span id="update-3872"><a href="#update-3872"><span class="linenos">3872</span></a><span class="sd"> "UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz WHERE id > 1"</span> +</span><span id="update-3873"><a href="#update-3873"><span class="linenos">3873</span></a> +</span><span id="update-3874"><a href="#update-3874"><span class="linenos">3874</span></a><span class="sd"> Args:</span> +</span><span id="update-3875"><a href="#update-3875"><span class="linenos">3875</span></a><span class="sd"> *properties (Dict[str, Any]): dictionary of properties to set which are</span> +</span><span id="update-3876"><a href="#update-3876"><span class="linenos">3876</span></a><span class="sd"> auto converted to sql objects eg None -> NULL</span> +</span><span id="update-3877"><a href="#update-3877"><span class="linenos">3877</span></a><span class="sd"> where (str): sql conditional parsed into a WHERE statement</span> +</span><span id="update-3878"><a href="#update-3878"><span class="linenos">3878</span></a><span class="sd"> from_ (str): sql statement parsed into a FROM statement</span> +</span><span id="update-3879"><a href="#update-3879"><span class="linenos">3879</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="update-3880"><a href="#update-3880"><span class="linenos">3880</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="update-3881"><a href="#update-3881"><span class="linenos">3881</span></a> +</span><span id="update-3882"><a href="#update-3882"><span class="linenos">3882</span></a><span class="sd"> Returns:</span> +</span><span id="update-3883"><a href="#update-3883"><span class="linenos">3883</span></a><span class="sd"> Update: the syntax tree for the UPDATE statement.</span> +</span><span id="update-3884"><a href="#update-3884"><span class="linenos">3884</span></a><span class="sd"> """</span> +</span><span id="update-3885"><a href="#update-3885"><span class="linenos">3885</span></a> <span class="n">update</span> <span class="o">=</span> <span class="n">Update</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">))</span> +</span><span id="update-3886"><a href="#update-3886"><span class="linenos">3886</span></a> <span class="n">update</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="update-3887"><a href="#update-3887"><span class="linenos">3887</span></a> <span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="update-3888"><a href="#update-3888"><span class="linenos">3888</span></a> <span class="p">[</span> +</span><span id="update-3889"><a href="#update-3889"><span class="linenos">3889</span></a> <span class="n">EQ</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> <span class="n">expression</span><span class="o">=</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">))</span> +</span><span id="update-3890"><a href="#update-3890"><span class="linenos">3890</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">properties</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="update-3891"><a href="#update-3891"><span class="linenos">3891</span></a> <span class="p">],</span> +</span><span id="update-3892"><a href="#update-3892"><span class="linenos">3892</span></a> <span class="p">)</span> +</span><span id="update-3893"><a href="#update-3893"><span class="linenos">3893</span></a> <span class="k">if</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="update-3894"><a href="#update-3894"><span class="linenos">3894</span></a> <span class="n">update</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="update-3895"><a href="#update-3895"><span class="linenos">3895</span></a> <span class="s2">"from"</span><span class="p">,</span> +</span><span id="update-3896"><a href="#update-3896"><span class="linenos">3896</span></a> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">from_</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">From</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"FROM"</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="update-3897"><a href="#update-3897"><span class="linenos">3897</span></a> <span class="p">)</span> +</span><span id="update-3898"><a href="#update-3898"><span class="linenos">3898</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">Condition</span><span class="p">):</span> +</span><span id="update-3899"><a href="#update-3899"><span class="linenos">3899</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">Where</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">where</span><span class="p">)</span> +</span><span id="update-3900"><a href="#update-3900"><span class="linenos">3900</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="update-3901"><a href="#update-3901"><span class="linenos">3901</span></a> <span class="n">update</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="update-3902"><a href="#update-3902"><span class="linenos">3902</span></a> <span class="s2">"where"</span><span class="p">,</span> +</span><span id="update-3903"><a href="#update-3903"><span class="linenos">3903</span></a> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WHERE"</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="update-3904"><a href="#update-3904"><span class="linenos">3904</span></a> <span class="p">)</span> +</span><span id="update-3905"><a href="#update-3905"><span class="linenos">3905</span></a> <span class="k">return</span> <span class="n">update</span> +</span></pre></div> + + + <div class="docstring"><p>Creates an update statement.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">update</span><span class="p">(</span><span class="s2">"my_table"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"x"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">"y"</span><span class="p">:</span> <span class="s2">"2"</span><span class="p">,</span> <span class="s2">"z"</span><span class="p">:</span> <span class="kc">None</span><span class="p">},</span> <span class="n">from_</span><span class="o">=</span><span class="s2">"baz"</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="s2">"id > 1"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">"UPDATE my_table SET x = 1, y = '2', z = NULL FROM baz WHERE id > 1"</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*properties (Dict[str, Any]):</strong> dictionary of properties to set which are +auto converted to sql objects eg None -> NULL</li> +<li><strong>where (str):</strong> sql conditional parsed into a WHERE statement</li> +<li><strong>from_ (str):</strong> sql statement parsed into a FROM statement</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Update: the syntax tree for the UPDATE statement.</p> +</blockquote> +</div> + + + </section> + <section id="delete"> + <input id="delete-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">delete</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">table</span>, </span><span class="param"><span class="n">where</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Delete">sqlglot.expressions.Delete</a></span>:</span></span> + + <label class="view-source-button" for="delete-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#delete"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="delete-3908"><a href="#delete-3908"><span class="linenos">3908</span></a><span class="k">def</span> <span class="nf">delete</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Delete</span><span class="p">:</span> +</span><span id="delete-3909"><a href="#delete-3909"><span class="linenos">3909</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="delete-3910"><a href="#delete-3910"><span class="linenos">3910</span></a><span class="sd"> Builds a delete statement.</span> +</span><span id="delete-3911"><a href="#delete-3911"><span class="linenos">3911</span></a> +</span><span id="delete-3912"><a href="#delete-3912"><span class="linenos">3912</span></a><span class="sd"> Example:</span> +</span><span id="delete-3913"><a href="#delete-3913"><span class="linenos">3913</span></a><span class="sd"> >>> delete("my_table", where="id > 1").sql()</span> +</span><span id="delete-3914"><a href="#delete-3914"><span class="linenos">3914</span></a><span class="sd"> 'DELETE FROM my_table WHERE id > 1'</span> +</span><span id="delete-3915"><a href="#delete-3915"><span class="linenos">3915</span></a> +</span><span id="delete-3916"><a href="#delete-3916"><span class="linenos">3916</span></a><span class="sd"> Args:</span> +</span><span id="delete-3917"><a href="#delete-3917"><span class="linenos">3917</span></a><span class="sd"> where (str|Condition): sql conditional parsed into a WHERE statement</span> +</span><span id="delete-3918"><a href="#delete-3918"><span class="linenos">3918</span></a><span class="sd"> dialect (str): the dialect used to parse the input expressions.</span> +</span><span id="delete-3919"><a href="#delete-3919"><span class="linenos">3919</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="delete-3920"><a href="#delete-3920"><span class="linenos">3920</span></a> +</span><span id="delete-3921"><a href="#delete-3921"><span class="linenos">3921</span></a><span class="sd"> Returns:</span> +</span><span id="delete-3922"><a href="#delete-3922"><span class="linenos">3922</span></a><span class="sd"> Delete: the syntax tree for the DELETE statement.</span> +</span><span id="delete-3923"><a href="#delete-3923"><span class="linenos">3923</span></a><span class="sd"> """</span> +</span><span id="delete-3924"><a href="#delete-3924"><span class="linenos">3924</span></a> <span class="k">return</span> <span class="n">Delete</span><span class="p">(</span> +</span><span id="delete-3925"><a href="#delete-3925"><span class="linenos">3925</span></a> <span class="n">this</span><span class="o">=</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="delete-3926"><a href="#delete-3926"><span class="linenos">3926</span></a> <span class="n">where</span><span class="o">=</span><span class="n">Where</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">where</span><span class="p">)</span> +</span><span id="delete-3927"><a href="#delete-3927"><span class="linenos">3927</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">Condition</span><span class="p">)</span> +</span><span id="delete-3928"><a href="#delete-3928"><span class="linenos">3928</span></a> <span class="k">else</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">where</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Where</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"WHERE"</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">),</span> +</span><span id="delete-3929"><a href="#delete-3929"><span class="linenos">3929</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Builds a delete statement.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">delete</span><span class="p">(</span><span class="s2">"my_table"</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="s2">"id > 1"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'DELETE FROM my_table WHERE id > 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>where (str|Condition):</strong> sql conditional parsed into a WHERE statement</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expressions.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Delete: the syntax tree for the DELETE statement.</p> +</blockquote> +</div> + + + </section> + <section id="condition"> + <input id="condition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">condition</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Condition">sqlglot.expressions.Condition</a></span>:</span></span> + + <label class="view-source-button" for="condition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#condition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="condition-3932"><a href="#condition-3932"><span class="linenos">3932</span></a><span class="k">def</span> <span class="nf">condition</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Condition</span><span class="p">:</span> +</span><span id="condition-3933"><a href="#condition-3933"><span class="linenos">3933</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="condition-3934"><a href="#condition-3934"><span class="linenos">3934</span></a><span class="sd"> Initialize a logical condition expression.</span> +</span><span id="condition-3935"><a href="#condition-3935"><span class="linenos">3935</span></a> +</span><span id="condition-3936"><a href="#condition-3936"><span class="linenos">3936</span></a><span class="sd"> Example:</span> +</span><span id="condition-3937"><a href="#condition-3937"><span class="linenos">3937</span></a><span class="sd"> >>> condition("x=1").sql()</span> +</span><span id="condition-3938"><a href="#condition-3938"><span class="linenos">3938</span></a><span class="sd"> 'x = 1'</span> +</span><span id="condition-3939"><a href="#condition-3939"><span class="linenos">3939</span></a> +</span><span id="condition-3940"><a href="#condition-3940"><span class="linenos">3940</span></a><span class="sd"> This is helpful for composing larger logical syntax trees:</span> +</span><span id="condition-3941"><a href="#condition-3941"><span class="linenos">3941</span></a><span class="sd"> >>> where = condition("x=1")</span> +</span><span id="condition-3942"><a href="#condition-3942"><span class="linenos">3942</span></a><span class="sd"> >>> where = where.and_("y=1")</span> +</span><span id="condition-3943"><a href="#condition-3943"><span class="linenos">3943</span></a><span class="sd"> >>> Select().from_("tbl").select("*").where(where).sql()</span> +</span><span id="condition-3944"><a href="#condition-3944"><span class="linenos">3944</span></a><span class="sd"> 'SELECT * FROM tbl WHERE x = 1 AND y = 1'</span> +</span><span id="condition-3945"><a href="#condition-3945"><span class="linenos">3945</span></a> +</span><span id="condition-3946"><a href="#condition-3946"><span class="linenos">3946</span></a><span class="sd"> Args:</span> +</span><span id="condition-3947"><a href="#condition-3947"><span class="linenos">3947</span></a><span class="sd"> *expression (str | Expression): the SQL code string to parse.</span> +</span><span id="condition-3948"><a href="#condition-3948"><span class="linenos">3948</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="condition-3949"><a href="#condition-3949"><span class="linenos">3949</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression (in the case that the</span> +</span><span id="condition-3950"><a href="#condition-3950"><span class="linenos">3950</span></a><span class="sd"> input expression is a SQL string).</span> +</span><span id="condition-3951"><a href="#condition-3951"><span class="linenos">3951</span></a><span class="sd"> **opts: other options to use to parse the input expressions (again, in the case</span> +</span><span id="condition-3952"><a href="#condition-3952"><span class="linenos">3952</span></a><span class="sd"> that the input expression is a SQL string).</span> +</span><span id="condition-3953"><a href="#condition-3953"><span class="linenos">3953</span></a> +</span><span id="condition-3954"><a href="#condition-3954"><span class="linenos">3954</span></a><span class="sd"> Returns:</span> +</span><span id="condition-3955"><a href="#condition-3955"><span class="linenos">3955</span></a><span class="sd"> Condition: the expression</span> +</span><span id="condition-3956"><a href="#condition-3956"><span class="linenos">3956</span></a><span class="sd"> """</span> +</span><span id="condition-3957"><a href="#condition-3957"><span class="linenos">3957</span></a> <span class="k">return</span> <span class="n">maybe_parse</span><span class="p">(</span> <span class="c1"># type: ignore</span> +</span><span id="condition-3958"><a href="#condition-3958"><span class="linenos">3958</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="condition-3959"><a href="#condition-3959"><span class="linenos">3959</span></a> <span class="n">into</span><span class="o">=</span><span class="n">Condition</span><span class="p">,</span> +</span><span id="condition-3960"><a href="#condition-3960"><span class="linenos">3960</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="condition-3961"><a href="#condition-3961"><span class="linenos">3961</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="condition-3962"><a href="#condition-3962"><span class="linenos">3962</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Initialize a logical condition expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">condition</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'x = 1'</span> +</code></pre> + </div> + + <p>This is helpful for composing larger logical syntax trees:</p> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">where</span> <span class="o">=</span> <span class="n">condition</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">where</span> <span class="o">=</span> <span class="n">where</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="s2">"y=1"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="s2">"tbl"</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">where</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM tbl WHERE x = 1 AND y = 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expression (str | Expression):</strong> the SQL code string to parse. +If an Expression instance is passed, this is used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression (in the case that the +input expression is a SQL string).</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions (again, in the case +that the input expression is a SQL string).</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Condition: the expression</p> +</blockquote> +</div> + + + </section> + <section id="and_"> + <input id="and_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">and_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#And">sqlglot.expressions.And</a></span>:</span></span> + + <label class="view-source-button" for="and_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#and_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="and_-3965"><a href="#and_-3965"><span class="linenos">3965</span></a><span class="k">def</span> <span class="nf">and_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">And</span><span class="p">:</span> +</span><span id="and_-3966"><a href="#and_-3966"><span class="linenos">3966</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="and_-3967"><a href="#and_-3967"><span class="linenos">3967</span></a><span class="sd"> Combine multiple conditions with an AND logical operator.</span> +</span><span id="and_-3968"><a href="#and_-3968"><span class="linenos">3968</span></a> +</span><span id="and_-3969"><a href="#and_-3969"><span class="linenos">3969</span></a><span class="sd"> Example:</span> +</span><span id="and_-3970"><a href="#and_-3970"><span class="linenos">3970</span></a><span class="sd"> >>> and_("x=1", and_("y=1", "z=1")).sql()</span> +</span><span id="and_-3971"><a href="#and_-3971"><span class="linenos">3971</span></a><span class="sd"> 'x = 1 AND (y = 1 AND z = 1)'</span> +</span><span id="and_-3972"><a href="#and_-3972"><span class="linenos">3972</span></a> +</span><span id="and_-3973"><a href="#and_-3973"><span class="linenos">3973</span></a><span class="sd"> Args:</span> +</span><span id="and_-3974"><a href="#and_-3974"><span class="linenos">3974</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="and_-3975"><a href="#and_-3975"><span class="linenos">3975</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="and_-3976"><a href="#and_-3976"><span class="linenos">3976</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="and_-3977"><a href="#and_-3977"><span class="linenos">3977</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="and_-3978"><a href="#and_-3978"><span class="linenos">3978</span></a> +</span><span id="and_-3979"><a href="#and_-3979"><span class="linenos">3979</span></a><span class="sd"> Returns:</span> +</span><span id="and_-3980"><a href="#and_-3980"><span class="linenos">3980</span></a><span class="sd"> And: the new condition</span> +</span><span id="and_-3981"><a href="#and_-3981"><span class="linenos">3981</span></a><span class="sd"> """</span> +</span><span id="and_-3982"><a href="#and_-3982"><span class="linenos">3982</span></a> <span class="k">return</span> <span class="n">_combine</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="n">And</span><span class="p">,</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Combine multiple conditions with an AND logical operator.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">and_</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">,</span> <span class="n">and_</span><span class="p">(</span><span class="s2">"y=1"</span><span class="p">,</span> <span class="s2">"z=1"</span><span class="p">))</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'x = 1 AND (y = 1 AND z = 1)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an Expression instance is passed, this is used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>And: the new condition</p> +</blockquote> +</div> + + + </section> + <section id="or_"> + <input id="or_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">or_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">*</span><span class="n">expressions</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Or">sqlglot.expressions.Or</a></span>:</span></span> + + <label class="view-source-button" for="or_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#or_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="or_-3985"><a href="#or_-3985"><span class="linenos">3985</span></a><span class="k">def</span> <span class="nf">or_</span><span class="p">(</span><span class="o">*</span><span class="n">expressions</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Or</span><span class="p">:</span> +</span><span id="or_-3986"><a href="#or_-3986"><span class="linenos">3986</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="or_-3987"><a href="#or_-3987"><span class="linenos">3987</span></a><span class="sd"> Combine multiple conditions with an OR logical operator.</span> +</span><span id="or_-3988"><a href="#or_-3988"><span class="linenos">3988</span></a> +</span><span id="or_-3989"><a href="#or_-3989"><span class="linenos">3989</span></a><span class="sd"> Example:</span> +</span><span id="or_-3990"><a href="#or_-3990"><span class="linenos">3990</span></a><span class="sd"> >>> or_("x=1", or_("y=1", "z=1")).sql()</span> +</span><span id="or_-3991"><a href="#or_-3991"><span class="linenos">3991</span></a><span class="sd"> 'x = 1 OR (y = 1 OR z = 1)'</span> +</span><span id="or_-3992"><a href="#or_-3992"><span class="linenos">3992</span></a> +</span><span id="or_-3993"><a href="#or_-3993"><span class="linenos">3993</span></a><span class="sd"> Args:</span> +</span><span id="or_-3994"><a href="#or_-3994"><span class="linenos">3994</span></a><span class="sd"> *expressions (str | Expression): the SQL code strings to parse.</span> +</span><span id="or_-3995"><a href="#or_-3995"><span class="linenos">3995</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="or_-3996"><a href="#or_-3996"><span class="linenos">3996</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="or_-3997"><a href="#or_-3997"><span class="linenos">3997</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="or_-3998"><a href="#or_-3998"><span class="linenos">3998</span></a> +</span><span id="or_-3999"><a href="#or_-3999"><span class="linenos">3999</span></a><span class="sd"> Returns:</span> +</span><span id="or_-4000"><a href="#or_-4000"><span class="linenos">4000</span></a><span class="sd"> Or: the new condition</span> +</span><span id="or_-4001"><a href="#or_-4001"><span class="linenos">4001</span></a><span class="sd"> """</span> +</span><span id="or_-4002"><a href="#or_-4002"><span class="linenos">4002</span></a> <span class="k">return</span> <span class="n">_combine</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="n">Or</span><span class="p">,</span> <span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Combine multiple conditions with an OR logical operator.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">or_</span><span class="p">(</span><span class="s2">"x=1"</span><span class="p">,</span> <span class="n">or_</span><span class="p">(</span><span class="s2">"y=1"</span><span class="p">,</span> <span class="s2">"z=1"</span><span class="p">))</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'x = 1 OR (y = 1 OR z = 1)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>*expressions (str | Expression):</strong> the SQL code strings to parse. +If an Expression instance is passed, this is used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Or: the new condition</p> +</blockquote> +</div> + + + </section> + <section id="not_"> + <input id="not_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">not_</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Not">sqlglot.expressions.Not</a></span>:</span></span> + + <label class="view-source-button" for="not_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#not_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="not_-4005"><a href="#not_-4005"><span class="linenos">4005</span></a><span class="k">def</span> <span class="nf">not_</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Not</span><span class="p">:</span> +</span><span id="not_-4006"><a href="#not_-4006"><span class="linenos">4006</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="not_-4007"><a href="#not_-4007"><span class="linenos">4007</span></a><span class="sd"> Wrap a condition with a NOT operator.</span> +</span><span id="not_-4008"><a href="#not_-4008"><span class="linenos">4008</span></a> +</span><span id="not_-4009"><a href="#not_-4009"><span class="linenos">4009</span></a><span class="sd"> Example:</span> +</span><span id="not_-4010"><a href="#not_-4010"><span class="linenos">4010</span></a><span class="sd"> >>> not_("this_suit='black'").sql()</span> +</span><span id="not_-4011"><a href="#not_-4011"><span class="linenos">4011</span></a><span class="sd"> "NOT this_suit = 'black'"</span> +</span><span id="not_-4012"><a href="#not_-4012"><span class="linenos">4012</span></a> +</span><span id="not_-4013"><a href="#not_-4013"><span class="linenos">4013</span></a><span class="sd"> Args:</span> +</span><span id="not_-4014"><a href="#not_-4014"><span class="linenos">4014</span></a><span class="sd"> expression (str | Expression): the SQL code strings to parse.</span> +</span><span id="not_-4015"><a href="#not_-4015"><span class="linenos">4015</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="not_-4016"><a href="#not_-4016"><span class="linenos">4016</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="not_-4017"><a href="#not_-4017"><span class="linenos">4017</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="not_-4018"><a href="#not_-4018"><span class="linenos">4018</span></a> +</span><span id="not_-4019"><a href="#not_-4019"><span class="linenos">4019</span></a><span class="sd"> Returns:</span> +</span><span id="not_-4020"><a href="#not_-4020"><span class="linenos">4020</span></a><span class="sd"> Not: the new condition</span> +</span><span id="not_-4021"><a href="#not_-4021"><span class="linenos">4021</span></a><span class="sd"> """</span> +</span><span id="not_-4022"><a href="#not_-4022"><span class="linenos">4022</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">condition</span><span class="p">(</span> +</span><span id="not_-4023"><a href="#not_-4023"><span class="linenos">4023</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="not_-4024"><a href="#not_-4024"><span class="linenos">4024</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="not_-4025"><a href="#not_-4025"><span class="linenos">4025</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="not_-4026"><a href="#not_-4026"><span class="linenos">4026</span></a> <span class="p">)</span> +</span><span id="not_-4027"><a href="#not_-4027"><span class="linenos">4027</span></a> <span class="k">return</span> <span class="n">Not</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">_wrap_operator</span><span class="p">(</span><span class="n">this</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Wrap a condition with a NOT operator.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">not_</span><span class="p">(</span><span class="s2">"this_suit='black'"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">"NOT this_suit = 'black'"</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | Expression):</strong> the SQL code strings to parse. +If an Expression instance is passed, this is used as-is.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Not: the new condition</p> +</blockquote> +</div> + + + </section> + <section id="paren"> + <input id="paren-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">paren</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">) -> <span class="n"><a href="#Paren">sqlglot.expressions.Paren</a></span>:</span></span> + + <label class="view-source-button" for="paren-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#paren"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="paren-4030"><a href="#paren-4030"><span class="linenos">4030</span></a><span class="k">def</span> <span class="nf">paren</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">Paren</span><span class="p">:</span> +</span><span id="paren-4031"><a href="#paren-4031"><span class="linenos">4031</span></a> <span class="k">return</span> <span class="n">Paren</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="to_identifier"> + <input id="to_identifier-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">to_identifier</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">name</span>, </span><span class="param"><span class="n">quoted</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="to_identifier-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#to_identifier"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="to_identifier-4047"><a href="#to_identifier-4047"><span class="linenos">4047</span></a><span class="k">def</span> <span class="nf">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="to_identifier-4048"><a href="#to_identifier-4048"><span class="linenos">4048</span></a><span class="w"> </span><span class="sd">"""Builds an identifier.</span> +</span><span id="to_identifier-4049"><a href="#to_identifier-4049"><span class="linenos">4049</span></a> +</span><span id="to_identifier-4050"><a href="#to_identifier-4050"><span class="linenos">4050</span></a><span class="sd"> Args:</span> +</span><span id="to_identifier-4051"><a href="#to_identifier-4051"><span class="linenos">4051</span></a><span class="sd"> name: The name to turn into an identifier.</span> +</span><span id="to_identifier-4052"><a href="#to_identifier-4052"><span class="linenos">4052</span></a><span class="sd"> quoted: Whether or not force quote the identifier.</span> +</span><span id="to_identifier-4053"><a href="#to_identifier-4053"><span class="linenos">4053</span></a> +</span><span id="to_identifier-4054"><a href="#to_identifier-4054"><span class="linenos">4054</span></a><span class="sd"> Returns:</span> +</span><span id="to_identifier-4055"><a href="#to_identifier-4055"><span class="linenos">4055</span></a><span class="sd"> The identifier ast node.</span> +</span><span id="to_identifier-4056"><a href="#to_identifier-4056"><span class="linenos">4056</span></a><span class="sd"> """</span> +</span><span id="to_identifier-4057"><a href="#to_identifier-4057"><span class="linenos">4057</span></a> +</span><span id="to_identifier-4058"><a href="#to_identifier-4058"><span class="linenos">4058</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="to_identifier-4059"><a href="#to_identifier-4059"><span class="linenos">4059</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="to_identifier-4060"><a href="#to_identifier-4060"><span class="linenos">4060</span></a> +</span><span id="to_identifier-4061"><a href="#to_identifier-4061"><span class="linenos">4061</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">Identifier</span><span class="p">):</span> +</span><span id="to_identifier-4062"><a href="#to_identifier-4062"><span class="linenos">4062</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">name</span> +</span><span id="to_identifier-4063"><a href="#to_identifier-4063"><span class="linenos">4063</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="to_identifier-4064"><a href="#to_identifier-4064"><span class="linenos">4064</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">Identifier</span><span class="p">(</span> +</span><span id="to_identifier-4065"><a href="#to_identifier-4065"><span class="linenos">4065</span></a> <span class="n">this</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> +</span><span id="to_identifier-4066"><a href="#to_identifier-4066"><span class="linenos">4066</span></a> <span class="n">quoted</span><span class="o">=</span><span class="ow">not</span> <span class="n">re</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">SAFE_IDENTIFIER_RE</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> <span class="k">if</span> <span class="n">quoted</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">quoted</span><span class="p">,</span> +</span><span id="to_identifier-4067"><a href="#to_identifier-4067"><span class="linenos">4067</span></a> <span class="p">)</span> +</span><span id="to_identifier-4068"><a href="#to_identifier-4068"><span class="linenos">4068</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="to_identifier-4069"><a href="#to_identifier-4069"><span class="linenos">4069</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Name needs to be a string or an Identifier, got: </span><span class="si">{</span><span class="n">name</span><span class="o">.</span><span class="vm">__class__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="to_identifier-4070"><a href="#to_identifier-4070"><span class="linenos">4070</span></a> <span class="k">return</span> <span class="n">identifier</span> +</span></pre></div> + + + <div class="docstring"><p>Builds an identifier.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>name:</strong> The name to turn into an identifier.</li> +<li><strong>quoted:</strong> Whether or not force quote the identifier.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The identifier ast node.</p> +</blockquote> +</div> + + + </section> + <section id="to_interval"> + <input id="to_interval-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">to_interval</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">interval</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Literal">sqlglot.expressions.Literal</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#Interval">sqlglot.expressions.Interval</a></span>:</span></span> + + <label class="view-source-button" for="to_interval-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#to_interval"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="to_interval-4076"><a href="#to_interval-4076"><span class="linenos">4076</span></a><span class="k">def</span> <span class="nf">to_interval</span><span class="p">(</span><span class="n">interval</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Literal</span><span class="p">)</span> <span class="o">-></span> <span class="n">Interval</span><span class="p">:</span> +</span><span id="to_interval-4077"><a href="#to_interval-4077"><span class="linenos">4077</span></a><span class="w"> </span><span class="sd">"""Builds an interval expression from a string like '1 day' or '5 months'."""</span> +</span><span id="to_interval-4078"><a href="#to_interval-4078"><span class="linenos">4078</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">interval</span><span class="p">,</span> <span class="n">Literal</span><span class="p">):</span> +</span><span id="to_interval-4079"><a href="#to_interval-4079"><span class="linenos">4079</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">interval</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="to_interval-4080"><a href="#to_interval-4080"><span class="linenos">4080</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid interval string."</span><span class="p">)</span> +</span><span id="to_interval-4081"><a href="#to_interval-4081"><span class="linenos">4081</span></a> +</span><span id="to_interval-4082"><a href="#to_interval-4082"><span class="linenos">4082</span></a> <span class="n">interval</span> <span class="o">=</span> <span class="n">interval</span><span class="o">.</span><span class="n">this</span> +</span><span id="to_interval-4083"><a href="#to_interval-4083"><span class="linenos">4083</span></a> +</span><span id="to_interval-4084"><a href="#to_interval-4084"><span class="linenos">4084</span></a> <span class="n">interval_parts</span> <span class="o">=</span> <span class="n">INTERVAL_STRING_RE</span><span class="o">.</span><span class="n">match</span><span class="p">(</span><span class="n">interval</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="to_interval-4085"><a href="#to_interval-4085"><span class="linenos">4085</span></a> +</span><span id="to_interval-4086"><a href="#to_interval-4086"><span class="linenos">4086</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">interval_parts</span><span class="p">:</span> +</span><span id="to_interval-4087"><a href="#to_interval-4087"><span class="linenos">4087</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Invalid interval string."</span><span class="p">)</span> +</span><span id="to_interval-4088"><a href="#to_interval-4088"><span class="linenos">4088</span></a> +</span><span id="to_interval-4089"><a href="#to_interval-4089"><span class="linenos">4089</span></a> <span class="k">return</span> <span class="n">Interval</span><span class="p">(</span> +</span><span id="to_interval-4090"><a href="#to_interval-4090"><span class="linenos">4090</span></a> <span class="n">this</span><span class="o">=</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">interval_parts</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">1</span><span class="p">)),</span> +</span><span id="to_interval-4091"><a href="#to_interval-4091"><span class="linenos">4091</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">interval_parts</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="mi">2</span><span class="p">)),</span> +</span><span id="to_interval-4092"><a href="#to_interval-4092"><span class="linenos">4092</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Builds an interval expression from a string like '1 day' or '5 months'.</p> +</div> + + + </section> + <section id="to_table"> + <input id="to_table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">to_table</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql_path</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Table">sqlglot.expressions.Table</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="#Table">sqlglot.expressions.Table</a></span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="to_table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#to_table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="to_table-4105"><a href="#to_table-4105"><span class="linenos">4105</span></a><span class="k">def</span> <span class="nf">to_table</span><span class="p">(</span><span class="n">sql_path</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Table</span><span class="p">]:</span> +</span><span id="to_table-4106"><a href="#to_table-4106"><span class="linenos">4106</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="to_table-4107"><a href="#to_table-4107"><span class="linenos">4107</span></a><span class="sd"> Create a table expression from a `[catalog].[schema].[table]` sql path. Catalog and schema are optional.</span> +</span><span id="to_table-4108"><a href="#to_table-4108"><span class="linenos">4108</span></a><span class="sd"> If a table is passed in then that table is returned.</span> +</span><span id="to_table-4109"><a href="#to_table-4109"><span class="linenos">4109</span></a> +</span><span id="to_table-4110"><a href="#to_table-4110"><span class="linenos">4110</span></a><span class="sd"> Args:</span> +</span><span id="to_table-4111"><a href="#to_table-4111"><span class="linenos">4111</span></a><span class="sd"> sql_path: a `[catalog].[schema].[table]` string.</span> +</span><span id="to_table-4112"><a href="#to_table-4112"><span class="linenos">4112</span></a> +</span><span id="to_table-4113"><a href="#to_table-4113"><span class="linenos">4113</span></a><span class="sd"> Returns:</span> +</span><span id="to_table-4114"><a href="#to_table-4114"><span class="linenos">4114</span></a><span class="sd"> A table expression.</span> +</span><span id="to_table-4115"><a href="#to_table-4115"><span class="linenos">4115</span></a><span class="sd"> """</span> +</span><span id="to_table-4116"><a href="#to_table-4116"><span class="linenos">4116</span></a> <span class="k">if</span> <span class="n">sql_path</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="to_table-4117"><a href="#to_table-4117"><span class="linenos">4117</span></a> <span class="k">return</span> <span class="n">sql_path</span> +</span><span id="to_table-4118"><a href="#to_table-4118"><span class="linenos">4118</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="to_table-4119"><a href="#to_table-4119"><span class="linenos">4119</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid type provided for a table: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">sql_path</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="to_table-4120"><a href="#to_table-4120"><span class="linenos">4120</span></a> +</span><span id="to_table-4121"><a href="#to_table-4121"><span class="linenos">4121</span></a> <span class="n">catalog</span><span class="p">,</span> <span class="n">db</span><span class="p">,</span> <span class="n">table_name</span> <span class="o">=</span> <span class="p">(</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">split_num_words</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> +</span><span id="to_table-4122"><a href="#to_table-4122"><span class="linenos">4122</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">table_name</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="n">catalog</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Create a table expression from a <code>[catalog].[schema].[table]</code> sql path. Catalog and schema are optional. +If a table is passed in then that table is returned.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql_path:</strong> a <code>[catalog].[schema].[table]</code> string.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A table expression.</p> +</blockquote> +</div> + + + </section> + <section id="to_column"> + <input id="to_column-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">to_column</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">sql_path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Column">sqlglot.expressions.Column</a></span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.expressions.Column</a></span>:</span></span> + + <label class="view-source-button" for="to_column-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#to_column"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="to_column-4125"><a href="#to_column-4125"><span class="linenos">4125</span></a><span class="k">def</span> <span class="nf">to_column</span><span class="p">(</span><span class="n">sql_path</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Column</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="to_column-4126"><a href="#to_column-4126"><span class="linenos">4126</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="to_column-4127"><a href="#to_column-4127"><span class="linenos">4127</span></a><span class="sd"> Create a column from a `[table].[column]` sql path. Schema is optional.</span> +</span><span id="to_column-4128"><a href="#to_column-4128"><span class="linenos">4128</span></a> +</span><span id="to_column-4129"><a href="#to_column-4129"><span class="linenos">4129</span></a><span class="sd"> If a column is passed in then that column is returned.</span> +</span><span id="to_column-4130"><a href="#to_column-4130"><span class="linenos">4130</span></a> +</span><span id="to_column-4131"><a href="#to_column-4131"><span class="linenos">4131</span></a><span class="sd"> Args:</span> +</span><span id="to_column-4132"><a href="#to_column-4132"><span class="linenos">4132</span></a><span class="sd"> sql_path: `[table].[column]` string</span> +</span><span id="to_column-4133"><a href="#to_column-4133"><span class="linenos">4133</span></a><span class="sd"> Returns:</span> +</span><span id="to_column-4134"><a href="#to_column-4134"><span class="linenos">4134</span></a><span class="sd"> Table: A column expression</span> +</span><span id="to_column-4135"><a href="#to_column-4135"><span class="linenos">4135</span></a><span class="sd"> """</span> +</span><span id="to_column-4136"><a href="#to_column-4136"><span class="linenos">4136</span></a> <span class="k">if</span> <span class="n">sql_path</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="n">Column</span><span class="p">):</span> +</span><span id="to_column-4137"><a href="#to_column-4137"><span class="linenos">4137</span></a> <span class="k">return</span> <span class="n">sql_path</span> +</span><span id="to_column-4138"><a href="#to_column-4138"><span class="linenos">4138</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="to_column-4139"><a href="#to_column-4139"><span class="linenos">4139</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid type provided for column: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">sql_path</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="to_column-4140"><a href="#to_column-4140"><span class="linenos">4140</span></a> <span class="n">table_name</span><span class="p">,</span> <span class="n">column_name</span> <span class="o">=</span> <span class="p">(</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">split_num_words</span><span class="p">(</span><span class="n">sql_path</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> +</span><span id="to_column-4141"><a href="#to_column-4141"><span class="linenos">4141</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">column_name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">table_name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Create a column from a <code>[table].[column]</code> sql path. Schema is optional.</p> + +<p>If a column is passed in then that column is returned.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>sql_path:</strong> <code>[table].[column]</code> string</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Table: A column expression</p> +</blockquote> +</div> + + + </section> + <section id="alias_"> + <input id="alias_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">alias_</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">alias</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Identifier">sqlglot.expressions.Identifier</a></span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">bool</span><span class="p">,</span> <span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Identifier">sqlglot.expressions.Identifier</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">False</span>,</span><span class="param"> <span class="n">quoted</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="alias_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#alias_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="alias_-4144"><a href="#alias_-4144"><span class="linenos">4144</span></a><span class="k">def</span> <span class="nf">alias_</span><span class="p">(</span> +</span><span id="alias_-4145"><a href="#alias_-4145"><span class="linenos">4145</span></a> <span class="n">expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> +</span><span id="alias_-4146"><a href="#alias_-4146"><span class="linenos">4146</span></a> <span class="n">alias</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Identifier</span><span class="p">,</span> +</span><span id="alias_-4147"><a href="#alias_-4147"><span class="linenos">4147</span></a> <span class="n">table</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">Identifier</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="alias_-4148"><a href="#alias_-4148"><span class="linenos">4148</span></a> <span class="n">quoted</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="alias_-4149"><a href="#alias_-4149"><span class="linenos">4149</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="alias_-4150"><a href="#alias_-4150"><span class="linenos">4150</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="alias_-4151"><a href="#alias_-4151"><span class="linenos">4151</span></a><span class="p">):</span> +</span><span id="alias_-4152"><a href="#alias_-4152"><span class="linenos">4152</span></a><span class="w"> </span><span class="sd">"""Create an Alias expression.</span> +</span><span id="alias_-4153"><a href="#alias_-4153"><span class="linenos">4153</span></a> +</span><span id="alias_-4154"><a href="#alias_-4154"><span class="linenos">4154</span></a><span class="sd"> Example:</span> +</span><span id="alias_-4155"><a href="#alias_-4155"><span class="linenos">4155</span></a><span class="sd"> >>> alias_('foo', 'bar').sql()</span> +</span><span id="alias_-4156"><a href="#alias_-4156"><span class="linenos">4156</span></a><span class="sd"> 'foo AS bar'</span> +</span><span id="alias_-4157"><a href="#alias_-4157"><span class="linenos">4157</span></a> +</span><span id="alias_-4158"><a href="#alias_-4158"><span class="linenos">4158</span></a><span class="sd"> >>> alias_('(select 1, 2)', 'bar', table=['a', 'b']).sql()</span> +</span><span id="alias_-4159"><a href="#alias_-4159"><span class="linenos">4159</span></a><span class="sd"> '(SELECT 1, 2) AS bar(a, b)'</span> +</span><span id="alias_-4160"><a href="#alias_-4160"><span class="linenos">4160</span></a> +</span><span id="alias_-4161"><a href="#alias_-4161"><span class="linenos">4161</span></a><span class="sd"> Args:</span> +</span><span id="alias_-4162"><a href="#alias_-4162"><span class="linenos">4162</span></a><span class="sd"> expression: the SQL code strings to parse.</span> +</span><span id="alias_-4163"><a href="#alias_-4163"><span class="linenos">4163</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="alias_-4164"><a href="#alias_-4164"><span class="linenos">4164</span></a><span class="sd"> alias: the alias name to use. If the name has</span> +</span><span id="alias_-4165"><a href="#alias_-4165"><span class="linenos">4165</span></a><span class="sd"> special characters it is quoted.</span> +</span><span id="alias_-4166"><a href="#alias_-4166"><span class="linenos">4166</span></a><span class="sd"> table: Whether or not to create a table alias, can also be a list of columns.</span> +</span><span id="alias_-4167"><a href="#alias_-4167"><span class="linenos">4167</span></a><span class="sd"> quoted: whether or not to quote the alias</span> +</span><span id="alias_-4168"><a href="#alias_-4168"><span class="linenos">4168</span></a><span class="sd"> dialect: the dialect used to parse the input expression.</span> +</span><span id="alias_-4169"><a href="#alias_-4169"><span class="linenos">4169</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="alias_-4170"><a href="#alias_-4170"><span class="linenos">4170</span></a> +</span><span id="alias_-4171"><a href="#alias_-4171"><span class="linenos">4171</span></a><span class="sd"> Returns:</span> +</span><span id="alias_-4172"><a href="#alias_-4172"><span class="linenos">4172</span></a><span class="sd"> Alias: the aliased expression</span> +</span><span id="alias_-4173"><a href="#alias_-4173"><span class="linenos">4173</span></a><span class="sd"> """</span> +</span><span id="alias_-4174"><a href="#alias_-4174"><span class="linenos">4174</span></a> <span class="n">exp</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="alias_-4175"><a href="#alias_-4175"><span class="linenos">4175</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">)</span> +</span><span id="alias_-4176"><a href="#alias_-4176"><span class="linenos">4176</span></a> +</span><span id="alias_-4177"><a href="#alias_-4177"><span class="linenos">4177</span></a> <span class="k">if</span> <span class="n">table</span><span class="p">:</span> +</span><span id="alias_-4178"><a href="#alias_-4178"><span class="linenos">4178</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span> +</span><span id="alias_-4179"><a href="#alias_-4179"><span class="linenos">4179</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="alias_-4180"><a href="#alias_-4180"><span class="linenos">4180</span></a> +</span><span id="alias_-4181"><a href="#alias_-4181"><span class="linenos">4181</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="nb">bool</span><span class="p">):</span> +</span><span id="alias_-4182"><a href="#alias_-4182"><span class="linenos">4182</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">table</span><span class="p">:</span> +</span><span id="alias_-4183"><a href="#alias_-4183"><span class="linenos">4183</span></a> <span class="n">table_alias</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">to_identifier</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">))</span> +</span><span id="alias_-4184"><a href="#alias_-4184"><span class="linenos">4184</span></a> +</span><span id="alias_-4185"><a href="#alias_-4185"><span class="linenos">4185</span></a> <span class="k">return</span> <span class="n">exp</span> +</span><span id="alias_-4186"><a href="#alias_-4186"><span class="linenos">4186</span></a> +</span><span id="alias_-4187"><a href="#alias_-4187"><span class="linenos">4187</span></a> <span class="c1"># We don't set the "alias" arg for Window expressions, because that would add an IDENTIFIER node in</span> +</span><span id="alias_-4188"><a href="#alias_-4188"><span class="linenos">4188</span></a> <span class="c1"># the AST, representing a "named_window" [1] construct (eg. bigquery). What we want is an ALIAS node</span> +</span><span id="alias_-4189"><a href="#alias_-4189"><span class="linenos">4189</span></a> <span class="c1"># for the complete Window expression.</span> +</span><span id="alias_-4190"><a href="#alias_-4190"><span class="linenos">4190</span></a> <span class="c1">#</span> +</span><span id="alias_-4191"><a href="#alias_-4191"><span class="linenos">4191</span></a> <span class="c1"># [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls</span> +</span><span id="alias_-4192"><a href="#alias_-4192"><span class="linenos">4192</span></a> +</span><span id="alias_-4193"><a href="#alias_-4193"><span class="linenos">4193</span></a> <span class="k">if</span> <span class="s2">"alias"</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">arg_types</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">exp</span><span class="p">,</span> <span class="n">Window</span><span class="p">):</span> +</span><span id="alias_-4194"><a href="#alias_-4194"><span class="linenos">4194</span></a> <span class="n">exp</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="alias_-4195"><a href="#alias_-4195"><span class="linenos">4195</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="alias_-4196"><a href="#alias_-4196"><span class="linenos">4196</span></a> <span class="k">return</span> <span class="n">exp</span> +</span><span id="alias_-4197"><a href="#alias_-4197"><span class="linenos">4197</span></a> <span class="k">return</span> <span class="n">Alias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Create an Alias expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">alias_</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span> <span class="s1">'bar'</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'foo AS bar'</span> +</code></pre> + </div> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">alias_</span><span class="p">(</span><span class="s1">'(select 1, 2)'</span><span class="p">,</span> <span class="s1">'bar'</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="p">[</span><span class="s1">'a'</span><span class="p">,</span> <span class="s1">'b'</span><span class="p">])</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'(SELECT 1, 2) AS bar(a, b)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the SQL code strings to parse. +If an Expression instance is passed, this is used as-is.</li> +<li><strong>alias:</strong> the alias name to use. If the name has +special characters it is quoted.</li> +<li><strong>table:</strong> Whether or not to create a table alias, can also be a list of columns.</li> +<li><strong>quoted:</strong> whether or not to quote the alias</li> +<li><strong>dialect:</strong> the dialect used to parse the input expression.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Alias: the aliased expression</p> +</blockquote> +</div> + + + </section> + <section id="subquery"> + <input id="subquery-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">subquery</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">alias</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">dialect</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="subquery-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#subquery"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="subquery-4200"><a href="#subquery-4200"><span class="linenos">4200</span></a><span class="k">def</span> <span class="nf">subquery</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">):</span> +</span><span id="subquery-4201"><a href="#subquery-4201"><span class="linenos">4201</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="subquery-4202"><a href="#subquery-4202"><span class="linenos">4202</span></a><span class="sd"> Build a subquery expression.</span> +</span><span id="subquery-4203"><a href="#subquery-4203"><span class="linenos">4203</span></a> +</span><span id="subquery-4204"><a href="#subquery-4204"><span class="linenos">4204</span></a><span class="sd"> Example:</span> +</span><span id="subquery-4205"><a href="#subquery-4205"><span class="linenos">4205</span></a><span class="sd"> >>> subquery('select x from tbl', 'bar').select('x').sql()</span> +</span><span id="subquery-4206"><a href="#subquery-4206"><span class="linenos">4206</span></a><span class="sd"> 'SELECT x FROM (SELECT x FROM tbl) AS bar'</span> +</span><span id="subquery-4207"><a href="#subquery-4207"><span class="linenos">4207</span></a> +</span><span id="subquery-4208"><a href="#subquery-4208"><span class="linenos">4208</span></a><span class="sd"> Args:</span> +</span><span id="subquery-4209"><a href="#subquery-4209"><span class="linenos">4209</span></a><span class="sd"> expression (str | Expression): the SQL code strings to parse.</span> +</span><span id="subquery-4210"><a href="#subquery-4210"><span class="linenos">4210</span></a><span class="sd"> If an Expression instance is passed, this is used as-is.</span> +</span><span id="subquery-4211"><a href="#subquery-4211"><span class="linenos">4211</span></a><span class="sd"> alias (str | Expression): the alias name to use.</span> +</span><span id="subquery-4212"><a href="#subquery-4212"><span class="linenos">4212</span></a><span class="sd"> dialect (str): the dialect used to parse the input expression.</span> +</span><span id="subquery-4213"><a href="#subquery-4213"><span class="linenos">4213</span></a><span class="sd"> **opts: other options to use to parse the input expressions.</span> +</span><span id="subquery-4214"><a href="#subquery-4214"><span class="linenos">4214</span></a> +</span><span id="subquery-4215"><a href="#subquery-4215"><span class="linenos">4215</span></a><span class="sd"> Returns:</span> +</span><span id="subquery-4216"><a href="#subquery-4216"><span class="linenos">4216</span></a><span class="sd"> Select: a new select with the subquery expression included</span> +</span><span id="subquery-4217"><a href="#subquery-4217"><span class="linenos">4217</span></a><span class="sd"> """</span> +</span><span id="subquery-4218"><a href="#subquery-4218"><span class="linenos">4218</span></a> +</span><span id="subquery-4219"><a href="#subquery-4219"><span class="linenos">4219</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="subquery-4220"><a href="#subquery-4220"><span class="linenos">4220</span></a> <span class="k">return</span> <span class="n">Select</span><span class="p">()</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Build a subquery expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">subquery</span><span class="p">(</span><span class="s1">'select x from tbl'</span><span class="p">,</span> <span class="s1">'bar'</span><span class="p">)</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s1">'x'</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x FROM (SELECT x FROM tbl) AS bar'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (str | Expression):</strong> the SQL code strings to parse. +If an Expression instance is passed, this is used as-is.</li> +<li><strong>alias (str | Expression):</strong> the alias name to use.</li> +<li><strong>dialect (str):</strong> the dialect used to parse the input expression.</li> +<li><strong>**opts:</strong> other options to use to parse the input expressions.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Select: a new select with the subquery expression included</p> +</blockquote> +</div> + + + </section> + <section id="column"> + <input id="column-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">column</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">col</span>, </span><span class="param"><span class="n">table</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">quoted</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Column">sqlglot.expressions.Column</a></span>:</span></span> + + <label class="view-source-button" for="column-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#column"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="column-4223"><a href="#column-4223"><span class="linenos">4223</span></a><span class="k">def</span> <span class="nf">column</span><span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">Column</span><span class="p">:</span> +</span><span id="column-4224"><a href="#column-4224"><span class="linenos">4224</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="column-4225"><a href="#column-4225"><span class="linenos">4225</span></a><span class="sd"> Build a Column.</span> +</span><span id="column-4226"><a href="#column-4226"><span class="linenos">4226</span></a> +</span><span id="column-4227"><a href="#column-4227"><span class="linenos">4227</span></a><span class="sd"> Args:</span> +</span><span id="column-4228"><a href="#column-4228"><span class="linenos">4228</span></a><span class="sd"> col (str | Expression): column name</span> +</span><span id="column-4229"><a href="#column-4229"><span class="linenos">4229</span></a><span class="sd"> table (str | Expression): table name</span> +</span><span id="column-4230"><a href="#column-4230"><span class="linenos">4230</span></a><span class="sd"> Returns:</span> +</span><span id="column-4231"><a href="#column-4231"><span class="linenos">4231</span></a><span class="sd"> Column: column instance</span> +</span><span id="column-4232"><a href="#column-4232"><span class="linenos">4232</span></a><span class="sd"> """</span> +</span><span id="column-4233"><a href="#column-4233"><span class="linenos">4233</span></a> <span class="k">return</span> <span class="n">Column</span><span class="p">(</span> +</span><span id="column-4234"><a href="#column-4234"><span class="linenos">4234</span></a> <span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">col</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="column-4235"><a href="#column-4235"><span class="linenos">4235</span></a> <span class="n">table</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="column-4236"><a href="#column-4236"><span class="linenos">4236</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Build a Column.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>col (str | Expression):</strong> column name</li> +<li><strong>table (str | Expression):</strong> table name</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Column: column instance</p> +</blockquote> +</div> + + + </section> + <section id="cast"> + <input id="cast-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cast</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">to</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#DataType">sqlglot.expressions.DataType</a></span> <span class="o">|</span> <span class="n"><a href="#DataType.Type">sqlglot.expressions.DataType.Type</a></span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#Cast">sqlglot.expressions.Cast</a></span>:</span></span> + + <label class="view-source-button" for="cast-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#cast"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="cast-4239"><a href="#cast-4239"><span class="linenos">4239</span></a><span class="k">def</span> <span class="nf">cast</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Expression</span><span class="p">,</span> <span class="n">to</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">DataType</span> <span class="o">|</span> <span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">Cast</span><span class="p">:</span> +</span><span id="cast-4240"><a href="#cast-4240"><span class="linenos">4240</span></a><span class="w"> </span><span class="sd">"""Cast an expression to a data type.</span> +</span><span id="cast-4241"><a href="#cast-4241"><span class="linenos">4241</span></a> +</span><span id="cast-4242"><a href="#cast-4242"><span class="linenos">4242</span></a><span class="sd"> Example:</span> +</span><span id="cast-4243"><a href="#cast-4243"><span class="linenos">4243</span></a><span class="sd"> >>> cast('x + 1', 'int').sql()</span> +</span><span id="cast-4244"><a href="#cast-4244"><span class="linenos">4244</span></a><span class="sd"> 'CAST(x + 1 AS INT)'</span> +</span><span id="cast-4245"><a href="#cast-4245"><span class="linenos">4245</span></a> +</span><span id="cast-4246"><a href="#cast-4246"><span class="linenos">4246</span></a><span class="sd"> Args:</span> +</span><span id="cast-4247"><a href="#cast-4247"><span class="linenos">4247</span></a><span class="sd"> expression: The expression to cast.</span> +</span><span id="cast-4248"><a href="#cast-4248"><span class="linenos">4248</span></a><span class="sd"> to: The datatype to cast to.</span> +</span><span id="cast-4249"><a href="#cast-4249"><span class="linenos">4249</span></a> +</span><span id="cast-4250"><a href="#cast-4250"><span class="linenos">4250</span></a><span class="sd"> Returns:</span> +</span><span id="cast-4251"><a href="#cast-4251"><span class="linenos">4251</span></a><span class="sd"> A cast node.</span> +</span><span id="cast-4252"><a href="#cast-4252"><span class="linenos">4252</span></a><span class="sd"> """</span> +</span><span id="cast-4253"><a href="#cast-4253"><span class="linenos">4253</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="cast-4254"><a href="#cast-4254"><span class="linenos">4254</span></a> <span class="k">return</span> <span class="n">Cast</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">to</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Cast an expression to a data type.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">cast</span><span class="p">(</span><span class="s1">'x + 1'</span><span class="p">,</span> <span class="s1">'int'</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'CAST(x + 1 AS INT)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> The expression to cast.</li> +<li><strong>to:</strong> The datatype to cast to.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A cast node.</p> +</blockquote> +</div> + + + </section> + <section id="table_"> + <input id="table_-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table_</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">table</span>,</span><span class="param"> <span class="n">db</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Table">sqlglot.expressions.Table</a></span>:</span></span> + + <label class="view-source-button" for="table_-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#table_"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="table_-4257"><a href="#table_-4257"><span class="linenos">4257</span></a><span class="k">def</span> <span class="nf">table_</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">Table</span><span class="p">:</span> +</span><span id="table_-4258"><a href="#table_-4258"><span class="linenos">4258</span></a><span class="w"> </span><span class="sd">"""Build a Table.</span> +</span><span id="table_-4259"><a href="#table_-4259"><span class="linenos">4259</span></a> +</span><span id="table_-4260"><a href="#table_-4260"><span class="linenos">4260</span></a><span class="sd"> Args:</span> +</span><span id="table_-4261"><a href="#table_-4261"><span class="linenos">4261</span></a><span class="sd"> table (str | Expression): column name</span> +</span><span id="table_-4262"><a href="#table_-4262"><span class="linenos">4262</span></a><span class="sd"> db (str | Expression): db name</span> +</span><span id="table_-4263"><a href="#table_-4263"><span class="linenos">4263</span></a><span class="sd"> catalog (str | Expression): catalog name</span> +</span><span id="table_-4264"><a href="#table_-4264"><span class="linenos">4264</span></a> +</span><span id="table_-4265"><a href="#table_-4265"><span class="linenos">4265</span></a><span class="sd"> Returns:</span> +</span><span id="table_-4266"><a href="#table_-4266"><span class="linenos">4266</span></a><span class="sd"> Table: table instance</span> +</span><span id="table_-4267"><a href="#table_-4267"><span class="linenos">4267</span></a><span class="sd"> """</span> +</span><span id="table_-4268"><a href="#table_-4268"><span class="linenos">4268</span></a> <span class="k">return</span> <span class="n">Table</span><span class="p">(</span> +</span><span id="table_-4269"><a href="#table_-4269"><span class="linenos">4269</span></a> <span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="table_-4270"><a href="#table_-4270"><span class="linenos">4270</span></a> <span class="n">db</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">db</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="table_-4271"><a href="#table_-4271"><span class="linenos">4271</span></a> <span class="n">catalog</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">catalog</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">),</span> +</span><span id="table_-4272"><a href="#table_-4272"><span class="linenos">4272</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">))</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="table_-4273"><a href="#table_-4273"><span class="linenos">4273</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Build a Table.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table (str | Expression):</strong> column name</li> +<li><strong>db (str | Expression):</strong> db name</li> +<li><strong>catalog (str | Expression):</strong> catalog name</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Table: table instance</p> +</blockquote> +</div> + + + </section> + <section id="values"> + <input id="values-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">values</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">values</span><span class="p">:</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">Tuple</span><span class="p">[</span><span class="n">Any</span><span class="p">,</span> <span class="o">...</span><span class="p">]]</span>,</span><span class="param"> <span class="n">alias</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">columns</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Iterable</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#DataType">sqlglot.expressions.DataType</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Values">sqlglot.expressions.Values</a></span>:</span></span> + + <label class="view-source-button" for="values-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#values"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="values-4276"><a href="#values-4276"><span class="linenos">4276</span></a><span class="k">def</span> <span class="nf">values</span><span class="p">(</span> +</span><span id="values-4277"><a href="#values-4277"><span class="linenos">4277</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="o">...</span><span class="p">]],</span> +</span><span id="values-4278"><a href="#values-4278"><span class="linenos">4278</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="values-4279"><a href="#values-4279"><span class="linenos">4279</span></a> <span class="n">columns</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">DataType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="values-4280"><a href="#values-4280"><span class="linenos">4280</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Values</span><span class="p">:</span> +</span><span id="values-4281"><a href="#values-4281"><span class="linenos">4281</span></a><span class="w"> </span><span class="sd">"""Build VALUES statement.</span> +</span><span id="values-4282"><a href="#values-4282"><span class="linenos">4282</span></a> +</span><span id="values-4283"><a href="#values-4283"><span class="linenos">4283</span></a><span class="sd"> Example:</span> +</span><span id="values-4284"><a href="#values-4284"><span class="linenos">4284</span></a><span class="sd"> >>> values([(1, '2')]).sql()</span> +</span><span id="values-4285"><a href="#values-4285"><span class="linenos">4285</span></a><span class="sd"> "VALUES (1, '2')"</span> +</span><span id="values-4286"><a href="#values-4286"><span class="linenos">4286</span></a> +</span><span id="values-4287"><a href="#values-4287"><span class="linenos">4287</span></a><span class="sd"> Args:</span> +</span><span id="values-4288"><a href="#values-4288"><span class="linenos">4288</span></a><span class="sd"> values: values statements that will be converted to SQL</span> +</span><span id="values-4289"><a href="#values-4289"><span class="linenos">4289</span></a><span class="sd"> alias: optional alias</span> +</span><span id="values-4290"><a href="#values-4290"><span class="linenos">4290</span></a><span class="sd"> columns: Optional list of ordered column names or ordered dictionary of column names to types.</span> +</span><span id="values-4291"><a href="#values-4291"><span class="linenos">4291</span></a><span class="sd"> If either are provided then an alias is also required.</span> +</span><span id="values-4292"><a href="#values-4292"><span class="linenos">4292</span></a><span class="sd"> If a dictionary is provided then the first column of the values will be casted to the expected type</span> +</span><span id="values-4293"><a href="#values-4293"><span class="linenos">4293</span></a><span class="sd"> in order to help with type inference.</span> +</span><span id="values-4294"><a href="#values-4294"><span class="linenos">4294</span></a> +</span><span id="values-4295"><a href="#values-4295"><span class="linenos">4295</span></a><span class="sd"> Returns:</span> +</span><span id="values-4296"><a href="#values-4296"><span class="linenos">4296</span></a><span class="sd"> Values: the Values expression object</span> +</span><span id="values-4297"><a href="#values-4297"><span class="linenos">4297</span></a><span class="sd"> """</span> +</span><span id="values-4298"><a href="#values-4298"><span class="linenos">4298</span></a> <span class="k">if</span> <span class="n">columns</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="values-4299"><a href="#values-4299"><span class="linenos">4299</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Alias is required when providing columns"</span><span class="p">)</span> +</span><span id="values-4300"><a href="#values-4300"><span class="linenos">4300</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="values-4301"><a href="#values-4301"><span class="linenos">4301</span></a> <span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">),</span> <span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">])</span> +</span><span id="values-4302"><a href="#values-4302"><span class="linenos">4302</span></a> <span class="k">if</span> <span class="n">columns</span> +</span><span id="values-4303"><a href="#values-4303"><span class="linenos">4303</span></a> <span class="k">else</span> <span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="values-4304"><a href="#values-4304"><span class="linenos">4304</span></a> <span class="p">)</span> +</span><span id="values-4305"><a href="#values-4305"><span class="linenos">4305</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">tup</span><span class="p">)</span> <span class="k">for</span> <span class="n">tup</span> <span class="ow">in</span> <span class="n">values</span><span class="p">]</span> +</span><span id="values-4306"><a href="#values-4306"><span class="linenos">4306</span></a> <span class="k">if</span> <span class="n">columns</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">columns</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="values-4307"><a href="#values-4307"><span class="linenos">4307</span></a> <span class="n">types</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">columns</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="values-4308"><a href="#values-4308"><span class="linenos">4308</span></a> <span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="values-4309"><a href="#values-4309"><span class="linenos">4309</span></a> <span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="values-4310"><a href="#values-4310"><span class="linenos">4310</span></a> <span class="p">[</span><span class="n">cast</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">types</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span><span class="p">)],</span> +</span><span id="values-4311"><a href="#values-4311"><span class="linenos">4311</span></a> <span class="p">)</span> +</span><span id="values-4312"><a href="#values-4312"><span class="linenos">4312</span></a> <span class="k">return</span> <span class="n">Values</span><span class="p">(</span> +</span><span id="values-4313"><a href="#values-4313"><span class="linenos">4313</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="values-4314"><a href="#values-4314"><span class="linenos">4314</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">table_alias</span><span class="p">,</span> +</span><span id="values-4315"><a href="#values-4315"><span class="linenos">4315</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Build VALUES statement.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">values</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span> <span class="s1">'2'</span><span class="p">)])</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">"VALUES (1, '2')"</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>values:</strong> values statements that will be converted to SQL</li> +<li><strong>alias:</strong> optional alias</li> +<li><strong>columns:</strong> Optional list of ordered column names or ordered dictionary of column names to types. +If either are provided then an alias is also required. +If a dictionary is provided then the first column of the values will be casted to the expected type +in order to help with type inference.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Values: the Values expression object</p> +</blockquote> +</div> + + + </section> + <section id="rename_table"> + <input id="rename_table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rename_table</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">old_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Table">sqlglot.expressions.Table</a></span>,</span><span class="param"> <span class="n">new_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="#Table">sqlglot.expressions.Table</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#AlterTable">sqlglot.expressions.AlterTable</a></span>:</span></span> + + <label class="view-source-button" for="rename_table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#rename_table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="rename_table-4318"><a href="#rename_table-4318"><span class="linenos">4318</span></a><span class="k">def</span> <span class="nf">rename_table</span><span class="p">(</span><span class="n">old_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">,</span> <span class="n">new_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">Table</span><span class="p">)</span> <span class="o">-></span> <span class="n">AlterTable</span><span class="p">:</span> +</span><span id="rename_table-4319"><a href="#rename_table-4319"><span class="linenos">4319</span></a><span class="w"> </span><span class="sd">"""Build ALTER TABLE... RENAME... expression</span> +</span><span id="rename_table-4320"><a href="#rename_table-4320"><span class="linenos">4320</span></a> +</span><span id="rename_table-4321"><a href="#rename_table-4321"><span class="linenos">4321</span></a><span class="sd"> Args:</span> +</span><span id="rename_table-4322"><a href="#rename_table-4322"><span class="linenos">4322</span></a><span class="sd"> old_name: The old name of the table</span> +</span><span id="rename_table-4323"><a href="#rename_table-4323"><span class="linenos">4323</span></a><span class="sd"> new_name: The new name of the table</span> +</span><span id="rename_table-4324"><a href="#rename_table-4324"><span class="linenos">4324</span></a> +</span><span id="rename_table-4325"><a href="#rename_table-4325"><span class="linenos">4325</span></a><span class="sd"> Returns:</span> +</span><span id="rename_table-4326"><a href="#rename_table-4326"><span class="linenos">4326</span></a><span class="sd"> Alter table expression</span> +</span><span id="rename_table-4327"><a href="#rename_table-4327"><span class="linenos">4327</span></a><span class="sd"> """</span> +</span><span id="rename_table-4328"><a href="#rename_table-4328"><span class="linenos">4328</span></a> <span class="n">old_table</span> <span class="o">=</span> <span class="n">to_table</span><span class="p">(</span><span class="n">old_name</span><span class="p">)</span> +</span><span id="rename_table-4329"><a href="#rename_table-4329"><span class="linenos">4329</span></a> <span class="n">new_table</span> <span class="o">=</span> <span class="n">to_table</span><span class="p">(</span><span class="n">new_name</span><span class="p">)</span> +</span><span id="rename_table-4330"><a href="#rename_table-4330"><span class="linenos">4330</span></a> <span class="k">return</span> <span class="n">AlterTable</span><span class="p">(</span> +</span><span id="rename_table-4331"><a href="#rename_table-4331"><span class="linenos">4331</span></a> <span class="n">this</span><span class="o">=</span><span class="n">old_table</span><span class="p">,</span> +</span><span id="rename_table-4332"><a href="#rename_table-4332"><span class="linenos">4332</span></a> <span class="n">actions</span><span class="o">=</span><span class="p">[</span> +</span><span id="rename_table-4333"><a href="#rename_table-4333"><span class="linenos">4333</span></a> <span class="n">RenameTable</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">new_table</span><span class="p">),</span> +</span><span id="rename_table-4334"><a href="#rename_table-4334"><span class="linenos">4334</span></a> <span class="p">],</span> +</span><span id="rename_table-4335"><a href="#rename_table-4335"><span class="linenos">4335</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Build ALTER TABLE... RENAME... expression</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>old_name:</strong> The old name of the table</li> +<li><strong>new_name:</strong> The new name of the table</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Alter table expression</p> +</blockquote> +</div> + + + </section> + <section id="convert"> + <input id="convert-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">convert</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">value</span></span><span class="return-annotation">) -> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="convert-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#convert"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="convert-4338"><a href="#convert-4338"><span class="linenos">4338</span></a><span class="k">def</span> <span class="nf">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="convert-4339"><a href="#convert-4339"><span class="linenos">4339</span></a><span class="w"> </span><span class="sd">"""Convert a python value into an expression object.</span> +</span><span id="convert-4340"><a href="#convert-4340"><span class="linenos">4340</span></a> +</span><span id="convert-4341"><a href="#convert-4341"><span class="linenos">4341</span></a><span class="sd"> Raises an error if a conversion is not possible.</span> +</span><span id="convert-4342"><a href="#convert-4342"><span class="linenos">4342</span></a> +</span><span id="convert-4343"><a href="#convert-4343"><span class="linenos">4343</span></a><span class="sd"> Args:</span> +</span><span id="convert-4344"><a href="#convert-4344"><span class="linenos">4344</span></a><span class="sd"> value (Any): a python object</span> +</span><span id="convert-4345"><a href="#convert-4345"><span class="linenos">4345</span></a> +</span><span id="convert-4346"><a href="#convert-4346"><span class="linenos">4346</span></a><span class="sd"> Returns:</span> +</span><span id="convert-4347"><a href="#convert-4347"><span class="linenos">4347</span></a><span class="sd"> Expression: the equivalent expression object</span> +</span><span id="convert-4348"><a href="#convert-4348"><span class="linenos">4348</span></a><span class="sd"> """</span> +</span><span id="convert-4349"><a href="#convert-4349"><span class="linenos">4349</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="convert-4350"><a href="#convert-4350"><span class="linenos">4350</span></a> <span class="k">return</span> <span class="n">value</span> +</span><span id="convert-4351"><a href="#convert-4351"><span class="linenos">4351</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="convert-4352"><a href="#convert-4352"><span class="linenos">4352</span></a> <span class="k">return</span> <span class="n">NULL</span> +</span><span id="convert-4353"><a href="#convert-4353"><span class="linenos">4353</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">bool</span><span class="p">):</span> +</span><span id="convert-4354"><a href="#convert-4354"><span class="linenos">4354</span></a> <span class="k">return</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">value</span><span class="p">)</span> +</span><span id="convert-4355"><a href="#convert-4355"><span class="linenos">4355</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="convert-4356"><a href="#convert-4356"><span class="linenos">4356</span></a> <span class="k">return</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="convert-4357"><a href="#convert-4357"><span class="linenos">4357</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">float</span><span class="p">)</span> <span class="ow">and</span> <span class="n">math</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="convert-4358"><a href="#convert-4358"><span class="linenos">4358</span></a> <span class="k">return</span> <span class="n">NULL</span> +</span><span id="convert-4359"><a href="#convert-4359"><span class="linenos">4359</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">numbers</span><span class="o">.</span><span class="n">Number</span><span class="p">):</span> +</span><span id="convert-4360"><a href="#convert-4360"><span class="linenos">4360</span></a> <span class="k">return</span> <span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="convert-4361"><a href="#convert-4361"><span class="linenos">4361</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">):</span> +</span><span id="convert-4362"><a href="#convert-4362"><span class="linenos">4362</span></a> <span class="k">return</span> <span class="n">Tuple</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="p">])</span> +</span><span id="convert-4363"><a href="#convert-4363"><span class="linenos">4363</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="convert-4364"><a href="#convert-4364"><span class="linenos">4364</span></a> <span class="k">return</span> <span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="p">])</span> +</span><span id="convert-4365"><a href="#convert-4365"><span class="linenos">4365</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="convert-4366"><a href="#convert-4366"><span class="linenos">4366</span></a> <span class="k">return</span> <span class="n">Map</span><span class="p">(</span> +</span><span id="convert-4367"><a href="#convert-4367"><span class="linenos">4367</span></a> <span class="n">keys</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">value</span><span class="p">],</span> +</span><span id="convert-4368"><a href="#convert-4368"><span class="linenos">4368</span></a> <span class="n">values</span><span class="o">=</span><span class="p">[</span><span class="n">convert</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">value</span><span class="o">.</span><span class="n">values</span><span class="p">()],</span> +</span><span id="convert-4369"><a href="#convert-4369"><span class="linenos">4369</span></a> <span class="p">)</span> +</span><span id="convert-4370"><a href="#convert-4370"><span class="linenos">4370</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">):</span> +</span><span id="convert-4371"><a href="#convert-4371"><span class="linenos">4371</span></a> <span class="n">datetime_literal</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span> +</span><span id="convert-4372"><a href="#convert-4372"><span class="linenos">4372</span></a> <span class="p">(</span><span class="n">value</span> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">tzinfo</span> <span class="k">else</span> <span class="n">value</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">tzinfo</span><span class="o">=</span><span class="n">datetime</span><span class="o">.</span><span class="n">timezone</span><span class="o">.</span><span class="n">utc</span><span class="p">))</span><span class="o">.</span><span class="n">isoformat</span><span class="p">()</span> +</span><span id="convert-4373"><a href="#convert-4373"><span class="linenos">4373</span></a> <span class="p">)</span> +</span><span id="convert-4374"><a href="#convert-4374"><span class="linenos">4374</span></a> <span class="k">return</span> <span class="n">TimeStrToTime</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">datetime_literal</span><span class="p">)</span> +</span><span id="convert-4375"><a href="#convert-4375"><span class="linenos">4375</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="p">):</span> +</span><span id="convert-4376"><a href="#convert-4376"><span class="linenos">4376</span></a> <span class="n">date_literal</span> <span class="o">=</span> <span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s2">"%Y-%m-</span><span class="si">%d</span><span class="s2">"</span><span class="p">))</span> +</span><span id="convert-4377"><a href="#convert-4377"><span class="linenos">4377</span></a> <span class="k">return</span> <span class="n">DateStrToDate</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">date_literal</span><span class="p">)</span> +</span><span id="convert-4378"><a href="#convert-4378"><span class="linenos">4378</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Cannot convert </span><span class="si">{</span><span class="n">value</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Convert a python value into an expression object.</p> + +<p>Raises an error if a conversion is not possible.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>value (Any):</strong> a python object</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Expression: the equivalent expression object</p> +</blockquote> +</div> + + + </section> + <section id="replace_children"> + <input id="replace_children-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace_children</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">fun</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="replace_children-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#replace_children"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="replace_children-4381"><a href="#replace_children-4381"><span class="linenos">4381</span></a><span class="k">def</span> <span class="nf">replace_children</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">fun</span><span class="p">):</span> +</span><span id="replace_children-4382"><a href="#replace_children-4382"><span class="linenos">4382</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="replace_children-4383"><a href="#replace_children-4383"><span class="linenos">4383</span></a><span class="sd"> Replace children of an expression with the result of a lambda fun(child) -> exp.</span> +</span><span id="replace_children-4384"><a href="#replace_children-4384"><span class="linenos">4384</span></a><span class="sd"> """</span> +</span><span id="replace_children-4385"><a href="#replace_children-4385"><span class="linenos">4385</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="replace_children-4386"><a href="#replace_children-4386"><span class="linenos">4386</span></a> <span class="n">is_list_arg</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> +</span><span id="replace_children-4387"><a href="#replace_children-4387"><span class="linenos">4387</span></a> +</span><span id="replace_children-4388"><a href="#replace_children-4388"><span class="linenos">4388</span></a> <span class="n">child_nodes</span> <span class="o">=</span> <span class="n">v</span> <span class="k">if</span> <span class="n">is_list_arg</span> <span class="k">else</span> <span class="p">[</span><span class="n">v</span><span class="p">]</span> +</span><span id="replace_children-4389"><a href="#replace_children-4389"><span class="linenos">4389</span></a> <span class="n">new_child_nodes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="replace_children-4390"><a href="#replace_children-4390"><span class="linenos">4390</span></a> +</span><span id="replace_children-4391"><a href="#replace_children-4391"><span class="linenos">4391</span></a> <span class="k">for</span> <span class="n">cn</span> <span class="ow">in</span> <span class="n">child_nodes</span><span class="p">:</span> +</span><span id="replace_children-4392"><a href="#replace_children-4392"><span class="linenos">4392</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">cn</span><span class="p">,</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="replace_children-4393"><a href="#replace_children-4393"><span class="linenos">4393</span></a> <span class="k">for</span> <span class="n">child_node</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">fun</span><span class="p">(</span><span class="n">cn</span><span class="p">)):</span> +</span><span id="replace_children-4394"><a href="#replace_children-4394"><span class="linenos">4394</span></a> <span class="n">new_child_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">child_node</span><span class="p">)</span> +</span><span id="replace_children-4395"><a href="#replace_children-4395"><span class="linenos">4395</span></a> <span class="n">child_node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="replace_children-4396"><a href="#replace_children-4396"><span class="linenos">4396</span></a> <span class="n">child_node</span><span class="o">.</span><span class="n">arg_key</span> <span class="o">=</span> <span class="n">k</span> +</span><span id="replace_children-4397"><a href="#replace_children-4397"><span class="linenos">4397</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="replace_children-4398"><a href="#replace_children-4398"><span class="linenos">4398</span></a> <span class="n">new_child_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cn</span><span class="p">)</span> +</span><span id="replace_children-4399"><a href="#replace_children-4399"><span class="linenos">4399</span></a> +</span><span id="replace_children-4400"><a href="#replace_children-4400"><span class="linenos">4400</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">new_child_nodes</span> <span class="k">if</span> <span class="n">is_list_arg</span> <span class="k">else</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">new_child_nodes</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Replace children of an expression with the result of a lambda fun(child) -> exp.</p> +</div> + + + </section> + <section id="column_table_names"> + <input id="column_table_names-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">column_table_names</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="column_table_names-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#column_table_names"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="column_table_names-4403"><a href="#column_table_names-4403"><span class="linenos">4403</span></a><span class="k">def</span> <span class="nf">column_table_names</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="column_table_names-4404"><a href="#column_table_names-4404"><span class="linenos">4404</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="column_table_names-4405"><a href="#column_table_names-4405"><span class="linenos">4405</span></a><span class="sd"> Return all table names referenced through columns in an expression.</span> +</span><span id="column_table_names-4406"><a href="#column_table_names-4406"><span class="linenos">4406</span></a> +</span><span id="column_table_names-4407"><a href="#column_table_names-4407"><span class="linenos">4407</span></a><span class="sd"> Example:</span> +</span><span id="column_table_names-4408"><a href="#column_table_names-4408"><span class="linenos">4408</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="column_table_names-4409"><a href="#column_table_names-4409"><span class="linenos">4409</span></a><span class="sd"> >>> column_table_names(sqlglot.parse_one("a.b AND c.d AND c.e"))</span> +</span><span id="column_table_names-4410"><a href="#column_table_names-4410"><span class="linenos">4410</span></a><span class="sd"> ['c', 'a']</span> +</span><span id="column_table_names-4411"><a href="#column_table_names-4411"><span class="linenos">4411</span></a> +</span><span id="column_table_names-4412"><a href="#column_table_names-4412"><span class="linenos">4412</span></a><span class="sd"> Args:</span> +</span><span id="column_table_names-4413"><a href="#column_table_names-4413"><span class="linenos">4413</span></a><span class="sd"> expression (sqlglot.Expression): expression to find table names</span> +</span><span id="column_table_names-4414"><a href="#column_table_names-4414"><span class="linenos">4414</span></a> +</span><span id="column_table_names-4415"><a href="#column_table_names-4415"><span class="linenos">4415</span></a><span class="sd"> Returns:</span> +</span><span id="column_table_names-4416"><a href="#column_table_names-4416"><span class="linenos">4416</span></a><span class="sd"> list: A list of unique names</span> +</span><span id="column_table_names-4417"><a href="#column_table_names-4417"><span class="linenos">4417</span></a><span class="sd"> """</span> +</span><span id="column_table_names-4418"><a href="#column_table_names-4418"><span class="linenos">4418</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="nb">dict</span><span class="o">.</span><span class="n">fromkeys</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">Column</span><span class="p">)))</span> +</span></pre></div> + + + <div class="docstring"><p>Return all table names referenced through columns in an expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">column_table_names</span><span class="p">(</span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"a.b AND c.d AND c.e"</span><span class="p">))</span> +<span class="go">['c', 'a']</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to find table names</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list: A list of unique names</p> +</blockquote> +</div> + + + </section> + <section id="table_name"> + <input id="table_name-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table_name</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">table</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="table_name-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#table_name"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="table_name-4421"><a href="#table_name-4421"><span class="linenos">4421</span></a><span class="k">def</span> <span class="nf">table_name</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="table_name-4422"><a href="#table_name-4422"><span class="linenos">4422</span></a><span class="w"> </span><span class="sd">"""Get the full name of a table as a string.</span> +</span><span id="table_name-4423"><a href="#table_name-4423"><span class="linenos">4423</span></a> +</span><span id="table_name-4424"><a href="#table_name-4424"><span class="linenos">4424</span></a><span class="sd"> Args:</span> +</span><span id="table_name-4425"><a href="#table_name-4425"><span class="linenos">4425</span></a><span class="sd"> table (exp.Table | str): table expression node or string.</span> +</span><span id="table_name-4426"><a href="#table_name-4426"><span class="linenos">4426</span></a> +</span><span id="table_name-4427"><a href="#table_name-4427"><span class="linenos">4427</span></a><span class="sd"> Examples:</span> +</span><span id="table_name-4428"><a href="#table_name-4428"><span class="linenos">4428</span></a><span class="sd"> >>> from sqlglot import exp, parse_one</span> +</span><span id="table_name-4429"><a href="#table_name-4429"><span class="linenos">4429</span></a><span class="sd"> >>> table_name(parse_one("select * from a.b.c").find(exp.Table))</span> +</span><span id="table_name-4430"><a href="#table_name-4430"><span class="linenos">4430</span></a><span class="sd"> 'a.b.c'</span> +</span><span id="table_name-4431"><a href="#table_name-4431"><span class="linenos">4431</span></a> +</span><span id="table_name-4432"><a href="#table_name-4432"><span class="linenos">4432</span></a><span class="sd"> Returns:</span> +</span><span id="table_name-4433"><a href="#table_name-4433"><span class="linenos">4433</span></a><span class="sd"> The table name.</span> +</span><span id="table_name-4434"><a href="#table_name-4434"><span class="linenos">4434</span></a><span class="sd"> """</span> +</span><span id="table_name-4435"><a href="#table_name-4435"><span class="linenos">4435</span></a> +</span><span id="table_name-4436"><a href="#table_name-4436"><span class="linenos">4436</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">Table</span><span class="p">)</span> +</span><span id="table_name-4437"><a href="#table_name-4437"><span class="linenos">4437</span></a> +</span><span id="table_name-4438"><a href="#table_name-4438"><span class="linenos">4438</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table</span><span class="p">:</span> +</span><span id="table_name-4439"><a href="#table_name-4439"><span class="linenos">4439</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Cannot parse </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="table_name-4440"><a href="#table_name-4440"><span class="linenos">4440</span></a> +</span><span id="table_name-4441"><a href="#table_name-4441"><span class="linenos">4441</span></a> <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="table_name-4442"><a href="#table_name-4442"><span class="linenos">4442</span></a> <span class="n">part</span> +</span><span id="table_name-4443"><a href="#table_name-4443"><span class="linenos">4443</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="table_name-4444"><a href="#table_name-4444"><span class="linenos">4444</span></a> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"catalog"</span><span class="p">),</span> +</span><span id="table_name-4445"><a href="#table_name-4445"><span class="linenos">4445</span></a> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"db"</span><span class="p">),</span> +</span><span id="table_name-4446"><a href="#table_name-4446"><span class="linenos">4446</span></a> <span class="n">table</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="table_name-4447"><a href="#table_name-4447"><span class="linenos">4447</span></a> <span class="p">)</span> +</span><span id="table_name-4448"><a href="#table_name-4448"><span class="linenos">4448</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="table_name-4449"><a href="#table_name-4449"><span class="linenos">4449</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Get the full name of a table as a string.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table (exp.Table | str):</strong> table expression node or string.</li> +</ul> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">table_name</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"select * from a.b.c"</span><span class="p">)</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">))</span> +<span class="go">'a.b.c'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The table name.</p> +</blockquote> +</div> + + + </section> + <section id="replace_tables"> + <input id="replace_tables-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace_tables</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">mapping</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="replace_tables-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#replace_tables"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="replace_tables-4452"><a href="#replace_tables-4452"><span class="linenos">4452</span></a><span class="k">def</span> <span class="nf">replace_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">mapping</span><span class="p">):</span> +</span><span id="replace_tables-4453"><a href="#replace_tables-4453"><span class="linenos">4453</span></a><span class="w"> </span><span class="sd">"""Replace all tables in expression according to the mapping.</span> +</span><span id="replace_tables-4454"><a href="#replace_tables-4454"><span class="linenos">4454</span></a> +</span><span id="replace_tables-4455"><a href="#replace_tables-4455"><span class="linenos">4455</span></a><span class="sd"> Args:</span> +</span><span id="replace_tables-4456"><a href="#replace_tables-4456"><span class="linenos">4456</span></a><span class="sd"> expression (sqlglot.Expression): expression node to be transformed and replaced.</span> +</span><span id="replace_tables-4457"><a href="#replace_tables-4457"><span class="linenos">4457</span></a><span class="sd"> mapping (Dict[str, str]): mapping of table names.</span> +</span><span id="replace_tables-4458"><a href="#replace_tables-4458"><span class="linenos">4458</span></a> +</span><span id="replace_tables-4459"><a href="#replace_tables-4459"><span class="linenos">4459</span></a><span class="sd"> Examples:</span> +</span><span id="replace_tables-4460"><a href="#replace_tables-4460"><span class="linenos">4460</span></a><span class="sd"> >>> from sqlglot import exp, parse_one</span> +</span><span id="replace_tables-4461"><a href="#replace_tables-4461"><span class="linenos">4461</span></a><span class="sd"> >>> replace_tables(parse_one("select * from a.b"), {"a.b": "c"}).sql()</span> +</span><span id="replace_tables-4462"><a href="#replace_tables-4462"><span class="linenos">4462</span></a><span class="sd"> 'SELECT * FROM c'</span> +</span><span id="replace_tables-4463"><a href="#replace_tables-4463"><span class="linenos">4463</span></a> +</span><span id="replace_tables-4464"><a href="#replace_tables-4464"><span class="linenos">4464</span></a><span class="sd"> Returns:</span> +</span><span id="replace_tables-4465"><a href="#replace_tables-4465"><span class="linenos">4465</span></a><span class="sd"> The mapped expression.</span> +</span><span id="replace_tables-4466"><a href="#replace_tables-4466"><span class="linenos">4466</span></a><span class="sd"> """</span> +</span><span id="replace_tables-4467"><a href="#replace_tables-4467"><span class="linenos">4467</span></a> +</span><span id="replace_tables-4468"><a href="#replace_tables-4468"><span class="linenos">4468</span></a> <span class="k">def</span> <span class="nf">_replace_tables</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> +</span><span id="replace_tables-4469"><a href="#replace_tables-4469"><span class="linenos">4469</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="replace_tables-4470"><a href="#replace_tables-4470"><span class="linenos">4470</span></a> <span class="n">new_name</span> <span class="o">=</span> <span class="n">mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table_name</span><span class="p">(</span><span class="n">node</span><span class="p">))</span> +</span><span id="replace_tables-4471"><a href="#replace_tables-4471"><span class="linenos">4471</span></a> <span class="k">if</span> <span class="n">new_name</span><span class="p">:</span> +</span><span id="replace_tables-4472"><a href="#replace_tables-4472"><span class="linenos">4472</span></a> <span class="k">return</span> <span class="n">to_table</span><span class="p">(</span> +</span><span id="replace_tables-4473"><a href="#replace_tables-4473"><span class="linenos">4473</span></a> <span class="n">new_name</span><span class="p">,</span> +</span><span id="replace_tables-4474"><a href="#replace_tables-4474"><span class="linenos">4474</span></a> <span class="o">**</span><span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">v</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">k</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">)},</span> +</span><span id="replace_tables-4475"><a href="#replace_tables-4475"><span class="linenos">4475</span></a> <span class="p">)</span> +</span><span id="replace_tables-4476"><a href="#replace_tables-4476"><span class="linenos">4476</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="replace_tables-4477"><a href="#replace_tables-4477"><span class="linenos">4477</span></a> +</span><span id="replace_tables-4478"><a href="#replace_tables-4478"><span class="linenos">4478</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_replace_tables</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Replace all tables in expression according to the mapping.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression node to be transformed and replaced.</li> +<li><strong>mapping (Dict[str, str]):</strong> mapping of table names.</li> +</ul> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">replace_tables</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"select * from a.b"</span><span class="p">),</span> <span class="p">{</span><span class="s2">"a.b"</span><span class="p">:</span> <span class="s2">"c"</span><span class="p">})</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM c'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The mapped expression.</p> +</blockquote> +</div> + + + </section> + <section id="replace_placeholders"> + <input id="replace_placeholders-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace_placeholders</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="o">*</span><span class="n">args</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="replace_placeholders-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#replace_placeholders"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="replace_placeholders-4481"><a href="#replace_placeholders-4481"><span class="linenos">4481</span></a><span class="k">def</span> <span class="nf">replace_placeholders</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="replace_placeholders-4482"><a href="#replace_placeholders-4482"><span class="linenos">4482</span></a><span class="w"> </span><span class="sd">"""Replace placeholders in an expression.</span> +</span><span id="replace_placeholders-4483"><a href="#replace_placeholders-4483"><span class="linenos">4483</span></a> +</span><span id="replace_placeholders-4484"><a href="#replace_placeholders-4484"><span class="linenos">4484</span></a><span class="sd"> Args:</span> +</span><span id="replace_placeholders-4485"><a href="#replace_placeholders-4485"><span class="linenos">4485</span></a><span class="sd"> expression (sqlglot.Expression): expression node to be transformed and replaced.</span> +</span><span id="replace_placeholders-4486"><a href="#replace_placeholders-4486"><span class="linenos">4486</span></a><span class="sd"> args: positional names that will substitute unnamed placeholders in the given order.</span> +</span><span id="replace_placeholders-4487"><a href="#replace_placeholders-4487"><span class="linenos">4487</span></a><span class="sd"> kwargs: keyword arguments that will substitute named placeholders.</span> +</span><span id="replace_placeholders-4488"><a href="#replace_placeholders-4488"><span class="linenos">4488</span></a> +</span><span id="replace_placeholders-4489"><a href="#replace_placeholders-4489"><span class="linenos">4489</span></a><span class="sd"> Examples:</span> +</span><span id="replace_placeholders-4490"><a href="#replace_placeholders-4490"><span class="linenos">4490</span></a><span class="sd"> >>> from sqlglot import exp, parse_one</span> +</span><span id="replace_placeholders-4491"><a href="#replace_placeholders-4491"><span class="linenos">4491</span></a><span class="sd"> >>> replace_placeholders(</span> +</span><span id="replace_placeholders-4492"><a href="#replace_placeholders-4492"><span class="linenos">4492</span></a><span class="sd"> ... parse_one("select * from :tbl where ? = ?"), "a", "b", tbl="foo"</span> +</span><span id="replace_placeholders-4493"><a href="#replace_placeholders-4493"><span class="linenos">4493</span></a><span class="sd"> ... ).sql()</span> +</span><span id="replace_placeholders-4494"><a href="#replace_placeholders-4494"><span class="linenos">4494</span></a><span class="sd"> 'SELECT * FROM foo WHERE a = b'</span> +</span><span id="replace_placeholders-4495"><a href="#replace_placeholders-4495"><span class="linenos">4495</span></a> +</span><span id="replace_placeholders-4496"><a href="#replace_placeholders-4496"><span class="linenos">4496</span></a><span class="sd"> Returns:</span> +</span><span id="replace_placeholders-4497"><a href="#replace_placeholders-4497"><span class="linenos">4497</span></a><span class="sd"> The mapped expression.</span> +</span><span id="replace_placeholders-4498"><a href="#replace_placeholders-4498"><span class="linenos">4498</span></a><span class="sd"> """</span> +</span><span id="replace_placeholders-4499"><a href="#replace_placeholders-4499"><span class="linenos">4499</span></a> +</span><span id="replace_placeholders-4500"><a href="#replace_placeholders-4500"><span class="linenos">4500</span></a> <span class="k">def</span> <span class="nf">_replace_placeholders</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="replace_placeholders-4501"><a href="#replace_placeholders-4501"><span class="linenos">4501</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Placeholder</span><span class="p">):</span> +</span><span id="replace_placeholders-4502"><a href="#replace_placeholders-4502"><span class="linenos">4502</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> +</span><span id="replace_placeholders-4503"><a href="#replace_placeholders-4503"><span class="linenos">4503</span></a> <span class="n">new_name</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="replace_placeholders-4504"><a href="#replace_placeholders-4504"><span class="linenos">4504</span></a> <span class="k">if</span> <span class="n">new_name</span><span class="p">:</span> +</span><span id="replace_placeholders-4505"><a href="#replace_placeholders-4505"><span class="linenos">4505</span></a> <span class="k">return</span> <span class="n">to_identifier</span><span class="p">(</span><span class="n">new_name</span><span class="p">)</span> +</span><span id="replace_placeholders-4506"><a href="#replace_placeholders-4506"><span class="linenos">4506</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="replace_placeholders-4507"><a href="#replace_placeholders-4507"><span class="linenos">4507</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="replace_placeholders-4508"><a href="#replace_placeholders-4508"><span class="linenos">4508</span></a> <span class="k">return</span> <span class="n">to_identifier</span><span class="p">(</span><span class="nb">next</span><span class="p">(</span><span class="n">args</span><span class="p">))</span> +</span><span id="replace_placeholders-4509"><a href="#replace_placeholders-4509"><span class="linenos">4509</span></a> <span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span> +</span><span id="replace_placeholders-4510"><a href="#replace_placeholders-4510"><span class="linenos">4510</span></a> <span class="k">pass</span> +</span><span id="replace_placeholders-4511"><a href="#replace_placeholders-4511"><span class="linenos">4511</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="replace_placeholders-4512"><a href="#replace_placeholders-4512"><span class="linenos">4512</span></a> +</span><span id="replace_placeholders-4513"><a href="#replace_placeholders-4513"><span class="linenos">4513</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_replace_placeholders</span><span class="p">,</span> <span class="nb">iter</span><span class="p">(</span><span class="n">args</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Replace placeholders in an expression.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression node to be transformed and replaced.</li> +<li><strong>args:</strong> positional names that will substitute unnamed placeholders in the given order.</li> +<li><strong>kwargs:</strong> keyword arguments that will substitute named placeholders.</li> +</ul> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">replace_placeholders</span><span class="p">(</span> +<span class="gp">... </span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"select * from :tbl where ? = ?"</span><span class="p">),</span> <span class="s2">"a"</span><span class="p">,</span> <span class="s2">"b"</span><span class="p">,</span> <span class="n">tbl</span><span class="o">=</span><span class="s2">"foo"</span> +<span class="gp">... </span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM foo WHERE a = b'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The mapped expression.</p> +</blockquote> +</div> + + + </section> + <section id="expand"> + <input id="expand-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">expand</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">sources</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Subqueryable">sqlglot.expressions.Subqueryable</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">) -> <span class="n"><a href="#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="expand-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#expand"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="expand-4516"><a href="#expand-4516"><span class="linenos">4516</span></a><span class="k">def</span> <span class="nf">expand</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">Expression</span><span class="p">,</span> <span class="n">sources</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Subqueryable</span><span class="p">],</span> <span class="n">copy</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="o">-></span> <span class="n">Expression</span><span class="p">:</span> +</span><span id="expand-4517"><a href="#expand-4517"><span class="linenos">4517</span></a><span class="w"> </span><span class="sd">"""Transforms an expression by expanding all referenced sources into subqueries.</span> +</span><span id="expand-4518"><a href="#expand-4518"><span class="linenos">4518</span></a> +</span><span id="expand-4519"><a href="#expand-4519"><span class="linenos">4519</span></a><span class="sd"> Examples:</span> +</span><span id="expand-4520"><a href="#expand-4520"><span class="linenos">4520</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="expand-4521"><a href="#expand-4521"><span class="linenos">4521</span></a><span class="sd"> >>> expand(parse_one("select * from x AS z"), {"x": parse_one("select * from y")}).sql()</span> +</span><span id="expand-4522"><a href="#expand-4522"><span class="linenos">4522</span></a><span class="sd"> 'SELECT * FROM (SELECT * FROM y) AS z /* source: x */'</span> +</span><span id="expand-4523"><a href="#expand-4523"><span class="linenos">4523</span></a> +</span><span id="expand-4524"><a href="#expand-4524"><span class="linenos">4524</span></a><span class="sd"> Args:</span> +</span><span id="expand-4525"><a href="#expand-4525"><span class="linenos">4525</span></a><span class="sd"> expression: The expression to expand.</span> +</span><span id="expand-4526"><a href="#expand-4526"><span class="linenos">4526</span></a><span class="sd"> sources: A dictionary of name to Subqueryables.</span> +</span><span id="expand-4527"><a href="#expand-4527"><span class="linenos">4527</span></a><span class="sd"> copy: Whether or not to copy the expression during transformation. Defaults to True.</span> +</span><span id="expand-4528"><a href="#expand-4528"><span class="linenos">4528</span></a> +</span><span id="expand-4529"><a href="#expand-4529"><span class="linenos">4529</span></a><span class="sd"> Returns:</span> +</span><span id="expand-4530"><a href="#expand-4530"><span class="linenos">4530</span></a><span class="sd"> The transformed expression.</span> +</span><span id="expand-4531"><a href="#expand-4531"><span class="linenos">4531</span></a><span class="sd"> """</span> +</span><span id="expand-4532"><a href="#expand-4532"><span class="linenos">4532</span></a> +</span><span id="expand-4533"><a href="#expand-4533"><span class="linenos">4533</span></a> <span class="k">def</span> <span class="nf">_expand</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">Expression</span><span class="p">):</span> +</span><span id="expand-4534"><a href="#expand-4534"><span class="linenos">4534</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">Table</span><span class="p">):</span> +</span><span id="expand-4535"><a href="#expand-4535"><span class="linenos">4535</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">table_name</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="expand-4536"><a href="#expand-4536"><span class="linenos">4536</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> +</span><span id="expand-4537"><a href="#expand-4537"><span class="linenos">4537</span></a> <span class="k">if</span> <span class="n">source</span><span class="p">:</span> +</span><span id="expand-4538"><a href="#expand-4538"><span class="linenos">4538</span></a> <span class="n">subquery</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">alias</span> <span class="ow">or</span> <span class="n">name</span><span class="p">)</span> +</span><span id="expand-4539"><a href="#expand-4539"><span class="linenos">4539</span></a> <span class="n">subquery</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"source: </span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span><span class="p">]</span> +</span><span id="expand-4540"><a href="#expand-4540"><span class="linenos">4540</span></a> <span class="k">return</span> <span class="n">subquery</span> +</span><span id="expand-4541"><a href="#expand-4541"><span class="linenos">4541</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="expand-4542"><a href="#expand-4542"><span class="linenos">4542</span></a> +</span><span id="expand-4543"><a href="#expand-4543"><span class="linenos">4543</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_expand</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="n">copy</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Transforms an expression by expanding all referenced sources into subqueries.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">expand</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"select * from x AS z"</span><span class="p">),</span> <span class="p">{</span><span class="s2">"x"</span><span class="p">:</span> <span class="n">parse_one</span><span class="p">(</span><span class="s2">"select * from y"</span><span class="p">)})</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM (SELECT * FROM y) AS z /* source: x */'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> The expression to expand.</li> +<li><strong>sources:</strong> A dictionary of name to Subqueryables.</li> +<li><strong>copy:</strong> Whether or not to copy the expression during transformation. Defaults to True.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The transformed expression.</p> +</blockquote> +</div> + + + </section> + <section id="func"> + <input id="func-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">func</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="o">*</span><span class="n">args</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#Func">sqlglot.expressions.Func</a></span>:</span></span> + + <label class="view-source-button" for="func-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#func"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="func-4546"><a href="#func-4546"><span class="linenos">4546</span></a><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">Func</span><span class="p">:</span> +</span><span id="func-4547"><a href="#func-4547"><span class="linenos">4547</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="func-4548"><a href="#func-4548"><span class="linenos">4548</span></a><span class="sd"> Returns a Func expression.</span> +</span><span id="func-4549"><a href="#func-4549"><span class="linenos">4549</span></a> +</span><span id="func-4550"><a href="#func-4550"><span class="linenos">4550</span></a><span class="sd"> Examples:</span> +</span><span id="func-4551"><a href="#func-4551"><span class="linenos">4551</span></a><span class="sd"> >>> func("abs", 5).sql()</span> +</span><span id="func-4552"><a href="#func-4552"><span class="linenos">4552</span></a><span class="sd"> 'ABS(5)'</span> +</span><span id="func-4553"><a href="#func-4553"><span class="linenos">4553</span></a> +</span><span id="func-4554"><a href="#func-4554"><span class="linenos">4554</span></a><span class="sd"> >>> func("cast", this=5, to=DataType.build("DOUBLE")).sql()</span> +</span><span id="func-4555"><a href="#func-4555"><span class="linenos">4555</span></a><span class="sd"> 'CAST(5 AS DOUBLE)'</span> +</span><span id="func-4556"><a href="#func-4556"><span class="linenos">4556</span></a> +</span><span id="func-4557"><a href="#func-4557"><span class="linenos">4557</span></a><span class="sd"> Args:</span> +</span><span id="func-4558"><a href="#func-4558"><span class="linenos">4558</span></a><span class="sd"> name: the name of the function to build.</span> +</span><span id="func-4559"><a href="#func-4559"><span class="linenos">4559</span></a><span class="sd"> args: the args used to instantiate the function of interest.</span> +</span><span id="func-4560"><a href="#func-4560"><span class="linenos">4560</span></a><span class="sd"> dialect: the source dialect.</span> +</span><span id="func-4561"><a href="#func-4561"><span class="linenos">4561</span></a><span class="sd"> kwargs: the kwargs used to instantiate the function of interest.</span> +</span><span id="func-4562"><a href="#func-4562"><span class="linenos">4562</span></a> +</span><span id="func-4563"><a href="#func-4563"><span class="linenos">4563</span></a><span class="sd"> Note:</span> +</span><span id="func-4564"><a href="#func-4564"><span class="linenos">4564</span></a><span class="sd"> The arguments `args` and `kwargs` are mutually exclusive.</span> +</span><span id="func-4565"><a href="#func-4565"><span class="linenos">4565</span></a> +</span><span id="func-4566"><a href="#func-4566"><span class="linenos">4566</span></a><span class="sd"> Returns:</span> +</span><span id="func-4567"><a href="#func-4567"><span class="linenos">4567</span></a><span class="sd"> An instance of the function of interest, or an anonymous function, if `name` doesn't</span> +</span><span id="func-4568"><a href="#func-4568"><span class="linenos">4568</span></a><span class="sd"> correspond to an existing `sqlglot.expressions.Func` class.</span> +</span><span id="func-4569"><a href="#func-4569"><span class="linenos">4569</span></a><span class="sd"> """</span> +</span><span id="func-4570"><a href="#func-4570"><span class="linenos">4570</span></a> <span class="k">if</span> <span class="n">args</span> <span class="ow">and</span> <span class="n">kwargs</span><span class="p">:</span> +</span><span id="func-4571"><a href="#func-4571"><span class="linenos">4571</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Can't use both args and kwargs to instantiate a function."</span><span class="p">)</span> +</span><span id="func-4572"><a href="#func-4572"><span class="linenos">4572</span></a> +</span><span id="func-4573"><a href="#func-4573"><span class="linenos">4573</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="func-4574"><a href="#func-4574"><span class="linenos">4574</span></a> +</span><span id="func-4575"><a href="#func-4575"><span class="linenos">4575</span></a> <span class="n">args</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">convert</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="func-4576"><a href="#func-4576"><span class="linenos">4576</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="n">key</span><span class="p">:</span> <span class="n">convert</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span> +</span><span id="func-4577"><a href="#func-4577"><span class="linenos">4577</span></a> +</span><span id="func-4578"><a href="#func-4578"><span class="linenos">4578</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="n">Dialect</span><span class="o">.</span><span class="n">get_or_raise</span><span class="p">(</span><span class="n">dialect</span><span class="p">)()</span><span class="o">.</span><span class="n">parser</span><span class="p">()</span> +</span><span id="func-4579"><a href="#func-4579"><span class="linenos">4579</span></a> <span class="n">from_args_list</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="func-4580"><a href="#func-4580"><span class="linenos">4580</span></a> +</span><span id="func-4581"><a href="#func-4581"><span class="linenos">4581</span></a> <span class="k">if</span> <span class="n">from_args_list</span><span class="p">:</span> +</span><span id="func-4582"><a href="#func-4582"><span class="linenos">4582</span></a> <span class="n">function</span> <span class="o">=</span> <span class="n">from_args_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="k">if</span> <span class="n">args</span> <span class="k">else</span> <span class="n">from_args_list</span><span class="o">.</span><span class="vm">__self__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="func-4583"><a href="#func-4583"><span class="linenos">4583</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="func-4584"><a href="#func-4584"><span class="linenos">4584</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="n">kwargs</span> <span class="ow">or</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">:</span> <span class="n">args</span><span class="p">}</span> +</span><span id="func-4585"><a href="#func-4585"><span class="linenos">4585</span></a> <span class="n">function</span> <span class="o">=</span> <span class="n">Anonymous</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="func-4586"><a href="#func-4586"><span class="linenos">4586</span></a> +</span><span id="func-4587"><a href="#func-4587"><span class="linenos">4587</span></a> <span class="k">for</span> <span class="n">error_message</span> <span class="ow">in</span> <span class="n">function</span><span class="o">.</span><span class="n">error_messages</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="func-4588"><a href="#func-4588"><span class="linenos">4588</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">error_message</span><span class="p">)</span> +</span><span id="func-4589"><a href="#func-4589"><span class="linenos">4589</span></a> +</span><span id="func-4590"><a href="#func-4590"><span class="linenos">4590</span></a> <span class="k">return</span> <span class="n">function</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a Func expression.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">func</span><span class="p">(</span><span class="s2">"abs"</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'ABS(5)'</span> +</code></pre> + </div> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">func</span><span class="p">(</span><span class="s2">"cast"</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n"><a href="#DataType.build">DataType.build</a></span><span class="p">(</span><span class="s2">"DOUBLE"</span><span class="p">))</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'CAST(5 AS DOUBLE)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>name:</strong> the name of the function to build.</li> +<li><strong>args:</strong> the args used to instantiate the function of interest.</li> +<li><strong>dialect:</strong> the source dialect.</li> +<li><strong>kwargs:</strong> the kwargs used to instantiate the function of interest.</li> +</ul> + +<h6 id="note">Note:</h6> + +<blockquote> + <p>The arguments <code>args</code> and <code>kwargs</code> are mutually exclusive.</p> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>An instance of the function of interest, or an anonymous function, if <code>name</code> doesn't + correspond to an existing <code><a href="#Func">sqlglot.expressions.Func</a></code> class.</p> +</blockquote> +</div> + + + </section> + <section id="true"> + <input id="true-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">true</span><span class="signature pdoc-code condensed">(<span class="return-annotation">):</span></span> + + <label class="view-source-button" for="true-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#true"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="true-4593"><a href="#true-4593"><span class="linenos">4593</span></a><span class="k">def</span> <span class="nf">true</span><span class="p">():</span> +</span><span id="true-4594"><a href="#true-4594"><span class="linenos">4594</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="true-4595"><a href="#true-4595"><span class="linenos">4595</span></a><span class="sd"> Returns a true Boolean expression.</span> +</span><span id="true-4596"><a href="#true-4596"><span class="linenos">4596</span></a><span class="sd"> """</span> +</span><span id="true-4597"><a href="#true-4597"><span class="linenos">4597</span></a> <span class="k">return</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a true Boolean expression.</p> +</div> + + + </section> + <section id="false"> + <input id="false-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">false</span><span class="signature pdoc-code condensed">(<span class="return-annotation">):</span></span> + + <label class="view-source-button" for="false-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#false"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="false-4600"><a href="#false-4600"><span class="linenos">4600</span></a><span class="k">def</span> <span class="nf">false</span><span class="p">():</span> +</span><span id="false-4601"><a href="#false-4601"><span class="linenos">4601</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="false-4602"><a href="#false-4602"><span class="linenos">4602</span></a><span class="sd"> Returns a false Boolean expression.</span> +</span><span id="false-4603"><a href="#false-4603"><span class="linenos">4603</span></a><span class="sd"> """</span> +</span><span id="false-4604"><a href="#false-4604"><span class="linenos">4604</span></a> <span class="k">return</span> <span class="n">Boolean</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a false Boolean expression.</p> +</div> + + + </section> + <section id="null"> + <input id="null-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">null</span><span class="signature pdoc-code condensed">(<span class="return-annotation">):</span></span> + + <label class="view-source-button" for="null-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#null"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="null-4607"><a href="#null-4607"><span class="linenos">4607</span></a><span class="k">def</span> <span class="nf">null</span><span class="p">():</span> +</span><span id="null-4608"><a href="#null-4608"><span class="linenos">4608</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="null-4609"><a href="#null-4609"><span class="linenos">4609</span></a><span class="sd"> Returns a Null expression.</span> +</span><span id="null-4610"><a href="#null-4610"><span class="linenos">4610</span></a><span class="sd"> """</span> +</span><span id="null-4611"><a href="#null-4611"><span class="linenos">4611</span></a> <span class="k">return</span> <span class="n">Null</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a Null expression.</p> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/generator.html b/docs/sqlglot/generator.html new file mode 100644 index 0000000..76dbbc0 --- /dev/null +++ b/docs/sqlglot/generator.html @@ -0,0 +1,9855 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.generator API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Generator">Generator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Generator.__init__">Generator</a> + </li> + <li> + <a class="function" href="#Generator.generate">generate</a> + </li> + <li> + <a class="function" href="#Generator.unsupported">unsupported</a> + </li> + <li> + <a class="function" href="#Generator.sep">sep</a> + </li> + <li> + <a class="function" href="#Generator.seg">seg</a> + </li> + <li> + <a class="function" href="#Generator.pad_comment">pad_comment</a> + </li> + <li> + <a class="function" href="#Generator.maybe_comment">maybe_comment</a> + </li> + <li> + <a class="function" href="#Generator.wrap">wrap</a> + </li> + <li> + <a class="function" href="#Generator.no_identify">no_identify</a> + </li> + <li> + <a class="function" href="#Generator.normalize_func">normalize_func</a> + </li> + <li> + <a class="function" href="#Generator.indent">indent</a> + </li> + <li> + <a class="function" href="#Generator.sql">sql</a> + </li> + <li> + <a class="function" href="#Generator.uncache_sql">uncache_sql</a> + </li> + <li> + <a class="function" href="#Generator.cache_sql">cache_sql</a> + </li> + <li> + <a class="function" href="#Generator.characterset_sql">characterset_sql</a> + </li> + <li> + <a class="function" href="#Generator.column_sql">column_sql</a> + </li> + <li> + <a class="function" href="#Generator.columndef_sql">columndef_sql</a> + </li> + <li> + <a class="function" href="#Generator.columnconstraint_sql">columnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.autoincrementcolumnconstraint_sql">autoincrementcolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.checkcolumnconstraint_sql">checkcolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.commentcolumnconstraint_sql">commentcolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.collatecolumnconstraint_sql">collatecolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.encodecolumnconstraint_sql">encodecolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.defaultcolumnconstraint_sql">defaultcolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.generatedasidentitycolumnconstraint_sql">generatedasidentitycolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.create_sql">create_sql</a> + </li> + <li> + <a class="function" href="#Generator.describe_sql">describe_sql</a> + </li> + <li> + <a class="function" href="#Generator.prepend_ctes">prepend_ctes</a> + </li> + <li> + <a class="function" href="#Generator.with_sql">with_sql</a> + </li> + <li> + <a class="function" href="#Generator.cte_sql">cte_sql</a> + </li> + <li> + <a class="function" href="#Generator.tablealias_sql">tablealias_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitstring_sql">bitstring_sql</a> + </li> + <li> + <a class="function" href="#Generator.hexstring_sql">hexstring_sql</a> + </li> + <li> + <a class="function" href="#Generator.datatype_sql">datatype_sql</a> + </li> + <li> + <a class="function" href="#Generator.directory_sql">directory_sql</a> + </li> + <li> + <a class="function" href="#Generator.delete_sql">delete_sql</a> + </li> + <li> + <a class="function" href="#Generator.drop_sql">drop_sql</a> + </li> + <li> + <a class="function" href="#Generator.except_sql">except_sql</a> + </li> + <li> + <a class="function" href="#Generator.except_op">except_op</a> + </li> + <li> + <a class="function" href="#Generator.fetch_sql">fetch_sql</a> + </li> + <li> + <a class="function" href="#Generator.filter_sql">filter_sql</a> + </li> + <li> + <a class="function" href="#Generator.hint_sql">hint_sql</a> + </li> + <li> + <a class="function" href="#Generator.index_sql">index_sql</a> + </li> + <li> + <a class="function" href="#Generator.identifier_sql">identifier_sql</a> + </li> + <li> + <a class="function" href="#Generator.national_sql">national_sql</a> + </li> + <li> + <a class="function" href="#Generator.partition_sql">partition_sql</a> + </li> + <li> + <a class="function" href="#Generator.properties_sql">properties_sql</a> + </li> + <li> + <a class="function" href="#Generator.root_properties">root_properties</a> + </li> + <li> + <a class="function" href="#Generator.properties">properties</a> + </li> + <li> + <a class="function" href="#Generator.with_properties">with_properties</a> + </li> + <li> + <a class="function" href="#Generator.locate_properties">locate_properties</a> + </li> + <li> + <a class="function" href="#Generator.property_sql">property_sql</a> + </li> + <li> + <a class="function" href="#Generator.likeproperty_sql">likeproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.fallbackproperty_sql">fallbackproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.journalproperty_sql">journalproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.freespaceproperty_sql">freespaceproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.checksumproperty_sql">checksumproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.blockcompressionproperty_sql">blockcompressionproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.isolatedloadingproperty_sql">isolatedloadingproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.insert_sql">insert_sql</a> + </li> + <li> + <a class="function" href="#Generator.intersect_sql">intersect_sql</a> + </li> + <li> + <a class="function" href="#Generator.intersect_op">intersect_op</a> + </li> + <li> + <a class="function" href="#Generator.introducer_sql">introducer_sql</a> + </li> + <li> + <a class="function" href="#Generator.pseudotype_sql">pseudotype_sql</a> + </li> + <li> + <a class="function" href="#Generator.rowformatdelimitedproperty_sql">rowformatdelimitedproperty_sql</a> + </li> + <li> + <a class="function" href="#Generator.table_sql">table_sql</a> + </li> + <li> + <a class="function" href="#Generator.tablesample_sql">tablesample_sql</a> + </li> + <li> + <a class="function" href="#Generator.pivot_sql">pivot_sql</a> + </li> + <li> + <a class="function" href="#Generator.tuple_sql">tuple_sql</a> + </li> + <li> + <a class="function" href="#Generator.update_sql">update_sql</a> + </li> + <li> + <a class="function" href="#Generator.values_sql">values_sql</a> + </li> + <li> + <a class="function" href="#Generator.var_sql">var_sql</a> + </li> + <li> + <a class="function" href="#Generator.into_sql">into_sql</a> + </li> + <li> + <a class="function" href="#Generator.from_sql">from_sql</a> + </li> + <li> + <a class="function" href="#Generator.group_sql">group_sql</a> + </li> + <li> + <a class="function" href="#Generator.having_sql">having_sql</a> + </li> + <li> + <a class="function" href="#Generator.join_sql">join_sql</a> + </li> + <li> + <a class="function" href="#Generator.lambda_sql">lambda_sql</a> + </li> + <li> + <a class="function" href="#Generator.lateral_sql">lateral_sql</a> + </li> + <li> + <a class="function" href="#Generator.limit_sql">limit_sql</a> + </li> + <li> + <a class="function" href="#Generator.offset_sql">offset_sql</a> + </li> + <li> + <a class="function" href="#Generator.lock_sql">lock_sql</a> + </li> + <li> + <a class="function" href="#Generator.literal_sql">literal_sql</a> + </li> + <li> + <a class="function" href="#Generator.loaddata_sql">loaddata_sql</a> + </li> + <li> + <a class="function" href="#Generator.null_sql">null_sql</a> + </li> + <li> + <a class="function" href="#Generator.boolean_sql">boolean_sql</a> + </li> + <li> + <a class="function" href="#Generator.order_sql">order_sql</a> + </li> + <li> + <a class="function" href="#Generator.cluster_sql">cluster_sql</a> + </li> + <li> + <a class="function" href="#Generator.distribute_sql">distribute_sql</a> + </li> + <li> + <a class="function" href="#Generator.sort_sql">sort_sql</a> + </li> + <li> + <a class="function" href="#Generator.ordered_sql">ordered_sql</a> + </li> + <li> + <a class="function" href="#Generator.matchrecognize_sql">matchrecognize_sql</a> + </li> + <li> + <a class="function" href="#Generator.query_modifiers">query_modifiers</a> + </li> + <li> + <a class="function" href="#Generator.select_sql">select_sql</a> + </li> + <li> + <a class="function" href="#Generator.schema_sql">schema_sql</a> + </li> + <li> + <a class="function" href="#Generator.star_sql">star_sql</a> + </li> + <li> + <a class="function" href="#Generator.structkwarg_sql">structkwarg_sql</a> + </li> + <li> + <a class="function" href="#Generator.parameter_sql">parameter_sql</a> + </li> + <li> + <a class="function" href="#Generator.sessionparameter_sql">sessionparameter_sql</a> + </li> + <li> + <a class="function" href="#Generator.placeholder_sql">placeholder_sql</a> + </li> + <li> + <a class="function" href="#Generator.subquery_sql">subquery_sql</a> + </li> + <li> + <a class="function" href="#Generator.qualify_sql">qualify_sql</a> + </li> + <li> + <a class="function" href="#Generator.union_sql">union_sql</a> + </li> + <li> + <a class="function" href="#Generator.union_op">union_op</a> + </li> + <li> + <a class="function" href="#Generator.unnest_sql">unnest_sql</a> + </li> + <li> + <a class="function" href="#Generator.where_sql">where_sql</a> + </li> + <li> + <a class="function" href="#Generator.window_sql">window_sql</a> + </li> + <li> + <a class="function" href="#Generator.partition_by_sql">partition_by_sql</a> + </li> + <li> + <a class="function" href="#Generator.window_spec_sql">window_spec_sql</a> + </li> + <li> + <a class="function" href="#Generator.withingroup_sql">withingroup_sql</a> + </li> + <li> + <a class="function" href="#Generator.between_sql">between_sql</a> + </li> + <li> + <a class="function" href="#Generator.bracket_sql">bracket_sql</a> + </li> + <li> + <a class="function" href="#Generator.all_sql">all_sql</a> + </li> + <li> + <a class="function" href="#Generator.any_sql">any_sql</a> + </li> + <li> + <a class="function" href="#Generator.exists_sql">exists_sql</a> + </li> + <li> + <a class="function" href="#Generator.case_sql">case_sql</a> + </li> + <li> + <a class="function" href="#Generator.constraint_sql">constraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.extract_sql">extract_sql</a> + </li> + <li> + <a class="function" href="#Generator.trim_sql">trim_sql</a> + </li> + <li> + <a class="function" href="#Generator.concat_sql">concat_sql</a> + </li> + <li> + <a class="function" href="#Generator.check_sql">check_sql</a> + </li> + <li> + <a class="function" href="#Generator.foreignkey_sql">foreignkey_sql</a> + </li> + <li> + <a class="function" href="#Generator.primarykey_sql">primarykey_sql</a> + </li> + <li> + <a class="function" href="#Generator.unique_sql">unique_sql</a> + </li> + <li> + <a class="function" href="#Generator.if_sql">if_sql</a> + </li> + <li> + <a class="function" href="#Generator.in_sql">in_sql</a> + </li> + <li> + <a class="function" href="#Generator.in_unnest_op">in_unnest_op</a> + </li> + <li> + <a class="function" href="#Generator.interval_sql">interval_sql</a> + </li> + <li> + <a class="function" href="#Generator.return_sql">return_sql</a> + </li> + <li> + <a class="function" href="#Generator.reference_sql">reference_sql</a> + </li> + <li> + <a class="function" href="#Generator.anonymous_sql">anonymous_sql</a> + </li> + <li> + <a class="function" href="#Generator.paren_sql">paren_sql</a> + </li> + <li> + <a class="function" href="#Generator.neg_sql">neg_sql</a> + </li> + <li> + <a class="function" href="#Generator.not_sql">not_sql</a> + </li> + <li> + <a class="function" href="#Generator.alias_sql">alias_sql</a> + </li> + <li> + <a class="function" href="#Generator.aliases_sql">aliases_sql</a> + </li> + <li> + <a class="function" href="#Generator.attimezone_sql">attimezone_sql</a> + </li> + <li> + <a class="function" href="#Generator.add_sql">add_sql</a> + </li> + <li> + <a class="function" href="#Generator.and_sql">and_sql</a> + </li> + <li> + <a class="function" href="#Generator.connector_sql">connector_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitwiseand_sql">bitwiseand_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitwiseleftshift_sql">bitwiseleftshift_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitwisenot_sql">bitwisenot_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitwiseor_sql">bitwiseor_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitwiserightshift_sql">bitwiserightshift_sql</a> + </li> + <li> + <a class="function" href="#Generator.bitwisexor_sql">bitwisexor_sql</a> + </li> + <li> + <a class="function" href="#Generator.cast_sql">cast_sql</a> + </li> + <li> + <a class="function" href="#Generator.currentdate_sql">currentdate_sql</a> + </li> + <li> + <a class="function" href="#Generator.collate_sql">collate_sql</a> + </li> + <li> + <a class="function" href="#Generator.command_sql">command_sql</a> + </li> + <li> + <a class="function" href="#Generator.transaction_sql">transaction_sql</a> + </li> + <li> + <a class="function" href="#Generator.commit_sql">commit_sql</a> + </li> + <li> + <a class="function" href="#Generator.rollback_sql">rollback_sql</a> + </li> + <li> + <a class="function" href="#Generator.altercolumn_sql">altercolumn_sql</a> + </li> + <li> + <a class="function" href="#Generator.renametable_sql">renametable_sql</a> + </li> + <li> + <a class="function" href="#Generator.altertable_sql">altertable_sql</a> + </li> + <li> + <a class="function" href="#Generator.droppartition_sql">droppartition_sql</a> + </li> + <li> + <a class="function" href="#Generator.addconstraint_sql">addconstraint_sql</a> + </li> + <li> + <a class="function" href="#Generator.distinct_sql">distinct_sql</a> + </li> + <li> + <a class="function" href="#Generator.ignorenulls_sql">ignorenulls_sql</a> + </li> + <li> + <a class="function" href="#Generator.respectnulls_sql">respectnulls_sql</a> + </li> + <li> + <a class="function" href="#Generator.intdiv_sql">intdiv_sql</a> + </li> + <li> + <a class="function" href="#Generator.dpipe_sql">dpipe_sql</a> + </li> + <li> + <a class="function" href="#Generator.div_sql">div_sql</a> + </li> + <li> + <a class="function" href="#Generator.distance_sql">distance_sql</a> + </li> + <li> + <a class="function" href="#Generator.dot_sql">dot_sql</a> + </li> + <li> + <a class="function" href="#Generator.eq_sql">eq_sql</a> + </li> + <li> + <a class="function" href="#Generator.escape_sql">escape_sql</a> + </li> + <li> + <a class="function" href="#Generator.glob_sql">glob_sql</a> + </li> + <li> + <a class="function" href="#Generator.gt_sql">gt_sql</a> + </li> + <li> + <a class="function" href="#Generator.gte_sql">gte_sql</a> + </li> + <li> + <a class="function" href="#Generator.ilike_sql">ilike_sql</a> + </li> + <li> + <a class="function" href="#Generator.is_sql">is_sql</a> + </li> + <li> + <a class="function" href="#Generator.like_sql">like_sql</a> + </li> + <li> + <a class="function" href="#Generator.similarto_sql">similarto_sql</a> + </li> + <li> + <a class="function" href="#Generator.lt_sql">lt_sql</a> + </li> + <li> + <a class="function" href="#Generator.lte_sql">lte_sql</a> + </li> + <li> + <a class="function" href="#Generator.mod_sql">mod_sql</a> + </li> + <li> + <a class="function" href="#Generator.mul_sql">mul_sql</a> + </li> + <li> + <a class="function" href="#Generator.neq_sql">neq_sql</a> + </li> + <li> + <a class="function" href="#Generator.nullsafeeq_sql">nullsafeeq_sql</a> + </li> + <li> + <a class="function" href="#Generator.nullsafeneq_sql">nullsafeneq_sql</a> + </li> + <li> + <a class="function" href="#Generator.or_sql">or_sql</a> + </li> + <li> + <a class="function" href="#Generator.slice_sql">slice_sql</a> + </li> + <li> + <a class="function" href="#Generator.sub_sql">sub_sql</a> + </li> + <li> + <a class="function" href="#Generator.trycast_sql">trycast_sql</a> + </li> + <li> + <a class="function" href="#Generator.use_sql">use_sql</a> + </li> + <li> + <a class="function" href="#Generator.binary">binary</a> + </li> + <li> + <a class="function" href="#Generator.function_fallback_sql">function_fallback_sql</a> + </li> + <li> + <a class="function" href="#Generator.format_args">format_args</a> + </li> + <li> + <a class="function" href="#Generator.text_width">text_width</a> + </li> + <li> + <a class="function" href="#Generator.format_time">format_time</a> + </li> + <li> + <a class="function" href="#Generator.expressions">expressions</a> + </li> + <li> + <a class="function" href="#Generator.op_expressions">op_expressions</a> + </li> + <li> + <a class="function" href="#Generator.naked_property">naked_property</a> + </li> + <li> + <a class="function" href="#Generator.set_operation">set_operation</a> + </li> + <li> + <a class="function" href="#Generator.tag_sql">tag_sql</a> + </li> + <li> + <a class="function" href="#Generator.token_sql">token_sql</a> + </li> + <li> + <a class="function" href="#Generator.userdefinedfunction_sql">userdefinedfunction_sql</a> + </li> + <li> + <a class="function" href="#Generator.userdefinedfunctionkwarg_sql">userdefinedfunctionkwarg_sql</a> + </li> + <li> + <a class="function" href="#Generator.joinhint_sql">joinhint_sql</a> + </li> + <li> + <a class="function" href="#Generator.kwarg_sql">kwarg_sql</a> + </li> + <li> + <a class="function" href="#Generator.when_sql">when_sql</a> + </li> + <li> + <a class="function" href="#Generator.merge_sql">merge_sql</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/generator.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.generator </h1> + + + <input id="mod-generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-generator-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">logging</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">re</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ErrorLevel</span><span class="p">,</span> <span class="n">UnsupportedError</span><span class="p">,</span> <span class="n">concat_messages</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">apply_index_offset</span><span class="p">,</span> <span class="n">csv</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.time</span> <span class="kn">import</span> <span class="n">format_time</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"sqlglot"</span><span class="p">)</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="n">BACKSLASH_RE</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">"</span><span class="se">\\</span><span class="s2">(?!b|f|n|r|t|0)"</span><span class="p">)</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="k">class</span> <span class="nc">Generator</span><span class="p">:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Generator interprets the given syntax tree and produces a SQL string as an output.</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> Args:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> time_mapping (dict): the dictionary of custom time mappings in which the key</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> represents a python time format and the output the target time format</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> time_trie (trie): a trie of the time_mapping keys</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> pretty (bool): if set to True the returned string will be formatted. Default: False.</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> quote_start (str): specifies which starting character to use to delimit quotes. Default: '.</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a><span class="sd"> quote_end (str): specifies which ending character to use to delimit quotes. Default: '.</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a><span class="sd"> identifier_start (str): specifies which starting character to use to delimit identifiers. Default: ".</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a><span class="sd"> identifier_end (str): specifies which ending character to use to delimit identifiers. Default: ".</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a><span class="sd"> identify (bool): if set to True all identifiers will be delimited by the corresponding</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="sd"> character.</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="sd"> normalize (bool): if set to True all identifiers will lower cased</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="sd"> string_escape (str): specifies a string escape character. Default: '.</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="sd"> identifier_escape (str): specifies an identifier escape character. Default: ".</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a><span class="sd"> pad (int): determines padding in a formatted string. Default: 2.</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="sd"> indent (int): determines the size of indentation in a formatted string. Default: 4.</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a><span class="sd"> unnest_column_only (bool): if true unnest table aliases are considered only as column aliases</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a><span class="sd"> normalize_functions (str): normalize function names, "upper", "lower", or None</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="sd"> Default: "upper"</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="sd"> alias_post_tablesample (bool): if the table alias comes after tablesample</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="sd"> Default: False</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="sd"> unsupported_level (ErrorLevel): determines the generator's behavior when it encounters</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="sd"> unsupported expressions. Default ErrorLevel.WARN.</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="sd"> null_ordering (str): Indicates the default null ordering method to use if not explicitly set.</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="sd"> Options are "nulls_are_small", "nulls_are_large", "nulls_are_last".</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="sd"> Default: "nulls_are_small"</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> max_unsupported (int): Maximum number of unsupported messages to include in a raised UnsupportedError.</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd"> This is only relevant if unsupported_level is ErrorLevel.RAISE.</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> Default: 3</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="sd"> leading_comma (bool): if the the comma is leading or trailing in select statements</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> Default: False</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="sd"> max_text_width: The max number of characters in a segment before creating new lines in pretty mode.</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="sd"> The default is on the smaller end because the length only represents a segment and not the true</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> line length.</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> Default: 80</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> comments: Whether or not to preserve comments in the output SQL code.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="sd"> Default: True</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="sd"> """</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATEDIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TS_OR_DS_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"MAP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'keys'</span><span class="p">],</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'values'</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'DEFAULT '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'default'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">CHARACTER SET=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LanguageProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExecuteAsProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithJournalTableProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"WITH JOURNAL TABLE=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'NO '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'no'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">LOG"</span><span class="p">,</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SqlSecurityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"SQL SECURITY </span><span class="si">{</span><span class="s1">'DEFINER'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'definer'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'INVOKER'</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="p">}</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="c1"># Whether 'CREATE ... TRANSIENT ... TABLE' is allowed</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">CREATE_TRANSIENT</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="c1"># Whether or not null ordering is supported in order by</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">NULL_ORDERING_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="c1"># Whether or not locking reads (i.e. SELECT ... FOR UPDATE/SHARE) are supported</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="c1"># Always do union distinct or union all</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="c1"># Wrap derived values in parens, usually standard but spark doesn't support it</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">WRAP_DERIVED_VALUES</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="c1"># Whether or not create function uses an AS before the def.</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">CREATE_FUNCTION_AS</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"CHAR"</span><span class="p">,</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos"> 100</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos"> 101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos"> 102</span></a> <span class="p">}</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos"> 103</span></a> +</span><span id="L-104"><a href="#L-104"><span class="linenos"> 104</span></a> <span class="n">STAR_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos"> 105</span></a> <span class="s2">"except"</span><span class="p">:</span> <span class="s2">"EXCEPT"</span><span class="p">,</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos"> 106</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="s2">"REPLACE"</span><span class="p">,</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos"> 107</span></a> <span class="p">}</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos"> 108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos"> 109</span></a> <span class="n">TOKEN_MAPPING</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">TokenType</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos"> 110</span></a> +</span><span id="L-111"><a href="#L-111"><span class="linenos"> 111</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"<"</span><span class="p">,</span> <span class="s2">">"</span><span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos"> 112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos"> 113</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos"> 114</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos"> 115</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AlgorithmProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">,</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos"> 116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos"> 117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos"> 118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos"> 119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos"> 120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos"> 121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos"> 122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DefinerProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos"> 123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos"> 124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos"> 125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos"> 126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExecuteAsProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos"> 127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos"> 128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos"> 129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos"> 130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos"> 131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos"> 132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LanguageProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos"> 133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos"> 134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos"> 135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos"> 136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos"> 137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos"> 138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos"> 139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos"> 140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos"> 141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos"> 142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos"> 143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos"> 144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos"> 145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SqlSecurityProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos"> 146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos"> 147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos"> 148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithJournalTableProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos"> 149</span></a> <span class="p">}</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos"> 150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos"> 151</span></a> <span class="n">WITH_SEPARATED_COMMENTS</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos"> 152</span></a> <span class="n">SENTINEL_LINE_BREAK</span> <span class="o">=</span> <span class="s2">"__SQLGLOT__LB__"</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos"> 153</span></a> +</span><span id="L-154"><a href="#L-154"><span class="linenos"> 154</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos"> 155</span></a> <span class="s2">"time_mapping"</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos"> 156</span></a> <span class="s2">"time_trie"</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos"> 157</span></a> <span class="s2">"pretty"</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos"> 158</span></a> <span class="s2">"quote_start"</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos"> 159</span></a> <span class="s2">"quote_end"</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos"> 160</span></a> <span class="s2">"identifier_start"</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos"> 161</span></a> <span class="s2">"identifier_end"</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos"> 162</span></a> <span class="s2">"identify"</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos"> 163</span></a> <span class="s2">"normalize"</span><span class="p">,</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos"> 164</span></a> <span class="s2">"string_escape"</span><span class="p">,</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos"> 165</span></a> <span class="s2">"identifier_escape"</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos"> 166</span></a> <span class="s2">"pad"</span><span class="p">,</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos"> 167</span></a> <span class="s2">"index_offset"</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos"> 168</span></a> <span class="s2">"unnest_column_only"</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos"> 169</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">,</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos"> 170</span></a> <span class="s2">"normalize_functions"</span><span class="p">,</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos"> 171</span></a> <span class="s2">"unsupported_level"</span><span class="p">,</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos"> 172</span></a> <span class="s2">"unsupported_messages"</span><span class="p">,</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos"> 173</span></a> <span class="s2">"null_ordering"</span><span class="p">,</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos"> 174</span></a> <span class="s2">"max_unsupported"</span><span class="p">,</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos"> 175</span></a> <span class="s2">"_indent"</span><span class="p">,</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos"> 176</span></a> <span class="s2">"_replace_backslash"</span><span class="p">,</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos"> 177</span></a> <span class="s2">"_escaped_quote_end"</span><span class="p">,</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos"> 178</span></a> <span class="s2">"_escaped_identifier_end"</span><span class="p">,</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos"> 179</span></a> <span class="s2">"_leading_comma"</span><span class="p">,</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos"> 180</span></a> <span class="s2">"_max_text_width"</span><span class="p">,</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos"> 181</span></a> <span class="s2">"_comments"</span><span class="p">,</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos"> 182</span></a> <span class="p">)</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos"> 183</span></a> +</span><span id="L-184"><a href="#L-184"><span class="linenos"> 184</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos"> 185</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos"> 186</span></a> <span class="n">time_mapping</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos"> 187</span></a> <span class="n">time_trie</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos"> 188</span></a> <span class="n">pretty</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos"> 189</span></a> <span class="n">quote_start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos"> 190</span></a> <span class="n">quote_end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos"> 191</span></a> <span class="n">identifier_start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos"> 192</span></a> <span class="n">identifier_end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos"> 193</span></a> <span class="n">identify</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos"> 194</span></a> <span class="n">normalize</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos"> 195</span></a> <span class="n">string_escape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos"> 196</span></a> <span class="n">identifier_escape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos"> 197</span></a> <span class="n">pad</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos"> 198</span></a> <span class="n">indent</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos"> 199</span></a> <span class="n">index_offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos"> 200</span></a> <span class="n">unnest_column_only</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos"> 201</span></a> <span class="n">alias_post_tablesample</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos"> 202</span></a> <span class="n">normalize_functions</span><span class="o">=</span><span class="s2">"upper"</span><span class="p">,</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos"> 203</span></a> <span class="n">unsupported_level</span><span class="o">=</span><span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">,</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos"> 204</span></a> <span class="n">null_ordering</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos"> 205</span></a> <span class="n">max_unsupported</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos"> 206</span></a> <span class="n">leading_comma</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos"> 207</span></a> <span class="n">max_text_width</span><span class="o">=</span><span class="mi">80</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos"> 208</span></a> <span class="n">comments</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos"> 209</span></a> <span class="p">):</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos"> 210</span></a> <span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos"> 211</span></a> +</span><span id="L-212"><a href="#L-212"><span class="linenos"> 212</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">time_mapping</span> <span class="o">=</span> <span class="n">time_mapping</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos"> 213</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">time_trie</span> <span class="o">=</span> <span class="n">time_trie</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos"> 214</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="o">=</span> <span class="n">pretty</span> <span class="k">if</span> <span class="n">pretty</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">pretty</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos"> 215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span> <span class="o">=</span> <span class="n">quote_start</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos"> 216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span> <span class="o">=</span> <span class="n">quote_end</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos"> 217</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span> <span class="o">=</span> <span class="n">identifier_start</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos"> 218</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span> <span class="o">=</span> <span class="n">identifier_end</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos"> 219</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="n">identify</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos"> 220</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">normalize</span> <span class="o">=</span> <span class="n">normalize</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos"> 221</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">=</span> <span class="n">string_escape</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos"> 222</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_escape</span> <span class="o">=</span> <span class="n">identifier_escape</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos"> 223</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos"> 224</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span> <span class="o">=</span> <span class="n">index_offset</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos"> 225</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span> <span class="o">=</span> <span class="n">unnest_column_only</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos"> 226</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="n">alias_post_tablesample</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos"> 227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">=</span> <span class="n">normalize_functions</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos"> 228</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">=</span> <span class="n">unsupported_level</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos"> 229</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos"> 230</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">max_unsupported</span> <span class="o">=</span> <span class="n">max_unsupported</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos"> 231</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">=</span> <span class="n">null_ordering</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos"> 232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_indent</span> <span class="o">=</span> <span class="n">indent</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos"> 233</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">==</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos"> 234</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_quote_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos"> 235</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_identifier_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_escape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos"> 236</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_leading_comma</span> <span class="o">=</span> <span class="n">leading_comma</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos"> 237</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span> <span class="o">=</span> <span class="n">max_text_width</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos"> 238</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos"> 239</span></a> +</span><span id="L-240"><a href="#L-240"><span class="linenos"> 240</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos"> 241</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos"> 242</span></a><span class="sd"> Generates a SQL string by interpreting the given syntax tree.</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos"> 243</span></a> +</span><span id="L-244"><a href="#L-244"><span class="linenos"> 244</span></a><span class="sd"> Args</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos"> 245</span></a><span class="sd"> expression: the syntax tree.</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos"> 246</span></a> +</span><span id="L-247"><a href="#L-247"><span class="linenos"> 247</span></a><span class="sd"> Returns</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos"> 248</span></a><span class="sd"> the SQL string.</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos"> 249</span></a><span class="sd"> """</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos"> 250</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos"> 251</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos"> 252</span></a> +</span><span id="L-253"><a href="#L-253"><span class="linenos"> 253</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IGNORE</span><span class="p">:</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos"> 254</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos"> 255</span></a> +</span><span id="L-256"><a href="#L-256"><span class="linenos"> 256</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos"> 257</span></a> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">:</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos"> 258</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos"> 259</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">RAISE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">:</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos"> 260</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="n">concat_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_unsupported</span><span class="p">))</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos"> 261</span></a> +</span><span id="L-262"><a href="#L-262"><span class="linenos"> 262</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos"> 263</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SENTINEL_LINE_BREAK</span><span class="p">,</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos"> 264</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos"> 265</span></a> +</span><span id="L-266"><a href="#L-266"><span class="linenos"> 266</span></a> <span class="k">def</span> <span class="nf">unsupported</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos"> 267</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span><span class="p">:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos"> 268</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos"> 269</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos"> 270</span></a> +</span><span id="L-271"><a href="#L-271"><span class="linenos"> 271</span></a> <span class="k">def</span> <span class="nf">sep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos"> 272</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="n">sep</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos"> 273</span></a> +</span><span id="L-274"><a href="#L-274"><span class="linenos"> 274</span></a> <span class="k">def</span> <span class="nf">seg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos"> 275</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="n">sep</span><span class="p">)</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos"> 276</span></a> +</span><span id="L-277"><a href="#L-277"><span class="linenos"> 277</span></a> <span class="k">def</span> <span class="nf">pad_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comment</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos"> 278</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="n">comment</span> <span class="k">if</span> <span class="n">comment</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">else</span> <span class="n">comment</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos"> 279</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="n">comment</span> <span class="o">+</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">comment</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">else</span> <span class="n">comment</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos"> 280</span></a> <span class="k">return</span> <span class="n">comment</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos"> 281</span></a> +</span><span id="L-282"><a href="#L-282"><span class="linenos"> 282</span></a> <span class="k">def</span> <span class="nf">maybe_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos"> 283</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos"> 284</span></a> +</span><span id="L-285"><a href="#L-285"><span class="linenos"> 285</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos"> 286</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos"> 287</span></a> +</span><span id="L-288"><a href="#L-288"><span class="linenos"> 288</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos"> 289</span></a> <span class="n">comments_sql</span> <span class="o">=</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos"> 290</span></a> <span class="sa">f</span><span class="s2">"/*</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">pad_comment</span><span class="p">(</span><span class="n">comment</span><span class="p">)</span><span class="si">}</span><span class="s2">*/"</span> <span class="k">for</span> <span class="n">comment</span> <span class="ow">in</span> <span class="n">comments</span> <span class="k">if</span> <span class="n">comment</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos"> 291</span></a> <span class="p">)</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos"> 292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos"> 293</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">comments_sql</span><span class="p">:</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos"> 294</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos"> 295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos"> 296</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">WITH_SEPARATED_COMMENTS</span><span class="p">):</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos"> 297</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">comments_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos"> 298</span></a> +</span><span id="L-299"><a href="#L-299"><span class="linenos"> 299</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">comments_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos"> 300</span></a> +</span><span id="L-301"><a href="#L-301"><span class="linenos"> 301</span></a> <span class="k">def</span> <span class="nf">wrap</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos"> 302</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos"> 303</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos"> 304</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">))</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos"> 305</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos"> 306</span></a> <span class="n">level</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos"> 307</span></a> <span class="n">pad</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos"> 308</span></a> <span class="p">)</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos"> 309</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="n">this_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos"> 310</span></a> +</span><span id="L-311"><a href="#L-311"><span class="linenos"> 311</span></a> <span class="k">def</span> <span class="nf">no_identify</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos"> 312</span></a> <span class="n">original</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos"> 313</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos"> 314</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos"> 315</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="n">original</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos"> 316</span></a> <span class="k">return</span> <span class="n">result</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos"> 317</span></a> +</span><span id="L-318"><a href="#L-318"><span class="linenos"> 318</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos"> 319</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">==</span> <span class="s2">"upper"</span><span class="p">:</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos"> 320</span></a> <span class="k">return</span> <span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos"> 321</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">==</span> <span class="s2">"lower"</span><span class="p">:</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos"> 322</span></a> <span class="k">return</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos"> 323</span></a> <span class="k">return</span> <span class="n">name</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos"> 324</span></a> +</span><span id="L-325"><a href="#L-325"><span class="linenos"> 325</span></a> <span class="k">def</span> <span class="nf">indent</span><span class="p">(</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos"> 326</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos"> 327</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos"> 328</span></a> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos"> 329</span></a> <span class="n">pad</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos"> 330</span></a> <span class="n">skip_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos"> 331</span></a> <span class="n">skip_last</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos"> 332</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos"> 333</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos"> 334</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos"> 335</span></a> +</span><span id="L-336"><a href="#L-336"><span class="linenos"> 336</span></a> <span class="n">pad</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> <span class="k">if</span> <span class="n">pad</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">pad</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos"> 337</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos"> 338</span></a> +</span><span id="L-339"><a href="#L-339"><span class="linenos"> 339</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos"> 340</span></a> <span class="n">line</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos"> 341</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">skip_first</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">skip_last</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos"> 342</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">' '</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="p">(</span><span class="n">level</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="bp">self</span><span class="o">.</span><span class="n">_indent</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">pad</span><span class="p">)</span><span class="si">}{</span><span class="n">line</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos"> 343</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">line</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos"> 344</span></a> <span class="p">)</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos"> 345</span></a> +</span><span id="L-346"><a href="#L-346"><span class="linenos"> 346</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos"> 347</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos"> 348</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos"> 349</span></a> <span class="n">key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos"> 350</span></a> <span class="n">comment</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos"> 351</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos"> 352</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos"> 353</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos"> 354</span></a> +</span><span id="L-355"><a href="#L-355"><span class="linenos"> 355</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos"> 356</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos"> 357</span></a> +</span><span id="L-358"><a href="#L-358"><span class="linenos"> 358</span></a> <span class="k">if</span> <span class="n">key</span><span class="p">:</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos"> 359</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos"> 360</span></a> +</span><span id="L-361"><a href="#L-361"><span class="linenos"> 361</span></a> <span class="n">transform</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos"> 362</span></a> +</span><span id="L-363"><a href="#L-363"><span class="linenos"> 363</span></a> <span class="k">if</span> <span class="n">callable</span><span class="p">(</span><span class="n">transform</span><span class="p">):</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos"> 364</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos"> 365</span></a> <span class="k">elif</span> <span class="n">transform</span><span class="p">:</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos"> 366</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">transform</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos"> 367</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos"> 368</span></a> <span class="n">exp_handler_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">_sql"</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos"> 369</span></a> +</span><span id="L-370"><a href="#L-370"><span class="linenos"> 370</span></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_handler_name</span><span class="p">):</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos"> 371</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_handler_name</span><span class="p">)(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos"> 372</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos"> 373</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos"> 374</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">):</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos"> 375</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">property_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos"> 376</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos"> 377</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported expression type </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos"> 378</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos"> 379</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected an Expression. Received </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">expression</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos"> 380</span></a> +</span><span id="L-381"><a href="#L-381"><span class="linenos"> 381</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">maybe_comment</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="ow">and</span> <span class="n">comment</span> <span class="k">else</span> <span class="n">sql</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos"> 382</span></a> +</span><span id="L-383"><a href="#L-383"><span class="linenos"> 383</span></a> <span class="k">def</span> <span class="nf">uncache_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Uncache</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos"> 384</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos"> 385</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos"> 386</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNCACHE TABLE</span><span class="si">{</span><span class="n">exists_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos"> 387</span></a> +</span><span id="L-388"><a href="#L-388"><span class="linenos"> 388</span></a> <span class="k">def</span> <span class="nf">cache_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos"> 389</span></a> <span class="n">lazy</span> <span class="o">=</span> <span class="s2">" LAZY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"lazy"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos"> 390</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos"> 391</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"options"</span><span class="p">)</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos"> 392</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" OPTIONS(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos"> 393</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos"> 394</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos"> 395</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CACHE</span><span class="si">{</span><span class="n">lazy</span><span class="si">}</span><span class="s2"> TABLE </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="n">options</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos"> 396</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos"> 397</span></a> +</span><span id="L-398"><a href="#L-398"><span class="linenos"> 398</span></a> <span class="k">def</span> <span class="nf">characterset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos"> 399</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos"> 400</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHAR CHARACTER SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos"> 401</span></a> <span class="n">default</span> <span class="o">=</span> <span class="s2">"DEFAULT "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos"> 402</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">CHARACTER SET=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos"> 403</span></a> +</span><span id="L-404"><a href="#L-404"><span class="linenos"> 404</span></a> <span class="k">def</span> <span class="nf">column_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos"> 405</span></a> <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos"> 406</span></a> <span class="n">part</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos"> 407</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos"> 408</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">),</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos"> 409</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">),</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos"> 410</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos"> 411</span></a> <span class="p">]</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos"> 412</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos"> 413</span></a> <span class="p">)</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos"> 414</span></a> +</span><span id="L-415"><a href="#L-415"><span class="linenos"> 415</span></a> <span class="k">def</span> <span class="nf">columndef_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos"> 416</span></a> <span class="n">column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos"> 417</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos"> 418</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"constraints"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos"> 419</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">"IF NOT EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos"> 420</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos"> 421</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">constraints</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">constraints</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos"> 422</span></a> +</span><span id="L-423"><a href="#L-423"><span class="linenos"> 423</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">exists</span><span class="si">}{</span><span class="n">column</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">constraints</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos"> 424</span></a> +</span><span id="L-425"><a href="#L-425"><span class="linenos"> 425</span></a> <span class="k">def</span> <span class="nf">columnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos"> 426</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos"> 427</span></a> <span class="n">kind_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos"> 428</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">kind_sql</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos"> 429</span></a> +</span><span id="L-430"><a href="#L-430"><span class="linenos"> 430</span></a> <span class="k">def</span> <span class="nf">autoincrementcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos"> 431</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">token_sql</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">)</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos"> 432</span></a> +</span><span id="L-433"><a href="#L-433"><span class="linenos"> 433</span></a> <span class="k">def</span> <span class="nf">checkcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CheckColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos"> 434</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos"> 435</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECK (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos"> 436</span></a> +</span><span id="L-437"><a href="#L-437"><span class="linenos"> 437</span></a> <span class="k">def</span> <span class="nf">commentcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CommentColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-438"><a href="#L-438"><span class="linenos"> 438</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos"> 439</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COMMENT </span><span class="si">{</span><span class="n">comment</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos"> 440</span></a> +</span><span id="L-441"><a href="#L-441"><span class="linenos"> 441</span></a> <span class="k">def</span> <span class="nf">collatecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CollateColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos"> 442</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos"> 443</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos"> 444</span></a> +</span><span id="L-445"><a href="#L-445"><span class="linenos"> 445</span></a> <span class="k">def</span> <span class="nf">encodecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EncodeColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos"> 446</span></a> <span class="n">encode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos"> 447</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ENCODE </span><span class="si">{</span><span class="n">encode</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos"> 448</span></a> +</span><span id="L-449"><a href="#L-449"><span class="linenos"> 449</span></a> <span class="k">def</span> <span class="nf">defaultcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DefaultColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos"> 450</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos"> 451</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DEFAULT </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos"> 452</span></a> +</span><span id="L-453"><a href="#L-453"><span class="linenos"> 453</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos"> 454</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos"> 455</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos"> 456</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos"> 457</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-458"><a href="#L-458"><span class="linenos"> 458</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">" ALWAYS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">" BY DEFAULT "</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos"> 459</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos"> 460</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"START WITH </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos"> 461</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos"> 462</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INCREMENT BY </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos"> 463</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-464"><a href="#L-464"><span class="linenos"> 464</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">or</span> <span class="n">increment</span><span class="p">:</span> +</span><span id="L-465"><a href="#L-465"><span class="linenos"> 465</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-466"><a href="#L-466"><span class="linenos"> 466</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" (</span><span class="si">{</span><span class="n">sequence_opts</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos"> 467</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"GENERATED</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">AS IDENTITY</span><span class="si">{</span><span class="n">sequence_opts</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-468"><a href="#L-468"><span class="linenos"> 468</span></a> +</span><span id="L-469"><a href="#L-469"><span class="linenos"> 469</span></a> <span class="k">def</span> <span class="nf">notnullcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos"> 470</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'allow_null'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'NOT '</span><span class="si">}</span><span class="s2">NULL"</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos"> 471</span></a> +</span><span id="L-472"><a href="#L-472"><span class="linenos"> 472</span></a> <span class="k">def</span> <span class="nf">primarykeycolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKeyColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-473"><a href="#L-473"><span class="linenos"> 473</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> +</span><span id="L-474"><a href="#L-474"><span class="linenos"> 474</span></a> <span class="k">if</span> <span class="n">desc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos"> 475</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY</span><span class="si">{</span><span class="s1">' DESC'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">desc</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ASC'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-476"><a href="#L-476"><span class="linenos"> 476</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY"</span> +</span><span id="L-477"><a href="#L-477"><span class="linenos"> 477</span></a> +</span><span id="L-478"><a href="#L-478"><span class="linenos"> 478</span></a> <span class="k">def</span> <span class="nf">uniquecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos"> 479</span></a> <span class="k">return</span> <span class="s2">"UNIQUE"</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos"> 480</span></a> +</span><span id="L-481"><a href="#L-481"><span class="linenos"> 481</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-482"><a href="#L-482"><span class="linenos"> 482</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos"> 483</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"properties"</span><span class="p">)</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos"> 484</span></a> <span class="n">properties_exp</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos"> 485</span></a> <span class="n">properties_locs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">locate_properties</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> <span class="k">if</span> <span class="n">properties</span> <span class="k">else</span> <span class="p">{}</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos"> 486</span></a> <span class="k">if</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">)</span> <span class="ow">or</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span> +</span><span id="L-487"><a href="#L-487"><span class="linenos"> 487</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos"> 488</span></a> <span class="p">):</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos"> 489</span></a> <span class="n">properties_exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos"> 490</span></a> <span class="s2">"properties"</span><span class="p">,</span> +</span><span id="L-491"><a href="#L-491"><span class="linenos"> 491</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span> +</span><span id="L-492"><a href="#L-492"><span class="linenos"> 492</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos"> 493</span></a> <span class="o">*</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">],</span> +</span><span id="L-494"><a href="#L-494"><span class="linenos"> 494</span></a> <span class="o">*</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">],</span> +</span><span id="L-495"><a href="#L-495"><span class="linenos"> 495</span></a> <span class="p">]</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos"> 496</span></a> <span class="p">),</span> +</span><span id="L-497"><a href="#L-497"><span class="linenos"> 497</span></a> <span class="p">)</span> +</span><span id="L-498"><a href="#L-498"><span class="linenos"> 498</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"TABLE"</span> <span class="ow">and</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">):</span> +</span><span id="L-499"><a href="#L-499"><span class="linenos"> 499</span></a> <span class="n">this_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-500"><a href="#L-500"><span class="linenos"> 500</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="L-501"><a href="#L-501"><span class="linenos"> 501</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">]),</span> +</span><span id="L-502"><a href="#L-502"><span class="linenos"> 502</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-503"><a href="#L-503"><span class="linenos"> 503</span></a> <span class="p">)</span> +</span><span id="L-504"><a href="#L-504"><span class="linenos"> 504</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-505"><a href="#L-505"><span class="linenos"> 505</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this_name</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">this_properties</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-506"><a href="#L-506"><span class="linenos"> 506</span></a> <span class="n">properties_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-507"><a href="#L-507"><span class="linenos"> 507</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-508"><a href="#L-508"><span class="linenos"> 508</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-509"><a href="#L-509"><span class="linenos"> 509</span></a> <span class="n">properties_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">properties_exp</span><span class="p">,</span> <span class="s2">"properties"</span><span class="p">)</span> +</span><span id="L-510"><a href="#L-510"><span class="linenos"> 510</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="s2">" BEGIN"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"begin"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-511"><a href="#L-511"><span class="linenos"> 511</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-512"><a href="#L-512"><span class="linenos"> 512</span></a> <span class="k">if</span> <span class="n">expression_sql</span><span class="p">:</span> +</span><span id="L-513"><a href="#L-513"><span class="linenos"> 513</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">begin</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-514"><a href="#L-514"><span class="linenos"> 514</span></a> +</span><span id="L-515"><a href="#L-515"><span class="linenos"> 515</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">CREATE_FUNCTION_AS</span> <span class="ow">or</span> <span class="n">kind</span> <span class="o">!=</span> <span class="s2">"FUNCTION"</span><span class="p">:</span> +</span><span id="L-516"><a href="#L-516"><span class="linenos"> 516</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-517"><a href="#L-517"><span class="linenos"> 517</span></a> +</span><span id="L-518"><a href="#L-518"><span class="linenos"> 518</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-519"><a href="#L-519"><span class="linenos"> 519</span></a> <span class="n">transient</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-520"><a href="#L-520"><span class="linenos"> 520</span></a> <span class="s2">" TRANSIENT"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">CREATE_TRANSIENT</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"transient"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-521"><a href="#L-521"><span class="linenos"> 521</span></a> <span class="p">)</span> +</span><span id="L-522"><a href="#L-522"><span class="linenos"> 522</span></a> <span class="n">external</span> <span class="o">=</span> <span class="s2">" EXTERNAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"external"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-523"><a href="#L-523"><span class="linenos"> 523</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="s2">" OR REPLACE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"replace"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-524"><a href="#L-524"><span class="linenos"> 524</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF NOT EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-525"><a href="#L-525"><span class="linenos"> 525</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="s2">" UNIQUE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unique"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-526"><a href="#L-526"><span class="linenos"> 526</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="s2">" MATERIALIZED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"materialized"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-527"><a href="#L-527"><span class="linenos"> 527</span></a> <span class="n">set_</span> <span class="o">=</span> <span class="s2">" SET"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"set"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-528"><a href="#L-528"><span class="linenos"> 528</span></a> <span class="n">multiset</span> <span class="o">=</span> <span class="s2">" MULTISET"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"multiset"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-529"><a href="#L-529"><span class="linenos"> 529</span></a> <span class="n">global_temporary</span> <span class="o">=</span> <span class="s2">" GLOBAL TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global_temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-530"><a href="#L-530"><span class="linenos"> 530</span></a> <span class="n">volatile</span> <span class="o">=</span> <span class="s2">" VOLATILE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"volatile"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-531"><a href="#L-531"><span class="linenos"> 531</span></a> <span class="n">data</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"data"</span><span class="p">)</span> +</span><span id="L-532"><a href="#L-532"><span class="linenos"> 532</span></a> <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-533"><a href="#L-533"><span class="linenos"> 533</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-534"><a href="#L-534"><span class="linenos"> 534</span></a> <span class="k">elif</span> <span class="n">data</span><span class="p">:</span> +</span><span id="L-535"><a href="#L-535"><span class="linenos"> 535</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">" WITH DATA"</span> +</span><span id="L-536"><a href="#L-536"><span class="linenos"> 536</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-537"><a href="#L-537"><span class="linenos"> 537</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">" WITH NO DATA"</span> +</span><span id="L-538"><a href="#L-538"><span class="linenos"> 538</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"statistics"</span><span class="p">)</span> +</span><span id="L-539"><a href="#L-539"><span class="linenos"> 539</span></a> <span class="k">if</span> <span class="n">statistics</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-540"><a href="#L-540"><span class="linenos"> 540</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-541"><a href="#L-541"><span class="linenos"> 541</span></a> <span class="k">elif</span> <span class="n">statistics</span><span class="p">:</span> +</span><span id="L-542"><a href="#L-542"><span class="linenos"> 542</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">" AND STATISTICS"</span> +</span><span id="L-543"><a href="#L-543"><span class="linenos"> 543</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-544"><a href="#L-544"><span class="linenos"> 544</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">" AND NO STATISTICS"</span> +</span><span id="L-545"><a href="#L-545"><span class="linenos"> 545</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="s2">" NO PRIMARY INDEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_primary_index"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-546"><a href="#L-546"><span class="linenos"> 546</span></a> +</span><span id="L-547"><a href="#L-547"><span class="linenos"> 547</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"indexes"</span><span class="p">)</span> +</span><span id="L-548"><a href="#L-548"><span class="linenos"> 548</span></a> <span class="n">index_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-549"><a href="#L-549"><span class="linenos"> 549</span></a> <span class="k">if</span> <span class="n">indexes</span><span class="p">:</span> +</span><span id="L-550"><a href="#L-550"><span class="linenos"> 550</span></a> <span class="n">indexes_sql</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-551"><a href="#L-551"><span class="linenos"> 551</span></a> <span class="k">for</span> <span class="n">index</span> <span class="ow">in</span> <span class="n">indexes</span><span class="p">:</span> +</span><span id="L-552"><a href="#L-552"><span class="linenos"> 552</span></a> <span class="n">ind_unique</span> <span class="o">=</span> <span class="s2">" UNIQUE"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unique"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-553"><a href="#L-553"><span class="linenos"> 553</span></a> <span class="n">ind_primary</span> <span class="o">=</span> <span class="s2">" PRIMARY"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"primary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-554"><a href="#L-554"><span class="linenos"> 554</span></a> <span class="n">ind_amp</span> <span class="o">=</span> <span class="s2">" AMP"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"amp"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-555"><a href="#L-555"><span class="linenos"> 555</span></a> <span class="n">ind_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">index</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-556"><a href="#L-556"><span class="linenos"> 556</span></a> <span class="n">ind_columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-557"><a href="#L-557"><span class="linenos"> 557</span></a> <span class="sa">f</span><span class="s1">' (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">index</span><span class="p">,</span><span class="w"> </span><span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s1">)'</span> +</span><span id="L-558"><a href="#L-558"><span class="linenos"> 558</span></a> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> +</span><span id="L-559"><a href="#L-559"><span class="linenos"> 559</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-560"><a href="#L-560"><span class="linenos"> 560</span></a> <span class="p">)</span> +</span><span id="L-561"><a href="#L-561"><span class="linenos"> 561</span></a> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"primary"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span> +</span><span id="L-562"><a href="#L-562"><span class="linenos"> 562</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span> +</span><span id="L-563"><a href="#L-563"><span class="linenos"> 563</span></a> <span class="p">):</span> +</span><span id="L-564"><a href="#L-564"><span class="linenos"> 564</span></a> <span class="n">postindex_props_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="L-565"><a href="#L-565"><span class="linenos"> 565</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span> +</span><span id="L-566"><a href="#L-566"><span class="linenos"> 566</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">]</span> +</span><span id="L-567"><a href="#L-567"><span class="linenos"> 567</span></a> <span class="p">),</span> +</span><span id="L-568"><a href="#L-568"><span class="linenos"> 568</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-569"><a href="#L-569"><span class="linenos"> 569</span></a> <span class="p">)</span> +</span><span id="L-570"><a href="#L-570"><span class="linenos"> 570</span></a> <span class="n">ind_columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">ind_columns</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">postindex_props_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-571"><a href="#L-571"><span class="linenos"> 571</span></a> +</span><span id="L-572"><a href="#L-572"><span class="linenos"> 572</span></a> <span class="n">indexes_sql</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-573"><a href="#L-573"><span class="linenos"> 573</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">ind_unique</span><span class="si">}{</span><span class="n">ind_primary</span><span class="si">}{</span><span class="n">ind_amp</span><span class="si">}</span><span class="s2"> INDEX</span><span class="si">{</span><span class="n">ind_name</span><span class="si">}{</span><span class="n">ind_columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-574"><a href="#L-574"><span class="linenos"> 574</span></a> <span class="p">)</span> +</span><span id="L-575"><a href="#L-575"><span class="linenos"> 575</span></a> <span class="n">index_sql</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">indexes_sql</span><span class="p">)</span> +</span><span id="L-576"><a href="#L-576"><span class="linenos"> 576</span></a> +</span><span id="L-577"><a href="#L-577"><span class="linenos"> 577</span></a> <span class="n">postcreate_props_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-578"><a href="#L-578"><span class="linenos"> 578</span></a> <span class="k">if</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">):</span> +</span><span id="L-579"><a href="#L-579"><span class="linenos"> 579</span></a> <span class="n">postcreate_props_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="L-580"><a href="#L-580"><span class="linenos"> 580</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">]),</span> +</span><span id="L-581"><a href="#L-581"><span class="linenos"> 581</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> +</span><span id="L-582"><a href="#L-582"><span class="linenos"> 582</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> +</span><span id="L-583"><a href="#L-583"><span class="linenos"> 583</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-584"><a href="#L-584"><span class="linenos"> 584</span></a> <span class="p">)</span> +</span><span id="L-585"><a href="#L-585"><span class="linenos"> 585</span></a> +</span><span id="L-586"><a href="#L-586"><span class="linenos"> 586</span></a> <span class="n">modifiers</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-587"><a href="#L-587"><span class="linenos"> 587</span></a> <span class="p">(</span> +</span><span id="L-588"><a href="#L-588"><span class="linenos"> 588</span></a> <span class="n">replace</span><span class="p">,</span> +</span><span id="L-589"><a href="#L-589"><span class="linenos"> 589</span></a> <span class="n">temporary</span><span class="p">,</span> +</span><span id="L-590"><a href="#L-590"><span class="linenos"> 590</span></a> <span class="n">transient</span><span class="p">,</span> +</span><span id="L-591"><a href="#L-591"><span class="linenos"> 591</span></a> <span class="n">external</span><span class="p">,</span> +</span><span id="L-592"><a href="#L-592"><span class="linenos"> 592</span></a> <span class="n">unique</span><span class="p">,</span> +</span><span id="L-593"><a href="#L-593"><span class="linenos"> 593</span></a> <span class="n">materialized</span><span class="p">,</span> +</span><span id="L-594"><a href="#L-594"><span class="linenos"> 594</span></a> <span class="n">set_</span><span class="p">,</span> +</span><span id="L-595"><a href="#L-595"><span class="linenos"> 595</span></a> <span class="n">multiset</span><span class="p">,</span> +</span><span id="L-596"><a href="#L-596"><span class="linenos"> 596</span></a> <span class="n">global_temporary</span><span class="p">,</span> +</span><span id="L-597"><a href="#L-597"><span class="linenos"> 597</span></a> <span class="n">volatile</span><span class="p">,</span> +</span><span id="L-598"><a href="#L-598"><span class="linenos"> 598</span></a> <span class="n">postcreate_props_sql</span><span class="p">,</span> +</span><span id="L-599"><a href="#L-599"><span class="linenos"> 599</span></a> <span class="p">)</span> +</span><span id="L-600"><a href="#L-600"><span class="linenos"> 600</span></a> <span class="p">)</span> +</span><span id="L-601"><a href="#L-601"><span class="linenos"> 601</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-602"><a href="#L-602"><span class="linenos"> 602</span></a> <span class="s2">" WITH NO SCHEMA BINDING"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_schema_binding"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-603"><a href="#L-603"><span class="linenos"> 603</span></a> <span class="p">)</span> +</span><span id="L-604"><a href="#L-604"><span class="linenos"> 604</span></a> +</span><span id="L-605"><a href="#L-605"><span class="linenos"> 605</span></a> <span class="n">post_expression_modifiers</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">((</span><span class="n">data</span><span class="p">,</span> <span class="n">statistics</span><span class="p">,</span> <span class="n">no_primary_index</span><span class="p">))</span> +</span><span id="L-606"><a href="#L-606"><span class="linenos"> 606</span></a> +</span><span id="L-607"><a href="#L-607"><span class="linenos"> 607</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CREATE</span><span class="si">{</span><span class="n">modifiers</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">exists_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">properties_sql</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}{</span><span class="n">post_expression_modifiers</span><span class="si">}{</span><span class="n">index_sql</span><span class="si">}{</span><span class="n">no_schema_binding</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-608"><a href="#L-608"><span class="linenos"> 608</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_sql</span><span class="p">)</span> +</span><span id="L-609"><a href="#L-609"><span class="linenos"> 609</span></a> +</span><span id="L-610"><a href="#L-610"><span class="linenos"> 610</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-611"><a href="#L-611"><span class="linenos"> 611</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-612"><a href="#L-612"><span class="linenos"> 612</span></a> +</span><span id="L-613"><a href="#L-613"><span class="linenos"> 613</span></a> <span class="k">def</span> <span class="nf">prepend_ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-614"><a href="#L-614"><span class="linenos"> 614</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"with"</span><span class="p">)</span> +</span><span id="L-615"><a href="#L-615"><span class="linenos"> 615</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="L-616"><a href="#L-616"><span class="linenos"> 616</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">with_</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-617"><a href="#L-617"><span class="linenos"> 617</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="L-618"><a href="#L-618"><span class="linenos"> 618</span></a> +</span><span id="L-619"><a href="#L-619"><span class="linenos"> 619</span></a> <span class="k">def</span> <span class="nf">with_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-620"><a href="#L-620"><span class="linenos"> 620</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-621"><a href="#L-621"><span class="linenos"> 621</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="s2">"RECURSIVE "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-622"><a href="#L-622"><span class="linenos"> 622</span></a> +</span><span id="L-623"><a href="#L-623"><span class="linenos"> 623</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WITH </span><span class="si">{</span><span class="n">recursive</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-624"><a href="#L-624"><span class="linenos"> 624</span></a> +</span><span id="L-625"><a href="#L-625"><span class="linenos"> 625</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-626"><a href="#L-626"><span class="linenos"> 626</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-627"><a href="#L-627"><span class="linenos"> 627</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-628"><a href="#L-628"><span class="linenos"> 628</span></a> +</span><span id="L-629"><a href="#L-629"><span class="linenos"> 629</span></a> <span class="k">def</span> <span class="nf">tablealias_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-630"><a href="#L-630"><span class="linenos"> 630</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-631"><a href="#L-631"><span class="linenos"> 631</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-632"><a href="#L-632"><span class="linenos"> 632</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-633"><a href="#L-633"><span class="linenos"> 633</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">alias</span><span class="si">}{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-634"><a href="#L-634"><span class="linenos"> 634</span></a> +</span><span id="L-635"><a href="#L-635"><span class="linenos"> 635</span></a> <span class="k">def</span> <span class="nf">bitstring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitString</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-636"><a href="#L-636"><span class="linenos"> 636</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-637"><a href="#L-637"><span class="linenos"> 637</span></a> +</span><span id="L-638"><a href="#L-638"><span class="linenos"> 638</span></a> <span class="k">def</span> <span class="nf">hexstring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">HexString</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-639"><a href="#L-639"><span class="linenos"> 639</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-640"><a href="#L-640"><span class="linenos"> 640</span></a> +</span><span id="L-641"><a href="#L-641"><span class="linenos"> 641</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-642"><a href="#L-642"><span class="linenos"> 642</span></a> <span class="n">type_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-643"><a href="#L-643"><span class="linenos"> 643</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">type_value</span><span class="p">,</span> <span class="n">type_value</span><span class="o">.</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-644"><a href="#L-644"><span class="linenos"> 644</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-645"><a href="#L-645"><span class="linenos"> 645</span></a> <span class="n">interior</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-646"><a href="#L-646"><span class="linenos"> 646</span></a> <span class="n">values</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-647"><a href="#L-647"><span class="linenos"> 647</span></a> <span class="k">if</span> <span class="n">interior</span><span class="p">:</span> +</span><span id="L-648"><a href="#L-648"><span class="linenos"> 648</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nested"</span><span class="p">):</span> +</span><span id="L-649"><a href="#L-649"><span class="linenos"> 649</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">STRUCT_DELIMITER</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}{</span><span class="n">interior</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">STRUCT_DELIMITER</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-650"><a href="#L-650"><span class="linenos"> 650</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"values"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-651"><a href="#L-651"><span class="linenos"> 651</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">)</span> <span class="k">if</span> <span class="n">type_value</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span> <span class="k">else</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="L-652"><a href="#L-652"><span class="linenos"> 652</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-653"><a href="#L-653"><span class="linenos"> 653</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">delimiters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'values'</span><span class="p">)</span><span class="si">}{</span><span class="n">delimiters</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-654"><a href="#L-654"><span class="linenos"> 654</span></a> <span class="p">)</span> +</span><span id="L-655"><a href="#L-655"><span class="linenos"> 655</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-656"><a href="#L-656"><span class="linenos"> 656</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">interior</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-657"><a href="#L-657"><span class="linenos"> 657</span></a> +</span><span id="L-658"><a href="#L-658"><span class="linenos"> 658</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}{</span><span class="n">nested</span><span class="si">}{</span><span class="n">values</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-659"><a href="#L-659"><span class="linenos"> 659</span></a> +</span><span id="L-660"><a href="#L-660"><span class="linenos"> 660</span></a> <span class="k">def</span> <span class="nf">directory_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-661"><a href="#L-661"><span class="linenos"> 661</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">"LOCAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-662"><a href="#L-662"><span class="linenos"> 662</span></a> <span class="n">row_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"row_format"</span><span class="p">)</span> +</span><span id="L-663"><a href="#L-663"><span class="linenos"> 663</span></a> <span class="n">row_format</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">row_format</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">row_format</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-664"><a href="#L-664"><span class="linenos"> 664</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">local</span><span class="si">}</span><span class="s2">DIRECTORY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">row_format</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-665"><a href="#L-665"><span class="linenos"> 665</span></a> +</span><span id="L-666"><a href="#L-666"><span class="linenos"> 666</span></a> <span class="k">def</span> <span class="nf">delete_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-667"><a href="#L-667"><span class="linenos"> 667</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-668"><a href="#L-668"><span class="linenos"> 668</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-669"><a href="#L-669"><span class="linenos"> 669</span></a> <span class="n">using_sql</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-670"><a href="#L-670"><span class="linenos"> 670</span></a> <span class="sa">f</span><span class="s2">" USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'using'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">', USING '</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-671"><a href="#L-671"><span class="linenos"> 671</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="L-672"><a href="#L-672"><span class="linenos"> 672</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-673"><a href="#L-673"><span class="linenos"> 673</span></a> <span class="p">)</span> +</span><span id="L-674"><a href="#L-674"><span class="linenos"> 674</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-675"><a href="#L-675"><span class="linenos"> 675</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"DELETE</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">using_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-676"><a href="#L-676"><span class="linenos"> 676</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-677"><a href="#L-677"><span class="linenos"> 677</span></a> +</span><span id="L-678"><a href="#L-678"><span class="linenos"> 678</span></a> <span class="k">def</span> <span class="nf">drop_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-679"><a href="#L-679"><span class="linenos"> 679</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-680"><a href="#L-680"><span class="linenos"> 680</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="L-681"><a href="#L-681"><span class="linenos"> 681</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="L-682"><a href="#L-682"><span class="linenos"> 682</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-683"><a href="#L-683"><span class="linenos"> 683</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="s2">" MATERIALIZED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"materialized"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-684"><a href="#L-684"><span class="linenos"> 684</span></a> <span class="n">cascade</span> <span class="o">=</span> <span class="s2">" CASCADE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cascade"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-685"><a href="#L-685"><span class="linenos"> 685</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DROP</span><span class="si">{</span><span class="n">temporary</span><span class="si">}{</span><span class="n">materialized</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">exists_sql</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">cascade</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-686"><a href="#L-686"><span class="linenos"> 686</span></a> +</span><span id="L-687"><a href="#L-687"><span class="linenos"> 687</span></a> <span class="k">def</span> <span class="nf">except_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-688"><a href="#L-688"><span class="linenos"> 688</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="L-689"><a href="#L-689"><span class="linenos"> 689</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-690"><a href="#L-690"><span class="linenos"> 690</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="L-691"><a href="#L-691"><span class="linenos"> 691</span></a> <span class="p">)</span> +</span><span id="L-692"><a href="#L-692"><span class="linenos"> 692</span></a> +</span><span id="L-693"><a href="#L-693"><span class="linenos"> 693</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-694"><a href="#L-694"><span class="linenos"> 694</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-695"><a href="#L-695"><span class="linenos"> 695</span></a> +</span><span id="L-696"><a href="#L-696"><span class="linenos"> 696</span></a> <span class="k">def</span> <span class="nf">fetch_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-697"><a href="#L-697"><span class="linenos"> 697</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"direction"</span><span class="p">)</span> +</span><span id="L-698"><a href="#L-698"><span class="linenos"> 698</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">direction</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">direction</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-699"><a href="#L-699"><span class="linenos"> 699</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"count"</span><span class="p">)</span> +</span><span id="L-700"><a href="#L-700"><span class="linenos"> 700</span></a> <span class="n">count</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">count</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">count</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-701"><a href="#L-701"><span class="linenos"> 701</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'FETCH'</span><span class="p">)</span><span class="si">}{</span><span class="n">direction</span><span class="si">}{</span><span class="n">count</span><span class="si">}</span><span class="s2"> ROWS ONLY"</span> +</span><span id="L-702"><a href="#L-702"><span class="linenos"> 702</span></a> +</span><span id="L-703"><a href="#L-703"><span class="linenos"> 703</span></a> <span class="k">def</span> <span class="nf">filter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Filter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-704"><a href="#L-704"><span class="linenos"> 704</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-705"><a href="#L-705"><span class="linenos"> 705</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> <span class="c1"># where has a leading space</span> +</span><span id="L-706"><a href="#L-706"><span class="linenos"> 706</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> FILTER(</span><span class="si">{</span><span class="n">where</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-707"><a href="#L-707"><span class="linenos"> 707</span></a> +</span><span id="L-708"><a href="#L-708"><span class="linenos"> 708</span></a> <span class="k">def</span> <span class="nf">hint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-709"><a href="#L-709"><span class="linenos"> 709</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">):</span> +</span><span id="L-710"><a href="#L-710"><span class="linenos"> 710</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Hints are not supported"</span><span class="p">)</span> +</span><span id="L-711"><a href="#L-711"><span class="linenos"> 711</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-712"><a href="#L-712"><span class="linenos"> 712</span></a> +</span><span id="L-713"><a href="#L-713"><span class="linenos"> 713</span></a> <span class="k">def</span> <span class="nf">index_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-714"><a href="#L-714"><span class="linenos"> 714</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-715"><a href="#L-715"><span class="linenos"> 715</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">)</span> +</span><span id="L-716"><a href="#L-716"><span class="linenos"> 716</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"columns"</span><span class="p">)</span> +</span><span id="L-717"><a href="#L-717"><span class="linenos"> 717</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> ON </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-718"><a href="#L-718"><span class="linenos"> 718</span></a> +</span><span id="L-719"><a href="#L-719"><span class="linenos"> 719</span></a> <span class="k">def</span> <span class="nf">identifier_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-720"><a href="#L-720"><span class="linenos"> 720</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-721"><a href="#L-721"><span class="linenos"> 721</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize</span> <span class="k">else</span> <span class="n">text</span> +</span><span id="L-722"><a href="#L-722"><span class="linenos"> 722</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_identifier_end</span><span class="p">)</span> +</span><span id="L-723"><a href="#L-723"><span class="linenos"> 723</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span><span class="p">:</span> +</span><span id="L-724"><a href="#L-724"><span class="linenos"> 724</span></a> <span class="n">text</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span><span class="si">}{</span><span class="n">text</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-725"><a href="#L-725"><span class="linenos"> 725</span></a> <span class="k">return</span> <span class="n">text</span> +</span><span id="L-726"><a href="#L-726"><span class="linenos"> 726</span></a> +</span><span id="L-727"><a href="#L-727"><span class="linenos"> 727</span></a> <span class="k">def</span> <span class="nf">national_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">National</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-728"><a href="#L-728"><span class="linenos"> 728</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"N</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-729"><a href="#L-729"><span class="linenos"> 729</span></a> +</span><span id="L-730"><a href="#L-730"><span class="linenos"> 730</span></a> <span class="k">def</span> <span class="nf">partition_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Partition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-731"><a href="#L-731"><span class="linenos"> 731</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-732"><a href="#L-732"><span class="linenos"> 732</span></a> +</span><span id="L-733"><a href="#L-733"><span class="linenos"> 733</span></a> <span class="k">def</span> <span class="nf">properties_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-734"><a href="#L-734"><span class="linenos"> 734</span></a> <span class="n">root_properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-735"><a href="#L-735"><span class="linenos"> 735</span></a> <span class="n">with_properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-736"><a href="#L-736"><span class="linenos"> 736</span></a> +</span><span id="L-737"><a href="#L-737"><span class="linenos"> 737</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-738"><a href="#L-738"><span class="linenos"> 738</span></a> <span class="n">p_loc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="vm">__class__</span><span class="p">]</span> +</span><span id="L-739"><a href="#L-739"><span class="linenos"> 739</span></a> <span class="k">if</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">:</span> +</span><span id="L-740"><a href="#L-740"><span class="linenos"> 740</span></a> <span class="n">with_properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-741"><a href="#L-741"><span class="linenos"> 741</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">:</span> +</span><span id="L-742"><a href="#L-742"><span class="linenos"> 742</span></a> <span class="n">root_properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-743"><a href="#L-743"><span class="linenos"> 743</span></a> +</span><span id="L-744"><a href="#L-744"><span class="linenos"> 744</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">root_properties</span><span class="p">(</span> +</span><span id="L-745"><a href="#L-745"><span class="linenos"> 745</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">root_properties</span><span class="p">)</span> +</span><span id="L-746"><a href="#L-746"><span class="linenos"> 746</span></a> <span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">with_properties</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">with_properties</span><span class="p">))</span> +</span><span id="L-747"><a href="#L-747"><span class="linenos"> 747</span></a> +</span><span id="L-748"><a href="#L-748"><span class="linenos"> 748</span></a> <span class="k">def</span> <span class="nf">root_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-749"><a href="#L-749"><span class="linenos"> 749</span></a> <span class="k">if</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-750"><a href="#L-750"><span class="linenos"> 750</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-751"><a href="#L-751"><span class="linenos"> 751</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-752"><a href="#L-752"><span class="linenos"> 752</span></a> +</span><span id="L-753"><a href="#L-753"><span class="linenos"> 753</span></a> <span class="k">def</span> <span class="nf">properties</span><span class="p">(</span> +</span><span id="L-754"><a href="#L-754"><span class="linenos"> 754</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-755"><a href="#L-755"><span class="linenos"> 755</span></a> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">,</span> +</span><span id="L-756"><a href="#L-756"><span class="linenos"> 756</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-757"><a href="#L-757"><span class="linenos"> 757</span></a> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">,</span> +</span><span id="L-758"><a href="#L-758"><span class="linenos"> 758</span></a> <span class="n">suffix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-759"><a href="#L-759"><span class="linenos"> 759</span></a> <span class="n">wrapped</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-760"><a href="#L-760"><span class="linenos"> 760</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-761"><a href="#L-761"><span class="linenos"> 761</span></a> <span class="k">if</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-762"><a href="#L-762"><span class="linenos"> 762</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="n">sep</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-763"><a href="#L-763"><span class="linenos"> 763</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="k">if</span> <span class="n">wrapped</span> <span class="k">else</span> <span class="n">expressions</span> +</span><span id="L-764"><a href="#L-764"><span class="linenos"> 764</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="s1">' '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">prefix</span><span class="w"> </span><span class="ow">and</span><span class="w"> </span><span class="n">prefix</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="s1">' '</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">suffix</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-765"><a href="#L-765"><span class="linenos"> 765</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-766"><a href="#L-766"><span class="linenos"> 766</span></a> +</span><span id="L-767"><a href="#L-767"><span class="linenos"> 767</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-768"><a href="#L-768"><span class="linenos"> 768</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">))</span> +</span><span id="L-769"><a href="#L-769"><span class="linenos"> 769</span></a> +</span><span id="L-770"><a href="#L-770"><span class="linenos"> 770</span></a> <span class="k">def</span> <span class="nf">locate_properties</span><span class="p">(</span> +</span><span id="L-771"><a href="#L-771"><span class="linenos"> 771</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span> +</span><span id="L-772"><a href="#L-772"><span class="linenos"> 772</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]]:</span> +</span><span id="L-773"><a href="#L-773"><span class="linenos"> 773</span></a> <span class="n">properties_locs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-774"><a href="#L-774"><span class="linenos"> 774</span></a> <span class="n">key</span><span class="p">:</span> <span class="p">[]</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span> +</span><span id="L-775"><a href="#L-775"><span class="linenos"> 775</span></a> <span class="p">}</span> +</span><span id="L-776"><a href="#L-776"><span class="linenos"> 776</span></a> +</span><span id="L-777"><a href="#L-777"><span class="linenos"> 777</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-778"><a href="#L-778"><span class="linenos"> 778</span></a> <span class="n">p_loc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="vm">__class__</span><span class="p">]</span> +</span><span id="L-779"><a href="#L-779"><span class="linenos"> 779</span></a> <span class="k">if</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">:</span> +</span><span id="L-780"><a href="#L-780"><span class="linenos"> 780</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-781"><a href="#L-781"><span class="linenos"> 781</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">:</span> +</span><span id="L-782"><a href="#L-782"><span class="linenos"> 782</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-783"><a href="#L-783"><span class="linenos"> 783</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">:</span> +</span><span id="L-784"><a href="#L-784"><span class="linenos"> 784</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-785"><a href="#L-785"><span class="linenos"> 785</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">:</span> +</span><span id="L-786"><a href="#L-786"><span class="linenos"> 786</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-787"><a href="#L-787"><span class="linenos"> 787</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">:</span> +</span><span id="L-788"><a href="#L-788"><span class="linenos"> 788</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-789"><a href="#L-789"><span class="linenos"> 789</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">:</span> +</span><span id="L-790"><a href="#L-790"><span class="linenos"> 790</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-791"><a href="#L-791"><span class="linenos"> 791</span></a> +</span><span id="L-792"><a href="#L-792"><span class="linenos"> 792</span></a> <span class="k">return</span> <span class="n">properties_locs</span> +</span><span id="L-793"><a href="#L-793"><span class="linenos"> 793</span></a> +</span><span id="L-794"><a href="#L-794"><span class="linenos"> 794</span></a> <span class="k">def</span> <span class="nf">property_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-795"><a href="#L-795"><span class="linenos"> 795</span></a> <span class="n">property_cls</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span> +</span><span id="L-796"><a href="#L-796"><span class="linenos"> 796</span></a> <span class="k">if</span> <span class="n">property_cls</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> +</span><span id="L-797"><a href="#L-797"><span class="linenos"> 797</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-798"><a href="#L-798"><span class="linenos"> 798</span></a> +</span><span id="L-799"><a href="#L-799"><span class="linenos"> 799</span></a> <span class="n">property_name</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">PROPERTY_TO_NAME</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">property_cls</span><span class="p">)</span> +</span><span id="L-800"><a href="#L-800"><span class="linenos"> 800</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">property_name</span><span class="p">:</span> +</span><span id="L-801"><a href="#L-801"><span class="linenos"> 801</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-802"><a href="#L-802"><span class="linenos"> 802</span></a> +</span><span id="L-803"><a href="#L-803"><span class="linenos"> 803</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">property_name</span><span class="si">}</span><span class="s2">=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-804"><a href="#L-804"><span class="linenos"> 804</span></a> +</span><span id="L-805"><a href="#L-805"><span class="linenos"> 805</span></a> <span class="k">def</span> <span class="nf">likeproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-806"><a href="#L-806"><span class="linenos"> 806</span></a> <span class="n">options</span> <span class="o">=</span> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-807"><a href="#L-807"><span class="linenos"> 807</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-808"><a href="#L-808"><span class="linenos"> 808</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LIKE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-809"><a href="#L-809"><span class="linenos"> 809</span></a> +</span><span id="L-810"><a href="#L-810"><span class="linenos"> 810</span></a> <span class="k">def</span> <span class="nf">fallbackproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-811"><a href="#L-811"><span class="linenos"> 811</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-812"><a href="#L-812"><span class="linenos"> 812</span></a> <span class="n">protection</span> <span class="o">=</span> <span class="s2">" PROTECTION"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"protection"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-813"><a href="#L-813"><span class="linenos"> 813</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}</span><span class="s2">FALLBACK</span><span class="si">{</span><span class="n">protection</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-814"><a href="#L-814"><span class="linenos"> 814</span></a> +</span><span id="L-815"><a href="#L-815"><span class="linenos"> 815</span></a> <span class="k">def</span> <span class="nf">journalproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-816"><a href="#L-816"><span class="linenos"> 816</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-817"><a href="#L-817"><span class="linenos"> 817</span></a> <span class="n">dual</span> <span class="o">=</span> <span class="s2">"DUAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"dual"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-818"><a href="#L-818"><span class="linenos"> 818</span></a> <span class="n">before</span> <span class="o">=</span> <span class="s2">"BEFORE "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"before"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-819"><a href="#L-819"><span class="linenos"> 819</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">dual</span><span class="si">}{</span><span class="n">before</span><span class="si">}</span><span class="s2">JOURNAL"</span> +</span><span id="L-820"><a href="#L-820"><span class="linenos"> 820</span></a> +</span><span id="L-821"><a href="#L-821"><span class="linenos"> 821</span></a> <span class="k">def</span> <span class="nf">freespaceproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-822"><a href="#L-822"><span class="linenos"> 822</span></a> <span class="n">freespace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-823"><a href="#L-823"><span class="linenos"> 823</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="s2">" PERCENT"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"percent"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-824"><a href="#L-824"><span class="linenos"> 824</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FREESPACE=</span><span class="si">{</span><span class="n">freespace</span><span class="si">}{</span><span class="n">percent</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-825"><a href="#L-825"><span class="linenos"> 825</span></a> +</span><span id="L-826"><a href="#L-826"><span class="linenos"> 826</span></a> <span class="k">def</span> <span class="nf">afterjournalproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-827"><a href="#L-827"><span class="linenos"> 827</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-828"><a href="#L-828"><span class="linenos"> 828</span></a> <span class="n">dual</span> <span class="o">=</span> <span class="s2">"DUAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"dual"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-829"><a href="#L-829"><span class="linenos"> 829</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-830"><a href="#L-830"><span class="linenos"> 830</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-831"><a href="#L-831"><span class="linenos"> 831</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">"LOCAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"NOT LOCAL "</span> +</span><span id="L-832"><a href="#L-832"><span class="linenos"> 832</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">dual</span><span class="si">}{</span><span class="n">local</span><span class="si">}</span><span class="s2">AFTER JOURNAL"</span> +</span><span id="L-833"><a href="#L-833"><span class="linenos"> 833</span></a> +</span><span id="L-834"><a href="#L-834"><span class="linenos"> 834</span></a> <span class="k">def</span> <span class="nf">checksumproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-835"><a href="#L-835"><span class="linenos"> 835</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">):</span> +</span><span id="L-836"><a href="#L-836"><span class="linenos"> 836</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="L-837"><a href="#L-837"><span class="linenos"> 837</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">):</span> +</span><span id="L-838"><a href="#L-838"><span class="linenos"> 838</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"ON"</span> +</span><span id="L-839"><a href="#L-839"><span class="linenos"> 839</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-840"><a href="#L-840"><span class="linenos"> 840</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"OFF"</span> +</span><span id="L-841"><a href="#L-841"><span class="linenos"> 841</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECKSUM=</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-842"><a href="#L-842"><span class="linenos"> 842</span></a> +</span><span id="L-843"><a href="#L-843"><span class="linenos"> 843</span></a> <span class="k">def</span> <span class="nf">mergeblockratioproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-844"><a href="#L-844"><span class="linenos"> 844</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">):</span> +</span><span id="L-845"><a href="#L-845"><span class="linenos"> 845</span></a> <span class="k">return</span> <span class="s2">"NO MERGEBLOCKRATIO"</span> +</span><span id="L-846"><a href="#L-846"><span class="linenos"> 846</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">):</span> +</span><span id="L-847"><a href="#L-847"><span class="linenos"> 847</span></a> <span class="k">return</span> <span class="s2">"DEFAULT MERGEBLOCKRATIO"</span> +</span><span id="L-848"><a href="#L-848"><span class="linenos"> 848</span></a> +</span><span id="L-849"><a href="#L-849"><span class="linenos"> 849</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="s2">" PERCENT"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"percent"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-850"><a href="#L-850"><span class="linenos"> 850</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MERGEBLOCKRATIO=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">percent</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-851"><a href="#L-851"><span class="linenos"> 851</span></a> +</span><span id="L-852"><a href="#L-852"><span class="linenos"> 852</span></a> <span class="k">def</span> <span class="nf">datablocksizeproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-853"><a href="#L-853"><span class="linenos"> 853</span></a> <span class="n">default</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> +</span><span id="L-854"><a href="#L-854"><span class="linenos"> 854</span></a> <span class="nb">min</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"min"</span><span class="p">)</span> +</span><span id="L-855"><a href="#L-855"><span class="linenos"> 855</span></a> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">min</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-856"><a href="#L-856"><span class="linenos"> 856</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="L-857"><a href="#L-857"><span class="linenos"> 857</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="L-858"><a href="#L-858"><span class="linenos"> 858</span></a> <span class="k">elif</span> <span class="nb">min</span><span class="p">:</span> +</span><span id="L-859"><a href="#L-859"><span class="linenos"> 859</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MINIMUM"</span> +</span><span id="L-860"><a href="#L-860"><span class="linenos"> 860</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-861"><a href="#L-861"><span class="linenos"> 861</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MAXIMUM"</span> +</span><span id="L-862"><a href="#L-862"><span class="linenos"> 862</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2"> DATABLOCKSIZE"</span> +</span><span id="L-863"><a href="#L-863"><span class="linenos"> 863</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-864"><a href="#L-864"><span class="linenos"> 864</span></a> <span class="n">units</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"units"</span><span class="p">)</span> +</span><span id="L-865"><a href="#L-865"><span class="linenos"> 865</span></a> <span class="n">units</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">units</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">units</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-866"><a href="#L-866"><span class="linenos"> 866</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATABLOCKSIZE=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</span><span class="p">)</span><span class="si">}{</span><span class="n">units</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-867"><a href="#L-867"><span class="linenos"> 867</span></a> +</span><span id="L-868"><a href="#L-868"><span class="linenos"> 868</span></a> <span class="k">def</span> <span class="nf">blockcompressionproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-869"><a href="#L-869"><span class="linenos"> 869</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"autotemp"</span><span class="p">)</span> +</span><span id="L-870"><a href="#L-870"><span class="linenos"> 870</span></a> <span class="n">always</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"always"</span><span class="p">)</span> +</span><span id="L-871"><a href="#L-871"><span class="linenos"> 871</span></a> <span class="n">default</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> +</span><span id="L-872"><a href="#L-872"><span class="linenos"> 872</span></a> <span class="n">manual</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"manual"</span><span class="p">)</span> +</span><span id="L-873"><a href="#L-873"><span class="linenos"> 873</span></a> <span class="n">never</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"never"</span><span class="p">)</span> +</span><span id="L-874"><a href="#L-874"><span class="linenos"> 874</span></a> +</span><span id="L-875"><a href="#L-875"><span class="linenos"> 875</span></a> <span class="k">if</span> <span class="n">autotemp</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-876"><a href="#L-876"><span class="linenos"> 876</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"AUTOTEMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">autotemp</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-877"><a href="#L-877"><span class="linenos"> 877</span></a> <span class="k">elif</span> <span class="n">always</span><span class="p">:</span> +</span><span id="L-878"><a href="#L-878"><span class="linenos"> 878</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"ALWAYS"</span> +</span><span id="L-879"><a href="#L-879"><span class="linenos"> 879</span></a> <span class="k">elif</span> <span class="n">default</span><span class="p">:</span> +</span><span id="L-880"><a href="#L-880"><span class="linenos"> 880</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="L-881"><a href="#L-881"><span class="linenos"> 881</span></a> <span class="k">elif</span> <span class="n">manual</span><span class="p">:</span> +</span><span id="L-882"><a href="#L-882"><span class="linenos"> 882</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MANUAL"</span> +</span><span id="L-883"><a href="#L-883"><span class="linenos"> 883</span></a> <span class="k">elif</span> <span class="n">never</span><span class="p">:</span> +</span><span id="L-884"><a href="#L-884"><span class="linenos"> 884</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"NEVER"</span> +</span><span id="L-885"><a href="#L-885"><span class="linenos"> 885</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BLOCKCOMPRESSION=</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-886"><a href="#L-886"><span class="linenos"> 886</span></a> +</span><span id="L-887"><a href="#L-887"><span class="linenos"> 887</span></a> <span class="k">def</span> <span class="nf">isolatedloadingproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-888"><a href="#L-888"><span class="linenos"> 888</span></a> <span class="n">no</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> +</span><span id="L-889"><a href="#L-889"><span class="linenos"> 889</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">" NO"</span> <span class="k">if</span> <span class="n">no</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-890"><a href="#L-890"><span class="linenos"> 890</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"concurrent"</span><span class="p">)</span> +</span><span id="L-891"><a href="#L-891"><span class="linenos"> 891</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="s2">" CONCURRENT"</span> <span class="k">if</span> <span class="n">concurrent</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-892"><a href="#L-892"><span class="linenos"> 892</span></a> +</span><span id="L-893"><a href="#L-893"><span class="linenos"> 893</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-894"><a href="#L-894"><span class="linenos"> 894</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_all"</span><span class="p">):</span> +</span><span id="L-895"><a href="#L-895"><span class="linenos"> 895</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR ALL"</span> +</span><span id="L-896"><a href="#L-896"><span class="linenos"> 896</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_insert"</span><span class="p">):</span> +</span><span id="L-897"><a href="#L-897"><span class="linenos"> 897</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR INSERT"</span> +</span><span id="L-898"><a href="#L-898"><span class="linenos"> 898</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_none"</span><span class="p">):</span> +</span><span id="L-899"><a href="#L-899"><span class="linenos"> 899</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR NONE"</span> +</span><span id="L-900"><a href="#L-900"><span class="linenos"> 900</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WITH</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">concurrent</span><span class="si">}</span><span class="s2"> ISOLATED LOADING</span><span class="si">{</span><span class="n">for_</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-901"><a href="#L-901"><span class="linenos"> 901</span></a> +</span><span id="L-902"><a href="#L-902"><span class="linenos"> 902</span></a> <span class="k">def</span> <span class="nf">insert_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-903"><a href="#L-903"><span class="linenos"> 903</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"overwrite"</span><span class="p">)</span> +</span><span id="L-904"><a href="#L-904"><span class="linenos"> 904</span></a> +</span><span id="L-905"><a href="#L-905"><span class="linenos"> 905</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">):</span> +</span><span id="L-906"><a href="#L-906"><span class="linenos"> 906</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">"OVERWRITE "</span> <span class="k">if</span> <span class="n">overwrite</span> <span class="k">else</span> <span class="s2">"INTO "</span> +</span><span id="L-907"><a href="#L-907"><span class="linenos"> 907</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-908"><a href="#L-908"><span class="linenos"> 908</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">"OVERWRITE TABLE "</span> <span class="k">if</span> <span class="n">overwrite</span> <span class="k">else</span> <span class="s2">"INTO "</span> +</span><span id="L-909"><a href="#L-909"><span class="linenos"> 909</span></a> +</span><span id="L-910"><a href="#L-910"><span class="linenos"> 910</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-911"><a href="#L-911"><span class="linenos"> 911</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="L-912"><a href="#L-912"><span class="linenos"> 912</span></a> <span class="n">partition_sql</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-913"><a href="#L-913"><span class="linenos"> 913</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"partition"</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"partition"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-914"><a href="#L-914"><span class="linenos"> 914</span></a> <span class="p">)</span> +</span><span id="L-915"><a href="#L-915"><span class="linenos"> 915</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-916"><a href="#L-916"><span class="linenos"> 916</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span> <span class="k">if</span> <span class="n">partition_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-917"><a href="#L-917"><span class="linenos"> 917</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INSERT </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">exists</span><span class="si">}{</span><span class="n">partition_sql</span><span class="si">}{</span><span class="n">sep</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-918"><a href="#L-918"><span class="linenos"> 918</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-919"><a href="#L-919"><span class="linenos"> 919</span></a> +</span><span id="L-920"><a href="#L-920"><span class="linenos"> 920</span></a> <span class="k">def</span> <span class="nf">intersect_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-921"><a href="#L-921"><span class="linenos"> 921</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="L-922"><a href="#L-922"><span class="linenos"> 922</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-923"><a href="#L-923"><span class="linenos"> 923</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="L-924"><a href="#L-924"><span class="linenos"> 924</span></a> <span class="p">)</span> +</span><span id="L-925"><a href="#L-925"><span class="linenos"> 925</span></a> +</span><span id="L-926"><a href="#L-926"><span class="linenos"> 926</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-927"><a href="#L-927"><span class="linenos"> 927</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-928"><a href="#L-928"><span class="linenos"> 928</span></a> +</span><span id="L-929"><a href="#L-929"><span class="linenos"> 929</span></a> <span class="k">def</span> <span class="nf">introducer_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Introducer</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-930"><a href="#L-930"><span class="linenos"> 930</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-931"><a href="#L-931"><span class="linenos"> 931</span></a> +</span><span id="L-932"><a href="#L-932"><span class="linenos"> 932</span></a> <span class="k">def</span> <span class="nf">pseudotype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PseudoType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-933"><a href="#L-933"><span class="linenos"> 933</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-934"><a href="#L-934"><span class="linenos"> 934</span></a> +</span><span id="L-935"><a href="#L-935"><span class="linenos"> 935</span></a> <span class="k">def</span> <span class="nf">rowformatdelimitedproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-936"><a href="#L-936"><span class="linenos"> 936</span></a> <span class="n">fields</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"fields"</span><span class="p">)</span> +</span><span id="L-937"><a href="#L-937"><span class="linenos"> 937</span></a> <span class="n">fields</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FIELDS TERMINATED BY </span><span class="si">{</span><span class="n">fields</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">fields</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-938"><a href="#L-938"><span class="linenos"> 938</span></a> <span class="n">escaped</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"escaped"</span><span class="p">)</span> +</span><span id="L-939"><a href="#L-939"><span class="linenos"> 939</span></a> <span class="n">escaped</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ESCAPED BY </span><span class="si">{</span><span class="n">escaped</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">escaped</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-940"><a href="#L-940"><span class="linenos"> 940</span></a> <span class="n">items</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"collection_items"</span><span class="p">)</span> +</span><span id="L-941"><a href="#L-941"><span class="linenos"> 941</span></a> <span class="n">items</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLECTION ITEMS TERMINATED BY </span><span class="si">{</span><span class="n">items</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">items</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-942"><a href="#L-942"><span class="linenos"> 942</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"map_keys"</span><span class="p">)</span> +</span><span id="L-943"><a href="#L-943"><span class="linenos"> 943</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" MAP KEYS TERMINATED BY </span><span class="si">{</span><span class="n">keys</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">keys</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-944"><a href="#L-944"><span class="linenos"> 944</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"lines"</span><span class="p">)</span> +</span><span id="L-945"><a href="#L-945"><span class="linenos"> 945</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" LINES TERMINATED BY </span><span class="si">{</span><span class="n">lines</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">lines</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-946"><a href="#L-946"><span class="linenos"> 946</span></a> <span class="n">null</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"null"</span><span class="p">)</span> +</span><span id="L-947"><a href="#L-947"><span class="linenos"> 947</span></a> <span class="n">null</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" NULL DEFINED AS </span><span class="si">{</span><span class="n">null</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">null</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-948"><a href="#L-948"><span class="linenos"> 948</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ROW FORMAT DELIMITED</span><span class="si">{</span><span class="n">fields</span><span class="si">}{</span><span class="n">escaped</span><span class="si">}{</span><span class="n">items</span><span class="si">}{</span><span class="n">keys</span><span class="si">}{</span><span class="n">lines</span><span class="si">}{</span><span class="n">null</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-949"><a href="#L-949"><span class="linenos"> 949</span></a> +</span><span id="L-950"><a href="#L-950"><span class="linenos"> 950</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" AS "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-951"><a href="#L-951"><span class="linenos"> 951</span></a> <span class="n">table</span> <span class="o">=</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-952"><a href="#L-952"><span class="linenos"> 952</span></a> <span class="n">part</span> +</span><span id="L-953"><a href="#L-953"><span class="linenos"> 953</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="L-954"><a href="#L-954"><span class="linenos"> 954</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">),</span> +</span><span id="L-955"><a href="#L-955"><span class="linenos"> 955</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">),</span> +</span><span id="L-956"><a href="#L-956"><span class="linenos"> 956</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-957"><a href="#L-957"><span class="linenos"> 957</span></a> <span class="p">]</span> +</span><span id="L-958"><a href="#L-958"><span class="linenos"> 958</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="L-959"><a href="#L-959"><span class="linenos"> 959</span></a> <span class="p">)</span> +</span><span id="L-960"><a href="#L-960"><span class="linenos"> 960</span></a> +</span><span id="L-961"><a href="#L-961"><span class="linenos"> 961</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-962"><a href="#L-962"><span class="linenos"> 962</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-963"><a href="#L-963"><span class="linenos"> 963</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"hints"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">", "</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-964"><a href="#L-964"><span class="linenos"> 964</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITH (</span><span class="si">{</span><span class="n">hints</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">hints</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-965"><a href="#L-965"><span class="linenos"> 965</span></a> <span class="n">laterals</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"laterals"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-966"><a href="#L-966"><span class="linenos"> 966</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"joins"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-967"><a href="#L-967"><span class="linenos"> 967</span></a> <span class="n">pivots</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"pivots"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-968"><a href="#L-968"><span class="linenos"> 968</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"system_time"</span><span class="p">)</span> +</span><span id="L-969"><a href="#L-969"><span class="linenos"> 969</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'system_time'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">system_time</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-970"><a href="#L-970"><span class="linenos"> 970</span></a> +</span><span id="L-971"><a href="#L-971"><span class="linenos"> 971</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">pivots</span><span class="p">:</span> +</span><span id="L-972"><a href="#L-972"><span class="linenos"> 972</span></a> <span class="n">pivots</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">pivots</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-973"><a href="#L-973"><span class="linenos"> 973</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-974"><a href="#L-974"><span class="linenos"> 974</span></a> +</span><span id="L-975"><a href="#L-975"><span class="linenos"> 975</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="n">system_time</span><span class="si">}{</span><span class="n">alias</span><span class="si">}{</span><span class="n">hints</span><span class="si">}{</span><span class="n">laterals</span><span class="si">}{</span><span class="n">joins</span><span class="si">}{</span><span class="n">pivots</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-976"><a href="#L-976"><span class="linenos"> 976</span></a> +</span><span id="L-977"><a href="#L-977"><span class="linenos"> 977</span></a> <span class="k">def</span> <span class="nf">tablesample_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-978"><a href="#L-978"><span class="linenos"> 978</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-979"><a href="#L-979"><span class="linenos"> 979</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-980"><a href="#L-980"><span class="linenos"> 980</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'alias'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-981"><a href="#L-981"><span class="linenos"> 981</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-982"><a href="#L-982"><span class="linenos"> 982</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-983"><a href="#L-983"><span class="linenos"> 983</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-984"><a href="#L-984"><span class="linenos"> 984</span></a> <span class="n">method</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"method"</span><span class="p">)</span> +</span><span id="L-985"><a href="#L-985"><span class="linenos"> 985</span></a> <span class="n">method</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">method</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">method</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-986"><a href="#L-986"><span class="linenos"> 986</span></a> <span class="n">numerator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_numerator"</span><span class="p">)</span> +</span><span id="L-987"><a href="#L-987"><span class="linenos"> 987</span></a> <span class="n">denominator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_denominator"</span><span class="p">)</span> +</span><span id="L-988"><a href="#L-988"><span class="linenos"> 988</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_field"</span><span class="p">)</span> +</span><span id="L-989"><a href="#L-989"><span class="linenos"> 989</span></a> <span class="n">field</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON </span><span class="si">{</span><span class="n">field</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">field</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-990"><a href="#L-990"><span class="linenos"> 990</span></a> <span class="n">bucket</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"BUCKET </span><span class="si">{</span><span class="n">numerator</span><span class="si">}</span><span class="s2"> OUT OF </span><span class="si">{</span><span class="n">denominator</span><span class="si">}{</span><span class="n">field</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">numerator</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-991"><a href="#L-991"><span class="linenos"> 991</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">)</span> +</span><span id="L-992"><a href="#L-992"><span class="linenos"> 992</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">percent</span><span class="si">}</span><span class="s2"> PERCENT"</span> <span class="k">if</span> <span class="n">percent</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-993"><a href="#L-993"><span class="linenos"> 993</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"rows"</span><span class="p">)</span> +</span><span id="L-994"><a href="#L-994"><span class="linenos"> 994</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">rows</span><span class="si">}</span><span class="s2"> ROWS"</span> <span class="k">if</span> <span class="n">rows</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-995"><a href="#L-995"><span class="linenos"> 995</span></a> <span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"size"</span><span class="p">)</span> +</span><span id="L-996"><a href="#L-996"><span class="linenos"> 996</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"seed"</span><span class="p">)</span> +</span><span id="L-997"><a href="#L-997"><span class="linenos"> 997</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" SEED (</span><span class="si">{</span><span class="n">seed</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">seed</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-998"><a href="#L-998"><span class="linenos"> 998</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TABLESAMPLE</span><span class="si">{</span><span class="n">method</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">bucket</span><span class="si">}{</span><span class="n">percent</span><span class="si">}{</span><span class="n">rows</span><span class="si">}{</span><span class="n">size</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">seed</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-999"><a href="#L-999"><span class="linenos"> 999</span></a> +</span><span id="L-1000"><a href="#L-1000"><span class="linenos">1000</span></a> <span class="k">def</span> <span class="nf">pivot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1001"><a href="#L-1001"><span class="linenos">1001</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1002"><a href="#L-1002"><span class="linenos">1002</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unpivot"</span><span class="p">)</span> +</span><span id="L-1003"><a href="#L-1003"><span class="linenos">1003</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="s2">"UNPIVOT"</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="s2">"PIVOT"</span> +</span><span id="L-1004"><a href="#L-1004"><span class="linenos">1004</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="L-1005"><a href="#L-1005"><span class="linenos">1005</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"field"</span><span class="p">)</span> +</span><span id="L-1006"><a href="#L-1006"><span class="linenos">1006</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">direction</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2"> FOR </span><span class="si">{</span><span class="n">field</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1007"><a href="#L-1007"><span class="linenos">1007</span></a> +</span><span id="L-1008"><a href="#L-1008"><span class="linenos">1008</span></a> <span class="k">def</span> <span class="nf">tuple_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1009"><a href="#L-1009"><span class="linenos">1009</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1010"><a href="#L-1010"><span class="linenos">1010</span></a> +</span><span id="L-1011"><a href="#L-1011"><span class="linenos">1011</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1012"><a href="#L-1012"><span class="linenos">1012</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1013"><a href="#L-1013"><span class="linenos">1013</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1014"><a href="#L-1014"><span class="linenos">1014</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-1015"><a href="#L-1015"><span class="linenos">1015</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-1016"><a href="#L-1016"><span class="linenos">1016</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1017"><a href="#L-1017"><span class="linenos">1017</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-1018"><a href="#L-1018"><span class="linenos">1018</span></a> +</span><span id="L-1019"><a href="#L-1019"><span class="linenos">1019</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1020"><a href="#L-1020"><span class="linenos">1020</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1021"><a href="#L-1021"><span class="linenos">1021</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1022"><a href="#L-1022"><span class="linenos">1022</span></a> <span class="n">values</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"VALUES</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="n">args</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1023"><a href="#L-1023"><span class="linenos">1023</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1024"><a href="#L-1024"><span class="linenos">1024</span></a> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1025"><a href="#L-1025"><span class="linenos">1025</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">WRAP_DERIVED_VALUES</span> <span class="ow">and</span> <span class="p">(</span><span class="n">alias</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">))</span> +</span><span id="L-1026"><a href="#L-1026"><span class="linenos">1026</span></a> <span class="k">else</span> <span class="n">values</span> +</span><span id="L-1027"><a href="#L-1027"><span class="linenos">1027</span></a> <span class="p">)</span> +</span><span id="L-1028"><a href="#L-1028"><span class="linenos">1028</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">values</span> +</span><span id="L-1029"><a href="#L-1029"><span class="linenos">1029</span></a> +</span><span id="L-1030"><a href="#L-1030"><span class="linenos">1030</span></a> <span class="k">def</span> <span class="nf">var_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1031"><a href="#L-1031"><span class="linenos">1031</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1032"><a href="#L-1032"><span class="linenos">1032</span></a> +</span><span id="L-1033"><a href="#L-1033"><span class="linenos">1033</span></a> <span class="k">def</span> <span class="nf">into_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Into</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1034"><a href="#L-1034"><span class="linenos">1034</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1035"><a href="#L-1035"><span class="linenos">1035</span></a> <span class="n">unlogged</span> <span class="o">=</span> <span class="s2">" UNLOGGED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unlogged"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1036"><a href="#L-1036"><span class="linenos">1036</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'INTO'</span><span class="p">)</span><span class="si">}{</span><span class="n">temporary</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="n">unlogged</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1037"><a href="#L-1037"><span class="linenos">1037</span></a> +</span><span id="L-1038"><a href="#L-1038"><span class="linenos">1038</span></a> <span class="k">def</span> <span class="nf">from_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1039"><a href="#L-1039"><span class="linenos">1039</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1040"><a href="#L-1040"><span class="linenos">1040</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'FROM'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1041"><a href="#L-1041"><span class="linenos">1041</span></a> +</span><span id="L-1042"><a href="#L-1042"><span class="linenos">1042</span></a> <span class="k">def</span> <span class="nf">group_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1043"><a href="#L-1043"><span class="linenos">1043</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"GROUP BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-1044"><a href="#L-1044"><span class="linenos">1044</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"grouping_sets"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1045"><a href="#L-1045"><span class="linenos">1045</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1046"><a href="#L-1046"><span class="linenos">1046</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'GROUPING SETS'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">grouping_sets</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">grouping_sets</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1047"><a href="#L-1047"><span class="linenos">1047</span></a> <span class="p">)</span> +</span><span id="L-1048"><a href="#L-1048"><span class="linenos">1048</span></a> +</span><span id="L-1049"><a href="#L-1049"><span class="linenos">1049</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cube"</span><span class="p">)</span> +</span><span id="L-1050"><a href="#L-1050"><span class="linenos">1050</span></a> <span class="k">if</span> <span class="n">cube</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1051"><a href="#L-1051"><span class="linenos">1051</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH CUBE"</span><span class="p">)</span> +</span><span id="L-1052"><a href="#L-1052"><span class="linenos">1052</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1053"><a href="#L-1053"><span class="linenos">1053</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"cube"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1054"><a href="#L-1054"><span class="linenos">1054</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'CUBE'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">cube</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">cube</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1055"><a href="#L-1055"><span class="linenos">1055</span></a> +</span><span id="L-1056"><a href="#L-1056"><span class="linenos">1056</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"rollup"</span><span class="p">)</span> +</span><span id="L-1057"><a href="#L-1057"><span class="linenos">1057</span></a> <span class="k">if</span> <span class="n">rollup</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1058"><a href="#L-1058"><span class="linenos">1058</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH ROLLUP"</span><span class="p">)</span> +</span><span id="L-1059"><a href="#L-1059"><span class="linenos">1059</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1060"><a href="#L-1060"><span class="linenos">1060</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"rollup"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1061"><a href="#L-1061"><span class="linenos">1061</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'ROLLUP'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">rollup</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">rollup</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1062"><a href="#L-1062"><span class="linenos">1062</span></a> +</span><span id="L-1063"><a href="#L-1063"><span class="linenos">1063</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">group_by</span><span class="si">}{</span><span class="n">csv</span><span class="p">(</span><span class="n">grouping_sets</span><span class="p">,</span><span class="w"> </span><span class="n">cube</span><span class="p">,</span><span class="w"> </span><span class="n">rollup</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">','</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1064"><a href="#L-1064"><span class="linenos">1064</span></a> +</span><span id="L-1065"><a href="#L-1065"><span class="linenos">1065</span></a> <span class="k">def</span> <span class="nf">having_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1066"><a href="#L-1066"><span class="linenos">1066</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="L-1067"><a href="#L-1067"><span class="linenos">1067</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'HAVING'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1068"><a href="#L-1068"><span class="linenos">1068</span></a> +</span><span id="L-1069"><a href="#L-1069"><span class="linenos">1069</span></a> <span class="k">def</span> <span class="nf">join_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1070"><a href="#L-1070"><span class="linenos">1070</span></a> <span class="n">op_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span> +</span><span id="L-1071"><a href="#L-1071"><span class="linenos">1071</span></a> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-1072"><a href="#L-1072"><span class="linenos">1072</span></a> <span class="n">op</span> +</span><span id="L-1073"><a href="#L-1073"><span class="linenos">1073</span></a> <span class="k">for</span> <span class="n">op</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="L-1074"><a href="#L-1074"><span class="linenos">1074</span></a> <span class="s2">"NATURAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"natural"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-1075"><a href="#L-1075"><span class="linenos">1075</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">side</span><span class="p">,</span> +</span><span id="L-1076"><a href="#L-1076"><span class="linenos">1076</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">kind</span><span class="p">,</span> +</span><span id="L-1077"><a href="#L-1077"><span class="linenos">1077</span></a> <span class="s2">"JOIN"</span><span class="p">,</span> +</span><span id="L-1078"><a href="#L-1078"><span class="linenos">1078</span></a> <span class="p">)</span> +</span><span id="L-1079"><a href="#L-1079"><span class="linenos">1079</span></a> <span class="k">if</span> <span class="n">op</span> +</span><span id="L-1080"><a href="#L-1080"><span class="linenos">1080</span></a> <span class="p">)</span> +</span><span id="L-1081"><a href="#L-1081"><span class="linenos">1081</span></a> <span class="p">)</span> +</span><span id="L-1082"><a href="#L-1082"><span class="linenos">1082</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">)</span> +</span><span id="L-1083"><a href="#L-1083"><span class="linenos">1083</span></a> <span class="n">using</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="L-1084"><a href="#L-1084"><span class="linenos">1084</span></a> +</span><span id="L-1085"><a href="#L-1085"><span class="linenos">1085</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">on_sql</span> <span class="ow">and</span> <span class="n">using</span><span class="p">:</span> +</span><span id="L-1086"><a href="#L-1086"><span class="linenos">1086</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="n">csv</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">using</span><span class="p">))</span> +</span><span id="L-1087"><a href="#L-1087"><span class="linenos">1087</span></a> +</span><span id="L-1088"><a href="#L-1088"><span class="linenos">1088</span></a> <span class="k">if</span> <span class="n">on_sql</span><span class="p">:</span> +</span><span id="L-1089"><a href="#L-1089"><span class="linenos">1089</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="n">on_sql</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1090"><a href="#L-1090"><span class="linenos">1090</span></a> <span class="n">space</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">" "</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="L-1091"><a href="#L-1091"><span class="linenos">1091</span></a> <span class="k">if</span> <span class="n">using</span><span class="p">:</span> +</span><span id="L-1092"><a href="#L-1092"><span class="linenos">1092</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">space</span><span class="si">}</span><span class="s2">USING (</span><span class="si">{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1093"><a href="#L-1093"><span class="linenos">1093</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1094"><a href="#L-1094"><span class="linenos">1094</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">space</span><span class="si">}</span><span class="s2">ON </span><span class="si">{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1095"><a href="#L-1095"><span class="linenos">1095</span></a> +</span><span id="L-1096"><a href="#L-1096"><span class="linenos">1096</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-1097"><a href="#L-1097"><span class="linenos">1097</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1098"><a href="#L-1098"><span class="linenos">1098</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}{</span><span class="n">op_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this_sql</span><span class="si">}{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1099"><a href="#L-1099"><span class="linenos">1099</span></a> +</span><span id="L-1100"><a href="#L-1100"><span class="linenos">1100</span></a> <span class="k">def</span> <span class="nf">lambda_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">,</span> <span class="n">arrow_sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"->"</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1101"><a href="#L-1101"><span class="linenos">1101</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1102"><a href="#L-1102"><span class="linenos">1102</span></a> <span class="n">args</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">))</span> <span class="o">></span> <span class="mi">1</span> <span class="k">else</span> <span class="n">args</span> +</span><span id="L-1103"><a href="#L-1103"><span class="linenos">1103</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">arrow_sep</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1104"><a href="#L-1104"><span class="linenos">1104</span></a> +</span><span id="L-1105"><a href="#L-1105"><span class="linenos">1105</span></a> <span class="k">def</span> <span class="nf">lateral_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1106"><a href="#L-1106"><span class="linenos">1106</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1107"><a href="#L-1107"><span class="linenos">1107</span></a> +</span><span id="L-1108"><a href="#L-1108"><span class="linenos">1108</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-1109"><a href="#L-1109"><span class="linenos">1109</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LATERAL </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1110"><a href="#L-1110"><span class="linenos">1110</span></a> +</span><span id="L-1111"><a href="#L-1111"><span class="linenos">1111</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"view"</span><span class="p">):</span> +</span><span id="L-1112"><a href="#L-1112"><span class="linenos">1112</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span> +</span><span id="L-1113"><a href="#L-1113"><span class="linenos">1113</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1114"><a href="#L-1114"><span class="linenos">1114</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">alias</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1115"><a href="#L-1115"><span class="linenos">1115</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1116"><a href="#L-1116"><span class="linenos">1116</span></a> <span class="n">op_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"LATERAL VIEW</span><span class="si">{</span><span class="s1">' OUTER'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'outer'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1117"><a href="#L-1117"><span class="linenos">1117</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">op_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">table</span><span class="si">}{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1118"><a href="#L-1118"><span class="linenos">1118</span></a> +</span><span id="L-1119"><a href="#L-1119"><span class="linenos">1119</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1120"><a href="#L-1120"><span class="linenos">1120</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1121"><a href="#L-1121"><span class="linenos">1121</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LATERAL </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1122"><a href="#L-1122"><span class="linenos">1122</span></a> +</span><span id="L-1123"><a href="#L-1123"><span class="linenos">1123</span></a> <span class="k">def</span> <span class="nf">limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1124"><a href="#L-1124"><span class="linenos">1124</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1125"><a href="#L-1125"><span class="linenos">1125</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'LIMIT'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1126"><a href="#L-1126"><span class="linenos">1126</span></a> +</span><span id="L-1127"><a href="#L-1127"><span class="linenos">1127</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1128"><a href="#L-1128"><span class="linenos">1128</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1129"><a href="#L-1129"><span class="linenos">1129</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'OFFSET'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1130"><a href="#L-1130"><span class="linenos">1130</span></a> +</span><span id="L-1131"><a href="#L-1131"><span class="linenos">1131</span></a> <span class="k">def</span> <span class="nf">lock_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1132"><a href="#L-1132"><span class="linenos">1132</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">LOCKING_READS_SUPPORTED</span><span class="p">:</span> +</span><span id="L-1133"><a href="#L-1133"><span class="linenos">1133</span></a> <span class="n">lock_type</span> <span class="o">=</span> <span class="s2">"UPDATE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"update"</span><span class="p">]</span> <span class="k">else</span> <span class="s2">"SHARE"</span> +</span><span id="L-1134"><a href="#L-1134"><span class="linenos">1134</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"FOR </span><span class="si">{</span><span class="n">lock_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1135"><a href="#L-1135"><span class="linenos">1135</span></a> +</span><span id="L-1136"><a href="#L-1136"><span class="linenos">1136</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Locking reads using 'FOR UPDATE/SHARE' are not supported"</span><span class="p">)</span> +</span><span id="L-1137"><a href="#L-1137"><span class="linenos">1137</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-1138"><a href="#L-1138"><span class="linenos">1138</span></a> +</span><span id="L-1139"><a href="#L-1139"><span class="linenos">1139</span></a> <span class="k">def</span> <span class="nf">literal_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1140"><a href="#L-1140"><span class="linenos">1140</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">or</span> <span class="s2">""</span> +</span><span id="L-1141"><a href="#L-1141"><span class="linenos">1141</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-1142"><a href="#L-1142"><span class="linenos">1142</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span><span class="p">:</span> +</span><span id="L-1143"><a href="#L-1143"><span class="linenos">1143</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">BACKSLASH_RE</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s2">"</span><span class="se">\\\\</span><span class="s2">"</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="L-1144"><a href="#L-1144"><span class="linenos">1144</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_quote_end</span><span class="p">)</span> +</span><span id="L-1145"><a href="#L-1145"><span class="linenos">1145</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="L-1146"><a href="#L-1146"><span class="linenos">1146</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">SENTINEL_LINE_BREAK</span><span class="p">)</span> +</span><span id="L-1147"><a href="#L-1147"><span class="linenos">1147</span></a> <span class="n">text</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span><span class="si">}{</span><span class="n">text</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1148"><a href="#L-1148"><span class="linenos">1148</span></a> <span class="k">return</span> <span class="n">text</span> +</span><span id="L-1149"><a href="#L-1149"><span class="linenos">1149</span></a> +</span><span id="L-1150"><a href="#L-1150"><span class="linenos">1150</span></a> <span class="k">def</span> <span class="nf">loaddata_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LoadData</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1151"><a href="#L-1151"><span class="linenos">1151</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">" LOCAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1152"><a href="#L-1152"><span class="linenos">1152</span></a> <span class="n">inpath</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INPATH </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'inpath'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1153"><a href="#L-1153"><span class="linenos">1153</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="s2">" OVERWRITE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"overwrite"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1154"><a href="#L-1154"><span class="linenos">1154</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INTO TABLE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1155"><a href="#L-1155"><span class="linenos">1155</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"partition"</span><span class="p">)</span> +</span><span id="L-1156"><a href="#L-1156"><span class="linenos">1156</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">partition</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">partition</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1157"><a href="#L-1157"><span class="linenos">1157</span></a> <span class="n">input_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"input_format"</span><span class="p">)</span> +</span><span id="L-1158"><a href="#L-1158"><span class="linenos">1158</span></a> <span class="n">input_format</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INPUTFORMAT </span><span class="si">{</span><span class="n">input_format</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">input_format</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1159"><a href="#L-1159"><span class="linenos">1159</span></a> <span class="n">serde</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"serde"</span><span class="p">)</span> +</span><span id="L-1160"><a href="#L-1160"><span class="linenos">1160</span></a> <span class="n">serde</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" SERDE </span><span class="si">{</span><span class="n">serde</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">serde</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1161"><a href="#L-1161"><span class="linenos">1161</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LOAD DATA</span><span class="si">{</span><span class="n">local</span><span class="si">}{</span><span class="n">inpath</span><span class="si">}{</span><span class="n">overwrite</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">partition</span><span class="si">}{</span><span class="n">input_format</span><span class="si">}{</span><span class="n">serde</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1162"><a href="#L-1162"><span class="linenos">1162</span></a> +</span><span id="L-1163"><a href="#L-1163"><span class="linenos">1163</span></a> <span class="k">def</span> <span class="nf">null_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1164"><a href="#L-1164"><span class="linenos">1164</span></a> <span class="k">return</span> <span class="s2">"NULL"</span> +</span><span id="L-1165"><a href="#L-1165"><span class="linenos">1165</span></a> +</span><span id="L-1166"><a href="#L-1166"><span class="linenos">1166</span></a> <span class="k">def</span> <span class="nf">boolean_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1167"><a href="#L-1167"><span class="linenos">1167</span></a> <span class="k">return</span> <span class="s2">"TRUE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">"FALSE"</span> +</span><span id="L-1168"><a href="#L-1168"><span class="linenos">1168</span></a> +</span><span id="L-1169"><a href="#L-1169"><span class="linenos">1169</span></a> <span class="k">def</span> <span class="nf">order_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1170"><a href="#L-1170"><span class="linenos">1170</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1171"><a href="#L-1171"><span class="linenos">1171</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">this</span> +</span><span id="L-1172"><a href="#L-1172"><span class="linenos">1172</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">ORDER BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="n">this</span> <span class="ow">or</span> <span class="n">flat</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-1173"><a href="#L-1173"><span class="linenos">1173</span></a> +</span><span id="L-1174"><a href="#L-1174"><span class="linenos">1174</span></a> <span class="k">def</span> <span class="nf">cluster_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1175"><a href="#L-1175"><span class="linenos">1175</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"CLUSTER BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-1176"><a href="#L-1176"><span class="linenos">1176</span></a> +</span><span id="L-1177"><a href="#L-1177"><span class="linenos">1177</span></a> <span class="k">def</span> <span class="nf">distribute_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distribute</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1178"><a href="#L-1178"><span class="linenos">1178</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"DISTRIBUTE BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-1179"><a href="#L-1179"><span class="linenos">1179</span></a> +</span><span id="L-1180"><a href="#L-1180"><span class="linenos">1180</span></a> <span class="k">def</span> <span class="nf">sort_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1181"><a href="#L-1181"><span class="linenos">1181</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"SORT BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-1182"><a href="#L-1182"><span class="linenos">1182</span></a> +</span><span id="L-1183"><a href="#L-1183"><span class="linenos">1183</span></a> <span class="k">def</span> <span class="nf">ordered_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1184"><a href="#L-1184"><span class="linenos">1184</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> +</span><span id="L-1185"><a href="#L-1185"><span class="linenos">1185</span></a> <span class="n">asc</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">desc</span> +</span><span id="L-1186"><a href="#L-1186"><span class="linenos">1186</span></a> +</span><span id="L-1187"><a href="#L-1187"><span class="linenos">1187</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nulls_first"</span><span class="p">)</span> +</span><span id="L-1188"><a href="#L-1188"><span class="linenos">1188</span></a> <span class="n">nulls_last</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">nulls_first</span> +</span><span id="L-1189"><a href="#L-1189"><span class="linenos">1189</span></a> <span class="n">nulls_are_large</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_large"</span> +</span><span id="L-1190"><a href="#L-1190"><span class="linenos">1190</span></a> <span class="n">nulls_are_small</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_small"</span> +</span><span id="L-1191"><a href="#L-1191"><span class="linenos">1191</span></a> <span class="n">nulls_are_last</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_last"</span> +</span><span id="L-1192"><a href="#L-1192"><span class="linenos">1192</span></a> +</span><span id="L-1193"><a href="#L-1193"><span class="linenos">1193</span></a> <span class="n">sort_order</span> <span class="o">=</span> <span class="s2">" DESC"</span> <span class="k">if</span> <span class="n">desc</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1194"><a href="#L-1194"><span class="linenos">1194</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-1195"><a href="#L-1195"><span class="linenos">1195</span></a> <span class="k">if</span> <span class="n">nulls_first</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-1196"><a href="#L-1196"><span class="linenos">1196</span></a> <span class="p">(</span><span class="n">asc</span> <span class="ow">and</span> <span class="n">nulls_are_large</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="n">nulls_are_small</span><span class="p">)</span> <span class="ow">or</span> <span class="n">nulls_are_last</span> +</span><span id="L-1197"><a href="#L-1197"><span class="linenos">1197</span></a> <span class="p">):</span> +</span><span id="L-1198"><a href="#L-1198"><span class="linenos">1198</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">" NULLS FIRST"</span> +</span><span id="L-1199"><a href="#L-1199"><span class="linenos">1199</span></a> <span class="k">elif</span> <span class="p">(</span> +</span><span id="L-1200"><a href="#L-1200"><span class="linenos">1200</span></a> <span class="n">nulls_last</span> +</span><span id="L-1201"><a href="#L-1201"><span class="linenos">1201</span></a> <span class="ow">and</span> <span class="p">((</span><span class="n">asc</span> <span class="ow">and</span> <span class="n">nulls_are_small</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="n">nulls_are_large</span><span class="p">))</span> +</span><span id="L-1202"><a href="#L-1202"><span class="linenos">1202</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">nulls_are_last</span> +</span><span id="L-1203"><a href="#L-1203"><span class="linenos">1203</span></a> <span class="p">):</span> +</span><span id="L-1204"><a href="#L-1204"><span class="linenos">1204</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">" NULLS LAST"</span> +</span><span id="L-1205"><a href="#L-1205"><span class="linenos">1205</span></a> +</span><span id="L-1206"><a href="#L-1206"><span class="linenos">1206</span></a> <span class="k">if</span> <span class="n">nulls_sort_change</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">NULL_ORDERING_SUPPORTED</span><span class="p">:</span> +</span><span id="L-1207"><a href="#L-1207"><span class="linenos">1207</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span> +</span><span id="L-1208"><a href="#L-1208"><span class="linenos">1208</span></a> <span class="s2">"Sorting in an ORDER BY on NULLS FIRST/NULLS LAST is not supported by this dialect"</span> +</span><span id="L-1209"><a href="#L-1209"><span class="linenos">1209</span></a> <span class="p">)</span> +</span><span id="L-1210"><a href="#L-1210"><span class="linenos">1210</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-1211"><a href="#L-1211"><span class="linenos">1211</span></a> +</span><span id="L-1212"><a href="#L-1212"><span class="linenos">1212</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">sort_order</span><span class="si">}{</span><span class="n">nulls_sort_change</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1213"><a href="#L-1213"><span class="linenos">1213</span></a> +</span><span id="L-1214"><a href="#L-1214"><span class="linenos">1214</span></a> <span class="k">def</span> <span class="nf">matchrecognize_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1215"><a href="#L-1215"><span class="linenos">1215</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition_by_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1216"><a href="#L-1216"><span class="linenos">1216</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-1217"><a href="#L-1217"><span class="linenos">1217</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"measures"</span><span class="p">)</span> +</span><span id="L-1218"><a href="#L-1218"><span class="linenos">1218</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"MEASURES </span><span class="si">{</span><span class="n">measures</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="n">measures</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1219"><a href="#L-1219"><span class="linenos">1219</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"rows"</span><span class="p">)</span> +</span><span id="L-1220"><a href="#L-1220"><span class="linenos">1220</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">rows</span><span class="p">)</span> <span class="k">if</span> <span class="n">rows</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1221"><a href="#L-1221"><span class="linenos">1221</span></a> <span class="n">after</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"after"</span><span class="p">)</span> +</span><span id="L-1222"><a href="#L-1222"><span class="linenos">1222</span></a> <span class="n">after</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">after</span><span class="p">)</span> <span class="k">if</span> <span class="n">after</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1223"><a href="#L-1223"><span class="linenos">1223</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"pattern"</span><span class="p">)</span> +</span><span id="L-1224"><a href="#L-1224"><span class="linenos">1224</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"PATTERN (</span><span class="si">{</span><span class="n">pattern</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> <span class="k">if</span> <span class="n">pattern</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1225"><a href="#L-1225"><span class="linenos">1225</span></a> <span class="n">define</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"define"</span><span class="p">)</span> +</span><span id="L-1226"><a href="#L-1226"><span class="linenos">1226</span></a> <span class="n">define</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"DEFINE </span><span class="si">{</span><span class="n">define</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="n">define</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1227"><a href="#L-1227"><span class="linenos">1227</span></a> <span class="n">body</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-1228"><a href="#L-1228"><span class="linenos">1228</span></a> <span class="p">(</span> +</span><span id="L-1229"><a href="#L-1229"><span class="linenos">1229</span></a> <span class="n">partition</span><span class="p">,</span> +</span><span id="L-1230"><a href="#L-1230"><span class="linenos">1230</span></a> <span class="n">order</span><span class="p">,</span> +</span><span id="L-1231"><a href="#L-1231"><span class="linenos">1231</span></a> <span class="n">measures</span><span class="p">,</span> +</span><span id="L-1232"><a href="#L-1232"><span class="linenos">1232</span></a> <span class="n">rows</span><span class="p">,</span> +</span><span id="L-1233"><a href="#L-1233"><span class="linenos">1233</span></a> <span class="n">after</span><span class="p">,</span> +</span><span id="L-1234"><a href="#L-1234"><span class="linenos">1234</span></a> <span class="n">pattern</span><span class="p">,</span> +</span><span id="L-1235"><a href="#L-1235"><span class="linenos">1235</span></a> <span class="n">define</span><span class="p">,</span> +</span><span id="L-1236"><a href="#L-1236"><span class="linenos">1236</span></a> <span class="p">)</span> +</span><span id="L-1237"><a href="#L-1237"><span class="linenos">1237</span></a> <span class="p">)</span> +</span><span id="L-1238"><a href="#L-1238"><span class="linenos">1238</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'MATCH_RECOGNIZE'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">body</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1239"><a href="#L-1239"><span class="linenos">1239</span></a> +</span><span id="L-1240"><a href="#L-1240"><span class="linenos">1240</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1241"><a href="#L-1241"><span class="linenos">1241</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="L-1242"><a href="#L-1242"><span class="linenos">1242</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="L-1243"><a href="#L-1243"><span class="linenos">1243</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="L-1244"><a href="#L-1244"><span class="linenos">1244</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="L-1245"><a href="#L-1245"><span class="linenos">1245</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="L-1246"><a href="#L-1246"><span class="linenos">1246</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="L-1247"><a href="#L-1247"><span class="linenos">1247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="L-1248"><a href="#L-1248"><span class="linenos">1248</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="L-1249"><a href="#L-1249"><span class="linenos">1249</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="L-1250"><a href="#L-1250"><span class="linenos">1250</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1251"><a href="#L-1251"><span class="linenos">1251</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="L-1252"><a href="#L-1252"><span class="linenos">1252</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-1253"><a href="#L-1253"><span class="linenos">1253</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="L-1254"><a href="#L-1254"><span class="linenos">1254</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="L-1255"><a href="#L-1255"><span class="linenos">1255</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="L-1256"><a href="#L-1256"><span class="linenos">1256</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="L-1257"><a href="#L-1257"><span class="linenos">1257</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="L-1258"><a href="#L-1258"><span class="linenos">1258</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> +</span><span id="L-1259"><a href="#L-1259"><span class="linenos">1259</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="L-1260"><a href="#L-1260"><span class="linenos">1260</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="L-1261"><a href="#L-1261"><span class="linenos">1261</span></a> <span class="p">)</span> +</span><span id="L-1262"><a href="#L-1262"><span class="linenos">1262</span></a> +</span><span id="L-1263"><a href="#L-1263"><span class="linenos">1263</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1264"><a href="#L-1264"><span class="linenos">1264</span></a> <span class="n">hint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"hint"</span><span class="p">)</span> +</span><span id="L-1265"><a href="#L-1265"><span class="linenos">1265</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distinct"</span><span class="p">)</span> +</span><span id="L-1266"><a href="#L-1266"><span class="linenos">1266</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">distinct</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">distinct</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1267"><a href="#L-1267"><span class="linenos">1267</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1268"><a href="#L-1268"><span class="linenos">1268</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">expressions</span> <span class="k">else</span> <span class="n">expressions</span> +</span><span id="L-1269"><a href="#L-1269"><span class="linenos">1269</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="L-1270"><a href="#L-1270"><span class="linenos">1270</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-1271"><a href="#L-1271"><span class="linenos">1271</span></a> <span class="sa">f</span><span class="s2">"SELECT</span><span class="si">{</span><span class="n">hint</span><span class="si">}{</span><span class="n">distinct</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-1272"><a href="#L-1272"><span class="linenos">1272</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"into"</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-1273"><a href="#L-1273"><span class="linenos">1273</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-1274"><a href="#L-1274"><span class="linenos">1274</span></a> <span class="p">)</span> +</span><span id="L-1275"><a href="#L-1275"><span class="linenos">1275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-1276"><a href="#L-1276"><span class="linenos">1276</span></a> +</span><span id="L-1277"><a href="#L-1277"><span class="linenos">1277</span></a> <span class="k">def</span> <span class="nf">schema_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1278"><a href="#L-1278"><span class="linenos">1278</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1279"><a href="#L-1279"><span class="linenos">1279</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1280"><a href="#L-1280"><span class="linenos">1280</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1281"><a href="#L-1281"><span class="linenos">1281</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1282"><a href="#L-1282"><span class="linenos">1282</span></a> +</span><span id="L-1283"><a href="#L-1283"><span class="linenos">1283</span></a> <span class="k">def</span> <span class="nf">star_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1284"><a href="#L-1284"><span class="linenos">1284</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"except"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1285"><a href="#L-1285"><span class="linenos">1285</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STAR_MAPPING</span><span class="p">[</span><span class="s1">'except'</span><span class="p">])</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">except_</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">except_</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1286"><a href="#L-1286"><span class="linenos">1286</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"replace"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1287"><a href="#L-1287"><span class="linenos">1287</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STAR_MAPPING</span><span class="p">[</span><span class="s1">'replace'</span><span class="p">])</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">replace</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">replace</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1288"><a href="#L-1288"><span class="linenos">1288</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"*</span><span class="si">{</span><span class="n">except_</span><span class="si">}{</span><span class="n">replace</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1289"><a href="#L-1289"><span class="linenos">1289</span></a> +</span><span id="L-1290"><a href="#L-1290"><span class="linenos">1290</span></a> <span class="k">def</span> <span class="nf">structkwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1291"><a href="#L-1291"><span class="linenos">1291</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1292"><a href="#L-1292"><span class="linenos">1292</span></a> +</span><span id="L-1293"><a href="#L-1293"><span class="linenos">1293</span></a> <span class="k">def</span> <span class="nf">parameter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1294"><a href="#L-1294"><span class="linenos">1294</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"@</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1295"><a href="#L-1295"><span class="linenos">1295</span></a> +</span><span id="L-1296"><a href="#L-1296"><span class="linenos">1296</span></a> <span class="k">def</span> <span class="nf">sessionparameter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SessionParameter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1297"><a href="#L-1297"><span class="linenos">1297</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1298"><a href="#L-1298"><span class="linenos">1298</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-1299"><a href="#L-1299"><span class="linenos">1299</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="L-1300"><a href="#L-1300"><span class="linenos">1300</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">."</span> +</span><span id="L-1301"><a href="#L-1301"><span class="linenos">1301</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"@@</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1302"><a href="#L-1302"><span class="linenos">1302</span></a> +</span><span id="L-1303"><a href="#L-1303"><span class="linenos">1303</span></a> <span class="k">def</span> <span class="nf">placeholder_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1304"><a href="#L-1304"><span class="linenos">1304</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">":</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">"?"</span> +</span><span id="L-1305"><a href="#L-1305"><span class="linenos">1305</span></a> +</span><span id="L-1306"><a href="#L-1306"><span class="linenos">1306</span></a> <span class="k">def</span> <span class="nf">subquery_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1307"><a href="#L-1307"><span class="linenos">1307</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1308"><a href="#L-1308"><span class="linenos">1308</span></a> +</span><span id="L-1309"><a href="#L-1309"><span class="linenos">1309</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="L-1310"><a href="#L-1310"><span class="linenos">1310</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-1311"><a href="#L-1311"><span class="linenos">1311</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">),</span> +</span><span id="L-1312"><a href="#L-1312"><span class="linenos">1312</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"pivots"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">),</span> +</span><span id="L-1313"><a href="#L-1313"><span class="linenos">1313</span></a> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-1314"><a href="#L-1314"><span class="linenos">1314</span></a> <span class="p">)</span> +</span><span id="L-1315"><a href="#L-1315"><span class="linenos">1315</span></a> +</span><span id="L-1316"><a href="#L-1316"><span class="linenos">1316</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-1317"><a href="#L-1317"><span class="linenos">1317</span></a> +</span><span id="L-1318"><a href="#L-1318"><span class="linenos">1318</span></a> <span class="k">def</span> <span class="nf">qualify_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1319"><a href="#L-1319"><span class="linenos">1319</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="L-1320"><a href="#L-1320"><span class="linenos">1320</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'QUALIFY'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1321"><a href="#L-1321"><span class="linenos">1321</span></a> +</span><span id="L-1322"><a href="#L-1322"><span class="linenos">1322</span></a> <span class="k">def</span> <span class="nf">union_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1323"><a href="#L-1323"><span class="linenos">1323</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="L-1324"><a href="#L-1324"><span class="linenos">1324</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-1325"><a href="#L-1325"><span class="linenos">1325</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">union_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="L-1326"><a href="#L-1326"><span class="linenos">1326</span></a> <span class="p">)</span> +</span><span id="L-1327"><a href="#L-1327"><span class="linenos">1327</span></a> +</span><span id="L-1328"><a href="#L-1328"><span class="linenos">1328</span></a> <span class="k">def</span> <span class="nf">union_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1329"><a href="#L-1329"><span class="linenos">1329</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="s2">" DISTINCT"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXPLICIT_UNION</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1330"><a href="#L-1330"><span class="linenos">1330</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">kind</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" ALL"</span> +</span><span id="L-1331"><a href="#L-1331"><span class="linenos">1331</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNION</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1332"><a href="#L-1332"><span class="linenos">1332</span></a> +</span><span id="L-1333"><a href="#L-1333"><span class="linenos">1333</span></a> <span class="k">def</span> <span class="nf">unnest_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1334"><a href="#L-1334"><span class="linenos">1334</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1335"><a href="#L-1335"><span class="linenos">1335</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1336"><a href="#L-1336"><span class="linenos">1336</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">:</span> +</span><span id="L-1337"><a href="#L-1337"><span class="linenos">1337</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">alias</span><span class="o">.</span><span class="n">columns</span> +</span><span id="L-1338"><a href="#L-1338"><span class="linenos">1338</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1339"><a href="#L-1339"><span class="linenos">1339</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1340"><a href="#L-1340"><span class="linenos">1340</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1341"><a href="#L-1341"><span class="linenos">1341</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">alias</span> +</span><span id="L-1342"><a href="#L-1342"><span class="linenos">1342</span></a> <span class="n">ordinality</span> <span class="o">=</span> <span class="s2">" WITH ORDINALITY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"ordinality"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1343"><a href="#L-1343"><span class="linenos">1343</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"offset"</span><span class="p">)</span> +</span><span id="L-1344"><a href="#L-1344"><span class="linenos">1344</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITH OFFSET AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">offset</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">offset</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1345"><a href="#L-1345"><span class="linenos">1345</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNNEST(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">ordinality</span><span class="si">}{</span><span class="n">alias</span><span class="si">}{</span><span class="n">offset</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1346"><a href="#L-1346"><span class="linenos">1346</span></a> +</span><span id="L-1347"><a href="#L-1347"><span class="linenos">1347</span></a> <span class="k">def</span> <span class="nf">where_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1348"><a href="#L-1348"><span class="linenos">1348</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="L-1349"><a href="#L-1349"><span class="linenos">1349</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'WHERE'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1350"><a href="#L-1350"><span class="linenos">1350</span></a> +</span><span id="L-1351"><a href="#L-1351"><span class="linenos">1351</span></a> <span class="k">def</span> <span class="nf">window_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1352"><a href="#L-1352"><span class="linenos">1352</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1353"><a href="#L-1353"><span class="linenos">1353</span></a> +</span><span id="L-1354"><a href="#L-1354"><span class="linenos">1354</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition_by_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1355"><a href="#L-1355"><span class="linenos">1355</span></a> +</span><span id="L-1356"><a href="#L-1356"><span class="linenos">1356</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-1357"><a href="#L-1357"><span class="linenos">1357</span></a> <span class="n">order_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">order_sql</span><span class="p">(</span><span class="n">order</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">order</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1358"><a href="#L-1358"><span class="linenos">1358</span></a> +</span><span id="L-1359"><a href="#L-1359"><span class="linenos">1359</span></a> <span class="n">partition_sql</span> <span class="o">=</span> <span class="n">partition</span> <span class="o">+</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">partition</span> <span class="ow">and</span> <span class="n">order</span> <span class="k">else</span> <span class="n">partition</span> +</span><span id="L-1360"><a href="#L-1360"><span class="linenos">1360</span></a> +</span><span id="L-1361"><a href="#L-1361"><span class="linenos">1361</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">)</span> +</span><span id="L-1362"><a href="#L-1362"><span class="linenos">1362</span></a> <span class="n">spec_sql</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_spec_sql</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span> <span class="k">if</span> <span class="n">spec</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1363"><a href="#L-1363"><span class="linenos">1363</span></a> +</span><span id="L-1364"><a href="#L-1364"><span class="linenos">1364</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1365"><a href="#L-1365"><span class="linenos">1365</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="s1">'AS'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">arg_key</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s1">'windows'</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'OVER'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1366"><a href="#L-1366"><span class="linenos">1366</span></a> +</span><span id="L-1367"><a href="#L-1367"><span class="linenos">1367</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">partition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">order</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">spec</span> <span class="ow">and</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-1368"><a href="#L-1368"><span class="linenos">1368</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1369"><a href="#L-1369"><span class="linenos">1369</span></a> +</span><span id="L-1370"><a href="#L-1370"><span class="linenos">1370</span></a> <span class="n">window_args</span> <span class="o">=</span> <span class="n">alias</span> <span class="o">+</span> <span class="n">partition_sql</span> <span class="o">+</span> <span class="n">order_sql</span> <span class="o">+</span> <span class="n">spec_sql</span> +</span><span id="L-1371"><a href="#L-1371"><span class="linenos">1371</span></a> +</span><span id="L-1372"><a href="#L-1372"><span class="linenos">1372</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">window_args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1373"><a href="#L-1373"><span class="linenos">1373</span></a> +</span><span id="L-1374"><a href="#L-1374"><span class="linenos">1374</span></a> <span class="k">def</span> <span class="nf">partition_by_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1375"><a href="#L-1375"><span class="linenos">1375</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1376"><a href="#L-1376"><span class="linenos">1376</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="n">partition</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">partition</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1377"><a href="#L-1377"><span class="linenos">1377</span></a> +</span><span id="L-1378"><a href="#L-1378"><span class="linenos">1378</span></a> <span class="k">def</span> <span class="nf">window_spec_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1379"><a href="#L-1379"><span class="linenos">1379</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-1380"><a href="#L-1380"><span class="linenos">1380</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start_side"</span><span class="p">),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-1381"><a href="#L-1381"><span class="linenos">1381</span></a> <span class="n">end</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1382"><a href="#L-1382"><span class="linenos">1382</span></a> <span class="n">csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"end"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"end_side"</span><span class="p">),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-1383"><a href="#L-1383"><span class="linenos">1383</span></a> <span class="ow">or</span> <span class="s2">"CURRENT ROW"</span> +</span><span id="L-1384"><a href="#L-1384"><span class="linenos">1384</span></a> <span class="p">)</span> +</span><span id="L-1385"><a href="#L-1385"><span class="linenos">1385</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1386"><a href="#L-1386"><span class="linenos">1386</span></a> +</span><span id="L-1387"><a href="#L-1387"><span class="linenos">1387</span></a> <span class="k">def</span> <span class="nf">withingroup_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1388"><a href="#L-1388"><span class="linenos">1388</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1389"><a href="#L-1389"><span class="linenos">1389</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> <span class="c1"># order has a leading space</span> +</span><span id="L-1390"><a href="#L-1390"><span class="linenos">1390</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> WITHIN GROUP (</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1391"><a href="#L-1391"><span class="linenos">1391</span></a> +</span><span id="L-1392"><a href="#L-1392"><span class="linenos">1392</span></a> <span class="k">def</span> <span class="nf">between_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1393"><a href="#L-1393"><span class="linenos">1393</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1394"><a href="#L-1394"><span class="linenos">1394</span></a> <span class="n">low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"low"</span><span class="p">)</span> +</span><span id="L-1395"><a href="#L-1395"><span class="linenos">1395</span></a> <span class="n">high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"high"</span><span class="p">)</span> +</span><span id="L-1396"><a href="#L-1396"><span class="linenos">1396</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">low</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">high</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1397"><a href="#L-1397"><span class="linenos">1397</span></a> +</span><span id="L-1398"><a href="#L-1398"><span class="linenos">1398</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1399"><a href="#L-1399"><span class="linenos">1399</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">apply_index_offset</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">)</span> +</span><span id="L-1400"><a href="#L-1400"><span class="linenos">1400</span></a> <span class="n">expressions_sql</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="L-1401"><a href="#L-1401"><span class="linenos">1401</span></a> +</span><span id="L-1402"><a href="#L-1402"><span class="linenos">1402</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">[</span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">]"</span> +</span><span id="L-1403"><a href="#L-1403"><span class="linenos">1403</span></a> +</span><span id="L-1404"><a href="#L-1404"><span class="linenos">1404</span></a> <span class="k">def</span> <span class="nf">all_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1405"><a href="#L-1405"><span class="linenos">1405</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALL </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1406"><a href="#L-1406"><span class="linenos">1406</span></a> +</span><span id="L-1407"><a href="#L-1407"><span class="linenos">1407</span></a> <span class="k">def</span> <span class="nf">any_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1408"><a href="#L-1408"><span class="linenos">1408</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ANY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1409"><a href="#L-1409"><span class="linenos">1409</span></a> +</span><span id="L-1410"><a href="#L-1410"><span class="linenos">1410</span></a> <span class="k">def</span> <span class="nf">exists_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1411"><a href="#L-1411"><span class="linenos">1411</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXISTS</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1412"><a href="#L-1412"><span class="linenos">1412</span></a> +</span><span id="L-1413"><a href="#L-1413"><span class="linenos">1413</span></a> <span class="k">def</span> <span class="nf">case_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1414"><a href="#L-1414"><span class="linenos">1414</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1415"><a href="#L-1415"><span class="linenos">1415</span></a> <span class="n">statements</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"CASE </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">"CASE"</span><span class="p">]</span> +</span><span id="L-1416"><a href="#L-1416"><span class="linenos">1416</span></a> +</span><span id="L-1417"><a href="#L-1417"><span class="linenos">1417</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">]:</span> +</span><span id="L-1418"><a href="#L-1418"><span class="linenos">1418</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"WHEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1419"><a href="#L-1419"><span class="linenos">1419</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"THEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'true'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1420"><a href="#L-1420"><span class="linenos">1420</span></a> +</span><span id="L-1421"><a href="#L-1421"><span class="linenos">1421</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> +</span><span id="L-1422"><a href="#L-1422"><span class="linenos">1422</span></a> +</span><span id="L-1423"><a href="#L-1423"><span class="linenos">1423</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="L-1424"><a href="#L-1424"><span class="linenos">1424</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"ELSE </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1425"><a href="#L-1425"><span class="linenos">1425</span></a> +</span><span id="L-1426"><a href="#L-1426"><span class="linenos">1426</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"END"</span><span class="p">)</span> +</span><span id="L-1427"><a href="#L-1427"><span class="linenos">1427</span></a> +</span><span id="L-1428"><a href="#L-1428"><span class="linenos">1428</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">statements</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span><span class="p">:</span> +</span><span id="L-1429"><a href="#L-1429"><span class="linenos">1429</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">statements</span><span class="p">),</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">skip_last</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1430"><a href="#L-1430"><span class="linenos">1430</span></a> +</span><span id="L-1431"><a href="#L-1431"><span class="linenos">1431</span></a> <span class="k">return</span> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">statements</span><span class="p">)</span> +</span><span id="L-1432"><a href="#L-1432"><span class="linenos">1432</span></a> +</span><span id="L-1433"><a href="#L-1433"><span class="linenos">1433</span></a> <span class="k">def</span> <span class="nf">constraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Constraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1434"><a href="#L-1434"><span class="linenos">1434</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1435"><a href="#L-1435"><span class="linenos">1435</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1436"><a href="#L-1436"><span class="linenos">1436</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1437"><a href="#L-1437"><span class="linenos">1437</span></a> +</span><span id="L-1438"><a href="#L-1438"><span class="linenos">1438</span></a> <span class="k">def</span> <span class="nf">extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1439"><a href="#L-1439"><span class="linenos">1439</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1440"><a href="#L-1440"><span class="linenos">1440</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-1441"><a href="#L-1441"><span class="linenos">1441</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXTRACT(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> FROM </span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1442"><a href="#L-1442"><span class="linenos">1442</span></a> +</span><span id="L-1443"><a href="#L-1443"><span class="linenos">1443</span></a> <span class="k">def</span> <span class="nf">trim_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1444"><a href="#L-1444"><span class="linenos">1444</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="L-1445"><a href="#L-1445"><span class="linenos">1445</span></a> +</span><span id="L-1446"><a href="#L-1446"><span class="linenos">1446</span></a> <span class="k">if</span> <span class="n">trim_type</span> <span class="o">==</span> <span class="s2">"LEADING"</span><span class="p">:</span> +</span><span id="L-1447"><a href="#L-1447"><span class="linenos">1447</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'LTRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1448"><a href="#L-1448"><span class="linenos">1448</span></a> <span class="k">elif</span> <span class="n">trim_type</span> <span class="o">==</span> <span class="s2">"TRAILING"</span><span class="p">:</span> +</span><span id="L-1449"><a href="#L-1449"><span class="linenos">1449</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'RTRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1450"><a href="#L-1450"><span class="linenos">1450</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1451"><a href="#L-1451"><span class="linenos">1451</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'TRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1452"><a href="#L-1452"><span class="linenos">1452</span></a> +</span><span id="L-1453"><a href="#L-1453"><span class="linenos">1453</span></a> <span class="k">def</span> <span class="nf">concat_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1454"><a href="#L-1454"><span class="linenos">1454</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-1455"><a href="#L-1455"><span class="linenos">1455</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="L-1456"><a href="#L-1456"><span class="linenos">1456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1457"><a href="#L-1457"><span class="linenos">1457</span></a> +</span><span id="L-1458"><a href="#L-1458"><span class="linenos">1458</span></a> <span class="k">def</span> <span class="nf">check_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Check</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1459"><a href="#L-1459"><span class="linenos">1459</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1460"><a href="#L-1460"><span class="linenos">1460</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECK (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1461"><a href="#L-1461"><span class="linenos">1461</span></a> +</span><span id="L-1462"><a href="#L-1462"><span class="linenos">1462</span></a> <span class="k">def</span> <span class="nf">foreignkey_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1463"><a href="#L-1463"><span class="linenos">1463</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1464"><a href="#L-1464"><span class="linenos">1464</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"reference"</span><span class="p">)</span> +</span><span id="L-1465"><a href="#L-1465"><span class="linenos">1465</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">reference</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">reference</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1466"><a href="#L-1466"><span class="linenos">1466</span></a> <span class="n">delete</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"delete"</span><span class="p">)</span> +</span><span id="L-1467"><a href="#L-1467"><span class="linenos">1467</span></a> <span class="n">delete</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON DELETE </span><span class="si">{</span><span class="n">delete</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">delete</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1468"><a href="#L-1468"><span class="linenos">1468</span></a> <span class="n">update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"update"</span><span class="p">)</span> +</span><span id="L-1469"><a href="#L-1469"><span class="linenos">1469</span></a> <span class="n">update</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON UPDATE </span><span class="si">{</span><span class="n">update</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">update</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1470"><a href="#L-1470"><span class="linenos">1470</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOREIGN KEY (</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">reference</span><span class="si">}{</span><span class="n">delete</span><span class="si">}{</span><span class="n">update</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1471"><a href="#L-1471"><span class="linenos">1471</span></a> +</span><span id="L-1472"><a href="#L-1472"><span class="linenos">1472</span></a> <span class="k">def</span> <span class="nf">primarykey_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1473"><a href="#L-1473"><span class="linenos">1473</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1474"><a href="#L-1474"><span class="linenos">1474</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-1475"><a href="#L-1475"><span class="linenos">1475</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1476"><a href="#L-1476"><span class="linenos">1476</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY (</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1477"><a href="#L-1477"><span class="linenos">1477</span></a> +</span><span id="L-1478"><a href="#L-1478"><span class="linenos">1478</span></a> <span class="k">def</span> <span class="nf">unique_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unique</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1479"><a href="#L-1479"><span class="linenos">1479</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="L-1480"><a href="#L-1480"><span class="linenos">1480</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNIQUE (</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1481"><a href="#L-1481"><span class="linenos">1481</span></a> +</span><span id="L-1482"><a href="#L-1482"><span class="linenos">1482</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1483"><a href="#L-1483"><span class="linenos">1483</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">case_sql</span><span class="p">(</span> +</span><span id="L-1484"><a href="#L-1484"><span class="linenos">1484</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">(</span><span class="n">ifs</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()],</span> <span class="n">default</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">))</span> +</span><span id="L-1485"><a href="#L-1485"><span class="linenos">1485</span></a> <span class="p">)</span> +</span><span id="L-1486"><a href="#L-1486"><span class="linenos">1486</span></a> +</span><span id="L-1487"><a href="#L-1487"><span class="linenos">1487</span></a> <span class="k">def</span> <span class="nf">in_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1488"><a href="#L-1488"><span class="linenos">1488</span></a> <span class="n">query</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"query"</span><span class="p">)</span> +</span><span id="L-1489"><a href="#L-1489"><span class="linenos">1489</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unnest"</span><span class="p">)</span> +</span><span id="L-1490"><a href="#L-1490"><span class="linenos">1490</span></a> <span class="n">field</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"field"</span><span class="p">)</span> +</span><span id="L-1491"><a href="#L-1491"><span class="linenos">1491</span></a> <span class="n">is_global</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1492"><a href="#L-1492"><span class="linenos">1492</span></a> +</span><span id="L-1493"><a href="#L-1493"><span class="linenos">1493</span></a> <span class="k">if</span> <span class="n">query</span><span class="p">:</span> +</span><span id="L-1494"><a href="#L-1494"><span class="linenos">1494</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">query</span><span class="p">)</span> +</span><span id="L-1495"><a href="#L-1495"><span class="linenos">1495</span></a> <span class="k">elif</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="L-1496"><a href="#L-1496"><span class="linenos">1496</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">in_unnest_op</span><span class="p">(</span><span class="n">unnest</span><span class="p">)</span> +</span><span id="L-1497"><a href="#L-1497"><span class="linenos">1497</span></a> <span class="k">elif</span> <span class="n">field</span><span class="p">:</span> +</span><span id="L-1498"><a href="#L-1498"><span class="linenos">1498</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">field</span><span class="p">)</span> +</span><span id="L-1499"><a href="#L-1499"><span class="linenos">1499</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1500"><a href="#L-1500"><span class="linenos">1500</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1501"><a href="#L-1501"><span class="linenos">1501</span></a> +</span><span id="L-1502"><a href="#L-1502"><span class="linenos">1502</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">is_global</span><span class="si">}</span><span class="s2"> IN </span><span class="si">{</span><span class="n">in_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1503"><a href="#L-1503"><span class="linenos">1503</span></a> +</span><span id="L-1504"><a href="#L-1504"><span class="linenos">1504</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">unnest</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1505"><a href="#L-1505"><span class="linenos">1505</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(SELECT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">unnest</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1506"><a href="#L-1506"><span class="linenos">1506</span></a> +</span><span id="L-1507"><a href="#L-1507"><span class="linenos">1507</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1508"><a href="#L-1508"><span class="linenos">1508</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1509"><a href="#L-1509"><span class="linenos">1509</span></a> <span class="k">if</span> <span class="n">this</span><span class="p">:</span> +</span><span id="L-1510"><a href="#L-1510"><span class="linenos">1510</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1511"><a href="#L-1511"><span class="linenos">1511</span></a> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1512"><a href="#L-1512"><span class="linenos">1512</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> +</span><span id="L-1513"><a href="#L-1513"><span class="linenos">1513</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">" (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1514"><a href="#L-1514"><span class="linenos">1514</span></a> <span class="p">)</span> +</span><span id="L-1515"><a href="#L-1515"><span class="linenos">1515</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1516"><a href="#L-1516"><span class="linenos">1516</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-1517"><a href="#L-1517"><span class="linenos">1517</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="L-1518"><a href="#L-1518"><span class="linenos">1518</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">unit</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1519"><a href="#L-1519"><span class="linenos">1519</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERVAL</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1520"><a href="#L-1520"><span class="linenos">1520</span></a> +</span><span id="L-1521"><a href="#L-1521"><span class="linenos">1521</span></a> <span class="k">def</span> <span class="nf">return_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Return</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1522"><a href="#L-1522"><span class="linenos">1522</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1523"><a href="#L-1523"><span class="linenos">1523</span></a> +</span><span id="L-1524"><a href="#L-1524"><span class="linenos">1524</span></a> <span class="k">def</span> <span class="nf">reference_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Reference</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1525"><a href="#L-1525"><span class="linenos">1525</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1526"><a href="#L-1526"><span class="linenos">1526</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1527"><a href="#L-1527"><span class="linenos">1527</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">expressions</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1528"><a href="#L-1528"><span class="linenos">1528</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-1529"><a href="#L-1529"><span class="linenos">1529</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1530"><a href="#L-1530"><span class="linenos">1530</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"REFERENCES </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1531"><a href="#L-1531"><span class="linenos">1531</span></a> +</span><span id="L-1532"><a href="#L-1532"><span class="linenos">1532</span></a> <span class="k">def</span> <span class="nf">anonymous_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1533"><a href="#L-1533"><span class="linenos">1533</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-1534"><a href="#L-1534"><span class="linenos">1534</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">))</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1535"><a href="#L-1535"><span class="linenos">1535</span></a> +</span><span id="L-1536"><a href="#L-1536"><span class="linenos">1536</span></a> <span class="k">def</span> <span class="nf">paren_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1537"><a href="#L-1537"><span class="linenos">1537</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-1538"><a href="#L-1538"><span class="linenos">1538</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1539"><a href="#L-1539"><span class="linenos">1539</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1540"><a href="#L-1540"><span class="linenos">1540</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-1541"><a href="#L-1541"><span class="linenos">1541</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1542"><a href="#L-1542"><span class="linenos">1542</span></a> +</span><span id="L-1543"><a href="#L-1543"><span class="linenos">1543</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-1544"><a href="#L-1544"><span class="linenos">1544</span></a> +</span><span id="L-1545"><a href="#L-1545"><span class="linenos">1545</span></a> <span class="k">def</span> <span class="nf">neg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1546"><a href="#L-1546"><span class="linenos">1546</span></a> <span class="c1"># This makes sure we don't convert "- - 5" to "--5", which is a comment</span> +</span><span id="L-1547"><a href="#L-1547"><span class="linenos">1547</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1548"><a href="#L-1548"><span class="linenos">1548</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">this_sql</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"-"</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1549"><a href="#L-1549"><span class="linenos">1549</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"-</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">this_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1550"><a href="#L-1550"><span class="linenos">1550</span></a> +</span><span id="L-1551"><a href="#L-1551"><span class="linenos">1551</span></a> <span class="k">def</span> <span class="nf">not_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1552"><a href="#L-1552"><span class="linenos">1552</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1553"><a href="#L-1553"><span class="linenos">1553</span></a> +</span><span id="L-1554"><a href="#L-1554"><span class="linenos">1554</span></a> <span class="k">def</span> <span class="nf">alias_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1555"><a href="#L-1555"><span class="linenos">1555</span></a> <span class="n">to_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-1556"><a href="#L-1556"><span class="linenos">1556</span></a> <span class="n">to_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">to_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">to_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1557"><a href="#L-1557"><span class="linenos">1557</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">to_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1558"><a href="#L-1558"><span class="linenos">1558</span></a> +</span><span id="L-1559"><a href="#L-1559"><span class="linenos">1559</span></a> <span class="k">def</span> <span class="nf">aliases_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Aliases</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1560"><a href="#L-1560"><span class="linenos">1560</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1561"><a href="#L-1561"><span class="linenos">1561</span></a> +</span><span id="L-1562"><a href="#L-1562"><span class="linenos">1562</span></a> <span class="k">def</span> <span class="nf">attimezone_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1563"><a href="#L-1563"><span class="linenos">1563</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1564"><a href="#L-1564"><span class="linenos">1564</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">)</span> +</span><span id="L-1565"><a href="#L-1565"><span class="linenos">1565</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AT TIME ZONE </span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1566"><a href="#L-1566"><span class="linenos">1566</span></a> +</span><span id="L-1567"><a href="#L-1567"><span class="linenos">1567</span></a> <span class="k">def</span> <span class="nf">add_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1568"><a href="#L-1568"><span class="linenos">1568</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">)</span> +</span><span id="L-1569"><a href="#L-1569"><span class="linenos">1569</span></a> +</span><span id="L-1570"><a href="#L-1570"><span class="linenos">1570</span></a> <span class="k">def</span> <span class="nf">and_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1571"><a href="#L-1571"><span class="linenos">1571</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">connector_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"AND"</span><span class="p">)</span> +</span><span id="L-1572"><a href="#L-1572"><span class="linenos">1572</span></a> +</span><span id="L-1573"><a href="#L-1573"><span class="linenos">1573</span></a> <span class="k">def</span> <span class="nf">connector_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1574"><a href="#L-1574"><span class="linenos">1574</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="L-1575"><a href="#L-1575"><span class="linenos">1575</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">op</span><span class="p">)</span> +</span><span id="L-1576"><a href="#L-1576"><span class="linenos">1576</span></a> +</span><span id="L-1577"><a href="#L-1577"><span class="linenos">1577</span></a> <span class="n">sqls</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(</span><span class="n">unnest</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span> +</span><span id="L-1578"><a href="#L-1578"><span class="linenos">1578</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">sqls</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="L-1579"><a href="#L-1579"><span class="linenos">1579</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">op</span><span class="si">}</span><span class="s2"> "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">sqls</span><span class="p">)</span> +</span><span id="L-1580"><a href="#L-1580"><span class="linenos">1580</span></a> +</span><span id="L-1581"><a href="#L-1581"><span class="linenos">1581</span></a> <span class="k">def</span> <span class="nf">bitwiseand_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1582"><a href="#L-1582"><span class="linenos">1582</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"&"</span><span class="p">)</span> +</span><span id="L-1583"><a href="#L-1583"><span class="linenos">1583</span></a> +</span><span id="L-1584"><a href="#L-1584"><span class="linenos">1584</span></a> <span class="k">def</span> <span class="nf">bitwiseleftshift_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1585"><a href="#L-1585"><span class="linenos">1585</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<<"</span><span class="p">)</span> +</span><span id="L-1586"><a href="#L-1586"><span class="linenos">1586</span></a> +</span><span id="L-1587"><a href="#L-1587"><span class="linenos">1587</span></a> <span class="k">def</span> <span class="nf">bitwisenot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1588"><a href="#L-1588"><span class="linenos">1588</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"~</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1589"><a href="#L-1589"><span class="linenos">1589</span></a> +</span><span id="L-1590"><a href="#L-1590"><span class="linenos">1590</span></a> <span class="k">def</span> <span class="nf">bitwiseor_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1591"><a href="#L-1591"><span class="linenos">1591</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"|"</span><span class="p">)</span> +</span><span id="L-1592"><a href="#L-1592"><span class="linenos">1592</span></a> +</span><span id="L-1593"><a href="#L-1593"><span class="linenos">1593</span></a> <span class="k">def</span> <span class="nf">bitwiserightshift_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1594"><a href="#L-1594"><span class="linenos">1594</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">>"</span><span class="p">)</span> +</span><span id="L-1595"><a href="#L-1595"><span class="linenos">1595</span></a> +</span><span id="L-1596"><a href="#L-1596"><span class="linenos">1596</span></a> <span class="k">def</span> <span class="nf">bitwisexor_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1597"><a href="#L-1597"><span class="linenos">1597</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"^"</span><span class="p">)</span> +</span><span id="L-1598"><a href="#L-1598"><span class="linenos">1598</span></a> +</span><span id="L-1599"><a href="#L-1599"><span class="linenos">1599</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1600"><a href="#L-1600"><span class="linenos">1600</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1601"><a href="#L-1601"><span class="linenos">1601</span></a> +</span><span id="L-1602"><a href="#L-1602"><span class="linenos">1602</span></a> <span class="k">def</span> <span class="nf">currentdate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1603"><a href="#L-1603"><span class="linenos">1603</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1604"><a href="#L-1604"><span class="linenos">1604</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CURRENT_DATE(</span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">zone</span> <span class="k">else</span> <span class="s2">"CURRENT_DATE"</span> +</span><span id="L-1605"><a href="#L-1605"><span class="linenos">1605</span></a> +</span><span id="L-1606"><a href="#L-1606"><span class="linenos">1606</span></a> <span class="k">def</span> <span class="nf">collate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Collate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1607"><a href="#L-1607"><span class="linenos">1607</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"COLLATE"</span><span class="p">)</span> +</span><span id="L-1608"><a href="#L-1608"><span class="linenos">1608</span></a> +</span><span id="L-1609"><a href="#L-1609"><span class="linenos">1609</span></a> <span class="k">def</span> <span class="nf">command_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1610"><a href="#L-1610"><span class="linenos">1610</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s1">'expression'</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1611"><a href="#L-1611"><span class="linenos">1611</span></a> +</span><span id="L-1612"><a href="#L-1612"><span class="linenos">1612</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1613"><a href="#L-1613"><span class="linenos">1613</span></a> <span class="k">return</span> <span class="s2">"BEGIN"</span> +</span><span id="L-1614"><a href="#L-1614"><span class="linenos">1614</span></a> +</span><span id="L-1615"><a href="#L-1615"><span class="linenos">1615</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Commit</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1616"><a href="#L-1616"><span class="linenos">1616</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"chain"</span><span class="p">)</span> +</span><span id="L-1617"><a href="#L-1617"><span class="linenos">1617</span></a> <span class="k">if</span> <span class="n">chain</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1618"><a href="#L-1618"><span class="linenos">1618</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="s2">" AND CHAIN"</span> <span class="k">if</span> <span class="n">chain</span> <span class="k">else</span> <span class="s2">" AND NO CHAIN"</span> +</span><span id="L-1619"><a href="#L-1619"><span class="linenos">1619</span></a> +</span><span id="L-1620"><a href="#L-1620"><span class="linenos">1620</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COMMIT</span><span class="si">{</span><span class="n">chain</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1621"><a href="#L-1621"><span class="linenos">1621</span></a> +</span><span id="L-1622"><a href="#L-1622"><span class="linenos">1622</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Rollback</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1623"><a href="#L-1623"><span class="linenos">1623</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"savepoint"</span><span class="p">)</span> +</span><span id="L-1624"><a href="#L-1624"><span class="linenos">1624</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" TO </span><span class="si">{</span><span class="n">savepoint</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">savepoint</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1625"><a href="#L-1625"><span class="linenos">1625</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ROLLBACK</span><span class="si">{</span><span class="n">savepoint</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1626"><a href="#L-1626"><span class="linenos">1626</span></a> +</span><span id="L-1627"><a href="#L-1627"><span class="linenos">1627</span></a> <span class="k">def</span> <span class="nf">altercolumn_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1628"><a href="#L-1628"><span class="linenos">1628</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1629"><a href="#L-1629"><span class="linenos">1629</span></a> +</span><span id="L-1630"><a href="#L-1630"><span class="linenos">1630</span></a> <span class="n">dtype</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"dtype"</span><span class="p">)</span> +</span><span id="L-1631"><a href="#L-1631"><span class="linenos">1631</span></a> <span class="k">if</span> <span class="n">dtype</span><span class="p">:</span> +</span><span id="L-1632"><a href="#L-1632"><span class="linenos">1632</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="L-1633"><a href="#L-1633"><span class="linenos">1633</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1634"><a href="#L-1634"><span class="linenos">1634</span></a> <span class="n">using</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">)</span> +</span><span id="L-1635"><a href="#L-1635"><span class="linenos">1635</span></a> <span class="n">using</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" USING </span><span class="si">{</span><span class="n">using</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">using</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1636"><a href="#L-1636"><span class="linenos">1636</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TYPE </span><span class="si">{</span><span class="n">dtype</span><span class="si">}{</span><span class="n">collate</span><span class="si">}{</span><span class="n">using</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1637"><a href="#L-1637"><span class="linenos">1637</span></a> +</span><span id="L-1638"><a href="#L-1638"><span class="linenos">1638</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> +</span><span id="L-1639"><a href="#L-1639"><span class="linenos">1639</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="L-1640"><a href="#L-1640"><span class="linenos">1640</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> SET DEFAULT </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1641"><a href="#L-1641"><span class="linenos">1641</span></a> +</span><span id="L-1642"><a href="#L-1642"><span class="linenos">1642</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"drop"</span><span class="p">):</span> +</span><span id="L-1643"><a href="#L-1643"><span class="linenos">1643</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Unsupported ALTER COLUMN syntax"</span><span class="p">)</span> +</span><span id="L-1644"><a href="#L-1644"><span class="linenos">1644</span></a> +</span><span id="L-1645"><a href="#L-1645"><span class="linenos">1645</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> DROP DEFAULT"</span> +</span><span id="L-1646"><a href="#L-1646"><span class="linenos">1646</span></a> +</span><span id="L-1647"><a href="#L-1647"><span class="linenos">1647</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1648"><a href="#L-1648"><span class="linenos">1648</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1649"><a href="#L-1649"><span class="linenos">1649</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1650"><a href="#L-1650"><span class="linenos">1650</span></a> +</span><span id="L-1651"><a href="#L-1651"><span class="linenos">1651</span></a> <span class="k">def</span> <span class="nf">altertable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AlterTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1652"><a href="#L-1652"><span class="linenos">1652</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"actions"</span><span class="p">]</span> +</span><span id="L-1653"><a href="#L-1653"><span class="linenos">1653</span></a> +</span><span id="L-1654"><a href="#L-1654"><span class="linenos">1654</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">):</span> +</span><span id="L-1655"><a href="#L-1655"><span class="linenos">1655</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ADD COLUMN "</span><span class="p">)</span> +</span><span id="L-1656"><a href="#L-1656"><span class="linenos">1656</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="L-1657"><a href="#L-1657"><span class="linenos">1657</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ADD COLUMNS "</span><span class="p">)</span> +</span><span id="L-1658"><a href="#L-1658"><span class="linenos">1658</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">):</span> +</span><span id="L-1659"><a href="#L-1659"><span class="linenos">1659</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1660"><a href="#L-1660"><span class="linenos">1660</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1661"><a href="#L-1661"><span class="linenos">1661</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">)</span> +</span><span id="L-1662"><a href="#L-1662"><span class="linenos">1662</span></a> +</span><span id="L-1663"><a href="#L-1663"><span class="linenos">1663</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1664"><a href="#L-1664"><span class="linenos">1664</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER TABLE</span><span class="si">{</span><span class="n">exists</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">actions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1665"><a href="#L-1665"><span class="linenos">1665</span></a> +</span><span id="L-1666"><a href="#L-1666"><span class="linenos">1666</span></a> <span class="k">def</span> <span class="nf">droppartition_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DropPartition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1667"><a href="#L-1667"><span class="linenos">1667</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-1668"><a href="#L-1668"><span class="linenos">1668</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="L-1669"><a href="#L-1669"><span class="linenos">1669</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DROP</span><span class="si">{</span><span class="n">exists</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1670"><a href="#L-1670"><span class="linenos">1670</span></a> +</span><span id="L-1671"><a href="#L-1671"><span class="linenos">1671</span></a> <span class="k">def</span> <span class="nf">addconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1672"><a href="#L-1672"><span class="linenos">1672</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1673"><a href="#L-1673"><span class="linenos">1673</span></a> <span class="n">expression_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="L-1674"><a href="#L-1674"><span class="linenos">1674</span></a> <span class="n">add_constraint</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"ADD CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">"ADD"</span> +</span><span id="L-1675"><a href="#L-1675"><span class="linenos">1675</span></a> +</span><span id="L-1676"><a href="#L-1676"><span class="linenos">1676</span></a> <span class="n">enforced</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"enforced"</span><span class="p">)</span> +</span><span id="L-1677"><a href="#L-1677"><span class="linenos">1677</span></a> <span class="k">if</span> <span class="n">enforced</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1678"><a href="#L-1678"><span class="linenos">1678</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">add_constraint</span><span class="si">}</span><span class="s2"> CHECK (</span><span class="si">{</span><span class="n">expression_</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="s1">' ENFORCED'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">enforced</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1679"><a href="#L-1679"><span class="linenos">1679</span></a> +</span><span id="L-1680"><a href="#L-1680"><span class="linenos">1680</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">add_constraint</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expression_</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1681"><a href="#L-1681"><span class="linenos">1681</span></a> +</span><span id="L-1682"><a href="#L-1682"><span class="linenos">1682</span></a> <span class="k">def</span> <span class="nf">distinct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1683"><a href="#L-1683"><span class="linenos">1683</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1684"><a href="#L-1684"><span class="linenos">1684</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1685"><a href="#L-1685"><span class="linenos">1685</span></a> +</span><span id="L-1686"><a href="#L-1686"><span class="linenos">1686</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">)</span> +</span><span id="L-1687"><a href="#L-1687"><span class="linenos">1687</span></a> <span class="n">on</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">on</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1688"><a href="#L-1688"><span class="linenos">1688</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DISTINCT</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">on</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1689"><a href="#L-1689"><span class="linenos">1689</span></a> +</span><span id="L-1690"><a href="#L-1690"><span class="linenos">1690</span></a> <span class="k">def</span> <span class="nf">ignorenulls_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1691"><a href="#L-1691"><span class="linenos">1691</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> IGNORE NULLS"</span> +</span><span id="L-1692"><a href="#L-1692"><span class="linenos">1692</span></a> +</span><span id="L-1693"><a href="#L-1693"><span class="linenos">1693</span></a> <span class="k">def</span> <span class="nf">respectnulls_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RespectNulls</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1694"><a href="#L-1694"><span class="linenos">1694</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> RESPECT NULLS"</span> +</span><span id="L-1695"><a href="#L-1695"><span class="linenos">1695</span></a> +</span><span id="L-1696"><a href="#L-1696"><span class="linenos">1696</span></a> <span class="k">def</span> <span class="nf">intdiv_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1697"><a href="#L-1697"><span class="linenos">1697</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span> +</span><span id="L-1698"><a href="#L-1698"><span class="linenos">1698</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="L-1699"><a href="#L-1699"><span class="linenos">1699</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">),</span> +</span><span id="L-1700"><a href="#L-1700"><span class="linenos">1700</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-1701"><a href="#L-1701"><span class="linenos">1701</span></a> <span class="p">)</span> +</span><span id="L-1702"><a href="#L-1702"><span class="linenos">1702</span></a> <span class="p">)</span> +</span><span id="L-1703"><a href="#L-1703"><span class="linenos">1703</span></a> +</span><span id="L-1704"><a href="#L-1704"><span class="linenos">1704</span></a> <span class="k">def</span> <span class="nf">dpipe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DPipe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1705"><a href="#L-1705"><span class="linenos">1705</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"||"</span><span class="p">)</span> +</span><span id="L-1706"><a href="#L-1706"><span class="linenos">1706</span></a> +</span><span id="L-1707"><a href="#L-1707"><span class="linenos">1707</span></a> <span class="k">def</span> <span class="nf">div_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1708"><a href="#L-1708"><span class="linenos">1708</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"/"</span><span class="p">)</span> +</span><span id="L-1709"><a href="#L-1709"><span class="linenos">1709</span></a> +</span><span id="L-1710"><a href="#L-1710"><span class="linenos">1710</span></a> <span class="k">def</span> <span class="nf">distance_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distance</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1711"><a href="#L-1711"><span class="linenos">1711</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<->"</span><span class="p">)</span> +</span><span id="L-1712"><a href="#L-1712"><span class="linenos">1712</span></a> +</span><span id="L-1713"><a href="#L-1713"><span class="linenos">1713</span></a> <span class="k">def</span> <span class="nf">dot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1714"><a href="#L-1714"><span class="linenos">1714</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1715"><a href="#L-1715"><span class="linenos">1715</span></a> +</span><span id="L-1716"><a href="#L-1716"><span class="linenos">1716</span></a> <span class="k">def</span> <span class="nf">eq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1717"><a href="#L-1717"><span class="linenos">1717</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"="</span><span class="p">)</span> +</span><span id="L-1718"><a href="#L-1718"><span class="linenos">1718</span></a> +</span><span id="L-1719"><a href="#L-1719"><span class="linenos">1719</span></a> <span class="k">def</span> <span class="nf">escape_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Escape</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1720"><a href="#L-1720"><span class="linenos">1720</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"ESCAPE"</span><span class="p">)</span> +</span><span id="L-1721"><a href="#L-1721"><span class="linenos">1721</span></a> +</span><span id="L-1722"><a href="#L-1722"><span class="linenos">1722</span></a> <span class="k">def</span> <span class="nf">glob_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Glob</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1723"><a href="#L-1723"><span class="linenos">1723</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"GLOB"</span><span class="p">)</span> +</span><span id="L-1724"><a href="#L-1724"><span class="linenos">1724</span></a> +</span><span id="L-1725"><a href="#L-1725"><span class="linenos">1725</span></a> <span class="k">def</span> <span class="nf">gt_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1726"><a href="#L-1726"><span class="linenos">1726</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">"</span><span class="p">)</span> +</span><span id="L-1727"><a href="#L-1727"><span class="linenos">1727</span></a> +</span><span id="L-1728"><a href="#L-1728"><span class="linenos">1728</span></a> <span class="k">def</span> <span class="nf">gte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1729"><a href="#L-1729"><span class="linenos">1729</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">="</span><span class="p">)</span> +</span><span id="L-1730"><a href="#L-1730"><span class="linenos">1730</span></a> +</span><span id="L-1731"><a href="#L-1731"><span class="linenos">1731</span></a> <span class="k">def</span> <span class="nf">ilike_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1732"><a href="#L-1732"><span class="linenos">1732</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"ILIKE"</span><span class="p">)</span> +</span><span id="L-1733"><a href="#L-1733"><span class="linenos">1733</span></a> +</span><span id="L-1734"><a href="#L-1734"><span class="linenos">1734</span></a> <span class="k">def</span> <span class="nf">is_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1735"><a href="#L-1735"><span class="linenos">1735</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS"</span><span class="p">)</span> +</span><span id="L-1736"><a href="#L-1736"><span class="linenos">1736</span></a> +</span><span id="L-1737"><a href="#L-1737"><span class="linenos">1737</span></a> <span class="k">def</span> <span class="nf">like_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1738"><a href="#L-1738"><span class="linenos">1738</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"LIKE"</span><span class="p">)</span> +</span><span id="L-1739"><a href="#L-1739"><span class="linenos">1739</span></a> +</span><span id="L-1740"><a href="#L-1740"><span class="linenos">1740</span></a> <span class="k">def</span> <span class="nf">similarto_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SimilarTo</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1741"><a href="#L-1741"><span class="linenos">1741</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"SIMILAR TO"</span><span class="p">)</span> +</span><span id="L-1742"><a href="#L-1742"><span class="linenos">1742</span></a> +</span><span id="L-1743"><a href="#L-1743"><span class="linenos">1743</span></a> <span class="k">def</span> <span class="nf">lt_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1744"><a href="#L-1744"><span class="linenos">1744</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<"</span><span class="p">)</span> +</span><span id="L-1745"><a href="#L-1745"><span class="linenos">1745</span></a> +</span><span id="L-1746"><a href="#L-1746"><span class="linenos">1746</span></a> <span class="k">def</span> <span class="nf">lte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1747"><a href="#L-1747"><span class="linenos">1747</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<="</span><span class="p">)</span> +</span><span id="L-1748"><a href="#L-1748"><span class="linenos">1748</span></a> +</span><span id="L-1749"><a href="#L-1749"><span class="linenos">1749</span></a> <span class="k">def</span> <span class="nf">mod_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1750"><a href="#L-1750"><span class="linenos">1750</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"%"</span><span class="p">)</span> +</span><span id="L-1751"><a href="#L-1751"><span class="linenos">1751</span></a> +</span><span id="L-1752"><a href="#L-1752"><span class="linenos">1752</span></a> <span class="k">def</span> <span class="nf">mul_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1753"><a href="#L-1753"><span class="linenos">1753</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">)</span> +</span><span id="L-1754"><a href="#L-1754"><span class="linenos">1754</span></a> +</span><span id="L-1755"><a href="#L-1755"><span class="linenos">1755</span></a> <span class="k">def</span> <span class="nf">neq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1756"><a href="#L-1756"><span class="linenos">1756</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<>"</span><span class="p">)</span> +</span><span id="L-1757"><a href="#L-1757"><span class="linenos">1757</span></a> +</span><span id="L-1758"><a href="#L-1758"><span class="linenos">1758</span></a> <span class="k">def</span> <span class="nf">nullsafeeq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1759"><a href="#L-1759"><span class="linenos">1759</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS NOT DISTINCT FROM"</span><span class="p">)</span> +</span><span id="L-1760"><a href="#L-1760"><span class="linenos">1760</span></a> +</span><span id="L-1761"><a href="#L-1761"><span class="linenos">1761</span></a> <span class="k">def</span> <span class="nf">nullsafeneq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1762"><a href="#L-1762"><span class="linenos">1762</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS DISTINCT FROM"</span><span class="p">)</span> +</span><span id="L-1763"><a href="#L-1763"><span class="linenos">1763</span></a> +</span><span id="L-1764"><a href="#L-1764"><span class="linenos">1764</span></a> <span class="k">def</span> <span class="nf">or_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1765"><a href="#L-1765"><span class="linenos">1765</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">connector_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"OR"</span><span class="p">)</span> +</span><span id="L-1766"><a href="#L-1766"><span class="linenos">1766</span></a> +</span><span id="L-1767"><a href="#L-1767"><span class="linenos">1767</span></a> <span class="k">def</span> <span class="nf">slice_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1768"><a href="#L-1768"><span class="linenos">1768</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">":"</span><span class="p">)</span> +</span><span id="L-1769"><a href="#L-1769"><span class="linenos">1769</span></a> +</span><span id="L-1770"><a href="#L-1770"><span class="linenos">1770</span></a> <span class="k">def</span> <span class="nf">sub_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1771"><a href="#L-1771"><span class="linenos">1771</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span><span id="L-1772"><a href="#L-1772"><span class="linenos">1772</span></a> +</span><span id="L-1773"><a href="#L-1773"><span class="linenos">1773</span></a> <span class="k">def</span> <span class="nf">trycast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1774"><a href="#L-1774"><span class="linenos">1774</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TRY_CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1775"><a href="#L-1775"><span class="linenos">1775</span></a> +</span><span id="L-1776"><a href="#L-1776"><span class="linenos">1776</span></a> <span class="k">def</span> <span class="nf">use_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Use</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1777"><a href="#L-1777"><span class="linenos">1777</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-1778"><a href="#L-1778"><span class="linenos">1778</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1779"><a href="#L-1779"><span class="linenos">1779</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1780"><a href="#L-1780"><span class="linenos">1780</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1781"><a href="#L-1781"><span class="linenos">1781</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"USE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1782"><a href="#L-1782"><span class="linenos">1782</span></a> +</span><span id="L-1783"><a href="#L-1783"><span class="linenos">1783</span></a> <span class="k">def</span> <span class="nf">binary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1784"><a href="#L-1784"><span class="linenos">1784</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">op</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1785"><a href="#L-1785"><span class="linenos">1785</span></a> +</span><span id="L-1786"><a href="#L-1786"><span class="linenos">1786</span></a> <span class="k">def</span> <span class="nf">function_fallback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1787"><a href="#L-1787"><span class="linenos">1787</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1788"><a href="#L-1788"><span class="linenos">1788</span></a> <span class="k">for</span> <span class="n">arg_value</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-1789"><a href="#L-1789"><span class="linenos">1789</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg_value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-1790"><a href="#L-1790"><span class="linenos">1790</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">arg_value</span><span class="p">:</span> +</span><span id="L-1791"><a href="#L-1791"><span class="linenos">1791</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-1792"><a href="#L-1792"><span class="linenos">1792</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1793"><a href="#L-1793"><span class="linenos">1793</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arg_value</span><span class="p">)</span> +</span><span id="L-1794"><a href="#L-1794"><span class="linenos">1794</span></a> +</span><span id="L-1795"><a href="#L-1795"><span class="linenos">1795</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">sql_name</span><span class="p">())</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1796"><a href="#L-1796"><span class="linenos">1796</span></a> +</span><span id="L-1797"><a href="#L-1797"><span class="linenos">1797</span></a> <span class="k">def</span> <span class="nf">format_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1798"><a href="#L-1798"><span class="linenos">1798</span></a> <span class="n">arg_sqls</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="n">arg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-1799"><a href="#L-1799"><span class="linenos">1799</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span><span class="p">:</span> +</span><span id="L-1800"><a href="#L-1800"><span class="linenos">1800</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="sa">f</span><span class="s2">",</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">skip_last</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1801"><a href="#L-1801"><span class="linenos">1801</span></a> <span class="k">return</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> +</span><span id="L-1802"><a href="#L-1802"><span class="linenos">1802</span></a> +</span><span id="L-1803"><a href="#L-1803"><span class="linenos">1803</span></a> <span class="k">def</span> <span class="nf">text_width</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-1804"><a href="#L-1804"><span class="linenos">1804</span></a> <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-1805"><a href="#L-1805"><span class="linenos">1805</span></a> +</span><span id="L-1806"><a href="#L-1806"><span class="linenos">1806</span></a> <span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-1807"><a href="#L-1807"><span class="linenos">1807</span></a> <span class="k">return</span> <span class="n">format_time</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_trie</span><span class="p">)</span> +</span><span id="L-1808"><a href="#L-1808"><span class="linenos">1808</span></a> +</span><span id="L-1809"><a href="#L-1809"><span class="linenos">1809</span></a> <span class="k">def</span> <span class="nf">expressions</span><span class="p">(</span> +</span><span id="L-1810"><a href="#L-1810"><span class="linenos">1810</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-1811"><a href="#L-1811"><span class="linenos">1811</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> +</span><span id="L-1812"><a href="#L-1812"><span class="linenos">1812</span></a> <span class="n">key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-1813"><a href="#L-1813"><span class="linenos">1813</span></a> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-1814"><a href="#L-1814"><span class="linenos">1814</span></a> <span class="n">indent</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-1815"><a href="#L-1815"><span class="linenos">1815</span></a> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">,</span> +</span><span id="L-1816"><a href="#L-1816"><span class="linenos">1816</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="L-1817"><a href="#L-1817"><span class="linenos">1817</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1818"><a href="#L-1818"><span class="linenos">1818</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span> <span class="ow">or</span> <span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="L-1819"><a href="#L-1819"><span class="linenos">1819</span></a> +</span><span id="L-1820"><a href="#L-1820"><span class="linenos">1820</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-1821"><a href="#L-1821"><span class="linenos">1821</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-1822"><a href="#L-1822"><span class="linenos">1822</span></a> +</span><span id="L-1823"><a href="#L-1823"><span class="linenos">1823</span></a> <span class="k">if</span> <span class="n">flat</span><span class="p">:</span> +</span><span id="L-1824"><a href="#L-1824"><span class="linenos">1824</span></a> <span class="k">return</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="L-1825"><a href="#L-1825"><span class="linenos">1825</span></a> +</span><span id="L-1826"><a href="#L-1826"><span class="linenos">1826</span></a> <span class="n">num_sqls</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-1827"><a href="#L-1827"><span class="linenos">1827</span></a> +</span><span id="L-1828"><a href="#L-1828"><span class="linenos">1828</span></a> <span class="c1"># These are calculated once in case we have the leading_comma / pretty option set, correspondingly</span> +</span><span id="L-1829"><a href="#L-1829"><span class="linenos">1829</span></a> <span class="n">pad</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> +</span><span id="L-1830"><a href="#L-1830"><span class="linenos">1830</span></a> <span class="n">stripped_sep</span> <span class="o">=</span> <span class="n">sep</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="L-1831"><a href="#L-1831"><span class="linenos">1831</span></a> +</span><span id="L-1832"><a href="#L-1832"><span class="linenos">1832</span></a> <span class="n">result_sqls</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1833"><a href="#L-1833"><span class="linenos">1833</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="L-1834"><a href="#L-1834"><span class="linenos">1834</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1835"><a href="#L-1835"><span class="linenos">1835</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">maybe_comment</span><span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-1836"><a href="#L-1836"><span class="linenos">1836</span></a> +</span><span id="L-1837"><a href="#L-1837"><span class="linenos">1837</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="L-1838"><a href="#L-1838"><span class="linenos">1838</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_leading_comma</span><span class="p">:</span> +</span><span id="L-1839"><a href="#L-1839"><span class="linenos">1839</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="n">pad</span><span class="si">}{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">comments</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1840"><a href="#L-1840"><span class="linenos">1840</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1841"><a href="#L-1841"><span class="linenos">1841</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-1842"><a href="#L-1842"><span class="linenos">1842</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">stripped_sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">num_sqls</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">comments</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1843"><a href="#L-1843"><span class="linenos">1843</span></a> <span class="p">)</span> +</span><span id="L-1844"><a href="#L-1844"><span class="linenos">1844</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1845"><a href="#L-1845"><span class="linenos">1845</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">comments</span><span class="si">}{</span><span class="n">sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">num_sqls</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1846"><a href="#L-1846"><span class="linenos">1846</span></a> +</span><span id="L-1847"><a href="#L-1847"><span class="linenos">1847</span></a> <span class="n">result_sql</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result_sqls</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result_sqls</span><span class="p">)</span> +</span><span id="L-1848"><a href="#L-1848"><span class="linenos">1848</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="n">result_sql</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="k">if</span> <span class="n">indent</span> <span class="k">else</span> <span class="n">result_sql</span> +</span><span id="L-1849"><a href="#L-1849"><span class="linenos">1849</span></a> +</span><span id="L-1850"><a href="#L-1850"><span class="linenos">1850</span></a> <span class="k">def</span> <span class="nf">op_expressions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1851"><a href="#L-1851"><span class="linenos">1851</span></a> <span class="n">expressions_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="n">flat</span><span class="p">)</span> +</span><span id="L-1852"><a href="#L-1852"><span class="linenos">1852</span></a> <span class="k">if</span> <span class="n">flat</span><span class="p">:</span> +</span><span id="L-1853"><a href="#L-1853"><span class="linenos">1853</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">op</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1854"><a href="#L-1854"><span class="linenos">1854</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">op</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expressions_sql</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1855"><a href="#L-1855"><span class="linenos">1855</span></a> +</span><span id="L-1856"><a href="#L-1856"><span class="linenos">1856</span></a> <span class="k">def</span> <span class="nf">naked_property</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1857"><a href="#L-1857"><span class="linenos">1857</span></a> <span class="n">property_name</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">PROPERTY_TO_NAME</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="L-1858"><a href="#L-1858"><span class="linenos">1858</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">property_name</span><span class="p">:</span> +</span><span id="L-1859"><a href="#L-1859"><span class="linenos">1859</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1860"><a href="#L-1860"><span class="linenos">1860</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">property_name</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1861"><a href="#L-1861"><span class="linenos">1861</span></a> +</span><span id="L-1862"><a href="#L-1862"><span class="linenos">1862</span></a> <span class="k">def</span> <span class="nf">set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1863"><a href="#L-1863"><span class="linenos">1863</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1864"><a href="#L-1864"><span class="linenos">1864</span></a> <span class="n">op</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">op</span><span class="p">)</span> +</span><span id="L-1865"><a href="#L-1865"><span class="linenos">1865</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="L-1866"><a href="#L-1866"><span class="linenos">1866</span></a> <span class="n">expression</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">op</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1867"><a href="#L-1867"><span class="linenos">1867</span></a> <span class="p">)</span> +</span><span id="L-1868"><a href="#L-1868"><span class="linenos">1868</span></a> +</span><span id="L-1869"><a href="#L-1869"><span class="linenos">1869</span></a> <span class="k">def</span> <span class="nf">tag_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tag</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1870"><a href="#L-1870"><span class="linenos">1870</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'prefix'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}{</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'postfix'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1871"><a href="#L-1871"><span class="linenos">1871</span></a> +</span><span id="L-1872"><a href="#L-1872"><span class="linenos">1872</span></a> <span class="k">def</span> <span class="nf">token_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1873"><a href="#L-1873"><span class="linenos">1873</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">TOKEN_MAPPING</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">token_type</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-1874"><a href="#L-1874"><span class="linenos">1874</span></a> +</span><span id="L-1875"><a href="#L-1875"><span class="linenos">1875</span></a> <span class="k">def</span> <span class="nf">userdefinedfunction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1876"><a href="#L-1876"><span class="linenos">1876</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1877"><a href="#L-1877"><span class="linenos">1877</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-1878"><a href="#L-1878"><span class="linenos">1878</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1879"><a href="#L-1879"><span class="linenos">1879</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"wrapped"</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1880"><a href="#L-1880"><span class="linenos">1880</span></a> <span class="p">)</span> +</span><span id="L-1881"><a href="#L-1881"><span class="linenos">1881</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1882"><a href="#L-1882"><span class="linenos">1882</span></a> +</span><span id="L-1883"><a href="#L-1883"><span class="linenos">1883</span></a> <span class="k">def</span> <span class="nf">userdefinedfunctionkwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunctionKwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1884"><a href="#L-1884"><span class="linenos">1884</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1885"><a href="#L-1885"><span class="linenos">1885</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="L-1886"><a href="#L-1886"><span class="linenos">1886</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1887"><a href="#L-1887"><span class="linenos">1887</span></a> +</span><span id="L-1888"><a href="#L-1888"><span class="linenos">1888</span></a> <span class="k">def</span> <span class="nf">joinhint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1889"><a href="#L-1889"><span class="linenos">1889</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1890"><a href="#L-1890"><span class="linenos">1890</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1891"><a href="#L-1891"><span class="linenos">1891</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-1892"><a href="#L-1892"><span class="linenos">1892</span></a> +</span><span id="L-1893"><a href="#L-1893"><span class="linenos">1893</span></a> <span class="k">def</span> <span class="nf">kwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Kwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1894"><a href="#L-1894"><span class="linenos">1894</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"=>"</span><span class="p">)</span> +</span><span id="L-1895"><a href="#L-1895"><span class="linenos">1895</span></a> +</span><span id="L-1896"><a href="#L-1896"><span class="linenos">1896</span></a> <span class="k">def</span> <span class="nf">when_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">When</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1897"><a href="#L-1897"><span class="linenos">1897</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1898"><a href="#L-1898"><span class="linenos">1898</span></a> <span class="n">then_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"then"</span><span class="p">)</span> +</span><span id="L-1899"><a href="#L-1899"><span class="linenos">1899</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">):</span> +</span><span id="L-1900"><a href="#L-1900"><span class="linenos">1900</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INSERT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1901"><a href="#L-1901"><span class="linenos">1901</span></a> <span class="k">if</span> <span class="s2">"expression"</span> <span class="ow">in</span> <span class="n">then_expression</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="L-1902"><a href="#L-1902"><span class="linenos">1902</span></a> <span class="n">then</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" VALUES </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1903"><a href="#L-1903"><span class="linenos">1903</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">):</span> +</span><span id="L-1904"><a href="#L-1904"><span class="linenos">1904</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="L-1905"><a href="#L-1905"><span class="linenos">1905</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1906"><a href="#L-1906"><span class="linenos">1906</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1907"><a href="#L-1907"><span class="linenos">1907</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1908"><a href="#L-1908"><span class="linenos">1908</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1909"><a href="#L-1909"><span class="linenos">1909</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">)</span> +</span><span id="L-1910"><a href="#L-1910"><span class="linenos">1910</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WHEN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">then</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1911"><a href="#L-1911"><span class="linenos">1911</span></a> +</span><span id="L-1912"><a href="#L-1912"><span class="linenos">1912</span></a> <span class="k">def</span> <span class="nf">merge_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Merge</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1913"><a href="#L-1913"><span class="linenos">1913</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-1914"><a href="#L-1914"><span class="linenos">1914</span></a> <span class="n">using</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'using'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1915"><a href="#L-1915"><span class="linenos">1915</span></a> <span class="n">on</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"ON </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'on'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1916"><a href="#L-1916"><span class="linenos">1916</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MERGE INTO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">using</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">' '</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + </section> + <section id="Generator"> + <input id="Generator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Generator</span>: + + <label class="view-source-button" for="Generator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator-19"><a href="#Generator-19"><span class="linenos"> 19</span></a><span class="k">class</span> <span class="nc">Generator</span><span class="p">:</span> +</span><span id="Generator-20"><a href="#Generator-20"><span class="linenos"> 20</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Generator-21"><a href="#Generator-21"><span class="linenos"> 21</span></a><span class="sd"> Generator interprets the given syntax tree and produces a SQL string as an output.</span> +</span><span id="Generator-22"><a href="#Generator-22"><span class="linenos"> 22</span></a> +</span><span id="Generator-23"><a href="#Generator-23"><span class="linenos"> 23</span></a><span class="sd"> Args:</span> +</span><span id="Generator-24"><a href="#Generator-24"><span class="linenos"> 24</span></a><span class="sd"> time_mapping (dict): the dictionary of custom time mappings in which the key</span> +</span><span id="Generator-25"><a href="#Generator-25"><span class="linenos"> 25</span></a><span class="sd"> represents a python time format and the output the target time format</span> +</span><span id="Generator-26"><a href="#Generator-26"><span class="linenos"> 26</span></a><span class="sd"> time_trie (trie): a trie of the time_mapping keys</span> +</span><span id="Generator-27"><a href="#Generator-27"><span class="linenos"> 27</span></a><span class="sd"> pretty (bool): if set to True the returned string will be formatted. Default: False.</span> +</span><span id="Generator-28"><a href="#Generator-28"><span class="linenos"> 28</span></a><span class="sd"> quote_start (str): specifies which starting character to use to delimit quotes. Default: '.</span> +</span><span id="Generator-29"><a href="#Generator-29"><span class="linenos"> 29</span></a><span class="sd"> quote_end (str): specifies which ending character to use to delimit quotes. Default: '.</span> +</span><span id="Generator-30"><a href="#Generator-30"><span class="linenos"> 30</span></a><span class="sd"> identifier_start (str): specifies which starting character to use to delimit identifiers. Default: ".</span> +</span><span id="Generator-31"><a href="#Generator-31"><span class="linenos"> 31</span></a><span class="sd"> identifier_end (str): specifies which ending character to use to delimit identifiers. Default: ".</span> +</span><span id="Generator-32"><a href="#Generator-32"><span class="linenos"> 32</span></a><span class="sd"> identify (bool): if set to True all identifiers will be delimited by the corresponding</span> +</span><span id="Generator-33"><a href="#Generator-33"><span class="linenos"> 33</span></a><span class="sd"> character.</span> +</span><span id="Generator-34"><a href="#Generator-34"><span class="linenos"> 34</span></a><span class="sd"> normalize (bool): if set to True all identifiers will lower cased</span> +</span><span id="Generator-35"><a href="#Generator-35"><span class="linenos"> 35</span></a><span class="sd"> string_escape (str): specifies a string escape character. Default: '.</span> +</span><span id="Generator-36"><a href="#Generator-36"><span class="linenos"> 36</span></a><span class="sd"> identifier_escape (str): specifies an identifier escape character. Default: ".</span> +</span><span id="Generator-37"><a href="#Generator-37"><span class="linenos"> 37</span></a><span class="sd"> pad (int): determines padding in a formatted string. Default: 2.</span> +</span><span id="Generator-38"><a href="#Generator-38"><span class="linenos"> 38</span></a><span class="sd"> indent (int): determines the size of indentation in a formatted string. Default: 4.</span> +</span><span id="Generator-39"><a href="#Generator-39"><span class="linenos"> 39</span></a><span class="sd"> unnest_column_only (bool): if true unnest table aliases are considered only as column aliases</span> +</span><span id="Generator-40"><a href="#Generator-40"><span class="linenos"> 40</span></a><span class="sd"> normalize_functions (str): normalize function names, "upper", "lower", or None</span> +</span><span id="Generator-41"><a href="#Generator-41"><span class="linenos"> 41</span></a><span class="sd"> Default: "upper"</span> +</span><span id="Generator-42"><a href="#Generator-42"><span class="linenos"> 42</span></a><span class="sd"> alias_post_tablesample (bool): if the table alias comes after tablesample</span> +</span><span id="Generator-43"><a href="#Generator-43"><span class="linenos"> 43</span></a><span class="sd"> Default: False</span> +</span><span id="Generator-44"><a href="#Generator-44"><span class="linenos"> 44</span></a><span class="sd"> unsupported_level (ErrorLevel): determines the generator's behavior when it encounters</span> +</span><span id="Generator-45"><a href="#Generator-45"><span class="linenos"> 45</span></a><span class="sd"> unsupported expressions. Default ErrorLevel.WARN.</span> +</span><span id="Generator-46"><a href="#Generator-46"><span class="linenos"> 46</span></a><span class="sd"> null_ordering (str): Indicates the default null ordering method to use if not explicitly set.</span> +</span><span id="Generator-47"><a href="#Generator-47"><span class="linenos"> 47</span></a><span class="sd"> Options are "nulls_are_small", "nulls_are_large", "nulls_are_last".</span> +</span><span id="Generator-48"><a href="#Generator-48"><span class="linenos"> 48</span></a><span class="sd"> Default: "nulls_are_small"</span> +</span><span id="Generator-49"><a href="#Generator-49"><span class="linenos"> 49</span></a><span class="sd"> max_unsupported (int): Maximum number of unsupported messages to include in a raised UnsupportedError.</span> +</span><span id="Generator-50"><a href="#Generator-50"><span class="linenos"> 50</span></a><span class="sd"> This is only relevant if unsupported_level is ErrorLevel.RAISE.</span> +</span><span id="Generator-51"><a href="#Generator-51"><span class="linenos"> 51</span></a><span class="sd"> Default: 3</span> +</span><span id="Generator-52"><a href="#Generator-52"><span class="linenos"> 52</span></a><span class="sd"> leading_comma (bool): if the the comma is leading or trailing in select statements</span> +</span><span id="Generator-53"><a href="#Generator-53"><span class="linenos"> 53</span></a><span class="sd"> Default: False</span> +</span><span id="Generator-54"><a href="#Generator-54"><span class="linenos"> 54</span></a><span class="sd"> max_text_width: The max number of characters in a segment before creating new lines in pretty mode.</span> +</span><span id="Generator-55"><a href="#Generator-55"><span class="linenos"> 55</span></a><span class="sd"> The default is on the smaller end because the length only represents a segment and not the true</span> +</span><span id="Generator-56"><a href="#Generator-56"><span class="linenos"> 56</span></a><span class="sd"> line length.</span> +</span><span id="Generator-57"><a href="#Generator-57"><span class="linenos"> 57</span></a><span class="sd"> Default: 80</span> +</span><span id="Generator-58"><a href="#Generator-58"><span class="linenos"> 58</span></a><span class="sd"> comments: Whether or not to preserve comments in the output SQL code.</span> +</span><span id="Generator-59"><a href="#Generator-59"><span class="linenos"> 59</span></a><span class="sd"> Default: True</span> +</span><span id="Generator-60"><a href="#Generator-60"><span class="linenos"> 60</span></a><span class="sd"> """</span> +</span><span id="Generator-61"><a href="#Generator-61"><span class="linenos"> 61</span></a> +</span><span id="Generator-62"><a href="#Generator-62"><span class="linenos"> 62</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Generator-63"><a href="#Generator-63"><span class="linenos"> 63</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATE_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Generator-64"><a href="#Generator-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"DATEDIFF(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Generator-65"><a href="#Generator-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"TS_OR_DS_ADD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'unit'</span><span class="p">))</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Generator-66"><a href="#Generator-66"><span class="linenos"> 66</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"MAP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'keys'</span><span class="p">],</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'values'</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Generator-67"><a href="#Generator-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'DEFAULT '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'default'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">CHARACTER SET=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Generator-68"><a href="#Generator-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LanguageProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Generator-69"><a href="#Generator-69"><span class="linenos"> 69</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Generator-70"><a href="#Generator-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Generator-71"><a href="#Generator-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExecuteAsProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Generator-72"><a href="#Generator-72"><span class="linenos"> 72</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="Generator-73"><a href="#Generator-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithJournalTableProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"WITH JOURNAL TABLE=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Generator-74"><a href="#Generator-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'NO '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'no'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">LOG"</span><span class="p">,</span> +</span><span id="Generator-75"><a href="#Generator-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SqlSecurityProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"SQL SECURITY </span><span class="si">{</span><span class="s1">'DEFINER'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'definer'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'INVOKER'</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Generator-76"><a href="#Generator-76"><span class="linenos"> 76</span></a> <span class="p">}</span> +</span><span id="Generator-77"><a href="#Generator-77"><span class="linenos"> 77</span></a> +</span><span id="Generator-78"><a href="#Generator-78"><span class="linenos"> 78</span></a> <span class="c1"># Whether 'CREATE ... TRANSIENT ... TABLE' is allowed</span> +</span><span id="Generator-79"><a href="#Generator-79"><span class="linenos"> 79</span></a> <span class="n">CREATE_TRANSIENT</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Generator-80"><a href="#Generator-80"><span class="linenos"> 80</span></a> +</span><span id="Generator-81"><a href="#Generator-81"><span class="linenos"> 81</span></a> <span class="c1"># Whether or not null ordering is supported in order by</span> +</span><span id="Generator-82"><a href="#Generator-82"><span class="linenos"> 82</span></a> <span class="n">NULL_ORDERING_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Generator-83"><a href="#Generator-83"><span class="linenos"> 83</span></a> +</span><span id="Generator-84"><a href="#Generator-84"><span class="linenos"> 84</span></a> <span class="c1"># Whether or not locking reads (i.e. SELECT ... FOR UPDATE/SHARE) are supported</span> +</span><span id="Generator-85"><a href="#Generator-85"><span class="linenos"> 85</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Generator-86"><a href="#Generator-86"><span class="linenos"> 86</span></a> +</span><span id="Generator-87"><a href="#Generator-87"><span class="linenos"> 87</span></a> <span class="c1"># Always do union distinct or union all</span> +</span><span id="Generator-88"><a href="#Generator-88"><span class="linenos"> 88</span></a> <span class="n">EXPLICIT_UNION</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Generator-89"><a href="#Generator-89"><span class="linenos"> 89</span></a> +</span><span id="Generator-90"><a href="#Generator-90"><span class="linenos"> 90</span></a> <span class="c1"># Wrap derived values in parens, usually standard but spark doesn't support it</span> +</span><span id="Generator-91"><a href="#Generator-91"><span class="linenos"> 91</span></a> <span class="n">WRAP_DERIVED_VALUES</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Generator-92"><a href="#Generator-92"><span class="linenos"> 92</span></a> +</span><span id="Generator-93"><a href="#Generator-93"><span class="linenos"> 93</span></a> <span class="c1"># Whether or not create function uses an AS before the def.</span> +</span><span id="Generator-94"><a href="#Generator-94"><span class="linenos"> 94</span></a> <span class="n">CREATE_FUNCTION_AS</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Generator-95"><a href="#Generator-95"><span class="linenos"> 95</span></a> +</span><span id="Generator-96"><a href="#Generator-96"><span class="linenos"> 96</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Generator-97"><a href="#Generator-97"><span class="linenos"> 97</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="s2">"CHAR"</span><span class="p">,</span> +</span><span id="Generator-98"><a href="#Generator-98"><span class="linenos"> 98</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="s2">"VARCHAR"</span><span class="p">,</span> +</span><span id="Generator-99"><a href="#Generator-99"><span class="linenos"> 99</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="Generator-100"><a href="#Generator-100"><span class="linenos"> 100</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">:</span> <span class="s2">"TEXT"</span><span class="p">,</span> +</span><span id="Generator-101"><a href="#Generator-101"><span class="linenos"> 101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="Generator-102"><a href="#Generator-102"><span class="linenos"> 102</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">:</span> <span class="s2">"BLOB"</span><span class="p">,</span> +</span><span id="Generator-103"><a href="#Generator-103"><span class="linenos"> 103</span></a> <span class="p">}</span> +</span><span id="Generator-104"><a href="#Generator-104"><span class="linenos"> 104</span></a> +</span><span id="Generator-105"><a href="#Generator-105"><span class="linenos"> 105</span></a> <span class="n">STAR_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Generator-106"><a href="#Generator-106"><span class="linenos"> 106</span></a> <span class="s2">"except"</span><span class="p">:</span> <span class="s2">"EXCEPT"</span><span class="p">,</span> +</span><span id="Generator-107"><a href="#Generator-107"><span class="linenos"> 107</span></a> <span class="s2">"replace"</span><span class="p">:</span> <span class="s2">"REPLACE"</span><span class="p">,</span> +</span><span id="Generator-108"><a href="#Generator-108"><span class="linenos"> 108</span></a> <span class="p">}</span> +</span><span id="Generator-109"><a href="#Generator-109"><span class="linenos"> 109</span></a> +</span><span id="Generator-110"><a href="#Generator-110"><span class="linenos"> 110</span></a> <span class="n">TOKEN_MAPPING</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">TokenType</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Generator-111"><a href="#Generator-111"><span class="linenos"> 111</span></a> +</span><span id="Generator-112"><a href="#Generator-112"><span class="linenos"> 112</span></a> <span class="n">STRUCT_DELIMITER</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"<"</span><span class="p">,</span> <span class="s2">">"</span><span class="p">)</span> +</span><span id="Generator-113"><a href="#Generator-113"><span class="linenos"> 113</span></a> +</span><span id="Generator-114"><a href="#Generator-114"><span class="linenos"> 114</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Generator-115"><a href="#Generator-115"><span class="linenos"> 115</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-116"><a href="#Generator-116"><span class="linenos"> 116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AlgorithmProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">,</span> +</span><span id="Generator-117"><a href="#Generator-117"><span class="linenos"> 117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-118"><a href="#Generator-118"><span class="linenos"> 118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-119"><a href="#Generator-119"><span class="linenos"> 119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-120"><a href="#Generator-120"><span class="linenos"> 120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-121"><a href="#Generator-121"><span class="linenos"> 121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-122"><a href="#Generator-122"><span class="linenos"> 122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-123"><a href="#Generator-123"><span class="linenos"> 123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DefinerProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">,</span> +</span><span id="Generator-124"><a href="#Generator-124"><span class="linenos"> 124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-125"><a href="#Generator-125"><span class="linenos"> 125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-126"><a href="#Generator-126"><span class="linenos"> 126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EngineProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-127"><a href="#Generator-127"><span class="linenos"> 127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ExecuteAsProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-128"><a href="#Generator-128"><span class="linenos"> 128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-129"><a href="#Generator-129"><span class="linenos"> 129</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="Generator-130"><a href="#Generator-130"><span class="linenos"> 130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-131"><a href="#Generator-131"><span class="linenos"> 131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-132"><a href="#Generator-132"><span class="linenos"> 132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-133"><a href="#Generator-133"><span class="linenos"> 133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LanguageProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-134"><a href="#Generator-134"><span class="linenos"> 134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-135"><a href="#Generator-135"><span class="linenos"> 135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-136"><a href="#Generator-136"><span class="linenos"> 136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LogProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-137"><a href="#Generator-137"><span class="linenos"> 137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-138"><a href="#Generator-138"><span class="linenos"> 138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="Generator-139"><a href="#Generator-139"><span class="linenos"> 139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="Generator-140"><a href="#Generator-140"><span class="linenos"> 140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-141"><a href="#Generator-141"><span class="linenos"> 141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-142"><a href="#Generator-142"><span class="linenos"> 142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-143"><a href="#Generator-143"><span class="linenos"> 143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-144"><a href="#Generator-144"><span class="linenos"> 144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SerdeProperties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-145"><a href="#Generator-145"><span class="linenos"> 145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-146"><a href="#Generator-146"><span class="linenos"> 146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SqlSecurityProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">,</span> +</span><span id="Generator-147"><a href="#Generator-147"><span class="linenos"> 147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">,</span> +</span><span id="Generator-148"><a href="#Generator-148"><span class="linenos"> 148</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">,</span> +</span><span id="Generator-149"><a href="#Generator-149"><span class="linenos"> 149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WithJournalTableProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">,</span> +</span><span id="Generator-150"><a href="#Generator-150"><span class="linenos"> 150</span></a> <span class="p">}</span> +</span><span id="Generator-151"><a href="#Generator-151"><span class="linenos"> 151</span></a> +</span><span id="Generator-152"><a href="#Generator-152"><span class="linenos"> 152</span></a> <span class="n">WITH_SEPARATED_COMMENTS</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)</span> +</span><span id="Generator-153"><a href="#Generator-153"><span class="linenos"> 153</span></a> <span class="n">SENTINEL_LINE_BREAK</span> <span class="o">=</span> <span class="s2">"__SQLGLOT__LB__"</span> +</span><span id="Generator-154"><a href="#Generator-154"><span class="linenos"> 154</span></a> +</span><span id="Generator-155"><a href="#Generator-155"><span class="linenos"> 155</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-156"><a href="#Generator-156"><span class="linenos"> 156</span></a> <span class="s2">"time_mapping"</span><span class="p">,</span> +</span><span id="Generator-157"><a href="#Generator-157"><span class="linenos"> 157</span></a> <span class="s2">"time_trie"</span><span class="p">,</span> +</span><span id="Generator-158"><a href="#Generator-158"><span class="linenos"> 158</span></a> <span class="s2">"pretty"</span><span class="p">,</span> +</span><span id="Generator-159"><a href="#Generator-159"><span class="linenos"> 159</span></a> <span class="s2">"quote_start"</span><span class="p">,</span> +</span><span id="Generator-160"><a href="#Generator-160"><span class="linenos"> 160</span></a> <span class="s2">"quote_end"</span><span class="p">,</span> +</span><span id="Generator-161"><a href="#Generator-161"><span class="linenos"> 161</span></a> <span class="s2">"identifier_start"</span><span class="p">,</span> +</span><span id="Generator-162"><a href="#Generator-162"><span class="linenos"> 162</span></a> <span class="s2">"identifier_end"</span><span class="p">,</span> +</span><span id="Generator-163"><a href="#Generator-163"><span class="linenos"> 163</span></a> <span class="s2">"identify"</span><span class="p">,</span> +</span><span id="Generator-164"><a href="#Generator-164"><span class="linenos"> 164</span></a> <span class="s2">"normalize"</span><span class="p">,</span> +</span><span id="Generator-165"><a href="#Generator-165"><span class="linenos"> 165</span></a> <span class="s2">"string_escape"</span><span class="p">,</span> +</span><span id="Generator-166"><a href="#Generator-166"><span class="linenos"> 166</span></a> <span class="s2">"identifier_escape"</span><span class="p">,</span> +</span><span id="Generator-167"><a href="#Generator-167"><span class="linenos"> 167</span></a> <span class="s2">"pad"</span><span class="p">,</span> +</span><span id="Generator-168"><a href="#Generator-168"><span class="linenos"> 168</span></a> <span class="s2">"index_offset"</span><span class="p">,</span> +</span><span id="Generator-169"><a href="#Generator-169"><span class="linenos"> 169</span></a> <span class="s2">"unnest_column_only"</span><span class="p">,</span> +</span><span id="Generator-170"><a href="#Generator-170"><span class="linenos"> 170</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">,</span> +</span><span id="Generator-171"><a href="#Generator-171"><span class="linenos"> 171</span></a> <span class="s2">"normalize_functions"</span><span class="p">,</span> +</span><span id="Generator-172"><a href="#Generator-172"><span class="linenos"> 172</span></a> <span class="s2">"unsupported_level"</span><span class="p">,</span> +</span><span id="Generator-173"><a href="#Generator-173"><span class="linenos"> 173</span></a> <span class="s2">"unsupported_messages"</span><span class="p">,</span> +</span><span id="Generator-174"><a href="#Generator-174"><span class="linenos"> 174</span></a> <span class="s2">"null_ordering"</span><span class="p">,</span> +</span><span id="Generator-175"><a href="#Generator-175"><span class="linenos"> 175</span></a> <span class="s2">"max_unsupported"</span><span class="p">,</span> +</span><span id="Generator-176"><a href="#Generator-176"><span class="linenos"> 176</span></a> <span class="s2">"_indent"</span><span class="p">,</span> +</span><span id="Generator-177"><a href="#Generator-177"><span class="linenos"> 177</span></a> <span class="s2">"_replace_backslash"</span><span class="p">,</span> +</span><span id="Generator-178"><a href="#Generator-178"><span class="linenos"> 178</span></a> <span class="s2">"_escaped_quote_end"</span><span class="p">,</span> +</span><span id="Generator-179"><a href="#Generator-179"><span class="linenos"> 179</span></a> <span class="s2">"_escaped_identifier_end"</span><span class="p">,</span> +</span><span id="Generator-180"><a href="#Generator-180"><span class="linenos"> 180</span></a> <span class="s2">"_leading_comma"</span><span class="p">,</span> +</span><span id="Generator-181"><a href="#Generator-181"><span class="linenos"> 181</span></a> <span class="s2">"_max_text_width"</span><span class="p">,</span> +</span><span id="Generator-182"><a href="#Generator-182"><span class="linenos"> 182</span></a> <span class="s2">"_comments"</span><span class="p">,</span> +</span><span id="Generator-183"><a href="#Generator-183"><span class="linenos"> 183</span></a> <span class="p">)</span> +</span><span id="Generator-184"><a href="#Generator-184"><span class="linenos"> 184</span></a> +</span><span id="Generator-185"><a href="#Generator-185"><span class="linenos"> 185</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Generator-186"><a href="#Generator-186"><span class="linenos"> 186</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator-187"><a href="#Generator-187"><span class="linenos"> 187</span></a> <span class="n">time_mapping</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-188"><a href="#Generator-188"><span class="linenos"> 188</span></a> <span class="n">time_trie</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-189"><a href="#Generator-189"><span class="linenos"> 189</span></a> <span class="n">pretty</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-190"><a href="#Generator-190"><span class="linenos"> 190</span></a> <span class="n">quote_start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-191"><a href="#Generator-191"><span class="linenos"> 191</span></a> <span class="n">quote_end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-192"><a href="#Generator-192"><span class="linenos"> 192</span></a> <span class="n">identifier_start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-193"><a href="#Generator-193"><span class="linenos"> 193</span></a> <span class="n">identifier_end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-194"><a href="#Generator-194"><span class="linenos"> 194</span></a> <span class="n">identify</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-195"><a href="#Generator-195"><span class="linenos"> 195</span></a> <span class="n">normalize</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-196"><a href="#Generator-196"><span class="linenos"> 196</span></a> <span class="n">string_escape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-197"><a href="#Generator-197"><span class="linenos"> 197</span></a> <span class="n">identifier_escape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-198"><a href="#Generator-198"><span class="linenos"> 198</span></a> <span class="n">pad</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> +</span><span id="Generator-199"><a href="#Generator-199"><span class="linenos"> 199</span></a> <span class="n">indent</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> +</span><span id="Generator-200"><a href="#Generator-200"><span class="linenos"> 200</span></a> <span class="n">index_offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> +</span><span id="Generator-201"><a href="#Generator-201"><span class="linenos"> 201</span></a> <span class="n">unnest_column_only</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-202"><a href="#Generator-202"><span class="linenos"> 202</span></a> <span class="n">alias_post_tablesample</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-203"><a href="#Generator-203"><span class="linenos"> 203</span></a> <span class="n">normalize_functions</span><span class="o">=</span><span class="s2">"upper"</span><span class="p">,</span> +</span><span id="Generator-204"><a href="#Generator-204"><span class="linenos"> 204</span></a> <span class="n">unsupported_level</span><span class="o">=</span><span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">,</span> +</span><span id="Generator-205"><a href="#Generator-205"><span class="linenos"> 205</span></a> <span class="n">null_ordering</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-206"><a href="#Generator-206"><span class="linenos"> 206</span></a> <span class="n">max_unsupported</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> +</span><span id="Generator-207"><a href="#Generator-207"><span class="linenos"> 207</span></a> <span class="n">leading_comma</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-208"><a href="#Generator-208"><span class="linenos"> 208</span></a> <span class="n">max_text_width</span><span class="o">=</span><span class="mi">80</span><span class="p">,</span> +</span><span id="Generator-209"><a href="#Generator-209"><span class="linenos"> 209</span></a> <span class="n">comments</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Generator-210"><a href="#Generator-210"><span class="linenos"> 210</span></a> <span class="p">):</span> +</span><span id="Generator-211"><a href="#Generator-211"><span class="linenos"> 211</span></a> <span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="Generator-212"><a href="#Generator-212"><span class="linenos"> 212</span></a> +</span><span id="Generator-213"><a href="#Generator-213"><span class="linenos"> 213</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">time_mapping</span> <span class="o">=</span> <span class="n">time_mapping</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="Generator-214"><a href="#Generator-214"><span class="linenos"> 214</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">time_trie</span> <span class="o">=</span> <span class="n">time_trie</span> +</span><span id="Generator-215"><a href="#Generator-215"><span class="linenos"> 215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="o">=</span> <span class="n">pretty</span> <span class="k">if</span> <span class="n">pretty</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">pretty</span> +</span><span id="Generator-216"><a href="#Generator-216"><span class="linenos"> 216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span> <span class="o">=</span> <span class="n">quote_start</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="Generator-217"><a href="#Generator-217"><span class="linenos"> 217</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span> <span class="o">=</span> <span class="n">quote_end</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="Generator-218"><a href="#Generator-218"><span class="linenos"> 218</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span> <span class="o">=</span> <span class="n">identifier_start</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="Generator-219"><a href="#Generator-219"><span class="linenos"> 219</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span> <span class="o">=</span> <span class="n">identifier_end</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="Generator-220"><a href="#Generator-220"><span class="linenos"> 220</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="n">identify</span> +</span><span id="Generator-221"><a href="#Generator-221"><span class="linenos"> 221</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">normalize</span> <span class="o">=</span> <span class="n">normalize</span> +</span><span id="Generator-222"><a href="#Generator-222"><span class="linenos"> 222</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">=</span> <span class="n">string_escape</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="Generator-223"><a href="#Generator-223"><span class="linenos"> 223</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_escape</span> <span class="o">=</span> <span class="n">identifier_escape</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="Generator-224"><a href="#Generator-224"><span class="linenos"> 224</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span> +</span><span id="Generator-225"><a href="#Generator-225"><span class="linenos"> 225</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span> <span class="o">=</span> <span class="n">index_offset</span> +</span><span id="Generator-226"><a href="#Generator-226"><span class="linenos"> 226</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span> <span class="o">=</span> <span class="n">unnest_column_only</span> +</span><span id="Generator-227"><a href="#Generator-227"><span class="linenos"> 227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="n">alias_post_tablesample</span> +</span><span id="Generator-228"><a href="#Generator-228"><span class="linenos"> 228</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">=</span> <span class="n">normalize_functions</span> +</span><span id="Generator-229"><a href="#Generator-229"><span class="linenos"> 229</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">=</span> <span class="n">unsupported_level</span> +</span><span id="Generator-230"><a href="#Generator-230"><span class="linenos"> 230</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-231"><a href="#Generator-231"><span class="linenos"> 231</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">max_unsupported</span> <span class="o">=</span> <span class="n">max_unsupported</span> +</span><span id="Generator-232"><a href="#Generator-232"><span class="linenos"> 232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">=</span> <span class="n">null_ordering</span> +</span><span id="Generator-233"><a href="#Generator-233"><span class="linenos"> 233</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_indent</span> <span class="o">=</span> <span class="n">indent</span> +</span><span id="Generator-234"><a href="#Generator-234"><span class="linenos"> 234</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">==</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span> +</span><span id="Generator-235"><a href="#Generator-235"><span class="linenos"> 235</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_quote_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span> +</span><span id="Generator-236"><a href="#Generator-236"><span class="linenos"> 236</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_identifier_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_escape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span> +</span><span id="Generator-237"><a href="#Generator-237"><span class="linenos"> 237</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_leading_comma</span> <span class="o">=</span> <span class="n">leading_comma</span> +</span><span id="Generator-238"><a href="#Generator-238"><span class="linenos"> 238</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span> <span class="o">=</span> <span class="n">max_text_width</span> +</span><span id="Generator-239"><a href="#Generator-239"><span class="linenos"> 239</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="Generator-240"><a href="#Generator-240"><span class="linenos"> 240</span></a> +</span><span id="Generator-241"><a href="#Generator-241"><span class="linenos"> 241</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-242"><a href="#Generator-242"><span class="linenos"> 242</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Generator-243"><a href="#Generator-243"><span class="linenos"> 243</span></a><span class="sd"> Generates a SQL string by interpreting the given syntax tree.</span> +</span><span id="Generator-244"><a href="#Generator-244"><span class="linenos"> 244</span></a> +</span><span id="Generator-245"><a href="#Generator-245"><span class="linenos"> 245</span></a><span class="sd"> Args</span> +</span><span id="Generator-246"><a href="#Generator-246"><span class="linenos"> 246</span></a><span class="sd"> expression: the syntax tree.</span> +</span><span id="Generator-247"><a href="#Generator-247"><span class="linenos"> 247</span></a> +</span><span id="Generator-248"><a href="#Generator-248"><span class="linenos"> 248</span></a><span class="sd"> Returns</span> +</span><span id="Generator-249"><a href="#Generator-249"><span class="linenos"> 249</span></a><span class="sd"> the SQL string.</span> +</span><span id="Generator-250"><a href="#Generator-250"><span class="linenos"> 250</span></a><span class="sd"> """</span> +</span><span id="Generator-251"><a href="#Generator-251"><span class="linenos"> 251</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-252"><a href="#Generator-252"><span class="linenos"> 252</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="Generator-253"><a href="#Generator-253"><span class="linenos"> 253</span></a> +</span><span id="Generator-254"><a href="#Generator-254"><span class="linenos"> 254</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IGNORE</span><span class="p">:</span> +</span><span id="Generator-255"><a href="#Generator-255"><span class="linenos"> 255</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator-256"><a href="#Generator-256"><span class="linenos"> 256</span></a> +</span><span id="Generator-257"><a href="#Generator-257"><span class="linenos"> 257</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> +</span><span id="Generator-258"><a href="#Generator-258"><span class="linenos"> 258</span></a> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">:</span> +</span><span id="Generator-259"><a href="#Generator-259"><span class="linenos"> 259</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> +</span><span id="Generator-260"><a href="#Generator-260"><span class="linenos"> 260</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">RAISE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">:</span> +</span><span id="Generator-261"><a href="#Generator-261"><span class="linenos"> 261</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="n">concat_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_unsupported</span><span class="p">))</span> +</span><span id="Generator-262"><a href="#Generator-262"><span class="linenos"> 262</span></a> +</span><span id="Generator-263"><a href="#Generator-263"><span class="linenos"> 263</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator-264"><a href="#Generator-264"><span class="linenos"> 264</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SENTINEL_LINE_BREAK</span><span class="p">,</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-265"><a href="#Generator-265"><span class="linenos"> 265</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator-266"><a href="#Generator-266"><span class="linenos"> 266</span></a> +</span><span id="Generator-267"><a href="#Generator-267"><span class="linenos"> 267</span></a> <span class="k">def</span> <span class="nf">unsupported</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-268"><a href="#Generator-268"><span class="linenos"> 268</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span><span class="p">:</span> +</span><span id="Generator-269"><a href="#Generator-269"><span class="linenos"> 269</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="Generator-270"><a href="#Generator-270"><span class="linenos"> 270</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="Generator-271"><a href="#Generator-271"><span class="linenos"> 271</span></a> +</span><span id="Generator-272"><a href="#Generator-272"><span class="linenos"> 272</span></a> <span class="k">def</span> <span class="nf">sep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-273"><a href="#Generator-273"><span class="linenos"> 273</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="n">sep</span> +</span><span id="Generator-274"><a href="#Generator-274"><span class="linenos"> 274</span></a> +</span><span id="Generator-275"><a href="#Generator-275"><span class="linenos"> 275</span></a> <span class="k">def</span> <span class="nf">seg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-276"><a href="#Generator-276"><span class="linenos"> 276</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="n">sep</span><span class="p">)</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-277"><a href="#Generator-277"><span class="linenos"> 277</span></a> +</span><span id="Generator-278"><a href="#Generator-278"><span class="linenos"> 278</span></a> <span class="k">def</span> <span class="nf">pad_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comment</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-279"><a href="#Generator-279"><span class="linenos"> 279</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="n">comment</span> <span class="k">if</span> <span class="n">comment</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">else</span> <span class="n">comment</span> +</span><span id="Generator-280"><a href="#Generator-280"><span class="linenos"> 280</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="n">comment</span> <span class="o">+</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">comment</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">else</span> <span class="n">comment</span> +</span><span id="Generator-281"><a href="#Generator-281"><span class="linenos"> 281</span></a> <span class="k">return</span> <span class="n">comment</span> +</span><span id="Generator-282"><a href="#Generator-282"><span class="linenos"> 282</span></a> +</span><span id="Generator-283"><a href="#Generator-283"><span class="linenos"> 283</span></a> <span class="k">def</span> <span class="nf">maybe_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-284"><a href="#Generator-284"><span class="linenos"> 284</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="Generator-285"><a href="#Generator-285"><span class="linenos"> 285</span></a> +</span><span id="Generator-286"><a href="#Generator-286"><span class="linenos"> 286</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="Generator-287"><a href="#Generator-287"><span class="linenos"> 287</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator-288"><a href="#Generator-288"><span class="linenos"> 288</span></a> +</span><span id="Generator-289"><a href="#Generator-289"><span class="linenos"> 289</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator-290"><a href="#Generator-290"><span class="linenos"> 290</span></a> <span class="n">comments_sql</span> <span class="o">=</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-291"><a href="#Generator-291"><span class="linenos"> 291</span></a> <span class="sa">f</span><span class="s2">"/*</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">pad_comment</span><span class="p">(</span><span class="n">comment</span><span class="p">)</span><span class="si">}</span><span class="s2">*/"</span> <span class="k">for</span> <span class="n">comment</span> <span class="ow">in</span> <span class="n">comments</span> <span class="k">if</span> <span class="n">comment</span> +</span><span id="Generator-292"><a href="#Generator-292"><span class="linenos"> 292</span></a> <span class="p">)</span> +</span><span id="Generator-293"><a href="#Generator-293"><span class="linenos"> 293</span></a> +</span><span id="Generator-294"><a href="#Generator-294"><span class="linenos"> 294</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">comments_sql</span><span class="p">:</span> +</span><span id="Generator-295"><a href="#Generator-295"><span class="linenos"> 295</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator-296"><a href="#Generator-296"><span class="linenos"> 296</span></a> +</span><span id="Generator-297"><a href="#Generator-297"><span class="linenos"> 297</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">WITH_SEPARATED_COMMENTS</span><span class="p">):</span> +</span><span id="Generator-298"><a href="#Generator-298"><span class="linenos"> 298</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">comments_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-299"><a href="#Generator-299"><span class="linenos"> 299</span></a> +</span><span id="Generator-300"><a href="#Generator-300"><span class="linenos"> 300</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">comments_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-301"><a href="#Generator-301"><span class="linenos"> 301</span></a> +</span><span id="Generator-302"><a href="#Generator-302"><span class="linenos"> 302</span></a> <span class="k">def</span> <span class="nf">wrap</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-303"><a href="#Generator-303"><span class="linenos"> 303</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span> +</span><span id="Generator-304"><a href="#Generator-304"><span class="linenos"> 304</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-305"><a href="#Generator-305"><span class="linenos"> 305</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">))</span> +</span><span id="Generator-306"><a href="#Generator-306"><span class="linenos"> 306</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="Generator-307"><a href="#Generator-307"><span class="linenos"> 307</span></a> <span class="n">level</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> +</span><span id="Generator-308"><a href="#Generator-308"><span class="linenos"> 308</span></a> <span class="n">pad</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> +</span><span id="Generator-309"><a href="#Generator-309"><span class="linenos"> 309</span></a> <span class="p">)</span> +</span><span id="Generator-310"><a href="#Generator-310"><span class="linenos"> 310</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="n">this_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-311"><a href="#Generator-311"><span class="linenos"> 311</span></a> +</span><span id="Generator-312"><a href="#Generator-312"><span class="linenos"> 312</span></a> <span class="k">def</span> <span class="nf">no_identify</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-313"><a href="#Generator-313"><span class="linenos"> 313</span></a> <span class="n">original</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> +</span><span id="Generator-314"><a href="#Generator-314"><span class="linenos"> 314</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Generator-315"><a href="#Generator-315"><span class="linenos"> 315</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Generator-316"><a href="#Generator-316"><span class="linenos"> 316</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="n">original</span> +</span><span id="Generator-317"><a href="#Generator-317"><span class="linenos"> 317</span></a> <span class="k">return</span> <span class="n">result</span> +</span><span id="Generator-318"><a href="#Generator-318"><span class="linenos"> 318</span></a> +</span><span id="Generator-319"><a href="#Generator-319"><span class="linenos"> 319</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-320"><a href="#Generator-320"><span class="linenos"> 320</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">==</span> <span class="s2">"upper"</span><span class="p">:</span> +</span><span id="Generator-321"><a href="#Generator-321"><span class="linenos"> 321</span></a> <span class="k">return</span> <span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Generator-322"><a href="#Generator-322"><span class="linenos"> 322</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">==</span> <span class="s2">"lower"</span><span class="p">:</span> +</span><span id="Generator-323"><a href="#Generator-323"><span class="linenos"> 323</span></a> <span class="k">return</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="Generator-324"><a href="#Generator-324"><span class="linenos"> 324</span></a> <span class="k">return</span> <span class="n">name</span> +</span><span id="Generator-325"><a href="#Generator-325"><span class="linenos"> 325</span></a> +</span><span id="Generator-326"><a href="#Generator-326"><span class="linenos"> 326</span></a> <span class="k">def</span> <span class="nf">indent</span><span class="p">(</span> +</span><span id="Generator-327"><a href="#Generator-327"><span class="linenos"> 327</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator-328"><a href="#Generator-328"><span class="linenos"> 328</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="Generator-329"><a href="#Generator-329"><span class="linenos"> 329</span></a> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +</span><span id="Generator-330"><a href="#Generator-330"><span class="linenos"> 330</span></a> <span class="n">pad</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-331"><a href="#Generator-331"><span class="linenos"> 331</span></a> <span class="n">skip_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-332"><a href="#Generator-332"><span class="linenos"> 332</span></a> <span class="n">skip_last</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-333"><a href="#Generator-333"><span class="linenos"> 333</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-334"><a href="#Generator-334"><span class="linenos"> 334</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator-335"><a href="#Generator-335"><span class="linenos"> 335</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator-336"><a href="#Generator-336"><span class="linenos"> 336</span></a> +</span><span id="Generator-337"><a href="#Generator-337"><span class="linenos"> 337</span></a> <span class="n">pad</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> <span class="k">if</span> <span class="n">pad</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">pad</span> +</span><span id="Generator-338"><a href="#Generator-338"><span class="linenos"> 338</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-339"><a href="#Generator-339"><span class="linenos"> 339</span></a> +</span><span id="Generator-340"><a href="#Generator-340"><span class="linenos"> 340</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-341"><a href="#Generator-341"><span class="linenos"> 341</span></a> <span class="n">line</span> +</span><span id="Generator-342"><a href="#Generator-342"><span class="linenos"> 342</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">skip_first</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">skip_last</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Generator-343"><a href="#Generator-343"><span class="linenos"> 343</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">' '</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="p">(</span><span class="n">level</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="bp">self</span><span class="o">.</span><span class="n">_indent</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">pad</span><span class="p">)</span><span class="si">}{</span><span class="n">line</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-344"><a href="#Generator-344"><span class="linenos"> 344</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">line</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span><span id="Generator-345"><a href="#Generator-345"><span class="linenos"> 345</span></a> <span class="p">)</span> +</span><span id="Generator-346"><a href="#Generator-346"><span class="linenos"> 346</span></a> +</span><span id="Generator-347"><a href="#Generator-347"><span class="linenos"> 347</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span> +</span><span id="Generator-348"><a href="#Generator-348"><span class="linenos"> 348</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator-349"><a href="#Generator-349"><span class="linenos"> 349</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="Generator-350"><a href="#Generator-350"><span class="linenos"> 350</span></a> <span class="n">key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-351"><a href="#Generator-351"><span class="linenos"> 351</span></a> <span class="n">comment</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Generator-352"><a href="#Generator-352"><span class="linenos"> 352</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-353"><a href="#Generator-353"><span class="linenos"> 353</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="Generator-354"><a href="#Generator-354"><span class="linenos"> 354</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator-355"><a href="#Generator-355"><span class="linenos"> 355</span></a> +</span><span id="Generator-356"><a href="#Generator-356"><span class="linenos"> 356</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Generator-357"><a href="#Generator-357"><span class="linenos"> 357</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Generator-358"><a href="#Generator-358"><span class="linenos"> 358</span></a> +</span><span id="Generator-359"><a href="#Generator-359"><span class="linenos"> 359</span></a> <span class="k">if</span> <span class="n">key</span><span class="p">:</span> +</span><span id="Generator-360"><a href="#Generator-360"><span class="linenos"> 360</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span> +</span><span id="Generator-361"><a href="#Generator-361"><span class="linenos"> 361</span></a> +</span><span id="Generator-362"><a href="#Generator-362"><span class="linenos"> 362</span></a> <span class="n">transform</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="Generator-363"><a href="#Generator-363"><span class="linenos"> 363</span></a> +</span><span id="Generator-364"><a href="#Generator-364"><span class="linenos"> 364</span></a> <span class="k">if</span> <span class="n">callable</span><span class="p">(</span><span class="n">transform</span><span class="p">):</span> +</span><span id="Generator-365"><a href="#Generator-365"><span class="linenos"> 365</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-366"><a href="#Generator-366"><span class="linenos"> 366</span></a> <span class="k">elif</span> <span class="n">transform</span><span class="p">:</span> +</span><span id="Generator-367"><a href="#Generator-367"><span class="linenos"> 367</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">transform</span> +</span><span id="Generator-368"><a href="#Generator-368"><span class="linenos"> 368</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Generator-369"><a href="#Generator-369"><span class="linenos"> 369</span></a> <span class="n">exp_handler_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">_sql"</span> +</span><span id="Generator-370"><a href="#Generator-370"><span class="linenos"> 370</span></a> +</span><span id="Generator-371"><a href="#Generator-371"><span class="linenos"> 371</span></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_handler_name</span><span class="p">):</span> +</span><span id="Generator-372"><a href="#Generator-372"><span class="linenos"> 372</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_handler_name</span><span class="p">)(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-373"><a href="#Generator-373"><span class="linenos"> 373</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Generator-374"><a href="#Generator-374"><span class="linenos"> 374</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-375"><a href="#Generator-375"><span class="linenos"> 375</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">):</span> +</span><span id="Generator-376"><a href="#Generator-376"><span class="linenos"> 376</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">property_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-377"><a href="#Generator-377"><span class="linenos"> 377</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-378"><a href="#Generator-378"><span class="linenos"> 378</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported expression type </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-379"><a href="#Generator-379"><span class="linenos"> 379</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-380"><a href="#Generator-380"><span class="linenos"> 380</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected an Expression. Received </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">expression</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-381"><a href="#Generator-381"><span class="linenos"> 381</span></a> +</span><span id="Generator-382"><a href="#Generator-382"><span class="linenos"> 382</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">maybe_comment</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="ow">and</span> <span class="n">comment</span> <span class="k">else</span> <span class="n">sql</span> +</span><span id="Generator-383"><a href="#Generator-383"><span class="linenos"> 383</span></a> +</span><span id="Generator-384"><a href="#Generator-384"><span class="linenos"> 384</span></a> <span class="k">def</span> <span class="nf">uncache_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Uncache</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-385"><a href="#Generator-385"><span class="linenos"> 385</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-386"><a href="#Generator-386"><span class="linenos"> 386</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-387"><a href="#Generator-387"><span class="linenos"> 387</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNCACHE TABLE</span><span class="si">{</span><span class="n">exists_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-388"><a href="#Generator-388"><span class="linenos"> 388</span></a> +</span><span id="Generator-389"><a href="#Generator-389"><span class="linenos"> 389</span></a> <span class="k">def</span> <span class="nf">cache_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-390"><a href="#Generator-390"><span class="linenos"> 390</span></a> <span class="n">lazy</span> <span class="o">=</span> <span class="s2">" LAZY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"lazy"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-391"><a href="#Generator-391"><span class="linenos"> 391</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-392"><a href="#Generator-392"><span class="linenos"> 392</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"options"</span><span class="p">)</span> +</span><span id="Generator-393"><a href="#Generator-393"><span class="linenos"> 393</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" OPTIONS(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-394"><a href="#Generator-394"><span class="linenos"> 394</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator-395"><a href="#Generator-395"><span class="linenos"> 395</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-396"><a href="#Generator-396"><span class="linenos"> 396</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CACHE</span><span class="si">{</span><span class="n">lazy</span><span class="si">}</span><span class="s2"> TABLE </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="n">options</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-397"><a href="#Generator-397"><span class="linenos"> 397</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-398"><a href="#Generator-398"><span class="linenos"> 398</span></a> +</span><span id="Generator-399"><a href="#Generator-399"><span class="linenos"> 399</span></a> <span class="k">def</span> <span class="nf">characterset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-400"><a href="#Generator-400"><span class="linenos"> 400</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="Generator-401"><a href="#Generator-401"><span class="linenos"> 401</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHAR CHARACTER SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-402"><a href="#Generator-402"><span class="linenos"> 402</span></a> <span class="n">default</span> <span class="o">=</span> <span class="s2">"DEFAULT "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-403"><a href="#Generator-403"><span class="linenos"> 403</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">CHARACTER SET=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-404"><a href="#Generator-404"><span class="linenos"> 404</span></a> +</span><span id="Generator-405"><a href="#Generator-405"><span class="linenos"> 405</span></a> <span class="k">def</span> <span class="nf">column_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-406"><a href="#Generator-406"><span class="linenos"> 406</span></a> <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-407"><a href="#Generator-407"><span class="linenos"> 407</span></a> <span class="n">part</span> +</span><span id="Generator-408"><a href="#Generator-408"><span class="linenos"> 408</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="Generator-409"><a href="#Generator-409"><span class="linenos"> 409</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">),</span> +</span><span id="Generator-410"><a href="#Generator-410"><span class="linenos"> 410</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">),</span> +</span><span id="Generator-411"><a href="#Generator-411"><span class="linenos"> 411</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="Generator-412"><a href="#Generator-412"><span class="linenos"> 412</span></a> <span class="p">]</span> +</span><span id="Generator-413"><a href="#Generator-413"><span class="linenos"> 413</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="Generator-414"><a href="#Generator-414"><span class="linenos"> 414</span></a> <span class="p">)</span> +</span><span id="Generator-415"><a href="#Generator-415"><span class="linenos"> 415</span></a> +</span><span id="Generator-416"><a href="#Generator-416"><span class="linenos"> 416</span></a> <span class="k">def</span> <span class="nf">columndef_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-417"><a href="#Generator-417"><span class="linenos"> 417</span></a> <span class="n">column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-418"><a href="#Generator-418"><span class="linenos"> 418</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator-419"><a href="#Generator-419"><span class="linenos"> 419</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"constraints"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-420"><a href="#Generator-420"><span class="linenos"> 420</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">"IF NOT EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-421"><a href="#Generator-421"><span class="linenos"> 421</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-422"><a href="#Generator-422"><span class="linenos"> 422</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">constraints</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">constraints</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-423"><a href="#Generator-423"><span class="linenos"> 423</span></a> +</span><span id="Generator-424"><a href="#Generator-424"><span class="linenos"> 424</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">exists</span><span class="si">}{</span><span class="n">column</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">constraints</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-425"><a href="#Generator-425"><span class="linenos"> 425</span></a> +</span><span id="Generator-426"><a href="#Generator-426"><span class="linenos"> 426</span></a> <span class="k">def</span> <span class="nf">columnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-427"><a href="#Generator-427"><span class="linenos"> 427</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-428"><a href="#Generator-428"><span class="linenos"> 428</span></a> <span class="n">kind_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator-429"><a href="#Generator-429"><span class="linenos"> 429</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">kind_sql</span> +</span><span id="Generator-430"><a href="#Generator-430"><span class="linenos"> 430</span></a> +</span><span id="Generator-431"><a href="#Generator-431"><span class="linenos"> 431</span></a> <span class="k">def</span> <span class="nf">autoincrementcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-432"><a href="#Generator-432"><span class="linenos"> 432</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">token_sql</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">)</span> +</span><span id="Generator-433"><a href="#Generator-433"><span class="linenos"> 433</span></a> +</span><span id="Generator-434"><a href="#Generator-434"><span class="linenos"> 434</span></a> <span class="k">def</span> <span class="nf">checkcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CheckColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-435"><a href="#Generator-435"><span class="linenos"> 435</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-436"><a href="#Generator-436"><span class="linenos"> 436</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECK (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-437"><a href="#Generator-437"><span class="linenos"> 437</span></a> +</span><span id="Generator-438"><a href="#Generator-438"><span class="linenos"> 438</span></a> <span class="k">def</span> <span class="nf">commentcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CommentColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-439"><a href="#Generator-439"><span class="linenos"> 439</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-440"><a href="#Generator-440"><span class="linenos"> 440</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COMMENT </span><span class="si">{</span><span class="n">comment</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-441"><a href="#Generator-441"><span class="linenos"> 441</span></a> +</span><span id="Generator-442"><a href="#Generator-442"><span class="linenos"> 442</span></a> <span class="k">def</span> <span class="nf">collatecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CollateColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-443"><a href="#Generator-443"><span class="linenos"> 443</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-444"><a href="#Generator-444"><span class="linenos"> 444</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-445"><a href="#Generator-445"><span class="linenos"> 445</span></a> +</span><span id="Generator-446"><a href="#Generator-446"><span class="linenos"> 446</span></a> <span class="k">def</span> <span class="nf">encodecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EncodeColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-447"><a href="#Generator-447"><span class="linenos"> 447</span></a> <span class="n">encode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-448"><a href="#Generator-448"><span class="linenos"> 448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ENCODE </span><span class="si">{</span><span class="n">encode</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-449"><a href="#Generator-449"><span class="linenos"> 449</span></a> +</span><span id="Generator-450"><a href="#Generator-450"><span class="linenos"> 450</span></a> <span class="k">def</span> <span class="nf">defaultcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DefaultColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-451"><a href="#Generator-451"><span class="linenos"> 451</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-452"><a href="#Generator-452"><span class="linenos"> 452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DEFAULT </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-453"><a href="#Generator-453"><span class="linenos"> 453</span></a> +</span><span id="Generator-454"><a href="#Generator-454"><span class="linenos"> 454</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="Generator-455"><a href="#Generator-455"><span class="linenos"> 455</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="Generator-456"><a href="#Generator-456"><span class="linenos"> 456</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-457"><a href="#Generator-457"><span class="linenos"> 457</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-458"><a href="#Generator-458"><span class="linenos"> 458</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-459"><a href="#Generator-459"><span class="linenos"> 459</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">" ALWAYS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">" BY DEFAULT "</span> +</span><span id="Generator-460"><a href="#Generator-460"><span class="linenos"> 460</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="Generator-461"><a href="#Generator-461"><span class="linenos"> 461</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"START WITH </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-462"><a href="#Generator-462"><span class="linenos"> 462</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="Generator-463"><a href="#Generator-463"><span class="linenos"> 463</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INCREMENT BY </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-464"><a href="#Generator-464"><span class="linenos"> 464</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-465"><a href="#Generator-465"><span class="linenos"> 465</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">or</span> <span class="n">increment</span><span class="p">:</span> +</span><span id="Generator-466"><a href="#Generator-466"><span class="linenos"> 466</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-467"><a href="#Generator-467"><span class="linenos"> 467</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" (</span><span class="si">{</span><span class="n">sequence_opts</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-468"><a href="#Generator-468"><span class="linenos"> 468</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"GENERATED</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">AS IDENTITY</span><span class="si">{</span><span class="n">sequence_opts</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-469"><a href="#Generator-469"><span class="linenos"> 469</span></a> +</span><span id="Generator-470"><a href="#Generator-470"><span class="linenos"> 470</span></a> <span class="k">def</span> <span class="nf">notnullcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-471"><a href="#Generator-471"><span class="linenos"> 471</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'allow_null'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'NOT '</span><span class="si">}</span><span class="s2">NULL"</span> +</span><span id="Generator-472"><a href="#Generator-472"><span class="linenos"> 472</span></a> +</span><span id="Generator-473"><a href="#Generator-473"><span class="linenos"> 473</span></a> <span class="k">def</span> <span class="nf">primarykeycolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKeyColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-474"><a href="#Generator-474"><span class="linenos"> 474</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> +</span><span id="Generator-475"><a href="#Generator-475"><span class="linenos"> 475</span></a> <span class="k">if</span> <span class="n">desc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-476"><a href="#Generator-476"><span class="linenos"> 476</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY</span><span class="si">{</span><span class="s1">' DESC'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">desc</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ASC'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-477"><a href="#Generator-477"><span class="linenos"> 477</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY"</span> +</span><span id="Generator-478"><a href="#Generator-478"><span class="linenos"> 478</span></a> +</span><span id="Generator-479"><a href="#Generator-479"><span class="linenos"> 479</span></a> <span class="k">def</span> <span class="nf">uniquecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-480"><a href="#Generator-480"><span class="linenos"> 480</span></a> <span class="k">return</span> <span class="s2">"UNIQUE"</span> +</span><span id="Generator-481"><a href="#Generator-481"><span class="linenos"> 481</span></a> +</span><span id="Generator-482"><a href="#Generator-482"><span class="linenos"> 482</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-483"><a href="#Generator-483"><span class="linenos"> 483</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Generator-484"><a href="#Generator-484"><span class="linenos"> 484</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"properties"</span><span class="p">)</span> +</span><span id="Generator-485"><a href="#Generator-485"><span class="linenos"> 485</span></a> <span class="n">properties_exp</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Generator-486"><a href="#Generator-486"><span class="linenos"> 486</span></a> <span class="n">properties_locs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">locate_properties</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> <span class="k">if</span> <span class="n">properties</span> <span class="k">else</span> <span class="p">{}</span> +</span><span id="Generator-487"><a href="#Generator-487"><span class="linenos"> 487</span></a> <span class="k">if</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">)</span> <span class="ow">or</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span> +</span><span id="Generator-488"><a href="#Generator-488"><span class="linenos"> 488</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span> +</span><span id="Generator-489"><a href="#Generator-489"><span class="linenos"> 489</span></a> <span class="p">):</span> +</span><span id="Generator-490"><a href="#Generator-490"><span class="linenos"> 490</span></a> <span class="n">properties_exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="Generator-491"><a href="#Generator-491"><span class="linenos"> 491</span></a> <span class="s2">"properties"</span><span class="p">,</span> +</span><span id="Generator-492"><a href="#Generator-492"><span class="linenos"> 492</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span> +</span><span id="Generator-493"><a href="#Generator-493"><span class="linenos"> 493</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span> +</span><span id="Generator-494"><a href="#Generator-494"><span class="linenos"> 494</span></a> <span class="o">*</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">],</span> +</span><span id="Generator-495"><a href="#Generator-495"><span class="linenos"> 495</span></a> <span class="o">*</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">],</span> +</span><span id="Generator-496"><a href="#Generator-496"><span class="linenos"> 496</span></a> <span class="p">]</span> +</span><span id="Generator-497"><a href="#Generator-497"><span class="linenos"> 497</span></a> <span class="p">),</span> +</span><span id="Generator-498"><a href="#Generator-498"><span class="linenos"> 498</span></a> <span class="p">)</span> +</span><span id="Generator-499"><a href="#Generator-499"><span class="linenos"> 499</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"TABLE"</span> <span class="ow">and</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">):</span> +</span><span id="Generator-500"><a href="#Generator-500"><span class="linenos"> 500</span></a> <span class="n">this_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-501"><a href="#Generator-501"><span class="linenos"> 501</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Generator-502"><a href="#Generator-502"><span class="linenos"> 502</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">]),</span> +</span><span id="Generator-503"><a href="#Generator-503"><span class="linenos"> 503</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-504"><a href="#Generator-504"><span class="linenos"> 504</span></a> <span class="p">)</span> +</span><span id="Generator-505"><a href="#Generator-505"><span class="linenos"> 505</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-506"><a href="#Generator-506"><span class="linenos"> 506</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this_name</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">this_properties</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-507"><a href="#Generator-507"><span class="linenos"> 507</span></a> <span class="n">properties_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-508"><a href="#Generator-508"><span class="linenos"> 508</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-509"><a href="#Generator-509"><span class="linenos"> 509</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-510"><a href="#Generator-510"><span class="linenos"> 510</span></a> <span class="n">properties_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">properties_exp</span><span class="p">,</span> <span class="s2">"properties"</span><span class="p">)</span> +</span><span id="Generator-511"><a href="#Generator-511"><span class="linenos"> 511</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="s2">" BEGIN"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"begin"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-512"><a href="#Generator-512"><span class="linenos"> 512</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator-513"><a href="#Generator-513"><span class="linenos"> 513</span></a> <span class="k">if</span> <span class="n">expression_sql</span><span class="p">:</span> +</span><span id="Generator-514"><a href="#Generator-514"><span class="linenos"> 514</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">begin</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-515"><a href="#Generator-515"><span class="linenos"> 515</span></a> +</span><span id="Generator-516"><a href="#Generator-516"><span class="linenos"> 516</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">CREATE_FUNCTION_AS</span> <span class="ow">or</span> <span class="n">kind</span> <span class="o">!=</span> <span class="s2">"FUNCTION"</span><span class="p">:</span> +</span><span id="Generator-517"><a href="#Generator-517"><span class="linenos"> 517</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-518"><a href="#Generator-518"><span class="linenos"> 518</span></a> +</span><span id="Generator-519"><a href="#Generator-519"><span class="linenos"> 519</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-520"><a href="#Generator-520"><span class="linenos"> 520</span></a> <span class="n">transient</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-521"><a href="#Generator-521"><span class="linenos"> 521</span></a> <span class="s2">" TRANSIENT"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">CREATE_TRANSIENT</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"transient"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-522"><a href="#Generator-522"><span class="linenos"> 522</span></a> <span class="p">)</span> +</span><span id="Generator-523"><a href="#Generator-523"><span class="linenos"> 523</span></a> <span class="n">external</span> <span class="o">=</span> <span class="s2">" EXTERNAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"external"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-524"><a href="#Generator-524"><span class="linenos"> 524</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="s2">" OR REPLACE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"replace"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-525"><a href="#Generator-525"><span class="linenos"> 525</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF NOT EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-526"><a href="#Generator-526"><span class="linenos"> 526</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="s2">" UNIQUE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unique"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-527"><a href="#Generator-527"><span class="linenos"> 527</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="s2">" MATERIALIZED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"materialized"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-528"><a href="#Generator-528"><span class="linenos"> 528</span></a> <span class="n">set_</span> <span class="o">=</span> <span class="s2">" SET"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"set"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-529"><a href="#Generator-529"><span class="linenos"> 529</span></a> <span class="n">multiset</span> <span class="o">=</span> <span class="s2">" MULTISET"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"multiset"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-530"><a href="#Generator-530"><span class="linenos"> 530</span></a> <span class="n">global_temporary</span> <span class="o">=</span> <span class="s2">" GLOBAL TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global_temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-531"><a href="#Generator-531"><span class="linenos"> 531</span></a> <span class="n">volatile</span> <span class="o">=</span> <span class="s2">" VOLATILE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"volatile"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-532"><a href="#Generator-532"><span class="linenos"> 532</span></a> <span class="n">data</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"data"</span><span class="p">)</span> +</span><span id="Generator-533"><a href="#Generator-533"><span class="linenos"> 533</span></a> <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-534"><a href="#Generator-534"><span class="linenos"> 534</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-535"><a href="#Generator-535"><span class="linenos"> 535</span></a> <span class="k">elif</span> <span class="n">data</span><span class="p">:</span> +</span><span id="Generator-536"><a href="#Generator-536"><span class="linenos"> 536</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">" WITH DATA"</span> +</span><span id="Generator-537"><a href="#Generator-537"><span class="linenos"> 537</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-538"><a href="#Generator-538"><span class="linenos"> 538</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">" WITH NO DATA"</span> +</span><span id="Generator-539"><a href="#Generator-539"><span class="linenos"> 539</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"statistics"</span><span class="p">)</span> +</span><span id="Generator-540"><a href="#Generator-540"><span class="linenos"> 540</span></a> <span class="k">if</span> <span class="n">statistics</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-541"><a href="#Generator-541"><span class="linenos"> 541</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-542"><a href="#Generator-542"><span class="linenos"> 542</span></a> <span class="k">elif</span> <span class="n">statistics</span><span class="p">:</span> +</span><span id="Generator-543"><a href="#Generator-543"><span class="linenos"> 543</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">" AND STATISTICS"</span> +</span><span id="Generator-544"><a href="#Generator-544"><span class="linenos"> 544</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-545"><a href="#Generator-545"><span class="linenos"> 545</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">" AND NO STATISTICS"</span> +</span><span id="Generator-546"><a href="#Generator-546"><span class="linenos"> 546</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="s2">" NO PRIMARY INDEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_primary_index"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-547"><a href="#Generator-547"><span class="linenos"> 547</span></a> +</span><span id="Generator-548"><a href="#Generator-548"><span class="linenos"> 548</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"indexes"</span><span class="p">)</span> +</span><span id="Generator-549"><a href="#Generator-549"><span class="linenos"> 549</span></a> <span class="n">index_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-550"><a href="#Generator-550"><span class="linenos"> 550</span></a> <span class="k">if</span> <span class="n">indexes</span><span class="p">:</span> +</span><span id="Generator-551"><a href="#Generator-551"><span class="linenos"> 551</span></a> <span class="n">indexes_sql</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-552"><a href="#Generator-552"><span class="linenos"> 552</span></a> <span class="k">for</span> <span class="n">index</span> <span class="ow">in</span> <span class="n">indexes</span><span class="p">:</span> +</span><span id="Generator-553"><a href="#Generator-553"><span class="linenos"> 553</span></a> <span class="n">ind_unique</span> <span class="o">=</span> <span class="s2">" UNIQUE"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unique"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-554"><a href="#Generator-554"><span class="linenos"> 554</span></a> <span class="n">ind_primary</span> <span class="o">=</span> <span class="s2">" PRIMARY"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"primary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-555"><a href="#Generator-555"><span class="linenos"> 555</span></a> <span class="n">ind_amp</span> <span class="o">=</span> <span class="s2">" AMP"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"amp"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-556"><a href="#Generator-556"><span class="linenos"> 556</span></a> <span class="n">ind_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">index</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-557"><a href="#Generator-557"><span class="linenos"> 557</span></a> <span class="n">ind_columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-558"><a href="#Generator-558"><span class="linenos"> 558</span></a> <span class="sa">f</span><span class="s1">' (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">index</span><span class="p">,</span><span class="w"> </span><span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s1">)'</span> +</span><span id="Generator-559"><a href="#Generator-559"><span class="linenos"> 559</span></a> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> +</span><span id="Generator-560"><a href="#Generator-560"><span class="linenos"> 560</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-561"><a href="#Generator-561"><span class="linenos"> 561</span></a> <span class="p">)</span> +</span><span id="Generator-562"><a href="#Generator-562"><span class="linenos"> 562</span></a> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"primary"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span> +</span><span id="Generator-563"><a href="#Generator-563"><span class="linenos"> 563</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span> +</span><span id="Generator-564"><a href="#Generator-564"><span class="linenos"> 564</span></a> <span class="p">):</span> +</span><span id="Generator-565"><a href="#Generator-565"><span class="linenos"> 565</span></a> <span class="n">postindex_props_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Generator-566"><a href="#Generator-566"><span class="linenos"> 566</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span> +</span><span id="Generator-567"><a href="#Generator-567"><span class="linenos"> 567</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">]</span> +</span><span id="Generator-568"><a href="#Generator-568"><span class="linenos"> 568</span></a> <span class="p">),</span> +</span><span id="Generator-569"><a href="#Generator-569"><span class="linenos"> 569</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-570"><a href="#Generator-570"><span class="linenos"> 570</span></a> <span class="p">)</span> +</span><span id="Generator-571"><a href="#Generator-571"><span class="linenos"> 571</span></a> <span class="n">ind_columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">ind_columns</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">postindex_props_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-572"><a href="#Generator-572"><span class="linenos"> 572</span></a> +</span><span id="Generator-573"><a href="#Generator-573"><span class="linenos"> 573</span></a> <span class="n">indexes_sql</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Generator-574"><a href="#Generator-574"><span class="linenos"> 574</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">ind_unique</span><span class="si">}{</span><span class="n">ind_primary</span><span class="si">}{</span><span class="n">ind_amp</span><span class="si">}</span><span class="s2"> INDEX</span><span class="si">{</span><span class="n">ind_name</span><span class="si">}{</span><span class="n">ind_columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-575"><a href="#Generator-575"><span class="linenos"> 575</span></a> <span class="p">)</span> +</span><span id="Generator-576"><a href="#Generator-576"><span class="linenos"> 576</span></a> <span class="n">index_sql</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">indexes_sql</span><span class="p">)</span> +</span><span id="Generator-577"><a href="#Generator-577"><span class="linenos"> 577</span></a> +</span><span id="Generator-578"><a href="#Generator-578"><span class="linenos"> 578</span></a> <span class="n">postcreate_props_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-579"><a href="#Generator-579"><span class="linenos"> 579</span></a> <span class="k">if</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">):</span> +</span><span id="Generator-580"><a href="#Generator-580"><span class="linenos"> 580</span></a> <span class="n">postcreate_props_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Generator-581"><a href="#Generator-581"><span class="linenos"> 581</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">]),</span> +</span><span id="Generator-582"><a href="#Generator-582"><span class="linenos"> 582</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> +</span><span id="Generator-583"><a href="#Generator-583"><span class="linenos"> 583</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> +</span><span id="Generator-584"><a href="#Generator-584"><span class="linenos"> 584</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-585"><a href="#Generator-585"><span class="linenos"> 585</span></a> <span class="p">)</span> +</span><span id="Generator-586"><a href="#Generator-586"><span class="linenos"> 586</span></a> +</span><span id="Generator-587"><a href="#Generator-587"><span class="linenos"> 587</span></a> <span class="n">modifiers</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-588"><a href="#Generator-588"><span class="linenos"> 588</span></a> <span class="p">(</span> +</span><span id="Generator-589"><a href="#Generator-589"><span class="linenos"> 589</span></a> <span class="n">replace</span><span class="p">,</span> +</span><span id="Generator-590"><a href="#Generator-590"><span class="linenos"> 590</span></a> <span class="n">temporary</span><span class="p">,</span> +</span><span id="Generator-591"><a href="#Generator-591"><span class="linenos"> 591</span></a> <span class="n">transient</span><span class="p">,</span> +</span><span id="Generator-592"><a href="#Generator-592"><span class="linenos"> 592</span></a> <span class="n">external</span><span class="p">,</span> +</span><span id="Generator-593"><a href="#Generator-593"><span class="linenos"> 593</span></a> <span class="n">unique</span><span class="p">,</span> +</span><span id="Generator-594"><a href="#Generator-594"><span class="linenos"> 594</span></a> <span class="n">materialized</span><span class="p">,</span> +</span><span id="Generator-595"><a href="#Generator-595"><span class="linenos"> 595</span></a> <span class="n">set_</span><span class="p">,</span> +</span><span id="Generator-596"><a href="#Generator-596"><span class="linenos"> 596</span></a> <span class="n">multiset</span><span class="p">,</span> +</span><span id="Generator-597"><a href="#Generator-597"><span class="linenos"> 597</span></a> <span class="n">global_temporary</span><span class="p">,</span> +</span><span id="Generator-598"><a href="#Generator-598"><span class="linenos"> 598</span></a> <span class="n">volatile</span><span class="p">,</span> +</span><span id="Generator-599"><a href="#Generator-599"><span class="linenos"> 599</span></a> <span class="n">postcreate_props_sql</span><span class="p">,</span> +</span><span id="Generator-600"><a href="#Generator-600"><span class="linenos"> 600</span></a> <span class="p">)</span> +</span><span id="Generator-601"><a href="#Generator-601"><span class="linenos"> 601</span></a> <span class="p">)</span> +</span><span id="Generator-602"><a href="#Generator-602"><span class="linenos"> 602</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-603"><a href="#Generator-603"><span class="linenos"> 603</span></a> <span class="s2">" WITH NO SCHEMA BINDING"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_schema_binding"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-604"><a href="#Generator-604"><span class="linenos"> 604</span></a> <span class="p">)</span> +</span><span id="Generator-605"><a href="#Generator-605"><span class="linenos"> 605</span></a> +</span><span id="Generator-606"><a href="#Generator-606"><span class="linenos"> 606</span></a> <span class="n">post_expression_modifiers</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">((</span><span class="n">data</span><span class="p">,</span> <span class="n">statistics</span><span class="p">,</span> <span class="n">no_primary_index</span><span class="p">))</span> +</span><span id="Generator-607"><a href="#Generator-607"><span class="linenos"> 607</span></a> +</span><span id="Generator-608"><a href="#Generator-608"><span class="linenos"> 608</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CREATE</span><span class="si">{</span><span class="n">modifiers</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">exists_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">properties_sql</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}{</span><span class="n">post_expression_modifiers</span><span class="si">}{</span><span class="n">index_sql</span><span class="si">}{</span><span class="n">no_schema_binding</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-609"><a href="#Generator-609"><span class="linenos"> 609</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_sql</span><span class="p">)</span> +</span><span id="Generator-610"><a href="#Generator-610"><span class="linenos"> 610</span></a> +</span><span id="Generator-611"><a href="#Generator-611"><span class="linenos"> 611</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-612"><a href="#Generator-612"><span class="linenos"> 612</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-613"><a href="#Generator-613"><span class="linenos"> 613</span></a> +</span><span id="Generator-614"><a href="#Generator-614"><span class="linenos"> 614</span></a> <span class="k">def</span> <span class="nf">prepend_ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-615"><a href="#Generator-615"><span class="linenos"> 615</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"with"</span><span class="p">)</span> +</span><span id="Generator-616"><a href="#Generator-616"><span class="linenos"> 616</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="Generator-617"><a href="#Generator-617"><span class="linenos"> 617</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">with_</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-618"><a href="#Generator-618"><span class="linenos"> 618</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator-619"><a href="#Generator-619"><span class="linenos"> 619</span></a> +</span><span id="Generator-620"><a href="#Generator-620"><span class="linenos"> 620</span></a> <span class="k">def</span> <span class="nf">with_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-621"><a href="#Generator-621"><span class="linenos"> 621</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-622"><a href="#Generator-622"><span class="linenos"> 622</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="s2">"RECURSIVE "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-623"><a href="#Generator-623"><span class="linenos"> 623</span></a> +</span><span id="Generator-624"><a href="#Generator-624"><span class="linenos"> 624</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WITH </span><span class="si">{</span><span class="n">recursive</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-625"><a href="#Generator-625"><span class="linenos"> 625</span></a> +</span><span id="Generator-626"><a href="#Generator-626"><span class="linenos"> 626</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-627"><a href="#Generator-627"><span class="linenos"> 627</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-628"><a href="#Generator-628"><span class="linenos"> 628</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-629"><a href="#Generator-629"><span class="linenos"> 629</span></a> +</span><span id="Generator-630"><a href="#Generator-630"><span class="linenos"> 630</span></a> <span class="k">def</span> <span class="nf">tablealias_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-631"><a href="#Generator-631"><span class="linenos"> 631</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-632"><a href="#Generator-632"><span class="linenos"> 632</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-633"><a href="#Generator-633"><span class="linenos"> 633</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-634"><a href="#Generator-634"><span class="linenos"> 634</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">alias</span><span class="si">}{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-635"><a href="#Generator-635"><span class="linenos"> 635</span></a> +</span><span id="Generator-636"><a href="#Generator-636"><span class="linenos"> 636</span></a> <span class="k">def</span> <span class="nf">bitstring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitString</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-637"><a href="#Generator-637"><span class="linenos"> 637</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-638"><a href="#Generator-638"><span class="linenos"> 638</span></a> +</span><span id="Generator-639"><a href="#Generator-639"><span class="linenos"> 639</span></a> <span class="k">def</span> <span class="nf">hexstring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">HexString</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-640"><a href="#Generator-640"><span class="linenos"> 640</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-641"><a href="#Generator-641"><span class="linenos"> 641</span></a> +</span><span id="Generator-642"><a href="#Generator-642"><span class="linenos"> 642</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-643"><a href="#Generator-643"><span class="linenos"> 643</span></a> <span class="n">type_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Generator-644"><a href="#Generator-644"><span class="linenos"> 644</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">type_value</span><span class="p">,</span> <span class="n">type_value</span><span class="o">.</span><span class="n">value</span><span class="p">)</span> +</span><span id="Generator-645"><a href="#Generator-645"><span class="linenos"> 645</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-646"><a href="#Generator-646"><span class="linenos"> 646</span></a> <span class="n">interior</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-647"><a href="#Generator-647"><span class="linenos"> 647</span></a> <span class="n">values</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-648"><a href="#Generator-648"><span class="linenos"> 648</span></a> <span class="k">if</span> <span class="n">interior</span><span class="p">:</span> +</span><span id="Generator-649"><a href="#Generator-649"><span class="linenos"> 649</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nested"</span><span class="p">):</span> +</span><span id="Generator-650"><a href="#Generator-650"><span class="linenos"> 650</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">STRUCT_DELIMITER</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}{</span><span class="n">interior</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">STRUCT_DELIMITER</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-651"><a href="#Generator-651"><span class="linenos"> 651</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"values"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-652"><a href="#Generator-652"><span class="linenos"> 652</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">)</span> <span class="k">if</span> <span class="n">type_value</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span> <span class="k">else</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="Generator-653"><a href="#Generator-653"><span class="linenos"> 653</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-654"><a href="#Generator-654"><span class="linenos"> 654</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">delimiters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'values'</span><span class="p">)</span><span class="si">}{</span><span class="n">delimiters</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-655"><a href="#Generator-655"><span class="linenos"> 655</span></a> <span class="p">)</span> +</span><span id="Generator-656"><a href="#Generator-656"><span class="linenos"> 656</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-657"><a href="#Generator-657"><span class="linenos"> 657</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">interior</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-658"><a href="#Generator-658"><span class="linenos"> 658</span></a> +</span><span id="Generator-659"><a href="#Generator-659"><span class="linenos"> 659</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}{</span><span class="n">nested</span><span class="si">}{</span><span class="n">values</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-660"><a href="#Generator-660"><span class="linenos"> 660</span></a> +</span><span id="Generator-661"><a href="#Generator-661"><span class="linenos"> 661</span></a> <span class="k">def</span> <span class="nf">directory_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-662"><a href="#Generator-662"><span class="linenos"> 662</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">"LOCAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-663"><a href="#Generator-663"><span class="linenos"> 663</span></a> <span class="n">row_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"row_format"</span><span class="p">)</span> +</span><span id="Generator-664"><a href="#Generator-664"><span class="linenos"> 664</span></a> <span class="n">row_format</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">row_format</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">row_format</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-665"><a href="#Generator-665"><span class="linenos"> 665</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">local</span><span class="si">}</span><span class="s2">DIRECTORY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">row_format</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-666"><a href="#Generator-666"><span class="linenos"> 666</span></a> +</span><span id="Generator-667"><a href="#Generator-667"><span class="linenos"> 667</span></a> <span class="k">def</span> <span class="nf">delete_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-668"><a href="#Generator-668"><span class="linenos"> 668</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-669"><a href="#Generator-669"><span class="linenos"> 669</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-670"><a href="#Generator-670"><span class="linenos"> 670</span></a> <span class="n">using_sql</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-671"><a href="#Generator-671"><span class="linenos"> 671</span></a> <span class="sa">f</span><span class="s2">" USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'using'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">', USING '</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-672"><a href="#Generator-672"><span class="linenos"> 672</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="Generator-673"><a href="#Generator-673"><span class="linenos"> 673</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-674"><a href="#Generator-674"><span class="linenos"> 674</span></a> <span class="p">)</span> +</span><span id="Generator-675"><a href="#Generator-675"><span class="linenos"> 675</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Generator-676"><a href="#Generator-676"><span class="linenos"> 676</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"DELETE</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">using_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-677"><a href="#Generator-677"><span class="linenos"> 677</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-678"><a href="#Generator-678"><span class="linenos"> 678</span></a> +</span><span id="Generator-679"><a href="#Generator-679"><span class="linenos"> 679</span></a> <span class="k">def</span> <span class="nf">drop_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-680"><a href="#Generator-680"><span class="linenos"> 680</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-681"><a href="#Generator-681"><span class="linenos"> 681</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="Generator-682"><a href="#Generator-682"><span class="linenos"> 682</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator-683"><a href="#Generator-683"><span class="linenos"> 683</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-684"><a href="#Generator-684"><span class="linenos"> 684</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="s2">" MATERIALIZED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"materialized"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-685"><a href="#Generator-685"><span class="linenos"> 685</span></a> <span class="n">cascade</span> <span class="o">=</span> <span class="s2">" CASCADE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cascade"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-686"><a href="#Generator-686"><span class="linenos"> 686</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DROP</span><span class="si">{</span><span class="n">temporary</span><span class="si">}{</span><span class="n">materialized</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">exists_sql</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">cascade</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-687"><a href="#Generator-687"><span class="linenos"> 687</span></a> +</span><span id="Generator-688"><a href="#Generator-688"><span class="linenos"> 688</span></a> <span class="k">def</span> <span class="nf">except_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-689"><a href="#Generator-689"><span class="linenos"> 689</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="Generator-690"><a href="#Generator-690"><span class="linenos"> 690</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator-691"><a href="#Generator-691"><span class="linenos"> 691</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="Generator-692"><a href="#Generator-692"><span class="linenos"> 692</span></a> <span class="p">)</span> +</span><span id="Generator-693"><a href="#Generator-693"><span class="linenos"> 693</span></a> +</span><span id="Generator-694"><a href="#Generator-694"><span class="linenos"> 694</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-695"><a href="#Generator-695"><span class="linenos"> 695</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-696"><a href="#Generator-696"><span class="linenos"> 696</span></a> +</span><span id="Generator-697"><a href="#Generator-697"><span class="linenos"> 697</span></a> <span class="k">def</span> <span class="nf">fetch_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-698"><a href="#Generator-698"><span class="linenos"> 698</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"direction"</span><span class="p">)</span> +</span><span id="Generator-699"><a href="#Generator-699"><span class="linenos"> 699</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">direction</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">direction</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-700"><a href="#Generator-700"><span class="linenos"> 700</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"count"</span><span class="p">)</span> +</span><span id="Generator-701"><a href="#Generator-701"><span class="linenos"> 701</span></a> <span class="n">count</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">count</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">count</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-702"><a href="#Generator-702"><span class="linenos"> 702</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'FETCH'</span><span class="p">)</span><span class="si">}{</span><span class="n">direction</span><span class="si">}{</span><span class="n">count</span><span class="si">}</span><span class="s2"> ROWS ONLY"</span> +</span><span id="Generator-703"><a href="#Generator-703"><span class="linenos"> 703</span></a> +</span><span id="Generator-704"><a href="#Generator-704"><span class="linenos"> 704</span></a> <span class="k">def</span> <span class="nf">filter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Filter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-705"><a href="#Generator-705"><span class="linenos"> 705</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-706"><a href="#Generator-706"><span class="linenos"> 706</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> <span class="c1"># where has a leading space</span> +</span><span id="Generator-707"><a href="#Generator-707"><span class="linenos"> 707</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> FILTER(</span><span class="si">{</span><span class="n">where</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-708"><a href="#Generator-708"><span class="linenos"> 708</span></a> +</span><span id="Generator-709"><a href="#Generator-709"><span class="linenos"> 709</span></a> <span class="k">def</span> <span class="nf">hint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-710"><a href="#Generator-710"><span class="linenos"> 710</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">):</span> +</span><span id="Generator-711"><a href="#Generator-711"><span class="linenos"> 711</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Hints are not supported"</span><span class="p">)</span> +</span><span id="Generator-712"><a href="#Generator-712"><span class="linenos"> 712</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator-713"><a href="#Generator-713"><span class="linenos"> 713</span></a> +</span><span id="Generator-714"><a href="#Generator-714"><span class="linenos"> 714</span></a> <span class="k">def</span> <span class="nf">index_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-715"><a href="#Generator-715"><span class="linenos"> 715</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-716"><a href="#Generator-716"><span class="linenos"> 716</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">)</span> +</span><span id="Generator-717"><a href="#Generator-717"><span class="linenos"> 717</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"columns"</span><span class="p">)</span> +</span><span id="Generator-718"><a href="#Generator-718"><span class="linenos"> 718</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> ON </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-719"><a href="#Generator-719"><span class="linenos"> 719</span></a> +</span><span id="Generator-720"><a href="#Generator-720"><span class="linenos"> 720</span></a> <span class="k">def</span> <span class="nf">identifier_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-721"><a href="#Generator-721"><span class="linenos"> 721</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> +</span><span id="Generator-722"><a href="#Generator-722"><span class="linenos"> 722</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize</span> <span class="k">else</span> <span class="n">text</span> +</span><span id="Generator-723"><a href="#Generator-723"><span class="linenos"> 723</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_identifier_end</span><span class="p">)</span> +</span><span id="Generator-724"><a href="#Generator-724"><span class="linenos"> 724</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span><span class="p">:</span> +</span><span id="Generator-725"><a href="#Generator-725"><span class="linenos"> 725</span></a> <span class="n">text</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span><span class="si">}{</span><span class="n">text</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-726"><a href="#Generator-726"><span class="linenos"> 726</span></a> <span class="k">return</span> <span class="n">text</span> +</span><span id="Generator-727"><a href="#Generator-727"><span class="linenos"> 727</span></a> +</span><span id="Generator-728"><a href="#Generator-728"><span class="linenos"> 728</span></a> <span class="k">def</span> <span class="nf">national_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">National</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-729"><a href="#Generator-729"><span class="linenos"> 729</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"N</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-730"><a href="#Generator-730"><span class="linenos"> 730</span></a> +</span><span id="Generator-731"><a href="#Generator-731"><span class="linenos"> 731</span></a> <span class="k">def</span> <span class="nf">partition_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Partition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-732"><a href="#Generator-732"><span class="linenos"> 732</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-733"><a href="#Generator-733"><span class="linenos"> 733</span></a> +</span><span id="Generator-734"><a href="#Generator-734"><span class="linenos"> 734</span></a> <span class="k">def</span> <span class="nf">properties_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-735"><a href="#Generator-735"><span class="linenos"> 735</span></a> <span class="n">root_properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-736"><a href="#Generator-736"><span class="linenos"> 736</span></a> <span class="n">with_properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-737"><a href="#Generator-737"><span class="linenos"> 737</span></a> +</span><span id="Generator-738"><a href="#Generator-738"><span class="linenos"> 738</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator-739"><a href="#Generator-739"><span class="linenos"> 739</span></a> <span class="n">p_loc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="vm">__class__</span><span class="p">]</span> +</span><span id="Generator-740"><a href="#Generator-740"><span class="linenos"> 740</span></a> <span class="k">if</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">:</span> +</span><span id="Generator-741"><a href="#Generator-741"><span class="linenos"> 741</span></a> <span class="n">with_properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-742"><a href="#Generator-742"><span class="linenos"> 742</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">:</span> +</span><span id="Generator-743"><a href="#Generator-743"><span class="linenos"> 743</span></a> <span class="n">root_properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-744"><a href="#Generator-744"><span class="linenos"> 744</span></a> +</span><span id="Generator-745"><a href="#Generator-745"><span class="linenos"> 745</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">root_properties</span><span class="p">(</span> +</span><span id="Generator-746"><a href="#Generator-746"><span class="linenos"> 746</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">root_properties</span><span class="p">)</span> +</span><span id="Generator-747"><a href="#Generator-747"><span class="linenos"> 747</span></a> <span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">with_properties</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">with_properties</span><span class="p">))</span> +</span><span id="Generator-748"><a href="#Generator-748"><span class="linenos"> 748</span></a> +</span><span id="Generator-749"><a href="#Generator-749"><span class="linenos"> 749</span></a> <span class="k">def</span> <span class="nf">root_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-750"><a href="#Generator-750"><span class="linenos"> 750</span></a> <span class="k">if</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator-751"><a href="#Generator-751"><span class="linenos"> 751</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator-752"><a href="#Generator-752"><span class="linenos"> 752</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator-753"><a href="#Generator-753"><span class="linenos"> 753</span></a> +</span><span id="Generator-754"><a href="#Generator-754"><span class="linenos"> 754</span></a> <span class="k">def</span> <span class="nf">properties</span><span class="p">(</span> +</span><span id="Generator-755"><a href="#Generator-755"><span class="linenos"> 755</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator-756"><a href="#Generator-756"><span class="linenos"> 756</span></a> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">,</span> +</span><span id="Generator-757"><a href="#Generator-757"><span class="linenos"> 757</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator-758"><a href="#Generator-758"><span class="linenos"> 758</span></a> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">,</span> +</span><span id="Generator-759"><a href="#Generator-759"><span class="linenos"> 759</span></a> <span class="n">suffix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator-760"><a href="#Generator-760"><span class="linenos"> 760</span></a> <span class="n">wrapped</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Generator-761"><a href="#Generator-761"><span class="linenos"> 761</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-762"><a href="#Generator-762"><span class="linenos"> 762</span></a> <span class="k">if</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator-763"><a href="#Generator-763"><span class="linenos"> 763</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="n">sep</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator-764"><a href="#Generator-764"><span class="linenos"> 764</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="k">if</span> <span class="n">wrapped</span> <span class="k">else</span> <span class="n">expressions</span> +</span><span id="Generator-765"><a href="#Generator-765"><span class="linenos"> 765</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="s1">' '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">prefix</span><span class="w"> </span><span class="ow">and</span><span class="w"> </span><span class="n">prefix</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="s1">' '</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">suffix</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-766"><a href="#Generator-766"><span class="linenos"> 766</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator-767"><a href="#Generator-767"><span class="linenos"> 767</span></a> +</span><span id="Generator-768"><a href="#Generator-768"><span class="linenos"> 768</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-769"><a href="#Generator-769"><span class="linenos"> 769</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">))</span> +</span><span id="Generator-770"><a href="#Generator-770"><span class="linenos"> 770</span></a> +</span><span id="Generator-771"><a href="#Generator-771"><span class="linenos"> 771</span></a> <span class="k">def</span> <span class="nf">locate_properties</span><span class="p">(</span> +</span><span id="Generator-772"><a href="#Generator-772"><span class="linenos"> 772</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span> +</span><span id="Generator-773"><a href="#Generator-773"><span class="linenos"> 773</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]]:</span> +</span><span id="Generator-774"><a href="#Generator-774"><span class="linenos"> 774</span></a> <span class="n">properties_locs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Generator-775"><a href="#Generator-775"><span class="linenos"> 775</span></a> <span class="n">key</span><span class="p">:</span> <span class="p">[]</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span> +</span><span id="Generator-776"><a href="#Generator-776"><span class="linenos"> 776</span></a> <span class="p">}</span> +</span><span id="Generator-777"><a href="#Generator-777"><span class="linenos"> 777</span></a> +</span><span id="Generator-778"><a href="#Generator-778"><span class="linenos"> 778</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator-779"><a href="#Generator-779"><span class="linenos"> 779</span></a> <span class="n">p_loc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="vm">__class__</span><span class="p">]</span> +</span><span id="Generator-780"><a href="#Generator-780"><span class="linenos"> 780</span></a> <span class="k">if</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">:</span> +</span><span id="Generator-781"><a href="#Generator-781"><span class="linenos"> 781</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-782"><a href="#Generator-782"><span class="linenos"> 782</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">:</span> +</span><span id="Generator-783"><a href="#Generator-783"><span class="linenos"> 783</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-784"><a href="#Generator-784"><span class="linenos"> 784</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">:</span> +</span><span id="Generator-785"><a href="#Generator-785"><span class="linenos"> 785</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-786"><a href="#Generator-786"><span class="linenos"> 786</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">:</span> +</span><span id="Generator-787"><a href="#Generator-787"><span class="linenos"> 787</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-788"><a href="#Generator-788"><span class="linenos"> 788</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">:</span> +</span><span id="Generator-789"><a href="#Generator-789"><span class="linenos"> 789</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator-790"><a href="#Generator-790"><span class="linenos"> 790</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">:</span> +</span><span id="Generator-791"><a href="#Generator-791"><span class="linenos"> 791</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-792"><a href="#Generator-792"><span class="linenos"> 792</span></a> +</span><span id="Generator-793"><a href="#Generator-793"><span class="linenos"> 793</span></a> <span class="k">return</span> <span class="n">properties_locs</span> +</span><span id="Generator-794"><a href="#Generator-794"><span class="linenos"> 794</span></a> +</span><span id="Generator-795"><a href="#Generator-795"><span class="linenos"> 795</span></a> <span class="k">def</span> <span class="nf">property_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-796"><a href="#Generator-796"><span class="linenos"> 796</span></a> <span class="n">property_cls</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span> +</span><span id="Generator-797"><a href="#Generator-797"><span class="linenos"> 797</span></a> <span class="k">if</span> <span class="n">property_cls</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> +</span><span id="Generator-798"><a href="#Generator-798"><span class="linenos"> 798</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-799"><a href="#Generator-799"><span class="linenos"> 799</span></a> +</span><span id="Generator-800"><a href="#Generator-800"><span class="linenos"> 800</span></a> <span class="n">property_name</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">PROPERTY_TO_NAME</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">property_cls</span><span class="p">)</span> +</span><span id="Generator-801"><a href="#Generator-801"><span class="linenos"> 801</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">property_name</span><span class="p">:</span> +</span><span id="Generator-802"><a href="#Generator-802"><span class="linenos"> 802</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-803"><a href="#Generator-803"><span class="linenos"> 803</span></a> +</span><span id="Generator-804"><a href="#Generator-804"><span class="linenos"> 804</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">property_name</span><span class="si">}</span><span class="s2">=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-805"><a href="#Generator-805"><span class="linenos"> 805</span></a> +</span><span id="Generator-806"><a href="#Generator-806"><span class="linenos"> 806</span></a> <span class="k">def</span> <span class="nf">likeproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-807"><a href="#Generator-807"><span class="linenos"> 807</span></a> <span class="n">options</span> <span class="o">=</span> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator-808"><a href="#Generator-808"><span class="linenos"> 808</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-809"><a href="#Generator-809"><span class="linenos"> 809</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LIKE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-810"><a href="#Generator-810"><span class="linenos"> 810</span></a> +</span><span id="Generator-811"><a href="#Generator-811"><span class="linenos"> 811</span></a> <span class="k">def</span> <span class="nf">fallbackproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-812"><a href="#Generator-812"><span class="linenos"> 812</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-813"><a href="#Generator-813"><span class="linenos"> 813</span></a> <span class="n">protection</span> <span class="o">=</span> <span class="s2">" PROTECTION"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"protection"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-814"><a href="#Generator-814"><span class="linenos"> 814</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}</span><span class="s2">FALLBACK</span><span class="si">{</span><span class="n">protection</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-815"><a href="#Generator-815"><span class="linenos"> 815</span></a> +</span><span id="Generator-816"><a href="#Generator-816"><span class="linenos"> 816</span></a> <span class="k">def</span> <span class="nf">journalproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-817"><a href="#Generator-817"><span class="linenos"> 817</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-818"><a href="#Generator-818"><span class="linenos"> 818</span></a> <span class="n">dual</span> <span class="o">=</span> <span class="s2">"DUAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"dual"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-819"><a href="#Generator-819"><span class="linenos"> 819</span></a> <span class="n">before</span> <span class="o">=</span> <span class="s2">"BEFORE "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"before"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-820"><a href="#Generator-820"><span class="linenos"> 820</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">dual</span><span class="si">}{</span><span class="n">before</span><span class="si">}</span><span class="s2">JOURNAL"</span> +</span><span id="Generator-821"><a href="#Generator-821"><span class="linenos"> 821</span></a> +</span><span id="Generator-822"><a href="#Generator-822"><span class="linenos"> 822</span></a> <span class="k">def</span> <span class="nf">freespaceproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-823"><a href="#Generator-823"><span class="linenos"> 823</span></a> <span class="n">freespace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-824"><a href="#Generator-824"><span class="linenos"> 824</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="s2">" PERCENT"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"percent"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-825"><a href="#Generator-825"><span class="linenos"> 825</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FREESPACE=</span><span class="si">{</span><span class="n">freespace</span><span class="si">}{</span><span class="n">percent</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-826"><a href="#Generator-826"><span class="linenos"> 826</span></a> +</span><span id="Generator-827"><a href="#Generator-827"><span class="linenos"> 827</span></a> <span class="k">def</span> <span class="nf">afterjournalproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-828"><a href="#Generator-828"><span class="linenos"> 828</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-829"><a href="#Generator-829"><span class="linenos"> 829</span></a> <span class="n">dual</span> <span class="o">=</span> <span class="s2">"DUAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"dual"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-830"><a href="#Generator-830"><span class="linenos"> 830</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-831"><a href="#Generator-831"><span class="linenos"> 831</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-832"><a href="#Generator-832"><span class="linenos"> 832</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">"LOCAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"NOT LOCAL "</span> +</span><span id="Generator-833"><a href="#Generator-833"><span class="linenos"> 833</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">dual</span><span class="si">}{</span><span class="n">local</span><span class="si">}</span><span class="s2">AFTER JOURNAL"</span> +</span><span id="Generator-834"><a href="#Generator-834"><span class="linenos"> 834</span></a> +</span><span id="Generator-835"><a href="#Generator-835"><span class="linenos"> 835</span></a> <span class="k">def</span> <span class="nf">checksumproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-836"><a href="#Generator-836"><span class="linenos"> 836</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">):</span> +</span><span id="Generator-837"><a href="#Generator-837"><span class="linenos"> 837</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="Generator-838"><a href="#Generator-838"><span class="linenos"> 838</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">):</span> +</span><span id="Generator-839"><a href="#Generator-839"><span class="linenos"> 839</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"ON"</span> +</span><span id="Generator-840"><a href="#Generator-840"><span class="linenos"> 840</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-841"><a href="#Generator-841"><span class="linenos"> 841</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"OFF"</span> +</span><span id="Generator-842"><a href="#Generator-842"><span class="linenos"> 842</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECKSUM=</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-843"><a href="#Generator-843"><span class="linenos"> 843</span></a> +</span><span id="Generator-844"><a href="#Generator-844"><span class="linenos"> 844</span></a> <span class="k">def</span> <span class="nf">mergeblockratioproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-845"><a href="#Generator-845"><span class="linenos"> 845</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">):</span> +</span><span id="Generator-846"><a href="#Generator-846"><span class="linenos"> 846</span></a> <span class="k">return</span> <span class="s2">"NO MERGEBLOCKRATIO"</span> +</span><span id="Generator-847"><a href="#Generator-847"><span class="linenos"> 847</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">):</span> +</span><span id="Generator-848"><a href="#Generator-848"><span class="linenos"> 848</span></a> <span class="k">return</span> <span class="s2">"DEFAULT MERGEBLOCKRATIO"</span> +</span><span id="Generator-849"><a href="#Generator-849"><span class="linenos"> 849</span></a> +</span><span id="Generator-850"><a href="#Generator-850"><span class="linenos"> 850</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="s2">" PERCENT"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"percent"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-851"><a href="#Generator-851"><span class="linenos"> 851</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MERGEBLOCKRATIO=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">percent</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-852"><a href="#Generator-852"><span class="linenos"> 852</span></a> +</span><span id="Generator-853"><a href="#Generator-853"><span class="linenos"> 853</span></a> <span class="k">def</span> <span class="nf">datablocksizeproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-854"><a href="#Generator-854"><span class="linenos"> 854</span></a> <span class="n">default</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator-855"><a href="#Generator-855"><span class="linenos"> 855</span></a> <span class="nb">min</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"min"</span><span class="p">)</span> +</span><span id="Generator-856"><a href="#Generator-856"><span class="linenos"> 856</span></a> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">min</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-857"><a href="#Generator-857"><span class="linenos"> 857</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator-858"><a href="#Generator-858"><span class="linenos"> 858</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="Generator-859"><a href="#Generator-859"><span class="linenos"> 859</span></a> <span class="k">elif</span> <span class="nb">min</span><span class="p">:</span> +</span><span id="Generator-860"><a href="#Generator-860"><span class="linenos"> 860</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MINIMUM"</span> +</span><span id="Generator-861"><a href="#Generator-861"><span class="linenos"> 861</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-862"><a href="#Generator-862"><span class="linenos"> 862</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MAXIMUM"</span> +</span><span id="Generator-863"><a href="#Generator-863"><span class="linenos"> 863</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2"> DATABLOCKSIZE"</span> +</span><span id="Generator-864"><a href="#Generator-864"><span class="linenos"> 864</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-865"><a href="#Generator-865"><span class="linenos"> 865</span></a> <span class="n">units</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"units"</span><span class="p">)</span> +</span><span id="Generator-866"><a href="#Generator-866"><span class="linenos"> 866</span></a> <span class="n">units</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">units</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">units</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-867"><a href="#Generator-867"><span class="linenos"> 867</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATABLOCKSIZE=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</span><span class="p">)</span><span class="si">}{</span><span class="n">units</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-868"><a href="#Generator-868"><span class="linenos"> 868</span></a> +</span><span id="Generator-869"><a href="#Generator-869"><span class="linenos"> 869</span></a> <span class="k">def</span> <span class="nf">blockcompressionproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-870"><a href="#Generator-870"><span class="linenos"> 870</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"autotemp"</span><span class="p">)</span> +</span><span id="Generator-871"><a href="#Generator-871"><span class="linenos"> 871</span></a> <span class="n">always</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"always"</span><span class="p">)</span> +</span><span id="Generator-872"><a href="#Generator-872"><span class="linenos"> 872</span></a> <span class="n">default</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator-873"><a href="#Generator-873"><span class="linenos"> 873</span></a> <span class="n">manual</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"manual"</span><span class="p">)</span> +</span><span id="Generator-874"><a href="#Generator-874"><span class="linenos"> 874</span></a> <span class="n">never</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"never"</span><span class="p">)</span> +</span><span id="Generator-875"><a href="#Generator-875"><span class="linenos"> 875</span></a> +</span><span id="Generator-876"><a href="#Generator-876"><span class="linenos"> 876</span></a> <span class="k">if</span> <span class="n">autotemp</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-877"><a href="#Generator-877"><span class="linenos"> 877</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"AUTOTEMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">autotemp</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-878"><a href="#Generator-878"><span class="linenos"> 878</span></a> <span class="k">elif</span> <span class="n">always</span><span class="p">:</span> +</span><span id="Generator-879"><a href="#Generator-879"><span class="linenos"> 879</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"ALWAYS"</span> +</span><span id="Generator-880"><a href="#Generator-880"><span class="linenos"> 880</span></a> <span class="k">elif</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator-881"><a href="#Generator-881"><span class="linenos"> 881</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="Generator-882"><a href="#Generator-882"><span class="linenos"> 882</span></a> <span class="k">elif</span> <span class="n">manual</span><span class="p">:</span> +</span><span id="Generator-883"><a href="#Generator-883"><span class="linenos"> 883</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MANUAL"</span> +</span><span id="Generator-884"><a href="#Generator-884"><span class="linenos"> 884</span></a> <span class="k">elif</span> <span class="n">never</span><span class="p">:</span> +</span><span id="Generator-885"><a href="#Generator-885"><span class="linenos"> 885</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"NEVER"</span> +</span><span id="Generator-886"><a href="#Generator-886"><span class="linenos"> 886</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BLOCKCOMPRESSION=</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-887"><a href="#Generator-887"><span class="linenos"> 887</span></a> +</span><span id="Generator-888"><a href="#Generator-888"><span class="linenos"> 888</span></a> <span class="k">def</span> <span class="nf">isolatedloadingproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-889"><a href="#Generator-889"><span class="linenos"> 889</span></a> <span class="n">no</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> +</span><span id="Generator-890"><a href="#Generator-890"><span class="linenos"> 890</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">" NO"</span> <span class="k">if</span> <span class="n">no</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-891"><a href="#Generator-891"><span class="linenos"> 891</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"concurrent"</span><span class="p">)</span> +</span><span id="Generator-892"><a href="#Generator-892"><span class="linenos"> 892</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="s2">" CONCURRENT"</span> <span class="k">if</span> <span class="n">concurrent</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-893"><a href="#Generator-893"><span class="linenos"> 893</span></a> +</span><span id="Generator-894"><a href="#Generator-894"><span class="linenos"> 894</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-895"><a href="#Generator-895"><span class="linenos"> 895</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_all"</span><span class="p">):</span> +</span><span id="Generator-896"><a href="#Generator-896"><span class="linenos"> 896</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR ALL"</span> +</span><span id="Generator-897"><a href="#Generator-897"><span class="linenos"> 897</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_insert"</span><span class="p">):</span> +</span><span id="Generator-898"><a href="#Generator-898"><span class="linenos"> 898</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR INSERT"</span> +</span><span id="Generator-899"><a href="#Generator-899"><span class="linenos"> 899</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_none"</span><span class="p">):</span> +</span><span id="Generator-900"><a href="#Generator-900"><span class="linenos"> 900</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR NONE"</span> +</span><span id="Generator-901"><a href="#Generator-901"><span class="linenos"> 901</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WITH</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">concurrent</span><span class="si">}</span><span class="s2"> ISOLATED LOADING</span><span class="si">{</span><span class="n">for_</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-902"><a href="#Generator-902"><span class="linenos"> 902</span></a> +</span><span id="Generator-903"><a href="#Generator-903"><span class="linenos"> 903</span></a> <span class="k">def</span> <span class="nf">insert_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-904"><a href="#Generator-904"><span class="linenos"> 904</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"overwrite"</span><span class="p">)</span> +</span><span id="Generator-905"><a href="#Generator-905"><span class="linenos"> 905</span></a> +</span><span id="Generator-906"><a href="#Generator-906"><span class="linenos"> 906</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">):</span> +</span><span id="Generator-907"><a href="#Generator-907"><span class="linenos"> 907</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">"OVERWRITE "</span> <span class="k">if</span> <span class="n">overwrite</span> <span class="k">else</span> <span class="s2">"INTO "</span> +</span><span id="Generator-908"><a href="#Generator-908"><span class="linenos"> 908</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-909"><a href="#Generator-909"><span class="linenos"> 909</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">"OVERWRITE TABLE "</span> <span class="k">if</span> <span class="n">overwrite</span> <span class="k">else</span> <span class="s2">"INTO "</span> +</span><span id="Generator-910"><a href="#Generator-910"><span class="linenos"> 910</span></a> +</span><span id="Generator-911"><a href="#Generator-911"><span class="linenos"> 911</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-912"><a href="#Generator-912"><span class="linenos"> 912</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator-913"><a href="#Generator-913"><span class="linenos"> 913</span></a> <span class="n">partition_sql</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-914"><a href="#Generator-914"><span class="linenos"> 914</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"partition"</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"partition"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-915"><a href="#Generator-915"><span class="linenos"> 915</span></a> <span class="p">)</span> +</span><span id="Generator-916"><a href="#Generator-916"><span class="linenos"> 916</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator-917"><a href="#Generator-917"><span class="linenos"> 917</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span> <span class="k">if</span> <span class="n">partition_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-918"><a href="#Generator-918"><span class="linenos"> 918</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INSERT </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">exists</span><span class="si">}{</span><span class="n">partition_sql</span><span class="si">}{</span><span class="n">sep</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-919"><a href="#Generator-919"><span class="linenos"> 919</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-920"><a href="#Generator-920"><span class="linenos"> 920</span></a> +</span><span id="Generator-921"><a href="#Generator-921"><span class="linenos"> 921</span></a> <span class="k">def</span> <span class="nf">intersect_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-922"><a href="#Generator-922"><span class="linenos"> 922</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="Generator-923"><a href="#Generator-923"><span class="linenos"> 923</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator-924"><a href="#Generator-924"><span class="linenos"> 924</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="Generator-925"><a href="#Generator-925"><span class="linenos"> 925</span></a> <span class="p">)</span> +</span><span id="Generator-926"><a href="#Generator-926"><span class="linenos"> 926</span></a> +</span><span id="Generator-927"><a href="#Generator-927"><span class="linenos"> 927</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-928"><a href="#Generator-928"><span class="linenos"> 928</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-929"><a href="#Generator-929"><span class="linenos"> 929</span></a> +</span><span id="Generator-930"><a href="#Generator-930"><span class="linenos"> 930</span></a> <span class="k">def</span> <span class="nf">introducer_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Introducer</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-931"><a href="#Generator-931"><span class="linenos"> 931</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-932"><a href="#Generator-932"><span class="linenos"> 932</span></a> +</span><span id="Generator-933"><a href="#Generator-933"><span class="linenos"> 933</span></a> <span class="k">def</span> <span class="nf">pseudotype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PseudoType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-934"><a href="#Generator-934"><span class="linenos"> 934</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Generator-935"><a href="#Generator-935"><span class="linenos"> 935</span></a> +</span><span id="Generator-936"><a href="#Generator-936"><span class="linenos"> 936</span></a> <span class="k">def</span> <span class="nf">rowformatdelimitedproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-937"><a href="#Generator-937"><span class="linenos"> 937</span></a> <span class="n">fields</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"fields"</span><span class="p">)</span> +</span><span id="Generator-938"><a href="#Generator-938"><span class="linenos"> 938</span></a> <span class="n">fields</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FIELDS TERMINATED BY </span><span class="si">{</span><span class="n">fields</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">fields</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-939"><a href="#Generator-939"><span class="linenos"> 939</span></a> <span class="n">escaped</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"escaped"</span><span class="p">)</span> +</span><span id="Generator-940"><a href="#Generator-940"><span class="linenos"> 940</span></a> <span class="n">escaped</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ESCAPED BY </span><span class="si">{</span><span class="n">escaped</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">escaped</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-941"><a href="#Generator-941"><span class="linenos"> 941</span></a> <span class="n">items</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"collection_items"</span><span class="p">)</span> +</span><span id="Generator-942"><a href="#Generator-942"><span class="linenos"> 942</span></a> <span class="n">items</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLECTION ITEMS TERMINATED BY </span><span class="si">{</span><span class="n">items</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">items</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-943"><a href="#Generator-943"><span class="linenos"> 943</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"map_keys"</span><span class="p">)</span> +</span><span id="Generator-944"><a href="#Generator-944"><span class="linenos"> 944</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" MAP KEYS TERMINATED BY </span><span class="si">{</span><span class="n">keys</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">keys</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-945"><a href="#Generator-945"><span class="linenos"> 945</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"lines"</span><span class="p">)</span> +</span><span id="Generator-946"><a href="#Generator-946"><span class="linenos"> 946</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" LINES TERMINATED BY </span><span class="si">{</span><span class="n">lines</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">lines</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-947"><a href="#Generator-947"><span class="linenos"> 947</span></a> <span class="n">null</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"null"</span><span class="p">)</span> +</span><span id="Generator-948"><a href="#Generator-948"><span class="linenos"> 948</span></a> <span class="n">null</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" NULL DEFINED AS </span><span class="si">{</span><span class="n">null</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">null</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-949"><a href="#Generator-949"><span class="linenos"> 949</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ROW FORMAT DELIMITED</span><span class="si">{</span><span class="n">fields</span><span class="si">}{</span><span class="n">escaped</span><span class="si">}{</span><span class="n">items</span><span class="si">}{</span><span class="n">keys</span><span class="si">}{</span><span class="n">lines</span><span class="si">}{</span><span class="n">null</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-950"><a href="#Generator-950"><span class="linenos"> 950</span></a> +</span><span id="Generator-951"><a href="#Generator-951"><span class="linenos"> 951</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" AS "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-952"><a href="#Generator-952"><span class="linenos"> 952</span></a> <span class="n">table</span> <span class="o">=</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-953"><a href="#Generator-953"><span class="linenos"> 953</span></a> <span class="n">part</span> +</span><span id="Generator-954"><a href="#Generator-954"><span class="linenos"> 954</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="Generator-955"><a href="#Generator-955"><span class="linenos"> 955</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">),</span> +</span><span id="Generator-956"><a href="#Generator-956"><span class="linenos"> 956</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">),</span> +</span><span id="Generator-957"><a href="#Generator-957"><span class="linenos"> 957</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="Generator-958"><a href="#Generator-958"><span class="linenos"> 958</span></a> <span class="p">]</span> +</span><span id="Generator-959"><a href="#Generator-959"><span class="linenos"> 959</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="Generator-960"><a href="#Generator-960"><span class="linenos"> 960</span></a> <span class="p">)</span> +</span><span id="Generator-961"><a href="#Generator-961"><span class="linenos"> 961</span></a> +</span><span id="Generator-962"><a href="#Generator-962"><span class="linenos"> 962</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-963"><a href="#Generator-963"><span class="linenos"> 963</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-964"><a href="#Generator-964"><span class="linenos"> 964</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"hints"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">", "</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-965"><a href="#Generator-965"><span class="linenos"> 965</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITH (</span><span class="si">{</span><span class="n">hints</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">hints</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-966"><a href="#Generator-966"><span class="linenos"> 966</span></a> <span class="n">laterals</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"laterals"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator-967"><a href="#Generator-967"><span class="linenos"> 967</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"joins"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator-968"><a href="#Generator-968"><span class="linenos"> 968</span></a> <span class="n">pivots</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"pivots"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator-969"><a href="#Generator-969"><span class="linenos"> 969</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"system_time"</span><span class="p">)</span> +</span><span id="Generator-970"><a href="#Generator-970"><span class="linenos"> 970</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'system_time'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">system_time</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-971"><a href="#Generator-971"><span class="linenos"> 971</span></a> +</span><span id="Generator-972"><a href="#Generator-972"><span class="linenos"> 972</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">pivots</span><span class="p">:</span> +</span><span id="Generator-973"><a href="#Generator-973"><span class="linenos"> 973</span></a> <span class="n">pivots</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">pivots</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-974"><a href="#Generator-974"><span class="linenos"> 974</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-975"><a href="#Generator-975"><span class="linenos"> 975</span></a> +</span><span id="Generator-976"><a href="#Generator-976"><span class="linenos"> 976</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="n">system_time</span><span class="si">}{</span><span class="n">alias</span><span class="si">}{</span><span class="n">hints</span><span class="si">}{</span><span class="n">laterals</span><span class="si">}{</span><span class="n">joins</span><span class="si">}{</span><span class="n">pivots</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-977"><a href="#Generator-977"><span class="linenos"> 977</span></a> +</span><span id="Generator-978"><a href="#Generator-978"><span class="linenos"> 978</span></a> <span class="k">def</span> <span class="nf">tablesample_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-979"><a href="#Generator-979"><span class="linenos"> 979</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="Generator-980"><a href="#Generator-980"><span class="linenos"> 980</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-981"><a href="#Generator-981"><span class="linenos"> 981</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'alias'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-982"><a href="#Generator-982"><span class="linenos"> 982</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-983"><a href="#Generator-983"><span class="linenos"> 983</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-984"><a href="#Generator-984"><span class="linenos"> 984</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-985"><a href="#Generator-985"><span class="linenos"> 985</span></a> <span class="n">method</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"method"</span><span class="p">)</span> +</span><span id="Generator-986"><a href="#Generator-986"><span class="linenos"> 986</span></a> <span class="n">method</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">method</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">method</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-987"><a href="#Generator-987"><span class="linenos"> 987</span></a> <span class="n">numerator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_numerator"</span><span class="p">)</span> +</span><span id="Generator-988"><a href="#Generator-988"><span class="linenos"> 988</span></a> <span class="n">denominator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_denominator"</span><span class="p">)</span> +</span><span id="Generator-989"><a href="#Generator-989"><span class="linenos"> 989</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_field"</span><span class="p">)</span> +</span><span id="Generator-990"><a href="#Generator-990"><span class="linenos"> 990</span></a> <span class="n">field</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON </span><span class="si">{</span><span class="n">field</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">field</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-991"><a href="#Generator-991"><span class="linenos"> 991</span></a> <span class="n">bucket</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"BUCKET </span><span class="si">{</span><span class="n">numerator</span><span class="si">}</span><span class="s2"> OUT OF </span><span class="si">{</span><span class="n">denominator</span><span class="si">}{</span><span class="n">field</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">numerator</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-992"><a href="#Generator-992"><span class="linenos"> 992</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">)</span> +</span><span id="Generator-993"><a href="#Generator-993"><span class="linenos"> 993</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">percent</span><span class="si">}</span><span class="s2"> PERCENT"</span> <span class="k">if</span> <span class="n">percent</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-994"><a href="#Generator-994"><span class="linenos"> 994</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"rows"</span><span class="p">)</span> +</span><span id="Generator-995"><a href="#Generator-995"><span class="linenos"> 995</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">rows</span><span class="si">}</span><span class="s2"> ROWS"</span> <span class="k">if</span> <span class="n">rows</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-996"><a href="#Generator-996"><span class="linenos"> 996</span></a> <span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"size"</span><span class="p">)</span> +</span><span id="Generator-997"><a href="#Generator-997"><span class="linenos"> 997</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"seed"</span><span class="p">)</span> +</span><span id="Generator-998"><a href="#Generator-998"><span class="linenos"> 998</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" SEED (</span><span class="si">{</span><span class="n">seed</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">seed</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-999"><a href="#Generator-999"><span class="linenos"> 999</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TABLESAMPLE</span><span class="si">{</span><span class="n">method</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">bucket</span><span class="si">}{</span><span class="n">percent</span><span class="si">}{</span><span class="n">rows</span><span class="si">}{</span><span class="n">size</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">seed</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1000"><a href="#Generator-1000"><span class="linenos">1000</span></a> +</span><span id="Generator-1001"><a href="#Generator-1001"><span class="linenos">1001</span></a> <span class="k">def</span> <span class="nf">pivot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1002"><a href="#Generator-1002"><span class="linenos">1002</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1003"><a href="#Generator-1003"><span class="linenos">1003</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unpivot"</span><span class="p">)</span> +</span><span id="Generator-1004"><a href="#Generator-1004"><span class="linenos">1004</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="s2">"UNPIVOT"</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="s2">"PIVOT"</span> +</span><span id="Generator-1005"><a href="#Generator-1005"><span class="linenos">1005</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Generator-1006"><a href="#Generator-1006"><span class="linenos">1006</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"field"</span><span class="p">)</span> +</span><span id="Generator-1007"><a href="#Generator-1007"><span class="linenos">1007</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">direction</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2"> FOR </span><span class="si">{</span><span class="n">field</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1008"><a href="#Generator-1008"><span class="linenos">1008</span></a> +</span><span id="Generator-1009"><a href="#Generator-1009"><span class="linenos">1009</span></a> <span class="k">def</span> <span class="nf">tuple_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1010"><a href="#Generator-1010"><span class="linenos">1010</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1011"><a href="#Generator-1011"><span class="linenos">1011</span></a> +</span><span id="Generator-1012"><a href="#Generator-1012"><span class="linenos">1012</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1013"><a href="#Generator-1013"><span class="linenos">1013</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1014"><a href="#Generator-1014"><span class="linenos">1014</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1015"><a href="#Generator-1015"><span class="linenos">1015</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="Generator-1016"><a href="#Generator-1016"><span class="linenos">1016</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Generator-1017"><a href="#Generator-1017"><span class="linenos">1017</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1018"><a href="#Generator-1018"><span class="linenos">1018</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-1019"><a href="#Generator-1019"><span class="linenos">1019</span></a> +</span><span id="Generator-1020"><a href="#Generator-1020"><span class="linenos">1020</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1021"><a href="#Generator-1021"><span class="linenos">1021</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1022"><a href="#Generator-1022"><span class="linenos">1022</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1023"><a href="#Generator-1023"><span class="linenos">1023</span></a> <span class="n">values</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"VALUES</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="n">args</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1024"><a href="#Generator-1024"><span class="linenos">1024</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-1025"><a href="#Generator-1025"><span class="linenos">1025</span></a> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1026"><a href="#Generator-1026"><span class="linenos">1026</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">WRAP_DERIVED_VALUES</span> <span class="ow">and</span> <span class="p">(</span><span class="n">alias</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">))</span> +</span><span id="Generator-1027"><a href="#Generator-1027"><span class="linenos">1027</span></a> <span class="k">else</span> <span class="n">values</span> +</span><span id="Generator-1028"><a href="#Generator-1028"><span class="linenos">1028</span></a> <span class="p">)</span> +</span><span id="Generator-1029"><a href="#Generator-1029"><span class="linenos">1029</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">values</span> +</span><span id="Generator-1030"><a href="#Generator-1030"><span class="linenos">1030</span></a> +</span><span id="Generator-1031"><a href="#Generator-1031"><span class="linenos">1031</span></a> <span class="k">def</span> <span class="nf">var_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1032"><a href="#Generator-1032"><span class="linenos">1032</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1033"><a href="#Generator-1033"><span class="linenos">1033</span></a> +</span><span id="Generator-1034"><a href="#Generator-1034"><span class="linenos">1034</span></a> <span class="k">def</span> <span class="nf">into_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Into</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1035"><a href="#Generator-1035"><span class="linenos">1035</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1036"><a href="#Generator-1036"><span class="linenos">1036</span></a> <span class="n">unlogged</span> <span class="o">=</span> <span class="s2">" UNLOGGED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unlogged"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1037"><a href="#Generator-1037"><span class="linenos">1037</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'INTO'</span><span class="p">)</span><span class="si">}{</span><span class="n">temporary</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="n">unlogged</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1038"><a href="#Generator-1038"><span class="linenos">1038</span></a> +</span><span id="Generator-1039"><a href="#Generator-1039"><span class="linenos">1039</span></a> <span class="k">def</span> <span class="nf">from_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1040"><a href="#Generator-1040"><span class="linenos">1040</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1041"><a href="#Generator-1041"><span class="linenos">1041</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'FROM'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1042"><a href="#Generator-1042"><span class="linenos">1042</span></a> +</span><span id="Generator-1043"><a href="#Generator-1043"><span class="linenos">1043</span></a> <span class="k">def</span> <span class="nf">group_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1044"><a href="#Generator-1044"><span class="linenos">1044</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"GROUP BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1045"><a href="#Generator-1045"><span class="linenos">1045</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"grouping_sets"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator-1046"><a href="#Generator-1046"><span class="linenos">1046</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-1047"><a href="#Generator-1047"><span class="linenos">1047</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'GROUPING SETS'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">grouping_sets</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">grouping_sets</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1048"><a href="#Generator-1048"><span class="linenos">1048</span></a> <span class="p">)</span> +</span><span id="Generator-1049"><a href="#Generator-1049"><span class="linenos">1049</span></a> +</span><span id="Generator-1050"><a href="#Generator-1050"><span class="linenos">1050</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cube"</span><span class="p">)</span> +</span><span id="Generator-1051"><a href="#Generator-1051"><span class="linenos">1051</span></a> <span class="k">if</span> <span class="n">cube</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Generator-1052"><a href="#Generator-1052"><span class="linenos">1052</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH CUBE"</span><span class="p">)</span> +</span><span id="Generator-1053"><a href="#Generator-1053"><span class="linenos">1053</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1054"><a href="#Generator-1054"><span class="linenos">1054</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"cube"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator-1055"><a href="#Generator-1055"><span class="linenos">1055</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'CUBE'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">cube</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">cube</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1056"><a href="#Generator-1056"><span class="linenos">1056</span></a> +</span><span id="Generator-1057"><a href="#Generator-1057"><span class="linenos">1057</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"rollup"</span><span class="p">)</span> +</span><span id="Generator-1058"><a href="#Generator-1058"><span class="linenos">1058</span></a> <span class="k">if</span> <span class="n">rollup</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Generator-1059"><a href="#Generator-1059"><span class="linenos">1059</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH ROLLUP"</span><span class="p">)</span> +</span><span id="Generator-1060"><a href="#Generator-1060"><span class="linenos">1060</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1061"><a href="#Generator-1061"><span class="linenos">1061</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"rollup"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator-1062"><a href="#Generator-1062"><span class="linenos">1062</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'ROLLUP'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">rollup</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">rollup</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1063"><a href="#Generator-1063"><span class="linenos">1063</span></a> +</span><span id="Generator-1064"><a href="#Generator-1064"><span class="linenos">1064</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">group_by</span><span class="si">}{</span><span class="n">csv</span><span class="p">(</span><span class="n">grouping_sets</span><span class="p">,</span><span class="w"> </span><span class="n">cube</span><span class="p">,</span><span class="w"> </span><span class="n">rollup</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">','</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1065"><a href="#Generator-1065"><span class="linenos">1065</span></a> +</span><span id="Generator-1066"><a href="#Generator-1066"><span class="linenos">1066</span></a> <span class="k">def</span> <span class="nf">having_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1067"><a href="#Generator-1067"><span class="linenos">1067</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="Generator-1068"><a href="#Generator-1068"><span class="linenos">1068</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'HAVING'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1069"><a href="#Generator-1069"><span class="linenos">1069</span></a> +</span><span id="Generator-1070"><a href="#Generator-1070"><span class="linenos">1070</span></a> <span class="k">def</span> <span class="nf">join_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1071"><a href="#Generator-1071"><span class="linenos">1071</span></a> <span class="n">op_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span> +</span><span id="Generator-1072"><a href="#Generator-1072"><span class="linenos">1072</span></a> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-1073"><a href="#Generator-1073"><span class="linenos">1073</span></a> <span class="n">op</span> +</span><span id="Generator-1074"><a href="#Generator-1074"><span class="linenos">1074</span></a> <span class="k">for</span> <span class="n">op</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="Generator-1075"><a href="#Generator-1075"><span class="linenos">1075</span></a> <span class="s2">"NATURAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"natural"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-1076"><a href="#Generator-1076"><span class="linenos">1076</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">side</span><span class="p">,</span> +</span><span id="Generator-1077"><a href="#Generator-1077"><span class="linenos">1077</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">kind</span><span class="p">,</span> +</span><span id="Generator-1078"><a href="#Generator-1078"><span class="linenos">1078</span></a> <span class="s2">"JOIN"</span><span class="p">,</span> +</span><span id="Generator-1079"><a href="#Generator-1079"><span class="linenos">1079</span></a> <span class="p">)</span> +</span><span id="Generator-1080"><a href="#Generator-1080"><span class="linenos">1080</span></a> <span class="k">if</span> <span class="n">op</span> +</span><span id="Generator-1081"><a href="#Generator-1081"><span class="linenos">1081</span></a> <span class="p">)</span> +</span><span id="Generator-1082"><a href="#Generator-1082"><span class="linenos">1082</span></a> <span class="p">)</span> +</span><span id="Generator-1083"><a href="#Generator-1083"><span class="linenos">1083</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">)</span> +</span><span id="Generator-1084"><a href="#Generator-1084"><span class="linenos">1084</span></a> <span class="n">using</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="Generator-1085"><a href="#Generator-1085"><span class="linenos">1085</span></a> +</span><span id="Generator-1086"><a href="#Generator-1086"><span class="linenos">1086</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">on_sql</span> <span class="ow">and</span> <span class="n">using</span><span class="p">:</span> +</span><span id="Generator-1087"><a href="#Generator-1087"><span class="linenos">1087</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="n">csv</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">using</span><span class="p">))</span> +</span><span id="Generator-1088"><a href="#Generator-1088"><span class="linenos">1088</span></a> +</span><span id="Generator-1089"><a href="#Generator-1089"><span class="linenos">1089</span></a> <span class="k">if</span> <span class="n">on_sql</span><span class="p">:</span> +</span><span id="Generator-1090"><a href="#Generator-1090"><span class="linenos">1090</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="n">on_sql</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1091"><a href="#Generator-1091"><span class="linenos">1091</span></a> <span class="n">space</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">" "</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator-1092"><a href="#Generator-1092"><span class="linenos">1092</span></a> <span class="k">if</span> <span class="n">using</span><span class="p">:</span> +</span><span id="Generator-1093"><a href="#Generator-1093"><span class="linenos">1093</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">space</span><span class="si">}</span><span class="s2">USING (</span><span class="si">{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1094"><a href="#Generator-1094"><span class="linenos">1094</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1095"><a href="#Generator-1095"><span class="linenos">1095</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">space</span><span class="si">}</span><span class="s2">ON </span><span class="si">{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1096"><a href="#Generator-1096"><span class="linenos">1096</span></a> +</span><span id="Generator-1097"><a href="#Generator-1097"><span class="linenos">1097</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator-1098"><a href="#Generator-1098"><span class="linenos">1098</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1099"><a href="#Generator-1099"><span class="linenos">1099</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}{</span><span class="n">op_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this_sql</span><span class="si">}{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1100"><a href="#Generator-1100"><span class="linenos">1100</span></a> +</span><span id="Generator-1101"><a href="#Generator-1101"><span class="linenos">1101</span></a> <span class="k">def</span> <span class="nf">lambda_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">,</span> <span class="n">arrow_sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"->"</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1102"><a href="#Generator-1102"><span class="linenos">1102</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1103"><a href="#Generator-1103"><span class="linenos">1103</span></a> <span class="n">args</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">))</span> <span class="o">></span> <span class="mi">1</span> <span class="k">else</span> <span class="n">args</span> +</span><span id="Generator-1104"><a href="#Generator-1104"><span class="linenos">1104</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">arrow_sep</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1105"><a href="#Generator-1105"><span class="linenos">1105</span></a> +</span><span id="Generator-1106"><a href="#Generator-1106"><span class="linenos">1106</span></a> <span class="k">def</span> <span class="nf">lateral_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1107"><a href="#Generator-1107"><span class="linenos">1107</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1108"><a href="#Generator-1108"><span class="linenos">1108</span></a> +</span><span id="Generator-1109"><a href="#Generator-1109"><span class="linenos">1109</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="Generator-1110"><a href="#Generator-1110"><span class="linenos">1110</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LATERAL </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1111"><a href="#Generator-1111"><span class="linenos">1111</span></a> +</span><span id="Generator-1112"><a href="#Generator-1112"><span class="linenos">1112</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"view"</span><span class="p">):</span> +</span><span id="Generator-1113"><a href="#Generator-1113"><span class="linenos">1113</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span> +</span><span id="Generator-1114"><a href="#Generator-1114"><span class="linenos">1114</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1115"><a href="#Generator-1115"><span class="linenos">1115</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">alias</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1116"><a href="#Generator-1116"><span class="linenos">1116</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1117"><a href="#Generator-1117"><span class="linenos">1117</span></a> <span class="n">op_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"LATERAL VIEW</span><span class="si">{</span><span class="s1">' OUTER'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'outer'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1118"><a href="#Generator-1118"><span class="linenos">1118</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">op_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">table</span><span class="si">}{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1119"><a href="#Generator-1119"><span class="linenos">1119</span></a> +</span><span id="Generator-1120"><a href="#Generator-1120"><span class="linenos">1120</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1121"><a href="#Generator-1121"><span class="linenos">1121</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1122"><a href="#Generator-1122"><span class="linenos">1122</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LATERAL </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1123"><a href="#Generator-1123"><span class="linenos">1123</span></a> +</span><span id="Generator-1124"><a href="#Generator-1124"><span class="linenos">1124</span></a> <span class="k">def</span> <span class="nf">limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1125"><a href="#Generator-1125"><span class="linenos">1125</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1126"><a href="#Generator-1126"><span class="linenos">1126</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'LIMIT'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1127"><a href="#Generator-1127"><span class="linenos">1127</span></a> +</span><span id="Generator-1128"><a href="#Generator-1128"><span class="linenos">1128</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1129"><a href="#Generator-1129"><span class="linenos">1129</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1130"><a href="#Generator-1130"><span class="linenos">1130</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'OFFSET'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1131"><a href="#Generator-1131"><span class="linenos">1131</span></a> +</span><span id="Generator-1132"><a href="#Generator-1132"><span class="linenos">1132</span></a> <span class="k">def</span> <span class="nf">lock_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1133"><a href="#Generator-1133"><span class="linenos">1133</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">LOCKING_READS_SUPPORTED</span><span class="p">:</span> +</span><span id="Generator-1134"><a href="#Generator-1134"><span class="linenos">1134</span></a> <span class="n">lock_type</span> <span class="o">=</span> <span class="s2">"UPDATE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"update"</span><span class="p">]</span> <span class="k">else</span> <span class="s2">"SHARE"</span> +</span><span id="Generator-1135"><a href="#Generator-1135"><span class="linenos">1135</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"FOR </span><span class="si">{</span><span class="n">lock_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1136"><a href="#Generator-1136"><span class="linenos">1136</span></a> +</span><span id="Generator-1137"><a href="#Generator-1137"><span class="linenos">1137</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Locking reads using 'FOR UPDATE/SHARE' are not supported"</span><span class="p">)</span> +</span><span id="Generator-1138"><a href="#Generator-1138"><span class="linenos">1138</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator-1139"><a href="#Generator-1139"><span class="linenos">1139</span></a> +</span><span id="Generator-1140"><a href="#Generator-1140"><span class="linenos">1140</span></a> <span class="k">def</span> <span class="nf">literal_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1141"><a href="#Generator-1141"><span class="linenos">1141</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">or</span> <span class="s2">""</span> +</span><span id="Generator-1142"><a href="#Generator-1142"><span class="linenos">1142</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="Generator-1143"><a href="#Generator-1143"><span class="linenos">1143</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span><span class="p">:</span> +</span><span id="Generator-1144"><a href="#Generator-1144"><span class="linenos">1144</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">BACKSLASH_RE</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s2">"</span><span class="se">\\\\</span><span class="s2">"</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="Generator-1145"><a href="#Generator-1145"><span class="linenos">1145</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_quote_end</span><span class="p">)</span> +</span><span id="Generator-1146"><a href="#Generator-1146"><span class="linenos">1146</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator-1147"><a href="#Generator-1147"><span class="linenos">1147</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">SENTINEL_LINE_BREAK</span><span class="p">)</span> +</span><span id="Generator-1148"><a href="#Generator-1148"><span class="linenos">1148</span></a> <span class="n">text</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span><span class="si">}{</span><span class="n">text</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1149"><a href="#Generator-1149"><span class="linenos">1149</span></a> <span class="k">return</span> <span class="n">text</span> +</span><span id="Generator-1150"><a href="#Generator-1150"><span class="linenos">1150</span></a> +</span><span id="Generator-1151"><a href="#Generator-1151"><span class="linenos">1151</span></a> <span class="k">def</span> <span class="nf">loaddata_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LoadData</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1152"><a href="#Generator-1152"><span class="linenos">1152</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">" LOCAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1153"><a href="#Generator-1153"><span class="linenos">1153</span></a> <span class="n">inpath</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INPATH </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'inpath'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1154"><a href="#Generator-1154"><span class="linenos">1154</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="s2">" OVERWRITE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"overwrite"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1155"><a href="#Generator-1155"><span class="linenos">1155</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INTO TABLE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1156"><a href="#Generator-1156"><span class="linenos">1156</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"partition"</span><span class="p">)</span> +</span><span id="Generator-1157"><a href="#Generator-1157"><span class="linenos">1157</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">partition</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">partition</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1158"><a href="#Generator-1158"><span class="linenos">1158</span></a> <span class="n">input_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"input_format"</span><span class="p">)</span> +</span><span id="Generator-1159"><a href="#Generator-1159"><span class="linenos">1159</span></a> <span class="n">input_format</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INPUTFORMAT </span><span class="si">{</span><span class="n">input_format</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">input_format</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1160"><a href="#Generator-1160"><span class="linenos">1160</span></a> <span class="n">serde</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"serde"</span><span class="p">)</span> +</span><span id="Generator-1161"><a href="#Generator-1161"><span class="linenos">1161</span></a> <span class="n">serde</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" SERDE </span><span class="si">{</span><span class="n">serde</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">serde</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1162"><a href="#Generator-1162"><span class="linenos">1162</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LOAD DATA</span><span class="si">{</span><span class="n">local</span><span class="si">}{</span><span class="n">inpath</span><span class="si">}{</span><span class="n">overwrite</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">partition</span><span class="si">}{</span><span class="n">input_format</span><span class="si">}{</span><span class="n">serde</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1163"><a href="#Generator-1163"><span class="linenos">1163</span></a> +</span><span id="Generator-1164"><a href="#Generator-1164"><span class="linenos">1164</span></a> <span class="k">def</span> <span class="nf">null_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1165"><a href="#Generator-1165"><span class="linenos">1165</span></a> <span class="k">return</span> <span class="s2">"NULL"</span> +</span><span id="Generator-1166"><a href="#Generator-1166"><span class="linenos">1166</span></a> +</span><span id="Generator-1167"><a href="#Generator-1167"><span class="linenos">1167</span></a> <span class="k">def</span> <span class="nf">boolean_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1168"><a href="#Generator-1168"><span class="linenos">1168</span></a> <span class="k">return</span> <span class="s2">"TRUE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">"FALSE"</span> +</span><span id="Generator-1169"><a href="#Generator-1169"><span class="linenos">1169</span></a> +</span><span id="Generator-1170"><a href="#Generator-1170"><span class="linenos">1170</span></a> <span class="k">def</span> <span class="nf">order_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1171"><a href="#Generator-1171"><span class="linenos">1171</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1172"><a href="#Generator-1172"><span class="linenos">1172</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">this</span> +</span><span id="Generator-1173"><a href="#Generator-1173"><span class="linenos">1173</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">ORDER BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="n">this</span> <span class="ow">or</span> <span class="n">flat</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Generator-1174"><a href="#Generator-1174"><span class="linenos">1174</span></a> +</span><span id="Generator-1175"><a href="#Generator-1175"><span class="linenos">1175</span></a> <span class="k">def</span> <span class="nf">cluster_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1176"><a href="#Generator-1176"><span class="linenos">1176</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"CLUSTER BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1177"><a href="#Generator-1177"><span class="linenos">1177</span></a> +</span><span id="Generator-1178"><a href="#Generator-1178"><span class="linenos">1178</span></a> <span class="k">def</span> <span class="nf">distribute_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distribute</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1179"><a href="#Generator-1179"><span class="linenos">1179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"DISTRIBUTE BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1180"><a href="#Generator-1180"><span class="linenos">1180</span></a> +</span><span id="Generator-1181"><a href="#Generator-1181"><span class="linenos">1181</span></a> <span class="k">def</span> <span class="nf">sort_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1182"><a href="#Generator-1182"><span class="linenos">1182</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"SORT BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1183"><a href="#Generator-1183"><span class="linenos">1183</span></a> +</span><span id="Generator-1184"><a href="#Generator-1184"><span class="linenos">1184</span></a> <span class="k">def</span> <span class="nf">ordered_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1185"><a href="#Generator-1185"><span class="linenos">1185</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> +</span><span id="Generator-1186"><a href="#Generator-1186"><span class="linenos">1186</span></a> <span class="n">asc</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">desc</span> +</span><span id="Generator-1187"><a href="#Generator-1187"><span class="linenos">1187</span></a> +</span><span id="Generator-1188"><a href="#Generator-1188"><span class="linenos">1188</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nulls_first"</span><span class="p">)</span> +</span><span id="Generator-1189"><a href="#Generator-1189"><span class="linenos">1189</span></a> <span class="n">nulls_last</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">nulls_first</span> +</span><span id="Generator-1190"><a href="#Generator-1190"><span class="linenos">1190</span></a> <span class="n">nulls_are_large</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_large"</span> +</span><span id="Generator-1191"><a href="#Generator-1191"><span class="linenos">1191</span></a> <span class="n">nulls_are_small</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_small"</span> +</span><span id="Generator-1192"><a href="#Generator-1192"><span class="linenos">1192</span></a> <span class="n">nulls_are_last</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_last"</span> +</span><span id="Generator-1193"><a href="#Generator-1193"><span class="linenos">1193</span></a> +</span><span id="Generator-1194"><a href="#Generator-1194"><span class="linenos">1194</span></a> <span class="n">sort_order</span> <span class="o">=</span> <span class="s2">" DESC"</span> <span class="k">if</span> <span class="n">desc</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1195"><a href="#Generator-1195"><span class="linenos">1195</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-1196"><a href="#Generator-1196"><span class="linenos">1196</span></a> <span class="k">if</span> <span class="n">nulls_first</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="Generator-1197"><a href="#Generator-1197"><span class="linenos">1197</span></a> <span class="p">(</span><span class="n">asc</span> <span class="ow">and</span> <span class="n">nulls_are_large</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="n">nulls_are_small</span><span class="p">)</span> <span class="ow">or</span> <span class="n">nulls_are_last</span> +</span><span id="Generator-1198"><a href="#Generator-1198"><span class="linenos">1198</span></a> <span class="p">):</span> +</span><span id="Generator-1199"><a href="#Generator-1199"><span class="linenos">1199</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">" NULLS FIRST"</span> +</span><span id="Generator-1200"><a href="#Generator-1200"><span class="linenos">1200</span></a> <span class="k">elif</span> <span class="p">(</span> +</span><span id="Generator-1201"><a href="#Generator-1201"><span class="linenos">1201</span></a> <span class="n">nulls_last</span> +</span><span id="Generator-1202"><a href="#Generator-1202"><span class="linenos">1202</span></a> <span class="ow">and</span> <span class="p">((</span><span class="n">asc</span> <span class="ow">and</span> <span class="n">nulls_are_small</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="n">nulls_are_large</span><span class="p">))</span> +</span><span id="Generator-1203"><a href="#Generator-1203"><span class="linenos">1203</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">nulls_are_last</span> +</span><span id="Generator-1204"><a href="#Generator-1204"><span class="linenos">1204</span></a> <span class="p">):</span> +</span><span id="Generator-1205"><a href="#Generator-1205"><span class="linenos">1205</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">" NULLS LAST"</span> +</span><span id="Generator-1206"><a href="#Generator-1206"><span class="linenos">1206</span></a> +</span><span id="Generator-1207"><a href="#Generator-1207"><span class="linenos">1207</span></a> <span class="k">if</span> <span class="n">nulls_sort_change</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">NULL_ORDERING_SUPPORTED</span><span class="p">:</span> +</span><span id="Generator-1208"><a href="#Generator-1208"><span class="linenos">1208</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span> +</span><span id="Generator-1209"><a href="#Generator-1209"><span class="linenos">1209</span></a> <span class="s2">"Sorting in an ORDER BY on NULLS FIRST/NULLS LAST is not supported by this dialect"</span> +</span><span id="Generator-1210"><a href="#Generator-1210"><span class="linenos">1210</span></a> <span class="p">)</span> +</span><span id="Generator-1211"><a href="#Generator-1211"><span class="linenos">1211</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-1212"><a href="#Generator-1212"><span class="linenos">1212</span></a> +</span><span id="Generator-1213"><a href="#Generator-1213"><span class="linenos">1213</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">sort_order</span><span class="si">}{</span><span class="n">nulls_sort_change</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1214"><a href="#Generator-1214"><span class="linenos">1214</span></a> +</span><span id="Generator-1215"><a href="#Generator-1215"><span class="linenos">1215</span></a> <span class="k">def</span> <span class="nf">matchrecognize_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1216"><a href="#Generator-1216"><span class="linenos">1216</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition_by_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1217"><a href="#Generator-1217"><span class="linenos">1217</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">)</span> +</span><span id="Generator-1218"><a href="#Generator-1218"><span class="linenos">1218</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"measures"</span><span class="p">)</span> +</span><span id="Generator-1219"><a href="#Generator-1219"><span class="linenos">1219</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"MEASURES </span><span class="si">{</span><span class="n">measures</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="n">measures</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1220"><a href="#Generator-1220"><span class="linenos">1220</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"rows"</span><span class="p">)</span> +</span><span id="Generator-1221"><a href="#Generator-1221"><span class="linenos">1221</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">rows</span><span class="p">)</span> <span class="k">if</span> <span class="n">rows</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1222"><a href="#Generator-1222"><span class="linenos">1222</span></a> <span class="n">after</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"after"</span><span class="p">)</span> +</span><span id="Generator-1223"><a href="#Generator-1223"><span class="linenos">1223</span></a> <span class="n">after</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">after</span><span class="p">)</span> <span class="k">if</span> <span class="n">after</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1224"><a href="#Generator-1224"><span class="linenos">1224</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"pattern"</span><span class="p">)</span> +</span><span id="Generator-1225"><a href="#Generator-1225"><span class="linenos">1225</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"PATTERN (</span><span class="si">{</span><span class="n">pattern</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> <span class="k">if</span> <span class="n">pattern</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1226"><a href="#Generator-1226"><span class="linenos">1226</span></a> <span class="n">define</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"define"</span><span class="p">)</span> +</span><span id="Generator-1227"><a href="#Generator-1227"><span class="linenos">1227</span></a> <span class="n">define</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"DEFINE </span><span class="si">{</span><span class="n">define</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="n">define</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1228"><a href="#Generator-1228"><span class="linenos">1228</span></a> <span class="n">body</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator-1229"><a href="#Generator-1229"><span class="linenos">1229</span></a> <span class="p">(</span> +</span><span id="Generator-1230"><a href="#Generator-1230"><span class="linenos">1230</span></a> <span class="n">partition</span><span class="p">,</span> +</span><span id="Generator-1231"><a href="#Generator-1231"><span class="linenos">1231</span></a> <span class="n">order</span><span class="p">,</span> +</span><span id="Generator-1232"><a href="#Generator-1232"><span class="linenos">1232</span></a> <span class="n">measures</span><span class="p">,</span> +</span><span id="Generator-1233"><a href="#Generator-1233"><span class="linenos">1233</span></a> <span class="n">rows</span><span class="p">,</span> +</span><span id="Generator-1234"><a href="#Generator-1234"><span class="linenos">1234</span></a> <span class="n">after</span><span class="p">,</span> +</span><span id="Generator-1235"><a href="#Generator-1235"><span class="linenos">1235</span></a> <span class="n">pattern</span><span class="p">,</span> +</span><span id="Generator-1236"><a href="#Generator-1236"><span class="linenos">1236</span></a> <span class="n">define</span><span class="p">,</span> +</span><span id="Generator-1237"><a href="#Generator-1237"><span class="linenos">1237</span></a> <span class="p">)</span> +</span><span id="Generator-1238"><a href="#Generator-1238"><span class="linenos">1238</span></a> <span class="p">)</span> +</span><span id="Generator-1239"><a href="#Generator-1239"><span class="linenos">1239</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'MATCH_RECOGNIZE'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">body</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1240"><a href="#Generator-1240"><span class="linenos">1240</span></a> +</span><span id="Generator-1241"><a href="#Generator-1241"><span class="linenos">1241</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1242"><a href="#Generator-1242"><span class="linenos">1242</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="Generator-1243"><a href="#Generator-1243"><span class="linenos">1243</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="Generator-1244"><a href="#Generator-1244"><span class="linenos">1244</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Generator-1245"><a href="#Generator-1245"><span class="linenos">1245</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="Generator-1246"><a href="#Generator-1246"><span class="linenos">1246</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Generator-1247"><a href="#Generator-1247"><span class="linenos">1247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="Generator-1248"><a href="#Generator-1248"><span class="linenos">1248</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="Generator-1249"><a href="#Generator-1249"><span class="linenos">1249</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="Generator-1250"><a href="#Generator-1250"><span class="linenos">1250</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="Generator-1251"><a href="#Generator-1251"><span class="linenos">1251</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1252"><a href="#Generator-1252"><span class="linenos">1252</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="Generator-1253"><a href="#Generator-1253"><span class="linenos">1253</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator-1254"><a href="#Generator-1254"><span class="linenos">1254</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="Generator-1255"><a href="#Generator-1255"><span class="linenos">1255</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="Generator-1256"><a href="#Generator-1256"><span class="linenos">1256</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="Generator-1257"><a href="#Generator-1257"><span class="linenos">1257</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="Generator-1258"><a href="#Generator-1258"><span class="linenos">1258</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="Generator-1259"><a href="#Generator-1259"><span class="linenos">1259</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> +</span><span id="Generator-1260"><a href="#Generator-1260"><span class="linenos">1260</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="Generator-1261"><a href="#Generator-1261"><span class="linenos">1261</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="Generator-1262"><a href="#Generator-1262"><span class="linenos">1262</span></a> <span class="p">)</span> +</span><span id="Generator-1263"><a href="#Generator-1263"><span class="linenos">1263</span></a> +</span><span id="Generator-1264"><a href="#Generator-1264"><span class="linenos">1264</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1265"><a href="#Generator-1265"><span class="linenos">1265</span></a> <span class="n">hint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"hint"</span><span class="p">)</span> +</span><span id="Generator-1266"><a href="#Generator-1266"><span class="linenos">1266</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distinct"</span><span class="p">)</span> +</span><span id="Generator-1267"><a href="#Generator-1267"><span class="linenos">1267</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">distinct</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">distinct</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1268"><a href="#Generator-1268"><span class="linenos">1268</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1269"><a href="#Generator-1269"><span class="linenos">1269</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">expressions</span> <span class="k">else</span> <span class="n">expressions</span> +</span><span id="Generator-1270"><a href="#Generator-1270"><span class="linenos">1270</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="Generator-1271"><a href="#Generator-1271"><span class="linenos">1271</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator-1272"><a href="#Generator-1272"><span class="linenos">1272</span></a> <span class="sa">f</span><span class="s2">"SELECT</span><span class="si">{</span><span class="n">hint</span><span class="si">}{</span><span class="n">distinct</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Generator-1273"><a href="#Generator-1273"><span class="linenos">1273</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"into"</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Generator-1274"><a href="#Generator-1274"><span class="linenos">1274</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Generator-1275"><a href="#Generator-1275"><span class="linenos">1275</span></a> <span class="p">)</span> +</span><span id="Generator-1276"><a href="#Generator-1276"><span class="linenos">1276</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-1277"><a href="#Generator-1277"><span class="linenos">1277</span></a> +</span><span id="Generator-1278"><a href="#Generator-1278"><span class="linenos">1278</span></a> <span class="k">def</span> <span class="nf">schema_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1279"><a href="#Generator-1279"><span class="linenos">1279</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1280"><a href="#Generator-1280"><span class="linenos">1280</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1281"><a href="#Generator-1281"><span class="linenos">1281</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1282"><a href="#Generator-1282"><span class="linenos">1282</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1283"><a href="#Generator-1283"><span class="linenos">1283</span></a> +</span><span id="Generator-1284"><a href="#Generator-1284"><span class="linenos">1284</span></a> <span class="k">def</span> <span class="nf">star_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1285"><a href="#Generator-1285"><span class="linenos">1285</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"except"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1286"><a href="#Generator-1286"><span class="linenos">1286</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STAR_MAPPING</span><span class="p">[</span><span class="s1">'except'</span><span class="p">])</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">except_</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">except_</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1287"><a href="#Generator-1287"><span class="linenos">1287</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"replace"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1288"><a href="#Generator-1288"><span class="linenos">1288</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STAR_MAPPING</span><span class="p">[</span><span class="s1">'replace'</span><span class="p">])</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">replace</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">replace</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1289"><a href="#Generator-1289"><span class="linenos">1289</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"*</span><span class="si">{</span><span class="n">except_</span><span class="si">}{</span><span class="n">replace</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1290"><a href="#Generator-1290"><span class="linenos">1290</span></a> +</span><span id="Generator-1291"><a href="#Generator-1291"><span class="linenos">1291</span></a> <span class="k">def</span> <span class="nf">structkwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1292"><a href="#Generator-1292"><span class="linenos">1292</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1293"><a href="#Generator-1293"><span class="linenos">1293</span></a> +</span><span id="Generator-1294"><a href="#Generator-1294"><span class="linenos">1294</span></a> <span class="k">def</span> <span class="nf">parameter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1295"><a href="#Generator-1295"><span class="linenos">1295</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"@</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1296"><a href="#Generator-1296"><span class="linenos">1296</span></a> +</span><span id="Generator-1297"><a href="#Generator-1297"><span class="linenos">1297</span></a> <span class="k">def</span> <span class="nf">sessionparameter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SessionParameter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1298"><a href="#Generator-1298"><span class="linenos">1298</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1299"><a href="#Generator-1299"><span class="linenos">1299</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator-1300"><a href="#Generator-1300"><span class="linenos">1300</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Generator-1301"><a href="#Generator-1301"><span class="linenos">1301</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">."</span> +</span><span id="Generator-1302"><a href="#Generator-1302"><span class="linenos">1302</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"@@</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1303"><a href="#Generator-1303"><span class="linenos">1303</span></a> +</span><span id="Generator-1304"><a href="#Generator-1304"><span class="linenos">1304</span></a> <span class="k">def</span> <span class="nf">placeholder_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1305"><a href="#Generator-1305"><span class="linenos">1305</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">":</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">"?"</span> +</span><span id="Generator-1306"><a href="#Generator-1306"><span class="linenos">1306</span></a> +</span><span id="Generator-1307"><a href="#Generator-1307"><span class="linenos">1307</span></a> <span class="k">def</span> <span class="nf">subquery_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1308"><a href="#Generator-1308"><span class="linenos">1308</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1309"><a href="#Generator-1309"><span class="linenos">1309</span></a> +</span><span id="Generator-1310"><a href="#Generator-1310"><span class="linenos">1310</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="Generator-1311"><a href="#Generator-1311"><span class="linenos">1311</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator-1312"><a href="#Generator-1312"><span class="linenos">1312</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">),</span> +</span><span id="Generator-1313"><a href="#Generator-1313"><span class="linenos">1313</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"pivots"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">),</span> +</span><span id="Generator-1314"><a href="#Generator-1314"><span class="linenos">1314</span></a> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator-1315"><a href="#Generator-1315"><span class="linenos">1315</span></a> <span class="p">)</span> +</span><span id="Generator-1316"><a href="#Generator-1316"><span class="linenos">1316</span></a> +</span><span id="Generator-1317"><a href="#Generator-1317"><span class="linenos">1317</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-1318"><a href="#Generator-1318"><span class="linenos">1318</span></a> +</span><span id="Generator-1319"><a href="#Generator-1319"><span class="linenos">1319</span></a> <span class="k">def</span> <span class="nf">qualify_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1320"><a href="#Generator-1320"><span class="linenos">1320</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="Generator-1321"><a href="#Generator-1321"><span class="linenos">1321</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'QUALIFY'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1322"><a href="#Generator-1322"><span class="linenos">1322</span></a> +</span><span id="Generator-1323"><a href="#Generator-1323"><span class="linenos">1323</span></a> <span class="k">def</span> <span class="nf">union_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1324"><a href="#Generator-1324"><span class="linenos">1324</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="Generator-1325"><a href="#Generator-1325"><span class="linenos">1325</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator-1326"><a href="#Generator-1326"><span class="linenos">1326</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">union_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="Generator-1327"><a href="#Generator-1327"><span class="linenos">1327</span></a> <span class="p">)</span> +</span><span id="Generator-1328"><a href="#Generator-1328"><span class="linenos">1328</span></a> +</span><span id="Generator-1329"><a href="#Generator-1329"><span class="linenos">1329</span></a> <span class="k">def</span> <span class="nf">union_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1330"><a href="#Generator-1330"><span class="linenos">1330</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="s2">" DISTINCT"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXPLICIT_UNION</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1331"><a href="#Generator-1331"><span class="linenos">1331</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">kind</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" ALL"</span> +</span><span id="Generator-1332"><a href="#Generator-1332"><span class="linenos">1332</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNION</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1333"><a href="#Generator-1333"><span class="linenos">1333</span></a> +</span><span id="Generator-1334"><a href="#Generator-1334"><span class="linenos">1334</span></a> <span class="k">def</span> <span class="nf">unnest_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1335"><a href="#Generator-1335"><span class="linenos">1335</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1336"><a href="#Generator-1336"><span class="linenos">1336</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1337"><a href="#Generator-1337"><span class="linenos">1337</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">:</span> +</span><span id="Generator-1338"><a href="#Generator-1338"><span class="linenos">1338</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">alias</span><span class="o">.</span><span class="n">columns</span> +</span><span id="Generator-1339"><a href="#Generator-1339"><span class="linenos">1339</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1340"><a href="#Generator-1340"><span class="linenos">1340</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1341"><a href="#Generator-1341"><span class="linenos">1341</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1342"><a href="#Generator-1342"><span class="linenos">1342</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">alias</span> +</span><span id="Generator-1343"><a href="#Generator-1343"><span class="linenos">1343</span></a> <span class="n">ordinality</span> <span class="o">=</span> <span class="s2">" WITH ORDINALITY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"ordinality"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1344"><a href="#Generator-1344"><span class="linenos">1344</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"offset"</span><span class="p">)</span> +</span><span id="Generator-1345"><a href="#Generator-1345"><span class="linenos">1345</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITH OFFSET AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">offset</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">offset</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1346"><a href="#Generator-1346"><span class="linenos">1346</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNNEST(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">ordinality</span><span class="si">}{</span><span class="n">alias</span><span class="si">}{</span><span class="n">offset</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1347"><a href="#Generator-1347"><span class="linenos">1347</span></a> +</span><span id="Generator-1348"><a href="#Generator-1348"><span class="linenos">1348</span></a> <span class="k">def</span> <span class="nf">where_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1349"><a href="#Generator-1349"><span class="linenos">1349</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="Generator-1350"><a href="#Generator-1350"><span class="linenos">1350</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'WHERE'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1351"><a href="#Generator-1351"><span class="linenos">1351</span></a> +</span><span id="Generator-1352"><a href="#Generator-1352"><span class="linenos">1352</span></a> <span class="k">def</span> <span class="nf">window_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1353"><a href="#Generator-1353"><span class="linenos">1353</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1354"><a href="#Generator-1354"><span class="linenos">1354</span></a> +</span><span id="Generator-1355"><a href="#Generator-1355"><span class="linenos">1355</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition_by_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1356"><a href="#Generator-1356"><span class="linenos">1356</span></a> +</span><span id="Generator-1357"><a href="#Generator-1357"><span class="linenos">1357</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="Generator-1358"><a href="#Generator-1358"><span class="linenos">1358</span></a> <span class="n">order_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">order_sql</span><span class="p">(</span><span class="n">order</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">order</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1359"><a href="#Generator-1359"><span class="linenos">1359</span></a> +</span><span id="Generator-1360"><a href="#Generator-1360"><span class="linenos">1360</span></a> <span class="n">partition_sql</span> <span class="o">=</span> <span class="n">partition</span> <span class="o">+</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">partition</span> <span class="ow">and</span> <span class="n">order</span> <span class="k">else</span> <span class="n">partition</span> +</span><span id="Generator-1361"><a href="#Generator-1361"><span class="linenos">1361</span></a> +</span><span id="Generator-1362"><a href="#Generator-1362"><span class="linenos">1362</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">)</span> +</span><span id="Generator-1363"><a href="#Generator-1363"><span class="linenos">1363</span></a> <span class="n">spec_sql</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_spec_sql</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span> <span class="k">if</span> <span class="n">spec</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1364"><a href="#Generator-1364"><span class="linenos">1364</span></a> +</span><span id="Generator-1365"><a href="#Generator-1365"><span class="linenos">1365</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1366"><a href="#Generator-1366"><span class="linenos">1366</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="s1">'AS'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">arg_key</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s1">'windows'</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'OVER'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1367"><a href="#Generator-1367"><span class="linenos">1367</span></a> +</span><span id="Generator-1368"><a href="#Generator-1368"><span class="linenos">1368</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">partition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">order</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">spec</span> <span class="ow">and</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="Generator-1369"><a href="#Generator-1369"><span class="linenos">1369</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1370"><a href="#Generator-1370"><span class="linenos">1370</span></a> +</span><span id="Generator-1371"><a href="#Generator-1371"><span class="linenos">1371</span></a> <span class="n">window_args</span> <span class="o">=</span> <span class="n">alias</span> <span class="o">+</span> <span class="n">partition_sql</span> <span class="o">+</span> <span class="n">order_sql</span> <span class="o">+</span> <span class="n">spec_sql</span> +</span><span id="Generator-1372"><a href="#Generator-1372"><span class="linenos">1372</span></a> +</span><span id="Generator-1373"><a href="#Generator-1373"><span class="linenos">1373</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">window_args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1374"><a href="#Generator-1374"><span class="linenos">1374</span></a> +</span><span id="Generator-1375"><a href="#Generator-1375"><span class="linenos">1375</span></a> <span class="k">def</span> <span class="nf">partition_by_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1376"><a href="#Generator-1376"><span class="linenos">1376</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1377"><a href="#Generator-1377"><span class="linenos">1377</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="n">partition</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">partition</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1378"><a href="#Generator-1378"><span class="linenos">1378</span></a> +</span><span id="Generator-1379"><a href="#Generator-1379"><span class="linenos">1379</span></a> <span class="k">def</span> <span class="nf">window_spec_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1380"><a href="#Generator-1380"><span class="linenos">1380</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator-1381"><a href="#Generator-1381"><span class="linenos">1381</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start_side"</span><span class="p">),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator-1382"><a href="#Generator-1382"><span class="linenos">1382</span></a> <span class="n">end</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-1383"><a href="#Generator-1383"><span class="linenos">1383</span></a> <span class="n">csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"end"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"end_side"</span><span class="p">),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator-1384"><a href="#Generator-1384"><span class="linenos">1384</span></a> <span class="ow">or</span> <span class="s2">"CURRENT ROW"</span> +</span><span id="Generator-1385"><a href="#Generator-1385"><span class="linenos">1385</span></a> <span class="p">)</span> +</span><span id="Generator-1386"><a href="#Generator-1386"><span class="linenos">1386</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1387"><a href="#Generator-1387"><span class="linenos">1387</span></a> +</span><span id="Generator-1388"><a href="#Generator-1388"><span class="linenos">1388</span></a> <span class="k">def</span> <span class="nf">withingroup_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1389"><a href="#Generator-1389"><span class="linenos">1389</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1390"><a href="#Generator-1390"><span class="linenos">1390</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> <span class="c1"># order has a leading space</span> +</span><span id="Generator-1391"><a href="#Generator-1391"><span class="linenos">1391</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> WITHIN GROUP (</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1392"><a href="#Generator-1392"><span class="linenos">1392</span></a> +</span><span id="Generator-1393"><a href="#Generator-1393"><span class="linenos">1393</span></a> <span class="k">def</span> <span class="nf">between_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1394"><a href="#Generator-1394"><span class="linenos">1394</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1395"><a href="#Generator-1395"><span class="linenos">1395</span></a> <span class="n">low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"low"</span><span class="p">)</span> +</span><span id="Generator-1396"><a href="#Generator-1396"><span class="linenos">1396</span></a> <span class="n">high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"high"</span><span class="p">)</span> +</span><span id="Generator-1397"><a href="#Generator-1397"><span class="linenos">1397</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">low</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">high</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1398"><a href="#Generator-1398"><span class="linenos">1398</span></a> +</span><span id="Generator-1399"><a href="#Generator-1399"><span class="linenos">1399</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1400"><a href="#Generator-1400"><span class="linenos">1400</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">apply_index_offset</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">)</span> +</span><span id="Generator-1401"><a href="#Generator-1401"><span class="linenos">1401</span></a> <span class="n">expressions_sql</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator-1402"><a href="#Generator-1402"><span class="linenos">1402</span></a> +</span><span id="Generator-1403"><a href="#Generator-1403"><span class="linenos">1403</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">[</span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">]"</span> +</span><span id="Generator-1404"><a href="#Generator-1404"><span class="linenos">1404</span></a> +</span><span id="Generator-1405"><a href="#Generator-1405"><span class="linenos">1405</span></a> <span class="k">def</span> <span class="nf">all_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1406"><a href="#Generator-1406"><span class="linenos">1406</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALL </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1407"><a href="#Generator-1407"><span class="linenos">1407</span></a> +</span><span id="Generator-1408"><a href="#Generator-1408"><span class="linenos">1408</span></a> <span class="k">def</span> <span class="nf">any_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1409"><a href="#Generator-1409"><span class="linenos">1409</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ANY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1410"><a href="#Generator-1410"><span class="linenos">1410</span></a> +</span><span id="Generator-1411"><a href="#Generator-1411"><span class="linenos">1411</span></a> <span class="k">def</span> <span class="nf">exists_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1412"><a href="#Generator-1412"><span class="linenos">1412</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXISTS</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1413"><a href="#Generator-1413"><span class="linenos">1413</span></a> +</span><span id="Generator-1414"><a href="#Generator-1414"><span class="linenos">1414</span></a> <span class="k">def</span> <span class="nf">case_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1415"><a href="#Generator-1415"><span class="linenos">1415</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1416"><a href="#Generator-1416"><span class="linenos">1416</span></a> <span class="n">statements</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"CASE </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">"CASE"</span><span class="p">]</span> +</span><span id="Generator-1417"><a href="#Generator-1417"><span class="linenos">1417</span></a> +</span><span id="Generator-1418"><a href="#Generator-1418"><span class="linenos">1418</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">]:</span> +</span><span id="Generator-1419"><a href="#Generator-1419"><span class="linenos">1419</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"WHEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1420"><a href="#Generator-1420"><span class="linenos">1420</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"THEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'true'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1421"><a href="#Generator-1421"><span class="linenos">1421</span></a> +</span><span id="Generator-1422"><a href="#Generator-1422"><span class="linenos">1422</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator-1423"><a href="#Generator-1423"><span class="linenos">1423</span></a> +</span><span id="Generator-1424"><a href="#Generator-1424"><span class="linenos">1424</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator-1425"><a href="#Generator-1425"><span class="linenos">1425</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"ELSE </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1426"><a href="#Generator-1426"><span class="linenos">1426</span></a> +</span><span id="Generator-1427"><a href="#Generator-1427"><span class="linenos">1427</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"END"</span><span class="p">)</span> +</span><span id="Generator-1428"><a href="#Generator-1428"><span class="linenos">1428</span></a> +</span><span id="Generator-1429"><a href="#Generator-1429"><span class="linenos">1429</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">statements</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span><span class="p">:</span> +</span><span id="Generator-1430"><a href="#Generator-1430"><span class="linenos">1430</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">statements</span><span class="p">),</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">skip_last</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1431"><a href="#Generator-1431"><span class="linenos">1431</span></a> +</span><span id="Generator-1432"><a href="#Generator-1432"><span class="linenos">1432</span></a> <span class="k">return</span> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">statements</span><span class="p">)</span> +</span><span id="Generator-1433"><a href="#Generator-1433"><span class="linenos">1433</span></a> +</span><span id="Generator-1434"><a href="#Generator-1434"><span class="linenos">1434</span></a> <span class="k">def</span> <span class="nf">constraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Constraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1435"><a href="#Generator-1435"><span class="linenos">1435</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1436"><a href="#Generator-1436"><span class="linenos">1436</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1437"><a href="#Generator-1437"><span class="linenos">1437</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1438"><a href="#Generator-1438"><span class="linenos">1438</span></a> +</span><span id="Generator-1439"><a href="#Generator-1439"><span class="linenos">1439</span></a> <span class="k">def</span> <span class="nf">extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1440"><a href="#Generator-1440"><span class="linenos">1440</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1441"><a href="#Generator-1441"><span class="linenos">1441</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator-1442"><a href="#Generator-1442"><span class="linenos">1442</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXTRACT(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> FROM </span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1443"><a href="#Generator-1443"><span class="linenos">1443</span></a> +</span><span id="Generator-1444"><a href="#Generator-1444"><span class="linenos">1444</span></a> <span class="k">def</span> <span class="nf">trim_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1445"><a href="#Generator-1445"><span class="linenos">1445</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="Generator-1446"><a href="#Generator-1446"><span class="linenos">1446</span></a> +</span><span id="Generator-1447"><a href="#Generator-1447"><span class="linenos">1447</span></a> <span class="k">if</span> <span class="n">trim_type</span> <span class="o">==</span> <span class="s2">"LEADING"</span><span class="p">:</span> +</span><span id="Generator-1448"><a href="#Generator-1448"><span class="linenos">1448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'LTRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1449"><a href="#Generator-1449"><span class="linenos">1449</span></a> <span class="k">elif</span> <span class="n">trim_type</span> <span class="o">==</span> <span class="s2">"TRAILING"</span><span class="p">:</span> +</span><span id="Generator-1450"><a href="#Generator-1450"><span class="linenos">1450</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'RTRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1451"><a href="#Generator-1451"><span class="linenos">1451</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1452"><a href="#Generator-1452"><span class="linenos">1452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'TRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1453"><a href="#Generator-1453"><span class="linenos">1453</span></a> +</span><span id="Generator-1454"><a href="#Generator-1454"><span class="linenos">1454</span></a> <span class="k">def</span> <span class="nf">concat_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1455"><a href="#Generator-1455"><span class="linenos">1455</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Generator-1456"><a href="#Generator-1456"><span class="linenos">1456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="Generator-1457"><a href="#Generator-1457"><span class="linenos">1457</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1458"><a href="#Generator-1458"><span class="linenos">1458</span></a> +</span><span id="Generator-1459"><a href="#Generator-1459"><span class="linenos">1459</span></a> <span class="k">def</span> <span class="nf">check_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Check</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1460"><a href="#Generator-1460"><span class="linenos">1460</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1461"><a href="#Generator-1461"><span class="linenos">1461</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECK (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1462"><a href="#Generator-1462"><span class="linenos">1462</span></a> +</span><span id="Generator-1463"><a href="#Generator-1463"><span class="linenos">1463</span></a> <span class="k">def</span> <span class="nf">foreignkey_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1464"><a href="#Generator-1464"><span class="linenos">1464</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1465"><a href="#Generator-1465"><span class="linenos">1465</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"reference"</span><span class="p">)</span> +</span><span id="Generator-1466"><a href="#Generator-1466"><span class="linenos">1466</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">reference</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">reference</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1467"><a href="#Generator-1467"><span class="linenos">1467</span></a> <span class="n">delete</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"delete"</span><span class="p">)</span> +</span><span id="Generator-1468"><a href="#Generator-1468"><span class="linenos">1468</span></a> <span class="n">delete</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON DELETE </span><span class="si">{</span><span class="n">delete</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">delete</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1469"><a href="#Generator-1469"><span class="linenos">1469</span></a> <span class="n">update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"update"</span><span class="p">)</span> +</span><span id="Generator-1470"><a href="#Generator-1470"><span class="linenos">1470</span></a> <span class="n">update</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON UPDATE </span><span class="si">{</span><span class="n">update</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">update</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1471"><a href="#Generator-1471"><span class="linenos">1471</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOREIGN KEY (</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">reference</span><span class="si">}{</span><span class="n">delete</span><span class="si">}{</span><span class="n">update</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1472"><a href="#Generator-1472"><span class="linenos">1472</span></a> +</span><span id="Generator-1473"><a href="#Generator-1473"><span class="linenos">1473</span></a> <span class="k">def</span> <span class="nf">primarykey_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1474"><a href="#Generator-1474"><span class="linenos">1474</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1475"><a href="#Generator-1475"><span class="linenos">1475</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator-1476"><a href="#Generator-1476"><span class="linenos">1476</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1477"><a href="#Generator-1477"><span class="linenos">1477</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY (</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1478"><a href="#Generator-1478"><span class="linenos">1478</span></a> +</span><span id="Generator-1479"><a href="#Generator-1479"><span class="linenos">1479</span></a> <span class="k">def</span> <span class="nf">unique_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unique</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1480"><a href="#Generator-1480"><span class="linenos">1480</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Generator-1481"><a href="#Generator-1481"><span class="linenos">1481</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNIQUE (</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1482"><a href="#Generator-1482"><span class="linenos">1482</span></a> +</span><span id="Generator-1483"><a href="#Generator-1483"><span class="linenos">1483</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1484"><a href="#Generator-1484"><span class="linenos">1484</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">case_sql</span><span class="p">(</span> +</span><span id="Generator-1485"><a href="#Generator-1485"><span class="linenos">1485</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">(</span><span class="n">ifs</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()],</span> <span class="n">default</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">))</span> +</span><span id="Generator-1486"><a href="#Generator-1486"><span class="linenos">1486</span></a> <span class="p">)</span> +</span><span id="Generator-1487"><a href="#Generator-1487"><span class="linenos">1487</span></a> +</span><span id="Generator-1488"><a href="#Generator-1488"><span class="linenos">1488</span></a> <span class="k">def</span> <span class="nf">in_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1489"><a href="#Generator-1489"><span class="linenos">1489</span></a> <span class="n">query</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"query"</span><span class="p">)</span> +</span><span id="Generator-1490"><a href="#Generator-1490"><span class="linenos">1490</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unnest"</span><span class="p">)</span> +</span><span id="Generator-1491"><a href="#Generator-1491"><span class="linenos">1491</span></a> <span class="n">field</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"field"</span><span class="p">)</span> +</span><span id="Generator-1492"><a href="#Generator-1492"><span class="linenos">1492</span></a> <span class="n">is_global</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1493"><a href="#Generator-1493"><span class="linenos">1493</span></a> +</span><span id="Generator-1494"><a href="#Generator-1494"><span class="linenos">1494</span></a> <span class="k">if</span> <span class="n">query</span><span class="p">:</span> +</span><span id="Generator-1495"><a href="#Generator-1495"><span class="linenos">1495</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">query</span><span class="p">)</span> +</span><span id="Generator-1496"><a href="#Generator-1496"><span class="linenos">1496</span></a> <span class="k">elif</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="Generator-1497"><a href="#Generator-1497"><span class="linenos">1497</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">in_unnest_op</span><span class="p">(</span><span class="n">unnest</span><span class="p">)</span> +</span><span id="Generator-1498"><a href="#Generator-1498"><span class="linenos">1498</span></a> <span class="k">elif</span> <span class="n">field</span><span class="p">:</span> +</span><span id="Generator-1499"><a href="#Generator-1499"><span class="linenos">1499</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">field</span><span class="p">)</span> +</span><span id="Generator-1500"><a href="#Generator-1500"><span class="linenos">1500</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1501"><a href="#Generator-1501"><span class="linenos">1501</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1502"><a href="#Generator-1502"><span class="linenos">1502</span></a> +</span><span id="Generator-1503"><a href="#Generator-1503"><span class="linenos">1503</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">is_global</span><span class="si">}</span><span class="s2"> IN </span><span class="si">{</span><span class="n">in_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1504"><a href="#Generator-1504"><span class="linenos">1504</span></a> +</span><span id="Generator-1505"><a href="#Generator-1505"><span class="linenos">1505</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">unnest</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1506"><a href="#Generator-1506"><span class="linenos">1506</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(SELECT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">unnest</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1507"><a href="#Generator-1507"><span class="linenos">1507</span></a> +</span><span id="Generator-1508"><a href="#Generator-1508"><span class="linenos">1508</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1509"><a href="#Generator-1509"><span class="linenos">1509</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1510"><a href="#Generator-1510"><span class="linenos">1510</span></a> <span class="k">if</span> <span class="n">this</span><span class="p">:</span> +</span><span id="Generator-1511"><a href="#Generator-1511"><span class="linenos">1511</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-1512"><a href="#Generator-1512"><span class="linenos">1512</span></a> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1513"><a href="#Generator-1513"><span class="linenos">1513</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> +</span><span id="Generator-1514"><a href="#Generator-1514"><span class="linenos">1514</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">" (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1515"><a href="#Generator-1515"><span class="linenos">1515</span></a> <span class="p">)</span> +</span><span id="Generator-1516"><a href="#Generator-1516"><span class="linenos">1516</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1517"><a href="#Generator-1517"><span class="linenos">1517</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator-1518"><a href="#Generator-1518"><span class="linenos">1518</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="Generator-1519"><a href="#Generator-1519"><span class="linenos">1519</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">unit</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1520"><a href="#Generator-1520"><span class="linenos">1520</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERVAL</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1521"><a href="#Generator-1521"><span class="linenos">1521</span></a> +</span><span id="Generator-1522"><a href="#Generator-1522"><span class="linenos">1522</span></a> <span class="k">def</span> <span class="nf">return_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Return</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1523"><a href="#Generator-1523"><span class="linenos">1523</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1524"><a href="#Generator-1524"><span class="linenos">1524</span></a> +</span><span id="Generator-1525"><a href="#Generator-1525"><span class="linenos">1525</span></a> <span class="k">def</span> <span class="nf">reference_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Reference</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1526"><a href="#Generator-1526"><span class="linenos">1526</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1527"><a href="#Generator-1527"><span class="linenos">1527</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1528"><a href="#Generator-1528"><span class="linenos">1528</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">expressions</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1529"><a href="#Generator-1529"><span class="linenos">1529</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator-1530"><a href="#Generator-1530"><span class="linenos">1530</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1531"><a href="#Generator-1531"><span class="linenos">1531</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"REFERENCES </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1532"><a href="#Generator-1532"><span class="linenos">1532</span></a> +</span><span id="Generator-1533"><a href="#Generator-1533"><span class="linenos">1533</span></a> <span class="k">def</span> <span class="nf">anonymous_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1534"><a href="#Generator-1534"><span class="linenos">1534</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator-1535"><a href="#Generator-1535"><span class="linenos">1535</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">))</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1536"><a href="#Generator-1536"><span class="linenos">1536</span></a> +</span><span id="Generator-1537"><a href="#Generator-1537"><span class="linenos">1537</span></a> <span class="k">def</span> <span class="nf">paren_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1538"><a href="#Generator-1538"><span class="linenos">1538</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="Generator-1539"><a href="#Generator-1539"><span class="linenos">1539</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1540"><a href="#Generator-1540"><span class="linenos">1540</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1541"><a href="#Generator-1541"><span class="linenos">1541</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator-1542"><a href="#Generator-1542"><span class="linenos">1542</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1543"><a href="#Generator-1543"><span class="linenos">1543</span></a> +</span><span id="Generator-1544"><a href="#Generator-1544"><span class="linenos">1544</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Generator-1545"><a href="#Generator-1545"><span class="linenos">1545</span></a> +</span><span id="Generator-1546"><a href="#Generator-1546"><span class="linenos">1546</span></a> <span class="k">def</span> <span class="nf">neg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1547"><a href="#Generator-1547"><span class="linenos">1547</span></a> <span class="c1"># This makes sure we don't convert "- - 5" to "--5", which is a comment</span> +</span><span id="Generator-1548"><a href="#Generator-1548"><span class="linenos">1548</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1549"><a href="#Generator-1549"><span class="linenos">1549</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">this_sql</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"-"</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1550"><a href="#Generator-1550"><span class="linenos">1550</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"-</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">this_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1551"><a href="#Generator-1551"><span class="linenos">1551</span></a> +</span><span id="Generator-1552"><a href="#Generator-1552"><span class="linenos">1552</span></a> <span class="k">def</span> <span class="nf">not_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1553"><a href="#Generator-1553"><span class="linenos">1553</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1554"><a href="#Generator-1554"><span class="linenos">1554</span></a> +</span><span id="Generator-1555"><a href="#Generator-1555"><span class="linenos">1555</span></a> <span class="k">def</span> <span class="nf">alias_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1556"><a href="#Generator-1556"><span class="linenos">1556</span></a> <span class="n">to_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator-1557"><a href="#Generator-1557"><span class="linenos">1557</span></a> <span class="n">to_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">to_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">to_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1558"><a href="#Generator-1558"><span class="linenos">1558</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">to_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1559"><a href="#Generator-1559"><span class="linenos">1559</span></a> +</span><span id="Generator-1560"><a href="#Generator-1560"><span class="linenos">1560</span></a> <span class="k">def</span> <span class="nf">aliases_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Aliases</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1561"><a href="#Generator-1561"><span class="linenos">1561</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1562"><a href="#Generator-1562"><span class="linenos">1562</span></a> +</span><span id="Generator-1563"><a href="#Generator-1563"><span class="linenos">1563</span></a> <span class="k">def</span> <span class="nf">attimezone_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1564"><a href="#Generator-1564"><span class="linenos">1564</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1565"><a href="#Generator-1565"><span class="linenos">1565</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">)</span> +</span><span id="Generator-1566"><a href="#Generator-1566"><span class="linenos">1566</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AT TIME ZONE </span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1567"><a href="#Generator-1567"><span class="linenos">1567</span></a> +</span><span id="Generator-1568"><a href="#Generator-1568"><span class="linenos">1568</span></a> <span class="k">def</span> <span class="nf">add_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1569"><a href="#Generator-1569"><span class="linenos">1569</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">)</span> +</span><span id="Generator-1570"><a href="#Generator-1570"><span class="linenos">1570</span></a> +</span><span id="Generator-1571"><a href="#Generator-1571"><span class="linenos">1571</span></a> <span class="k">def</span> <span class="nf">and_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1572"><a href="#Generator-1572"><span class="linenos">1572</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">connector_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"AND"</span><span class="p">)</span> +</span><span id="Generator-1573"><a href="#Generator-1573"><span class="linenos">1573</span></a> +</span><span id="Generator-1574"><a href="#Generator-1574"><span class="linenos">1574</span></a> <span class="k">def</span> <span class="nf">connector_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1575"><a href="#Generator-1575"><span class="linenos">1575</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator-1576"><a href="#Generator-1576"><span class="linenos">1576</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">op</span><span class="p">)</span> +</span><span id="Generator-1577"><a href="#Generator-1577"><span class="linenos">1577</span></a> +</span><span id="Generator-1578"><a href="#Generator-1578"><span class="linenos">1578</span></a> <span class="n">sqls</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(</span><span class="n">unnest</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span> +</span><span id="Generator-1579"><a href="#Generator-1579"><span class="linenos">1579</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">sqls</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator-1580"><a href="#Generator-1580"><span class="linenos">1580</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">op</span><span class="si">}</span><span class="s2"> "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">sqls</span><span class="p">)</span> +</span><span id="Generator-1581"><a href="#Generator-1581"><span class="linenos">1581</span></a> +</span><span id="Generator-1582"><a href="#Generator-1582"><span class="linenos">1582</span></a> <span class="k">def</span> <span class="nf">bitwiseand_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1583"><a href="#Generator-1583"><span class="linenos">1583</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"&"</span><span class="p">)</span> +</span><span id="Generator-1584"><a href="#Generator-1584"><span class="linenos">1584</span></a> +</span><span id="Generator-1585"><a href="#Generator-1585"><span class="linenos">1585</span></a> <span class="k">def</span> <span class="nf">bitwiseleftshift_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1586"><a href="#Generator-1586"><span class="linenos">1586</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<<"</span><span class="p">)</span> +</span><span id="Generator-1587"><a href="#Generator-1587"><span class="linenos">1587</span></a> +</span><span id="Generator-1588"><a href="#Generator-1588"><span class="linenos">1588</span></a> <span class="k">def</span> <span class="nf">bitwisenot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1589"><a href="#Generator-1589"><span class="linenos">1589</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"~</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1590"><a href="#Generator-1590"><span class="linenos">1590</span></a> +</span><span id="Generator-1591"><a href="#Generator-1591"><span class="linenos">1591</span></a> <span class="k">def</span> <span class="nf">bitwiseor_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1592"><a href="#Generator-1592"><span class="linenos">1592</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"|"</span><span class="p">)</span> +</span><span id="Generator-1593"><a href="#Generator-1593"><span class="linenos">1593</span></a> +</span><span id="Generator-1594"><a href="#Generator-1594"><span class="linenos">1594</span></a> <span class="k">def</span> <span class="nf">bitwiserightshift_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1595"><a href="#Generator-1595"><span class="linenos">1595</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">>"</span><span class="p">)</span> +</span><span id="Generator-1596"><a href="#Generator-1596"><span class="linenos">1596</span></a> +</span><span id="Generator-1597"><a href="#Generator-1597"><span class="linenos">1597</span></a> <span class="k">def</span> <span class="nf">bitwisexor_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1598"><a href="#Generator-1598"><span class="linenos">1598</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"^"</span><span class="p">)</span> +</span><span id="Generator-1599"><a href="#Generator-1599"><span class="linenos">1599</span></a> +</span><span id="Generator-1600"><a href="#Generator-1600"><span class="linenos">1600</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1601"><a href="#Generator-1601"><span class="linenos">1601</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1602"><a href="#Generator-1602"><span class="linenos">1602</span></a> +</span><span id="Generator-1603"><a href="#Generator-1603"><span class="linenos">1603</span></a> <span class="k">def</span> <span class="nf">currentdate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1604"><a href="#Generator-1604"><span class="linenos">1604</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1605"><a href="#Generator-1605"><span class="linenos">1605</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CURRENT_DATE(</span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">zone</span> <span class="k">else</span> <span class="s2">"CURRENT_DATE"</span> +</span><span id="Generator-1606"><a href="#Generator-1606"><span class="linenos">1606</span></a> +</span><span id="Generator-1607"><a href="#Generator-1607"><span class="linenos">1607</span></a> <span class="k">def</span> <span class="nf">collate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Collate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1608"><a href="#Generator-1608"><span class="linenos">1608</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"COLLATE"</span><span class="p">)</span> +</span><span id="Generator-1609"><a href="#Generator-1609"><span class="linenos">1609</span></a> +</span><span id="Generator-1610"><a href="#Generator-1610"><span class="linenos">1610</span></a> <span class="k">def</span> <span class="nf">command_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1611"><a href="#Generator-1611"><span class="linenos">1611</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s1">'expression'</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1612"><a href="#Generator-1612"><span class="linenos">1612</span></a> +</span><span id="Generator-1613"><a href="#Generator-1613"><span class="linenos">1613</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1614"><a href="#Generator-1614"><span class="linenos">1614</span></a> <span class="k">return</span> <span class="s2">"BEGIN"</span> +</span><span id="Generator-1615"><a href="#Generator-1615"><span class="linenos">1615</span></a> +</span><span id="Generator-1616"><a href="#Generator-1616"><span class="linenos">1616</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Commit</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1617"><a href="#Generator-1617"><span class="linenos">1617</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"chain"</span><span class="p">)</span> +</span><span id="Generator-1618"><a href="#Generator-1618"><span class="linenos">1618</span></a> <span class="k">if</span> <span class="n">chain</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-1619"><a href="#Generator-1619"><span class="linenos">1619</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="s2">" AND CHAIN"</span> <span class="k">if</span> <span class="n">chain</span> <span class="k">else</span> <span class="s2">" AND NO CHAIN"</span> +</span><span id="Generator-1620"><a href="#Generator-1620"><span class="linenos">1620</span></a> +</span><span id="Generator-1621"><a href="#Generator-1621"><span class="linenos">1621</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COMMIT</span><span class="si">{</span><span class="n">chain</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1622"><a href="#Generator-1622"><span class="linenos">1622</span></a> +</span><span id="Generator-1623"><a href="#Generator-1623"><span class="linenos">1623</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Rollback</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1624"><a href="#Generator-1624"><span class="linenos">1624</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"savepoint"</span><span class="p">)</span> +</span><span id="Generator-1625"><a href="#Generator-1625"><span class="linenos">1625</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" TO </span><span class="si">{</span><span class="n">savepoint</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">savepoint</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1626"><a href="#Generator-1626"><span class="linenos">1626</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ROLLBACK</span><span class="si">{</span><span class="n">savepoint</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1627"><a href="#Generator-1627"><span class="linenos">1627</span></a> +</span><span id="Generator-1628"><a href="#Generator-1628"><span class="linenos">1628</span></a> <span class="k">def</span> <span class="nf">altercolumn_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1629"><a href="#Generator-1629"><span class="linenos">1629</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1630"><a href="#Generator-1630"><span class="linenos">1630</span></a> +</span><span id="Generator-1631"><a href="#Generator-1631"><span class="linenos">1631</span></a> <span class="n">dtype</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"dtype"</span><span class="p">)</span> +</span><span id="Generator-1632"><a href="#Generator-1632"><span class="linenos">1632</span></a> <span class="k">if</span> <span class="n">dtype</span><span class="p">:</span> +</span><span id="Generator-1633"><a href="#Generator-1633"><span class="linenos">1633</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="Generator-1634"><a href="#Generator-1634"><span class="linenos">1634</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1635"><a href="#Generator-1635"><span class="linenos">1635</span></a> <span class="n">using</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">)</span> +</span><span id="Generator-1636"><a href="#Generator-1636"><span class="linenos">1636</span></a> <span class="n">using</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" USING </span><span class="si">{</span><span class="n">using</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">using</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1637"><a href="#Generator-1637"><span class="linenos">1637</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TYPE </span><span class="si">{</span><span class="n">dtype</span><span class="si">}{</span><span class="n">collate</span><span class="si">}{</span><span class="n">using</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1638"><a href="#Generator-1638"><span class="linenos">1638</span></a> +</span><span id="Generator-1639"><a href="#Generator-1639"><span class="linenos">1639</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator-1640"><a href="#Generator-1640"><span class="linenos">1640</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator-1641"><a href="#Generator-1641"><span class="linenos">1641</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> SET DEFAULT </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1642"><a href="#Generator-1642"><span class="linenos">1642</span></a> +</span><span id="Generator-1643"><a href="#Generator-1643"><span class="linenos">1643</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"drop"</span><span class="p">):</span> +</span><span id="Generator-1644"><a href="#Generator-1644"><span class="linenos">1644</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Unsupported ALTER COLUMN syntax"</span><span class="p">)</span> +</span><span id="Generator-1645"><a href="#Generator-1645"><span class="linenos">1645</span></a> +</span><span id="Generator-1646"><a href="#Generator-1646"><span class="linenos">1646</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> DROP DEFAULT"</span> +</span><span id="Generator-1647"><a href="#Generator-1647"><span class="linenos">1647</span></a> +</span><span id="Generator-1648"><a href="#Generator-1648"><span class="linenos">1648</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1649"><a href="#Generator-1649"><span class="linenos">1649</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1650"><a href="#Generator-1650"><span class="linenos">1650</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1651"><a href="#Generator-1651"><span class="linenos">1651</span></a> +</span><span id="Generator-1652"><a href="#Generator-1652"><span class="linenos">1652</span></a> <span class="k">def</span> <span class="nf">altertable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AlterTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1653"><a href="#Generator-1653"><span class="linenos">1653</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"actions"</span><span class="p">]</span> +</span><span id="Generator-1654"><a href="#Generator-1654"><span class="linenos">1654</span></a> +</span><span id="Generator-1655"><a href="#Generator-1655"><span class="linenos">1655</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">):</span> +</span><span id="Generator-1656"><a href="#Generator-1656"><span class="linenos">1656</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ADD COLUMN "</span><span class="p">)</span> +</span><span id="Generator-1657"><a href="#Generator-1657"><span class="linenos">1657</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="Generator-1658"><a href="#Generator-1658"><span class="linenos">1658</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ADD COLUMNS "</span><span class="p">)</span> +</span><span id="Generator-1659"><a href="#Generator-1659"><span class="linenos">1659</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">):</span> +</span><span id="Generator-1660"><a href="#Generator-1660"><span class="linenos">1660</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1661"><a href="#Generator-1661"><span class="linenos">1661</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1662"><a href="#Generator-1662"><span class="linenos">1662</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">)</span> +</span><span id="Generator-1663"><a href="#Generator-1663"><span class="linenos">1663</span></a> +</span><span id="Generator-1664"><a href="#Generator-1664"><span class="linenos">1664</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1665"><a href="#Generator-1665"><span class="linenos">1665</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER TABLE</span><span class="si">{</span><span class="n">exists</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">actions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1666"><a href="#Generator-1666"><span class="linenos">1666</span></a> +</span><span id="Generator-1667"><a href="#Generator-1667"><span class="linenos">1667</span></a> <span class="k">def</span> <span class="nf">droppartition_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DropPartition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1668"><a href="#Generator-1668"><span class="linenos">1668</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1669"><a href="#Generator-1669"><span class="linenos">1669</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator-1670"><a href="#Generator-1670"><span class="linenos">1670</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DROP</span><span class="si">{</span><span class="n">exists</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1671"><a href="#Generator-1671"><span class="linenos">1671</span></a> +</span><span id="Generator-1672"><a href="#Generator-1672"><span class="linenos">1672</span></a> <span class="k">def</span> <span class="nf">addconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1673"><a href="#Generator-1673"><span class="linenos">1673</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1674"><a href="#Generator-1674"><span class="linenos">1674</span></a> <span class="n">expression_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator-1675"><a href="#Generator-1675"><span class="linenos">1675</span></a> <span class="n">add_constraint</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"ADD CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">"ADD"</span> +</span><span id="Generator-1676"><a href="#Generator-1676"><span class="linenos">1676</span></a> +</span><span id="Generator-1677"><a href="#Generator-1677"><span class="linenos">1677</span></a> <span class="n">enforced</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"enforced"</span><span class="p">)</span> +</span><span id="Generator-1678"><a href="#Generator-1678"><span class="linenos">1678</span></a> <span class="k">if</span> <span class="n">enforced</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator-1679"><a href="#Generator-1679"><span class="linenos">1679</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">add_constraint</span><span class="si">}</span><span class="s2"> CHECK (</span><span class="si">{</span><span class="n">expression_</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="s1">' ENFORCED'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">enforced</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1680"><a href="#Generator-1680"><span class="linenos">1680</span></a> +</span><span id="Generator-1681"><a href="#Generator-1681"><span class="linenos">1681</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">add_constraint</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expression_</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1682"><a href="#Generator-1682"><span class="linenos">1682</span></a> +</span><span id="Generator-1683"><a href="#Generator-1683"><span class="linenos">1683</span></a> <span class="k">def</span> <span class="nf">distinct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1684"><a href="#Generator-1684"><span class="linenos">1684</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1685"><a href="#Generator-1685"><span class="linenos">1685</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1686"><a href="#Generator-1686"><span class="linenos">1686</span></a> +</span><span id="Generator-1687"><a href="#Generator-1687"><span class="linenos">1687</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">)</span> +</span><span id="Generator-1688"><a href="#Generator-1688"><span class="linenos">1688</span></a> <span class="n">on</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">on</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1689"><a href="#Generator-1689"><span class="linenos">1689</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DISTINCT</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">on</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1690"><a href="#Generator-1690"><span class="linenos">1690</span></a> +</span><span id="Generator-1691"><a href="#Generator-1691"><span class="linenos">1691</span></a> <span class="k">def</span> <span class="nf">ignorenulls_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1692"><a href="#Generator-1692"><span class="linenos">1692</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> IGNORE NULLS"</span> +</span><span id="Generator-1693"><a href="#Generator-1693"><span class="linenos">1693</span></a> +</span><span id="Generator-1694"><a href="#Generator-1694"><span class="linenos">1694</span></a> <span class="k">def</span> <span class="nf">respectnulls_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RespectNulls</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1695"><a href="#Generator-1695"><span class="linenos">1695</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> RESPECT NULLS"</span> +</span><span id="Generator-1696"><a href="#Generator-1696"><span class="linenos">1696</span></a> +</span><span id="Generator-1697"><a href="#Generator-1697"><span class="linenos">1697</span></a> <span class="k">def</span> <span class="nf">intdiv_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1698"><a href="#Generator-1698"><span class="linenos">1698</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span> +</span><span id="Generator-1699"><a href="#Generator-1699"><span class="linenos">1699</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="Generator-1700"><a href="#Generator-1700"><span class="linenos">1700</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">),</span> +</span><span id="Generator-1701"><a href="#Generator-1701"><span class="linenos">1701</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="Generator-1702"><a href="#Generator-1702"><span class="linenos">1702</span></a> <span class="p">)</span> +</span><span id="Generator-1703"><a href="#Generator-1703"><span class="linenos">1703</span></a> <span class="p">)</span> +</span><span id="Generator-1704"><a href="#Generator-1704"><span class="linenos">1704</span></a> +</span><span id="Generator-1705"><a href="#Generator-1705"><span class="linenos">1705</span></a> <span class="k">def</span> <span class="nf">dpipe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DPipe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1706"><a href="#Generator-1706"><span class="linenos">1706</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"||"</span><span class="p">)</span> +</span><span id="Generator-1707"><a href="#Generator-1707"><span class="linenos">1707</span></a> +</span><span id="Generator-1708"><a href="#Generator-1708"><span class="linenos">1708</span></a> <span class="k">def</span> <span class="nf">div_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1709"><a href="#Generator-1709"><span class="linenos">1709</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"/"</span><span class="p">)</span> +</span><span id="Generator-1710"><a href="#Generator-1710"><span class="linenos">1710</span></a> +</span><span id="Generator-1711"><a href="#Generator-1711"><span class="linenos">1711</span></a> <span class="k">def</span> <span class="nf">distance_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distance</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1712"><a href="#Generator-1712"><span class="linenos">1712</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<->"</span><span class="p">)</span> +</span><span id="Generator-1713"><a href="#Generator-1713"><span class="linenos">1713</span></a> +</span><span id="Generator-1714"><a href="#Generator-1714"><span class="linenos">1714</span></a> <span class="k">def</span> <span class="nf">dot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1715"><a href="#Generator-1715"><span class="linenos">1715</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1716"><a href="#Generator-1716"><span class="linenos">1716</span></a> +</span><span id="Generator-1717"><a href="#Generator-1717"><span class="linenos">1717</span></a> <span class="k">def</span> <span class="nf">eq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1718"><a href="#Generator-1718"><span class="linenos">1718</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"="</span><span class="p">)</span> +</span><span id="Generator-1719"><a href="#Generator-1719"><span class="linenos">1719</span></a> +</span><span id="Generator-1720"><a href="#Generator-1720"><span class="linenos">1720</span></a> <span class="k">def</span> <span class="nf">escape_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Escape</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1721"><a href="#Generator-1721"><span class="linenos">1721</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"ESCAPE"</span><span class="p">)</span> +</span><span id="Generator-1722"><a href="#Generator-1722"><span class="linenos">1722</span></a> +</span><span id="Generator-1723"><a href="#Generator-1723"><span class="linenos">1723</span></a> <span class="k">def</span> <span class="nf">glob_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Glob</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1724"><a href="#Generator-1724"><span class="linenos">1724</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"GLOB"</span><span class="p">)</span> +</span><span id="Generator-1725"><a href="#Generator-1725"><span class="linenos">1725</span></a> +</span><span id="Generator-1726"><a href="#Generator-1726"><span class="linenos">1726</span></a> <span class="k">def</span> <span class="nf">gt_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1727"><a href="#Generator-1727"><span class="linenos">1727</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">"</span><span class="p">)</span> +</span><span id="Generator-1728"><a href="#Generator-1728"><span class="linenos">1728</span></a> +</span><span id="Generator-1729"><a href="#Generator-1729"><span class="linenos">1729</span></a> <span class="k">def</span> <span class="nf">gte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1730"><a href="#Generator-1730"><span class="linenos">1730</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">="</span><span class="p">)</span> +</span><span id="Generator-1731"><a href="#Generator-1731"><span class="linenos">1731</span></a> +</span><span id="Generator-1732"><a href="#Generator-1732"><span class="linenos">1732</span></a> <span class="k">def</span> <span class="nf">ilike_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1733"><a href="#Generator-1733"><span class="linenos">1733</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"ILIKE"</span><span class="p">)</span> +</span><span id="Generator-1734"><a href="#Generator-1734"><span class="linenos">1734</span></a> +</span><span id="Generator-1735"><a href="#Generator-1735"><span class="linenos">1735</span></a> <span class="k">def</span> <span class="nf">is_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1736"><a href="#Generator-1736"><span class="linenos">1736</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS"</span><span class="p">)</span> +</span><span id="Generator-1737"><a href="#Generator-1737"><span class="linenos">1737</span></a> +</span><span id="Generator-1738"><a href="#Generator-1738"><span class="linenos">1738</span></a> <span class="k">def</span> <span class="nf">like_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1739"><a href="#Generator-1739"><span class="linenos">1739</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"LIKE"</span><span class="p">)</span> +</span><span id="Generator-1740"><a href="#Generator-1740"><span class="linenos">1740</span></a> +</span><span id="Generator-1741"><a href="#Generator-1741"><span class="linenos">1741</span></a> <span class="k">def</span> <span class="nf">similarto_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SimilarTo</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1742"><a href="#Generator-1742"><span class="linenos">1742</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"SIMILAR TO"</span><span class="p">)</span> +</span><span id="Generator-1743"><a href="#Generator-1743"><span class="linenos">1743</span></a> +</span><span id="Generator-1744"><a href="#Generator-1744"><span class="linenos">1744</span></a> <span class="k">def</span> <span class="nf">lt_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1745"><a href="#Generator-1745"><span class="linenos">1745</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<"</span><span class="p">)</span> +</span><span id="Generator-1746"><a href="#Generator-1746"><span class="linenos">1746</span></a> +</span><span id="Generator-1747"><a href="#Generator-1747"><span class="linenos">1747</span></a> <span class="k">def</span> <span class="nf">lte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1748"><a href="#Generator-1748"><span class="linenos">1748</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<="</span><span class="p">)</span> +</span><span id="Generator-1749"><a href="#Generator-1749"><span class="linenos">1749</span></a> +</span><span id="Generator-1750"><a href="#Generator-1750"><span class="linenos">1750</span></a> <span class="k">def</span> <span class="nf">mod_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1751"><a href="#Generator-1751"><span class="linenos">1751</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"%"</span><span class="p">)</span> +</span><span id="Generator-1752"><a href="#Generator-1752"><span class="linenos">1752</span></a> +</span><span id="Generator-1753"><a href="#Generator-1753"><span class="linenos">1753</span></a> <span class="k">def</span> <span class="nf">mul_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1754"><a href="#Generator-1754"><span class="linenos">1754</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">)</span> +</span><span id="Generator-1755"><a href="#Generator-1755"><span class="linenos">1755</span></a> +</span><span id="Generator-1756"><a href="#Generator-1756"><span class="linenos">1756</span></a> <span class="k">def</span> <span class="nf">neq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1757"><a href="#Generator-1757"><span class="linenos">1757</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<>"</span><span class="p">)</span> +</span><span id="Generator-1758"><a href="#Generator-1758"><span class="linenos">1758</span></a> +</span><span id="Generator-1759"><a href="#Generator-1759"><span class="linenos">1759</span></a> <span class="k">def</span> <span class="nf">nullsafeeq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1760"><a href="#Generator-1760"><span class="linenos">1760</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS NOT DISTINCT FROM"</span><span class="p">)</span> +</span><span id="Generator-1761"><a href="#Generator-1761"><span class="linenos">1761</span></a> +</span><span id="Generator-1762"><a href="#Generator-1762"><span class="linenos">1762</span></a> <span class="k">def</span> <span class="nf">nullsafeneq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1763"><a href="#Generator-1763"><span class="linenos">1763</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS DISTINCT FROM"</span><span class="p">)</span> +</span><span id="Generator-1764"><a href="#Generator-1764"><span class="linenos">1764</span></a> +</span><span id="Generator-1765"><a href="#Generator-1765"><span class="linenos">1765</span></a> <span class="k">def</span> <span class="nf">or_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1766"><a href="#Generator-1766"><span class="linenos">1766</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">connector_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"OR"</span><span class="p">)</span> +</span><span id="Generator-1767"><a href="#Generator-1767"><span class="linenos">1767</span></a> +</span><span id="Generator-1768"><a href="#Generator-1768"><span class="linenos">1768</span></a> <span class="k">def</span> <span class="nf">slice_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1769"><a href="#Generator-1769"><span class="linenos">1769</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">":"</span><span class="p">)</span> +</span><span id="Generator-1770"><a href="#Generator-1770"><span class="linenos">1770</span></a> +</span><span id="Generator-1771"><a href="#Generator-1771"><span class="linenos">1771</span></a> <span class="k">def</span> <span class="nf">sub_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1772"><a href="#Generator-1772"><span class="linenos">1772</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span><span id="Generator-1773"><a href="#Generator-1773"><span class="linenos">1773</span></a> +</span><span id="Generator-1774"><a href="#Generator-1774"><span class="linenos">1774</span></a> <span class="k">def</span> <span class="nf">trycast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1775"><a href="#Generator-1775"><span class="linenos">1775</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TRY_CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1776"><a href="#Generator-1776"><span class="linenos">1776</span></a> +</span><span id="Generator-1777"><a href="#Generator-1777"><span class="linenos">1777</span></a> <span class="k">def</span> <span class="nf">use_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Use</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1778"><a href="#Generator-1778"><span class="linenos">1778</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator-1779"><a href="#Generator-1779"><span class="linenos">1779</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1780"><a href="#Generator-1780"><span class="linenos">1780</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1781"><a href="#Generator-1781"><span class="linenos">1781</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1782"><a href="#Generator-1782"><span class="linenos">1782</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"USE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1783"><a href="#Generator-1783"><span class="linenos">1783</span></a> +</span><span id="Generator-1784"><a href="#Generator-1784"><span class="linenos">1784</span></a> <span class="k">def</span> <span class="nf">binary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1785"><a href="#Generator-1785"><span class="linenos">1785</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">op</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1786"><a href="#Generator-1786"><span class="linenos">1786</span></a> +</span><span id="Generator-1787"><a href="#Generator-1787"><span class="linenos">1787</span></a> <span class="k">def</span> <span class="nf">function_fallback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1788"><a href="#Generator-1788"><span class="linenos">1788</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-1789"><a href="#Generator-1789"><span class="linenos">1789</span></a> <span class="k">for</span> <span class="n">arg_value</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Generator-1790"><a href="#Generator-1790"><span class="linenos">1790</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg_value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="Generator-1791"><a href="#Generator-1791"><span class="linenos">1791</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">arg_value</span><span class="p">:</span> +</span><span id="Generator-1792"><a href="#Generator-1792"><span class="linenos">1792</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Generator-1793"><a href="#Generator-1793"><span class="linenos">1793</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1794"><a href="#Generator-1794"><span class="linenos">1794</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arg_value</span><span class="p">)</span> +</span><span id="Generator-1795"><a href="#Generator-1795"><span class="linenos">1795</span></a> +</span><span id="Generator-1796"><a href="#Generator-1796"><span class="linenos">1796</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">sql_name</span><span class="p">())</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1797"><a href="#Generator-1797"><span class="linenos">1797</span></a> +</span><span id="Generator-1798"><a href="#Generator-1798"><span class="linenos">1798</span></a> <span class="k">def</span> <span class="nf">format_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1799"><a href="#Generator-1799"><span class="linenos">1799</span></a> <span class="n">arg_sqls</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="n">arg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Generator-1800"><a href="#Generator-1800"><span class="linenos">1800</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span><span class="p">:</span> +</span><span id="Generator-1801"><a href="#Generator-1801"><span class="linenos">1801</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="sa">f</span><span class="s2">",</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">skip_last</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1802"><a href="#Generator-1802"><span class="linenos">1802</span></a> <span class="k">return</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> +</span><span id="Generator-1803"><a href="#Generator-1803"><span class="linenos">1803</span></a> +</span><span id="Generator-1804"><a href="#Generator-1804"><span class="linenos">1804</span></a> <span class="k">def</span> <span class="nf">text_width</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="Generator-1805"><a href="#Generator-1805"><span class="linenos">1805</span></a> <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="Generator-1806"><a href="#Generator-1806"><span class="linenos">1806</span></a> +</span><span id="Generator-1807"><a href="#Generator-1807"><span class="linenos">1807</span></a> <span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Generator-1808"><a href="#Generator-1808"><span class="linenos">1808</span></a> <span class="k">return</span> <span class="n">format_time</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_trie</span><span class="p">)</span> +</span><span id="Generator-1809"><a href="#Generator-1809"><span class="linenos">1809</span></a> +</span><span id="Generator-1810"><a href="#Generator-1810"><span class="linenos">1810</span></a> <span class="k">def</span> <span class="nf">expressions</span><span class="p">(</span> +</span><span id="Generator-1811"><a href="#Generator-1811"><span class="linenos">1811</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator-1812"><a href="#Generator-1812"><span class="linenos">1812</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> +</span><span id="Generator-1813"><a href="#Generator-1813"><span class="linenos">1813</span></a> <span class="n">key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator-1814"><a href="#Generator-1814"><span class="linenos">1814</span></a> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Generator-1815"><a href="#Generator-1815"><span class="linenos">1815</span></a> <span class="n">indent</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Generator-1816"><a href="#Generator-1816"><span class="linenos">1816</span></a> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">,</span> +</span><span id="Generator-1817"><a href="#Generator-1817"><span class="linenos">1817</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator-1818"><a href="#Generator-1818"><span class="linenos">1818</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1819"><a href="#Generator-1819"><span class="linenos">1819</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span> <span class="ow">or</span> <span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Generator-1820"><a href="#Generator-1820"><span class="linenos">1820</span></a> +</span><span id="Generator-1821"><a href="#Generator-1821"><span class="linenos">1821</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator-1822"><a href="#Generator-1822"><span class="linenos">1822</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator-1823"><a href="#Generator-1823"><span class="linenos">1823</span></a> +</span><span id="Generator-1824"><a href="#Generator-1824"><span class="linenos">1824</span></a> <span class="k">if</span> <span class="n">flat</span><span class="p">:</span> +</span><span id="Generator-1825"><a href="#Generator-1825"><span class="linenos">1825</span></a> <span class="k">return</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator-1826"><a href="#Generator-1826"><span class="linenos">1826</span></a> +</span><span id="Generator-1827"><a href="#Generator-1827"><span class="linenos">1827</span></a> <span class="n">num_sqls</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator-1828"><a href="#Generator-1828"><span class="linenos">1828</span></a> +</span><span id="Generator-1829"><a href="#Generator-1829"><span class="linenos">1829</span></a> <span class="c1"># These are calculated once in case we have the leading_comma / pretty option set, correspondingly</span> +</span><span id="Generator-1830"><a href="#Generator-1830"><span class="linenos">1830</span></a> <span class="n">pad</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> +</span><span id="Generator-1831"><a href="#Generator-1831"><span class="linenos">1831</span></a> <span class="n">stripped_sep</span> <span class="o">=</span> <span class="n">sep</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="Generator-1832"><a href="#Generator-1832"><span class="linenos">1832</span></a> +</span><span id="Generator-1833"><a href="#Generator-1833"><span class="linenos">1833</span></a> <span class="n">result_sqls</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator-1834"><a href="#Generator-1834"><span class="linenos">1834</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="Generator-1835"><a href="#Generator-1835"><span class="linenos">1835</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator-1836"><a href="#Generator-1836"><span class="linenos">1836</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">maybe_comment</span><span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator-1837"><a href="#Generator-1837"><span class="linenos">1837</span></a> +</span><span id="Generator-1838"><a href="#Generator-1838"><span class="linenos">1838</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator-1839"><a href="#Generator-1839"><span class="linenos">1839</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_leading_comma</span><span class="p">:</span> +</span><span id="Generator-1840"><a href="#Generator-1840"><span class="linenos">1840</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="n">pad</span><span class="si">}{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">comments</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1841"><a href="#Generator-1841"><span class="linenos">1841</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1842"><a href="#Generator-1842"><span class="linenos">1842</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Generator-1843"><a href="#Generator-1843"><span class="linenos">1843</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">stripped_sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">num_sqls</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">comments</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1844"><a href="#Generator-1844"><span class="linenos">1844</span></a> <span class="p">)</span> +</span><span id="Generator-1845"><a href="#Generator-1845"><span class="linenos">1845</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1846"><a href="#Generator-1846"><span class="linenos">1846</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">comments</span><span class="si">}{</span><span class="n">sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">num_sqls</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1847"><a href="#Generator-1847"><span class="linenos">1847</span></a> +</span><span id="Generator-1848"><a href="#Generator-1848"><span class="linenos">1848</span></a> <span class="n">result_sql</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result_sqls</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result_sqls</span><span class="p">)</span> +</span><span id="Generator-1849"><a href="#Generator-1849"><span class="linenos">1849</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="n">result_sql</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="k">if</span> <span class="n">indent</span> <span class="k">else</span> <span class="n">result_sql</span> +</span><span id="Generator-1850"><a href="#Generator-1850"><span class="linenos">1850</span></a> +</span><span id="Generator-1851"><a href="#Generator-1851"><span class="linenos">1851</span></a> <span class="k">def</span> <span class="nf">op_expressions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1852"><a href="#Generator-1852"><span class="linenos">1852</span></a> <span class="n">expressions_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="n">flat</span><span class="p">)</span> +</span><span id="Generator-1853"><a href="#Generator-1853"><span class="linenos">1853</span></a> <span class="k">if</span> <span class="n">flat</span><span class="p">:</span> +</span><span id="Generator-1854"><a href="#Generator-1854"><span class="linenos">1854</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">op</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1855"><a href="#Generator-1855"><span class="linenos">1855</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">op</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expressions_sql</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1856"><a href="#Generator-1856"><span class="linenos">1856</span></a> +</span><span id="Generator-1857"><a href="#Generator-1857"><span class="linenos">1857</span></a> <span class="k">def</span> <span class="nf">naked_property</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1858"><a href="#Generator-1858"><span class="linenos">1858</span></a> <span class="n">property_name</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">PROPERTY_TO_NAME</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="Generator-1859"><a href="#Generator-1859"><span class="linenos">1859</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">property_name</span><span class="p">:</span> +</span><span id="Generator-1860"><a href="#Generator-1860"><span class="linenos">1860</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator-1861"><a href="#Generator-1861"><span class="linenos">1861</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">property_name</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1862"><a href="#Generator-1862"><span class="linenos">1862</span></a> +</span><span id="Generator-1863"><a href="#Generator-1863"><span class="linenos">1863</span></a> <span class="k">def</span> <span class="nf">set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1864"><a href="#Generator-1864"><span class="linenos">1864</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1865"><a href="#Generator-1865"><span class="linenos">1865</span></a> <span class="n">op</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">op</span><span class="p">)</span> +</span><span id="Generator-1866"><a href="#Generator-1866"><span class="linenos">1866</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="Generator-1867"><a href="#Generator-1867"><span class="linenos">1867</span></a> <span class="n">expression</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">op</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1868"><a href="#Generator-1868"><span class="linenos">1868</span></a> <span class="p">)</span> +</span><span id="Generator-1869"><a href="#Generator-1869"><span class="linenos">1869</span></a> +</span><span id="Generator-1870"><a href="#Generator-1870"><span class="linenos">1870</span></a> <span class="k">def</span> <span class="nf">tag_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tag</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1871"><a href="#Generator-1871"><span class="linenos">1871</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'prefix'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}{</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'postfix'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1872"><a href="#Generator-1872"><span class="linenos">1872</span></a> +</span><span id="Generator-1873"><a href="#Generator-1873"><span class="linenos">1873</span></a> <span class="k">def</span> <span class="nf">token_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1874"><a href="#Generator-1874"><span class="linenos">1874</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">TOKEN_MAPPING</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">token_type</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="Generator-1875"><a href="#Generator-1875"><span class="linenos">1875</span></a> +</span><span id="Generator-1876"><a href="#Generator-1876"><span class="linenos">1876</span></a> <span class="k">def</span> <span class="nf">userdefinedfunction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1877"><a href="#Generator-1877"><span class="linenos">1877</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1878"><a href="#Generator-1878"><span class="linenos">1878</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator-1879"><a href="#Generator-1879"><span class="linenos">1879</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator-1880"><a href="#Generator-1880"><span class="linenos">1880</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"wrapped"</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1881"><a href="#Generator-1881"><span class="linenos">1881</span></a> <span class="p">)</span> +</span><span id="Generator-1882"><a href="#Generator-1882"><span class="linenos">1882</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1883"><a href="#Generator-1883"><span class="linenos">1883</span></a> +</span><span id="Generator-1884"><a href="#Generator-1884"><span class="linenos">1884</span></a> <span class="k">def</span> <span class="nf">userdefinedfunctionkwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunctionKwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1885"><a href="#Generator-1885"><span class="linenos">1885</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1886"><a href="#Generator-1886"><span class="linenos">1886</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator-1887"><a href="#Generator-1887"><span class="linenos">1887</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1888"><a href="#Generator-1888"><span class="linenos">1888</span></a> +</span><span id="Generator-1889"><a href="#Generator-1889"><span class="linenos">1889</span></a> <span class="k">def</span> <span class="nf">joinhint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1890"><a href="#Generator-1890"><span class="linenos">1890</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1891"><a href="#Generator-1891"><span class="linenos">1891</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator-1892"><a href="#Generator-1892"><span class="linenos">1892</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator-1893"><a href="#Generator-1893"><span class="linenos">1893</span></a> +</span><span id="Generator-1894"><a href="#Generator-1894"><span class="linenos">1894</span></a> <span class="k">def</span> <span class="nf">kwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Kwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1895"><a href="#Generator-1895"><span class="linenos">1895</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"=>"</span><span class="p">)</span> +</span><span id="Generator-1896"><a href="#Generator-1896"><span class="linenos">1896</span></a> +</span><span id="Generator-1897"><a href="#Generator-1897"><span class="linenos">1897</span></a> <span class="k">def</span> <span class="nf">when_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">When</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1898"><a href="#Generator-1898"><span class="linenos">1898</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1899"><a href="#Generator-1899"><span class="linenos">1899</span></a> <span class="n">then_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"then"</span><span class="p">)</span> +</span><span id="Generator-1900"><a href="#Generator-1900"><span class="linenos">1900</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">):</span> +</span><span id="Generator-1901"><a href="#Generator-1901"><span class="linenos">1901</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INSERT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1902"><a href="#Generator-1902"><span class="linenos">1902</span></a> <span class="k">if</span> <span class="s2">"expression"</span> <span class="ow">in</span> <span class="n">then_expression</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Generator-1903"><a href="#Generator-1903"><span class="linenos">1903</span></a> <span class="n">then</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" VALUES </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1904"><a href="#Generator-1904"><span class="linenos">1904</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">):</span> +</span><span id="Generator-1905"><a href="#Generator-1905"><span class="linenos">1905</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="Generator-1906"><a href="#Generator-1906"><span class="linenos">1906</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1907"><a href="#Generator-1907"><span class="linenos">1907</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1908"><a href="#Generator-1908"><span class="linenos">1908</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1909"><a href="#Generator-1909"><span class="linenos">1909</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator-1910"><a href="#Generator-1910"><span class="linenos">1910</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">)</span> +</span><span id="Generator-1911"><a href="#Generator-1911"><span class="linenos">1911</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WHEN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">then</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1912"><a href="#Generator-1912"><span class="linenos">1912</span></a> +</span><span id="Generator-1913"><a href="#Generator-1913"><span class="linenos">1913</span></a> <span class="k">def</span> <span class="nf">merge_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Merge</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator-1914"><a href="#Generator-1914"><span class="linenos">1914</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator-1915"><a href="#Generator-1915"><span class="linenos">1915</span></a> <span class="n">using</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'using'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1916"><a href="#Generator-1916"><span class="linenos">1916</span></a> <span class="n">on</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"ON </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'on'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator-1917"><a href="#Generator-1917"><span class="linenos">1917</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MERGE INTO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">using</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">' '</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key +represents a python time format and the output the target time format</li> +<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> +<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> +<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> +<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> +<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> +<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> +<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding +character.</li> +<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> +<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> +<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> +<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> +<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> +<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> +<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None +Default: "upper"</li> +<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample +Default: False</li> +<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters +unsupported expressions. Default ErrorLevel.WARN.</li> +<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +This is only relevant if unsupported_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +Default: False</li> +<li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. +The default is on the smaller end because the length only represents a segment and not the true +line length. +Default: 80</li> +<li><strong>comments:</strong> Whether or not to preserve comments in the output SQL code. +Default: True</li> +</ul> +</div> + + + <div id="Generator.__init__" class="classattr"> + <input id="Generator.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Generator</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">time_mapping</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">time_trie</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">pretty</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">quote_start</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">quote_end</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">identifier_start</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">identifier_end</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">identify</span><span class="o">=</span><span class="kc">False</span>,</span><span class="param"> <span class="n">normalize</span><span class="o">=</span><span class="kc">False</span>,</span><span class="param"> <span class="n">string_escape</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">identifier_escape</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">pad</span><span class="o">=</span><span class="mi">2</span>,</span><span class="param"> <span class="n">indent</span><span class="o">=</span><span class="mi">2</span>,</span><span class="param"> <span class="n">index_offset</span><span class="o">=</span><span class="mi">0</span>,</span><span class="param"> <span class="n">unnest_column_only</span><span class="o">=</span><span class="kc">False</span>,</span><span class="param"> <span class="n">alias_post_tablesample</span><span class="o">=</span><span class="kc">False</span>,</span><span class="param"> <span class="n">normalize_functions</span><span class="o">=</span><span class="s1">'upper'</span>,</span><span class="param"> <span class="n">unsupported_level</span><span class="o">=<</span><span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> <span class="s1">'WARN'</span><span class="o">></span>,</span><span class="param"> <span class="n">null_ordering</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">max_unsupported</span><span class="o">=</span><span class="mi">3</span>,</span><span class="param"> <span class="n">leading_comma</span><span class="o">=</span><span class="kc">False</span>,</span><span class="param"> <span class="n">max_text_width</span><span class="o">=</span><span class="mi">80</span>,</span><span class="param"> <span class="n">comments</span><span class="o">=</span><span class="kc">True</span></span>)</span> + + <label class="view-source-button" for="Generator.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.__init__-185"><a href="#Generator.__init__-185"><span class="linenos">185</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Generator.__init__-186"><a href="#Generator.__init__-186"><span class="linenos">186</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator.__init__-187"><a href="#Generator.__init__-187"><span class="linenos">187</span></a> <span class="n">time_mapping</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-188"><a href="#Generator.__init__-188"><span class="linenos">188</span></a> <span class="n">time_trie</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-189"><a href="#Generator.__init__-189"><span class="linenos">189</span></a> <span class="n">pretty</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-190"><a href="#Generator.__init__-190"><span class="linenos">190</span></a> <span class="n">quote_start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-191"><a href="#Generator.__init__-191"><span class="linenos">191</span></a> <span class="n">quote_end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-192"><a href="#Generator.__init__-192"><span class="linenos">192</span></a> <span class="n">identifier_start</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-193"><a href="#Generator.__init__-193"><span class="linenos">193</span></a> <span class="n">identifier_end</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-194"><a href="#Generator.__init__-194"><span class="linenos">194</span></a> <span class="n">identify</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.__init__-195"><a href="#Generator.__init__-195"><span class="linenos">195</span></a> <span class="n">normalize</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.__init__-196"><a href="#Generator.__init__-196"><span class="linenos">196</span></a> <span class="n">string_escape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-197"><a href="#Generator.__init__-197"><span class="linenos">197</span></a> <span class="n">identifier_escape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-198"><a href="#Generator.__init__-198"><span class="linenos">198</span></a> <span class="n">pad</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> +</span><span id="Generator.__init__-199"><a href="#Generator.__init__-199"><span class="linenos">199</span></a> <span class="n">indent</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> +</span><span id="Generator.__init__-200"><a href="#Generator.__init__-200"><span class="linenos">200</span></a> <span class="n">index_offset</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> +</span><span id="Generator.__init__-201"><a href="#Generator.__init__-201"><span class="linenos">201</span></a> <span class="n">unnest_column_only</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.__init__-202"><a href="#Generator.__init__-202"><span class="linenos">202</span></a> <span class="n">alias_post_tablesample</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.__init__-203"><a href="#Generator.__init__-203"><span class="linenos">203</span></a> <span class="n">normalize_functions</span><span class="o">=</span><span class="s2">"upper"</span><span class="p">,</span> +</span><span id="Generator.__init__-204"><a href="#Generator.__init__-204"><span class="linenos">204</span></a> <span class="n">unsupported_level</span><span class="o">=</span><span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">,</span> +</span><span id="Generator.__init__-205"><a href="#Generator.__init__-205"><span class="linenos">205</span></a> <span class="n">null_ordering</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.__init__-206"><a href="#Generator.__init__-206"><span class="linenos">206</span></a> <span class="n">max_unsupported</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> +</span><span id="Generator.__init__-207"><a href="#Generator.__init__-207"><span class="linenos">207</span></a> <span class="n">leading_comma</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.__init__-208"><a href="#Generator.__init__-208"><span class="linenos">208</span></a> <span class="n">max_text_width</span><span class="o">=</span><span class="mi">80</span><span class="p">,</span> +</span><span id="Generator.__init__-209"><a href="#Generator.__init__-209"><span class="linenos">209</span></a> <span class="n">comments</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Generator.__init__-210"><a href="#Generator.__init__-210"><span class="linenos">210</span></a> <span class="p">):</span> +</span><span id="Generator.__init__-211"><a href="#Generator.__init__-211"><span class="linenos">211</span></a> <span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="Generator.__init__-212"><a href="#Generator.__init__-212"><span class="linenos">212</span></a> +</span><span id="Generator.__init__-213"><a href="#Generator.__init__-213"><span class="linenos">213</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">time_mapping</span> <span class="o">=</span> <span class="n">time_mapping</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="Generator.__init__-214"><a href="#Generator.__init__-214"><span class="linenos">214</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">time_trie</span> <span class="o">=</span> <span class="n">time_trie</span> +</span><span id="Generator.__init__-215"><a href="#Generator.__init__-215"><span class="linenos">215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="o">=</span> <span class="n">pretty</span> <span class="k">if</span> <span class="n">pretty</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">pretty</span> +</span><span id="Generator.__init__-216"><a href="#Generator.__init__-216"><span class="linenos">216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span> <span class="o">=</span> <span class="n">quote_start</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="Generator.__init__-217"><a href="#Generator.__init__-217"><span class="linenos">217</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span> <span class="o">=</span> <span class="n">quote_end</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="Generator.__init__-218"><a href="#Generator.__init__-218"><span class="linenos">218</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span> <span class="o">=</span> <span class="n">identifier_start</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="Generator.__init__-219"><a href="#Generator.__init__-219"><span class="linenos">219</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span> <span class="o">=</span> <span class="n">identifier_end</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="Generator.__init__-220"><a href="#Generator.__init__-220"><span class="linenos">220</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="n">identify</span> +</span><span id="Generator.__init__-221"><a href="#Generator.__init__-221"><span class="linenos">221</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">normalize</span> <span class="o">=</span> <span class="n">normalize</span> +</span><span id="Generator.__init__-222"><a href="#Generator.__init__-222"><span class="linenos">222</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">=</span> <span class="n">string_escape</span> <span class="ow">or</span> <span class="s2">"'"</span> +</span><span id="Generator.__init__-223"><a href="#Generator.__init__-223"><span class="linenos">223</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_escape</span> <span class="o">=</span> <span class="n">identifier_escape</span> <span class="ow">or</span> <span class="s1">'"'</span> +</span><span id="Generator.__init__-224"><a href="#Generator.__init__-224"><span class="linenos">224</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> <span class="o">=</span> <span class="n">pad</span> +</span><span id="Generator.__init__-225"><a href="#Generator.__init__-225"><span class="linenos">225</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span> <span class="o">=</span> <span class="n">index_offset</span> +</span><span id="Generator.__init__-226"><a href="#Generator.__init__-226"><span class="linenos">226</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span> <span class="o">=</span> <span class="n">unnest_column_only</span> +</span><span id="Generator.__init__-227"><a href="#Generator.__init__-227"><span class="linenos">227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="n">alias_post_tablesample</span> +</span><span id="Generator.__init__-228"><a href="#Generator.__init__-228"><span class="linenos">228</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">=</span> <span class="n">normalize_functions</span> +</span><span id="Generator.__init__-229"><a href="#Generator.__init__-229"><span class="linenos">229</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">=</span> <span class="n">unsupported_level</span> +</span><span id="Generator.__init__-230"><a href="#Generator.__init__-230"><span class="linenos">230</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.__init__-231"><a href="#Generator.__init__-231"><span class="linenos">231</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">max_unsupported</span> <span class="o">=</span> <span class="n">max_unsupported</span> +</span><span id="Generator.__init__-232"><a href="#Generator.__init__-232"><span class="linenos">232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">=</span> <span class="n">null_ordering</span> +</span><span id="Generator.__init__-233"><a href="#Generator.__init__-233"><span class="linenos">233</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_indent</span> <span class="o">=</span> <span class="n">indent</span> +</span><span id="Generator.__init__-234"><a href="#Generator.__init__-234"><span class="linenos">234</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">==</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span> +</span><span id="Generator.__init__-235"><a href="#Generator.__init__-235"><span class="linenos">235</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_quote_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">string_escape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span> +</span><span id="Generator.__init__-236"><a href="#Generator.__init__-236"><span class="linenos">236</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_identifier_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_escape</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span> +</span><span id="Generator.__init__-237"><a href="#Generator.__init__-237"><span class="linenos">237</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_leading_comma</span> <span class="o">=</span> <span class="n">leading_comma</span> +</span><span id="Generator.__init__-238"><a href="#Generator.__init__-238"><span class="linenos">238</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span> <span class="o">=</span> <span class="n">max_text_width</span> +</span><span id="Generator.__init__-239"><a href="#Generator.__init__-239"><span class="linenos">239</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="n">comments</span> +</span></pre></div> + + + + + </div> + <div id="Generator.generate" class="classattr"> + <input id="Generator.generate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.generate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.generate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.generate-241"><a href="#Generator.generate-241"><span class="linenos">241</span></a> <span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.generate-242"><a href="#Generator.generate-242"><span class="linenos">242</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Generator.generate-243"><a href="#Generator.generate-243"><span class="linenos">243</span></a><span class="sd"> Generates a SQL string by interpreting the given syntax tree.</span> +</span><span id="Generator.generate-244"><a href="#Generator.generate-244"><span class="linenos">244</span></a> +</span><span id="Generator.generate-245"><a href="#Generator.generate-245"><span class="linenos">245</span></a><span class="sd"> Args</span> +</span><span id="Generator.generate-246"><a href="#Generator.generate-246"><span class="linenos">246</span></a><span class="sd"> expression: the syntax tree.</span> +</span><span id="Generator.generate-247"><a href="#Generator.generate-247"><span class="linenos">247</span></a> +</span><span id="Generator.generate-248"><a href="#Generator.generate-248"><span class="linenos">248</span></a><span class="sd"> Returns</span> +</span><span id="Generator.generate-249"><a href="#Generator.generate-249"><span class="linenos">249</span></a><span class="sd"> the SQL string.</span> +</span><span id="Generator.generate-250"><a href="#Generator.generate-250"><span class="linenos">250</span></a><span class="sd"> """</span> +</span><span id="Generator.generate-251"><a href="#Generator.generate-251"><span class="linenos">251</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.generate-252"><a href="#Generator.generate-252"><span class="linenos">252</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="Generator.generate-253"><a href="#Generator.generate-253"><span class="linenos">253</span></a> +</span><span id="Generator.generate-254"><a href="#Generator.generate-254"><span class="linenos">254</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IGNORE</span><span class="p">:</span> +</span><span id="Generator.generate-255"><a href="#Generator.generate-255"><span class="linenos">255</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator.generate-256"><a href="#Generator.generate-256"><span class="linenos">256</span></a> +</span><span id="Generator.generate-257"><a href="#Generator.generate-257"><span class="linenos">257</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> +</span><span id="Generator.generate-258"><a href="#Generator.generate-258"><span class="linenos">258</span></a> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">:</span> +</span><span id="Generator.generate-259"><a href="#Generator.generate-259"><span class="linenos">259</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> +</span><span id="Generator.generate-260"><a href="#Generator.generate-260"><span class="linenos">260</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">RAISE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">:</span> +</span><span id="Generator.generate-261"><a href="#Generator.generate-261"><span class="linenos">261</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="n">concat_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_unsupported</span><span class="p">))</span> +</span><span id="Generator.generate-262"><a href="#Generator.generate-262"><span class="linenos">262</span></a> +</span><span id="Generator.generate-263"><a href="#Generator.generate-263"><span class="linenos">263</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator.generate-264"><a href="#Generator.generate-264"><span class="linenos">264</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SENTINEL_LINE_BREAK</span><span class="p">,</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.generate-265"><a href="#Generator.generate-265"><span class="linenos">265</span></a> <span class="k">return</span> <span class="n">sql</span> +</span></pre></div> + + + <div class="docstring"><p>Generates a SQL string by interpreting the given syntax tree.</p> + +<p>Args + expression: the syntax tree.</p> + +<p>Returns + the SQL string.</p> +</div> + + + </div> + <div id="Generator.unsupported" class="classattr"> + <input id="Generator.unsupported-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unsupported</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">message</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Generator.unsupported-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.unsupported"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.unsupported-267"><a href="#Generator.unsupported-267"><span class="linenos">267</span></a> <span class="k">def</span> <span class="nf">unsupported</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.unsupported-268"><a href="#Generator.unsupported-268"><span class="linenos">268</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span><span class="p">:</span> +</span><span id="Generator.unsupported-269"><a href="#Generator.unsupported-269"><span class="linenos">269</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span><span id="Generator.unsupported-270"><a href="#Generator.unsupported-270"><span class="linenos">270</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported_messages</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.sep" class="classattr"> + <input id="Generator.sep-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sep</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">' '</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.sep-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.sep"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.sep-272"><a href="#Generator.sep-272"><span class="linenos">272</span></a> <span class="k">def</span> <span class="nf">sep</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.sep-273"><a href="#Generator.sep-273"><span class="linenos">273</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="n">sep</span> +</span></pre></div> + + + + + </div> + <div id="Generator.seg" class="classattr"> + <input id="Generator.seg-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">seg</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">' '</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.seg-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.seg"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.seg-275"><a href="#Generator.seg-275"><span class="linenos">275</span></a> <span class="k">def</span> <span class="nf">seg</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.seg-276"><a href="#Generator.seg-276"><span class="linenos">276</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="n">sep</span><span class="p">)</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.pad_comment" class="classattr"> + <input id="Generator.pad_comment-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pad_comment</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">comment</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.pad_comment-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.pad_comment"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.pad_comment-278"><a href="#Generator.pad_comment-278"><span class="linenos">278</span></a> <span class="k">def</span> <span class="nf">pad_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comment</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.pad_comment-279"><a href="#Generator.pad_comment-279"><span class="linenos">279</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="n">comment</span> <span class="k">if</span> <span class="n">comment</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">else</span> <span class="n">comment</span> +</span><span id="Generator.pad_comment-280"><a href="#Generator.pad_comment-280"><span class="linenos">280</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="n">comment</span> <span class="o">+</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">comment</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">else</span> <span class="n">comment</span> +</span><span id="Generator.pad_comment-281"><a href="#Generator.pad_comment-281"><span class="linenos">281</span></a> <span class="k">return</span> <span class="n">comment</span> +</span></pre></div> + + + + + </div> + <div id="Generator.maybe_comment" class="classattr"> + <input id="Generator.maybe_comment-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">maybe_comment</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.maybe_comment-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.maybe_comment"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.maybe_comment-283"><a href="#Generator.maybe_comment-283"><span class="linenos">283</span></a> <span class="k">def</span> <span class="nf">maybe_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.maybe_comment-284"><a href="#Generator.maybe_comment-284"><span class="linenos">284</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="Generator.maybe_comment-285"><a href="#Generator.maybe_comment-285"><span class="linenos">285</span></a> +</span><span id="Generator.maybe_comment-286"><a href="#Generator.maybe_comment-286"><span class="linenos">286</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="Generator.maybe_comment-287"><a href="#Generator.maybe_comment-287"><span class="linenos">287</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator.maybe_comment-288"><a href="#Generator.maybe_comment-288"><span class="linenos">288</span></a> +</span><span id="Generator.maybe_comment-289"><a href="#Generator.maybe_comment-289"><span class="linenos">289</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator.maybe_comment-290"><a href="#Generator.maybe_comment-290"><span class="linenos">290</span></a> <span class="n">comments_sql</span> <span class="o">=</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.maybe_comment-291"><a href="#Generator.maybe_comment-291"><span class="linenos">291</span></a> <span class="sa">f</span><span class="s2">"/*</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">pad_comment</span><span class="p">(</span><span class="n">comment</span><span class="p">)</span><span class="si">}</span><span class="s2">*/"</span> <span class="k">for</span> <span class="n">comment</span> <span class="ow">in</span> <span class="n">comments</span> <span class="k">if</span> <span class="n">comment</span> +</span><span id="Generator.maybe_comment-292"><a href="#Generator.maybe_comment-292"><span class="linenos">292</span></a> <span class="p">)</span> +</span><span id="Generator.maybe_comment-293"><a href="#Generator.maybe_comment-293"><span class="linenos">293</span></a> +</span><span id="Generator.maybe_comment-294"><a href="#Generator.maybe_comment-294"><span class="linenos">294</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">comments_sql</span><span class="p">:</span> +</span><span id="Generator.maybe_comment-295"><a href="#Generator.maybe_comment-295"><span class="linenos">295</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator.maybe_comment-296"><a href="#Generator.maybe_comment-296"><span class="linenos">296</span></a> +</span><span id="Generator.maybe_comment-297"><a href="#Generator.maybe_comment-297"><span class="linenos">297</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">WITH_SEPARATED_COMMENTS</span><span class="p">):</span> +</span><span id="Generator.maybe_comment-298"><a href="#Generator.maybe_comment-298"><span class="linenos">298</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">comments_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.maybe_comment-299"><a href="#Generator.maybe_comment-299"><span class="linenos">299</span></a> +</span><span id="Generator.maybe_comment-300"><a href="#Generator.maybe_comment-300"><span class="linenos">300</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">comments_sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.wrap" class="classattr"> + <input id="Generator.wrap-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">wrap</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span> <span class="o">|</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.wrap-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.wrap"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.wrap-302"><a href="#Generator.wrap-302"><span class="linenos">302</span></a> <span class="k">def</span> <span class="nf">wrap</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.wrap-303"><a href="#Generator.wrap-303"><span class="linenos">303</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span> +</span><span id="Generator.wrap-304"><a href="#Generator.wrap-304"><span class="linenos">304</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.wrap-305"><a href="#Generator.wrap-305"><span class="linenos">305</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">))</span> +</span><span id="Generator.wrap-306"><a href="#Generator.wrap-306"><span class="linenos">306</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="Generator.wrap-307"><a href="#Generator.wrap-307"><span class="linenos">307</span></a> <span class="n">level</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> +</span><span id="Generator.wrap-308"><a href="#Generator.wrap-308"><span class="linenos">308</span></a> <span class="n">pad</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> +</span><span id="Generator.wrap-309"><a href="#Generator.wrap-309"><span class="linenos">309</span></a> <span class="p">)</span> +</span><span id="Generator.wrap-310"><a href="#Generator.wrap-310"><span class="linenos">310</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="n">this_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.no_identify" class="classattr"> + <input id="Generator.no_identify-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">no_identify</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">func</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span>, </span><span class="param"><span class="o">*</span><span class="n">args</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.no_identify-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.no_identify"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.no_identify-312"><a href="#Generator.no_identify-312"><span class="linenos">312</span></a> <span class="k">def</span> <span class="nf">no_identify</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[</span><span class="o">...</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.no_identify-313"><a href="#Generator.no_identify-313"><span class="linenos">313</span></a> <span class="n">original</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> +</span><span id="Generator.no_identify-314"><a href="#Generator.no_identify-314"><span class="linenos">314</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Generator.no_identify-315"><a href="#Generator.no_identify-315"><span class="linenos">315</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Generator.no_identify-316"><a href="#Generator.no_identify-316"><span class="linenos">316</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span> <span class="o">=</span> <span class="n">original</span> +</span><span id="Generator.no_identify-317"><a href="#Generator.no_identify-317"><span class="linenos">317</span></a> <span class="k">return</span> <span class="n">result</span> +</span></pre></div> + + + + + </div> + <div id="Generator.normalize_func" class="classattr"> + <input id="Generator.normalize_func-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">normalize_func</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">name</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.normalize_func-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.normalize_func"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.normalize_func-319"><a href="#Generator.normalize_func-319"><span class="linenos">319</span></a> <span class="k">def</span> <span class="nf">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.normalize_func-320"><a href="#Generator.normalize_func-320"><span class="linenos">320</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">==</span> <span class="s2">"upper"</span><span class="p">:</span> +</span><span id="Generator.normalize_func-321"><a href="#Generator.normalize_func-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Generator.normalize_func-322"><a href="#Generator.normalize_func-322"><span class="linenos">322</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize_functions</span> <span class="o">==</span> <span class="s2">"lower"</span><span class="p">:</span> +</span><span id="Generator.normalize_func-323"><a href="#Generator.normalize_func-323"><span class="linenos">323</span></a> <span class="k">return</span> <span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="Generator.normalize_func-324"><a href="#Generator.normalize_func-324"><span class="linenos">324</span></a> <span class="k">return</span> <span class="n">name</span> +</span></pre></div> + + + + + </div> + <div id="Generator.indent" class="classattr"> + <input id="Generator.indent-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">indent</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span>,</span><span class="param"> <span class="n">pad</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">skip_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span>,</span><span class="param"> <span class="n">skip_last</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.indent-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.indent"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.indent-326"><a href="#Generator.indent-326"><span class="linenos">326</span></a> <span class="k">def</span> <span class="nf">indent</span><span class="p">(</span> +</span><span id="Generator.indent-327"><a href="#Generator.indent-327"><span class="linenos">327</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator.indent-328"><a href="#Generator.indent-328"><span class="linenos">328</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="Generator.indent-329"><a href="#Generator.indent-329"><span class="linenos">329</span></a> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +</span><span id="Generator.indent-330"><a href="#Generator.indent-330"><span class="linenos">330</span></a> <span class="n">pad</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.indent-331"><a href="#Generator.indent-331"><span class="linenos">331</span></a> <span class="n">skip_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.indent-332"><a href="#Generator.indent-332"><span class="linenos">332</span></a> <span class="n">skip_last</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.indent-333"><a href="#Generator.indent-333"><span class="linenos">333</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.indent-334"><a href="#Generator.indent-334"><span class="linenos">334</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator.indent-335"><a href="#Generator.indent-335"><span class="linenos">335</span></a> <span class="k">return</span> <span class="n">sql</span> +</span><span id="Generator.indent-336"><a href="#Generator.indent-336"><span class="linenos">336</span></a> +</span><span id="Generator.indent-337"><a href="#Generator.indent-337"><span class="linenos">337</span></a> <span class="n">pad</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> <span class="k">if</span> <span class="n">pad</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">pad</span> +</span><span id="Generator.indent-338"><a href="#Generator.indent-338"><span class="linenos">338</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="n">sql</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.indent-339"><a href="#Generator.indent-339"><span class="linenos">339</span></a> +</span><span id="Generator.indent-340"><a href="#Generator.indent-340"><span class="linenos">340</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.indent-341"><a href="#Generator.indent-341"><span class="linenos">341</span></a> <span class="n">line</span> +</span><span id="Generator.indent-342"><a href="#Generator.indent-342"><span class="linenos">342</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">skip_first</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">skip_last</span> <span class="ow">and</span> <span class="n">i</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Generator.indent-343"><a href="#Generator.indent-343"><span class="linenos">343</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">' '</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="p">(</span><span class="n">level</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="bp">self</span><span class="o">.</span><span class="n">_indent</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">pad</span><span class="p">)</span><span class="si">}{</span><span class="n">line</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.indent-344"><a href="#Generator.indent-344"><span class="linenos">344</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">line</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span><span id="Generator.indent-345"><a href="#Generator.indent-345"><span class="linenos">345</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.sql" class="classattr"> + <input id="Generator.sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span>,</span><span class="param"> <span class="n">key</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">comment</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.sql-347"><a href="#Generator.sql-347"><span class="linenos">347</span></a> <span class="k">def</span> <span class="nf">sql</span><span class="p">(</span> +</span><span id="Generator.sql-348"><a href="#Generator.sql-348"><span class="linenos">348</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator.sql-349"><a href="#Generator.sql-349"><span class="linenos">349</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="Generator.sql-350"><a href="#Generator.sql-350"><span class="linenos">350</span></a> <span class="n">key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.sql-351"><a href="#Generator.sql-351"><span class="linenos">351</span></a> <span class="n">comment</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Generator.sql-352"><a href="#Generator.sql-352"><span class="linenos">352</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.sql-353"><a href="#Generator.sql-353"><span class="linenos">353</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="Generator.sql-354"><a href="#Generator.sql-354"><span class="linenos">354</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator.sql-355"><a href="#Generator.sql-355"><span class="linenos">355</span></a> +</span><span id="Generator.sql-356"><a href="#Generator.sql-356"><span class="linenos">356</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="Generator.sql-357"><a href="#Generator.sql-357"><span class="linenos">357</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Generator.sql-358"><a href="#Generator.sql-358"><span class="linenos">358</span></a> +</span><span id="Generator.sql-359"><a href="#Generator.sql-359"><span class="linenos">359</span></a> <span class="k">if</span> <span class="n">key</span><span class="p">:</span> +</span><span id="Generator.sql-360"><a href="#Generator.sql-360"><span class="linenos">360</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">))</span> +</span><span id="Generator.sql-361"><a href="#Generator.sql-361"><span class="linenos">361</span></a> +</span><span id="Generator.sql-362"><a href="#Generator.sql-362"><span class="linenos">362</span></a> <span class="n">transform</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="Generator.sql-363"><a href="#Generator.sql-363"><span class="linenos">363</span></a> +</span><span id="Generator.sql-364"><a href="#Generator.sql-364"><span class="linenos">364</span></a> <span class="k">if</span> <span class="n">callable</span><span class="p">(</span><span class="n">transform</span><span class="p">):</span> +</span><span id="Generator.sql-365"><a href="#Generator.sql-365"><span class="linenos">365</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.sql-366"><a href="#Generator.sql-366"><span class="linenos">366</span></a> <span class="k">elif</span> <span class="n">transform</span><span class="p">:</span> +</span><span id="Generator.sql-367"><a href="#Generator.sql-367"><span class="linenos">367</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="n">transform</span> +</span><span id="Generator.sql-368"><a href="#Generator.sql-368"><span class="linenos">368</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="Generator.sql-369"><a href="#Generator.sql-369"><span class="linenos">369</span></a> <span class="n">exp_handler_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">_sql"</span> +</span><span id="Generator.sql-370"><a href="#Generator.sql-370"><span class="linenos">370</span></a> +</span><span id="Generator.sql-371"><a href="#Generator.sql-371"><span class="linenos">371</span></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_handler_name</span><span class="p">):</span> +</span><span id="Generator.sql-372"><a href="#Generator.sql-372"><span class="linenos">372</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_handler_name</span><span class="p">)(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.sql-373"><a href="#Generator.sql-373"><span class="linenos">373</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Generator.sql-374"><a href="#Generator.sql-374"><span class="linenos">374</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.sql-375"><a href="#Generator.sql-375"><span class="linenos">375</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">):</span> +</span><span id="Generator.sql-376"><a href="#Generator.sql-376"><span class="linenos">376</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">property_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.sql-377"><a href="#Generator.sql-377"><span class="linenos">377</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.sql-378"><a href="#Generator.sql-378"><span class="linenos">378</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported expression type </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.sql-379"><a href="#Generator.sql-379"><span class="linenos">379</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.sql-380"><a href="#Generator.sql-380"><span class="linenos">380</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected an Expression. Received </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">expression</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.sql-381"><a href="#Generator.sql-381"><span class="linenos">381</span></a> +</span><span id="Generator.sql-382"><a href="#Generator.sql-382"><span class="linenos">382</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">maybe_comment</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="ow">and</span> <span class="n">comment</span> <span class="k">else</span> <span class="n">sql</span> +</span></pre></div> + + + + + </div> + <div id="Generator.uncache_sql" class="classattr"> + <input id="Generator.uncache_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">uncache_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Uncache">sqlglot.expressions.Uncache</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.uncache_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.uncache_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.uncache_sql-384"><a href="#Generator.uncache_sql-384"><span class="linenos">384</span></a> <span class="k">def</span> <span class="nf">uncache_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Uncache</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.uncache_sql-385"><a href="#Generator.uncache_sql-385"><span class="linenos">385</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.uncache_sql-386"><a href="#Generator.uncache_sql-386"><span class="linenos">386</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.uncache_sql-387"><a href="#Generator.uncache_sql-387"><span class="linenos">387</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNCACHE TABLE</span><span class="si">{</span><span class="n">exists_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.cache_sql" class="classattr"> + <input id="Generator.cache_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cache_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Cache">sqlglot.expressions.Cache</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.cache_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.cache_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.cache_sql-389"><a href="#Generator.cache_sql-389"><span class="linenos">389</span></a> <span class="k">def</span> <span class="nf">cache_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.cache_sql-390"><a href="#Generator.cache_sql-390"><span class="linenos">390</span></a> <span class="n">lazy</span> <span class="o">=</span> <span class="s2">" LAZY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"lazy"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.cache_sql-391"><a href="#Generator.cache_sql-391"><span class="linenos">391</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.cache_sql-392"><a href="#Generator.cache_sql-392"><span class="linenos">392</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"options"</span><span class="p">)</span> +</span><span id="Generator.cache_sql-393"><a href="#Generator.cache_sql-393"><span class="linenos">393</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" OPTIONS(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.cache_sql-394"><a href="#Generator.cache_sql-394"><span class="linenos">394</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator.cache_sql-395"><a href="#Generator.cache_sql-395"><span class="linenos">395</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.cache_sql-396"><a href="#Generator.cache_sql-396"><span class="linenos">396</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CACHE</span><span class="si">{</span><span class="n">lazy</span><span class="si">}</span><span class="s2"> TABLE </span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="n">options</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.cache_sql-397"><a href="#Generator.cache_sql-397"><span class="linenos">397</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.characterset_sql" class="classattr"> + <input id="Generator.characterset_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">characterset_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#CharacterSet">sqlglot.expressions.CharacterSet</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.characterset_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.characterset_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.characterset_sql-399"><a href="#Generator.characterset_sql-399"><span class="linenos">399</span></a> <span class="k">def</span> <span class="nf">characterset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.characterset_sql-400"><a href="#Generator.characterset_sql-400"><span class="linenos">400</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="Generator.characterset_sql-401"><a href="#Generator.characterset_sql-401"><span class="linenos">401</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHAR CHARACTER SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.characterset_sql-402"><a href="#Generator.characterset_sql-402"><span class="linenos">402</span></a> <span class="n">default</span> <span class="o">=</span> <span class="s2">"DEFAULT "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.characterset_sql-403"><a href="#Generator.characterset_sql-403"><span class="linenos">403</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">CHARACTER SET=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.column_sql" class="classattr"> + <input id="Generator.column_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">column_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Column">sqlglot.expressions.Column</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.column_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.column_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.column_sql-405"><a href="#Generator.column_sql-405"><span class="linenos">405</span></a> <span class="k">def</span> <span class="nf">column_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.column_sql-406"><a href="#Generator.column_sql-406"><span class="linenos">406</span></a> <span class="k">return</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.column_sql-407"><a href="#Generator.column_sql-407"><span class="linenos">407</span></a> <span class="n">part</span> +</span><span id="Generator.column_sql-408"><a href="#Generator.column_sql-408"><span class="linenos">408</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="Generator.column_sql-409"><a href="#Generator.column_sql-409"><span class="linenos">409</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">),</span> +</span><span id="Generator.column_sql-410"><a href="#Generator.column_sql-410"><span class="linenos">410</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">),</span> +</span><span id="Generator.column_sql-411"><a href="#Generator.column_sql-411"><span class="linenos">411</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="Generator.column_sql-412"><a href="#Generator.column_sql-412"><span class="linenos">412</span></a> <span class="p">]</span> +</span><span id="Generator.column_sql-413"><a href="#Generator.column_sql-413"><span class="linenos">413</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="Generator.column_sql-414"><a href="#Generator.column_sql-414"><span class="linenos">414</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.columndef_sql" class="classattr"> + <input id="Generator.columndef_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">columndef_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#ColumnDef">sqlglot.expressions.ColumnDef</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.columndef_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.columndef_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.columndef_sql-416"><a href="#Generator.columndef_sql-416"><span class="linenos">416</span></a> <span class="k">def</span> <span class="nf">columndef_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.columndef_sql-417"><a href="#Generator.columndef_sql-417"><span class="linenos">417</span></a> <span class="n">column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.columndef_sql-418"><a href="#Generator.columndef_sql-418"><span class="linenos">418</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator.columndef_sql-419"><a href="#Generator.columndef_sql-419"><span class="linenos">419</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"constraints"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.columndef_sql-420"><a href="#Generator.columndef_sql-420"><span class="linenos">420</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">"IF NOT EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.columndef_sql-421"><a href="#Generator.columndef_sql-421"><span class="linenos">421</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.columndef_sql-422"><a href="#Generator.columndef_sql-422"><span class="linenos">422</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">constraints</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">constraints</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.columndef_sql-423"><a href="#Generator.columndef_sql-423"><span class="linenos">423</span></a> +</span><span id="Generator.columndef_sql-424"><a href="#Generator.columndef_sql-424"><span class="linenos">424</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">exists</span><span class="si">}{</span><span class="n">column</span><span class="si">}{</span><span class="n">kind</span><span class="si">}{</span><span class="n">constraints</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.columnconstraint_sql" class="classattr"> + <input id="Generator.columnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">columnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#ColumnConstraint">sqlglot.expressions.ColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.columnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.columnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.columnconstraint_sql-426"><a href="#Generator.columnconstraint_sql-426"><span class="linenos">426</span></a> <span class="k">def</span> <span class="nf">columnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.columnconstraint_sql-427"><a href="#Generator.columnconstraint_sql-427"><span class="linenos">427</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.columnconstraint_sql-428"><a href="#Generator.columnconstraint_sql-428"><span class="linenos">428</span></a> <span class="n">kind_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator.columnconstraint_sql-429"><a href="#Generator.columnconstraint_sql-429"><span class="linenos">429</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">kind_sql</span> +</span></pre></div> + + + + + </div> + <div id="Generator.autoincrementcolumnconstraint_sql" class="classattr"> + <input id="Generator.autoincrementcolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">autoincrementcolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.autoincrementcolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.autoincrementcolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.autoincrementcolumnconstraint_sql-431"><a href="#Generator.autoincrementcolumnconstraint_sql-431"><span class="linenos">431</span></a> <span class="k">def</span> <span class="nf">autoincrementcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.autoincrementcolumnconstraint_sql-432"><a href="#Generator.autoincrementcolumnconstraint_sql-432"><span class="linenos">432</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">token_sql</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.checkcolumnconstraint_sql" class="classattr"> + <input id="Generator.checkcolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">checkcolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#CheckColumnConstraint">sqlglot.expressions.CheckColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.checkcolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.checkcolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.checkcolumnconstraint_sql-434"><a href="#Generator.checkcolumnconstraint_sql-434"><span class="linenos">434</span></a> <span class="k">def</span> <span class="nf">checkcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CheckColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.checkcolumnconstraint_sql-435"><a href="#Generator.checkcolumnconstraint_sql-435"><span class="linenos">435</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.checkcolumnconstraint_sql-436"><a href="#Generator.checkcolumnconstraint_sql-436"><span class="linenos">436</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECK (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.commentcolumnconstraint_sql" class="classattr"> + <input id="Generator.commentcolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">commentcolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#CommentColumnConstraint">sqlglot.expressions.CommentColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.commentcolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.commentcolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.commentcolumnconstraint_sql-438"><a href="#Generator.commentcolumnconstraint_sql-438"><span class="linenos">438</span></a> <span class="k">def</span> <span class="nf">commentcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CommentColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.commentcolumnconstraint_sql-439"><a href="#Generator.commentcolumnconstraint_sql-439"><span class="linenos">439</span></a> <span class="n">comment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.commentcolumnconstraint_sql-440"><a href="#Generator.commentcolumnconstraint_sql-440"><span class="linenos">440</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COMMENT </span><span class="si">{</span><span class="n">comment</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.collatecolumnconstraint_sql" class="classattr"> + <input id="Generator.collatecolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">collatecolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#CollateColumnConstraint">sqlglot.expressions.CollateColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.collatecolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.collatecolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.collatecolumnconstraint_sql-442"><a href="#Generator.collatecolumnconstraint_sql-442"><span class="linenos">442</span></a> <span class="k">def</span> <span class="nf">collatecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CollateColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.collatecolumnconstraint_sql-443"><a href="#Generator.collatecolumnconstraint_sql-443"><span class="linenos">443</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.collatecolumnconstraint_sql-444"><a href="#Generator.collatecolumnconstraint_sql-444"><span class="linenos">444</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.encodecolumnconstraint_sql" class="classattr"> + <input id="Generator.encodecolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">encodecolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#EncodeColumnConstraint">sqlglot.expressions.EncodeColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.encodecolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.encodecolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.encodecolumnconstraint_sql-446"><a href="#Generator.encodecolumnconstraint_sql-446"><span class="linenos">446</span></a> <span class="k">def</span> <span class="nf">encodecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EncodeColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.encodecolumnconstraint_sql-447"><a href="#Generator.encodecolumnconstraint_sql-447"><span class="linenos">447</span></a> <span class="n">encode</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.encodecolumnconstraint_sql-448"><a href="#Generator.encodecolumnconstraint_sql-448"><span class="linenos">448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ENCODE </span><span class="si">{</span><span class="n">encode</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.defaultcolumnconstraint_sql" class="classattr"> + <input id="Generator.defaultcolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">defaultcolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#DefaultColumnConstraint">sqlglot.expressions.DefaultColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.defaultcolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.defaultcolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.defaultcolumnconstraint_sql-450"><a href="#Generator.defaultcolumnconstraint_sql-450"><span class="linenos">450</span></a> <span class="k">def</span> <span class="nf">defaultcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DefaultColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.defaultcolumnconstraint_sql-451"><a href="#Generator.defaultcolumnconstraint_sql-451"><span class="linenos">451</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.defaultcolumnconstraint_sql-452"><a href="#Generator.defaultcolumnconstraint_sql-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DEFAULT </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.generatedasidentitycolumnconstraint_sql" class="classattr"> + <input id="Generator.generatedasidentitycolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">generatedasidentitycolumnconstraint_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#GeneratedAsIdentityColumnConstraint">sqlglot.expressions.GeneratedAsIdentityColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.generatedasidentitycolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.generatedasidentitycolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.generatedasidentitycolumnconstraint_sql-454"><a href="#Generator.generatedasidentitycolumnconstraint_sql-454"><span class="linenos">454</span></a> <span class="k">def</span> <span class="nf">generatedasidentitycolumnconstraint_sql</span><span class="p">(</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-455"><a href="#Generator.generatedasidentitycolumnconstraint_sql-455"><span class="linenos">455</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-456"><a href="#Generator.generatedasidentitycolumnconstraint_sql-456"><span class="linenos">456</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-457"><a href="#Generator.generatedasidentitycolumnconstraint_sql-457"><span class="linenos">457</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-458"><a href="#Generator.generatedasidentitycolumnconstraint_sql-458"><span class="linenos">458</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-459"><a href="#Generator.generatedasidentitycolumnconstraint_sql-459"><span class="linenos">459</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">" ALWAYS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">" BY DEFAULT "</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-460"><a href="#Generator.generatedasidentitycolumnconstraint_sql-460"><span class="linenos">460</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"start"</span><span class="p">)</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-461"><a href="#Generator.generatedasidentitycolumnconstraint_sql-461"><span class="linenos">461</span></a> <span class="n">start</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"START WITH </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">start</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-462"><a href="#Generator.generatedasidentitycolumnconstraint_sql-462"><span class="linenos">462</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">)</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-463"><a href="#Generator.generatedasidentitycolumnconstraint_sql-463"><span class="linenos">463</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INCREMENT BY </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">increment</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-464"><a href="#Generator.generatedasidentitycolumnconstraint_sql-464"><span class="linenos">464</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-465"><a href="#Generator.generatedasidentitycolumnconstraint_sql-465"><span class="linenos">465</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">or</span> <span class="n">increment</span><span class="p">:</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-466"><a href="#Generator.generatedasidentitycolumnconstraint_sql-466"><span class="linenos">466</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">increment</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-467"><a href="#Generator.generatedasidentitycolumnconstraint_sql-467"><span class="linenos">467</span></a> <span class="n">sequence_opts</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" (</span><span class="si">{</span><span class="n">sequence_opts</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.generatedasidentitycolumnconstraint_sql-468"><a href="#Generator.generatedasidentitycolumnconstraint_sql-468"><span class="linenos">468</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"GENERATED</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">AS IDENTITY</span><span class="si">{</span><span class="n">sequence_opts</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.notnullcolumnconstraint_sql" class="classattr"> + <input id="Generator.notnullcolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">notnullcolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#NotNullColumnConstraint">sqlglot.expressions.NotNullColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.notnullcolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.notnullcolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.notnullcolumnconstraint_sql-470"><a href="#Generator.notnullcolumnconstraint_sql-470"><span class="linenos">470</span></a> <span class="k">def</span> <span class="nf">notnullcolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.notnullcolumnconstraint_sql-471"><a href="#Generator.notnullcolumnconstraint_sql-471"><span class="linenos">471</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'allow_null'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'NOT '</span><span class="si">}</span><span class="s2">NULL"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.primarykeycolumnconstraint_sql" class="classattr"> + <input id="Generator.primarykeycolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">primarykeycolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#PrimaryKeyColumnConstraint">sqlglot.expressions.PrimaryKeyColumnConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.primarykeycolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.primarykeycolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.primarykeycolumnconstraint_sql-473"><a href="#Generator.primarykeycolumnconstraint_sql-473"><span class="linenos">473</span></a> <span class="k">def</span> <span class="nf">primarykeycolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKeyColumnConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.primarykeycolumnconstraint_sql-474"><a href="#Generator.primarykeycolumnconstraint_sql-474"><span class="linenos">474</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> +</span><span id="Generator.primarykeycolumnconstraint_sql-475"><a href="#Generator.primarykeycolumnconstraint_sql-475"><span class="linenos">475</span></a> <span class="k">if</span> <span class="n">desc</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.primarykeycolumnconstraint_sql-476"><a href="#Generator.primarykeycolumnconstraint_sql-476"><span class="linenos">476</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY</span><span class="si">{</span><span class="s1">' DESC'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">desc</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ASC'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.primarykeycolumnconstraint_sql-477"><a href="#Generator.primarykeycolumnconstraint_sql-477"><span class="linenos">477</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.uniquecolumnconstraint_sql" class="classattr"> + <input id="Generator.uniquecolumnconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">uniquecolumnconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.uniquecolumnconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.uniquecolumnconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.uniquecolumnconstraint_sql-479"><a href="#Generator.uniquecolumnconstraint_sql-479"><span class="linenos">479</span></a> <span class="k">def</span> <span class="nf">uniquecolumnconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.uniquecolumnconstraint_sql-480"><a href="#Generator.uniquecolumnconstraint_sql-480"><span class="linenos">480</span></a> <span class="k">return</span> <span class="s2">"UNIQUE"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.create_sql" class="classattr"> + <input id="Generator.create_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">create_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Create">sqlglot.expressions.Create</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.create_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.create_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.create_sql-482"><a href="#Generator.create_sql-482"><span class="linenos">482</span></a> <span class="k">def</span> <span class="nf">create_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.create_sql-483"><a href="#Generator.create_sql-483"><span class="linenos">483</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Generator.create_sql-484"><a href="#Generator.create_sql-484"><span class="linenos">484</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"properties"</span><span class="p">)</span> +</span><span id="Generator.create_sql-485"><a href="#Generator.create_sql-485"><span class="linenos">485</span></a> <span class="n">properties_exp</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Generator.create_sql-486"><a href="#Generator.create_sql-486"><span class="linenos">486</span></a> <span class="n">properties_locs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">locate_properties</span><span class="p">(</span><span class="n">properties</span><span class="p">)</span> <span class="k">if</span> <span class="n">properties</span> <span class="k">else</span> <span class="p">{}</span> +</span><span id="Generator.create_sql-487"><a href="#Generator.create_sql-487"><span class="linenos">487</span></a> <span class="k">if</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">)</span> <span class="ow">or</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span> +</span><span id="Generator.create_sql-488"><a href="#Generator.create_sql-488"><span class="linenos">488</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span> +</span><span id="Generator.create_sql-489"><a href="#Generator.create_sql-489"><span class="linenos">489</span></a> <span class="p">):</span> +</span><span id="Generator.create_sql-490"><a href="#Generator.create_sql-490"><span class="linenos">490</span></a> <span class="n">properties_exp</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="Generator.create_sql-491"><a href="#Generator.create_sql-491"><span class="linenos">491</span></a> <span class="s2">"properties"</span><span class="p">,</span> +</span><span id="Generator.create_sql-492"><a href="#Generator.create_sql-492"><span class="linenos">492</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span> +</span><span id="Generator.create_sql-493"><a href="#Generator.create_sql-493"><span class="linenos">493</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span> +</span><span id="Generator.create_sql-494"><a href="#Generator.create_sql-494"><span class="linenos">494</span></a> <span class="o">*</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">],</span> +</span><span id="Generator.create_sql-495"><a href="#Generator.create_sql-495"><span class="linenos">495</span></a> <span class="o">*</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">],</span> +</span><span id="Generator.create_sql-496"><a href="#Generator.create_sql-496"><span class="linenos">496</span></a> <span class="p">]</span> +</span><span id="Generator.create_sql-497"><a href="#Generator.create_sql-497"><span class="linenos">497</span></a> <span class="p">),</span> +</span><span id="Generator.create_sql-498"><a href="#Generator.create_sql-498"><span class="linenos">498</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-499"><a href="#Generator.create_sql-499"><span class="linenos">499</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">"TABLE"</span> <span class="ow">and</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">):</span> +</span><span id="Generator.create_sql-500"><a href="#Generator.create_sql-500"><span class="linenos">500</span></a> <span class="n">this_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.create_sql-501"><a href="#Generator.create_sql-501"><span class="linenos">501</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Generator.create_sql-502"><a href="#Generator.create_sql-502"><span class="linenos">502</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">]),</span> +</span><span id="Generator.create_sql-503"><a href="#Generator.create_sql-503"><span class="linenos">503</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.create_sql-504"><a href="#Generator.create_sql-504"><span class="linenos">504</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-505"><a href="#Generator.create_sql-505"><span class="linenos">505</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.create_sql-506"><a href="#Generator.create_sql-506"><span class="linenos">506</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this_name</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">this_properties</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.create_sql-507"><a href="#Generator.create_sql-507"><span class="linenos">507</span></a> <span class="n">properties_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-508"><a href="#Generator.create_sql-508"><span class="linenos">508</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.create_sql-509"><a href="#Generator.create_sql-509"><span class="linenos">509</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.create_sql-510"><a href="#Generator.create_sql-510"><span class="linenos">510</span></a> <span class="n">properties_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">properties_exp</span><span class="p">,</span> <span class="s2">"properties"</span><span class="p">)</span> +</span><span id="Generator.create_sql-511"><a href="#Generator.create_sql-511"><span class="linenos">511</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="s2">" BEGIN"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"begin"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-512"><a href="#Generator.create_sql-512"><span class="linenos">512</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator.create_sql-513"><a href="#Generator.create_sql-513"><span class="linenos">513</span></a> <span class="k">if</span> <span class="n">expression_sql</span><span class="p">:</span> +</span><span id="Generator.create_sql-514"><a href="#Generator.create_sql-514"><span class="linenos">514</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">begin</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.create_sql-515"><a href="#Generator.create_sql-515"><span class="linenos">515</span></a> +</span><span id="Generator.create_sql-516"><a href="#Generator.create_sql-516"><span class="linenos">516</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">CREATE_FUNCTION_AS</span> <span class="ow">or</span> <span class="n">kind</span> <span class="o">!=</span> <span class="s2">"FUNCTION"</span><span class="p">:</span> +</span><span id="Generator.create_sql-517"><a href="#Generator.create_sql-517"><span class="linenos">517</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.create_sql-518"><a href="#Generator.create_sql-518"><span class="linenos">518</span></a> +</span><span id="Generator.create_sql-519"><a href="#Generator.create_sql-519"><span class="linenos">519</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-520"><a href="#Generator.create_sql-520"><span class="linenos">520</span></a> <span class="n">transient</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.create_sql-521"><a href="#Generator.create_sql-521"><span class="linenos">521</span></a> <span class="s2">" TRANSIENT"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">CREATE_TRANSIENT</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"transient"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-522"><a href="#Generator.create_sql-522"><span class="linenos">522</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-523"><a href="#Generator.create_sql-523"><span class="linenos">523</span></a> <span class="n">external</span> <span class="o">=</span> <span class="s2">" EXTERNAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"external"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-524"><a href="#Generator.create_sql-524"><span class="linenos">524</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="s2">" OR REPLACE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"replace"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-525"><a href="#Generator.create_sql-525"><span class="linenos">525</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF NOT EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-526"><a href="#Generator.create_sql-526"><span class="linenos">526</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="s2">" UNIQUE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unique"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-527"><a href="#Generator.create_sql-527"><span class="linenos">527</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="s2">" MATERIALIZED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"materialized"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-528"><a href="#Generator.create_sql-528"><span class="linenos">528</span></a> <span class="n">set_</span> <span class="o">=</span> <span class="s2">" SET"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"set"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-529"><a href="#Generator.create_sql-529"><span class="linenos">529</span></a> <span class="n">multiset</span> <span class="o">=</span> <span class="s2">" MULTISET"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"multiset"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-530"><a href="#Generator.create_sql-530"><span class="linenos">530</span></a> <span class="n">global_temporary</span> <span class="o">=</span> <span class="s2">" GLOBAL TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"global_temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-531"><a href="#Generator.create_sql-531"><span class="linenos">531</span></a> <span class="n">volatile</span> <span class="o">=</span> <span class="s2">" VOLATILE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"volatile"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-532"><a href="#Generator.create_sql-532"><span class="linenos">532</span></a> <span class="n">data</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"data"</span><span class="p">)</span> +</span><span id="Generator.create_sql-533"><a href="#Generator.create_sql-533"><span class="linenos">533</span></a> <span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.create_sql-534"><a href="#Generator.create_sql-534"><span class="linenos">534</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-535"><a href="#Generator.create_sql-535"><span class="linenos">535</span></a> <span class="k">elif</span> <span class="n">data</span><span class="p">:</span> +</span><span id="Generator.create_sql-536"><a href="#Generator.create_sql-536"><span class="linenos">536</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">" WITH DATA"</span> +</span><span id="Generator.create_sql-537"><a href="#Generator.create_sql-537"><span class="linenos">537</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.create_sql-538"><a href="#Generator.create_sql-538"><span class="linenos">538</span></a> <span class="n">data</span> <span class="o">=</span> <span class="s2">" WITH NO DATA"</span> +</span><span id="Generator.create_sql-539"><a href="#Generator.create_sql-539"><span class="linenos">539</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"statistics"</span><span class="p">)</span> +</span><span id="Generator.create_sql-540"><a href="#Generator.create_sql-540"><span class="linenos">540</span></a> <span class="k">if</span> <span class="n">statistics</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.create_sql-541"><a href="#Generator.create_sql-541"><span class="linenos">541</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-542"><a href="#Generator.create_sql-542"><span class="linenos">542</span></a> <span class="k">elif</span> <span class="n">statistics</span><span class="p">:</span> +</span><span id="Generator.create_sql-543"><a href="#Generator.create_sql-543"><span class="linenos">543</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">" AND STATISTICS"</span> +</span><span id="Generator.create_sql-544"><a href="#Generator.create_sql-544"><span class="linenos">544</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.create_sql-545"><a href="#Generator.create_sql-545"><span class="linenos">545</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="s2">" AND NO STATISTICS"</span> +</span><span id="Generator.create_sql-546"><a href="#Generator.create_sql-546"><span class="linenos">546</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="s2">" NO PRIMARY INDEX"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_primary_index"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-547"><a href="#Generator.create_sql-547"><span class="linenos">547</span></a> +</span><span id="Generator.create_sql-548"><a href="#Generator.create_sql-548"><span class="linenos">548</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"indexes"</span><span class="p">)</span> +</span><span id="Generator.create_sql-549"><a href="#Generator.create_sql-549"><span class="linenos">549</span></a> <span class="n">index_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-550"><a href="#Generator.create_sql-550"><span class="linenos">550</span></a> <span class="k">if</span> <span class="n">indexes</span><span class="p">:</span> +</span><span id="Generator.create_sql-551"><a href="#Generator.create_sql-551"><span class="linenos">551</span></a> <span class="n">indexes_sql</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.create_sql-552"><a href="#Generator.create_sql-552"><span class="linenos">552</span></a> <span class="k">for</span> <span class="n">index</span> <span class="ow">in</span> <span class="n">indexes</span><span class="p">:</span> +</span><span id="Generator.create_sql-553"><a href="#Generator.create_sql-553"><span class="linenos">553</span></a> <span class="n">ind_unique</span> <span class="o">=</span> <span class="s2">" UNIQUE"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unique"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-554"><a href="#Generator.create_sql-554"><span class="linenos">554</span></a> <span class="n">ind_primary</span> <span class="o">=</span> <span class="s2">" PRIMARY"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"primary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-555"><a href="#Generator.create_sql-555"><span class="linenos">555</span></a> <span class="n">ind_amp</span> <span class="o">=</span> <span class="s2">" AMP"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"amp"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-556"><a href="#Generator.create_sql-556"><span class="linenos">556</span></a> <span class="n">ind_name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">index</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-557"><a href="#Generator.create_sql-557"><span class="linenos">557</span></a> <span class="n">ind_columns</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.create_sql-558"><a href="#Generator.create_sql-558"><span class="linenos">558</span></a> <span class="sa">f</span><span class="s1">' (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">index</span><span class="p">,</span><span class="w"> </span><span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s1">)'</span> +</span><span id="Generator.create_sql-559"><a href="#Generator.create_sql-559"><span class="linenos">559</span></a> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">)</span> +</span><span id="Generator.create_sql-560"><a href="#Generator.create_sql-560"><span class="linenos">560</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-561"><a href="#Generator.create_sql-561"><span class="linenos">561</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-562"><a href="#Generator.create_sql-562"><span class="linenos">562</span></a> <span class="k">if</span> <span class="n">index</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"primary"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span> +</span><span id="Generator.create_sql-563"><a href="#Generator.create_sql-563"><span class="linenos">563</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span> +</span><span id="Generator.create_sql-564"><a href="#Generator.create_sql-564"><span class="linenos">564</span></a> <span class="p">):</span> +</span><span id="Generator.create_sql-565"><a href="#Generator.create_sql-565"><span class="linenos">565</span></a> <span class="n">postindex_props_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Generator.create_sql-566"><a href="#Generator.create_sql-566"><span class="linenos">566</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span> +</span><span id="Generator.create_sql-567"><a href="#Generator.create_sql-567"><span class="linenos">567</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">]</span> +</span><span id="Generator.create_sql-568"><a href="#Generator.create_sql-568"><span class="linenos">568</span></a> <span class="p">),</span> +</span><span id="Generator.create_sql-569"><a href="#Generator.create_sql-569"><span class="linenos">569</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.create_sql-570"><a href="#Generator.create_sql-570"><span class="linenos">570</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-571"><a href="#Generator.create_sql-571"><span class="linenos">571</span></a> <span class="n">ind_columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">ind_columns</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">postindex_props_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.create_sql-572"><a href="#Generator.create_sql-572"><span class="linenos">572</span></a> +</span><span id="Generator.create_sql-573"><a href="#Generator.create_sql-573"><span class="linenos">573</span></a> <span class="n">indexes_sql</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Generator.create_sql-574"><a href="#Generator.create_sql-574"><span class="linenos">574</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">ind_unique</span><span class="si">}{</span><span class="n">ind_primary</span><span class="si">}{</span><span class="n">ind_amp</span><span class="si">}</span><span class="s2"> INDEX</span><span class="si">{</span><span class="n">ind_name</span><span class="si">}{</span><span class="n">ind_columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.create_sql-575"><a href="#Generator.create_sql-575"><span class="linenos">575</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-576"><a href="#Generator.create_sql-576"><span class="linenos">576</span></a> <span class="n">index_sql</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">indexes_sql</span><span class="p">)</span> +</span><span id="Generator.create_sql-577"><a href="#Generator.create_sql-577"><span class="linenos">577</span></a> +</span><span id="Generator.create_sql-578"><a href="#Generator.create_sql-578"><span class="linenos">578</span></a> <span class="n">postcreate_props_sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-579"><a href="#Generator.create_sql-579"><span class="linenos">579</span></a> <span class="k">if</span> <span class="n">properties_locs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">):</span> +</span><span id="Generator.create_sql-580"><a href="#Generator.create_sql-580"><span class="linenos">580</span></a> <span class="n">postcreate_props_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span> +</span><span id="Generator.create_sql-581"><a href="#Generator.create_sql-581"><span class="linenos">581</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">]),</span> +</span><span id="Generator.create_sql-582"><a href="#Generator.create_sql-582"><span class="linenos">582</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> +</span><span id="Generator.create_sql-583"><a href="#Generator.create_sql-583"><span class="linenos">583</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> +</span><span id="Generator.create_sql-584"><a href="#Generator.create_sql-584"><span class="linenos">584</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.create_sql-585"><a href="#Generator.create_sql-585"><span class="linenos">585</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-586"><a href="#Generator.create_sql-586"><span class="linenos">586</span></a> +</span><span id="Generator.create_sql-587"><a href="#Generator.create_sql-587"><span class="linenos">587</span></a> <span class="n">modifiers</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.create_sql-588"><a href="#Generator.create_sql-588"><span class="linenos">588</span></a> <span class="p">(</span> +</span><span id="Generator.create_sql-589"><a href="#Generator.create_sql-589"><span class="linenos">589</span></a> <span class="n">replace</span><span class="p">,</span> +</span><span id="Generator.create_sql-590"><a href="#Generator.create_sql-590"><span class="linenos">590</span></a> <span class="n">temporary</span><span class="p">,</span> +</span><span id="Generator.create_sql-591"><a href="#Generator.create_sql-591"><span class="linenos">591</span></a> <span class="n">transient</span><span class="p">,</span> +</span><span id="Generator.create_sql-592"><a href="#Generator.create_sql-592"><span class="linenos">592</span></a> <span class="n">external</span><span class="p">,</span> +</span><span id="Generator.create_sql-593"><a href="#Generator.create_sql-593"><span class="linenos">593</span></a> <span class="n">unique</span><span class="p">,</span> +</span><span id="Generator.create_sql-594"><a href="#Generator.create_sql-594"><span class="linenos">594</span></a> <span class="n">materialized</span><span class="p">,</span> +</span><span id="Generator.create_sql-595"><a href="#Generator.create_sql-595"><span class="linenos">595</span></a> <span class="n">set_</span><span class="p">,</span> +</span><span id="Generator.create_sql-596"><a href="#Generator.create_sql-596"><span class="linenos">596</span></a> <span class="n">multiset</span><span class="p">,</span> +</span><span id="Generator.create_sql-597"><a href="#Generator.create_sql-597"><span class="linenos">597</span></a> <span class="n">global_temporary</span><span class="p">,</span> +</span><span id="Generator.create_sql-598"><a href="#Generator.create_sql-598"><span class="linenos">598</span></a> <span class="n">volatile</span><span class="p">,</span> +</span><span id="Generator.create_sql-599"><a href="#Generator.create_sql-599"><span class="linenos">599</span></a> <span class="n">postcreate_props_sql</span><span class="p">,</span> +</span><span id="Generator.create_sql-600"><a href="#Generator.create_sql-600"><span class="linenos">600</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-601"><a href="#Generator.create_sql-601"><span class="linenos">601</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-602"><a href="#Generator.create_sql-602"><span class="linenos">602</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.create_sql-603"><a href="#Generator.create_sql-603"><span class="linenos">603</span></a> <span class="s2">" WITH NO SCHEMA BINDING"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no_schema_binding"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.create_sql-604"><a href="#Generator.create_sql-604"><span class="linenos">604</span></a> <span class="p">)</span> +</span><span id="Generator.create_sql-605"><a href="#Generator.create_sql-605"><span class="linenos">605</span></a> +</span><span id="Generator.create_sql-606"><a href="#Generator.create_sql-606"><span class="linenos">606</span></a> <span class="n">post_expression_modifiers</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">((</span><span class="n">data</span><span class="p">,</span> <span class="n">statistics</span><span class="p">,</span> <span class="n">no_primary_index</span><span class="p">))</span> +</span><span id="Generator.create_sql-607"><a href="#Generator.create_sql-607"><span class="linenos">607</span></a> +</span><span id="Generator.create_sql-608"><a href="#Generator.create_sql-608"><span class="linenos">608</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"CREATE</span><span class="si">{</span><span class="n">modifiers</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">exists_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">properties_sql</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}{</span><span class="n">post_expression_modifiers</span><span class="si">}{</span><span class="n">index_sql</span><span class="si">}{</span><span class="n">no_schema_binding</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.create_sql-609"><a href="#Generator.create_sql-609"><span class="linenos">609</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.describe_sql" class="classattr"> + <input id="Generator.describe_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">describe_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Describe">sqlglot.expressions.Describe</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.describe_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.describe_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.describe_sql-611"><a href="#Generator.describe_sql-611"><span class="linenos">611</span></a> <span class="k">def</span> <span class="nf">describe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.describe_sql-612"><a href="#Generator.describe_sql-612"><span class="linenos">612</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DESCRIBE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.prepend_ctes" class="classattr"> + <input id="Generator.prepend_ctes-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">prepend_ctes</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>, </span><span class="param"><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.prepend_ctes-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.prepend_ctes"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.prepend_ctes-614"><a href="#Generator.prepend_ctes-614"><span class="linenos">614</span></a> <span class="k">def</span> <span class="nf">prepend_ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.prepend_ctes-615"><a href="#Generator.prepend_ctes-615"><span class="linenos">615</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"with"</span><span class="p">)</span> +</span><span id="Generator.prepend_ctes-616"><a href="#Generator.prepend_ctes-616"><span class="linenos">616</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="Generator.prepend_ctes-617"><a href="#Generator.prepend_ctes-617"><span class="linenos">617</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">with_</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.prepend_ctes-618"><a href="#Generator.prepend_ctes-618"><span class="linenos">618</span></a> <span class="k">return</span> <span class="n">sql</span> +</span></pre></div> + + + + + </div> + <div id="Generator.with_sql" class="classattr"> + <input id="Generator.with_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">with_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#With">sqlglot.expressions.With</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.with_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.with_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.with_sql-620"><a href="#Generator.with_sql-620"><span class="linenos">620</span></a> <span class="k">def</span> <span class="nf">with_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.with_sql-621"><a href="#Generator.with_sql-621"><span class="linenos">621</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.with_sql-622"><a href="#Generator.with_sql-622"><span class="linenos">622</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="s2">"RECURSIVE "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.with_sql-623"><a href="#Generator.with_sql-623"><span class="linenos">623</span></a> +</span><span id="Generator.with_sql-624"><a href="#Generator.with_sql-624"><span class="linenos">624</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WITH </span><span class="si">{</span><span class="n">recursive</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.cte_sql" class="classattr"> + <input id="Generator.cte_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cte_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#CTE">sqlglot.expressions.CTE</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.cte_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.cte_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.cte_sql-626"><a href="#Generator.cte_sql-626"><span class="linenos">626</span></a> <span class="k">def</span> <span class="nf">cte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.cte_sql-627"><a href="#Generator.cte_sql-627"><span class="linenos">627</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.cte_sql-628"><a href="#Generator.cte_sql-628"><span class="linenos">628</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.tablealias_sql" class="classattr"> + <input id="Generator.tablealias_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">tablealias_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#TableAlias">sqlglot.expressions.TableAlias</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.tablealias_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.tablealias_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.tablealias_sql-630"><a href="#Generator.tablealias_sql-630"><span class="linenos">630</span></a> <span class="k">def</span> <span class="nf">tablealias_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.tablealias_sql-631"><a href="#Generator.tablealias_sql-631"><span class="linenos">631</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.tablealias_sql-632"><a href="#Generator.tablealias_sql-632"><span class="linenos">632</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.tablealias_sql-633"><a href="#Generator.tablealias_sql-633"><span class="linenos">633</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablealias_sql-634"><a href="#Generator.tablealias_sql-634"><span class="linenos">634</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">alias</span><span class="si">}{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitstring_sql" class="classattr"> + <input id="Generator.bitstring_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitstring_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitString">sqlglot.expressions.BitString</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitstring_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitstring_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitstring_sql-636"><a href="#Generator.bitstring_sql-636"><span class="linenos">636</span></a> <span class="k">def</span> <span class="nf">bitstring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitString</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitstring_sql-637"><a href="#Generator.bitstring_sql-637"><span class="linenos">637</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.hexstring_sql" class="classattr"> + <input id="Generator.hexstring_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">hexstring_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#HexString">sqlglot.expressions.HexString</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.hexstring_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.hexstring_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.hexstring_sql-639"><a href="#Generator.hexstring_sql-639"><span class="linenos">639</span></a> <span class="k">def</span> <span class="nf">hexstring_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">HexString</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.hexstring_sql-640"><a href="#Generator.hexstring_sql-640"><span class="linenos">640</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.datatype_sql" class="classattr"> + <input id="Generator.datatype_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">datatype_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#DataType">sqlglot.expressions.DataType</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.datatype_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.datatype_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.datatype_sql-642"><a href="#Generator.datatype_sql-642"><span class="linenos">642</span></a> <span class="k">def</span> <span class="nf">datatype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.datatype_sql-643"><a href="#Generator.datatype_sql-643"><span class="linenos">643</span></a> <span class="n">type_value</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Generator.datatype_sql-644"><a href="#Generator.datatype_sql-644"><span class="linenos">644</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">TYPE_MAPPING</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">type_value</span><span class="p">,</span> <span class="n">type_value</span><span class="o">.</span><span class="n">value</span><span class="p">)</span> +</span><span id="Generator.datatype_sql-645"><a href="#Generator.datatype_sql-645"><span class="linenos">645</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.datatype_sql-646"><a href="#Generator.datatype_sql-646"><span class="linenos">646</span></a> <span class="n">interior</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.datatype_sql-647"><a href="#Generator.datatype_sql-647"><span class="linenos">647</span></a> <span class="n">values</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.datatype_sql-648"><a href="#Generator.datatype_sql-648"><span class="linenos">648</span></a> <span class="k">if</span> <span class="n">interior</span><span class="p">:</span> +</span><span id="Generator.datatype_sql-649"><a href="#Generator.datatype_sql-649"><span class="linenos">649</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nested"</span><span class="p">):</span> +</span><span id="Generator.datatype_sql-650"><a href="#Generator.datatype_sql-650"><span class="linenos">650</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">STRUCT_DELIMITER</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}{</span><span class="n">interior</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">STRUCT_DELIMITER</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.datatype_sql-651"><a href="#Generator.datatype_sql-651"><span class="linenos">651</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"values"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.datatype_sql-652"><a href="#Generator.datatype_sql-652"><span class="linenos">652</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"["</span><span class="p">,</span> <span class="s2">"]"</span><span class="p">)</span> <span class="k">if</span> <span class="n">type_value</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span> <span class="k">else</span> <span class="p">(</span><span class="s2">"("</span><span class="p">,</span> <span class="s2">")"</span><span class="p">)</span> +</span><span id="Generator.datatype_sql-653"><a href="#Generator.datatype_sql-653"><span class="linenos">653</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.datatype_sql-654"><a href="#Generator.datatype_sql-654"><span class="linenos">654</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">delimiters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'values'</span><span class="p">)</span><span class="si">}{</span><span class="n">delimiters</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.datatype_sql-655"><a href="#Generator.datatype_sql-655"><span class="linenos">655</span></a> <span class="p">)</span> +</span><span id="Generator.datatype_sql-656"><a href="#Generator.datatype_sql-656"><span class="linenos">656</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.datatype_sql-657"><a href="#Generator.datatype_sql-657"><span class="linenos">657</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">interior</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.datatype_sql-658"><a href="#Generator.datatype_sql-658"><span class="linenos">658</span></a> +</span><span id="Generator.datatype_sql-659"><a href="#Generator.datatype_sql-659"><span class="linenos">659</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}{</span><span class="n">nested</span><span class="si">}{</span><span class="n">values</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.directory_sql" class="classattr"> + <input id="Generator.directory_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">directory_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Directory">sqlglot.expressions.Directory</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.directory_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.directory_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.directory_sql-661"><a href="#Generator.directory_sql-661"><span class="linenos">661</span></a> <span class="k">def</span> <span class="nf">directory_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.directory_sql-662"><a href="#Generator.directory_sql-662"><span class="linenos">662</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">"LOCAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.directory_sql-663"><a href="#Generator.directory_sql-663"><span class="linenos">663</span></a> <span class="n">row_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"row_format"</span><span class="p">)</span> +</span><span id="Generator.directory_sql-664"><a href="#Generator.directory_sql-664"><span class="linenos">664</span></a> <span class="n">row_format</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">row_format</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">row_format</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.directory_sql-665"><a href="#Generator.directory_sql-665"><span class="linenos">665</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">local</span><span class="si">}</span><span class="s2">DIRECTORY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">row_format</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.delete_sql" class="classattr"> + <input id="Generator.delete_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">delete_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Delete">sqlglot.expressions.Delete</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.delete_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.delete_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.delete_sql-667"><a href="#Generator.delete_sql-667"><span class="linenos">667</span></a> <span class="k">def</span> <span class="nf">delete_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.delete_sql-668"><a href="#Generator.delete_sql-668"><span class="linenos">668</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.delete_sql-669"><a href="#Generator.delete_sql-669"><span class="linenos">669</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FROM </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.delete_sql-670"><a href="#Generator.delete_sql-670"><span class="linenos">670</span></a> <span class="n">using_sql</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.delete_sql-671"><a href="#Generator.delete_sql-671"><span class="linenos">671</span></a> <span class="sa">f</span><span class="s2">" USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'using'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">', USING '</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.delete_sql-672"><a href="#Generator.delete_sql-672"><span class="linenos">672</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="Generator.delete_sql-673"><a href="#Generator.delete_sql-673"><span class="linenos">673</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.delete_sql-674"><a href="#Generator.delete_sql-674"><span class="linenos">674</span></a> <span class="p">)</span> +</span><span id="Generator.delete_sql-675"><a href="#Generator.delete_sql-675"><span class="linenos">675</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Generator.delete_sql-676"><a href="#Generator.delete_sql-676"><span class="linenos">676</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"DELETE</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">using_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.delete_sql-677"><a href="#Generator.delete_sql-677"><span class="linenos">677</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.drop_sql" class="classattr"> + <input id="Generator.drop_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">drop_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Drop">sqlglot.expressions.Drop</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.drop_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.drop_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.drop_sql-679"><a href="#Generator.drop_sql-679"><span class="linenos">679</span></a> <span class="k">def</span> <span class="nf">drop_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.drop_sql-680"><a href="#Generator.drop_sql-680"><span class="linenos">680</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.drop_sql-681"><a href="#Generator.drop_sql-681"><span class="linenos">681</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> +</span><span id="Generator.drop_sql-682"><a href="#Generator.drop_sql-682"><span class="linenos">682</span></a> <span class="n">exists_sql</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator.drop_sql-683"><a href="#Generator.drop_sql-683"><span class="linenos">683</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.drop_sql-684"><a href="#Generator.drop_sql-684"><span class="linenos">684</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="s2">" MATERIALIZED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"materialized"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.drop_sql-685"><a href="#Generator.drop_sql-685"><span class="linenos">685</span></a> <span class="n">cascade</span> <span class="o">=</span> <span class="s2">" CASCADE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cascade"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.drop_sql-686"><a href="#Generator.drop_sql-686"><span class="linenos">686</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DROP</span><span class="si">{</span><span class="n">temporary</span><span class="si">}{</span><span class="n">materialized</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">exists_sql</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">cascade</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.except_sql" class="classattr"> + <input id="Generator.except_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">except_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Except">sqlglot.expressions.Except</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.except_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.except_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.except_sql-688"><a href="#Generator.except_sql-688"><span class="linenos">688</span></a> <span class="k">def</span> <span class="nf">except_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.except_sql-689"><a href="#Generator.except_sql-689"><span class="linenos">689</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="Generator.except_sql-690"><a href="#Generator.except_sql-690"><span class="linenos">690</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator.except_sql-691"><a href="#Generator.except_sql-691"><span class="linenos">691</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">except_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="Generator.except_sql-692"><a href="#Generator.except_sql-692"><span class="linenos">692</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.except_op" class="classattr"> + <input id="Generator.except_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">except_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Except">sqlglot.expressions.Except</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.except_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.except_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.except_op-694"><a href="#Generator.except_op-694"><span class="linenos">694</span></a> <span class="k">def</span> <span class="nf">except_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.except_op-695"><a href="#Generator.except_op-695"><span class="linenos">695</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXCEPT</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.fetch_sql" class="classattr"> + <input id="Generator.fetch_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">fetch_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Fetch">sqlglot.expressions.Fetch</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.fetch_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.fetch_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.fetch_sql-697"><a href="#Generator.fetch_sql-697"><span class="linenos">697</span></a> <span class="k">def</span> <span class="nf">fetch_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.fetch_sql-698"><a href="#Generator.fetch_sql-698"><span class="linenos">698</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"direction"</span><span class="p">)</span> +</span><span id="Generator.fetch_sql-699"><a href="#Generator.fetch_sql-699"><span class="linenos">699</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">direction</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">direction</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.fetch_sql-700"><a href="#Generator.fetch_sql-700"><span class="linenos">700</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"count"</span><span class="p">)</span> +</span><span id="Generator.fetch_sql-701"><a href="#Generator.fetch_sql-701"><span class="linenos">701</span></a> <span class="n">count</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">count</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">count</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.fetch_sql-702"><a href="#Generator.fetch_sql-702"><span class="linenos">702</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'FETCH'</span><span class="p">)</span><span class="si">}{</span><span class="n">direction</span><span class="si">}{</span><span class="n">count</span><span class="si">}</span><span class="s2"> ROWS ONLY"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.filter_sql" class="classattr"> + <input id="Generator.filter_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">filter_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Filter">sqlglot.expressions.Filter</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.filter_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.filter_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.filter_sql-704"><a href="#Generator.filter_sql-704"><span class="linenos">704</span></a> <span class="k">def</span> <span class="nf">filter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Filter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.filter_sql-705"><a href="#Generator.filter_sql-705"><span class="linenos">705</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.filter_sql-706"><a href="#Generator.filter_sql-706"><span class="linenos">706</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> <span class="c1"># where has a leading space</span> +</span><span id="Generator.filter_sql-707"><a href="#Generator.filter_sql-707"><span class="linenos">707</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> FILTER(</span><span class="si">{</span><span class="n">where</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.hint_sql" class="classattr"> + <input id="Generator.hint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">hint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Hint">sqlglot.expressions.Hint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.hint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.hint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.hint_sql-709"><a href="#Generator.hint_sql-709"><span class="linenos">709</span></a> <span class="k">def</span> <span class="nf">hint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.hint_sql-710"><a href="#Generator.hint_sql-710"><span class="linenos">710</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">):</span> +</span><span id="Generator.hint_sql-711"><a href="#Generator.hint_sql-711"><span class="linenos">711</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Hints are not supported"</span><span class="p">)</span> +</span><span id="Generator.hint_sql-712"><a href="#Generator.hint_sql-712"><span class="linenos">712</span></a> <span class="k">return</span> <span class="s2">""</span> +</span></pre></div> + + + + + </div> + <div id="Generator.index_sql" class="classattr"> + <input id="Generator.index_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">index_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Index">sqlglot.expressions.Index</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.index_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.index_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.index_sql-714"><a href="#Generator.index_sql-714"><span class="linenos">714</span></a> <span class="k">def</span> <span class="nf">index_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.index_sql-715"><a href="#Generator.index_sql-715"><span class="linenos">715</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.index_sql-716"><a href="#Generator.index_sql-716"><span class="linenos">716</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"table"</span><span class="p">)</span> +</span><span id="Generator.index_sql-717"><a href="#Generator.index_sql-717"><span class="linenos">717</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"columns"</span><span class="p">)</span> +</span><span id="Generator.index_sql-718"><a href="#Generator.index_sql-718"><span class="linenos">718</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> ON </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.identifier_sql" class="classattr"> + <input id="Generator.identifier_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">identifier_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Identifier">sqlglot.expressions.Identifier</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.identifier_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.identifier_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.identifier_sql-720"><a href="#Generator.identifier_sql-720"><span class="linenos">720</span></a> <span class="k">def</span> <span class="nf">identifier_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.identifier_sql-721"><a href="#Generator.identifier_sql-721"><span class="linenos">721</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> +</span><span id="Generator.identifier_sql-722"><a href="#Generator.identifier_sql-722"><span class="linenos">722</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">normalize</span> <span class="k">else</span> <span class="n">text</span> +</span><span id="Generator.identifier_sql-723"><a href="#Generator.identifier_sql-723"><span class="linenos">723</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_identifier_end</span><span class="p">)</span> +</span><span id="Generator.identifier_sql-724"><a href="#Generator.identifier_sql-724"><span class="linenos">724</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">identify</span><span class="p">:</span> +</span><span id="Generator.identifier_sql-725"><a href="#Generator.identifier_sql-725"><span class="linenos">725</span></a> <span class="n">text</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_start</span><span class="si">}{</span><span class="n">text</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">identifier_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.identifier_sql-726"><a href="#Generator.identifier_sql-726"><span class="linenos">726</span></a> <span class="k">return</span> <span class="n">text</span> +</span></pre></div> + + + + + </div> + <div id="Generator.national_sql" class="classattr"> + <input id="Generator.national_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">national_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#National">sqlglot.expressions.National</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.national_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.national_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.national_sql-728"><a href="#Generator.national_sql-728"><span class="linenos">728</span></a> <span class="k">def</span> <span class="nf">national_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">National</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.national_sql-729"><a href="#Generator.national_sql-729"><span class="linenos">729</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"N</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.partition_sql" class="classattr"> + <input id="Generator.partition_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">partition_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Partition">sqlglot.expressions.Partition</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.partition_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.partition_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.partition_sql-731"><a href="#Generator.partition_sql-731"><span class="linenos">731</span></a> <span class="k">def</span> <span class="nf">partition_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Partition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.partition_sql-732"><a href="#Generator.partition_sql-732"><span class="linenos">732</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.properties_sql" class="classattr"> + <input id="Generator.properties_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">properties_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Properties">sqlglot.expressions.Properties</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.properties_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.properties_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.properties_sql-734"><a href="#Generator.properties_sql-734"><span class="linenos">734</span></a> <span class="k">def</span> <span class="nf">properties_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.properties_sql-735"><a href="#Generator.properties_sql-735"><span class="linenos">735</span></a> <span class="n">root_properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.properties_sql-736"><a href="#Generator.properties_sql-736"><span class="linenos">736</span></a> <span class="n">with_properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.properties_sql-737"><a href="#Generator.properties_sql-737"><span class="linenos">737</span></a> +</span><span id="Generator.properties_sql-738"><a href="#Generator.properties_sql-738"><span class="linenos">738</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator.properties_sql-739"><a href="#Generator.properties_sql-739"><span class="linenos">739</span></a> <span class="n">p_loc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="vm">__class__</span><span class="p">]</span> +</span><span id="Generator.properties_sql-740"><a href="#Generator.properties_sql-740"><span class="linenos">740</span></a> <span class="k">if</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">:</span> +</span><span id="Generator.properties_sql-741"><a href="#Generator.properties_sql-741"><span class="linenos">741</span></a> <span class="n">with_properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.properties_sql-742"><a href="#Generator.properties_sql-742"><span class="linenos">742</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">:</span> +</span><span id="Generator.properties_sql-743"><a href="#Generator.properties_sql-743"><span class="linenos">743</span></a> <span class="n">root_properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.properties_sql-744"><a href="#Generator.properties_sql-744"><span class="linenos">744</span></a> +</span><span id="Generator.properties_sql-745"><a href="#Generator.properties_sql-745"><span class="linenos">745</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">root_properties</span><span class="p">(</span> +</span><span id="Generator.properties_sql-746"><a href="#Generator.properties_sql-746"><span class="linenos">746</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">root_properties</span><span class="p">)</span> +</span><span id="Generator.properties_sql-747"><a href="#Generator.properties_sql-747"><span class="linenos">747</span></a> <span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">with_properties</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">with_properties</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="Generator.root_properties" class="classattr"> + <input id="Generator.root_properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">root_properties</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">properties</span><span class="p">:</span> <span class="n"><a href="expressions.html#Properties">sqlglot.expressions.Properties</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.root_properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.root_properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.root_properties-749"><a href="#Generator.root_properties-749"><span class="linenos">749</span></a> <span class="k">def</span> <span class="nf">root_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.root_properties-750"><a href="#Generator.root_properties-750"><span class="linenos">750</span></a> <span class="k">if</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator.root_properties-751"><a href="#Generator.root_properties-751"><span class="linenos">751</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator.root_properties-752"><a href="#Generator.root_properties-752"><span class="linenos">752</span></a> <span class="k">return</span> <span class="s2">""</span> +</span></pre></div> + + + + + </div> + <div id="Generator.properties" class="classattr"> + <input id="Generator.properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">properties</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">properties</span><span class="p">:</span> <span class="n"><a href="expressions.html#Properties">sqlglot.expressions.Properties</a></span>,</span><span class="param"> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">''</span>,</span><span class="param"> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">', '</span>,</span><span class="param"> <span class="n">suffix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">''</span>,</span><span class="param"> <span class="n">wrapped</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.properties-754"><a href="#Generator.properties-754"><span class="linenos">754</span></a> <span class="k">def</span> <span class="nf">properties</span><span class="p">(</span> +</span><span id="Generator.properties-755"><a href="#Generator.properties-755"><span class="linenos">755</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator.properties-756"><a href="#Generator.properties-756"><span class="linenos">756</span></a> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">,</span> +</span><span id="Generator.properties-757"><a href="#Generator.properties-757"><span class="linenos">757</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator.properties-758"><a href="#Generator.properties-758"><span class="linenos">758</span></a> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">,</span> +</span><span id="Generator.properties-759"><a href="#Generator.properties-759"><span class="linenos">759</span></a> <span class="n">suffix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator.properties-760"><a href="#Generator.properties-760"><span class="linenos">760</span></a> <span class="n">wrapped</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Generator.properties-761"><a href="#Generator.properties-761"><span class="linenos">761</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.properties-762"><a href="#Generator.properties-762"><span class="linenos">762</span></a> <span class="k">if</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator.properties-763"><a href="#Generator.properties-763"><span class="linenos">763</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="n">sep</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator.properties-764"><a href="#Generator.properties-764"><span class="linenos">764</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="k">if</span> <span class="n">wrapped</span> <span class="k">else</span> <span class="n">expressions</span> +</span><span id="Generator.properties-765"><a href="#Generator.properties-765"><span class="linenos">765</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="s1">' '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">prefix</span><span class="w"> </span><span class="ow">and</span><span class="w"> </span><span class="n">prefix</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="s1">' '</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">suffix</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.properties-766"><a href="#Generator.properties-766"><span class="linenos">766</span></a> <span class="k">return</span> <span class="s2">""</span> +</span></pre></div> + + + + + </div> + <div id="Generator.with_properties" class="classattr"> + <input id="Generator.with_properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">with_properties</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">properties</span><span class="p">:</span> <span class="n"><a href="expressions.html#Properties">sqlglot.expressions.Properties</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.with_properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.with_properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.with_properties-768"><a href="#Generator.with_properties-768"><span class="linenos">768</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.with_properties-769"><a href="#Generator.with_properties-769"><span class="linenos">769</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">))</span> +</span></pre></div> + + + + + </div> + <div id="Generator.locate_properties" class="classattr"> + <input id="Generator.locate_properties-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">locate_properties</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">properties</span><span class="p">:</span> <span class="n"><a href="expressions.html#Properties">sqlglot.expressions.Properties</a></span></span><span class="return-annotation">) -> <span class="n">Dict</span><span class="p">[</span><span class="n"><a href="expressions.html#Properties.Location">sqlglot.expressions.Properties.Location</a></span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n"><a href="expressions.html#Property">sqlglot.expressions.Property</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="Generator.locate_properties-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.locate_properties"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.locate_properties-771"><a href="#Generator.locate_properties-771"><span class="linenos">771</span></a> <span class="k">def</span> <span class="nf">locate_properties</span><span class="p">(</span> +</span><span id="Generator.locate_properties-772"><a href="#Generator.locate_properties-772"><span class="linenos">772</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span> +</span><span id="Generator.locate_properties-773"><a href="#Generator.locate_properties-773"><span class="linenos">773</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]]:</span> +</span><span id="Generator.locate_properties-774"><a href="#Generator.locate_properties-774"><span class="linenos">774</span></a> <span class="n">properties_locs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Generator.locate_properties-775"><a href="#Generator.locate_properties-775"><span class="linenos">775</span></a> <span class="n">key</span><span class="p">:</span> <span class="p">[]</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span> +</span><span id="Generator.locate_properties-776"><a href="#Generator.locate_properties-776"><span class="linenos">776</span></a> <span class="p">}</span> +</span><span id="Generator.locate_properties-777"><a href="#Generator.locate_properties-777"><span class="linenos">777</span></a> +</span><span id="Generator.locate_properties-778"><a href="#Generator.locate_properties-778"><span class="linenos">778</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator.locate_properties-779"><a href="#Generator.locate_properties-779"><span class="linenos">779</span></a> <span class="n">p_loc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">[</span><span class="n">p</span><span class="o">.</span><span class="vm">__class__</span><span class="p">]</span> +</span><span id="Generator.locate_properties-780"><a href="#Generator.locate_properties-780"><span class="linenos">780</span></a> <span class="k">if</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">:</span> +</span><span id="Generator.locate_properties-781"><a href="#Generator.locate_properties-781"><span class="linenos">781</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">PRE_SCHEMA</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.locate_properties-782"><a href="#Generator.locate_properties-782"><span class="linenos">782</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">:</span> +</span><span id="Generator.locate_properties-783"><a href="#Generator.locate_properties-783"><span class="linenos">783</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_INDEX</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.locate_properties-784"><a href="#Generator.locate_properties-784"><span class="linenos">784</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">:</span> +</span><span id="Generator.locate_properties-785"><a href="#Generator.locate_properties-785"><span class="linenos">785</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_ROOT</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.locate_properties-786"><a href="#Generator.locate_properties-786"><span class="linenos">786</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">:</span> +</span><span id="Generator.locate_properties-787"><a href="#Generator.locate_properties-787"><span class="linenos">787</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_SCHEMA_WITH</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.locate_properties-788"><a href="#Generator.locate_properties-788"><span class="linenos">788</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">:</span> +</span><span id="Generator.locate_properties-789"><a href="#Generator.locate_properties-789"><span class="linenos">789</span></a> <span class="n">properties_locs</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">POST_CREATE</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Generator.locate_properties-790"><a href="#Generator.locate_properties-790"><span class="linenos">790</span></a> <span class="k">elif</span> <span class="n">p_loc</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">:</span> +</span><span id="Generator.locate_properties-791"><a href="#Generator.locate_properties-791"><span class="linenos">791</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">p</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.locate_properties-792"><a href="#Generator.locate_properties-792"><span class="linenos">792</span></a> +</span><span id="Generator.locate_properties-793"><a href="#Generator.locate_properties-793"><span class="linenos">793</span></a> <span class="k">return</span> <span class="n">properties_locs</span> +</span></pre></div> + + + + + </div> + <div id="Generator.property_sql" class="classattr"> + <input id="Generator.property_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">property_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Property">sqlglot.expressions.Property</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.property_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.property_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.property_sql-795"><a href="#Generator.property_sql-795"><span class="linenos">795</span></a> <span class="k">def</span> <span class="nf">property_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.property_sql-796"><a href="#Generator.property_sql-796"><span class="linenos">796</span></a> <span class="n">property_cls</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span> +</span><span id="Generator.property_sql-797"><a href="#Generator.property_sql-797"><span class="linenos">797</span></a> <span class="k">if</span> <span class="n">property_cls</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">:</span> +</span><span id="Generator.property_sql-798"><a href="#Generator.property_sql-798"><span class="linenos">798</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.property_sql-799"><a href="#Generator.property_sql-799"><span class="linenos">799</span></a> +</span><span id="Generator.property_sql-800"><a href="#Generator.property_sql-800"><span class="linenos">800</span></a> <span class="n">property_name</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">PROPERTY_TO_NAME</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">property_cls</span><span class="p">)</span> +</span><span id="Generator.property_sql-801"><a href="#Generator.property_sql-801"><span class="linenos">801</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">property_name</span><span class="p">:</span> +</span><span id="Generator.property_sql-802"><a href="#Generator.property_sql-802"><span class="linenos">802</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.property_sql-803"><a href="#Generator.property_sql-803"><span class="linenos">803</span></a> +</span><span id="Generator.property_sql-804"><a href="#Generator.property_sql-804"><span class="linenos">804</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">property_name</span><span class="si">}</span><span class="s2">=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.likeproperty_sql" class="classattr"> + <input id="Generator.likeproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">likeproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#LikeProperty">sqlglot.expressions.LikeProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.likeproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.likeproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.likeproperty_sql-806"><a href="#Generator.likeproperty_sql-806"><span class="linenos">806</span></a> <span class="k">def</span> <span class="nf">likeproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.likeproperty_sql-807"><a href="#Generator.likeproperty_sql-807"><span class="linenos">807</span></a> <span class="n">options</span> <span class="o">=</span> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'value'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator.likeproperty_sql-808"><a href="#Generator.likeproperty_sql-808"><span class="linenos">808</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.likeproperty_sql-809"><a href="#Generator.likeproperty_sql-809"><span class="linenos">809</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LIKE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.fallbackproperty_sql" class="classattr"> + <input id="Generator.fallbackproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">fallbackproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#FallbackProperty">sqlglot.expressions.FallbackProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.fallbackproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.fallbackproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.fallbackproperty_sql-811"><a href="#Generator.fallbackproperty_sql-811"><span class="linenos">811</span></a> <span class="k">def</span> <span class="nf">fallbackproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.fallbackproperty_sql-812"><a href="#Generator.fallbackproperty_sql-812"><span class="linenos">812</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.fallbackproperty_sql-813"><a href="#Generator.fallbackproperty_sql-813"><span class="linenos">813</span></a> <span class="n">protection</span> <span class="o">=</span> <span class="s2">" PROTECTION"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"protection"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.fallbackproperty_sql-814"><a href="#Generator.fallbackproperty_sql-814"><span class="linenos">814</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}</span><span class="s2">FALLBACK</span><span class="si">{</span><span class="n">protection</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.journalproperty_sql" class="classattr"> + <input id="Generator.journalproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">journalproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#JournalProperty">sqlglot.expressions.JournalProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.journalproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.journalproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.journalproperty_sql-816"><a href="#Generator.journalproperty_sql-816"><span class="linenos">816</span></a> <span class="k">def</span> <span class="nf">journalproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.journalproperty_sql-817"><a href="#Generator.journalproperty_sql-817"><span class="linenos">817</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.journalproperty_sql-818"><a href="#Generator.journalproperty_sql-818"><span class="linenos">818</span></a> <span class="n">dual</span> <span class="o">=</span> <span class="s2">"DUAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"dual"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.journalproperty_sql-819"><a href="#Generator.journalproperty_sql-819"><span class="linenos">819</span></a> <span class="n">before</span> <span class="o">=</span> <span class="s2">"BEFORE "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"before"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.journalproperty_sql-820"><a href="#Generator.journalproperty_sql-820"><span class="linenos">820</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">dual</span><span class="si">}{</span><span class="n">before</span><span class="si">}</span><span class="s2">JOURNAL"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.freespaceproperty_sql" class="classattr"> + <input id="Generator.freespaceproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">freespaceproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#FreespaceProperty">sqlglot.expressions.FreespaceProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.freespaceproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.freespaceproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.freespaceproperty_sql-822"><a href="#Generator.freespaceproperty_sql-822"><span class="linenos">822</span></a> <span class="k">def</span> <span class="nf">freespaceproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.freespaceproperty_sql-823"><a href="#Generator.freespaceproperty_sql-823"><span class="linenos">823</span></a> <span class="n">freespace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.freespaceproperty_sql-824"><a href="#Generator.freespaceproperty_sql-824"><span class="linenos">824</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="s2">" PERCENT"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"percent"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.freespaceproperty_sql-825"><a href="#Generator.freespaceproperty_sql-825"><span class="linenos">825</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FREESPACE=</span><span class="si">{</span><span class="n">freespace</span><span class="si">}{</span><span class="n">percent</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.afterjournalproperty_sql" class="classattr"> + <input id="Generator.afterjournalproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">afterjournalproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#AfterJournalProperty">sqlglot.expressions.AfterJournalProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.afterjournalproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.afterjournalproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.afterjournalproperty_sql-827"><a href="#Generator.afterjournalproperty_sql-827"><span class="linenos">827</span></a> <span class="k">def</span> <span class="nf">afterjournalproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.afterjournalproperty_sql-828"><a href="#Generator.afterjournalproperty_sql-828"><span class="linenos">828</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">"NO "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.afterjournalproperty_sql-829"><a href="#Generator.afterjournalproperty_sql-829"><span class="linenos">829</span></a> <span class="n">dual</span> <span class="o">=</span> <span class="s2">"DUAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"dual"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.afterjournalproperty_sql-830"><a href="#Generator.afterjournalproperty_sql-830"><span class="linenos">830</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.afterjournalproperty_sql-831"><a href="#Generator.afterjournalproperty_sql-831"><span class="linenos">831</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.afterjournalproperty_sql-832"><a href="#Generator.afterjournalproperty_sql-832"><span class="linenos">832</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">"LOCAL "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"NOT LOCAL "</span> +</span><span id="Generator.afterjournalproperty_sql-833"><a href="#Generator.afterjournalproperty_sql-833"><span class="linenos">833</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">dual</span><span class="si">}{</span><span class="n">local</span><span class="si">}</span><span class="s2">AFTER JOURNAL"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.checksumproperty_sql" class="classattr"> + <input id="Generator.checksumproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">checksumproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#ChecksumProperty">sqlglot.expressions.ChecksumProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.checksumproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.checksumproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.checksumproperty_sql-835"><a href="#Generator.checksumproperty_sql-835"><span class="linenos">835</span></a> <span class="k">def</span> <span class="nf">checksumproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.checksumproperty_sql-836"><a href="#Generator.checksumproperty_sql-836"><span class="linenos">836</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">):</span> +</span><span id="Generator.checksumproperty_sql-837"><a href="#Generator.checksumproperty_sql-837"><span class="linenos">837</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="Generator.checksumproperty_sql-838"><a href="#Generator.checksumproperty_sql-838"><span class="linenos">838</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">):</span> +</span><span id="Generator.checksumproperty_sql-839"><a href="#Generator.checksumproperty_sql-839"><span class="linenos">839</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"ON"</span> +</span><span id="Generator.checksumproperty_sql-840"><a href="#Generator.checksumproperty_sql-840"><span class="linenos">840</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.checksumproperty_sql-841"><a href="#Generator.checksumproperty_sql-841"><span class="linenos">841</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"OFF"</span> +</span><span id="Generator.checksumproperty_sql-842"><a href="#Generator.checksumproperty_sql-842"><span class="linenos">842</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECKSUM=</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.mergeblockratioproperty_sql" class="classattr"> + <input id="Generator.mergeblockratioproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">mergeblockratioproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#MergeBlockRatioProperty">sqlglot.expressions.MergeBlockRatioProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.mergeblockratioproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.mergeblockratioproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.mergeblockratioproperty_sql-844"><a href="#Generator.mergeblockratioproperty_sql-844"><span class="linenos">844</span></a> <span class="k">def</span> <span class="nf">mergeblockratioproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.mergeblockratioproperty_sql-845"><a href="#Generator.mergeblockratioproperty_sql-845"><span class="linenos">845</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">):</span> +</span><span id="Generator.mergeblockratioproperty_sql-846"><a href="#Generator.mergeblockratioproperty_sql-846"><span class="linenos">846</span></a> <span class="k">return</span> <span class="s2">"NO MERGEBLOCKRATIO"</span> +</span><span id="Generator.mergeblockratioproperty_sql-847"><a href="#Generator.mergeblockratioproperty_sql-847"><span class="linenos">847</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">):</span> +</span><span id="Generator.mergeblockratioproperty_sql-848"><a href="#Generator.mergeblockratioproperty_sql-848"><span class="linenos">848</span></a> <span class="k">return</span> <span class="s2">"DEFAULT MERGEBLOCKRATIO"</span> +</span><span id="Generator.mergeblockratioproperty_sql-849"><a href="#Generator.mergeblockratioproperty_sql-849"><span class="linenos">849</span></a> +</span><span id="Generator.mergeblockratioproperty_sql-850"><a href="#Generator.mergeblockratioproperty_sql-850"><span class="linenos">850</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="s2">" PERCENT"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"percent"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.mergeblockratioproperty_sql-851"><a href="#Generator.mergeblockratioproperty_sql-851"><span class="linenos">851</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MERGEBLOCKRATIO=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">percent</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.datablocksizeproperty_sql" class="classattr"> + <input id="Generator.datablocksizeproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">datablocksizeproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#DataBlocksizeProperty">sqlglot.expressions.DataBlocksizeProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.datablocksizeproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.datablocksizeproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.datablocksizeproperty_sql-853"><a href="#Generator.datablocksizeproperty_sql-853"><span class="linenos">853</span></a> <span class="k">def</span> <span class="nf">datablocksizeproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.datablocksizeproperty_sql-854"><a href="#Generator.datablocksizeproperty_sql-854"><span class="linenos">854</span></a> <span class="n">default</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator.datablocksizeproperty_sql-855"><a href="#Generator.datablocksizeproperty_sql-855"><span class="linenos">855</span></a> <span class="nb">min</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"min"</span><span class="p">)</span> +</span><span id="Generator.datablocksizeproperty_sql-856"><a href="#Generator.datablocksizeproperty_sql-856"><span class="linenos">856</span></a> <span class="k">if</span> <span class="n">default</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">min</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.datablocksizeproperty_sql-857"><a href="#Generator.datablocksizeproperty_sql-857"><span class="linenos">857</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator.datablocksizeproperty_sql-858"><a href="#Generator.datablocksizeproperty_sql-858"><span class="linenos">858</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="Generator.datablocksizeproperty_sql-859"><a href="#Generator.datablocksizeproperty_sql-859"><span class="linenos">859</span></a> <span class="k">elif</span> <span class="nb">min</span><span class="p">:</span> +</span><span id="Generator.datablocksizeproperty_sql-860"><a href="#Generator.datablocksizeproperty_sql-860"><span class="linenos">860</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MINIMUM"</span> +</span><span id="Generator.datablocksizeproperty_sql-861"><a href="#Generator.datablocksizeproperty_sql-861"><span class="linenos">861</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.datablocksizeproperty_sql-862"><a href="#Generator.datablocksizeproperty_sql-862"><span class="linenos">862</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MAXIMUM"</span> +</span><span id="Generator.datablocksizeproperty_sql-863"><a href="#Generator.datablocksizeproperty_sql-863"><span class="linenos">863</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2"> DATABLOCKSIZE"</span> +</span><span id="Generator.datablocksizeproperty_sql-864"><a href="#Generator.datablocksizeproperty_sql-864"><span class="linenos">864</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.datablocksizeproperty_sql-865"><a href="#Generator.datablocksizeproperty_sql-865"><span class="linenos">865</span></a> <span class="n">units</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"units"</span><span class="p">)</span> +</span><span id="Generator.datablocksizeproperty_sql-866"><a href="#Generator.datablocksizeproperty_sql-866"><span class="linenos">866</span></a> <span class="n">units</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">units</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">units</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.datablocksizeproperty_sql-867"><a href="#Generator.datablocksizeproperty_sql-867"><span class="linenos">867</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DATABLOCKSIZE=</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'size'</span><span class="p">)</span><span class="si">}{</span><span class="n">units</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.blockcompressionproperty_sql" class="classattr"> + <input id="Generator.blockcompressionproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">blockcompressionproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BlockCompressionProperty">sqlglot.expressions.BlockCompressionProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.blockcompressionproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.blockcompressionproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.blockcompressionproperty_sql-869"><a href="#Generator.blockcompressionproperty_sql-869"><span class="linenos">869</span></a> <span class="k">def</span> <span class="nf">blockcompressionproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.blockcompressionproperty_sql-870"><a href="#Generator.blockcompressionproperty_sql-870"><span class="linenos">870</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"autotemp"</span><span class="p">)</span> +</span><span id="Generator.blockcompressionproperty_sql-871"><a href="#Generator.blockcompressionproperty_sql-871"><span class="linenos">871</span></a> <span class="n">always</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"always"</span><span class="p">)</span> +</span><span id="Generator.blockcompressionproperty_sql-872"><a href="#Generator.blockcompressionproperty_sql-872"><span class="linenos">872</span></a> <span class="n">default</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator.blockcompressionproperty_sql-873"><a href="#Generator.blockcompressionproperty_sql-873"><span class="linenos">873</span></a> <span class="n">manual</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"manual"</span><span class="p">)</span> +</span><span id="Generator.blockcompressionproperty_sql-874"><a href="#Generator.blockcompressionproperty_sql-874"><span class="linenos">874</span></a> <span class="n">never</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"never"</span><span class="p">)</span> +</span><span id="Generator.blockcompressionproperty_sql-875"><a href="#Generator.blockcompressionproperty_sql-875"><span class="linenos">875</span></a> +</span><span id="Generator.blockcompressionproperty_sql-876"><a href="#Generator.blockcompressionproperty_sql-876"><span class="linenos">876</span></a> <span class="k">if</span> <span class="n">autotemp</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.blockcompressionproperty_sql-877"><a href="#Generator.blockcompressionproperty_sql-877"><span class="linenos">877</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"AUTOTEMP(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">autotemp</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.blockcompressionproperty_sql-878"><a href="#Generator.blockcompressionproperty_sql-878"><span class="linenos">878</span></a> <span class="k">elif</span> <span class="n">always</span><span class="p">:</span> +</span><span id="Generator.blockcompressionproperty_sql-879"><a href="#Generator.blockcompressionproperty_sql-879"><span class="linenos">879</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"ALWAYS"</span> +</span><span id="Generator.blockcompressionproperty_sql-880"><a href="#Generator.blockcompressionproperty_sql-880"><span class="linenos">880</span></a> <span class="k">elif</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator.blockcompressionproperty_sql-881"><a href="#Generator.blockcompressionproperty_sql-881"><span class="linenos">881</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"DEFAULT"</span> +</span><span id="Generator.blockcompressionproperty_sql-882"><a href="#Generator.blockcompressionproperty_sql-882"><span class="linenos">882</span></a> <span class="k">elif</span> <span class="n">manual</span><span class="p">:</span> +</span><span id="Generator.blockcompressionproperty_sql-883"><a href="#Generator.blockcompressionproperty_sql-883"><span class="linenos">883</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"MANUAL"</span> +</span><span id="Generator.blockcompressionproperty_sql-884"><a href="#Generator.blockcompressionproperty_sql-884"><span class="linenos">884</span></a> <span class="k">elif</span> <span class="n">never</span><span class="p">:</span> +</span><span id="Generator.blockcompressionproperty_sql-885"><a href="#Generator.blockcompressionproperty_sql-885"><span class="linenos">885</span></a> <span class="nb">property</span> <span class="o">=</span> <span class="s2">"NEVER"</span> +</span><span id="Generator.blockcompressionproperty_sql-886"><a href="#Generator.blockcompressionproperty_sql-886"><span class="linenos">886</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"BLOCKCOMPRESSION=</span><span class="si">{</span><span class="nb">property</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.isolatedloadingproperty_sql" class="classattr"> + <input id="Generator.isolatedloadingproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">isolatedloadingproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#IsolatedLoadingProperty">sqlglot.expressions.IsolatedLoadingProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.isolatedloadingproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.isolatedloadingproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.isolatedloadingproperty_sql-888"><a href="#Generator.isolatedloadingproperty_sql-888"><span class="linenos">888</span></a> <span class="k">def</span> <span class="nf">isolatedloadingproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.isolatedloadingproperty_sql-889"><a href="#Generator.isolatedloadingproperty_sql-889"><span class="linenos">889</span></a> <span class="n">no</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"no"</span><span class="p">)</span> +</span><span id="Generator.isolatedloadingproperty_sql-890"><a href="#Generator.isolatedloadingproperty_sql-890"><span class="linenos">890</span></a> <span class="n">no</span> <span class="o">=</span> <span class="s2">" NO"</span> <span class="k">if</span> <span class="n">no</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.isolatedloadingproperty_sql-891"><a href="#Generator.isolatedloadingproperty_sql-891"><span class="linenos">891</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"concurrent"</span><span class="p">)</span> +</span><span id="Generator.isolatedloadingproperty_sql-892"><a href="#Generator.isolatedloadingproperty_sql-892"><span class="linenos">892</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="s2">" CONCURRENT"</span> <span class="k">if</span> <span class="n">concurrent</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.isolatedloadingproperty_sql-893"><a href="#Generator.isolatedloadingproperty_sql-893"><span class="linenos">893</span></a> +</span><span id="Generator.isolatedloadingproperty_sql-894"><a href="#Generator.isolatedloadingproperty_sql-894"><span class="linenos">894</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.isolatedloadingproperty_sql-895"><a href="#Generator.isolatedloadingproperty_sql-895"><span class="linenos">895</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_all"</span><span class="p">):</span> +</span><span id="Generator.isolatedloadingproperty_sql-896"><a href="#Generator.isolatedloadingproperty_sql-896"><span class="linenos">896</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR ALL"</span> +</span><span id="Generator.isolatedloadingproperty_sql-897"><a href="#Generator.isolatedloadingproperty_sql-897"><span class="linenos">897</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_insert"</span><span class="p">):</span> +</span><span id="Generator.isolatedloadingproperty_sql-898"><a href="#Generator.isolatedloadingproperty_sql-898"><span class="linenos">898</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR INSERT"</span> +</span><span id="Generator.isolatedloadingproperty_sql-899"><a href="#Generator.isolatedloadingproperty_sql-899"><span class="linenos">899</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"for_none"</span><span class="p">):</span> +</span><span id="Generator.isolatedloadingproperty_sql-900"><a href="#Generator.isolatedloadingproperty_sql-900"><span class="linenos">900</span></a> <span class="n">for_</span> <span class="o">=</span> <span class="s2">" FOR NONE"</span> +</span><span id="Generator.isolatedloadingproperty_sql-901"><a href="#Generator.isolatedloadingproperty_sql-901"><span class="linenos">901</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WITH</span><span class="si">{</span><span class="n">no</span><span class="si">}{</span><span class="n">concurrent</span><span class="si">}</span><span class="s2"> ISOLATED LOADING</span><span class="si">{</span><span class="n">for_</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.insert_sql" class="classattr"> + <input id="Generator.insert_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">insert_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Insert">sqlglot.expressions.Insert</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.insert_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.insert_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.insert_sql-903"><a href="#Generator.insert_sql-903"><span class="linenos">903</span></a> <span class="k">def</span> <span class="nf">insert_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.insert_sql-904"><a href="#Generator.insert_sql-904"><span class="linenos">904</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"overwrite"</span><span class="p">)</span> +</span><span id="Generator.insert_sql-905"><a href="#Generator.insert_sql-905"><span class="linenos">905</span></a> +</span><span id="Generator.insert_sql-906"><a href="#Generator.insert_sql-906"><span class="linenos">906</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">):</span> +</span><span id="Generator.insert_sql-907"><a href="#Generator.insert_sql-907"><span class="linenos">907</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">"OVERWRITE "</span> <span class="k">if</span> <span class="n">overwrite</span> <span class="k">else</span> <span class="s2">"INTO "</span> +</span><span id="Generator.insert_sql-908"><a href="#Generator.insert_sql-908"><span class="linenos">908</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.insert_sql-909"><a href="#Generator.insert_sql-909"><span class="linenos">909</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">"OVERWRITE TABLE "</span> <span class="k">if</span> <span class="n">overwrite</span> <span class="k">else</span> <span class="s2">"INTO "</span> +</span><span id="Generator.insert_sql-910"><a href="#Generator.insert_sql-910"><span class="linenos">910</span></a> +</span><span id="Generator.insert_sql-911"><a href="#Generator.insert_sql-911"><span class="linenos">911</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.insert_sql-912"><a href="#Generator.insert_sql-912"><span class="linenos">912</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator.insert_sql-913"><a href="#Generator.insert_sql-913"><span class="linenos">913</span></a> <span class="n">partition_sql</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.insert_sql-914"><a href="#Generator.insert_sql-914"><span class="linenos">914</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"partition"</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"partition"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.insert_sql-915"><a href="#Generator.insert_sql-915"><span class="linenos">915</span></a> <span class="p">)</span> +</span><span id="Generator.insert_sql-916"><a href="#Generator.insert_sql-916"><span class="linenos">916</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator.insert_sql-917"><a href="#Generator.insert_sql-917"><span class="linenos">917</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span> <span class="k">if</span> <span class="n">partition_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.insert_sql-918"><a href="#Generator.insert_sql-918"><span class="linenos">918</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INSERT </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">exists</span><span class="si">}{</span><span class="n">partition_sql</span><span class="si">}{</span><span class="n">sep</span><span class="si">}{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.insert_sql-919"><a href="#Generator.insert_sql-919"><span class="linenos">919</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.intersect_sql" class="classattr"> + <input id="Generator.intersect_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intersect_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Intersect">sqlglot.expressions.Intersect</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.intersect_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.intersect_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.intersect_sql-921"><a href="#Generator.intersect_sql-921"><span class="linenos">921</span></a> <span class="k">def</span> <span class="nf">intersect_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.intersect_sql-922"><a href="#Generator.intersect_sql-922"><span class="linenos">922</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="Generator.intersect_sql-923"><a href="#Generator.intersect_sql-923"><span class="linenos">923</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator.intersect_sql-924"><a href="#Generator.intersect_sql-924"><span class="linenos">924</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">intersect_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="Generator.intersect_sql-925"><a href="#Generator.intersect_sql-925"><span class="linenos">925</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.intersect_op" class="classattr"> + <input id="Generator.intersect_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intersect_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Intersect">sqlglot.expressions.Intersect</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.intersect_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.intersect_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.intersect_op-927"><a href="#Generator.intersect_op-927"><span class="linenos">927</span></a> <span class="k">def</span> <span class="nf">intersect_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.intersect_op-928"><a href="#Generator.intersect_op-928"><span class="linenos">928</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERSECT</span><span class="si">{</span><span class="s1">''</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'distinct'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">' ALL'</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.introducer_sql" class="classattr"> + <input id="Generator.introducer_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">introducer_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Introducer">sqlglot.expressions.Introducer</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.introducer_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.introducer_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.introducer_sql-930"><a href="#Generator.introducer_sql-930"><span class="linenos">930</span></a> <span class="k">def</span> <span class="nf">introducer_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Introducer</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.introducer_sql-931"><a href="#Generator.introducer_sql-931"><span class="linenos">931</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.pseudotype_sql" class="classattr"> + <input id="Generator.pseudotype_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pseudotype_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#PseudoType">sqlglot.expressions.PseudoType</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.pseudotype_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.pseudotype_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.pseudotype_sql-933"><a href="#Generator.pseudotype_sql-933"><span class="linenos">933</span></a> <span class="k">def</span> <span class="nf">pseudotype_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">PseudoType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.pseudotype_sql-934"><a href="#Generator.pseudotype_sql-934"><span class="linenos">934</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="Generator.rowformatdelimitedproperty_sql" class="classattr"> + <input id="Generator.rowformatdelimitedproperty_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rowformatdelimitedproperty_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#RowFormatDelimitedProperty">sqlglot.expressions.RowFormatDelimitedProperty</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.rowformatdelimitedproperty_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.rowformatdelimitedproperty_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.rowformatdelimitedproperty_sql-936"><a href="#Generator.rowformatdelimitedproperty_sql-936"><span class="linenos">936</span></a> <span class="k">def</span> <span class="nf">rowformatdelimitedproperty_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-937"><a href="#Generator.rowformatdelimitedproperty_sql-937"><span class="linenos">937</span></a> <span class="n">fields</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"fields"</span><span class="p">)</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-938"><a href="#Generator.rowformatdelimitedproperty_sql-938"><span class="linenos">938</span></a> <span class="n">fields</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" FIELDS TERMINATED BY </span><span class="si">{</span><span class="n">fields</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">fields</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-939"><a href="#Generator.rowformatdelimitedproperty_sql-939"><span class="linenos">939</span></a> <span class="n">escaped</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"escaped"</span><span class="p">)</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-940"><a href="#Generator.rowformatdelimitedproperty_sql-940"><span class="linenos">940</span></a> <span class="n">escaped</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ESCAPED BY </span><span class="si">{</span><span class="n">escaped</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">escaped</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-941"><a href="#Generator.rowformatdelimitedproperty_sql-941"><span class="linenos">941</span></a> <span class="n">items</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"collection_items"</span><span class="p">)</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-942"><a href="#Generator.rowformatdelimitedproperty_sql-942"><span class="linenos">942</span></a> <span class="n">items</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLECTION ITEMS TERMINATED BY </span><span class="si">{</span><span class="n">items</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">items</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-943"><a href="#Generator.rowformatdelimitedproperty_sql-943"><span class="linenos">943</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"map_keys"</span><span class="p">)</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-944"><a href="#Generator.rowformatdelimitedproperty_sql-944"><span class="linenos">944</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" MAP KEYS TERMINATED BY </span><span class="si">{</span><span class="n">keys</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">keys</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-945"><a href="#Generator.rowformatdelimitedproperty_sql-945"><span class="linenos">945</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"lines"</span><span class="p">)</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-946"><a href="#Generator.rowformatdelimitedproperty_sql-946"><span class="linenos">946</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" LINES TERMINATED BY </span><span class="si">{</span><span class="n">lines</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">lines</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-947"><a href="#Generator.rowformatdelimitedproperty_sql-947"><span class="linenos">947</span></a> <span class="n">null</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"null"</span><span class="p">)</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-948"><a href="#Generator.rowformatdelimitedproperty_sql-948"><span class="linenos">948</span></a> <span class="n">null</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" NULL DEFINED AS </span><span class="si">{</span><span class="n">null</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">null</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rowformatdelimitedproperty_sql-949"><a href="#Generator.rowformatdelimitedproperty_sql-949"><span class="linenos">949</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ROW FORMAT DELIMITED</span><span class="si">{</span><span class="n">fields</span><span class="si">}{</span><span class="n">escaped</span><span class="si">}{</span><span class="n">items</span><span class="si">}{</span><span class="n">keys</span><span class="si">}{</span><span class="n">lines</span><span class="si">}{</span><span class="n">null</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.table_sql" class="classattr"> + <input id="Generator.table_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span>, </span><span class="param"><span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">' AS '</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.table_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.table_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.table_sql-951"><a href="#Generator.table_sql-951"><span class="linenos">951</span></a> <span class="k">def</span> <span class="nf">table_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">" AS "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.table_sql-952"><a href="#Generator.table_sql-952"><span class="linenos">952</span></a> <span class="n">table</span> <span class="o">=</span> <span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.table_sql-953"><a href="#Generator.table_sql-953"><span class="linenos">953</span></a> <span class="n">part</span> +</span><span id="Generator.table_sql-954"><a href="#Generator.table_sql-954"><span class="linenos">954</span></a> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="p">[</span> +</span><span id="Generator.table_sql-955"><a href="#Generator.table_sql-955"><span class="linenos">955</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">),</span> +</span><span id="Generator.table_sql-956"><a href="#Generator.table_sql-956"><span class="linenos">956</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">),</span> +</span><span id="Generator.table_sql-957"><a href="#Generator.table_sql-957"><span class="linenos">957</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="Generator.table_sql-958"><a href="#Generator.table_sql-958"><span class="linenos">958</span></a> <span class="p">]</span> +</span><span id="Generator.table_sql-959"><a href="#Generator.table_sql-959"><span class="linenos">959</span></a> <span class="k">if</span> <span class="n">part</span> +</span><span id="Generator.table_sql-960"><a href="#Generator.table_sql-960"><span class="linenos">960</span></a> <span class="p">)</span> +</span><span id="Generator.table_sql-961"><a href="#Generator.table_sql-961"><span class="linenos">961</span></a> +</span><span id="Generator.table_sql-962"><a href="#Generator.table_sql-962"><span class="linenos">962</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.table_sql-963"><a href="#Generator.table_sql-963"><span class="linenos">963</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.table_sql-964"><a href="#Generator.table_sql-964"><span class="linenos">964</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"hints"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">", "</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.table_sql-965"><a href="#Generator.table_sql-965"><span class="linenos">965</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITH (</span><span class="si">{</span><span class="n">hints</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">hints</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.table_sql-966"><a href="#Generator.table_sql-966"><span class="linenos">966</span></a> <span class="n">laterals</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"laterals"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator.table_sql-967"><a href="#Generator.table_sql-967"><span class="linenos">967</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"joins"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator.table_sql-968"><a href="#Generator.table_sql-968"><span class="linenos">968</span></a> <span class="n">pivots</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"pivots"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator.table_sql-969"><a href="#Generator.table_sql-969"><span class="linenos">969</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"system_time"</span><span class="p">)</span> +</span><span id="Generator.table_sql-970"><a href="#Generator.table_sql-970"><span class="linenos">970</span></a> <span class="n">system_time</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'system_time'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">system_time</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.table_sql-971"><a href="#Generator.table_sql-971"><span class="linenos">971</span></a> +</span><span id="Generator.table_sql-972"><a href="#Generator.table_sql-972"><span class="linenos">972</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="n">pivots</span><span class="p">:</span> +</span><span id="Generator.table_sql-973"><a href="#Generator.table_sql-973"><span class="linenos">973</span></a> <span class="n">pivots</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">pivots</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.table_sql-974"><a href="#Generator.table_sql-974"><span class="linenos">974</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.table_sql-975"><a href="#Generator.table_sql-975"><span class="linenos">975</span></a> +</span><span id="Generator.table_sql-976"><a href="#Generator.table_sql-976"><span class="linenos">976</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">table</span><span class="si">}{</span><span class="n">system_time</span><span class="si">}{</span><span class="n">alias</span><span class="si">}{</span><span class="n">hints</span><span class="si">}{</span><span class="n">laterals</span><span class="si">}{</span><span class="n">joins</span><span class="si">}{</span><span class="n">pivots</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.tablesample_sql" class="classattr"> + <input id="Generator.tablesample_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">tablesample_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#TableSample">sqlglot.expressions.TableSample</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.tablesample_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.tablesample_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.tablesample_sql-978"><a href="#Generator.tablesample_sql-978"><span class="linenos">978</span></a> <span class="k">def</span> <span class="nf">tablesample_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.tablesample_sql-979"><a href="#Generator.tablesample_sql-979"><span class="linenos">979</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="Generator.tablesample_sql-980"><a href="#Generator.tablesample_sql-980"><span class="linenos">980</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-981"><a href="#Generator.tablesample_sql-981"><span class="linenos">981</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="s1">'alias'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.tablesample_sql-982"><a href="#Generator.tablesample_sql-982"><span class="linenos">982</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.tablesample_sql-983"><a href="#Generator.tablesample_sql-983"><span class="linenos">983</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-984"><a href="#Generator.tablesample_sql-984"><span class="linenos">984</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-985"><a href="#Generator.tablesample_sql-985"><span class="linenos">985</span></a> <span class="n">method</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"method"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-986"><a href="#Generator.tablesample_sql-986"><span class="linenos">986</span></a> <span class="n">method</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">method</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">method</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-987"><a href="#Generator.tablesample_sql-987"><span class="linenos">987</span></a> <span class="n">numerator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_numerator"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-988"><a href="#Generator.tablesample_sql-988"><span class="linenos">988</span></a> <span class="n">denominator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_denominator"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-989"><a href="#Generator.tablesample_sql-989"><span class="linenos">989</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"bucket_field"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-990"><a href="#Generator.tablesample_sql-990"><span class="linenos">990</span></a> <span class="n">field</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON </span><span class="si">{</span><span class="n">field</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">field</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-991"><a href="#Generator.tablesample_sql-991"><span class="linenos">991</span></a> <span class="n">bucket</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"BUCKET </span><span class="si">{</span><span class="n">numerator</span><span class="si">}</span><span class="s2"> OUT OF </span><span class="si">{</span><span class="n">denominator</span><span class="si">}{</span><span class="n">field</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">numerator</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-992"><a href="#Generator.tablesample_sql-992"><span class="linenos">992</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"percent"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-993"><a href="#Generator.tablesample_sql-993"><span class="linenos">993</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">percent</span><span class="si">}</span><span class="s2"> PERCENT"</span> <span class="k">if</span> <span class="n">percent</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-994"><a href="#Generator.tablesample_sql-994"><span class="linenos">994</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"rows"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-995"><a href="#Generator.tablesample_sql-995"><span class="linenos">995</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">rows</span><span class="si">}</span><span class="s2"> ROWS"</span> <span class="k">if</span> <span class="n">rows</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-996"><a href="#Generator.tablesample_sql-996"><span class="linenos">996</span></a> <span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"size"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-997"><a href="#Generator.tablesample_sql-997"><span class="linenos">997</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"seed"</span><span class="p">)</span> +</span><span id="Generator.tablesample_sql-998"><a href="#Generator.tablesample_sql-998"><span class="linenos">998</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" SEED (</span><span class="si">{</span><span class="n">seed</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">seed</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.tablesample_sql-999"><a href="#Generator.tablesample_sql-999"><span class="linenos">999</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TABLESAMPLE</span><span class="si">{</span><span class="n">method</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">bucket</span><span class="si">}{</span><span class="n">percent</span><span class="si">}{</span><span class="n">rows</span><span class="si">}{</span><span class="n">size</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">seed</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.pivot_sql" class="classattr"> + <input id="Generator.pivot_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pivot_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Pivot">sqlglot.expressions.Pivot</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.pivot_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.pivot_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.pivot_sql-1001"><a href="#Generator.pivot_sql-1001"><span class="linenos">1001</span></a> <span class="k">def</span> <span class="nf">pivot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.pivot_sql-1002"><a href="#Generator.pivot_sql-1002"><span class="linenos">1002</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.pivot_sql-1003"><a href="#Generator.pivot_sql-1003"><span class="linenos">1003</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unpivot"</span><span class="p">)</span> +</span><span id="Generator.pivot_sql-1004"><a href="#Generator.pivot_sql-1004"><span class="linenos">1004</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="s2">"UNPIVOT"</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="s2">"PIVOT"</span> +</span><span id="Generator.pivot_sql-1005"><a href="#Generator.pivot_sql-1005"><span class="linenos">1005</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Generator.pivot_sql-1006"><a href="#Generator.pivot_sql-1006"><span class="linenos">1006</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"field"</span><span class="p">)</span> +</span><span id="Generator.pivot_sql-1007"><a href="#Generator.pivot_sql-1007"><span class="linenos">1007</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">direction</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2"> FOR </span><span class="si">{</span><span class="n">field</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.tuple_sql" class="classattr"> + <input id="Generator.tuple_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">tuple_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Tuple">sqlglot.expressions.Tuple</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.tuple_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.tuple_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.tuple_sql-1009"><a href="#Generator.tuple_sql-1009"><span class="linenos">1009</span></a> <span class="k">def</span> <span class="nf">tuple_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.tuple_sql-1010"><a href="#Generator.tuple_sql-1010"><span class="linenos">1010</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.update_sql" class="classattr"> + <input id="Generator.update_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">update_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Update">sqlglot.expressions.Update</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.update_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.update_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.update_sql-1012"><a href="#Generator.update_sql-1012"><span class="linenos">1012</span></a> <span class="k">def</span> <span class="nf">update_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.update_sql-1013"><a href="#Generator.update_sql-1013"><span class="linenos">1013</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.update_sql-1014"><a href="#Generator.update_sql-1014"><span class="linenos">1014</span></a> <span class="n">set_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.update_sql-1015"><a href="#Generator.update_sql-1015"><span class="linenos">1015</span></a> <span class="n">from_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">)</span> +</span><span id="Generator.update_sql-1016"><a href="#Generator.update_sql-1016"><span class="linenos">1016</span></a> <span class="n">where_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">)</span> +</span><span id="Generator.update_sql-1017"><a href="#Generator.update_sql-1017"><span class="linenos">1017</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.update_sql-1018"><a href="#Generator.update_sql-1018"><span class="linenos">1018</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.values_sql" class="classattr"> + <input id="Generator.values_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">values_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Values">sqlglot.expressions.Values</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.values_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.values_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.values_sql-1020"><a href="#Generator.values_sql-1020"><span class="linenos">1020</span></a> <span class="k">def</span> <span class="nf">values_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.values_sql-1021"><a href="#Generator.values_sql-1021"><span class="linenos">1021</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.values_sql-1022"><a href="#Generator.values_sql-1022"><span class="linenos">1022</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.values_sql-1023"><a href="#Generator.values_sql-1023"><span class="linenos">1023</span></a> <span class="n">values</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"VALUES</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="n">args</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.values_sql-1024"><a href="#Generator.values_sql-1024"><span class="linenos">1024</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.values_sql-1025"><a href="#Generator.values_sql-1025"><span class="linenos">1025</span></a> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.values_sql-1026"><a href="#Generator.values_sql-1026"><span class="linenos">1026</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">WRAP_DERIVED_VALUES</span> <span class="ow">and</span> <span class="p">(</span><span class="n">alias</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">))</span> +</span><span id="Generator.values_sql-1027"><a href="#Generator.values_sql-1027"><span class="linenos">1027</span></a> <span class="k">else</span> <span class="n">values</span> +</span><span id="Generator.values_sql-1028"><a href="#Generator.values_sql-1028"><span class="linenos">1028</span></a> <span class="p">)</span> +</span><span id="Generator.values_sql-1029"><a href="#Generator.values_sql-1029"><span class="linenos">1029</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">values</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">values</span> +</span></pre></div> + + + + + </div> + <div id="Generator.var_sql" class="classattr"> + <input id="Generator.var_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">var_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Var">sqlglot.expressions.Var</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.var_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.var_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.var_sql-1031"><a href="#Generator.var_sql-1031"><span class="linenos">1031</span></a> <span class="k">def</span> <span class="nf">var_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.var_sql-1032"><a href="#Generator.var_sql-1032"><span class="linenos">1032</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.into_sql" class="classattr"> + <input id="Generator.into_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">into_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Into">sqlglot.expressions.Into</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.into_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.into_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.into_sql-1034"><a href="#Generator.into_sql-1034"><span class="linenos">1034</span></a> <span class="k">def</span> <span class="nf">into_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Into</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.into_sql-1035"><a href="#Generator.into_sql-1035"><span class="linenos">1035</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="s2">" TEMPORARY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"temporary"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.into_sql-1036"><a href="#Generator.into_sql-1036"><span class="linenos">1036</span></a> <span class="n">unlogged</span> <span class="o">=</span> <span class="s2">" UNLOGGED"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unlogged"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.into_sql-1037"><a href="#Generator.into_sql-1037"><span class="linenos">1037</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'INTO'</span><span class="p">)</span><span class="si">}{</span><span class="n">temporary</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="n">unlogged</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.from_sql" class="classattr"> + <input id="Generator.from_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">from_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#From">sqlglot.expressions.From</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.from_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.from_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.from_sql-1039"><a href="#Generator.from_sql-1039"><span class="linenos">1039</span></a> <span class="k">def</span> <span class="nf">from_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.from_sql-1040"><a href="#Generator.from_sql-1040"><span class="linenos">1040</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.from_sql-1041"><a href="#Generator.from_sql-1041"><span class="linenos">1041</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'FROM'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.group_sql" class="classattr"> + <input id="Generator.group_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">group_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Group">sqlglot.expressions.Group</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.group_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.group_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.group_sql-1043"><a href="#Generator.group_sql-1043"><span class="linenos">1043</span></a> <span class="k">def</span> <span class="nf">group_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.group_sql-1044"><a href="#Generator.group_sql-1044"><span class="linenos">1044</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"GROUP BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.group_sql-1045"><a href="#Generator.group_sql-1045"><span class="linenos">1045</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"grouping_sets"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator.group_sql-1046"><a href="#Generator.group_sql-1046"><span class="linenos">1046</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.group_sql-1047"><a href="#Generator.group_sql-1047"><span class="linenos">1047</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'GROUPING SETS'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">grouping_sets</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">grouping_sets</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.group_sql-1048"><a href="#Generator.group_sql-1048"><span class="linenos">1048</span></a> <span class="p">)</span> +</span><span id="Generator.group_sql-1049"><a href="#Generator.group_sql-1049"><span class="linenos">1049</span></a> +</span><span id="Generator.group_sql-1050"><a href="#Generator.group_sql-1050"><span class="linenos">1050</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"cube"</span><span class="p">)</span> +</span><span id="Generator.group_sql-1051"><a href="#Generator.group_sql-1051"><span class="linenos">1051</span></a> <span class="k">if</span> <span class="n">cube</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Generator.group_sql-1052"><a href="#Generator.group_sql-1052"><span class="linenos">1052</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH CUBE"</span><span class="p">)</span> +</span><span id="Generator.group_sql-1053"><a href="#Generator.group_sql-1053"><span class="linenos">1053</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.group_sql-1054"><a href="#Generator.group_sql-1054"><span class="linenos">1054</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"cube"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator.group_sql-1055"><a href="#Generator.group_sql-1055"><span class="linenos">1055</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'CUBE'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">cube</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">cube</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.group_sql-1056"><a href="#Generator.group_sql-1056"><span class="linenos">1056</span></a> +</span><span id="Generator.group_sql-1057"><a href="#Generator.group_sql-1057"><span class="linenos">1057</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"rollup"</span><span class="p">)</span> +</span><span id="Generator.group_sql-1058"><a href="#Generator.group_sql-1058"><span class="linenos">1058</span></a> <span class="k">if</span> <span class="n">rollup</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Generator.group_sql-1059"><a href="#Generator.group_sql-1059"><span class="linenos">1059</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WITH ROLLUP"</span><span class="p">)</span> +</span><span id="Generator.group_sql-1060"><a href="#Generator.group_sql-1060"><span class="linenos">1060</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.group_sql-1061"><a href="#Generator.group_sql-1061"><span class="linenos">1061</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"rollup"</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator.group_sql-1062"><a href="#Generator.group_sql-1062"><span class="linenos">1062</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'ROLLUP'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">rollup</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">rollup</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.group_sql-1063"><a href="#Generator.group_sql-1063"><span class="linenos">1063</span></a> +</span><span id="Generator.group_sql-1064"><a href="#Generator.group_sql-1064"><span class="linenos">1064</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">group_by</span><span class="si">}{</span><span class="n">csv</span><span class="p">(</span><span class="n">grouping_sets</span><span class="p">,</span><span class="w"> </span><span class="n">cube</span><span class="p">,</span><span class="w"> </span><span class="n">rollup</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">','</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.having_sql" class="classattr"> + <input id="Generator.having_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">having_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Having">sqlglot.expressions.Having</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.having_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.having_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.having_sql-1066"><a href="#Generator.having_sql-1066"><span class="linenos">1066</span></a> <span class="k">def</span> <span class="nf">having_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.having_sql-1067"><a href="#Generator.having_sql-1067"><span class="linenos">1067</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="Generator.having_sql-1068"><a href="#Generator.having_sql-1068"><span class="linenos">1068</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'HAVING'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.join_sql" class="classattr"> + <input id="Generator.join_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">join_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Join">sqlglot.expressions.Join</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.join_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.join_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.join_sql-1070"><a href="#Generator.join_sql-1070"><span class="linenos">1070</span></a> <span class="k">def</span> <span class="nf">join_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.join_sql-1071"><a href="#Generator.join_sql-1071"><span class="linenos">1071</span></a> <span class="n">op_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span> +</span><span id="Generator.join_sql-1072"><a href="#Generator.join_sql-1072"><span class="linenos">1072</span></a> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.join_sql-1073"><a href="#Generator.join_sql-1073"><span class="linenos">1073</span></a> <span class="n">op</span> +</span><span id="Generator.join_sql-1074"><a href="#Generator.join_sql-1074"><span class="linenos">1074</span></a> <span class="k">for</span> <span class="n">op</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="Generator.join_sql-1075"><a href="#Generator.join_sql-1075"><span class="linenos">1075</span></a> <span class="s2">"NATURAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"natural"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.join_sql-1076"><a href="#Generator.join_sql-1076"><span class="linenos">1076</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">side</span><span class="p">,</span> +</span><span id="Generator.join_sql-1077"><a href="#Generator.join_sql-1077"><span class="linenos">1077</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">kind</span><span class="p">,</span> +</span><span id="Generator.join_sql-1078"><a href="#Generator.join_sql-1078"><span class="linenos">1078</span></a> <span class="s2">"JOIN"</span><span class="p">,</span> +</span><span id="Generator.join_sql-1079"><a href="#Generator.join_sql-1079"><span class="linenos">1079</span></a> <span class="p">)</span> +</span><span id="Generator.join_sql-1080"><a href="#Generator.join_sql-1080"><span class="linenos">1080</span></a> <span class="k">if</span> <span class="n">op</span> +</span><span id="Generator.join_sql-1081"><a href="#Generator.join_sql-1081"><span class="linenos">1081</span></a> <span class="p">)</span> +</span><span id="Generator.join_sql-1082"><a href="#Generator.join_sql-1082"><span class="linenos">1082</span></a> <span class="p">)</span> +</span><span id="Generator.join_sql-1083"><a href="#Generator.join_sql-1083"><span class="linenos">1083</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">)</span> +</span><span id="Generator.join_sql-1084"><a href="#Generator.join_sql-1084"><span class="linenos">1084</span></a> <span class="n">using</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="Generator.join_sql-1085"><a href="#Generator.join_sql-1085"><span class="linenos">1085</span></a> +</span><span id="Generator.join_sql-1086"><a href="#Generator.join_sql-1086"><span class="linenos">1086</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">on_sql</span> <span class="ow">and</span> <span class="n">using</span><span class="p">:</span> +</span><span id="Generator.join_sql-1087"><a href="#Generator.join_sql-1087"><span class="linenos">1087</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="n">csv</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">using</span><span class="p">))</span> +</span><span id="Generator.join_sql-1088"><a href="#Generator.join_sql-1088"><span class="linenos">1088</span></a> +</span><span id="Generator.join_sql-1089"><a href="#Generator.join_sql-1089"><span class="linenos">1089</span></a> <span class="k">if</span> <span class="n">on_sql</span><span class="p">:</span> +</span><span id="Generator.join_sql-1090"><a href="#Generator.join_sql-1090"><span class="linenos">1090</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="n">on_sql</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.join_sql-1091"><a href="#Generator.join_sql-1091"><span class="linenos">1091</span></a> <span class="n">space</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">" "</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator.join_sql-1092"><a href="#Generator.join_sql-1092"><span class="linenos">1092</span></a> <span class="k">if</span> <span class="n">using</span><span class="p">:</span> +</span><span id="Generator.join_sql-1093"><a href="#Generator.join_sql-1093"><span class="linenos">1093</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">space</span><span class="si">}</span><span class="s2">USING (</span><span class="si">{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.join_sql-1094"><a href="#Generator.join_sql-1094"><span class="linenos">1094</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.join_sql-1095"><a href="#Generator.join_sql-1095"><span class="linenos">1095</span></a> <span class="n">on_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">space</span><span class="si">}</span><span class="s2">ON </span><span class="si">{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.join_sql-1096"><a href="#Generator.join_sql-1096"><span class="linenos">1096</span></a> +</span><span id="Generator.join_sql-1097"><a href="#Generator.join_sql-1097"><span class="linenos">1097</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator.join_sql-1098"><a href="#Generator.join_sql-1098"><span class="linenos">1098</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.join_sql-1099"><a href="#Generator.join_sql-1099"><span class="linenos">1099</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}{</span><span class="n">op_sql</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">this_sql</span><span class="si">}{</span><span class="n">on_sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.lambda_sql" class="classattr"> + <input id="Generator.lambda_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lambda_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Lambda">sqlglot.expressions.Lambda</a></span>,</span><span class="param"> <span class="n">arrow_sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">'->'</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.lambda_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.lambda_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.lambda_sql-1101"><a href="#Generator.lambda_sql-1101"><span class="linenos">1101</span></a> <span class="k">def</span> <span class="nf">lambda_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">,</span> <span class="n">arrow_sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">"->"</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.lambda_sql-1102"><a href="#Generator.lambda_sql-1102"><span class="linenos">1102</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.lambda_sql-1103"><a href="#Generator.lambda_sql-1103"><span class="linenos">1103</span></a> <span class="n">args</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">))</span> <span class="o">></span> <span class="mi">1</span> <span class="k">else</span> <span class="n">args</span> +</span><span id="Generator.lambda_sql-1104"><a href="#Generator.lambda_sql-1104"><span class="linenos">1104</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">arrow_sep</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.lateral_sql" class="classattr"> + <input id="Generator.lateral_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lateral_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Lateral">sqlglot.expressions.Lateral</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.lateral_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.lateral_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.lateral_sql-1106"><a href="#Generator.lateral_sql-1106"><span class="linenos">1106</span></a> <span class="k">def</span> <span class="nf">lateral_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.lateral_sql-1107"><a href="#Generator.lateral_sql-1107"><span class="linenos">1107</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.lateral_sql-1108"><a href="#Generator.lateral_sql-1108"><span class="linenos">1108</span></a> +</span><span id="Generator.lateral_sql-1109"><a href="#Generator.lateral_sql-1109"><span class="linenos">1109</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="Generator.lateral_sql-1110"><a href="#Generator.lateral_sql-1110"><span class="linenos">1110</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LATERAL </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.lateral_sql-1111"><a href="#Generator.lateral_sql-1111"><span class="linenos">1111</span></a> +</span><span id="Generator.lateral_sql-1112"><a href="#Generator.lateral_sql-1112"><span class="linenos">1112</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"view"</span><span class="p">):</span> +</span><span id="Generator.lateral_sql-1113"><a href="#Generator.lateral_sql-1113"><span class="linenos">1113</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"alias"</span><span class="p">]</span> +</span><span id="Generator.lateral_sql-1114"><a href="#Generator.lateral_sql-1114"><span class="linenos">1114</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.lateral_sql-1115"><a href="#Generator.lateral_sql-1115"><span class="linenos">1115</span></a> <span class="n">table</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">alias</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.lateral_sql-1116"><a href="#Generator.lateral_sql-1116"><span class="linenos">1116</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.lateral_sql-1117"><a href="#Generator.lateral_sql-1117"><span class="linenos">1117</span></a> <span class="n">op_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"LATERAL VIEW</span><span class="si">{</span><span class="s1">' OUTER'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'outer'</span><span class="p">)</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.lateral_sql-1118"><a href="#Generator.lateral_sql-1118"><span class="linenos">1118</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">op_sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">table</span><span class="si">}{</span><span class="n">columns</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.lateral_sql-1119"><a href="#Generator.lateral_sql-1119"><span class="linenos">1119</span></a> +</span><span id="Generator.lateral_sql-1120"><a href="#Generator.lateral_sql-1120"><span class="linenos">1120</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.lateral_sql-1121"><a href="#Generator.lateral_sql-1121"><span class="linenos">1121</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.lateral_sql-1122"><a href="#Generator.lateral_sql-1122"><span class="linenos">1122</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LATERAL </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.limit_sql" class="classattr"> + <input id="Generator.limit_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">limit_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Limit">sqlglot.expressions.Limit</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.limit_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.limit_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.limit_sql-1124"><a href="#Generator.limit_sql-1124"><span class="linenos">1124</span></a> <span class="k">def</span> <span class="nf">limit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.limit_sql-1125"><a href="#Generator.limit_sql-1125"><span class="linenos">1125</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.limit_sql-1126"><a href="#Generator.limit_sql-1126"><span class="linenos">1126</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'LIMIT'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.offset_sql" class="classattr"> + <input id="Generator.offset_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">offset_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Offset">sqlglot.expressions.Offset</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.offset_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.offset_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.offset_sql-1128"><a href="#Generator.offset_sql-1128"><span class="linenos">1128</span></a> <span class="k">def</span> <span class="nf">offset_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.offset_sql-1129"><a href="#Generator.offset_sql-1129"><span class="linenos">1129</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.offset_sql-1130"><a href="#Generator.offset_sql-1130"><span class="linenos">1130</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'OFFSET'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.lock_sql" class="classattr"> + <input id="Generator.lock_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lock_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Lock">sqlglot.expressions.Lock</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.lock_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.lock_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.lock_sql-1132"><a href="#Generator.lock_sql-1132"><span class="linenos">1132</span></a> <span class="k">def</span> <span class="nf">lock_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.lock_sql-1133"><a href="#Generator.lock_sql-1133"><span class="linenos">1133</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">LOCKING_READS_SUPPORTED</span><span class="p">:</span> +</span><span id="Generator.lock_sql-1134"><a href="#Generator.lock_sql-1134"><span class="linenos">1134</span></a> <span class="n">lock_type</span> <span class="o">=</span> <span class="s2">"UPDATE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"update"</span><span class="p">]</span> <span class="k">else</span> <span class="s2">"SHARE"</span> +</span><span id="Generator.lock_sql-1135"><a href="#Generator.lock_sql-1135"><span class="linenos">1135</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"FOR </span><span class="si">{</span><span class="n">lock_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.lock_sql-1136"><a href="#Generator.lock_sql-1136"><span class="linenos">1136</span></a> +</span><span id="Generator.lock_sql-1137"><a href="#Generator.lock_sql-1137"><span class="linenos">1137</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Locking reads using 'FOR UPDATE/SHARE' are not supported"</span><span class="p">)</span> +</span><span id="Generator.lock_sql-1138"><a href="#Generator.lock_sql-1138"><span class="linenos">1138</span></a> <span class="k">return</span> <span class="s2">""</span> +</span></pre></div> + + + + + </div> + <div id="Generator.literal_sql" class="classattr"> + <input id="Generator.literal_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">literal_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Literal">sqlglot.expressions.Literal</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.literal_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.literal_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.literal_sql-1140"><a href="#Generator.literal_sql-1140"><span class="linenos">1140</span></a> <span class="k">def</span> <span class="nf">literal_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.literal_sql-1141"><a href="#Generator.literal_sql-1141"><span class="linenos">1141</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="ow">or</span> <span class="s2">""</span> +</span><span id="Generator.literal_sql-1142"><a href="#Generator.literal_sql-1142"><span class="linenos">1142</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="Generator.literal_sql-1143"><a href="#Generator.literal_sql-1143"><span class="linenos">1143</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span><span class="p">:</span> +</span><span id="Generator.literal_sql-1144"><a href="#Generator.literal_sql-1144"><span class="linenos">1144</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">BACKSLASH_RE</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s2">"</span><span class="se">\\\\</span><span class="s2">"</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="Generator.literal_sql-1145"><a href="#Generator.literal_sql-1145"><span class="linenos">1145</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_escaped_quote_end</span><span class="p">)</span> +</span><span id="Generator.literal_sql-1146"><a href="#Generator.literal_sql-1146"><span class="linenos">1146</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator.literal_sql-1147"><a href="#Generator.literal_sql-1147"><span class="linenos">1147</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">SENTINEL_LINE_BREAK</span><span class="p">)</span> +</span><span id="Generator.literal_sql-1148"><a href="#Generator.literal_sql-1148"><span class="linenos">1148</span></a> <span class="n">text</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_start</span><span class="si">}{</span><span class="n">text</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">quote_end</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.literal_sql-1149"><a href="#Generator.literal_sql-1149"><span class="linenos">1149</span></a> <span class="k">return</span> <span class="n">text</span> +</span></pre></div> + + + + + </div> + <div id="Generator.loaddata_sql" class="classattr"> + <input id="Generator.loaddata_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">loaddata_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#LoadData">sqlglot.expressions.LoadData</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.loaddata_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.loaddata_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.loaddata_sql-1151"><a href="#Generator.loaddata_sql-1151"><span class="linenos">1151</span></a> <span class="k">def</span> <span class="nf">loaddata_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LoadData</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.loaddata_sql-1152"><a href="#Generator.loaddata_sql-1152"><span class="linenos">1152</span></a> <span class="n">local</span> <span class="o">=</span> <span class="s2">" LOCAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"local"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.loaddata_sql-1153"><a href="#Generator.loaddata_sql-1153"><span class="linenos">1153</span></a> <span class="n">inpath</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INPATH </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'inpath'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.loaddata_sql-1154"><a href="#Generator.loaddata_sql-1154"><span class="linenos">1154</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="s2">" OVERWRITE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"overwrite"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.loaddata_sql-1155"><a href="#Generator.loaddata_sql-1155"><span class="linenos">1155</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INTO TABLE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.loaddata_sql-1156"><a href="#Generator.loaddata_sql-1156"><span class="linenos">1156</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"partition"</span><span class="p">)</span> +</span><span id="Generator.loaddata_sql-1157"><a href="#Generator.loaddata_sql-1157"><span class="linenos">1157</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">partition</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">partition</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.loaddata_sql-1158"><a href="#Generator.loaddata_sql-1158"><span class="linenos">1158</span></a> <span class="n">input_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"input_format"</span><span class="p">)</span> +</span><span id="Generator.loaddata_sql-1159"><a href="#Generator.loaddata_sql-1159"><span class="linenos">1159</span></a> <span class="n">input_format</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" INPUTFORMAT </span><span class="si">{</span><span class="n">input_format</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">input_format</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.loaddata_sql-1160"><a href="#Generator.loaddata_sql-1160"><span class="linenos">1160</span></a> <span class="n">serde</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"serde"</span><span class="p">)</span> +</span><span id="Generator.loaddata_sql-1161"><a href="#Generator.loaddata_sql-1161"><span class="linenos">1161</span></a> <span class="n">serde</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" SERDE </span><span class="si">{</span><span class="n">serde</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">serde</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.loaddata_sql-1162"><a href="#Generator.loaddata_sql-1162"><span class="linenos">1162</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"LOAD DATA</span><span class="si">{</span><span class="n">local</span><span class="si">}{</span><span class="n">inpath</span><span class="si">}{</span><span class="n">overwrite</span><span class="si">}{</span><span class="n">this</span><span class="si">}{</span><span class="n">partition</span><span class="si">}{</span><span class="n">input_format</span><span class="si">}{</span><span class="n">serde</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.null_sql" class="classattr"> + <input id="Generator.null_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">null_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.null_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.null_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.null_sql-1164"><a href="#Generator.null_sql-1164"><span class="linenos">1164</span></a> <span class="k">def</span> <span class="nf">null_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.null_sql-1165"><a href="#Generator.null_sql-1165"><span class="linenos">1165</span></a> <span class="k">return</span> <span class="s2">"NULL"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.boolean_sql" class="classattr"> + <input id="Generator.boolean_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">boolean_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Boolean">sqlglot.expressions.Boolean</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.boolean_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.boolean_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.boolean_sql-1167"><a href="#Generator.boolean_sql-1167"><span class="linenos">1167</span></a> <span class="k">def</span> <span class="nf">boolean_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.boolean_sql-1168"><a href="#Generator.boolean_sql-1168"><span class="linenos">1168</span></a> <span class="k">return</span> <span class="s2">"TRUE"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="k">else</span> <span class="s2">"FALSE"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.order_sql" class="classattr"> + <input id="Generator.order_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">order_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Order">sqlglot.expressions.Order</a></span>, </span><span class="param"><span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.order_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.order_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.order_sql-1170"><a href="#Generator.order_sql-1170"><span class="linenos">1170</span></a> <span class="k">def</span> <span class="nf">order_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.order_sql-1171"><a href="#Generator.order_sql-1171"><span class="linenos">1171</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.order_sql-1172"><a href="#Generator.order_sql-1172"><span class="linenos">1172</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="n">this</span> +</span><span id="Generator.order_sql-1173"><a href="#Generator.order_sql-1173"><span class="linenos">1173</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">ORDER BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="n">this</span> <span class="ow">or</span> <span class="n">flat</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span></pre></div> + + + + + </div> + <div id="Generator.cluster_sql" class="classattr"> + <input id="Generator.cluster_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cluster_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Cluster">sqlglot.expressions.Cluster</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.cluster_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.cluster_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.cluster_sql-1175"><a href="#Generator.cluster_sql-1175"><span class="linenos">1175</span></a> <span class="k">def</span> <span class="nf">cluster_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.cluster_sql-1176"><a href="#Generator.cluster_sql-1176"><span class="linenos">1176</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"CLUSTER BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.distribute_sql" class="classattr"> + <input id="Generator.distribute_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">distribute_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Distribute">sqlglot.expressions.Distribute</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.distribute_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.distribute_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.distribute_sql-1178"><a href="#Generator.distribute_sql-1178"><span class="linenos">1178</span></a> <span class="k">def</span> <span class="nf">distribute_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distribute</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.distribute_sql-1179"><a href="#Generator.distribute_sql-1179"><span class="linenos">1179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"DISTRIBUTE BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.sort_sql" class="classattr"> + <input id="Generator.sort_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sort_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Sort">sqlglot.expressions.Sort</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.sort_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.sort_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.sort_sql-1181"><a href="#Generator.sort_sql-1181"><span class="linenos">1181</span></a> <span class="k">def</span> <span class="nf">sort_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.sort_sql-1182"><a href="#Generator.sort_sql-1182"><span class="linenos">1182</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op_expressions</span><span class="p">(</span><span class="s2">"SORT BY"</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.ordered_sql" class="classattr"> + <input id="Generator.ordered_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ordered_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Ordered">sqlglot.expressions.Ordered</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.ordered_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.ordered_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.ordered_sql-1184"><a href="#Generator.ordered_sql-1184"><span class="linenos">1184</span></a> <span class="k">def</span> <span class="nf">ordered_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.ordered_sql-1185"><a href="#Generator.ordered_sql-1185"><span class="linenos">1185</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"desc"</span><span class="p">)</span> +</span><span id="Generator.ordered_sql-1186"><a href="#Generator.ordered_sql-1186"><span class="linenos">1186</span></a> <span class="n">asc</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">desc</span> +</span><span id="Generator.ordered_sql-1187"><a href="#Generator.ordered_sql-1187"><span class="linenos">1187</span></a> +</span><span id="Generator.ordered_sql-1188"><a href="#Generator.ordered_sql-1188"><span class="linenos">1188</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"nulls_first"</span><span class="p">)</span> +</span><span id="Generator.ordered_sql-1189"><a href="#Generator.ordered_sql-1189"><span class="linenos">1189</span></a> <span class="n">nulls_last</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">nulls_first</span> +</span><span id="Generator.ordered_sql-1190"><a href="#Generator.ordered_sql-1190"><span class="linenos">1190</span></a> <span class="n">nulls_are_large</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_large"</span> +</span><span id="Generator.ordered_sql-1191"><a href="#Generator.ordered_sql-1191"><span class="linenos">1191</span></a> <span class="n">nulls_are_small</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_small"</span> +</span><span id="Generator.ordered_sql-1192"><a href="#Generator.ordered_sql-1192"><span class="linenos">1192</span></a> <span class="n">nulls_are_last</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_last"</span> +</span><span id="Generator.ordered_sql-1193"><a href="#Generator.ordered_sql-1193"><span class="linenos">1193</span></a> +</span><span id="Generator.ordered_sql-1194"><a href="#Generator.ordered_sql-1194"><span class="linenos">1194</span></a> <span class="n">sort_order</span> <span class="o">=</span> <span class="s2">" DESC"</span> <span class="k">if</span> <span class="n">desc</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.ordered_sql-1195"><a href="#Generator.ordered_sql-1195"><span class="linenos">1195</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.ordered_sql-1196"><a href="#Generator.ordered_sql-1196"><span class="linenos">1196</span></a> <span class="k">if</span> <span class="n">nulls_first</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="Generator.ordered_sql-1197"><a href="#Generator.ordered_sql-1197"><span class="linenos">1197</span></a> <span class="p">(</span><span class="n">asc</span> <span class="ow">and</span> <span class="n">nulls_are_large</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="n">nulls_are_small</span><span class="p">)</span> <span class="ow">or</span> <span class="n">nulls_are_last</span> +</span><span id="Generator.ordered_sql-1198"><a href="#Generator.ordered_sql-1198"><span class="linenos">1198</span></a> <span class="p">):</span> +</span><span id="Generator.ordered_sql-1199"><a href="#Generator.ordered_sql-1199"><span class="linenos">1199</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">" NULLS FIRST"</span> +</span><span id="Generator.ordered_sql-1200"><a href="#Generator.ordered_sql-1200"><span class="linenos">1200</span></a> <span class="k">elif</span> <span class="p">(</span> +</span><span id="Generator.ordered_sql-1201"><a href="#Generator.ordered_sql-1201"><span class="linenos">1201</span></a> <span class="n">nulls_last</span> +</span><span id="Generator.ordered_sql-1202"><a href="#Generator.ordered_sql-1202"><span class="linenos">1202</span></a> <span class="ow">and</span> <span class="p">((</span><span class="n">asc</span> <span class="ow">and</span> <span class="n">nulls_are_small</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="n">nulls_are_large</span><span class="p">))</span> +</span><span id="Generator.ordered_sql-1203"><a href="#Generator.ordered_sql-1203"><span class="linenos">1203</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">nulls_are_last</span> +</span><span id="Generator.ordered_sql-1204"><a href="#Generator.ordered_sql-1204"><span class="linenos">1204</span></a> <span class="p">):</span> +</span><span id="Generator.ordered_sql-1205"><a href="#Generator.ordered_sql-1205"><span class="linenos">1205</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">" NULLS LAST"</span> +</span><span id="Generator.ordered_sql-1206"><a href="#Generator.ordered_sql-1206"><span class="linenos">1206</span></a> +</span><span id="Generator.ordered_sql-1207"><a href="#Generator.ordered_sql-1207"><span class="linenos">1207</span></a> <span class="k">if</span> <span class="n">nulls_sort_change</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">NULL_ORDERING_SUPPORTED</span><span class="p">:</span> +</span><span id="Generator.ordered_sql-1208"><a href="#Generator.ordered_sql-1208"><span class="linenos">1208</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span> +</span><span id="Generator.ordered_sql-1209"><a href="#Generator.ordered_sql-1209"><span class="linenos">1209</span></a> <span class="s2">"Sorting in an ORDER BY on NULLS FIRST/NULLS LAST is not supported by this dialect"</span> +</span><span id="Generator.ordered_sql-1210"><a href="#Generator.ordered_sql-1210"><span class="linenos">1210</span></a> <span class="p">)</span> +</span><span id="Generator.ordered_sql-1211"><a href="#Generator.ordered_sql-1211"><span class="linenos">1211</span></a> <span class="n">nulls_sort_change</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.ordered_sql-1212"><a href="#Generator.ordered_sql-1212"><span class="linenos">1212</span></a> +</span><span id="Generator.ordered_sql-1213"><a href="#Generator.ordered_sql-1213"><span class="linenos">1213</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">sort_order</span><span class="si">}{</span><span class="n">nulls_sort_change</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.matchrecognize_sql" class="classattr"> + <input id="Generator.matchrecognize_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">matchrecognize_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#MatchRecognize">sqlglot.expressions.MatchRecognize</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.matchrecognize_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.matchrecognize_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.matchrecognize_sql-1215"><a href="#Generator.matchrecognize_sql-1215"><span class="linenos">1215</span></a> <span class="k">def</span> <span class="nf">matchrecognize_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.matchrecognize_sql-1216"><a href="#Generator.matchrecognize_sql-1216"><span class="linenos">1216</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition_by_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1217"><a href="#Generator.matchrecognize_sql-1217"><span class="linenos">1217</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1218"><a href="#Generator.matchrecognize_sql-1218"><span class="linenos">1218</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"measures"</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1219"><a href="#Generator.matchrecognize_sql-1219"><span class="linenos">1219</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"MEASURES </span><span class="si">{</span><span class="n">measures</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="n">measures</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.matchrecognize_sql-1220"><a href="#Generator.matchrecognize_sql-1220"><span class="linenos">1220</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"rows"</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1221"><a href="#Generator.matchrecognize_sql-1221"><span class="linenos">1221</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">rows</span><span class="p">)</span> <span class="k">if</span> <span class="n">rows</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.matchrecognize_sql-1222"><a href="#Generator.matchrecognize_sql-1222"><span class="linenos">1222</span></a> <span class="n">after</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"after"</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1223"><a href="#Generator.matchrecognize_sql-1223"><span class="linenos">1223</span></a> <span class="n">after</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">after</span><span class="p">)</span> <span class="k">if</span> <span class="n">after</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.matchrecognize_sql-1224"><a href="#Generator.matchrecognize_sql-1224"><span class="linenos">1224</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"pattern"</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1225"><a href="#Generator.matchrecognize_sql-1225"><span class="linenos">1225</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"PATTERN (</span><span class="si">{</span><span class="n">pattern</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> <span class="k">if</span> <span class="n">pattern</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.matchrecognize_sql-1226"><a href="#Generator.matchrecognize_sql-1226"><span class="linenos">1226</span></a> <span class="n">define</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"define"</span><span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1227"><a href="#Generator.matchrecognize_sql-1227"><span class="linenos">1227</span></a> <span class="n">define</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="sa">f</span><span class="s2">"DEFINE </span><span class="si">{</span><span class="n">define</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="n">define</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.matchrecognize_sql-1228"><a href="#Generator.matchrecognize_sql-1228"><span class="linenos">1228</span></a> <span class="n">body</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="Generator.matchrecognize_sql-1229"><a href="#Generator.matchrecognize_sql-1229"><span class="linenos">1229</span></a> <span class="p">(</span> +</span><span id="Generator.matchrecognize_sql-1230"><a href="#Generator.matchrecognize_sql-1230"><span class="linenos">1230</span></a> <span class="n">partition</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1231"><a href="#Generator.matchrecognize_sql-1231"><span class="linenos">1231</span></a> <span class="n">order</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1232"><a href="#Generator.matchrecognize_sql-1232"><span class="linenos">1232</span></a> <span class="n">measures</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1233"><a href="#Generator.matchrecognize_sql-1233"><span class="linenos">1233</span></a> <span class="n">rows</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1234"><a href="#Generator.matchrecognize_sql-1234"><span class="linenos">1234</span></a> <span class="n">after</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1235"><a href="#Generator.matchrecognize_sql-1235"><span class="linenos">1235</span></a> <span class="n">pattern</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1236"><a href="#Generator.matchrecognize_sql-1236"><span class="linenos">1236</span></a> <span class="n">define</span><span class="p">,</span> +</span><span id="Generator.matchrecognize_sql-1237"><a href="#Generator.matchrecognize_sql-1237"><span class="linenos">1237</span></a> <span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1238"><a href="#Generator.matchrecognize_sql-1238"><span class="linenos">1238</span></a> <span class="p">)</span> +</span><span id="Generator.matchrecognize_sql-1239"><a href="#Generator.matchrecognize_sql-1239"><span class="linenos">1239</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'MATCH_RECOGNIZE'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">body</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.query_modifiers" class="classattr"> + <input id="Generator.query_modifiers-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">query_modifiers</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>, </span><span class="param"><span class="o">*</span><span class="n">sqls</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.query_modifiers-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.query_modifiers"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.query_modifiers-1241"><a href="#Generator.query_modifiers-1241"><span class="linenos">1241</span></a> <span class="k">def</span> <span class="nf">query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="o">*</span><span class="n">sqls</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.query_modifiers-1242"><a href="#Generator.query_modifiers-1242"><span class="linenos">1242</span></a> <span class="k">return</span> <span class="n">csv</span><span class="p">(</span> +</span><span id="Generator.query_modifiers-1243"><a href="#Generator.query_modifiers-1243"><span class="linenos">1243</span></a> <span class="o">*</span><span class="n">sqls</span><span class="p">,</span> +</span><span id="Generator.query_modifiers-1244"><a href="#Generator.query_modifiers-1244"><span class="linenos">1244</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Generator.query_modifiers-1245"><a href="#Generator.query_modifiers-1245"><span class="linenos">1245</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"match"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1246"><a href="#Generator.query_modifiers-1246"><span class="linenos">1246</span></a> <span class="o">*</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]],</span> +</span><span id="Generator.query_modifiers-1247"><a href="#Generator.query_modifiers-1247"><span class="linenos">1247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"where"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1248"><a href="#Generator.query_modifiers-1248"><span class="linenos">1248</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"group"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1249"><a href="#Generator.query_modifiers-1249"><span class="linenos">1249</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1250"><a href="#Generator.query_modifiers-1250"><span class="linenos">1250</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"qualify"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1251"><a href="#Generator.query_modifiers-1251"><span class="linenos">1251</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s2">"WINDOW "</span><span class="p">)</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"windows"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.query_modifiers-1252"><a href="#Generator.query_modifiers-1252"><span class="linenos">1252</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> +</span><span id="Generator.query_modifiers-1253"><a href="#Generator.query_modifiers-1253"><span class="linenos">1253</span></a> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator.query_modifiers-1254"><a href="#Generator.query_modifiers-1254"><span class="linenos">1254</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distribute"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1255"><a href="#Generator.query_modifiers-1255"><span class="linenos">1255</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"sort"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1256"><a href="#Generator.query_modifiers-1256"><span class="linenos">1256</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"cluster"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1257"><a href="#Generator.query_modifiers-1257"><span class="linenos">1257</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1258"><a href="#Generator.query_modifiers-1258"><span class="linenos">1258</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"limit"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1259"><a href="#Generator.query_modifiers-1259"><span class="linenos">1259</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"offset"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1260"><a href="#Generator.query_modifiers-1260"><span class="linenos">1260</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"lock"</span><span class="p">),</span> +</span><span id="Generator.query_modifiers-1261"><a href="#Generator.query_modifiers-1261"><span class="linenos">1261</span></a> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">,</span> +</span><span id="Generator.query_modifiers-1262"><a href="#Generator.query_modifiers-1262"><span class="linenos">1262</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.select_sql" class="classattr"> + <input id="Generator.select_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">select_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Select">sqlglot.expressions.Select</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.select_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.select_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.select_sql-1264"><a href="#Generator.select_sql-1264"><span class="linenos">1264</span></a> <span class="k">def</span> <span class="nf">select_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.select_sql-1265"><a href="#Generator.select_sql-1265"><span class="linenos">1265</span></a> <span class="n">hint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"hint"</span><span class="p">)</span> +</span><span id="Generator.select_sql-1266"><a href="#Generator.select_sql-1266"><span class="linenos">1266</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"distinct"</span><span class="p">)</span> +</span><span id="Generator.select_sql-1267"><a href="#Generator.select_sql-1267"><span class="linenos">1267</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">distinct</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">distinct</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.select_sql-1268"><a href="#Generator.select_sql-1268"><span class="linenos">1268</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.select_sql-1269"><a href="#Generator.select_sql-1269"><span class="linenos">1269</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">expressions</span> <span class="k">else</span> <span class="n">expressions</span> +</span><span id="Generator.select_sql-1270"><a href="#Generator.select_sql-1270"><span class="linenos">1270</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="Generator.select_sql-1271"><a href="#Generator.select_sql-1271"><span class="linenos">1271</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator.select_sql-1272"><a href="#Generator.select_sql-1272"><span class="linenos">1272</span></a> <span class="sa">f</span><span class="s2">"SELECT</span><span class="si">{</span><span class="n">hint</span><span class="si">}{</span><span class="n">distinct</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Generator.select_sql-1273"><a href="#Generator.select_sql-1273"><span class="linenos">1273</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"into"</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Generator.select_sql-1274"><a href="#Generator.select_sql-1274"><span class="linenos">1274</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"from"</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Generator.select_sql-1275"><a href="#Generator.select_sql-1275"><span class="linenos">1275</span></a> <span class="p">)</span> +</span><span id="Generator.select_sql-1276"><a href="#Generator.select_sql-1276"><span class="linenos">1276</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.schema_sql" class="classattr"> + <input id="Generator.schema_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">schema_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Schema">sqlglot.expressions.Schema</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.schema_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.schema_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.schema_sql-1278"><a href="#Generator.schema_sql-1278"><span class="linenos">1278</span></a> <span class="k">def</span> <span class="nf">schema_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.schema_sql-1279"><a href="#Generator.schema_sql-1279"><span class="linenos">1279</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.schema_sql-1280"><a href="#Generator.schema_sql-1280"><span class="linenos">1280</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> "</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.schema_sql-1281"><a href="#Generator.schema_sql-1281"><span class="linenos">1281</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">(</span><span class="s1">''</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.schema_sql-1282"><a href="#Generator.schema_sql-1282"><span class="linenos">1282</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.star_sql" class="classattr"> + <input id="Generator.star_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">star_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Star">sqlglot.expressions.Star</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.star_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.star_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.star_sql-1284"><a href="#Generator.star_sql-1284"><span class="linenos">1284</span></a> <span class="k">def</span> <span class="nf">star_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.star_sql-1285"><a href="#Generator.star_sql-1285"><span class="linenos">1285</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"except"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.star_sql-1286"><a href="#Generator.star_sql-1286"><span class="linenos">1286</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STAR_MAPPING</span><span class="p">[</span><span class="s1">'except'</span><span class="p">])</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">except_</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">except_</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.star_sql-1287"><a href="#Generator.star_sql-1287"><span class="linenos">1287</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"replace"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.star_sql-1288"><a href="#Generator.star_sql-1288"><span class="linenos">1288</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STAR_MAPPING</span><span class="p">[</span><span class="s1">'replace'</span><span class="p">])</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">replace</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">replace</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.star_sql-1289"><a href="#Generator.star_sql-1289"><span class="linenos">1289</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"*</span><span class="si">{</span><span class="n">except_</span><span class="si">}{</span><span class="n">replace</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.structkwarg_sql" class="classattr"> + <input id="Generator.structkwarg_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">structkwarg_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#StructKwarg">sqlglot.expressions.StructKwarg</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.structkwarg_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.structkwarg_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.structkwarg_sql-1291"><a href="#Generator.structkwarg_sql-1291"><span class="linenos">1291</span></a> <span class="k">def</span> <span class="nf">structkwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.structkwarg_sql-1292"><a href="#Generator.structkwarg_sql-1292"><span class="linenos">1292</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.parameter_sql" class="classattr"> + <input id="Generator.parameter_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parameter_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Parameter">sqlglot.expressions.Parameter</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.parameter_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.parameter_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.parameter_sql-1294"><a href="#Generator.parameter_sql-1294"><span class="linenos">1294</span></a> <span class="k">def</span> <span class="nf">parameter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.parameter_sql-1295"><a href="#Generator.parameter_sql-1295"><span class="linenos">1295</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"@</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.sessionparameter_sql" class="classattr"> + <input id="Generator.sessionparameter_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sessionparameter_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#SessionParameter">sqlglot.expressions.SessionParameter</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.sessionparameter_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.sessionparameter_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.sessionparameter_sql-1297"><a href="#Generator.sessionparameter_sql-1297"><span class="linenos">1297</span></a> <span class="k">def</span> <span class="nf">sessionparameter_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SessionParameter</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.sessionparameter_sql-1298"><a href="#Generator.sessionparameter_sql-1298"><span class="linenos">1298</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.sessionparameter_sql-1299"><a href="#Generator.sessionparameter_sql-1299"><span class="linenos">1299</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator.sessionparameter_sql-1300"><a href="#Generator.sessionparameter_sql-1300"><span class="linenos">1300</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Generator.sessionparameter_sql-1301"><a href="#Generator.sessionparameter_sql-1301"><span class="linenos">1301</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">."</span> +</span><span id="Generator.sessionparameter_sql-1302"><a href="#Generator.sessionparameter_sql-1302"><span class="linenos">1302</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"@@</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.placeholder_sql" class="classattr"> + <input id="Generator.placeholder_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">placeholder_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Placeholder">sqlglot.expressions.Placeholder</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.placeholder_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.placeholder_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.placeholder_sql-1304"><a href="#Generator.placeholder_sql-1304"><span class="linenos">1304</span></a> <span class="k">def</span> <span class="nf">placeholder_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.placeholder_sql-1305"><a href="#Generator.placeholder_sql-1305"><span class="linenos">1305</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">":</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">name</span> <span class="k">else</span> <span class="s2">"?"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.subquery_sql" class="classattr"> + <input id="Generator.subquery_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">subquery_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Subquery">sqlglot.expressions.Subquery</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.subquery_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.subquery_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.subquery_sql-1307"><a href="#Generator.subquery_sql-1307"><span class="linenos">1307</span></a> <span class="k">def</span> <span class="nf">subquery_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.subquery_sql-1308"><a href="#Generator.subquery_sql-1308"><span class="linenos">1308</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.subquery_sql-1309"><a href="#Generator.subquery_sql-1309"><span class="linenos">1309</span></a> +</span><span id="Generator.subquery_sql-1310"><a href="#Generator.subquery_sql-1310"><span class="linenos">1310</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="Generator.subquery_sql-1311"><a href="#Generator.subquery_sql-1311"><span class="linenos">1311</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator.subquery_sql-1312"><a href="#Generator.subquery_sql-1312"><span class="linenos">1312</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">),</span> +</span><span id="Generator.subquery_sql-1313"><a href="#Generator.subquery_sql-1313"><span class="linenos">1313</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"pivots"</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">),</span> +</span><span id="Generator.subquery_sql-1314"><a href="#Generator.subquery_sql-1314"><span class="linenos">1314</span></a> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator.subquery_sql-1315"><a href="#Generator.subquery_sql-1315"><span class="linenos">1315</span></a> <span class="p">)</span> +</span><span id="Generator.subquery_sql-1316"><a href="#Generator.subquery_sql-1316"><span class="linenos">1316</span></a> +</span><span id="Generator.subquery_sql-1317"><a href="#Generator.subquery_sql-1317"><span class="linenos">1317</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.qualify_sql" class="classattr"> + <input id="Generator.qualify_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">qualify_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Qualify">sqlglot.expressions.Qualify</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.qualify_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.qualify_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.qualify_sql-1319"><a href="#Generator.qualify_sql-1319"><span class="linenos">1319</span></a> <span class="k">def</span> <span class="nf">qualify_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.qualify_sql-1320"><a href="#Generator.qualify_sql-1320"><span class="linenos">1320</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="Generator.qualify_sql-1321"><a href="#Generator.qualify_sql-1321"><span class="linenos">1321</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'QUALIFY'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.union_sql" class="classattr"> + <input id="Generator.union_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">union_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Union">sqlglot.expressions.Union</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.union_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.union_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.union_sql-1323"><a href="#Generator.union_sql-1323"><span class="linenos">1323</span></a> <span class="k">def</span> <span class="nf">union_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.union_sql-1324"><a href="#Generator.union_sql-1324"><span class="linenos">1324</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span> +</span><span id="Generator.union_sql-1325"><a href="#Generator.union_sql-1325"><span class="linenos">1325</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Generator.union_sql-1326"><a href="#Generator.union_sql-1326"><span class="linenos">1326</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_operation</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">union_op</span><span class="p">(</span><span class="n">expression</span><span class="p">)),</span> +</span><span id="Generator.union_sql-1327"><a href="#Generator.union_sql-1327"><span class="linenos">1327</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.union_op" class="classattr"> + <input id="Generator.union_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">union_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Union">sqlglot.expressions.Union</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.union_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.union_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.union_op-1329"><a href="#Generator.union_op-1329"><span class="linenos">1329</span></a> <span class="k">def</span> <span class="nf">union_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.union_op-1330"><a href="#Generator.union_op-1330"><span class="linenos">1330</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="s2">" DISTINCT"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXPLICIT_UNION</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.union_op-1331"><a href="#Generator.union_op-1331"><span class="linenos">1331</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">kind</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" ALL"</span> +</span><span id="Generator.union_op-1332"><a href="#Generator.union_op-1332"><span class="linenos">1332</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNION</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.unnest_sql" class="classattr"> + <input id="Generator.unnest_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unnest_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Unnest">sqlglot.expressions.Unnest</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.unnest_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.unnest_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.unnest_sql-1334"><a href="#Generator.unnest_sql-1334"><span class="linenos">1334</span></a> <span class="k">def</span> <span class="nf">unnest_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.unnest_sql-1335"><a href="#Generator.unnest_sql-1335"><span class="linenos">1335</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.unnest_sql-1336"><a href="#Generator.unnest_sql-1336"><span class="linenos">1336</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.unnest_sql-1337"><a href="#Generator.unnest_sql-1337"><span class="linenos">1337</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">:</span> +</span><span id="Generator.unnest_sql-1338"><a href="#Generator.unnest_sql-1338"><span class="linenos">1338</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">alias</span><span class="o">.</span><span class="n">columns</span> +</span><span id="Generator.unnest_sql-1339"><a href="#Generator.unnest_sql-1339"><span class="linenos">1339</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">columns</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.unnest_sql-1340"><a href="#Generator.unnest_sql-1340"><span class="linenos">1340</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.unnest_sql-1341"><a href="#Generator.unnest_sql-1341"><span class="linenos">1341</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.unnest_sql-1342"><a href="#Generator.unnest_sql-1342"><span class="linenos">1342</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">alias</span> +</span><span id="Generator.unnest_sql-1343"><a href="#Generator.unnest_sql-1343"><span class="linenos">1343</span></a> <span class="n">ordinality</span> <span class="o">=</span> <span class="s2">" WITH ORDINALITY"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"ordinality"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.unnest_sql-1344"><a href="#Generator.unnest_sql-1344"><span class="linenos">1344</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"offset"</span><span class="p">)</span> +</span><span id="Generator.unnest_sql-1345"><a href="#Generator.unnest_sql-1345"><span class="linenos">1345</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" WITH OFFSET AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">offset</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">offset</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.unnest_sql-1346"><a href="#Generator.unnest_sql-1346"><span class="linenos">1346</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNNEST(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">ordinality</span><span class="si">}{</span><span class="n">alias</span><span class="si">}{</span><span class="n">offset</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.where_sql" class="classattr"> + <input id="Generator.where_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">where_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Where">sqlglot.expressions.Where</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.where_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.where_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.where_sql-1348"><a href="#Generator.where_sql-1348"><span class="linenos">1348</span></a> <span class="k">def</span> <span class="nf">where_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.where_sql-1349"><a href="#Generator.where_sql-1349"><span class="linenos">1349</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">))</span> +</span><span id="Generator.where_sql-1350"><a href="#Generator.where_sql-1350"><span class="linenos">1350</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">'WHERE'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.window_sql" class="classattr"> + <input id="Generator.window_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">window_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Window">sqlglot.expressions.Window</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.window_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.window_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.window_sql-1352"><a href="#Generator.window_sql-1352"><span class="linenos">1352</span></a> <span class="k">def</span> <span class="nf">window_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.window_sql-1353"><a href="#Generator.window_sql-1353"><span class="linenos">1353</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.window_sql-1354"><a href="#Generator.window_sql-1354"><span class="linenos">1354</span></a> +</span><span id="Generator.window_sql-1355"><a href="#Generator.window_sql-1355"><span class="linenos">1355</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partition_by_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.window_sql-1356"><a href="#Generator.window_sql-1356"><span class="linenos">1356</span></a> +</span><span id="Generator.window_sql-1357"><a href="#Generator.window_sql-1357"><span class="linenos">1357</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="Generator.window_sql-1358"><a href="#Generator.window_sql-1358"><span class="linenos">1358</span></a> <span class="n">order_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">order_sql</span><span class="p">(</span><span class="n">order</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">order</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.window_sql-1359"><a href="#Generator.window_sql-1359"><span class="linenos">1359</span></a> +</span><span id="Generator.window_sql-1360"><a href="#Generator.window_sql-1360"><span class="linenos">1360</span></a> <span class="n">partition_sql</span> <span class="o">=</span> <span class="n">partition</span> <span class="o">+</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">partition</span> <span class="ow">and</span> <span class="n">order</span> <span class="k">else</span> <span class="n">partition</span> +</span><span id="Generator.window_sql-1361"><a href="#Generator.window_sql-1361"><span class="linenos">1361</span></a> +</span><span id="Generator.window_sql-1362"><a href="#Generator.window_sql-1362"><span class="linenos">1362</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"spec"</span><span class="p">)</span> +</span><span id="Generator.window_sql-1363"><a href="#Generator.window_sql-1363"><span class="linenos">1363</span></a> <span class="n">spec_sql</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_spec_sql</span><span class="p">(</span><span class="n">spec</span><span class="p">)</span> <span class="k">if</span> <span class="n">spec</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.window_sql-1364"><a href="#Generator.window_sql-1364"><span class="linenos">1364</span></a> +</span><span id="Generator.window_sql-1365"><a href="#Generator.window_sql-1365"><span class="linenos">1365</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.window_sql-1366"><a href="#Generator.window_sql-1366"><span class="linenos">1366</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="s1">'AS'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">arg_key</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s1">'windows'</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'OVER'</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.window_sql-1367"><a href="#Generator.window_sql-1367"><span class="linenos">1367</span></a> +</span><span id="Generator.window_sql-1368"><a href="#Generator.window_sql-1368"><span class="linenos">1368</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">partition</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">order</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">spec</span> <span class="ow">and</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="Generator.window_sql-1369"><a href="#Generator.window_sql-1369"><span class="linenos">1369</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.window_sql-1370"><a href="#Generator.window_sql-1370"><span class="linenos">1370</span></a> +</span><span id="Generator.window_sql-1371"><a href="#Generator.window_sql-1371"><span class="linenos">1371</span></a> <span class="n">window_args</span> <span class="o">=</span> <span class="n">alias</span> <span class="o">+</span> <span class="n">partition_sql</span> <span class="o">+</span> <span class="n">order_sql</span> <span class="o">+</span> <span class="n">spec_sql</span> +</span><span id="Generator.window_sql-1372"><a href="#Generator.window_sql-1372"><span class="linenos">1372</span></a> +</span><span id="Generator.window_sql-1373"><a href="#Generator.window_sql-1373"><span class="linenos">1373</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="n">window_args</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.partition_by_sql" class="classattr"> + <input id="Generator.partition_by_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">partition_by_sql</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Window">sqlglot.expressions.Window</a></span> <span class="o">|</span> <span class="n"><a href="expressions.html#MatchRecognize">sqlglot.expressions.MatchRecognize</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.partition_by_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.partition_by_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.partition_by_sql-1375"><a href="#Generator.partition_by_sql-1375"><span class="linenos">1375</span></a> <span class="k">def</span> <span class="nf">partition_by_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.partition_by_sql-1376"><a href="#Generator.partition_by_sql-1376"><span class="linenos">1376</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"partition_by"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.partition_by_sql-1377"><a href="#Generator.partition_by_sql-1377"><span class="linenos">1377</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PARTITION BY </span><span class="si">{</span><span class="n">partition</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">partition</span> <span class="k">else</span> <span class="s2">""</span> +</span></pre></div> + + + + + </div> + <div id="Generator.window_spec_sql" class="classattr"> + <input id="Generator.window_spec_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">window_spec_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#WindowSpec">sqlglot.expressions.WindowSpec</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.window_spec_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.window_spec_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.window_spec_sql-1379"><a href="#Generator.window_spec_sql-1379"><span class="linenos">1379</span></a> <span class="k">def</span> <span class="nf">window_spec_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.window_spec_sql-1380"><a href="#Generator.window_spec_sql-1380"><span class="linenos">1380</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator.window_spec_sql-1381"><a href="#Generator.window_spec_sql-1381"><span class="linenos">1381</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"start_side"</span><span class="p">),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator.window_spec_sql-1382"><a href="#Generator.window_spec_sql-1382"><span class="linenos">1382</span></a> <span class="n">end</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.window_spec_sql-1383"><a href="#Generator.window_spec_sql-1383"><span class="linenos">1383</span></a> <span class="n">csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"end"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"end_side"</span><span class="p">),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator.window_spec_sql-1384"><a href="#Generator.window_spec_sql-1384"><span class="linenos">1384</span></a> <span class="ow">or</span> <span class="s2">"CURRENT ROW"</span> +</span><span id="Generator.window_spec_sql-1385"><a href="#Generator.window_spec_sql-1385"><span class="linenos">1385</span></a> <span class="p">)</span> +</span><span id="Generator.window_spec_sql-1386"><a href="#Generator.window_spec_sql-1386"><span class="linenos">1386</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">start</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">end</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.withingroup_sql" class="classattr"> + <input id="Generator.withingroup_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">withingroup_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#WithinGroup">sqlglot.expressions.WithinGroup</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.withingroup_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.withingroup_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.withingroup_sql-1388"><a href="#Generator.withingroup_sql-1388"><span class="linenos">1388</span></a> <span class="k">def</span> <span class="nf">withingroup_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.withingroup_sql-1389"><a href="#Generator.withingroup_sql-1389"><span class="linenos">1389</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.withingroup_sql-1390"><a href="#Generator.withingroup_sql-1390"><span class="linenos">1390</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> <span class="c1"># order has a leading space</span> +</span><span id="Generator.withingroup_sql-1391"><a href="#Generator.withingroup_sql-1391"><span class="linenos">1391</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> WITHIN GROUP (</span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.between_sql" class="classattr"> + <input id="Generator.between_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">between_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Between">sqlglot.expressions.Between</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.between_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.between_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.between_sql-1393"><a href="#Generator.between_sql-1393"><span class="linenos">1393</span></a> <span class="k">def</span> <span class="nf">between_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.between_sql-1394"><a href="#Generator.between_sql-1394"><span class="linenos">1394</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.between_sql-1395"><a href="#Generator.between_sql-1395"><span class="linenos">1395</span></a> <span class="n">low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"low"</span><span class="p">)</span> +</span><span id="Generator.between_sql-1396"><a href="#Generator.between_sql-1396"><span class="linenos">1396</span></a> <span class="n">high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"high"</span><span class="p">)</span> +</span><span id="Generator.between_sql-1397"><a href="#Generator.between_sql-1397"><span class="linenos">1397</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">low</span><span class="si">}</span><span class="s2"> AND </span><span class="si">{</span><span class="n">high</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bracket_sql" class="classattr"> + <input id="Generator.bracket_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bracket_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Bracket">sqlglot.expressions.Bracket</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bracket_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bracket_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bracket_sql-1399"><a href="#Generator.bracket_sql-1399"><span class="linenos">1399</span></a> <span class="k">def</span> <span class="nf">bracket_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bracket_sql-1400"><a href="#Generator.bracket_sql-1400"><span class="linenos">1400</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">apply_index_offset</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">)</span> +</span><span id="Generator.bracket_sql-1401"><a href="#Generator.bracket_sql-1401"><span class="linenos">1401</span></a> <span class="n">expressions_sql</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator.bracket_sql-1402"><a href="#Generator.bracket_sql-1402"><span class="linenos">1402</span></a> +</span><span id="Generator.bracket_sql-1403"><a href="#Generator.bracket_sql-1403"><span class="linenos">1403</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">[</span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">]"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.all_sql" class="classattr"> + <input id="Generator.all_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">all_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#All">sqlglot.expressions.All</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.all_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.all_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.all_sql-1405"><a href="#Generator.all_sql-1405"><span class="linenos">1405</span></a> <span class="k">def</span> <span class="nf">all_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.all_sql-1406"><a href="#Generator.all_sql-1406"><span class="linenos">1406</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALL </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.any_sql" class="classattr"> + <input id="Generator.any_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">any_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Any">sqlglot.expressions.Any</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.any_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.any_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.any_sql-1408"><a href="#Generator.any_sql-1408"><span class="linenos">1408</span></a> <span class="k">def</span> <span class="nf">any_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.any_sql-1409"><a href="#Generator.any_sql-1409"><span class="linenos">1409</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ANY </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.exists_sql" class="classattr"> + <input id="Generator.exists_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">exists_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Exists">sqlglot.expressions.Exists</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.exists_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.exists_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.exists_sql-1411"><a href="#Generator.exists_sql-1411"><span class="linenos">1411</span></a> <span class="k">def</span> <span class="nf">exists_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.exists_sql-1412"><a href="#Generator.exists_sql-1412"><span class="linenos">1412</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXISTS</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.case_sql" class="classattr"> + <input id="Generator.case_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">case_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Case">sqlglot.expressions.Case</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.case_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.case_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.case_sql-1414"><a href="#Generator.case_sql-1414"><span class="linenos">1414</span></a> <span class="k">def</span> <span class="nf">case_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.case_sql-1415"><a href="#Generator.case_sql-1415"><span class="linenos">1415</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.case_sql-1416"><a href="#Generator.case_sql-1416"><span class="linenos">1416</span></a> <span class="n">statements</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"CASE </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">"CASE"</span><span class="p">]</span> +</span><span id="Generator.case_sql-1417"><a href="#Generator.case_sql-1417"><span class="linenos">1417</span></a> +</span><span id="Generator.case_sql-1418"><a href="#Generator.case_sql-1418"><span class="linenos">1418</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"ifs"</span><span class="p">]:</span> +</span><span id="Generator.case_sql-1419"><a href="#Generator.case_sql-1419"><span class="linenos">1419</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"WHEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.case_sql-1420"><a href="#Generator.case_sql-1420"><span class="linenos">1420</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"THEN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span><span class="w"> </span><span class="s1">'true'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.case_sql-1421"><a href="#Generator.case_sql-1421"><span class="linenos">1421</span></a> +</span><span id="Generator.case_sql-1422"><a href="#Generator.case_sql-1422"><span class="linenos">1422</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator.case_sql-1423"><a href="#Generator.case_sql-1423"><span class="linenos">1423</span></a> +</span><span id="Generator.case_sql-1424"><a href="#Generator.case_sql-1424"><span class="linenos">1424</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator.case_sql-1425"><a href="#Generator.case_sql-1425"><span class="linenos">1425</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"ELSE </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.case_sql-1426"><a href="#Generator.case_sql-1426"><span class="linenos">1426</span></a> +</span><span id="Generator.case_sql-1427"><a href="#Generator.case_sql-1427"><span class="linenos">1427</span></a> <span class="n">statements</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"END"</span><span class="p">)</span> +</span><span id="Generator.case_sql-1428"><a href="#Generator.case_sql-1428"><span class="linenos">1428</span></a> +</span><span id="Generator.case_sql-1429"><a href="#Generator.case_sql-1429"><span class="linenos">1429</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">statements</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span><span class="p">:</span> +</span><span id="Generator.case_sql-1430"><a href="#Generator.case_sql-1430"><span class="linenos">1430</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">statements</span><span class="p">),</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">skip_last</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.case_sql-1431"><a href="#Generator.case_sql-1431"><span class="linenos">1431</span></a> +</span><span id="Generator.case_sql-1432"><a href="#Generator.case_sql-1432"><span class="linenos">1432</span></a> <span class="k">return</span> <span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">statements</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.constraint_sql" class="classattr"> + <input id="Generator.constraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">constraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Constraint">sqlglot.expressions.Constraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.constraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.constraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.constraint_sql-1434"><a href="#Generator.constraint_sql-1434"><span class="linenos">1434</span></a> <span class="k">def</span> <span class="nf">constraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Constraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.constraint_sql-1435"><a href="#Generator.constraint_sql-1435"><span class="linenos">1435</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.constraint_sql-1436"><a href="#Generator.constraint_sql-1436"><span class="linenos">1436</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.constraint_sql-1437"><a href="#Generator.constraint_sql-1437"><span class="linenos">1437</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.extract_sql" class="classattr"> + <input id="Generator.extract_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">extract_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Extract">sqlglot.expressions.Extract</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.extract_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.extract_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.extract_sql-1439"><a href="#Generator.extract_sql-1439"><span class="linenos">1439</span></a> <span class="k">def</span> <span class="nf">extract_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.extract_sql-1440"><a href="#Generator.extract_sql-1440"><span class="linenos">1440</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.extract_sql-1441"><a href="#Generator.extract_sql-1441"><span class="linenos">1441</span></a> <span class="n">expression_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator.extract_sql-1442"><a href="#Generator.extract_sql-1442"><span class="linenos">1442</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"EXTRACT(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> FROM </span><span class="si">{</span><span class="n">expression_sql</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.trim_sql" class="classattr"> + <input id="Generator.trim_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">trim_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Trim">sqlglot.expressions.Trim</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.trim_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.trim_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.trim_sql-1444"><a href="#Generator.trim_sql-1444"><span class="linenos">1444</span></a> <span class="k">def</span> <span class="nf">trim_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.trim_sql-1445"><a href="#Generator.trim_sql-1445"><span class="linenos">1445</span></a> <span class="n">trim_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"position"</span><span class="p">)</span> +</span><span id="Generator.trim_sql-1446"><a href="#Generator.trim_sql-1446"><span class="linenos">1446</span></a> +</span><span id="Generator.trim_sql-1447"><a href="#Generator.trim_sql-1447"><span class="linenos">1447</span></a> <span class="k">if</span> <span class="n">trim_type</span> <span class="o">==</span> <span class="s2">"LEADING"</span><span class="p">:</span> +</span><span id="Generator.trim_sql-1448"><a href="#Generator.trim_sql-1448"><span class="linenos">1448</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'LTRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.trim_sql-1449"><a href="#Generator.trim_sql-1449"><span class="linenos">1449</span></a> <span class="k">elif</span> <span class="n">trim_type</span> <span class="o">==</span> <span class="s2">"TRAILING"</span><span class="p">:</span> +</span><span id="Generator.trim_sql-1450"><a href="#Generator.trim_sql-1450"><span class="linenos">1450</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'RTRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.trim_sql-1451"><a href="#Generator.trim_sql-1451"><span class="linenos">1451</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.trim_sql-1452"><a href="#Generator.trim_sql-1452"><span class="linenos">1452</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="s1">'TRIM'</span><span class="p">)</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.concat_sql" class="classattr"> + <input id="Generator.concat_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">concat_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Concat">sqlglot.expressions.Concat</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.concat_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.concat_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.concat_sql-1454"><a href="#Generator.concat_sql-1454"><span class="linenos">1454</span></a> <span class="k">def</span> <span class="nf">concat_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.concat_sql-1455"><a href="#Generator.concat_sql-1455"><span class="linenos">1455</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Generator.concat_sql-1456"><a href="#Generator.concat_sql-1456"><span class="linenos">1456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="Generator.concat_sql-1457"><a href="#Generator.concat_sql-1457"><span class="linenos">1457</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.check_sql" class="classattr"> + <input id="Generator.check_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">check_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Check">sqlglot.expressions.Check</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.check_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.check_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.check_sql-1459"><a href="#Generator.check_sql-1459"><span class="linenos">1459</span></a> <span class="k">def</span> <span class="nf">check_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Check</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.check_sql-1460"><a href="#Generator.check_sql-1460"><span class="linenos">1460</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.check_sql-1461"><a href="#Generator.check_sql-1461"><span class="linenos">1461</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CHECK (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.foreignkey_sql" class="classattr"> + <input id="Generator.foreignkey_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">foreignkey_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#ForeignKey">sqlglot.expressions.ForeignKey</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.foreignkey_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.foreignkey_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.foreignkey_sql-1463"><a href="#Generator.foreignkey_sql-1463"><span class="linenos">1463</span></a> <span class="k">def</span> <span class="nf">foreignkey_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.foreignkey_sql-1464"><a href="#Generator.foreignkey_sql-1464"><span class="linenos">1464</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.foreignkey_sql-1465"><a href="#Generator.foreignkey_sql-1465"><span class="linenos">1465</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"reference"</span><span class="p">)</span> +</span><span id="Generator.foreignkey_sql-1466"><a href="#Generator.foreignkey_sql-1466"><span class="linenos">1466</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">reference</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">reference</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.foreignkey_sql-1467"><a href="#Generator.foreignkey_sql-1467"><span class="linenos">1467</span></a> <span class="n">delete</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"delete"</span><span class="p">)</span> +</span><span id="Generator.foreignkey_sql-1468"><a href="#Generator.foreignkey_sql-1468"><span class="linenos">1468</span></a> <span class="n">delete</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON DELETE </span><span class="si">{</span><span class="n">delete</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">delete</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.foreignkey_sql-1469"><a href="#Generator.foreignkey_sql-1469"><span class="linenos">1469</span></a> <span class="n">update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"update"</span><span class="p">)</span> +</span><span id="Generator.foreignkey_sql-1470"><a href="#Generator.foreignkey_sql-1470"><span class="linenos">1470</span></a> <span class="n">update</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON UPDATE </span><span class="si">{</span><span class="n">update</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">update</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.foreignkey_sql-1471"><a href="#Generator.foreignkey_sql-1471"><span class="linenos">1471</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"FOREIGN KEY (</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">reference</span><span class="si">}{</span><span class="n">delete</span><span class="si">}{</span><span class="n">update</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.primarykey_sql" class="classattr"> + <input id="Generator.primarykey_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">primarykey_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#ForeignKey">sqlglot.expressions.ForeignKey</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.primarykey_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.primarykey_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.primarykey_sql-1473"><a href="#Generator.primarykey_sql-1473"><span class="linenos">1473</span></a> <span class="k">def</span> <span class="nf">primarykey_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.primarykey_sql-1474"><a href="#Generator.primarykey_sql-1474"><span class="linenos">1474</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.primarykey_sql-1475"><a href="#Generator.primarykey_sql-1475"><span class="linenos">1475</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator.primarykey_sql-1476"><a href="#Generator.primarykey_sql-1476"><span class="linenos">1476</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.primarykey_sql-1477"><a href="#Generator.primarykey_sql-1477"><span class="linenos">1477</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"PRIMARY KEY (</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.unique_sql" class="classattr"> + <input id="Generator.unique_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unique_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Unique">sqlglot.expressions.Unique</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.unique_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.unique_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.unique_sql-1479"><a href="#Generator.unique_sql-1479"><span class="linenos">1479</span></a> <span class="k">def</span> <span class="nf">unique_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unique</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.unique_sql-1480"><a href="#Generator.unique_sql-1480"><span class="linenos">1480</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Generator.unique_sql-1481"><a href="#Generator.unique_sql-1481"><span class="linenos">1481</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"UNIQUE (</span><span class="si">{</span><span class="n">columns</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.if_sql" class="classattr"> + <input id="Generator.if_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">if_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#If">sqlglot.expressions.If</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.if_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.if_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.if_sql-1483"><a href="#Generator.if_sql-1483"><span class="linenos">1483</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.if_sql-1484"><a href="#Generator.if_sql-1484"><span class="linenos">1484</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">case_sql</span><span class="p">(</span> +</span><span id="Generator.if_sql-1485"><a href="#Generator.if_sql-1485"><span class="linenos">1485</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">(</span><span class="n">ifs</span><span class="o">=</span><span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()],</span> <span class="n">default</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"false"</span><span class="p">))</span> +</span><span id="Generator.if_sql-1486"><a href="#Generator.if_sql-1486"><span class="linenos">1486</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.in_sql" class="classattr"> + <input id="Generator.in_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">in_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#In">sqlglot.expressions.In</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.in_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.in_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.in_sql-1488"><a href="#Generator.in_sql-1488"><span class="linenos">1488</span></a> <span class="k">def</span> <span class="nf">in_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.in_sql-1489"><a href="#Generator.in_sql-1489"><span class="linenos">1489</span></a> <span class="n">query</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"query"</span><span class="p">)</span> +</span><span id="Generator.in_sql-1490"><a href="#Generator.in_sql-1490"><span class="linenos">1490</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unnest"</span><span class="p">)</span> +</span><span id="Generator.in_sql-1491"><a href="#Generator.in_sql-1491"><span class="linenos">1491</span></a> <span class="n">field</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"field"</span><span class="p">)</span> +</span><span id="Generator.in_sql-1492"><a href="#Generator.in_sql-1492"><span class="linenos">1492</span></a> <span class="n">is_global</span> <span class="o">=</span> <span class="s2">" GLOBAL"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"is_global"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.in_sql-1493"><a href="#Generator.in_sql-1493"><span class="linenos">1493</span></a> +</span><span id="Generator.in_sql-1494"><a href="#Generator.in_sql-1494"><span class="linenos">1494</span></a> <span class="k">if</span> <span class="n">query</span><span class="p">:</span> +</span><span id="Generator.in_sql-1495"><a href="#Generator.in_sql-1495"><span class="linenos">1495</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">query</span><span class="p">)</span> +</span><span id="Generator.in_sql-1496"><a href="#Generator.in_sql-1496"><span class="linenos">1496</span></a> <span class="k">elif</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="Generator.in_sql-1497"><a href="#Generator.in_sql-1497"><span class="linenos">1497</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">in_unnest_op</span><span class="p">(</span><span class="n">unnest</span><span class="p">)</span> +</span><span id="Generator.in_sql-1498"><a href="#Generator.in_sql-1498"><span class="linenos">1498</span></a> <span class="k">elif</span> <span class="n">field</span><span class="p">:</span> +</span><span id="Generator.in_sql-1499"><a href="#Generator.in_sql-1499"><span class="linenos">1499</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">field</span><span class="p">)</span> +</span><span id="Generator.in_sql-1500"><a href="#Generator.in_sql-1500"><span class="linenos">1500</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.in_sql-1501"><a href="#Generator.in_sql-1501"><span class="linenos">1501</span></a> <span class="n">in_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.in_sql-1502"><a href="#Generator.in_sql-1502"><span class="linenos">1502</span></a> +</span><span id="Generator.in_sql-1503"><a href="#Generator.in_sql-1503"><span class="linenos">1503</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">is_global</span><span class="si">}</span><span class="s2"> IN </span><span class="si">{</span><span class="n">in_sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.in_unnest_op" class="classattr"> + <input id="Generator.in_unnest_op-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">in_unnest_op</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">unnest</span><span class="p">:</span> <span class="n"><a href="expressions.html#Unnest">sqlglot.expressions.Unnest</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.in_unnest_op-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.in_unnest_op"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.in_unnest_op-1505"><a href="#Generator.in_unnest_op-1505"><span class="linenos">1505</span></a> <span class="k">def</span> <span class="nf">in_unnest_op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">unnest</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.in_unnest_op-1506"><a href="#Generator.in_unnest_op-1506"><span class="linenos">1506</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"(SELECT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">unnest</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.interval_sql" class="classattr"> + <input id="Generator.interval_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">interval_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Interval">sqlglot.expressions.Interval</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.interval_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.interval_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.interval_sql-1508"><a href="#Generator.interval_sql-1508"><span class="linenos">1508</span></a> <span class="k">def</span> <span class="nf">interval_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.interval_sql-1509"><a href="#Generator.interval_sql-1509"><span class="linenos">1509</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.interval_sql-1510"><a href="#Generator.interval_sql-1510"><span class="linenos">1510</span></a> <span class="k">if</span> <span class="n">this</span><span class="p">:</span> +</span><span id="Generator.interval_sql-1511"><a href="#Generator.interval_sql-1511"><span class="linenos">1511</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.interval_sql-1512"><a href="#Generator.interval_sql-1512"><span class="linenos">1512</span></a> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.interval_sql-1513"><a href="#Generator.interval_sql-1513"><span class="linenos">1513</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> +</span><span id="Generator.interval_sql-1514"><a href="#Generator.interval_sql-1514"><span class="linenos">1514</span></a> <span class="k">else</span> <span class="sa">f</span><span class="s2">" (</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Generator.interval_sql-1515"><a href="#Generator.interval_sql-1515"><span class="linenos">1515</span></a> <span class="p">)</span> +</span><span id="Generator.interval_sql-1516"><a href="#Generator.interval_sql-1516"><span class="linenos">1516</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.interval_sql-1517"><a href="#Generator.interval_sql-1517"><span class="linenos">1517</span></a> <span class="n">this</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Generator.interval_sql-1518"><a href="#Generator.interval_sql-1518"><span class="linenos">1518</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span> +</span><span id="Generator.interval_sql-1519"><a href="#Generator.interval_sql-1519"><span class="linenos">1519</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">unit</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.interval_sql-1520"><a href="#Generator.interval_sql-1520"><span class="linenos">1520</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"INTERVAL</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">unit</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.return_sql" class="classattr"> + <input id="Generator.return_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">return_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Return">sqlglot.expressions.Return</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.return_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.return_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.return_sql-1522"><a href="#Generator.return_sql-1522"><span class="linenos">1522</span></a> <span class="k">def</span> <span class="nf">return_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Return</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.return_sql-1523"><a href="#Generator.return_sql-1523"><span class="linenos">1523</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RETURN </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.reference_sql" class="classattr"> + <input id="Generator.reference_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">reference_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Reference">sqlglot.expressions.Reference</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.reference_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.reference_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.reference_sql-1525"><a href="#Generator.reference_sql-1525"><span class="linenos">1525</span></a> <span class="k">def</span> <span class="nf">reference_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Reference</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.reference_sql-1526"><a href="#Generator.reference_sql-1526"><span class="linenos">1526</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.reference_sql-1527"><a href="#Generator.reference_sql-1527"><span class="linenos">1527</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.reference_sql-1528"><a href="#Generator.reference_sql-1528"><span class="linenos">1528</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">expressions</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.reference_sql-1529"><a href="#Generator.reference_sql-1529"><span class="linenos">1529</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"options"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Generator.reference_sql-1530"><a href="#Generator.reference_sql-1530"><span class="linenos">1530</span></a> <span class="n">options</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">options</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.reference_sql-1531"><a href="#Generator.reference_sql-1531"><span class="linenos">1531</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"REFERENCES </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}{</span><span class="n">options</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.anonymous_sql" class="classattr"> + <input id="Generator.anonymous_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">anonymous_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Anonymous">sqlglot.expressions.Anonymous</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.anonymous_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.anonymous_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.anonymous_sql-1533"><a href="#Generator.anonymous_sql-1533"><span class="linenos">1533</span></a> <span class="k">def</span> <span class="nf">anonymous_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.anonymous_sql-1534"><a href="#Generator.anonymous_sql-1534"><span class="linenos">1534</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator.anonymous_sql-1535"><a href="#Generator.anonymous_sql-1535"><span class="linenos">1535</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">))</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">args</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.paren_sql" class="classattr"> + <input id="Generator.paren_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">paren_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Paren">sqlglot.expressions.Paren</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.paren_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.paren_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.paren_sql-1537"><a href="#Generator.paren_sql-1537"><span class="linenos">1537</span></a> <span class="k">def</span> <span class="nf">paren_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.paren_sql-1538"><a href="#Generator.paren_sql-1538"><span class="linenos">1538</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="Generator.paren_sql-1539"><a href="#Generator.paren_sql-1539"><span class="linenos">1539</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.paren_sql-1540"><a href="#Generator.paren_sql-1540"><span class="linenos">1540</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.paren_sql-1541"><a href="#Generator.paren_sql-1541"><span class="linenos">1541</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)),</span> <span class="n">sep</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Generator.paren_sql-1542"><a href="#Generator.paren_sql-1542"><span class="linenos">1542</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">sql</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="s1">')'</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">''</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.paren_sql-1543"><a href="#Generator.paren_sql-1543"><span class="linenos">1543</span></a> +</span><span id="Generator.paren_sql-1544"><a href="#Generator.paren_sql-1544"><span class="linenos">1544</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.neg_sql" class="classattr"> + <input id="Generator.neg_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">neg_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Neg">sqlglot.expressions.Neg</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.neg_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.neg_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.neg_sql-1546"><a href="#Generator.neg_sql-1546"><span class="linenos">1546</span></a> <span class="k">def</span> <span class="nf">neg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.neg_sql-1547"><a href="#Generator.neg_sql-1547"><span class="linenos">1547</span></a> <span class="c1"># This makes sure we don't convert "- - 5" to "--5", which is a comment</span> +</span><span id="Generator.neg_sql-1548"><a href="#Generator.neg_sql-1548"><span class="linenos">1548</span></a> <span class="n">this_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.neg_sql-1549"><a href="#Generator.neg_sql-1549"><span class="linenos">1549</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">" "</span> <span class="k">if</span> <span class="n">this_sql</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"-"</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.neg_sql-1550"><a href="#Generator.neg_sql-1550"><span class="linenos">1550</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"-</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">this_sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.not_sql" class="classattr"> + <input id="Generator.not_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">not_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Not">sqlglot.expressions.Not</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.not_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.not_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.not_sql-1552"><a href="#Generator.not_sql-1552"><span class="linenos">1552</span></a> <span class="k">def</span> <span class="nf">not_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.not_sql-1553"><a href="#Generator.not_sql-1553"><span class="linenos">1553</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.alias_sql" class="classattr"> + <input id="Generator.alias_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">alias_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Alias">sqlglot.expressions.Alias</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.alias_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.alias_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.alias_sql-1555"><a href="#Generator.alias_sql-1555"><span class="linenos">1555</span></a> <span class="k">def</span> <span class="nf">alias_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.alias_sql-1556"><a href="#Generator.alias_sql-1556"><span class="linenos">1556</span></a> <span class="n">to_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"alias"</span><span class="p">)</span> +</span><span id="Generator.alias_sql-1557"><a href="#Generator.alias_sql-1557"><span class="linenos">1557</span></a> <span class="n">to_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" AS </span><span class="si">{</span><span class="n">to_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">to_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.alias_sql-1558"><a href="#Generator.alias_sql-1558"><span class="linenos">1558</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}{</span><span class="n">to_sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.aliases_sql" class="classattr"> + <input id="Generator.aliases_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">aliases_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Aliases">sqlglot.expressions.Aliases</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.aliases_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.aliases_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.aliases_sql-1560"><a href="#Generator.aliases_sql-1560"><span class="linenos">1560</span></a> <span class="k">def</span> <span class="nf">aliases_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Aliases</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.aliases_sql-1561"><a href="#Generator.aliases_sql-1561"><span class="linenos">1561</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS (</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.attimezone_sql" class="classattr"> + <input id="Generator.attimezone_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">attimezone_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#AtTimeZone">sqlglot.expressions.AtTimeZone</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.attimezone_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.attimezone_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.attimezone_sql-1563"><a href="#Generator.attimezone_sql-1563"><span class="linenos">1563</span></a> <span class="k">def</span> <span class="nf">attimezone_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.attimezone_sql-1564"><a href="#Generator.attimezone_sql-1564"><span class="linenos">1564</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.attimezone_sql-1565"><a href="#Generator.attimezone_sql-1565"><span class="linenos">1565</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"zone"</span><span class="p">)</span> +</span><span id="Generator.attimezone_sql-1566"><a href="#Generator.attimezone_sql-1566"><span class="linenos">1566</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> AT TIME ZONE </span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.add_sql" class="classattr"> + <input id="Generator.add_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Add">sqlglot.expressions.Add</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.add_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.add_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.add_sql-1568"><a href="#Generator.add_sql-1568"><span class="linenos">1568</span></a> <span class="k">def</span> <span class="nf">add_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.add_sql-1569"><a href="#Generator.add_sql-1569"><span class="linenos">1569</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.and_sql" class="classattr"> + <input id="Generator.and_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">and_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#And">sqlglot.expressions.And</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.and_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.and_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.and_sql-1571"><a href="#Generator.and_sql-1571"><span class="linenos">1571</span></a> <span class="k">def</span> <span class="nf">and_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.and_sql-1572"><a href="#Generator.and_sql-1572"><span class="linenos">1572</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">connector_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"AND"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.connector_sql" class="classattr"> + <input id="Generator.connector_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">connector_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Connector">sqlglot.expressions.Connector</a></span>, </span><span class="param"><span class="n">op</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.connector_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.connector_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.connector_sql-1574"><a href="#Generator.connector_sql-1574"><span class="linenos">1574</span></a> <span class="k">def</span> <span class="nf">connector_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.connector_sql-1575"><a href="#Generator.connector_sql-1575"><span class="linenos">1575</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator.connector_sql-1576"><a href="#Generator.connector_sql-1576"><span class="linenos">1576</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">op</span><span class="p">)</span> +</span><span id="Generator.connector_sql-1577"><a href="#Generator.connector_sql-1577"><span class="linenos">1577</span></a> +</span><span id="Generator.connector_sql-1578"><a href="#Generator.connector_sql-1578"><span class="linenos">1578</span></a> <span class="n">sqls</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(</span><span class="n">unnest</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span> +</span><span id="Generator.connector_sql-1579"><a href="#Generator.connector_sql-1579"><span class="linenos">1579</span></a> <span class="n">sep</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">sqls</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator.connector_sql-1580"><a href="#Generator.connector_sql-1580"><span class="linenos">1580</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="si">}{</span><span class="n">op</span><span class="si">}</span><span class="s2"> "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">sqls</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitwiseand_sql" class="classattr"> + <input id="Generator.bitwiseand_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitwiseand_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitwiseAnd">sqlglot.expressions.BitwiseAnd</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitwiseand_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitwiseand_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitwiseand_sql-1582"><a href="#Generator.bitwiseand_sql-1582"><span class="linenos">1582</span></a> <span class="k">def</span> <span class="nf">bitwiseand_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitwiseand_sql-1583"><a href="#Generator.bitwiseand_sql-1583"><span class="linenos">1583</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"&"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitwiseleftshift_sql" class="classattr"> + <input id="Generator.bitwiseleftshift_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitwiseleftshift_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitwiseLeftShift">sqlglot.expressions.BitwiseLeftShift</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitwiseleftshift_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitwiseleftshift_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitwiseleftshift_sql-1585"><a href="#Generator.bitwiseleftshift_sql-1585"><span class="linenos">1585</span></a> <span class="k">def</span> <span class="nf">bitwiseleftshift_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitwiseleftshift_sql-1586"><a href="#Generator.bitwiseleftshift_sql-1586"><span class="linenos">1586</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<<"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitwisenot_sql" class="classattr"> + <input id="Generator.bitwisenot_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitwisenot_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitwiseNot">sqlglot.expressions.BitwiseNot</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitwisenot_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitwisenot_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitwisenot_sql-1588"><a href="#Generator.bitwisenot_sql-1588"><span class="linenos">1588</span></a> <span class="k">def</span> <span class="nf">bitwisenot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitwisenot_sql-1589"><a href="#Generator.bitwisenot_sql-1589"><span class="linenos">1589</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"~</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitwiseor_sql" class="classattr"> + <input id="Generator.bitwiseor_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitwiseor_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitwiseOr">sqlglot.expressions.BitwiseOr</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitwiseor_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitwiseor_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitwiseor_sql-1591"><a href="#Generator.bitwiseor_sql-1591"><span class="linenos">1591</span></a> <span class="k">def</span> <span class="nf">bitwiseor_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitwiseor_sql-1592"><a href="#Generator.bitwiseor_sql-1592"><span class="linenos">1592</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"|"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitwiserightshift_sql" class="classattr"> + <input id="Generator.bitwiserightshift_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitwiserightshift_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitwiseRightShift">sqlglot.expressions.BitwiseRightShift</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitwiserightshift_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitwiserightshift_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitwiserightshift_sql-1594"><a href="#Generator.bitwiserightshift_sql-1594"><span class="linenos">1594</span></a> <span class="k">def</span> <span class="nf">bitwiserightshift_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitwiserightshift_sql-1595"><a href="#Generator.bitwiserightshift_sql-1595"><span class="linenos">1595</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">>"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.bitwisexor_sql" class="classattr"> + <input id="Generator.bitwisexor_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">bitwisexor_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#BitwiseXor">sqlglot.expressions.BitwiseXor</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.bitwisexor_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.bitwisexor_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.bitwisexor_sql-1597"><a href="#Generator.bitwisexor_sql-1597"><span class="linenos">1597</span></a> <span class="k">def</span> <span class="nf">bitwisexor_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.bitwisexor_sql-1598"><a href="#Generator.bitwisexor_sql-1598"><span class="linenos">1598</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"^"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.cast_sql" class="classattr"> + <input id="Generator.cast_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">cast_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Cast">sqlglot.expressions.Cast</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.cast_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.cast_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.cast_sql-1600"><a href="#Generator.cast_sql-1600"><span class="linenos">1600</span></a> <span class="k">def</span> <span class="nf">cast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.cast_sql-1601"><a href="#Generator.cast_sql-1601"><span class="linenos">1601</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.currentdate_sql" class="classattr"> + <input id="Generator.currentdate_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">currentdate_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.currentdate_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.currentdate_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.currentdate_sql-1603"><a href="#Generator.currentdate_sql-1603"><span class="linenos">1603</span></a> <span class="k">def</span> <span class="nf">currentdate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.currentdate_sql-1604"><a href="#Generator.currentdate_sql-1604"><span class="linenos">1604</span></a> <span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.currentdate_sql-1605"><a href="#Generator.currentdate_sql-1605"><span class="linenos">1605</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"CURRENT_DATE(</span><span class="si">{</span><span class="n">zone</span><span class="si">}</span><span class="s2">)"</span> <span class="k">if</span> <span class="n">zone</span> <span class="k">else</span> <span class="s2">"CURRENT_DATE"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.collate_sql" class="classattr"> + <input id="Generator.collate_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">collate_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Collate">sqlglot.expressions.Collate</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.collate_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.collate_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.collate_sql-1607"><a href="#Generator.collate_sql-1607"><span class="linenos">1607</span></a> <span class="k">def</span> <span class="nf">collate_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Collate</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.collate_sql-1608"><a href="#Generator.collate_sql-1608"><span class="linenos">1608</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"COLLATE"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.command_sql" class="classattr"> + <input id="Generator.command_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">command_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Command">sqlglot.expressions.Command</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.command_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.command_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.command_sql-1610"><a href="#Generator.command_sql-1610"><span class="linenos">1610</span></a> <span class="k">def</span> <span class="nf">command_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.command_sql-1611"><a href="#Generator.command_sql-1611"><span class="linenos">1611</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s1">'expression'</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.transaction_sql" class="classattr"> + <input id="Generator.transaction_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">transaction_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">_</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.transaction_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.transaction_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.transaction_sql-1613"><a href="#Generator.transaction_sql-1613"><span class="linenos">1613</span></a> <span class="k">def</span> <span class="nf">transaction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.transaction_sql-1614"><a href="#Generator.transaction_sql-1614"><span class="linenos">1614</span></a> <span class="k">return</span> <span class="s2">"BEGIN"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.commit_sql" class="classattr"> + <input id="Generator.commit_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">commit_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Commit">sqlglot.expressions.Commit</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.commit_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.commit_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.commit_sql-1616"><a href="#Generator.commit_sql-1616"><span class="linenos">1616</span></a> <span class="k">def</span> <span class="nf">commit_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Commit</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.commit_sql-1617"><a href="#Generator.commit_sql-1617"><span class="linenos">1617</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"chain"</span><span class="p">)</span> +</span><span id="Generator.commit_sql-1618"><a href="#Generator.commit_sql-1618"><span class="linenos">1618</span></a> <span class="k">if</span> <span class="n">chain</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.commit_sql-1619"><a href="#Generator.commit_sql-1619"><span class="linenos">1619</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="s2">" AND CHAIN"</span> <span class="k">if</span> <span class="n">chain</span> <span class="k">else</span> <span class="s2">" AND NO CHAIN"</span> +</span><span id="Generator.commit_sql-1620"><a href="#Generator.commit_sql-1620"><span class="linenos">1620</span></a> +</span><span id="Generator.commit_sql-1621"><a href="#Generator.commit_sql-1621"><span class="linenos">1621</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COMMIT</span><span class="si">{</span><span class="n">chain</span><span class="w"> </span><span class="ow">or</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.rollback_sql" class="classattr"> + <input id="Generator.rollback_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rollback_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Rollback">sqlglot.expressions.Rollback</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.rollback_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.rollback_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.rollback_sql-1623"><a href="#Generator.rollback_sql-1623"><span class="linenos">1623</span></a> <span class="k">def</span> <span class="nf">rollback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Rollback</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.rollback_sql-1624"><a href="#Generator.rollback_sql-1624"><span class="linenos">1624</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"savepoint"</span><span class="p">)</span> +</span><span id="Generator.rollback_sql-1625"><a href="#Generator.rollback_sql-1625"><span class="linenos">1625</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" TO </span><span class="si">{</span><span class="n">savepoint</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">savepoint</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.rollback_sql-1626"><a href="#Generator.rollback_sql-1626"><span class="linenos">1626</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ROLLBACK</span><span class="si">{</span><span class="n">savepoint</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.altercolumn_sql" class="classattr"> + <input id="Generator.altercolumn_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">altercolumn_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#AlterColumn">sqlglot.expressions.AlterColumn</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.altercolumn_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.altercolumn_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.altercolumn_sql-1628"><a href="#Generator.altercolumn_sql-1628"><span class="linenos">1628</span></a> <span class="k">def</span> <span class="nf">altercolumn_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.altercolumn_sql-1629"><a href="#Generator.altercolumn_sql-1629"><span class="linenos">1629</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.altercolumn_sql-1630"><a href="#Generator.altercolumn_sql-1630"><span class="linenos">1630</span></a> +</span><span id="Generator.altercolumn_sql-1631"><a href="#Generator.altercolumn_sql-1631"><span class="linenos">1631</span></a> <span class="n">dtype</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"dtype"</span><span class="p">)</span> +</span><span id="Generator.altercolumn_sql-1632"><a href="#Generator.altercolumn_sql-1632"><span class="linenos">1632</span></a> <span class="k">if</span> <span class="n">dtype</span><span class="p">:</span> +</span><span id="Generator.altercolumn_sql-1633"><a href="#Generator.altercolumn_sql-1633"><span class="linenos">1633</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"collate"</span><span class="p">)</span> +</span><span id="Generator.altercolumn_sql-1634"><a href="#Generator.altercolumn_sql-1634"><span class="linenos">1634</span></a> <span class="n">collate</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" COLLATE </span><span class="si">{</span><span class="n">collate</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">collate</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.altercolumn_sql-1635"><a href="#Generator.altercolumn_sql-1635"><span class="linenos">1635</span></a> <span class="n">using</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"using"</span><span class="p">)</span> +</span><span id="Generator.altercolumn_sql-1636"><a href="#Generator.altercolumn_sql-1636"><span class="linenos">1636</span></a> <span class="n">using</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" USING </span><span class="si">{</span><span class="n">using</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">using</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.altercolumn_sql-1637"><a href="#Generator.altercolumn_sql-1637"><span class="linenos">1637</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> TYPE </span><span class="si">{</span><span class="n">dtype</span><span class="si">}{</span><span class="n">collate</span><span class="si">}{</span><span class="n">using</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.altercolumn_sql-1638"><a href="#Generator.altercolumn_sql-1638"><span class="linenos">1638</span></a> +</span><span id="Generator.altercolumn_sql-1639"><a href="#Generator.altercolumn_sql-1639"><span class="linenos">1639</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">)</span> +</span><span id="Generator.altercolumn_sql-1640"><a href="#Generator.altercolumn_sql-1640"><span class="linenos">1640</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Generator.altercolumn_sql-1641"><a href="#Generator.altercolumn_sql-1641"><span class="linenos">1641</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> SET DEFAULT </span><span class="si">{</span><span class="n">default</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.altercolumn_sql-1642"><a href="#Generator.altercolumn_sql-1642"><span class="linenos">1642</span></a> +</span><span id="Generator.altercolumn_sql-1643"><a href="#Generator.altercolumn_sql-1643"><span class="linenos">1643</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"drop"</span><span class="p">):</span> +</span><span id="Generator.altercolumn_sql-1644"><a href="#Generator.altercolumn_sql-1644"><span class="linenos">1644</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="s2">"Unsupported ALTER COLUMN syntax"</span><span class="p">)</span> +</span><span id="Generator.altercolumn_sql-1645"><a href="#Generator.altercolumn_sql-1645"><span class="linenos">1645</span></a> +</span><span id="Generator.altercolumn_sql-1646"><a href="#Generator.altercolumn_sql-1646"><span class="linenos">1646</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER COLUMN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> DROP DEFAULT"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.renametable_sql" class="classattr"> + <input id="Generator.renametable_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">renametable_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#RenameTable">sqlglot.expressions.RenameTable</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.renametable_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.renametable_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.renametable_sql-1648"><a href="#Generator.renametable_sql-1648"><span class="linenos">1648</span></a> <span class="k">def</span> <span class="nf">renametable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.renametable_sql-1649"><a href="#Generator.renametable_sql-1649"><span class="linenos">1649</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.renametable_sql-1650"><a href="#Generator.renametable_sql-1650"><span class="linenos">1650</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"RENAME TO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.altertable_sql" class="classattr"> + <input id="Generator.altertable_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">altertable_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#AlterTable">sqlglot.expressions.AlterTable</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.altertable_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.altertable_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.altertable_sql-1652"><a href="#Generator.altertable_sql-1652"><span class="linenos">1652</span></a> <span class="k">def</span> <span class="nf">altertable_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AlterTable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.altertable_sql-1653"><a href="#Generator.altertable_sql-1653"><span class="linenos">1653</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"actions"</span><span class="p">]</span> +</span><span id="Generator.altertable_sql-1654"><a href="#Generator.altertable_sql-1654"><span class="linenos">1654</span></a> +</span><span id="Generator.altertable_sql-1655"><a href="#Generator.altertable_sql-1655"><span class="linenos">1655</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">):</span> +</span><span id="Generator.altertable_sql-1656"><a href="#Generator.altertable_sql-1656"><span class="linenos">1656</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ADD COLUMN "</span><span class="p">)</span> +</span><span id="Generator.altertable_sql-1657"><a href="#Generator.altertable_sql-1657"><span class="linenos">1657</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">):</span> +</span><span id="Generator.altertable_sql-1658"><a href="#Generator.altertable_sql-1658"><span class="linenos">1658</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"ADD COLUMNS "</span><span class="p">)</span> +</span><span id="Generator.altertable_sql-1659"><a href="#Generator.altertable_sql-1659"><span class="linenos">1659</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">actions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">):</span> +</span><span id="Generator.altertable_sql-1660"><a href="#Generator.altertable_sql-1660"><span class="linenos">1660</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.altertable_sql-1661"><a href="#Generator.altertable_sql-1661"><span class="linenos">1661</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.altertable_sql-1662"><a href="#Generator.altertable_sql-1662"><span class="linenos">1662</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"actions"</span><span class="p">)</span> +</span><span id="Generator.altertable_sql-1663"><a href="#Generator.altertable_sql-1663"><span class="linenos">1663</span></a> +</span><span id="Generator.altertable_sql-1664"><a href="#Generator.altertable_sql-1664"><span class="linenos">1664</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS"</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.altertable_sql-1665"><a href="#Generator.altertable_sql-1665"><span class="linenos">1665</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"ALTER TABLE</span><span class="si">{</span><span class="n">exists</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">actions</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.droppartition_sql" class="classattr"> + <input id="Generator.droppartition_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">droppartition_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#DropPartition">sqlglot.expressions.DropPartition</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.droppartition_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.droppartition_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.droppartition_sql-1667"><a href="#Generator.droppartition_sql-1667"><span class="linenos">1667</span></a> <span class="k">def</span> <span class="nf">droppartition_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DropPartition</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.droppartition_sql-1668"><a href="#Generator.droppartition_sql-1668"><span class="linenos">1668</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.droppartition_sql-1669"><a href="#Generator.droppartition_sql-1669"><span class="linenos">1669</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="s2">" IF EXISTS "</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">" "</span> +</span><span id="Generator.droppartition_sql-1670"><a href="#Generator.droppartition_sql-1670"><span class="linenos">1670</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DROP</span><span class="si">{</span><span class="n">exists</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.addconstraint_sql" class="classattr"> + <input id="Generator.addconstraint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">addconstraint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#AddConstraint">sqlglot.expressions.AddConstraint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.addconstraint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.addconstraint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.addconstraint_sql-1672"><a href="#Generator.addconstraint_sql-1672"><span class="linenos">1672</span></a> <span class="k">def</span> <span class="nf">addconstraint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.addconstraint_sql-1673"><a href="#Generator.addconstraint_sql-1673"><span class="linenos">1673</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.addconstraint_sql-1674"><a href="#Generator.addconstraint_sql-1674"><span class="linenos">1674</span></a> <span class="n">expression_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">)</span> +</span><span id="Generator.addconstraint_sql-1675"><a href="#Generator.addconstraint_sql-1675"><span class="linenos">1675</span></a> <span class="n">add_constraint</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"ADD CONSTRAINT </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">"ADD"</span> +</span><span id="Generator.addconstraint_sql-1676"><a href="#Generator.addconstraint_sql-1676"><span class="linenos">1676</span></a> +</span><span id="Generator.addconstraint_sql-1677"><a href="#Generator.addconstraint_sql-1677"><span class="linenos">1677</span></a> <span class="n">enforced</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"enforced"</span><span class="p">)</span> +</span><span id="Generator.addconstraint_sql-1678"><a href="#Generator.addconstraint_sql-1678"><span class="linenos">1678</span></a> <span class="k">if</span> <span class="n">enforced</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Generator.addconstraint_sql-1679"><a href="#Generator.addconstraint_sql-1679"><span class="linenos">1679</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">add_constraint</span><span class="si">}</span><span class="s2"> CHECK (</span><span class="si">{</span><span class="n">expression_</span><span class="si">}</span><span class="s2">)</span><span class="si">{</span><span class="s1">' ENFORCED'</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">enforced</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.addconstraint_sql-1680"><a href="#Generator.addconstraint_sql-1680"><span class="linenos">1680</span></a> +</span><span id="Generator.addconstraint_sql-1681"><a href="#Generator.addconstraint_sql-1681"><span class="linenos">1681</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">add_constraint</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expression_</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.distinct_sql" class="classattr"> + <input id="Generator.distinct_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">distinct_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Distinct">sqlglot.expressions.Distinct</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.distinct_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.distinct_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.distinct_sql-1683"><a href="#Generator.distinct_sql-1683"><span class="linenos">1683</span></a> <span class="k">def</span> <span class="nf">distinct_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.distinct_sql-1684"><a href="#Generator.distinct_sql-1684"><span class="linenos">1684</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.distinct_sql-1685"><a href="#Generator.distinct_sql-1685"><span class="linenos">1685</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.distinct_sql-1686"><a href="#Generator.distinct_sql-1686"><span class="linenos">1686</span></a> +</span><span id="Generator.distinct_sql-1687"><a href="#Generator.distinct_sql-1687"><span class="linenos">1687</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"on"</span><span class="p">)</span> +</span><span id="Generator.distinct_sql-1688"><a href="#Generator.distinct_sql-1688"><span class="linenos">1688</span></a> <span class="n">on</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" ON </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">on</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.distinct_sql-1689"><a href="#Generator.distinct_sql-1689"><span class="linenos">1689</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"DISTINCT</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">on</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.ignorenulls_sql" class="classattr"> + <input id="Generator.ignorenulls_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ignorenulls_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#IgnoreNulls">sqlglot.expressions.IgnoreNulls</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.ignorenulls_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.ignorenulls_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.ignorenulls_sql-1691"><a href="#Generator.ignorenulls_sql-1691"><span class="linenos">1691</span></a> <span class="k">def</span> <span class="nf">ignorenulls_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.ignorenulls_sql-1692"><a href="#Generator.ignorenulls_sql-1692"><span class="linenos">1692</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> IGNORE NULLS"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.respectnulls_sql" class="classattr"> + <input id="Generator.respectnulls_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">respectnulls_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#RespectNulls">sqlglot.expressions.RespectNulls</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.respectnulls_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.respectnulls_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.respectnulls_sql-1694"><a href="#Generator.respectnulls_sql-1694"><span class="linenos">1694</span></a> <span class="k">def</span> <span class="nf">respectnulls_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">RespectNulls</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.respectnulls_sql-1695"><a href="#Generator.respectnulls_sql-1695"><span class="linenos">1695</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> RESPECT NULLS"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.intdiv_sql" class="classattr"> + <input id="Generator.intdiv_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">intdiv_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#IntDiv">sqlglot.expressions.IntDiv</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.intdiv_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.intdiv_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.intdiv_sql-1697"><a href="#Generator.intdiv_sql-1697"><span class="linenos">1697</span></a> <span class="k">def</span> <span class="nf">intdiv_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.intdiv_sql-1698"><a href="#Generator.intdiv_sql-1698"><span class="linenos">1698</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span> +</span><span id="Generator.intdiv_sql-1699"><a href="#Generator.intdiv_sql-1699"><span class="linenos">1699</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="Generator.intdiv_sql-1700"><a href="#Generator.intdiv_sql-1700"><span class="linenos">1700</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">expression</span><span class="p">),</span> +</span><span id="Generator.intdiv_sql-1701"><a href="#Generator.intdiv_sql-1701"><span class="linenos">1701</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="Generator.intdiv_sql-1702"><a href="#Generator.intdiv_sql-1702"><span class="linenos">1702</span></a> <span class="p">)</span> +</span><span id="Generator.intdiv_sql-1703"><a href="#Generator.intdiv_sql-1703"><span class="linenos">1703</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.dpipe_sql" class="classattr"> + <input id="Generator.dpipe_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">dpipe_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#DPipe">sqlglot.expressions.DPipe</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.dpipe_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.dpipe_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.dpipe_sql-1705"><a href="#Generator.dpipe_sql-1705"><span class="linenos">1705</span></a> <span class="k">def</span> <span class="nf">dpipe_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DPipe</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.dpipe_sql-1706"><a href="#Generator.dpipe_sql-1706"><span class="linenos">1706</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"||"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.div_sql" class="classattr"> + <input id="Generator.div_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">div_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Div">sqlglot.expressions.Div</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.div_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.div_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.div_sql-1708"><a href="#Generator.div_sql-1708"><span class="linenos">1708</span></a> <span class="k">def</span> <span class="nf">div_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.div_sql-1709"><a href="#Generator.div_sql-1709"><span class="linenos">1709</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"/"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.distance_sql" class="classattr"> + <input id="Generator.distance_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">distance_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Distance">sqlglot.expressions.Distance</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.distance_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.distance_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.distance_sql-1711"><a href="#Generator.distance_sql-1711"><span class="linenos">1711</span></a> <span class="k">def</span> <span class="nf">distance_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distance</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.distance_sql-1712"><a href="#Generator.distance_sql-1712"><span class="linenos">1712</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<->"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.dot_sql" class="classattr"> + <input id="Generator.dot_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">dot_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Dot">sqlglot.expressions.Dot</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.dot_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.dot_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.dot_sql-1714"><a href="#Generator.dot_sql-1714"><span class="linenos">1714</span></a> <span class="k">def</span> <span class="nf">dot_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.dot_sql-1715"><a href="#Generator.dot_sql-1715"><span class="linenos">1715</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.eq_sql" class="classattr"> + <input id="Generator.eq_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eq_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#EQ">sqlglot.expressions.EQ</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.eq_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.eq_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.eq_sql-1717"><a href="#Generator.eq_sql-1717"><span class="linenos">1717</span></a> <span class="k">def</span> <span class="nf">eq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.eq_sql-1718"><a href="#Generator.eq_sql-1718"><span class="linenos">1718</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"="</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.escape_sql" class="classattr"> + <input id="Generator.escape_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">escape_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Escape">sqlglot.expressions.Escape</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.escape_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.escape_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.escape_sql-1720"><a href="#Generator.escape_sql-1720"><span class="linenos">1720</span></a> <span class="k">def</span> <span class="nf">escape_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Escape</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.escape_sql-1721"><a href="#Generator.escape_sql-1721"><span class="linenos">1721</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"ESCAPE"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.glob_sql" class="classattr"> + <input id="Generator.glob_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">glob_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Glob">sqlglot.expressions.Glob</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.glob_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.glob_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.glob_sql-1723"><a href="#Generator.glob_sql-1723"><span class="linenos">1723</span></a> <span class="k">def</span> <span class="nf">glob_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Glob</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.glob_sql-1724"><a href="#Generator.glob_sql-1724"><span class="linenos">1724</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"GLOB"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.gt_sql" class="classattr"> + <input id="Generator.gt_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">gt_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#GT">sqlglot.expressions.GT</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.gt_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.gt_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.gt_sql-1726"><a href="#Generator.gt_sql-1726"><span class="linenos">1726</span></a> <span class="k">def</span> <span class="nf">gt_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.gt_sql-1727"><a href="#Generator.gt_sql-1727"><span class="linenos">1727</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.gte_sql" class="classattr"> + <input id="Generator.gte_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">gte_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#GTE">sqlglot.expressions.GTE</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.gte_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.gte_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.gte_sql-1729"><a href="#Generator.gte_sql-1729"><span class="linenos">1729</span></a> <span class="k">def</span> <span class="nf">gte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.gte_sql-1730"><a href="#Generator.gte_sql-1730"><span class="linenos">1730</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">">="</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.ilike_sql" class="classattr"> + <input id="Generator.ilike_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ilike_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#ILike">sqlglot.expressions.ILike</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.ilike_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.ilike_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.ilike_sql-1732"><a href="#Generator.ilike_sql-1732"><span class="linenos">1732</span></a> <span class="k">def</span> <span class="nf">ilike_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.ilike_sql-1733"><a href="#Generator.ilike_sql-1733"><span class="linenos">1733</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"ILIKE"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.is_sql" class="classattr"> + <input id="Generator.is_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">is_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Is">sqlglot.expressions.Is</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.is_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.is_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.is_sql-1735"><a href="#Generator.is_sql-1735"><span class="linenos">1735</span></a> <span class="k">def</span> <span class="nf">is_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.is_sql-1736"><a href="#Generator.is_sql-1736"><span class="linenos">1736</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.like_sql" class="classattr"> + <input id="Generator.like_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">like_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Like">sqlglot.expressions.Like</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.like_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.like_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.like_sql-1738"><a href="#Generator.like_sql-1738"><span class="linenos">1738</span></a> <span class="k">def</span> <span class="nf">like_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.like_sql-1739"><a href="#Generator.like_sql-1739"><span class="linenos">1739</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"LIKE"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.similarto_sql" class="classattr"> + <input id="Generator.similarto_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">similarto_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#SimilarTo">sqlglot.expressions.SimilarTo</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.similarto_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.similarto_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.similarto_sql-1741"><a href="#Generator.similarto_sql-1741"><span class="linenos">1741</span></a> <span class="k">def</span> <span class="nf">similarto_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">SimilarTo</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.similarto_sql-1742"><a href="#Generator.similarto_sql-1742"><span class="linenos">1742</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"SIMILAR TO"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.lt_sql" class="classattr"> + <input id="Generator.lt_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lt_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#LT">sqlglot.expressions.LT</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.lt_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.lt_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.lt_sql-1744"><a href="#Generator.lt_sql-1744"><span class="linenos">1744</span></a> <span class="k">def</span> <span class="nf">lt_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.lt_sql-1745"><a href="#Generator.lt_sql-1745"><span class="linenos">1745</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.lte_sql" class="classattr"> + <input id="Generator.lte_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lte_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#LTE">sqlglot.expressions.LTE</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.lte_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.lte_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.lte_sql-1747"><a href="#Generator.lte_sql-1747"><span class="linenos">1747</span></a> <span class="k">def</span> <span class="nf">lte_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.lte_sql-1748"><a href="#Generator.lte_sql-1748"><span class="linenos">1748</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<="</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.mod_sql" class="classattr"> + <input id="Generator.mod_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">mod_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Mod">sqlglot.expressions.Mod</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.mod_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.mod_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.mod_sql-1750"><a href="#Generator.mod_sql-1750"><span class="linenos">1750</span></a> <span class="k">def</span> <span class="nf">mod_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.mod_sql-1751"><a href="#Generator.mod_sql-1751"><span class="linenos">1751</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"%"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.mul_sql" class="classattr"> + <input id="Generator.mul_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">mul_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Mul">sqlglot.expressions.Mul</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.mul_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.mul_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.mul_sql-1753"><a href="#Generator.mul_sql-1753"><span class="linenos">1753</span></a> <span class="k">def</span> <span class="nf">mul_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.mul_sql-1754"><a href="#Generator.mul_sql-1754"><span class="linenos">1754</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"*"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.neq_sql" class="classattr"> + <input id="Generator.neq_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">neq_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#NEQ">sqlglot.expressions.NEQ</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.neq_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.neq_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.neq_sql-1756"><a href="#Generator.neq_sql-1756"><span class="linenos">1756</span></a> <span class="k">def</span> <span class="nf">neq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.neq_sql-1757"><a href="#Generator.neq_sql-1757"><span class="linenos">1757</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"<>"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.nullsafeeq_sql" class="classattr"> + <input id="Generator.nullsafeeq_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">nullsafeeq_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#NullSafeEQ">sqlglot.expressions.NullSafeEQ</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.nullsafeeq_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.nullsafeeq_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.nullsafeeq_sql-1759"><a href="#Generator.nullsafeeq_sql-1759"><span class="linenos">1759</span></a> <span class="k">def</span> <span class="nf">nullsafeeq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.nullsafeeq_sql-1760"><a href="#Generator.nullsafeeq_sql-1760"><span class="linenos">1760</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS NOT DISTINCT FROM"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.nullsafeneq_sql" class="classattr"> + <input id="Generator.nullsafeneq_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">nullsafeneq_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#NullSafeNEQ">sqlglot.expressions.NullSafeNEQ</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.nullsafeneq_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.nullsafeneq_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.nullsafeneq_sql-1762"><a href="#Generator.nullsafeneq_sql-1762"><span class="linenos">1762</span></a> <span class="k">def</span> <span class="nf">nullsafeneq_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.nullsafeneq_sql-1763"><a href="#Generator.nullsafeneq_sql-1763"><span class="linenos">1763</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"IS DISTINCT FROM"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.or_sql" class="classattr"> + <input id="Generator.or_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">or_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Or">sqlglot.expressions.Or</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.or_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.or_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.or_sql-1765"><a href="#Generator.or_sql-1765"><span class="linenos">1765</span></a> <span class="k">def</span> <span class="nf">or_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.or_sql-1766"><a href="#Generator.or_sql-1766"><span class="linenos">1766</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">connector_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"OR"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.slice_sql" class="classattr"> + <input id="Generator.slice_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">slice_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Slice">sqlglot.expressions.Slice</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.slice_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.slice_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.slice_sql-1768"><a href="#Generator.slice_sql-1768"><span class="linenos">1768</span></a> <span class="k">def</span> <span class="nf">slice_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.slice_sql-1769"><a href="#Generator.slice_sql-1769"><span class="linenos">1769</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">":"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.sub_sql" class="classattr"> + <input id="Generator.sub_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">sub_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Sub">sqlglot.expressions.Sub</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.sub_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.sub_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.sub_sql-1771"><a href="#Generator.sub_sql-1771"><span class="linenos">1771</span></a> <span class="k">def</span> <span class="nf">sub_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.sub_sql-1772"><a href="#Generator.sub_sql-1772"><span class="linenos">1772</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.trycast_sql" class="classattr"> + <input id="Generator.trycast_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">trycast_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#TryCast">sqlglot.expressions.TryCast</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.trycast_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.trycast_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.trycast_sql-1774"><a href="#Generator.trycast_sql-1774"><span class="linenos">1774</span></a> <span class="k">def</span> <span class="nf">trycast_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.trycast_sql-1775"><a href="#Generator.trycast_sql-1775"><span class="linenos">1775</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"TRY_CAST(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'to'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.use_sql" class="classattr"> + <input id="Generator.use_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">use_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Use">sqlglot.expressions.Use</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.use_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.use_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.use_sql-1777"><a href="#Generator.use_sql-1777"><span class="linenos">1777</span></a> <span class="k">def</span> <span class="nf">use_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Use</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.use_sql-1778"><a href="#Generator.use_sql-1778"><span class="linenos">1778</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator.use_sql-1779"><a href="#Generator.use_sql-1779"><span class="linenos">1779</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">kind</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.use_sql-1780"><a href="#Generator.use_sql-1780"><span class="linenos">1780</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.use_sql-1781"><a href="#Generator.use_sql-1781"><span class="linenos">1781</span></a> <span class="n">this</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">this</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.use_sql-1782"><a href="#Generator.use_sql-1782"><span class="linenos">1782</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"USE</span><span class="si">{</span><span class="n">kind</span><span class="si">}{</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.binary" class="classattr"> + <input id="Generator.binary-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">binary</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Binary">sqlglot.expressions.Binary</a></span>, </span><span class="param"><span class="n">op</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.binary-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.binary"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.binary-1784"><a href="#Generator.binary-1784"><span class="linenos">1784</span></a> <span class="k">def</span> <span class="nf">binary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.binary-1785"><a href="#Generator.binary-1785"><span class="linenos">1785</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">op</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.function_fallback_sql" class="classattr"> + <input id="Generator.function_fallback_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">function_fallback_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Func">sqlglot.expressions.Func</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.function_fallback_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.function_fallback_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.function_fallback_sql-1787"><a href="#Generator.function_fallback_sql-1787"><span class="linenos">1787</span></a> <span class="k">def</span> <span class="nf">function_fallback_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.function_fallback_sql-1788"><a href="#Generator.function_fallback_sql-1788"><span class="linenos">1788</span></a> <span class="n">args</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.function_fallback_sql-1789"><a href="#Generator.function_fallback_sql-1789"><span class="linenos">1789</span></a> <span class="k">for</span> <span class="n">arg_value</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Generator.function_fallback_sql-1790"><a href="#Generator.function_fallback_sql-1790"><span class="linenos">1790</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg_value</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="Generator.function_fallback_sql-1791"><a href="#Generator.function_fallback_sql-1791"><span class="linenos">1791</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">arg_value</span><span class="p">:</span> +</span><span id="Generator.function_fallback_sql-1792"><a href="#Generator.function_fallback_sql-1792"><span class="linenos">1792</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Generator.function_fallback_sql-1793"><a href="#Generator.function_fallback_sql-1793"><span class="linenos">1793</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.function_fallback_sql-1794"><a href="#Generator.function_fallback_sql-1794"><span class="linenos">1794</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">arg_value</span><span class="p">)</span> +</span><span id="Generator.function_fallback_sql-1795"><a href="#Generator.function_fallback_sql-1795"><span class="linenos">1795</span></a> +</span><span id="Generator.function_fallback_sql-1796"><a href="#Generator.function_fallback_sql-1796"><span class="linenos">1796</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">normalize_func</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">sql_name</span><span class="p">())</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.format_args" class="classattr"> + <input id="Generator.format_args-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">format_args</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.format_args-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.format_args"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.format_args-1798"><a href="#Generator.format_args-1798"><span class="linenos">1798</span></a> <span class="k">def</span> <span class="nf">format_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.format_args-1799"><a href="#Generator.format_args-1799"><span class="linenos">1799</span></a> <span class="n">arg_sqls</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="n">arg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Generator.format_args-1800"><a href="#Generator.format_args-1800"><span class="linenos">1800</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">text_width</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> <span class="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">_max_text_width</span><span class="p">:</span> +</span><span id="Generator.format_args-1801"><a href="#Generator.format_args-1801"><span class="linenos">1801</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="s2">"</span><span class="se">\n</span><span class="s2">"</span> <span class="o">+</span> <span class="sa">f</span><span class="s2">",</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> <span class="o">+</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">skip_last</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.format_args-1802"><a href="#Generator.format_args-1802"><span class="linenos">1802</span></a> <span class="k">return</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg_sqls</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.text_width" class="classattr"> + <input id="Generator.text_width-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">text_width</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">args</span><span class="p">:</span> <span class="n">Iterable</span></span><span class="return-annotation">) -> <span class="nb">int</span>:</span></span> + + <label class="view-source-button" for="Generator.text_width-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.text_width"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.text_width-1804"><a href="#Generator.text_width-1804"><span class="linenos">1804</span></a> <span class="k">def</span> <span class="nf">text_width</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="Generator.text_width-1805"><a href="#Generator.text_width-1805"><span class="linenos">1805</span></a> <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.format_time" class="classattr"> + <input id="Generator.format_time-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">format_time</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Generator.format_time-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.format_time"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.format_time-1807"><a href="#Generator.format_time-1807"><span class="linenos">1807</span></a> <span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Generator.format_time-1808"><a href="#Generator.format_time-1808"><span class="linenos">1808</span></a> <span class="k">return</span> <span class="n">format_time</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"format"</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_mapping</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_trie</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.expressions" class="classattr"> + <input id="Generator.expressions-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">expressions</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">key</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span>,</span><span class="param"> <span class="n">indent</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>,</span><span class="param"> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">', '</span>,</span><span class="param"> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">''</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.expressions-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.expressions"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.expressions-1810"><a href="#Generator.expressions-1810"><span class="linenos">1810</span></a> <span class="k">def</span> <span class="nf">expressions</span><span class="p">(</span> +</span><span id="Generator.expressions-1811"><a href="#Generator.expressions-1811"><span class="linenos">1811</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Generator.expressions-1812"><a href="#Generator.expressions-1812"><span class="linenos">1812</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> +</span><span id="Generator.expressions-1813"><a href="#Generator.expressions-1813"><span class="linenos">1813</span></a> <span class="n">key</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Generator.expressions-1814"><a href="#Generator.expressions-1814"><span class="linenos">1814</span></a> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Generator.expressions-1815"><a href="#Generator.expressions-1815"><span class="linenos">1815</span></a> <span class="n">indent</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Generator.expressions-1816"><a href="#Generator.expressions-1816"><span class="linenos">1816</span></a> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">,</span> +</span><span id="Generator.expressions-1817"><a href="#Generator.expressions-1817"><span class="linenos">1817</span></a> <span class="n">prefix</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">""</span><span class="p">,</span> +</span><span id="Generator.expressions-1818"><a href="#Generator.expressions-1818"><span class="linenos">1818</span></a> <span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.expressions-1819"><a href="#Generator.expressions-1819"><span class="linenos">1819</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span> <span class="ow">or</span> <span class="s2">"expressions"</span><span class="p">)</span> +</span><span id="Generator.expressions-1820"><a href="#Generator.expressions-1820"><span class="linenos">1820</span></a> +</span><span id="Generator.expressions-1821"><a href="#Generator.expressions-1821"><span class="linenos">1821</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="Generator.expressions-1822"><a href="#Generator.expressions-1822"><span class="linenos">1822</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Generator.expressions-1823"><a href="#Generator.expressions-1823"><span class="linenos">1823</span></a> +</span><span id="Generator.expressions-1824"><a href="#Generator.expressions-1824"><span class="linenos">1824</span></a> <span class="k">if</span> <span class="n">flat</span><span class="p">:</span> +</span><span id="Generator.expressions-1825"><a href="#Generator.expressions-1825"><span class="linenos">1825</span></a> <span class="k">return</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator.expressions-1826"><a href="#Generator.expressions-1826"><span class="linenos">1826</span></a> +</span><span id="Generator.expressions-1827"><a href="#Generator.expressions-1827"><span class="linenos">1827</span></a> <span class="n">num_sqls</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Generator.expressions-1828"><a href="#Generator.expressions-1828"><span class="linenos">1828</span></a> +</span><span id="Generator.expressions-1829"><a href="#Generator.expressions-1829"><span class="linenos">1829</span></a> <span class="c1"># These are calculated once in case we have the leading_comma / pretty option set, correspondingly</span> +</span><span id="Generator.expressions-1830"><a href="#Generator.expressions-1830"><span class="linenos">1830</span></a> <span class="n">pad</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">pad</span> +</span><span id="Generator.expressions-1831"><a href="#Generator.expressions-1831"><span class="linenos">1831</span></a> <span class="n">stripped_sep</span> <span class="o">=</span> <span class="n">sep</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="Generator.expressions-1832"><a href="#Generator.expressions-1832"><span class="linenos">1832</span></a> +</span><span id="Generator.expressions-1833"><a href="#Generator.expressions-1833"><span class="linenos">1833</span></a> <span class="n">result_sqls</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Generator.expressions-1834"><a href="#Generator.expressions-1834"><span class="linenos">1834</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="Generator.expressions-1835"><a href="#Generator.expressions-1835"><span class="linenos">1835</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Generator.expressions-1836"><a href="#Generator.expressions-1836"><span class="linenos">1836</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">maybe_comment</span><span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Generator.expressions-1837"><a href="#Generator.expressions-1837"><span class="linenos">1837</span></a> +</span><span id="Generator.expressions-1838"><a href="#Generator.expressions-1838"><span class="linenos">1838</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span><span class="p">:</span> +</span><span id="Generator.expressions-1839"><a href="#Generator.expressions-1839"><span class="linenos">1839</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_leading_comma</span><span class="p">:</span> +</span><span id="Generator.expressions-1840"><a href="#Generator.expressions-1840"><span class="linenos">1840</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="mi">0</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="n">pad</span><span class="si">}{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">comments</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.expressions-1841"><a href="#Generator.expressions-1841"><span class="linenos">1841</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.expressions-1842"><a href="#Generator.expressions-1842"><span class="linenos">1842</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Generator.expressions-1843"><a href="#Generator.expressions-1843"><span class="linenos">1843</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">stripped_sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">num_sqls</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">comments</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.expressions-1844"><a href="#Generator.expressions-1844"><span class="linenos">1844</span></a> <span class="p">)</span> +</span><span id="Generator.expressions-1845"><a href="#Generator.expressions-1845"><span class="linenos">1845</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.expressions-1846"><a href="#Generator.expressions-1846"><span class="linenos">1846</span></a> <span class="n">result_sqls</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">sql</span><span class="si">}{</span><span class="n">comments</span><span class="si">}{</span><span class="n">sep</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">num_sqls</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.expressions-1847"><a href="#Generator.expressions-1847"><span class="linenos">1847</span></a> +</span><span id="Generator.expressions-1848"><a href="#Generator.expressions-1848"><span class="linenos">1848</span></a> <span class="n">result_sql</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result_sqls</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">pretty</span> <span class="k">else</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">result_sqls</span><span class="p">)</span> +</span><span id="Generator.expressions-1849"><a href="#Generator.expressions-1849"><span class="linenos">1849</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">indent</span><span class="p">(</span><span class="n">result_sql</span><span class="p">,</span> <span class="n">skip_first</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="k">if</span> <span class="n">indent</span> <span class="k">else</span> <span class="n">result_sql</span> +</span></pre></div> + + + + + </div> + <div id="Generator.op_expressions" class="classattr"> + <input id="Generator.op_expressions-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">op_expressions</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.op_expressions-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.op_expressions"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.op_expressions-1851"><a href="#Generator.op_expressions-1851"><span class="linenos">1851</span></a> <span class="k">def</span> <span class="nf">op_expressions</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">flat</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.op_expressions-1852"><a href="#Generator.op_expressions-1852"><span class="linenos">1852</span></a> <span class="n">expressions_sql</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="n">flat</span><span class="p">)</span> +</span><span id="Generator.op_expressions-1853"><a href="#Generator.op_expressions-1853"><span class="linenos">1853</span></a> <span class="k">if</span> <span class="n">flat</span><span class="p">:</span> +</span><span id="Generator.op_expressions-1854"><a href="#Generator.op_expressions-1854"><span class="linenos">1854</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">op</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.op_expressions-1855"><a href="#Generator.op_expressions-1855"><span class="linenos">1855</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">op</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">expressions_sql</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}{</span><span class="n">expressions_sql</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.naked_property" class="classattr"> + <input id="Generator.naked_property-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">naked_property</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Property">sqlglot.expressions.Property</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.naked_property-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.naked_property"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.naked_property-1857"><a href="#Generator.naked_property-1857"><span class="linenos">1857</span></a> <span class="k">def</span> <span class="nf">naked_property</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.naked_property-1858"><a href="#Generator.naked_property-1858"><span class="linenos">1858</span></a> <span class="n">property_name</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">PROPERTY_TO_NAME</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="Generator.naked_property-1859"><a href="#Generator.naked_property-1859"><span class="linenos">1859</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">property_name</span><span class="p">:</span> +</span><span id="Generator.naked_property-1860"><a href="#Generator.naked_property-1860"><span class="linenos">1860</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported property </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Generator.naked_property-1861"><a href="#Generator.naked_property-1861"><span class="linenos">1861</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">property_name</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.set_operation" class="classattr"> + <input id="Generator.set_operation-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">set_operation</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>, </span><span class="param"><span class="n">op</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.set_operation-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.set_operation"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.set_operation-1863"><a href="#Generator.set_operation-1863"><span class="linenos">1863</span></a> <span class="k">def</span> <span class="nf">set_operation</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">op</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.set_operation-1864"><a href="#Generator.set_operation-1864"><span class="linenos">1864</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.set_operation-1865"><a href="#Generator.set_operation-1865"><span class="linenos">1865</span></a> <span class="n">op</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">seg</span><span class="p">(</span><span class="n">op</span><span class="p">)</span> +</span><span id="Generator.set_operation-1866"><a href="#Generator.set_operation-1866"><span class="linenos">1866</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">query_modifiers</span><span class="p">(</span> +</span><span id="Generator.set_operation-1867"><a href="#Generator.set_operation-1867"><span class="linenos">1867</span></a> <span class="n">expression</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">op</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.set_operation-1868"><a href="#Generator.set_operation-1868"><span class="linenos">1868</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.tag_sql" class="classattr"> + <input id="Generator.tag_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">tag_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Tag">sqlglot.expressions.Tag</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.tag_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.tag_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.tag_sql-1870"><a href="#Generator.tag_sql-1870"><span class="linenos">1870</span></a> <span class="k">def</span> <span class="nf">tag_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tag</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.tag_sql-1871"><a href="#Generator.tag_sql-1871"><span class="linenos">1871</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'prefix'</span><span class="p">)</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}{</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'postfix'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.token_sql" class="classattr"> + <input id="Generator.token_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">token_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">token_type</span><span class="p">:</span> <span class="n"><a href="tokens.html#TokenType">sqlglot.tokens.TokenType</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.token_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.token_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.token_sql-1873"><a href="#Generator.token_sql-1873"><span class="linenos">1873</span></a> <span class="k">def</span> <span class="nf">token_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.token_sql-1874"><a href="#Generator.token_sql-1874"><span class="linenos">1874</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">TOKEN_MAPPING</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">token_type</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.userdefinedfunction_sql" class="classattr"> + <input id="Generator.userdefinedfunction_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">userdefinedfunction_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#UserDefinedFunction">sqlglot.expressions.UserDefinedFunction</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.userdefinedfunction_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.userdefinedfunction_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.userdefinedfunction_sql-1876"><a href="#Generator.userdefinedfunction_sql-1876"><span class="linenos">1876</span></a> <span class="k">def</span> <span class="nf">userdefinedfunction_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.userdefinedfunction_sql-1877"><a href="#Generator.userdefinedfunction_sql-1877"><span class="linenos">1877</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.userdefinedfunction_sql-1878"><a href="#Generator.userdefinedfunction_sql-1878"><span class="linenos">1878</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">no_identify</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Generator.userdefinedfunction_sql-1879"><a href="#Generator.userdefinedfunction_sql-1879"><span class="linenos">1879</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Generator.userdefinedfunction_sql-1880"><a href="#Generator.userdefinedfunction_sql-1880"><span class="linenos">1880</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"wrapped"</span><span class="p">)</span> <span class="k">else</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.userdefinedfunction_sql-1881"><a href="#Generator.userdefinedfunction_sql-1881"><span class="linenos">1881</span></a> <span class="p">)</span> +</span><span id="Generator.userdefinedfunction_sql-1882"><a href="#Generator.userdefinedfunction_sql-1882"><span class="linenos">1882</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.userdefinedfunctionkwarg_sql" class="classattr"> + <input id="Generator.userdefinedfunctionkwarg_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">userdefinedfunctionkwarg_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#UserDefinedFunctionKwarg">sqlglot.expressions.UserDefinedFunctionKwarg</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.userdefinedfunctionkwarg_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.userdefinedfunctionkwarg_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.userdefinedfunctionkwarg_sql-1884"><a href="#Generator.userdefinedfunctionkwarg_sql-1884"><span class="linenos">1884</span></a> <span class="k">def</span> <span class="nf">userdefinedfunctionkwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunctionKwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.userdefinedfunctionkwarg_sql-1885"><a href="#Generator.userdefinedfunctionkwarg_sql-1885"><span class="linenos">1885</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.userdefinedfunctionkwarg_sql-1886"><a href="#Generator.userdefinedfunctionkwarg_sql-1886"><span class="linenos">1886</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"kind"</span><span class="p">)</span> +</span><span id="Generator.userdefinedfunctionkwarg_sql-1887"><a href="#Generator.userdefinedfunctionkwarg_sql-1887"><span class="linenos">1887</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">kind</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.joinhint_sql" class="classattr"> + <input id="Generator.joinhint_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">joinhint_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#JoinHint">sqlglot.expressions.JoinHint</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.joinhint_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.joinhint_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.joinhint_sql-1889"><a href="#Generator.joinhint_sql-1889"><span class="linenos">1889</span></a> <span class="k">def</span> <span class="nf">joinhint_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.joinhint_sql-1890"><a href="#Generator.joinhint_sql-1890"><span class="linenos">1890</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.joinhint_sql-1891"><a href="#Generator.joinhint_sql-1891"><span class="linenos">1891</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Generator.joinhint_sql-1892"><a href="#Generator.joinhint_sql-1892"><span class="linenos">1892</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2">(</span><span class="si">{</span><span class="n">expressions</span><span class="si">}</span><span class="s2">)"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.kwarg_sql" class="classattr"> + <input id="Generator.kwarg_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">kwarg_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Kwarg">sqlglot.expressions.Kwarg</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.kwarg_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.kwarg_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.kwarg_sql-1894"><a href="#Generator.kwarg_sql-1894"><span class="linenos">1894</span></a> <span class="k">def</span> <span class="nf">kwarg_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Kwarg</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.kwarg_sql-1895"><a href="#Generator.kwarg_sql-1895"><span class="linenos">1895</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"=>"</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Generator.when_sql" class="classattr"> + <input id="Generator.when_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">when_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#When">sqlglot.expressions.When</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.when_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.when_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.when_sql-1897"><a href="#Generator.when_sql-1897"><span class="linenos">1897</span></a> <span class="k">def</span> <span class="nf">when_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">When</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.when_sql-1898"><a href="#Generator.when_sql-1898"><span class="linenos">1898</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.when_sql-1899"><a href="#Generator.when_sql-1899"><span class="linenos">1899</span></a> <span class="n">then_expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"then"</span><span class="p">)</span> +</span><span id="Generator.when_sql-1900"><a href="#Generator.when_sql-1900"><span class="linenos">1900</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">):</span> +</span><span id="Generator.when_sql-1901"><a href="#Generator.when_sql-1901"><span class="linenos">1901</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"INSERT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.when_sql-1902"><a href="#Generator.when_sql-1902"><span class="linenos">1902</span></a> <span class="k">if</span> <span class="s2">"expression"</span> <span class="ow">in</span> <span class="n">then_expression</span><span class="o">.</span><span class="n">args</span><span class="p">:</span> +</span><span id="Generator.when_sql-1903"><a href="#Generator.when_sql-1903"><span class="linenos">1903</span></a> <span class="n">then</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" VALUES </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expression'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.when_sql-1904"><a href="#Generator.when_sql-1904"><span class="linenos">1904</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">):</span> +</span><span id="Generator.when_sql-1905"><a href="#Generator.when_sql-1905"><span class="linenos">1905</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">then_expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="Generator.when_sql-1906"><a href="#Generator.when_sql-1906"><span class="linenos">1906</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'expressions'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.when_sql-1907"><a href="#Generator.when_sql-1907"><span class="linenos">1907</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.when_sql-1908"><a href="#Generator.when_sql-1908"><span class="linenos">1908</span></a> <span class="n">then</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UPDATE SET </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">then_expression</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.when_sql-1909"><a href="#Generator.when_sql-1909"><span class="linenos">1909</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Generator.when_sql-1910"><a href="#Generator.when_sql-1910"><span class="linenos">1910</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">then_expression</span><span class="p">)</span> +</span><span id="Generator.when_sql-1911"><a href="#Generator.when_sql-1911"><span class="linenos">1911</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"WHEN </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">then</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + <div id="Generator.merge_sql" class="classattr"> + <input id="Generator.merge_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">merge_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Merge">sqlglot.expressions.Merge</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Generator.merge_sql-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Generator.merge_sql"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Generator.merge_sql-1913"><a href="#Generator.merge_sql-1913"><span class="linenos">1913</span></a> <span class="k">def</span> <span class="nf">merge_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Merge</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Generator.merge_sql-1914"><a href="#Generator.merge_sql-1914"><span class="linenos">1914</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Generator.merge_sql-1915"><a href="#Generator.merge_sql-1915"><span class="linenos">1915</span></a> <span class="n">using</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"USING </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'using'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.merge_sql-1916"><a href="#Generator.merge_sql-1916"><span class="linenos">1916</span></a> <span class="n">on</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"ON </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'on'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Generator.merge_sql-1917"><a href="#Generator.merge_sql-1917"><span class="linenos">1917</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"MERGE INTO </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">using</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="n">sep</span><span class="o">=</span><span class="s1">' '</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/helper.html b/docs/sqlglot/helper.html new file mode 100644 index 0000000..bf8994f --- /dev/null +++ b/docs/sqlglot/helper.html @@ -0,0 +1,1651 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.helper API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#AutoName">AutoName</a> + <ul class="memberlist"> + </ul> + + </li> + <li> + <a class="function" href="#seq_get">seq_get</a> + </li> + <li> + <a class="function" href="#ensure_list">ensure_list</a> + </li> + <li> + <a class="function" href="#ensure_collection">ensure_collection</a> + </li> + <li> + <a class="function" href="#csv">csv</a> + </li> + <li> + <a class="function" href="#subclasses">subclasses</a> + </li> + <li> + <a class="function" href="#apply_index_offset">apply_index_offset</a> + </li> + <li> + <a class="function" href="#camel_to_snake_case">camel_to_snake_case</a> + </li> + <li> + <a class="function" href="#while_changing">while_changing</a> + </li> + <li> + <a class="function" href="#tsort">tsort</a> + </li> + <li> + <a class="function" href="#open_file">open_file</a> + </li> + <li> + <a class="function" href="#csv_reader">csv_reader</a> + </li> + <li> + <a class="function" href="#find_new_name">find_new_name</a> + </li> + <li> + <a class="function" href="#object_to_dict">object_to_dict</a> + </li> + <li> + <a class="function" href="#split_num_words">split_num_words</a> + </li> + <li> + <a class="function" href="#is_iterable">is_iterable</a> + </li> + <li> + <a class="function" href="#flatten">flatten</a> + </li> + <li> + <a class="function" href="#count_params">count_params</a> + </li> + <li> + <a class="function" href="#dict_depth">dict_depth</a> + </li> + <li> + <a class="function" href="#first">first</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/helper.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.helper </h1> + + + <input id="mod-helper-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-helper-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">inspect</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">logging</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">import</span> <span class="nn">re</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">import</span> <span class="nn">sys</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">collections.abc</span> <span class="kn">import</span> <span class="n">Collection</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">contextlib</span> <span class="kn">import</span> <span class="n">contextmanager</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">copy</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">Expression</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="n">T</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"T"</span><span class="p">)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">E</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"E"</span><span class="p">,</span> <span class="n">bound</span><span class="o">=</span><span class="n">Expression</span><span class="p">)</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="n">CAMEL_CASE_PATTERN</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="s2">"(?<!^)(?=[A-Z])"</span><span class="p">)</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="n">PYTHON_VERSION</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">version_info</span><span class="p">[:</span><span class="mi">2</span><span class="p">]</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"sqlglot"</span><span class="p">)</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="k">class</span> <span class="nc">AutoName</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="w"> </span><span class="sd">"""This is used for creating enum classes where `auto()` is the string form of the corresponding value's name."""</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">def</span> <span class="nf">_generate_next_value_</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">_start</span><span class="p">,</span> <span class="n">_count</span><span class="p">,</span> <span class="n">_last_values</span><span class="p">):</span> <span class="c1"># type: ignore</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">return</span> <span class="n">name</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="k">def</span> <span class="nf">seq_get</span><span class="p">(</span><span class="n">seq</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">T</span><span class="p">],</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="w"> </span><span class="sd">"""Returns the value in `seq` at position `index`, or `None` if `index` is out of bounds."""</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">return</span> <span class="n">seq</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="k">def</span> <span class="nf">ensure_list</span><span class="p">(</span><span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="o">...</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="k">def</span> <span class="nf">ensure_list</span><span class="p">(</span><span class="n">value</span><span class="p">:</span> <span class="n">T</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="o">...</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="k">def</span> <span class="nf">ensure_list</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> Ensures that a value is a list, otherwise casts or wraps it into one.</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="sd"> Args:</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> value: the value of interest.</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> Returns:</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="sd"> The value cast as a list if it's a list or a tuple, or else the value wrapped in a list.</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="sd"> """</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)):</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="k">def</span> <span class="nf">ensure_collection</span><span class="p">(</span><span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="o">...</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a><span class="nd">@t</span><span class="o">.</span><span class="n">overload</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="k">def</span> <span class="nf">ensure_collection</span><span class="p">(</span><span class="n">value</span><span class="p">:</span> <span class="n">T</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="o">...</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="k">def</span> <span class="nf">ensure_collection</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd"> Ensures that a value is a collection (excluding `str` and `bytes`), otherwise wraps it into a list.</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="sd"> Args:</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a><span class="sd"> value: the value of interest.</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="sd"> Returns:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a><span class="sd"> The value if it's a collection, or else the value wrapped in a list.</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a><span class="sd"> """</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">value</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Collection</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">))</span> <span class="k">else</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="p">)</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a><span class="k">def</span> <span class="nf">csv</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a><span class="sd"> Formats any number of string arguments as CSV.</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a><span class="sd"> Args:</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a><span class="sd"> args: the string arguments to format.</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a><span class="sd"> sep: the argument separator.</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a><span class="sd"> Returns:</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a><span class="sd"> The arguments formatted as a CSV string.</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a><span class="sd"> """</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="n">arg</span><span class="p">)</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="k">def</span> <span class="nf">subclasses</span><span class="p">(</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">module_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">classes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">exclude</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">(),</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">]:</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a><span class="sd"> Returns all subclasses for a collection of classes, possibly excluding some of them.</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a><span class="sd"> Args:</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a><span class="sd"> module_name: the name of the module to search for subclasses in.</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a><span class="sd"> classes: class(es) we want to find the subclasses of.</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a><span class="sd"> exclude: class(es) we want to exclude from the returned list.</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a><span class="sd"> Returns:</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a><span class="sd"> The target subclasses.</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a><span class="sd"> """</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">obj</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">inspect</span><span class="o">.</span><span class="n">getmembers</span><span class="p">(</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span><span class="p">[</span><span class="n">module_name</span><span class="p">],</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">lambda</span> <span class="n">obj</span><span class="p">:</span> <span class="n">inspect</span><span class="o">.</span><span class="n">isclass</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">classes</span><span class="p">)</span> <span class="ow">and</span> <span class="n">obj</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">exclude</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="p">)</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="p">]</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a><span class="k">def</span> <span class="nf">apply_index_offset</span><span class="p">(</span><span class="n">expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">E</span><span class="p">]],</span> <span class="n">offset</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">E</span><span class="p">]]:</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a><span class="sd"> Applies an offset to a given integer literal expression.</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a><span class="sd"> Args:</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a><span class="sd"> expressions: the expression the offset will be applied to, wrapped in a list.</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a><span class="sd"> offset: the offset that will be applied.</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="sd"> Returns:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a><span class="sd"> The original expression with the offset applied to it, wrapped in a list. If the provided</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a><span class="sd"> `expressions` argument contains more than one expressions, it's returned unaffected.</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a><span class="sd"> """</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">offset</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">return</span> <span class="n">expressions</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_int</span><span class="p">:</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">"Applying array index offset (</span><span class="si">%s</span><span class="s2">)"</span><span class="p">,</span> <span class="n">offset</span><span class="p">)</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"this"</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">expression</span><span class="p">]</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">return</span> <span class="n">expressions</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a><span class="k">def</span> <span class="nf">camel_to_snake_case</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a><span class="w"> </span><span class="sd">"""Converts `name` from camelCase to snake_case and returns the result."""</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">return</span> <span class="n">CAMEL_CASE_PATTERN</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s2">"_"</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a><span class="k">def</span> <span class="nf">while_changing</span><span class="p">(</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">],</span> <span class="n">func</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]],</span> <span class="n">E</span><span class="p">]</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">E</span><span class="p">:</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a><span class="sd"> Applies a transformation to a given expression until a fix point is reached.</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a><span class="sd"> Args:</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a><span class="sd"> expression: the expression to be transformed.</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a><span class="sd"> func: the transformation to be applied.</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a><span class="sd"> Returns:</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a><span class="sd"> The transformed expression.</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a><span class="sd"> """</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">hash</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">if</span> <span class="n">start</span> <span class="o">==</span> <span class="nb">hash</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">break</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a><span class="k">def</span> <span class="nf">tsort</span><span class="p">(</span><span class="n">dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">T</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a><span class="sd"> Sorts a given directed acyclic graph in topological order.</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a><span class="sd"> Args:</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a><span class="sd"> dag: the graph to be sorted.</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a><span class="sd"> Returns:</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a><span class="sd"> A list that contains all of the graph's nodes in topological order.</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a><span class="sd"> """</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="k">def</span> <span class="nf">visit</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">T</span><span class="p">,</span> <span class="n">visited</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="k">return</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">visited</span><span class="p">:</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Cycle error"</span><span class="p">)</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">visited</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">dag</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="p">[]):</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="n">visit</span><span class="p">(</span><span class="n">dep</span><span class="p">,</span> <span class="n">visited</span><span class="p">)</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">visited</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">dag</span><span class="p">:</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">visit</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="nb">set</span><span class="p">())</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="k">return</span> <span class="n">result</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a><span class="k">def</span> <span class="nf">open_file</span><span class="p">(</span><span class="n">file_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">TextIO</span><span class="p">:</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a><span class="w"> </span><span class="sd">"""Open a file that may be compressed as gzip and return it in universal newline mode."""</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="s2">"rb"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">gzipped</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">==</span> <span class="sa">b</span><span class="s2">"</span><span class="se">\x1f\x8b</span><span class="s2">"</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="k">if</span> <span class="n">gzipped</span><span class="p">:</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="kn">import</span> <span class="nn">gzip</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="k">return</span> <span class="n">gzip</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="s2">"rt"</span><span class="p">,</span> <span class="n">newline</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="k">return</span> <span class="nb">open</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">"utf-8"</span><span class="p">,</span> <span class="n">newline</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a><span class="nd">@contextmanager</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a><span class="k">def</span> <span class="nf">csv_reader</span><span class="p">(</span><span class="n">read_csv</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">:</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a><span class="sd"> Returns a csv reader given the expression `READ_CSV(name, ['delimiter', '|', ...])`.</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a><span class="sd"> Args:</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a><span class="sd"> read_csv: a `ReadCSV` function call</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a><span class="sd"> Yields:</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a><span class="sd"> A python csv reader.</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a><span class="sd"> """</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">read_csv</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="n">file</span> <span class="o">=</span> <span class="n">open_file</span><span class="p">(</span><span class="n">read_csv</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="n">delimiter</span> <span class="o">=</span> <span class="s2">","</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="n">args</span> <span class="o">=</span> <span class="nb">iter</span><span class="p">(</span><span class="n">arg</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="s2">"delimiter"</span><span class="p">:</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="n">delimiter</span> <span class="o">=</span> <span class="n">v</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="kn">import</span> <span class="nn">csv</span> <span class="k">as</span> <span class="nn">csv_</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">yield</span> <span class="n">csv_</span><span class="o">.</span><span class="n">reader</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="n">delimiter</span><span class="o">=</span><span class="n">delimiter</span><span class="p">)</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="k">finally</span><span class="p">:</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a><span class="k">def</span> <span class="nf">find_new_name</span><span class="p">(</span><span class="n">taken</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">base</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a><span class="sd"> Searches for a new name.</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a><span class="sd"> Args:</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a><span class="sd"> taken: a collection of taken names.</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a><span class="sd"> base: base name to alter.</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a><span class="sd"> Returns:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a><span class="sd"> The new, available name.</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a><span class="sd"> """</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">if</span> <span class="n">base</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">taken</span><span class="p">:</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="k">return</span> <span class="n">base</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">i</span> <span class="o">=</span> <span class="mi">2</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">new</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">base</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="k">while</span> <span class="n">new</span> <span class="ow">in</span> <span class="n">taken</span><span class="p">:</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">new</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">base</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="k">return</span> <span class="n">new</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a><span class="k">def</span> <span class="nf">object_to_dict</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a><span class="w"> </span><span class="sd">"""Returns a dictionary created from an object's attributes."""</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">return</span> <span class="p">{</span><span class="o">**</span><span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">copy</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">vars</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">()},</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">}</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a><span class="k">def</span> <span class="nf">split_num_words</span><span class="p">(</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="n">value</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">min_num_words</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">fill_from_start</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]]:</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a><span class="sd"> Perform a split on a value and return N words as a result with `None` used for words that don't exist.</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a><span class="sd"> Args:</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a><span class="sd"> value: the value to be split.</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a><span class="sd"> sep: the value to use to split on.</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a><span class="sd"> min_num_words: the minimum number of words that are going to be in the result.</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a><span class="sd"> fill_from_start: indicates that if `None` values should be inserted at the start or end of the list.</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a><span class="sd"> Examples:</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a><span class="sd"> >>> split_num_words("db.table", ".", 3)</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a><span class="sd"> [None, 'db', 'table']</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a><span class="sd"> >>> split_num_words("db.table", ".", 3, fill_from_start=False)</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a><span class="sd"> ['db', 'table', None]</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a><span class="sd"> >>> split_num_words("db.table", ".", 1)</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a><span class="sd"> ['db', 'table']</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a><span class="sd"> Returns:</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a><span class="sd"> The list of words returned by `split`, possibly augmented by a number of `None` values.</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a><span class="sd"> """</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="n">words</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">sep</span><span class="p">)</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="k">if</span> <span class="n">fill_from_start</span><span class="p">:</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span> <span class="o">*</span> <span class="p">(</span><span class="n">min_num_words</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">words</span><span class="p">))</span> <span class="o">+</span> <span class="n">words</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">return</span> <span class="n">words</span> <span class="o">+</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span> <span class="o">*</span> <span class="p">(</span><span class="n">min_num_words</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">words</span><span class="p">))</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a><span class="k">def</span> <span class="nf">is_iterable</span><span class="p">(</span><span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a><span class="sd"> Checks if the value is an iterable, excluding the types `str` and `bytes`.</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a><span class="sd"> Examples:</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a><span class="sd"> >>> is_iterable([1,2])</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a><span class="sd"> True</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a><span class="sd"> >>> is_iterable("test")</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a><span class="sd"> False</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a><span class="sd"> Args:</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a><span class="sd"> value: the value to check if it is an iterable.</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a><span class="sd"> Returns:</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a><span class="sd"> A `bool` value indicating if it is an iterable.</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a><span class="sd"> """</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="k">return</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="s2">"__iter__"</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">))</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a><span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]:</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a><span class="sd"> Flattens an iterable that can contain both iterable and non-iterable elements. Objects of</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a><span class="sd"> type `str` and `bytes` are not regarded as iterables.</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a><span class="sd"> Examples:</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a><span class="sd"> >>> list(flatten([[1, 2], 3, {4}, (5, "bla")]))</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a><span class="sd"> [1, 2, 3, 4, 5, 'bla']</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a><span class="sd"> >>> list(flatten([1, 2, 3]))</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a><span class="sd"> [1, 2, 3]</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a><span class="sd"> Args:</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a><span class="sd"> values: the value to be flattened.</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a><span class="sd"> Yields:</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a><span class="sd"> Non-iterable elements in `values`.</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a><span class="sd"> """</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">:</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="k">if</span> <span class="n">is_iterable</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="k">yield from</span> <span class="n">flatten</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="k">yield</span> <span class="n">value</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a><span class="k">def</span> <span class="nf">count_params</span><span class="p">(</span><span class="n">function</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a><span class="sd"> Returns the number of formal parameters expected by a function, without counting "self"</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a><span class="sd"> and "cls", in case of instance and class methods, respectively.</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a><span class="sd"> """</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">function</span><span class="o">.</span><span class="vm">__code__</span><span class="o">.</span><span class="n">co_argcount</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">return</span> <span class="n">count</span> <span class="o">-</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">inspect</span><span class="o">.</span><span class="n">ismethod</span><span class="p">(</span><span class="n">function</span><span class="p">)</span> <span class="k">else</span> <span class="n">count</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a><span class="k">def</span> <span class="nf">dict_depth</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a><span class="sd"> Get the nesting depth of a dictionary.</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a><span class="sd"> For example:</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a><span class="sd"> >>> dict_depth(None)</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a><span class="sd"> 0</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a><span class="sd"> >>> dict_depth({})</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a><span class="sd"> 1</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a><span class="sd"> >>> dict_depth({"a": "b"})</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a><span class="sd"> 1</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a><span class="sd"> >>> dict_depth({"a": {}})</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a><span class="sd"> 2</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a><span class="sd"> >>> dict_depth({"a": {"b": {}}})</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a><span class="sd"> 3</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a><span class="sd"> Args:</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a><span class="sd"> d (dict): dictionary</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a><span class="sd"> Returns:</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a><span class="sd"> int: depth</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a><span class="sd"> """</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="k">return</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">dict_depth</span><span class="p">(</span><span class="nb">next</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">d</span><span class="o">.</span><span class="n">values</span><span class="p">())))</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="c1"># d doesn't have attribute "values"</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="mi">0</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="c1"># d.values() returns an empty sequence</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="k">return</span> <span class="mi">1</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a><span class="k">def</span> <span class="nf">first</span><span class="p">(</span><span class="n">it</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">-></span> <span class="n">T</span><span class="p">:</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a><span class="w"> </span><span class="sd">"""Returns the first element from an iterable.</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a><span class="sd"> Useful for sets.</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a><span class="sd"> """</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">it</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="AutoName"> + <input id="AutoName-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AutoName</span><wbr>(<span class="base">enum.Enum</span>): + + <label class="view-source-button" for="AutoName-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AutoName"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AutoName-26"><a href="#AutoName-26"><span class="linenos">26</span></a><span class="k">class</span> <span class="nc">AutoName</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span> +</span><span id="AutoName-27"><a href="#AutoName-27"><span class="linenos">27</span></a><span class="w"> </span><span class="sd">"""This is used for creating enum classes where `auto()` is the string form of the corresponding value's name."""</span> +</span><span id="AutoName-28"><a href="#AutoName-28"><span class="linenos">28</span></a> +</span><span id="AutoName-29"><a href="#AutoName-29"><span class="linenos">29</span></a> <span class="k">def</span> <span class="nf">_generate_next_value_</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">_start</span><span class="p">,</span> <span class="n">_count</span><span class="p">,</span> <span class="n">_last_values</span><span class="p">):</span> <span class="c1"># type: ignore</span> +</span><span id="AutoName-30"><a href="#AutoName-30"><span class="linenos">30</span></a> <span class="k">return</span> <span class="n">name</span> +</span></pre></div> + + + <div class="docstring"><p>This is used for creating enum classes where <code>auto()</code> is the string form of the corresponding value's name.</p> +</div> + + + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="AutoName.name" class="variable">name</dd> + <dd id="AutoName.value" class="variable">value</dd> + + </div> + </dl> + </div> + </section> + <section id="seq_get"> + <input id="seq_get-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">seq_get</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">seq</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">]</span>, </span><span class="param"><span class="n">index</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n">Optional</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="seq_get-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#seq_get"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="seq_get-33"><a href="#seq_get-33"><span class="linenos">33</span></a><span class="k">def</span> <span class="nf">seq_get</span><span class="p">(</span><span class="n">seq</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">T</span><span class="p">],</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="seq_get-34"><a href="#seq_get-34"><span class="linenos">34</span></a><span class="w"> </span><span class="sd">"""Returns the value in `seq` at position `index`, or `None` if `index` is out of bounds."""</span> +</span><span id="seq_get-35"><a href="#seq_get-35"><span class="linenos">35</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="seq_get-36"><a href="#seq_get-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="n">seq</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> +</span><span id="seq_get-37"><a href="#seq_get-37"><span class="linenos">37</span></a> <span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span> +</span><span id="seq_get-38"><a href="#seq_get-38"><span class="linenos">38</span></a> <span class="k">return</span> <span class="kc">None</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the value in <code>seq</code> at position <code>index</code>, or <code>None</code> if <code>index</code> is out of bounds.</p> +</div> + + + </section> + <section id="ensure_list"> + <input id="ensure_list-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ensure_list</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">value</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="ensure_list-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ensure_list"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ensure_list-51"><a href="#ensure_list-51"><span class="linenos">51</span></a><span class="k">def</span> <span class="nf">ensure_list</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="ensure_list-52"><a href="#ensure_list-52"><span class="linenos">52</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="ensure_list-53"><a href="#ensure_list-53"><span class="linenos">53</span></a><span class="sd"> Ensures that a value is a list, otherwise casts or wraps it into one.</span> +</span><span id="ensure_list-54"><a href="#ensure_list-54"><span class="linenos">54</span></a> +</span><span id="ensure_list-55"><a href="#ensure_list-55"><span class="linenos">55</span></a><span class="sd"> Args:</span> +</span><span id="ensure_list-56"><a href="#ensure_list-56"><span class="linenos">56</span></a><span class="sd"> value: the value of interest.</span> +</span><span id="ensure_list-57"><a href="#ensure_list-57"><span class="linenos">57</span></a> +</span><span id="ensure_list-58"><a href="#ensure_list-58"><span class="linenos">58</span></a><span class="sd"> Returns:</span> +</span><span id="ensure_list-59"><a href="#ensure_list-59"><span class="linenos">59</span></a><span class="sd"> The value cast as a list if it's a list or a tuple, or else the value wrapped in a list.</span> +</span><span id="ensure_list-60"><a href="#ensure_list-60"><span class="linenos">60</span></a><span class="sd"> """</span> +</span><span id="ensure_list-61"><a href="#ensure_list-61"><span class="linenos">61</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="ensure_list-62"><a href="#ensure_list-62"><span class="linenos">62</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="ensure_list-63"><a href="#ensure_list-63"><span class="linenos">63</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)):</span> +</span><span id="ensure_list-64"><a href="#ensure_list-64"><span class="linenos">64</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="ensure_list-65"><a href="#ensure_list-65"><span class="linenos">65</span></a> +</span><span id="ensure_list-66"><a href="#ensure_list-66"><span class="linenos">66</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Ensures that a value is a list, otherwise casts or wraps it into one.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>value:</strong> the value of interest.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The value cast as a list if it's a list or a tuple, or else the value wrapped in a list.</p> +</blockquote> +</div> + + + </section> + <section id="ensure_collection"> + <input id="ensure_collection-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ensure_collection</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">value</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="ensure_collection-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ensure_collection"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ensure_collection-79"><a href="#ensure_collection-79"><span class="linenos">79</span></a><span class="k">def</span> <span class="nf">ensure_collection</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="ensure_collection-80"><a href="#ensure_collection-80"><span class="linenos">80</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="ensure_collection-81"><a href="#ensure_collection-81"><span class="linenos">81</span></a><span class="sd"> Ensures that a value is a collection (excluding `str` and `bytes`), otherwise wraps it into a list.</span> +</span><span id="ensure_collection-82"><a href="#ensure_collection-82"><span class="linenos">82</span></a> +</span><span id="ensure_collection-83"><a href="#ensure_collection-83"><span class="linenos">83</span></a><span class="sd"> Args:</span> +</span><span id="ensure_collection-84"><a href="#ensure_collection-84"><span class="linenos">84</span></a><span class="sd"> value: the value of interest.</span> +</span><span id="ensure_collection-85"><a href="#ensure_collection-85"><span class="linenos">85</span></a> +</span><span id="ensure_collection-86"><a href="#ensure_collection-86"><span class="linenos">86</span></a><span class="sd"> Returns:</span> +</span><span id="ensure_collection-87"><a href="#ensure_collection-87"><span class="linenos">87</span></a><span class="sd"> The value if it's a collection, or else the value wrapped in a list.</span> +</span><span id="ensure_collection-88"><a href="#ensure_collection-88"><span class="linenos">88</span></a><span class="sd"> """</span> +</span><span id="ensure_collection-89"><a href="#ensure_collection-89"><span class="linenos">89</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="ensure_collection-90"><a href="#ensure_collection-90"><span class="linenos">90</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="ensure_collection-91"><a href="#ensure_collection-91"><span class="linenos">91</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="ensure_collection-92"><a href="#ensure_collection-92"><span class="linenos">92</span></a> <span class="n">value</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">Collection</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">))</span> <span class="k">else</span> <span class="p">[</span><span class="n">value</span><span class="p">]</span> +</span><span id="ensure_collection-93"><a href="#ensure_collection-93"><span class="linenos">93</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Ensures that a value is a collection (excluding <code>str</code> and <code>bytes</code>), otherwise wraps it into a list.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>value:</strong> the value of interest.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The value if it's a collection, or else the value wrapped in a list.</p> +</blockquote> +</div> + + + </section> + <section id="csv"> + <input id="csv-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">csv</span><span class="signature pdoc-code condensed">(<span class="param"><span class="o">*</span><span class="n">args</span>, </span><span class="param"><span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s1">', '</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="csv-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#csv"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="csv-96"><a href="#csv-96"><span class="linenos"> 96</span></a><span class="k">def</span> <span class="nf">csv</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">", "</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="csv-97"><a href="#csv-97"><span class="linenos"> 97</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="csv-98"><a href="#csv-98"><span class="linenos"> 98</span></a><span class="sd"> Formats any number of string arguments as CSV.</span> +</span><span id="csv-99"><a href="#csv-99"><span class="linenos"> 99</span></a> +</span><span id="csv-100"><a href="#csv-100"><span class="linenos">100</span></a><span class="sd"> Args:</span> +</span><span id="csv-101"><a href="#csv-101"><span class="linenos">101</span></a><span class="sd"> args: the string arguments to format.</span> +</span><span id="csv-102"><a href="#csv-102"><span class="linenos">102</span></a><span class="sd"> sep: the argument separator.</span> +</span><span id="csv-103"><a href="#csv-103"><span class="linenos">103</span></a> +</span><span id="csv-104"><a href="#csv-104"><span class="linenos">104</span></a><span class="sd"> Returns:</span> +</span><span id="csv-105"><a href="#csv-105"><span class="linenos">105</span></a><span class="sd"> The arguments formatted as a CSV string.</span> +</span><span id="csv-106"><a href="#csv-106"><span class="linenos">106</span></a><span class="sd"> """</span> +</span><span id="csv-107"><a href="#csv-107"><span class="linenos">107</span></a> <span class="k">return</span> <span class="n">sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">arg</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span> <span class="k">if</span> <span class="n">arg</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Formats any number of string arguments as CSV.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>args:</strong> the string arguments to format.</li> +<li><strong>sep:</strong> the argument separator.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The arguments formatted as a CSV string.</p> +</blockquote> +</div> + + + </section> + <section id="subclasses"> + <input id="subclasses-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">subclasses</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">module_name</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">classes</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Type</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Type</span><span class="p">,</span> <span class="o">...</span><span class="p">]]</span>,</span><span class="param"> <span class="n">exclude</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Type</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">[</span><span class="n">Type</span><span class="p">,</span> <span class="o">...</span><span class="p">]]</span> <span class="o">=</span> <span class="p">()</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Type</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="subclasses-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#subclasses"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="subclasses-110"><a href="#subclasses-110"><span class="linenos">110</span></a><span class="k">def</span> <span class="nf">subclasses</span><span class="p">(</span> +</span><span id="subclasses-111"><a href="#subclasses-111"><span class="linenos">111</span></a> <span class="n">module_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="subclasses-112"><a href="#subclasses-112"><span class="linenos">112</span></a> <span class="n">classes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="o">...</span><span class="p">],</span> +</span><span id="subclasses-113"><a href="#subclasses-113"><span class="linenos">113</span></a> <span class="n">exclude</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">(),</span> +</span><span id="subclasses-114"><a href="#subclasses-114"><span class="linenos">114</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">]:</span> +</span><span id="subclasses-115"><a href="#subclasses-115"><span class="linenos">115</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="subclasses-116"><a href="#subclasses-116"><span class="linenos">116</span></a><span class="sd"> Returns all subclasses for a collection of classes, possibly excluding some of them.</span> +</span><span id="subclasses-117"><a href="#subclasses-117"><span class="linenos">117</span></a> +</span><span id="subclasses-118"><a href="#subclasses-118"><span class="linenos">118</span></a><span class="sd"> Args:</span> +</span><span id="subclasses-119"><a href="#subclasses-119"><span class="linenos">119</span></a><span class="sd"> module_name: the name of the module to search for subclasses in.</span> +</span><span id="subclasses-120"><a href="#subclasses-120"><span class="linenos">120</span></a><span class="sd"> classes: class(es) we want to find the subclasses of.</span> +</span><span id="subclasses-121"><a href="#subclasses-121"><span class="linenos">121</span></a><span class="sd"> exclude: class(es) we want to exclude from the returned list.</span> +</span><span id="subclasses-122"><a href="#subclasses-122"><span class="linenos">122</span></a> +</span><span id="subclasses-123"><a href="#subclasses-123"><span class="linenos">123</span></a><span class="sd"> Returns:</span> +</span><span id="subclasses-124"><a href="#subclasses-124"><span class="linenos">124</span></a><span class="sd"> The target subclasses.</span> +</span><span id="subclasses-125"><a href="#subclasses-125"><span class="linenos">125</span></a><span class="sd"> """</span> +</span><span id="subclasses-126"><a href="#subclasses-126"><span class="linenos">126</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="subclasses-127"><a href="#subclasses-127"><span class="linenos">127</span></a> <span class="n">obj</span> +</span><span id="subclasses-128"><a href="#subclasses-128"><span class="linenos">128</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">inspect</span><span class="o">.</span><span class="n">getmembers</span><span class="p">(</span> +</span><span id="subclasses-129"><a href="#subclasses-129"><span class="linenos">129</span></a> <span class="n">sys</span><span class="o">.</span><span class="n">modules</span><span class="p">[</span><span class="n">module_name</span><span class="p">],</span> +</span><span id="subclasses-130"><a href="#subclasses-130"><span class="linenos">130</span></a> <span class="k">lambda</span> <span class="n">obj</span><span class="p">:</span> <span class="n">inspect</span><span class="o">.</span><span class="n">isclass</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">issubclass</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">classes</span><span class="p">)</span> <span class="ow">and</span> <span class="n">obj</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">exclude</span><span class="p">,</span> +</span><span id="subclasses-131"><a href="#subclasses-131"><span class="linenos">131</span></a> <span class="p">)</span> +</span><span id="subclasses-132"><a href="#subclasses-132"><span class="linenos">132</span></a> <span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Returns all subclasses for a collection of classes, possibly excluding some of them.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>module_name:</strong> the name of the module to search for subclasses in.</li> +<li><strong>classes:</strong> class(es) we want to find the subclasses of.</li> +<li><strong>exclude:</strong> class(es) we want to exclude from the returned list.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The target subclasses.</p> +</blockquote> +</div> + + + </section> + <section id="apply_index_offset"> + <input id="apply_index_offset-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">apply_index_offset</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expressions</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="o">~</span><span class="n">E</span><span class="p">]]</span>, </span><span class="param"><span class="n">offset</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="o">~</span><span class="n">E</span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="apply_index_offset-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#apply_index_offset"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="apply_index_offset-135"><a href="#apply_index_offset-135"><span class="linenos">135</span></a><span class="k">def</span> <span class="nf">apply_index_offset</span><span class="p">(</span><span class="n">expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">E</span><span class="p">]],</span> <span class="n">offset</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">E</span><span class="p">]]:</span> +</span><span id="apply_index_offset-136"><a href="#apply_index_offset-136"><span class="linenos">136</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="apply_index_offset-137"><a href="#apply_index_offset-137"><span class="linenos">137</span></a><span class="sd"> Applies an offset to a given integer literal expression.</span> +</span><span id="apply_index_offset-138"><a href="#apply_index_offset-138"><span class="linenos">138</span></a> +</span><span id="apply_index_offset-139"><a href="#apply_index_offset-139"><span class="linenos">139</span></a><span class="sd"> Args:</span> +</span><span id="apply_index_offset-140"><a href="#apply_index_offset-140"><span class="linenos">140</span></a><span class="sd"> expressions: the expression the offset will be applied to, wrapped in a list.</span> +</span><span id="apply_index_offset-141"><a href="#apply_index_offset-141"><span class="linenos">141</span></a><span class="sd"> offset: the offset that will be applied.</span> +</span><span id="apply_index_offset-142"><a href="#apply_index_offset-142"><span class="linenos">142</span></a> +</span><span id="apply_index_offset-143"><a href="#apply_index_offset-143"><span class="linenos">143</span></a><span class="sd"> Returns:</span> +</span><span id="apply_index_offset-144"><a href="#apply_index_offset-144"><span class="linenos">144</span></a><span class="sd"> The original expression with the offset applied to it, wrapped in a list. If the provided</span> +</span><span id="apply_index_offset-145"><a href="#apply_index_offset-145"><span class="linenos">145</span></a><span class="sd"> `expressions` argument contains more than one expressions, it's returned unaffected.</span> +</span><span id="apply_index_offset-146"><a href="#apply_index_offset-146"><span class="linenos">146</span></a><span class="sd"> """</span> +</span><span id="apply_index_offset-147"><a href="#apply_index_offset-147"><span class="linenos">147</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">offset</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="apply_index_offset-148"><a href="#apply_index_offset-148"><span class="linenos">148</span></a> <span class="k">return</span> <span class="n">expressions</span> +</span><span id="apply_index_offset-149"><a href="#apply_index_offset-149"><span class="linenos">149</span></a> +</span><span id="apply_index_offset-150"><a href="#apply_index_offset-150"><span class="linenos">150</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="apply_index_offset-151"><a href="#apply_index_offset-151"><span class="linenos">151</span></a> +</span><span id="apply_index_offset-152"><a href="#apply_index_offset-152"><span class="linenos">152</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_int</span><span class="p">:</span> +</span><span id="apply_index_offset-153"><a href="#apply_index_offset-153"><span class="linenos">153</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="apply_index_offset-154"><a href="#apply_index_offset-154"><span class="linenos">154</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">"Applying array index offset (</span><span class="si">%s</span><span class="s2">)"</span><span class="p">,</span> <span class="n">offset</span><span class="p">)</span> +</span><span id="apply_index_offset-155"><a href="#apply_index_offset-155"><span class="linenos">155</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"this"</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="apply_index_offset-156"><a href="#apply_index_offset-156"><span class="linenos">156</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">expression</span><span class="p">]</span> +</span><span id="apply_index_offset-157"><a href="#apply_index_offset-157"><span class="linenos">157</span></a> +</span><span id="apply_index_offset-158"><a href="#apply_index_offset-158"><span class="linenos">158</span></a> <span class="k">return</span> <span class="n">expressions</span> +</span></pre></div> + + + <div class="docstring"><p>Applies an offset to a given integer literal expression.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expressions:</strong> the expression the offset will be applied to, wrapped in a list.</li> +<li><strong>offset:</strong> the offset that will be applied.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The original expression with the offset applied to it, wrapped in a list. If the provided + <code>expressions</code> argument contains more than one expressions, it's returned unaffected.</p> +</blockquote> +</div> + + + </section> + <section id="camel_to_snake_case"> + <input id="camel_to_snake_case-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">camel_to_snake_case</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">name</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="camel_to_snake_case-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#camel_to_snake_case"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="camel_to_snake_case-161"><a href="#camel_to_snake_case-161"><span class="linenos">161</span></a><span class="k">def</span> <span class="nf">camel_to_snake_case</span><span class="p">(</span><span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="camel_to_snake_case-162"><a href="#camel_to_snake_case-162"><span class="linenos">162</span></a><span class="w"> </span><span class="sd">"""Converts `name` from camelCase to snake_case and returns the result."""</span> +</span><span id="camel_to_snake_case-163"><a href="#camel_to_snake_case-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="n">CAMEL_CASE_PATTERN</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s2">"_"</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Converts <code>name</code> from camelCase to snake_case and returns the result.</p> +</div> + + + </section> + <section id="while_changing"> + <input id="while_changing-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">while_changing</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">func</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[</span><span class="n">Optional</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]],</span> <span class="o">~</span><span class="n">E</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="o">~</span><span class="n">E</span>:</span></span> + + <label class="view-source-button" for="while_changing-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#while_changing"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="while_changing-166"><a href="#while_changing-166"><span class="linenos">166</span></a><span class="k">def</span> <span class="nf">while_changing</span><span class="p">(</span> +</span><span id="while_changing-167"><a href="#while_changing-167"><span class="linenos">167</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">],</span> <span class="n">func</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Expression</span><span class="p">]],</span> <span class="n">E</span><span class="p">]</span> +</span><span id="while_changing-168"><a href="#while_changing-168"><span class="linenos">168</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">E</span><span class="p">:</span> +</span><span id="while_changing-169"><a href="#while_changing-169"><span class="linenos">169</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="while_changing-170"><a href="#while_changing-170"><span class="linenos">170</span></a><span class="sd"> Applies a transformation to a given expression until a fix point is reached.</span> +</span><span id="while_changing-171"><a href="#while_changing-171"><span class="linenos">171</span></a> +</span><span id="while_changing-172"><a href="#while_changing-172"><span class="linenos">172</span></a><span class="sd"> Args:</span> +</span><span id="while_changing-173"><a href="#while_changing-173"><span class="linenos">173</span></a><span class="sd"> expression: the expression to be transformed.</span> +</span><span id="while_changing-174"><a href="#while_changing-174"><span class="linenos">174</span></a><span class="sd"> func: the transformation to be applied.</span> +</span><span id="while_changing-175"><a href="#while_changing-175"><span class="linenos">175</span></a> +</span><span id="while_changing-176"><a href="#while_changing-176"><span class="linenos">176</span></a><span class="sd"> Returns:</span> +</span><span id="while_changing-177"><a href="#while_changing-177"><span class="linenos">177</span></a><span class="sd"> The transformed expression.</span> +</span><span id="while_changing-178"><a href="#while_changing-178"><span class="linenos">178</span></a><span class="sd"> """</span> +</span><span id="while_changing-179"><a href="#while_changing-179"><span class="linenos">179</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="while_changing-180"><a href="#while_changing-180"><span class="linenos">180</span></a> <span class="n">start</span> <span class="o">=</span> <span class="nb">hash</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="while_changing-181"><a href="#while_changing-181"><span class="linenos">181</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">func</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="while_changing-182"><a href="#while_changing-182"><span class="linenos">182</span></a> <span class="k">if</span> <span class="n">start</span> <span class="o">==</span> <span class="nb">hash</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="while_changing-183"><a href="#while_changing-183"><span class="linenos">183</span></a> <span class="k">break</span> +</span><span id="while_changing-184"><a href="#while_changing-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Applies a transformation to a given expression until a fix point is reached.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression to be transformed.</li> +<li><strong>func:</strong> the transformation to be applied.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The transformed expression.</p> +</blockquote> +</div> + + + </section> + <section id="tsort"> + <input id="tsort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">tsort</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">dag</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">,</span> <span class="n">List</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="tsort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#tsort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="tsort-187"><a href="#tsort-187"><span class="linenos">187</span></a><span class="k">def</span> <span class="nf">tsort</span><span class="p">(</span><span class="n">dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">T</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="tsort-188"><a href="#tsort-188"><span class="linenos">188</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="tsort-189"><a href="#tsort-189"><span class="linenos">189</span></a><span class="sd"> Sorts a given directed acyclic graph in topological order.</span> +</span><span id="tsort-190"><a href="#tsort-190"><span class="linenos">190</span></a> +</span><span id="tsort-191"><a href="#tsort-191"><span class="linenos">191</span></a><span class="sd"> Args:</span> +</span><span id="tsort-192"><a href="#tsort-192"><span class="linenos">192</span></a><span class="sd"> dag: the graph to be sorted.</span> +</span><span id="tsort-193"><a href="#tsort-193"><span class="linenos">193</span></a> +</span><span id="tsort-194"><a href="#tsort-194"><span class="linenos">194</span></a><span class="sd"> Returns:</span> +</span><span id="tsort-195"><a href="#tsort-195"><span class="linenos">195</span></a><span class="sd"> A list that contains all of the graph's nodes in topological order.</span> +</span><span id="tsort-196"><a href="#tsort-196"><span class="linenos">196</span></a><span class="sd"> """</span> +</span><span id="tsort-197"><a href="#tsort-197"><span class="linenos">197</span></a> <span class="n">result</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="tsort-198"><a href="#tsort-198"><span class="linenos">198</span></a> +</span><span id="tsort-199"><a href="#tsort-199"><span class="linenos">199</span></a> <span class="k">def</span> <span class="nf">visit</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">T</span><span class="p">,</span> <span class="n">visited</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="tsort-200"><a href="#tsort-200"><span class="linenos">200</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">result</span><span class="p">:</span> +</span><span id="tsort-201"><a href="#tsort-201"><span class="linenos">201</span></a> <span class="k">return</span> +</span><span id="tsort-202"><a href="#tsort-202"><span class="linenos">202</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">visited</span><span class="p">:</span> +</span><span id="tsort-203"><a href="#tsort-203"><span class="linenos">203</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">"Cycle error"</span><span class="p">)</span> +</span><span id="tsort-204"><a href="#tsort-204"><span class="linenos">204</span></a> +</span><span id="tsort-205"><a href="#tsort-205"><span class="linenos">205</span></a> <span class="n">visited</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="tsort-206"><a href="#tsort-206"><span class="linenos">206</span></a> +</span><span id="tsort-207"><a href="#tsort-207"><span class="linenos">207</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">dag</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="p">[]):</span> +</span><span id="tsort-208"><a href="#tsort-208"><span class="linenos">208</span></a> <span class="n">visit</span><span class="p">(</span><span class="n">dep</span><span class="p">,</span> <span class="n">visited</span><span class="p">)</span> +</span><span id="tsort-209"><a href="#tsort-209"><span class="linenos">209</span></a> +</span><span id="tsort-210"><a href="#tsort-210"><span class="linenos">210</span></a> <span class="n">visited</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="tsort-211"><a href="#tsort-211"><span class="linenos">211</span></a> <span class="n">result</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="tsort-212"><a href="#tsort-212"><span class="linenos">212</span></a> +</span><span id="tsort-213"><a href="#tsort-213"><span class="linenos">213</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">dag</span><span class="p">:</span> +</span><span id="tsort-214"><a href="#tsort-214"><span class="linenos">214</span></a> <span class="n">visit</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="nb">set</span><span class="p">())</span> +</span><span id="tsort-215"><a href="#tsort-215"><span class="linenos">215</span></a> +</span><span id="tsort-216"><a href="#tsort-216"><span class="linenos">216</span></a> <span class="k">return</span> <span class="n">result</span> +</span></pre></div> + + + <div class="docstring"><p>Sorts a given directed acyclic graph in topological order.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>dag:</strong> the graph to be sorted.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A list that contains all of the graph's nodes in topological order.</p> +</blockquote> +</div> + + + </section> + <section id="open_file"> + <input id="open_file-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">open_file</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">file_name</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <class 'TextIO'>:</span></span> + + <label class="view-source-button" for="open_file-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#open_file"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="open_file-219"><a href="#open_file-219"><span class="linenos">219</span></a><span class="k">def</span> <span class="nf">open_file</span><span class="p">(</span><span class="n">file_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">TextIO</span><span class="p">:</span> +</span><span id="open_file-220"><a href="#open_file-220"><span class="linenos">220</span></a><span class="w"> </span><span class="sd">"""Open a file that may be compressed as gzip and return it in universal newline mode."""</span> +</span><span id="open_file-221"><a href="#open_file-221"><span class="linenos">221</span></a> <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="s2">"rb"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> +</span><span id="open_file-222"><a href="#open_file-222"><span class="linenos">222</span></a> <span class="n">gzipped</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">==</span> <span class="sa">b</span><span class="s2">"</span><span class="se">\x1f\x8b</span><span class="s2">"</span> +</span><span id="open_file-223"><a href="#open_file-223"><span class="linenos">223</span></a> +</span><span id="open_file-224"><a href="#open_file-224"><span class="linenos">224</span></a> <span class="k">if</span> <span class="n">gzipped</span><span class="p">:</span> +</span><span id="open_file-225"><a href="#open_file-225"><span class="linenos">225</span></a> <span class="kn">import</span> <span class="nn">gzip</span> +</span><span id="open_file-226"><a href="#open_file-226"><span class="linenos">226</span></a> +</span><span id="open_file-227"><a href="#open_file-227"><span class="linenos">227</span></a> <span class="k">return</span> <span class="n">gzip</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="s2">"rt"</span><span class="p">,</span> <span class="n">newline</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="open_file-228"><a href="#open_file-228"><span class="linenos">228</span></a> +</span><span id="open_file-229"><a href="#open_file-229"><span class="linenos">229</span></a> <span class="k">return</span> <span class="nb">open</span><span class="p">(</span><span class="n">file_name</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">"utf-8"</span><span class="p">,</span> <span class="n">newline</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Open a file that may be compressed as gzip and return it in universal newline mode.</p> +</div> + + + </section> + <section id="csv_reader"> + <input id="csv_reader-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@contextmanager</div> + + <span class="def">def</span> + <span class="name">csv_reader</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">read_csv</span><span class="p">:</span> <span class="n"><a href="expressions.html#ReadCSV">sqlglot.expressions.ReadCSV</a></span></span><span class="return-annotation">) -> <span class="n">Any</span>:</span></span> + + <label class="view-source-button" for="csv_reader-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#csv_reader"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="csv_reader-232"><a href="#csv_reader-232"><span class="linenos">232</span></a><span class="nd">@contextmanager</span> +</span><span id="csv_reader-233"><a href="#csv_reader-233"><span class="linenos">233</span></a><span class="k">def</span> <span class="nf">csv_reader</span><span class="p">(</span><span class="n">read_csv</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">:</span> +</span><span id="csv_reader-234"><a href="#csv_reader-234"><span class="linenos">234</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="csv_reader-235"><a href="#csv_reader-235"><span class="linenos">235</span></a><span class="sd"> Returns a csv reader given the expression `READ_CSV(name, ['delimiter', '|', ...])`.</span> +</span><span id="csv_reader-236"><a href="#csv_reader-236"><span class="linenos">236</span></a> +</span><span id="csv_reader-237"><a href="#csv_reader-237"><span class="linenos">237</span></a><span class="sd"> Args:</span> +</span><span id="csv_reader-238"><a href="#csv_reader-238"><span class="linenos">238</span></a><span class="sd"> read_csv: a `ReadCSV` function call</span> +</span><span id="csv_reader-239"><a href="#csv_reader-239"><span class="linenos">239</span></a> +</span><span id="csv_reader-240"><a href="#csv_reader-240"><span class="linenos">240</span></a><span class="sd"> Yields:</span> +</span><span id="csv_reader-241"><a href="#csv_reader-241"><span class="linenos">241</span></a><span class="sd"> A python csv reader.</span> +</span><span id="csv_reader-242"><a href="#csv_reader-242"><span class="linenos">242</span></a><span class="sd"> """</span> +</span><span id="csv_reader-243"><a href="#csv_reader-243"><span class="linenos">243</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">read_csv</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="csv_reader-244"><a href="#csv_reader-244"><span class="linenos">244</span></a> <span class="n">file</span> <span class="o">=</span> <span class="n">open_file</span><span class="p">(</span><span class="n">read_csv</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="csv_reader-245"><a href="#csv_reader-245"><span class="linenos">245</span></a> +</span><span id="csv_reader-246"><a href="#csv_reader-246"><span class="linenos">246</span></a> <span class="n">delimiter</span> <span class="o">=</span> <span class="s2">","</span> +</span><span id="csv_reader-247"><a href="#csv_reader-247"><span class="linenos">247</span></a> <span class="n">args</span> <span class="o">=</span> <span class="nb">iter</span><span class="p">(</span><span class="n">arg</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">)</span> +</span><span id="csv_reader-248"><a href="#csv_reader-248"><span class="linenos">248</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">args</span><span class="p">):</span> +</span><span id="csv_reader-249"><a href="#csv_reader-249"><span class="linenos">249</span></a> <span class="k">if</span> <span class="n">k</span> <span class="o">==</span> <span class="s2">"delimiter"</span><span class="p">:</span> +</span><span id="csv_reader-250"><a href="#csv_reader-250"><span class="linenos">250</span></a> <span class="n">delimiter</span> <span class="o">=</span> <span class="n">v</span> +</span><span id="csv_reader-251"><a href="#csv_reader-251"><span class="linenos">251</span></a> +</span><span id="csv_reader-252"><a href="#csv_reader-252"><span class="linenos">252</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="csv_reader-253"><a href="#csv_reader-253"><span class="linenos">253</span></a> <span class="kn">import</span> <span class="nn">csv</span> <span class="k">as</span> <span class="nn">csv_</span> +</span><span id="csv_reader-254"><a href="#csv_reader-254"><span class="linenos">254</span></a> +</span><span id="csv_reader-255"><a href="#csv_reader-255"><span class="linenos">255</span></a> <span class="k">yield</span> <span class="n">csv_</span><span class="o">.</span><span class="n">reader</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="n">delimiter</span><span class="o">=</span><span class="n">delimiter</span><span class="p">)</span> +</span><span id="csv_reader-256"><a href="#csv_reader-256"><span class="linenos">256</span></a> <span class="k">finally</span><span class="p">:</span> +</span><span id="csv_reader-257"><a href="#csv_reader-257"><span class="linenos">257</span></a> <span class="n">file</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a csv reader given the expression <code>READ_CSV(name, ['delimiter', '|', ...])</code>.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>read_csv:</strong> a <code>ReadCSV</code> function call</li> +</ul> + +<h6 id="yields">Yields:</h6> + +<blockquote> + <p>A python csv reader.</p> +</blockquote> +</div> + + + </section> + <section id="find_new_name"> + <input id="find_new_name-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find_new_name</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">taken</span><span class="p">:</span> <span class="n">Collection</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>, </span><span class="param"><span class="n">base</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="find_new_name-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#find_new_name"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="find_new_name-260"><a href="#find_new_name-260"><span class="linenos">260</span></a><span class="k">def</span> <span class="nf">find_new_name</span><span class="p">(</span><span class="n">taken</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">base</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="find_new_name-261"><a href="#find_new_name-261"><span class="linenos">261</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="find_new_name-262"><a href="#find_new_name-262"><span class="linenos">262</span></a><span class="sd"> Searches for a new name.</span> +</span><span id="find_new_name-263"><a href="#find_new_name-263"><span class="linenos">263</span></a> +</span><span id="find_new_name-264"><a href="#find_new_name-264"><span class="linenos">264</span></a><span class="sd"> Args:</span> +</span><span id="find_new_name-265"><a href="#find_new_name-265"><span class="linenos">265</span></a><span class="sd"> taken: a collection of taken names.</span> +</span><span id="find_new_name-266"><a href="#find_new_name-266"><span class="linenos">266</span></a><span class="sd"> base: base name to alter.</span> +</span><span id="find_new_name-267"><a href="#find_new_name-267"><span class="linenos">267</span></a> +</span><span id="find_new_name-268"><a href="#find_new_name-268"><span class="linenos">268</span></a><span class="sd"> Returns:</span> +</span><span id="find_new_name-269"><a href="#find_new_name-269"><span class="linenos">269</span></a><span class="sd"> The new, available name.</span> +</span><span id="find_new_name-270"><a href="#find_new_name-270"><span class="linenos">270</span></a><span class="sd"> """</span> +</span><span id="find_new_name-271"><a href="#find_new_name-271"><span class="linenos">271</span></a> <span class="k">if</span> <span class="n">base</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">taken</span><span class="p">:</span> +</span><span id="find_new_name-272"><a href="#find_new_name-272"><span class="linenos">272</span></a> <span class="k">return</span> <span class="n">base</span> +</span><span id="find_new_name-273"><a href="#find_new_name-273"><span class="linenos">273</span></a> +</span><span id="find_new_name-274"><a href="#find_new_name-274"><span class="linenos">274</span></a> <span class="n">i</span> <span class="o">=</span> <span class="mi">2</span> +</span><span id="find_new_name-275"><a href="#find_new_name-275"><span class="linenos">275</span></a> <span class="n">new</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">base</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span> +</span><span id="find_new_name-276"><a href="#find_new_name-276"><span class="linenos">276</span></a> <span class="k">while</span> <span class="n">new</span> <span class="ow">in</span> <span class="n">taken</span><span class="p">:</span> +</span><span id="find_new_name-277"><a href="#find_new_name-277"><span class="linenos">277</span></a> <span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="find_new_name-278"><a href="#find_new_name-278"><span class="linenos">278</span></a> <span class="n">new</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">base</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span> +</span><span id="find_new_name-279"><a href="#find_new_name-279"><span class="linenos">279</span></a> +</span><span id="find_new_name-280"><a href="#find_new_name-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="n">new</span> +</span></pre></div> + + + <div class="docstring"><p>Searches for a new name.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>taken:</strong> a collection of taken names.</li> +<li><strong>base:</strong> base name to alter.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The new, available name.</p> +</blockquote> +</div> + + + </section> + <section id="object_to_dict"> + <input id="object_to_dict-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">object_to_dict</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n">Dict</span>:</span></span> + + <label class="view-source-button" for="object_to_dict-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#object_to_dict"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="object_to_dict-283"><a href="#object_to_dict-283"><span class="linenos">283</span></a><span class="k">def</span> <span class="nf">object_to_dict</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="object_to_dict-284"><a href="#object_to_dict-284"><span class="linenos">284</span></a><span class="w"> </span><span class="sd">"""Returns a dictionary created from an object's attributes."""</span> +</span><span id="object_to_dict-285"><a href="#object_to_dict-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="p">{</span><span class="o">**</span><span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">copy</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">vars</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">()},</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">}</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a dictionary created from an object's attributes.</p> +</div> + + + </section> + <section id="split_num_words"> + <input id="split_num_words-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">split_num_words</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">value</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">min_num_words</span><span class="p">:</span> <span class="nb">int</span>,</span><span class="param"> <span class="n">fill_from_start</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="split_num_words-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#split_num_words"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="split_num_words-288"><a href="#split_num_words-288"><span class="linenos">288</span></a><span class="k">def</span> <span class="nf">split_num_words</span><span class="p">(</span> +</span><span id="split_num_words-289"><a href="#split_num_words-289"><span class="linenos">289</span></a> <span class="n">value</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">min_num_words</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">fill_from_start</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="split_num_words-290"><a href="#split_num_words-290"><span class="linenos">290</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]]:</span> +</span><span id="split_num_words-291"><a href="#split_num_words-291"><span class="linenos">291</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="split_num_words-292"><a href="#split_num_words-292"><span class="linenos">292</span></a><span class="sd"> Perform a split on a value and return N words as a result with `None` used for words that don't exist.</span> +</span><span id="split_num_words-293"><a href="#split_num_words-293"><span class="linenos">293</span></a> +</span><span id="split_num_words-294"><a href="#split_num_words-294"><span class="linenos">294</span></a><span class="sd"> Args:</span> +</span><span id="split_num_words-295"><a href="#split_num_words-295"><span class="linenos">295</span></a><span class="sd"> value: the value to be split.</span> +</span><span id="split_num_words-296"><a href="#split_num_words-296"><span class="linenos">296</span></a><span class="sd"> sep: the value to use to split on.</span> +</span><span id="split_num_words-297"><a href="#split_num_words-297"><span class="linenos">297</span></a><span class="sd"> min_num_words: the minimum number of words that are going to be in the result.</span> +</span><span id="split_num_words-298"><a href="#split_num_words-298"><span class="linenos">298</span></a><span class="sd"> fill_from_start: indicates that if `None` values should be inserted at the start or end of the list.</span> +</span><span id="split_num_words-299"><a href="#split_num_words-299"><span class="linenos">299</span></a> +</span><span id="split_num_words-300"><a href="#split_num_words-300"><span class="linenos">300</span></a><span class="sd"> Examples:</span> +</span><span id="split_num_words-301"><a href="#split_num_words-301"><span class="linenos">301</span></a><span class="sd"> >>> split_num_words("db.table", ".", 3)</span> +</span><span id="split_num_words-302"><a href="#split_num_words-302"><span class="linenos">302</span></a><span class="sd"> [None, 'db', 'table']</span> +</span><span id="split_num_words-303"><a href="#split_num_words-303"><span class="linenos">303</span></a><span class="sd"> >>> split_num_words("db.table", ".", 3, fill_from_start=False)</span> +</span><span id="split_num_words-304"><a href="#split_num_words-304"><span class="linenos">304</span></a><span class="sd"> ['db', 'table', None]</span> +</span><span id="split_num_words-305"><a href="#split_num_words-305"><span class="linenos">305</span></a><span class="sd"> >>> split_num_words("db.table", ".", 1)</span> +</span><span id="split_num_words-306"><a href="#split_num_words-306"><span class="linenos">306</span></a><span class="sd"> ['db', 'table']</span> +</span><span id="split_num_words-307"><a href="#split_num_words-307"><span class="linenos">307</span></a> +</span><span id="split_num_words-308"><a href="#split_num_words-308"><span class="linenos">308</span></a><span class="sd"> Returns:</span> +</span><span id="split_num_words-309"><a href="#split_num_words-309"><span class="linenos">309</span></a><span class="sd"> The list of words returned by `split`, possibly augmented by a number of `None` values.</span> +</span><span id="split_num_words-310"><a href="#split_num_words-310"><span class="linenos">310</span></a><span class="sd"> """</span> +</span><span id="split_num_words-311"><a href="#split_num_words-311"><span class="linenos">311</span></a> <span class="n">words</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">sep</span><span class="p">)</span> +</span><span id="split_num_words-312"><a href="#split_num_words-312"><span class="linenos">312</span></a> <span class="k">if</span> <span class="n">fill_from_start</span><span class="p">:</span> +</span><span id="split_num_words-313"><a href="#split_num_words-313"><span class="linenos">313</span></a> <span class="k">return</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span> <span class="o">*</span> <span class="p">(</span><span class="n">min_num_words</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">words</span><span class="p">))</span> <span class="o">+</span> <span class="n">words</span> +</span><span id="split_num_words-314"><a href="#split_num_words-314"><span class="linenos">314</span></a> <span class="k">return</span> <span class="n">words</span> <span class="o">+</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span> <span class="o">*</span> <span class="p">(</span><span class="n">min_num_words</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">words</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Perform a split on a value and return N words as a result with <code>None</code> used for words that don't exist.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>value:</strong> the value to be split.</li> +<li><strong>sep:</strong> the value to use to split on.</li> +<li><strong>min_num_words:</strong> the minimum number of words that are going to be in the result.</li> +<li><strong>fill_from_start:</strong> indicates that if <code>None</code> values should be inserted at the start or end of the list.</li> +</ul> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">split_num_words</span><span class="p">(</span><span class="s2">"db.table"</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> +<span class="go">[None, 'db', 'table']</span> +<span class="gp">>>> </span><span class="n">split_num_words</span><span class="p">(</span><span class="s2">"db.table"</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">fill_from_start</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +<span class="go">['db', 'table', None]</span> +<span class="gp">>>> </span><span class="n">split_num_words</span><span class="p">(</span><span class="s2">"db.table"</span><span class="p">,</span> <span class="s2">"."</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +<span class="go">['db', 'table']</span> +</code></pre> + </div> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The list of words returned by <code>split</code>, possibly augmented by a number of <code>None</code> values.</p> +</blockquote> +</div> + + + </section> + <section id="is_iterable"> + <input id="is_iterable-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">is_iterable</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">value</span><span class="p">:</span> <span class="n">Any</span></span><span class="return-annotation">) -> <span class="nb">bool</span>:</span></span> + + <label class="view-source-button" for="is_iterable-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#is_iterable"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="is_iterable-317"><a href="#is_iterable-317"><span class="linenos">317</span></a><span class="k">def</span> <span class="nf">is_iterable</span><span class="p">(</span><span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="is_iterable-318"><a href="#is_iterable-318"><span class="linenos">318</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="is_iterable-319"><a href="#is_iterable-319"><span class="linenos">319</span></a><span class="sd"> Checks if the value is an iterable, excluding the types `str` and `bytes`.</span> +</span><span id="is_iterable-320"><a href="#is_iterable-320"><span class="linenos">320</span></a> +</span><span id="is_iterable-321"><a href="#is_iterable-321"><span class="linenos">321</span></a><span class="sd"> Examples:</span> +</span><span id="is_iterable-322"><a href="#is_iterable-322"><span class="linenos">322</span></a><span class="sd"> >>> is_iterable([1,2])</span> +</span><span id="is_iterable-323"><a href="#is_iterable-323"><span class="linenos">323</span></a><span class="sd"> True</span> +</span><span id="is_iterable-324"><a href="#is_iterable-324"><span class="linenos">324</span></a><span class="sd"> >>> is_iterable("test")</span> +</span><span id="is_iterable-325"><a href="#is_iterable-325"><span class="linenos">325</span></a><span class="sd"> False</span> +</span><span id="is_iterable-326"><a href="#is_iterable-326"><span class="linenos">326</span></a> +</span><span id="is_iterable-327"><a href="#is_iterable-327"><span class="linenos">327</span></a><span class="sd"> Args:</span> +</span><span id="is_iterable-328"><a href="#is_iterable-328"><span class="linenos">328</span></a><span class="sd"> value: the value to check if it is an iterable.</span> +</span><span id="is_iterable-329"><a href="#is_iterable-329"><span class="linenos">329</span></a> +</span><span id="is_iterable-330"><a href="#is_iterable-330"><span class="linenos">330</span></a><span class="sd"> Returns:</span> +</span><span id="is_iterable-331"><a href="#is_iterable-331"><span class="linenos">331</span></a><span class="sd"> A `bool` value indicating if it is an iterable.</span> +</span><span id="is_iterable-332"><a href="#is_iterable-332"><span class="linenos">332</span></a><span class="sd"> """</span> +</span><span id="is_iterable-333"><a href="#is_iterable-333"><span class="linenos">333</span></a> <span class="k">return</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="s2">"__iter__"</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="nb">bytes</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Checks if the value is an iterable, excluding the types <code>str</code> and <code>bytes</code>.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">is_iterable</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">])</span> +<span class="go">True</span> +<span class="gp">>>> </span><span class="n">is_iterable</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span> +<span class="go">False</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>value:</strong> the value to check if it is an iterable.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A <code>bool</code> value indicating if it is an iterable.</p> +</blockquote> +</div> + + + </section> + <section id="flatten"> + <input id="flatten-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">flatten</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">values</span><span class="p">:</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="n">Iterable</span><span class="p">[</span><span class="n">Any</span><span class="p">],</span> <span class="n">Any</span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n">Iterator</span><span class="p">[</span><span class="n">Any</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="flatten-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#flatten"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="flatten-336"><a href="#flatten-336"><span class="linenos">336</span></a><span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]:</span> +</span><span id="flatten-337"><a href="#flatten-337"><span class="linenos">337</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="flatten-338"><a href="#flatten-338"><span class="linenos">338</span></a><span class="sd"> Flattens an iterable that can contain both iterable and non-iterable elements. Objects of</span> +</span><span id="flatten-339"><a href="#flatten-339"><span class="linenos">339</span></a><span class="sd"> type `str` and `bytes` are not regarded as iterables.</span> +</span><span id="flatten-340"><a href="#flatten-340"><span class="linenos">340</span></a> +</span><span id="flatten-341"><a href="#flatten-341"><span class="linenos">341</span></a><span class="sd"> Examples:</span> +</span><span id="flatten-342"><a href="#flatten-342"><span class="linenos">342</span></a><span class="sd"> >>> list(flatten([[1, 2], 3, {4}, (5, "bla")]))</span> +</span><span id="flatten-343"><a href="#flatten-343"><span class="linenos">343</span></a><span class="sd"> [1, 2, 3, 4, 5, 'bla']</span> +</span><span id="flatten-344"><a href="#flatten-344"><span class="linenos">344</span></a><span class="sd"> >>> list(flatten([1, 2, 3]))</span> +</span><span id="flatten-345"><a href="#flatten-345"><span class="linenos">345</span></a><span class="sd"> [1, 2, 3]</span> +</span><span id="flatten-346"><a href="#flatten-346"><span class="linenos">346</span></a> +</span><span id="flatten-347"><a href="#flatten-347"><span class="linenos">347</span></a><span class="sd"> Args:</span> +</span><span id="flatten-348"><a href="#flatten-348"><span class="linenos">348</span></a><span class="sd"> values: the value to be flattened.</span> +</span><span id="flatten-349"><a href="#flatten-349"><span class="linenos">349</span></a> +</span><span id="flatten-350"><a href="#flatten-350"><span class="linenos">350</span></a><span class="sd"> Yields:</span> +</span><span id="flatten-351"><a href="#flatten-351"><span class="linenos">351</span></a><span class="sd"> Non-iterable elements in `values`.</span> +</span><span id="flatten-352"><a href="#flatten-352"><span class="linenos">352</span></a><span class="sd"> """</span> +</span><span id="flatten-353"><a href="#flatten-353"><span class="linenos">353</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">values</span><span class="p">:</span> +</span><span id="flatten-354"><a href="#flatten-354"><span class="linenos">354</span></a> <span class="k">if</span> <span class="n">is_iterable</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="flatten-355"><a href="#flatten-355"><span class="linenos">355</span></a> <span class="k">yield from</span> <span class="n">flatten</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="flatten-356"><a href="#flatten-356"><span class="linenos">356</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="flatten-357"><a href="#flatten-357"><span class="linenos">357</span></a> <span class="k">yield</span> <span class="n">value</span> +</span></pre></div> + + + <div class="docstring"><p>Flattens an iterable that can contain both iterable and non-iterable elements. Objects of +type <code>str</code> and <code>bytes</code> are not regarded as iterables.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">flatten</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="mi">3</span><span class="p">,</span> <span class="p">{</span><span class="mi">4</span><span class="p">},</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="s2">"bla"</span><span class="p">)]))</span> +<span class="go">[1, 2, 3, 4, 5, 'bla']</span> +<span class="gp">>>> </span><span class="nb">list</span><span class="p">(</span><span class="n">flatten</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]))</span> +<span class="go">[1, 2, 3]</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>values:</strong> the value to be flattened.</li> +</ul> + +<h6 id="yields">Yields:</h6> + +<blockquote> + <p>Non-iterable elements in <code>values</code>.</p> +</blockquote> +</div> + + + </section> + <section id="count_params"> + <input id="count_params-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">count_params</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">function</span><span class="p">:</span> <span class="n">Callable</span></span><span class="return-annotation">) -> <span class="nb">int</span>:</span></span> + + <label class="view-source-button" for="count_params-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#count_params"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="count_params-360"><a href="#count_params-360"><span class="linenos">360</span></a><span class="k">def</span> <span class="nf">count_params</span><span class="p">(</span><span class="n">function</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="count_params-361"><a href="#count_params-361"><span class="linenos">361</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="count_params-362"><a href="#count_params-362"><span class="linenos">362</span></a><span class="sd"> Returns the number of formal parameters expected by a function, without counting "self"</span> +</span><span id="count_params-363"><a href="#count_params-363"><span class="linenos">363</span></a><span class="sd"> and "cls", in case of instance and class methods, respectively.</span> +</span><span id="count_params-364"><a href="#count_params-364"><span class="linenos">364</span></a><span class="sd"> """</span> +</span><span id="count_params-365"><a href="#count_params-365"><span class="linenos">365</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">function</span><span class="o">.</span><span class="vm">__code__</span><span class="o">.</span><span class="n">co_argcount</span> +</span><span id="count_params-366"><a href="#count_params-366"><span class="linenos">366</span></a> <span class="k">return</span> <span class="n">count</span> <span class="o">-</span> <span class="mi">1</span> <span class="k">if</span> <span class="n">inspect</span><span class="o">.</span><span class="n">ismethod</span><span class="p">(</span><span class="n">function</span><span class="p">)</span> <span class="k">else</span> <span class="n">count</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the number of formal parameters expected by a function, without counting "self" +and "cls", in case of instance and class methods, respectively.</p> +</div> + + + </section> + <section id="dict_depth"> + <input id="dict_depth-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">dict_depth</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">d</span><span class="p">:</span> <span class="n">Dict</span></span><span class="return-annotation">) -> <span class="nb">int</span>:</span></span> + + <label class="view-source-button" for="dict_depth-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#dict_depth"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="dict_depth-369"><a href="#dict_depth-369"><span class="linenos">369</span></a><span class="k">def</span> <span class="nf">dict_depth</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="dict_depth-370"><a href="#dict_depth-370"><span class="linenos">370</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="dict_depth-371"><a href="#dict_depth-371"><span class="linenos">371</span></a><span class="sd"> Get the nesting depth of a dictionary.</span> +</span><span id="dict_depth-372"><a href="#dict_depth-372"><span class="linenos">372</span></a> +</span><span id="dict_depth-373"><a href="#dict_depth-373"><span class="linenos">373</span></a><span class="sd"> For example:</span> +</span><span id="dict_depth-374"><a href="#dict_depth-374"><span class="linenos">374</span></a><span class="sd"> >>> dict_depth(None)</span> +</span><span id="dict_depth-375"><a href="#dict_depth-375"><span class="linenos">375</span></a><span class="sd"> 0</span> +</span><span id="dict_depth-376"><a href="#dict_depth-376"><span class="linenos">376</span></a><span class="sd"> >>> dict_depth({})</span> +</span><span id="dict_depth-377"><a href="#dict_depth-377"><span class="linenos">377</span></a><span class="sd"> 1</span> +</span><span id="dict_depth-378"><a href="#dict_depth-378"><span class="linenos">378</span></a><span class="sd"> >>> dict_depth({"a": "b"})</span> +</span><span id="dict_depth-379"><a href="#dict_depth-379"><span class="linenos">379</span></a><span class="sd"> 1</span> +</span><span id="dict_depth-380"><a href="#dict_depth-380"><span class="linenos">380</span></a><span class="sd"> >>> dict_depth({"a": {}})</span> +</span><span id="dict_depth-381"><a href="#dict_depth-381"><span class="linenos">381</span></a><span class="sd"> 2</span> +</span><span id="dict_depth-382"><a href="#dict_depth-382"><span class="linenos">382</span></a><span class="sd"> >>> dict_depth({"a": {"b": {}}})</span> +</span><span id="dict_depth-383"><a href="#dict_depth-383"><span class="linenos">383</span></a><span class="sd"> 3</span> +</span><span id="dict_depth-384"><a href="#dict_depth-384"><span class="linenos">384</span></a> +</span><span id="dict_depth-385"><a href="#dict_depth-385"><span class="linenos">385</span></a><span class="sd"> Args:</span> +</span><span id="dict_depth-386"><a href="#dict_depth-386"><span class="linenos">386</span></a><span class="sd"> d (dict): dictionary</span> +</span><span id="dict_depth-387"><a href="#dict_depth-387"><span class="linenos">387</span></a> +</span><span id="dict_depth-388"><a href="#dict_depth-388"><span class="linenos">388</span></a><span class="sd"> Returns:</span> +</span><span id="dict_depth-389"><a href="#dict_depth-389"><span class="linenos">389</span></a><span class="sd"> int: depth</span> +</span><span id="dict_depth-390"><a href="#dict_depth-390"><span class="linenos">390</span></a><span class="sd"> """</span> +</span><span id="dict_depth-391"><a href="#dict_depth-391"><span class="linenos">391</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="dict_depth-392"><a href="#dict_depth-392"><span class="linenos">392</span></a> <span class="k">return</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">dict_depth</span><span class="p">(</span><span class="nb">next</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">d</span><span class="o">.</span><span class="n">values</span><span class="p">())))</span> +</span><span id="dict_depth-393"><a href="#dict_depth-393"><span class="linenos">393</span></a> <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span> +</span><span id="dict_depth-394"><a href="#dict_depth-394"><span class="linenos">394</span></a> <span class="c1"># d doesn't have attribute "values"</span> +</span><span id="dict_depth-395"><a href="#dict_depth-395"><span class="linenos">395</span></a> <span class="k">return</span> <span class="mi">0</span> +</span><span id="dict_depth-396"><a href="#dict_depth-396"><span class="linenos">396</span></a> <span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span> +</span><span id="dict_depth-397"><a href="#dict_depth-397"><span class="linenos">397</span></a> <span class="c1"># d.values() returns an empty sequence</span> +</span><span id="dict_depth-398"><a href="#dict_depth-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="mi">1</span> +</span></pre></div> + + + <div class="docstring"><p>Get the nesting depth of a dictionary.</p> + +<h6 id="for-example">For example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">dict_depth</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span> +<span class="go">0</span> +<span class="gp">>>> </span><span class="n">dict_depth</span><span class="p">({})</span> +<span class="go">1</span> +<span class="gp">>>> </span><span class="n">dict_depth</span><span class="p">({</span><span class="s2">"a"</span><span class="p">:</span> <span class="s2">"b"</span><span class="p">})</span> +<span class="go">1</span> +<span class="gp">>>> </span><span class="n">dict_depth</span><span class="p">({</span><span class="s2">"a"</span><span class="p">:</span> <span class="p">{}})</span> +<span class="go">2</span> +<span class="gp">>>> </span><span class="n">dict_depth</span><span class="p">({</span><span class="s2">"a"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"b"</span><span class="p">:</span> <span class="p">{}}})</span> +<span class="go">3</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>d (dict):</strong> dictionary</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>int: depth</p> +</blockquote> +</div> + + + </section> + <section id="first"> + <input id="first-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">first</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">it</span><span class="p">:</span> <span class="n">Iterable</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="o">~</span><span class="n">T</span>:</span></span> + + <label class="view-source-button" for="first-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#first"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="first-401"><a href="#first-401"><span class="linenos">401</span></a><span class="k">def</span> <span class="nf">first</span><span class="p">(</span><span class="n">it</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">T</span><span class="p">])</span> <span class="o">-></span> <span class="n">T</span><span class="p">:</span> +</span><span id="first-402"><a href="#first-402"><span class="linenos">402</span></a><span class="w"> </span><span class="sd">"""Returns the first element from an iterable.</span> +</span><span id="first-403"><a href="#first-403"><span class="linenos">403</span></a> +</span><span id="first-404"><a href="#first-404"><span class="linenos">404</span></a><span class="sd"> Useful for sets.</span> +</span><span id="first-405"><a href="#first-405"><span class="linenos">405</span></a><span class="sd"> """</span> +</span><span id="first-406"><a href="#first-406"><span class="linenos">406</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">it</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the first element from an iterable.</p> + +<p>Useful for sets.</p> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/lineage.html b/docs/sqlglot/lineage.html new file mode 100644 index 0000000..37abb1d --- /dev/null +++ b/docs/sqlglot/lineage.html @@ -0,0 +1,931 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.lineage API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Node">Node</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Node.__init__">Node</a> + </li> + <li> + <a class="function" href="#Node.walk">walk</a> + </li> + <li> + <a class="function" href="#Node.to_html">to_html</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#lineage">lineage</a> + </li> + <li> + <a class="class" href="#LineageHTML">LineageHTML</a> + <ul class="memberlist"> + <li> + <a class="function" href="#LineageHTML.__init__">LineageHTML</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/lineage.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.lineage </h1> + + + <input id="mod-lineage-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-lineage-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">json</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">dataclasses</span> <span class="kn">import</span> <span class="n">dataclass</span><span class="p">,</span> <span class="n">field</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">Schema</span><span class="p">,</span> <span class="n">exp</span><span class="p">,</span> <span class="n">maybe_parse</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">build_scope</span><span class="p">,</span> <span class="n">optimize</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.expand_laterals</span> <span class="kn">import</span> <span class="n">expand_laterals</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.qualify_columns</span> <span class="kn">import</span> <span class="n">qualify_columns</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.qualify_tables</span> <span class="kn">import</span> <span class="n">qualify_tables</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">DialectType</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="k">class</span> <span class="nc">Node</span><span class="p">:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">downstream</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="n">field</span><span class="p">(</span><span class="n">default_factory</span><span class="o">=</span><span class="nb">list</span><span class="p">)</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">Node</span><span class="p">]:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="k">yield</span> <span class="bp">self</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">downstream</span><span class="p">:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">d</span><span class="p">,</span> <span class="n">Node</span><span class="p">):</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">yield from</span> <span class="n">d</span><span class="o">.</span><span class="n">walk</span><span class="p">()</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">yield</span> <span class="n">d</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="k">def</span> <span class="nf">to_html</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">LineageHTML</span><span class="p">:</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">return</span> <span class="n">LineageHTML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="k">def</span> <span class="nf">lineage</span><span class="p">(</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">column</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">,</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">|</span> <span class="n">Schema</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">sources</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">rules</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">qualify_tables</span><span class="p">,</span> <span class="n">qualify_columns</span><span class="p">,</span> <span class="n">expand_laterals</span><span class="p">),</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Node</span><span class="p">:</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="w"> </span><span class="sd">"""Build the lineage graph for a column of a SQL query.</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="sd"> Args:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> column: The column to build the lineage for.</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd"> sql: The SQL string or expression.</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> schema: The schema of tables.</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="sd"> sources: A mapping of queries which will be used to continue building lineage.</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> rules: Optimizer rules to apply, by default only qualifying tables and columns.</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="sd"> dialect: The dialect of input SQL.</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> Returns:</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> A lineage node.</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> """</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">if</span> <span class="n">sources</span><span class="p">:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">expand</span><span class="p">(</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="p">{</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">k</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">,</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">))</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="p">},</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">optimized</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">rules</span><span class="o">=</span><span class="n">rules</span><span class="p">)</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">scope</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">optimized</span><span class="p">)</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">def</span> <span class="nf">to_node</span><span class="p">(</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">column_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">scope</span><span class="p">:</span> <span class="n">Scope</span><span class="p">,</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">scope_name</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">upstream</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Node</span><span class="p">:</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">:</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">to_node</span><span class="p">(</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">column_name</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">scope</span><span class="p">,</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">scope_name</span><span class="p">,</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">upstream</span><span class="p">,</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">select</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span> <span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">rules</span><span class="o">=</span><span class="n">rules</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">Node</span><span class="p">(</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">scope_name</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">column_name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">scope_name</span> <span class="k">else</span> <span class="n">column_name</span><span class="p">,</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">select</span><span class="p">,</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">if</span> <span class="n">upstream</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">upstream</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="nb">set</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">to_node</span><span class="p">(</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">node</span><span class="p">,</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="p">)</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">)</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">])</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">return</span> <span class="n">to_node</span><span class="p">(</span><span class="n">column</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">scope</span><span class="p">)</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a><span class="k">class</span> <span class="nc">LineageHTML</span><span class="p">:</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a><span class="w"> </span><span class="sd">"""Node to HTML generator using vis.js.</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a><span class="sd"> https://visjs.github.io/vis-network/docs/network/</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a><span class="sd"> """</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">node</span><span class="p">:</span> <span class="n">Node</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="p">):</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">node</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="p">},</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="p">},</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="p">},</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="p">},</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="p">},</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="p">},</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="p">},</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="p">}</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">walk</span><span class="p">():</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">label</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"FROM </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"<pre>SELECT </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> FROM </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2"></pre>"</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">group</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">label</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tag</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">n</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"<b>"</span><span class="p">,</span> <span class="n">postfix</span><span class="o">=</span><span class="s2">"</b>"</span><span class="p">)</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">if</span> <span class="n">n</span> <span class="ow">is</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="k">else</span> <span class="n">n</span><span class="p">,</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"<pre></span><span class="si">{</span><span class="n">source</span><span class="si">}</span><span class="s2"></pre>"</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">group</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">node_id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="n">node_id</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="s2">"id"</span><span class="p">:</span> <span class="n">node_id</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="s2">"label"</span><span class="p">:</span> <span class="n">label</span><span class="p">,</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="s2">"title"</span><span class="p">:</span> <span class="n">title</span><span class="p">,</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="s2">"group"</span><span class="p">:</span> <span class="n">group</span><span class="p">,</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="p">}</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="p">:</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"from"</span><span class="p">:</span> <span class="n">node_id</span><span class="p">,</span> <span class="s2">"to"</span><span class="p">:</span> <span class="nb">id</span><span class="p">(</span><span class="n">d</span><span class="p">)})</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">edges</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">)</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">imports</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a><span class="w"> </span><span class="sd">"""<script type="text/javascript" src="https://unpkg.com/vis-data@latest/peer/umd/vis-data.min.js"></script></span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a><span class="sd"> <script type="text/javascript" src="https://unpkg.com/vis-network@latest/peer/umd/vis-network.min.js"></script></span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a><span class="sd"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/vis-network/styles/vis-network.min.css" />"""</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="p">)</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"""<div></span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a><span class="s2"> <div id="sqlglot-lineage"></div></span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a><span class="s2"> </span><span class="si">{</span><span class="n">imports</span><span class="si">}</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a><span class="s2"> <script type="text/javascript"></span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a><span class="s2"> var nodes = new vis.DataSet(</span><span class="si">{</span><span class="n">nodes</span><span class="si">}</span><span class="s2">)</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a><span class="s2"> nodes.forEach(row => row["title"] = new DOMParser().parseFromString(row["title"], "text/html").body.childNodes[0])</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a><span class="s2"> new vis.Network(</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a><span class="s2"> document.getElementById("sqlglot-lineage"),</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a><span class="s2"> </span><span class="se">{{</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a><span class="s2"> nodes: nodes,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a><span class="s2"> edges: new vis.DataSet(</span><span class="si">{</span><span class="n">edges</span><span class="si">}</span><span class="s2">)</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a><span class="s2"> </span><span class="se">}}</span><span class="s2">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a><span class="s2"> </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">,</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a><span class="s2"> )</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a><span class="s2"> </script></span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a><span class="s2"></div>"""</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="k">def</span> <span class="nf">_repr_html_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> +</span></pre></div> + + + </section> + <section id="Node"> + <input id="Node-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + <div class="decorator">@dataclass(frozen=True)</div> + + <span class="def">class</span> + <span class="name">Node</span>: + + <label class="view-source-button" for="Node-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Node"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Node-18"><a href="#Node-18"><span class="linenos">18</span></a><span class="nd">@dataclass</span><span class="p">(</span><span class="n">frozen</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Node-19"><a href="#Node-19"><span class="linenos">19</span></a><span class="k">class</span> <span class="nc">Node</span><span class="p">:</span> +</span><span id="Node-20"><a href="#Node-20"><span class="linenos">20</span></a> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span> +</span><span id="Node-21"><a href="#Node-21"><span class="linenos">21</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="Node-22"><a href="#Node-22"><span class="linenos">22</span></a> <span class="n">source</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="Node-23"><a href="#Node-23"><span class="linenos">23</span></a> <span class="n">downstream</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="n">field</span><span class="p">(</span><span class="n">default_factory</span><span class="o">=</span><span class="nb">list</span><span class="p">)</span> +</span><span id="Node-24"><a href="#Node-24"><span class="linenos">24</span></a> +</span><span id="Node-25"><a href="#Node-25"><span class="linenos">25</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">Node</span><span class="p">]:</span> +</span><span id="Node-26"><a href="#Node-26"><span class="linenos">26</span></a> <span class="k">yield</span> <span class="bp">self</span> +</span><span id="Node-27"><a href="#Node-27"><span class="linenos">27</span></a> +</span><span id="Node-28"><a href="#Node-28"><span class="linenos">28</span></a> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">downstream</span><span class="p">:</span> +</span><span id="Node-29"><a href="#Node-29"><span class="linenos">29</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">d</span><span class="p">,</span> <span class="n">Node</span><span class="p">):</span> +</span><span id="Node-30"><a href="#Node-30"><span class="linenos">30</span></a> <span class="k">yield from</span> <span class="n">d</span><span class="o">.</span><span class="n">walk</span><span class="p">()</span> +</span><span id="Node-31"><a href="#Node-31"><span class="linenos">31</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Node-32"><a href="#Node-32"><span class="linenos">32</span></a> <span class="k">yield</span> <span class="n">d</span> +</span><span id="Node-33"><a href="#Node-33"><span class="linenos">33</span></a> +</span><span id="Node-34"><a href="#Node-34"><span class="linenos">34</span></a> <span class="k">def</span> <span class="nf">to_html</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">LineageHTML</span><span class="p">:</span> +</span><span id="Node-35"><a href="#Node-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="n">LineageHTML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + + + <div id="Node.__init__" class="classattr"> + <div class="attr function"> + + <span class="name">Node</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">source</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">downstream</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n"><a href="#Node">sqlglot.lineage.Node</a></span><span class="p">]</span> <span class="o">=</span> <span class="o"><</span><span class="n">factory</span><span class="o">></span></span>)</span> + + + </div> + <a class="headerlink" href="#Node.__init__"></a> + + + + </div> + <div id="Node.walk" class="classattr"> + <input id="Node.walk-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">walk</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="n">Iterator</span><span class="p">[</span><span class="n"><a href="#Node">sqlglot.lineage.Node</a></span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Node.walk-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Node.walk"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Node.walk-25"><a href="#Node.walk-25"><span class="linenos">25</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">Node</span><span class="p">]:</span> +</span><span id="Node.walk-26"><a href="#Node.walk-26"><span class="linenos">26</span></a> <span class="k">yield</span> <span class="bp">self</span> +</span><span id="Node.walk-27"><a href="#Node.walk-27"><span class="linenos">27</span></a> +</span><span id="Node.walk-28"><a href="#Node.walk-28"><span class="linenos">28</span></a> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">downstream</span><span class="p">:</span> +</span><span id="Node.walk-29"><a href="#Node.walk-29"><span class="linenos">29</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">d</span><span class="p">,</span> <span class="n">Node</span><span class="p">):</span> +</span><span id="Node.walk-30"><a href="#Node.walk-30"><span class="linenos">30</span></a> <span class="k">yield from</span> <span class="n">d</span><span class="o">.</span><span class="n">walk</span><span class="p">()</span> +</span><span id="Node.walk-31"><a href="#Node.walk-31"><span class="linenos">31</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Node.walk-32"><a href="#Node.walk-32"><span class="linenos">32</span></a> <span class="k">yield</span> <span class="n">d</span> +</span></pre></div> + + + + + </div> + <div id="Node.to_html" class="classattr"> + <input id="Node.to_html-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">to_html</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">opts</span></span><span class="return-annotation">) -> <span class="n"><a href="#LineageHTML">sqlglot.lineage.LineageHTML</a></span>:</span></span> + + <label class="view-source-button" for="Node.to_html-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Node.to_html"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Node.to_html-34"><a href="#Node.to_html-34"><span class="linenos">34</span></a> <span class="k">def</span> <span class="nf">to_html</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> <span class="o">-></span> <span class="n">LineageHTML</span><span class="p">:</span> +</span><span id="Node.to_html-35"><a href="#Node.to_html-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="n">LineageHTML</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">opts</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="lineage"> + <input id="lineage-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lineage</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">column</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="expressions.html#Column">sqlglot.expressions.Column</a></span>,</span><span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">schema</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Dict</span><span class="p">,</span> <span class="n"><a href="schema.html#Schema">sqlglot.schema.Schema</a></span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">sources</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span> <span class="o">|</span> <span class="n"><a href="expressions.html#Subqueryable">sqlglot.expressions.Subqueryable</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">rules</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="o"><</span><span class="n">function</span> <span class="n">qualify_tables</span> <span class="n">at</span> <span class="mh">0x7ff75a9d9240</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">qualify_columns</span> <span class="n">at</span> <span class="mh">0x7ff75a9d8820</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">expand_laterals</span> <span class="n">at</span> <span class="mh">0x7ff75a9b2b90</span><span class="o">></span><span class="p">)</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Node">sqlglot.lineage.Node</a></span>:</span></span> + + <label class="view-source-button" for="lineage-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#lineage"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="lineage-38"><a href="#lineage-38"><span class="linenos"> 38</span></a><span class="k">def</span> <span class="nf">lineage</span><span class="p">(</span> +</span><span id="lineage-39"><a href="#lineage-39"><span class="linenos"> 39</span></a> <span class="n">column</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">,</span> +</span><span id="lineage-40"><a href="#lineage-40"><span class="linenos"> 40</span></a> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> +</span><span id="lineage-41"><a href="#lineage-41"><span class="linenos"> 41</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">|</span> <span class="n">Schema</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="lineage-42"><a href="#lineage-42"><span class="linenos"> 42</span></a> <span class="n">sources</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="lineage-43"><a href="#lineage-43"><span class="linenos"> 43</span></a> <span class="n">rules</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">qualify_tables</span><span class="p">,</span> <span class="n">qualify_columns</span><span class="p">,</span> <span class="n">expand_laterals</span><span class="p">),</span> +</span><span id="lineage-44"><a href="#lineage-44"><span class="linenos"> 44</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="lineage-45"><a href="#lineage-45"><span class="linenos"> 45</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">Node</span><span class="p">:</span> +</span><span id="lineage-46"><a href="#lineage-46"><span class="linenos"> 46</span></a><span class="w"> </span><span class="sd">"""Build the lineage graph for a column of a SQL query.</span> +</span><span id="lineage-47"><a href="#lineage-47"><span class="linenos"> 47</span></a> +</span><span id="lineage-48"><a href="#lineage-48"><span class="linenos"> 48</span></a><span class="sd"> Args:</span> +</span><span id="lineage-49"><a href="#lineage-49"><span class="linenos"> 49</span></a><span class="sd"> column: The column to build the lineage for.</span> +</span><span id="lineage-50"><a href="#lineage-50"><span class="linenos"> 50</span></a><span class="sd"> sql: The SQL string or expression.</span> +</span><span id="lineage-51"><a href="#lineage-51"><span class="linenos"> 51</span></a><span class="sd"> schema: The schema of tables.</span> +</span><span id="lineage-52"><a href="#lineage-52"><span class="linenos"> 52</span></a><span class="sd"> sources: A mapping of queries which will be used to continue building lineage.</span> +</span><span id="lineage-53"><a href="#lineage-53"><span class="linenos"> 53</span></a><span class="sd"> rules: Optimizer rules to apply, by default only qualifying tables and columns.</span> +</span><span id="lineage-54"><a href="#lineage-54"><span class="linenos"> 54</span></a><span class="sd"> dialect: The dialect of input SQL.</span> +</span><span id="lineage-55"><a href="#lineage-55"><span class="linenos"> 55</span></a> +</span><span id="lineage-56"><a href="#lineage-56"><span class="linenos"> 56</span></a><span class="sd"> Returns:</span> +</span><span id="lineage-57"><a href="#lineage-57"><span class="linenos"> 57</span></a><span class="sd"> A lineage node.</span> +</span><span id="lineage-58"><a href="#lineage-58"><span class="linenos"> 58</span></a><span class="sd"> """</span> +</span><span id="lineage-59"><a href="#lineage-59"><span class="linenos"> 59</span></a> +</span><span id="lineage-60"><a href="#lineage-60"><span class="linenos"> 60</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="lineage-61"><a href="#lineage-61"><span class="linenos"> 61</span></a> +</span><span id="lineage-62"><a href="#lineage-62"><span class="linenos"> 62</span></a> <span class="k">if</span> <span class="n">sources</span><span class="p">:</span> +</span><span id="lineage-63"><a href="#lineage-63"><span class="linenos"> 63</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">expand</span><span class="p">(</span> +</span><span id="lineage-64"><a href="#lineage-64"><span class="linenos"> 64</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="lineage-65"><a href="#lineage-65"><span class="linenos"> 65</span></a> <span class="p">{</span> +</span><span id="lineage-66"><a href="#lineage-66"><span class="linenos"> 66</span></a> <span class="n">k</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">,</span> <span class="n">maybe_parse</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">))</span> +</span><span id="lineage-67"><a href="#lineage-67"><span class="linenos"> 67</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="lineage-68"><a href="#lineage-68"><span class="linenos"> 68</span></a> <span class="p">},</span> +</span><span id="lineage-69"><a href="#lineage-69"><span class="linenos"> 69</span></a> <span class="p">)</span> +</span><span id="lineage-70"><a href="#lineage-70"><span class="linenos"> 70</span></a> +</span><span id="lineage-71"><a href="#lineage-71"><span class="linenos"> 71</span></a> <span class="n">optimized</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">rules</span><span class="o">=</span><span class="n">rules</span><span class="p">)</span> +</span><span id="lineage-72"><a href="#lineage-72"><span class="linenos"> 72</span></a> <span class="n">scope</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">optimized</span><span class="p">)</span> +</span><span id="lineage-73"><a href="#lineage-73"><span class="linenos"> 73</span></a> <span class="n">tables</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="lineage-74"><a href="#lineage-74"><span class="linenos"> 74</span></a> +</span><span id="lineage-75"><a href="#lineage-75"><span class="linenos"> 75</span></a> <span class="k">def</span> <span class="nf">to_node</span><span class="p">(</span> +</span><span id="lineage-76"><a href="#lineage-76"><span class="linenos"> 76</span></a> <span class="n">column_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="lineage-77"><a href="#lineage-77"><span class="linenos"> 77</span></a> <span class="n">scope</span><span class="p">:</span> <span class="n">Scope</span><span class="p">,</span> +</span><span id="lineage-78"><a href="#lineage-78"><span class="linenos"> 78</span></a> <span class="n">scope_name</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="lineage-79"><a href="#lineage-79"><span class="linenos"> 79</span></a> <span class="n">upstream</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Node</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="lineage-80"><a href="#lineage-80"><span class="linenos"> 80</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Node</span><span class="p">:</span> +</span><span id="lineage-81"><a href="#lineage-81"><span class="linenos"> 81</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="lineage-82"><a href="#lineage-82"><span class="linenos"> 82</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">:</span> +</span><span id="lineage-83"><a href="#lineage-83"><span class="linenos"> 83</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">to_node</span><span class="p">(</span> +</span><span id="lineage-84"><a href="#lineage-84"><span class="linenos"> 84</span></a> <span class="n">column_name</span><span class="p">,</span> +</span><span id="lineage-85"><a href="#lineage-85"><span class="linenos"> 85</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">scope</span><span class="p">,</span> +</span><span id="lineage-86"><a href="#lineage-86"><span class="linenos"> 86</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">scope_name</span><span class="p">,</span> +</span><span id="lineage-87"><a href="#lineage-87"><span class="linenos"> 87</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">upstream</span><span class="p">,</span> +</span><span id="lineage-88"><a href="#lineage-88"><span class="linenos"> 88</span></a> <span class="p">)</span> +</span><span id="lineage-89"><a href="#lineage-89"><span class="linenos"> 89</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="lineage-90"><a href="#lineage-90"><span class="linenos"> 90</span></a> +</span><span id="lineage-91"><a href="#lineage-91"><span class="linenos"> 91</span></a> <span class="n">select</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span> <span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="n">column_name</span><span class="p">)</span> +</span><span id="lineage-92"><a href="#lineage-92"><span class="linenos"> 92</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">optimize</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> <span class="n">rules</span><span class="o">=</span><span class="n">rules</span><span class="p">)</span> +</span><span id="lineage-93"><a href="#lineage-93"><span class="linenos"> 93</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="lineage-94"><a href="#lineage-94"><span class="linenos"> 94</span></a> +</span><span id="lineage-95"><a href="#lineage-95"><span class="linenos"> 95</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">Node</span><span class="p">(</span> +</span><span id="lineage-96"><a href="#lineage-96"><span class="linenos"> 96</span></a> <span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">scope_name</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">column_name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">scope_name</span> <span class="k">else</span> <span class="n">column_name</span><span class="p">,</span> +</span><span id="lineage-97"><a href="#lineage-97"><span class="linenos"> 97</span></a> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> +</span><span id="lineage-98"><a href="#lineage-98"><span class="linenos"> 98</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">select</span><span class="p">,</span> +</span><span id="lineage-99"><a href="#lineage-99"><span class="linenos"> 99</span></a> <span class="p">)</span> +</span><span id="lineage-100"><a href="#lineage-100"><span class="linenos">100</span></a> +</span><span id="lineage-101"><a href="#lineage-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="n">upstream</span><span class="p">:</span> +</span><span id="lineage-102"><a href="#lineage-102"><span class="linenos">102</span></a> <span class="n">upstream</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="lineage-103"><a href="#lineage-103"><span class="linenos">103</span></a> +</span><span id="lineage-104"><a href="#lineage-104"><span class="linenos">104</span></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="nb">set</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)):</span> +</span><span id="lineage-105"><a href="#lineage-105"><span class="linenos">105</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> +</span><span id="lineage-106"><a href="#lineage-106"><span class="linenos">106</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> +</span><span id="lineage-107"><a href="#lineage-107"><span class="linenos">107</span></a> +</span><span id="lineage-108"><a href="#lineage-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="lineage-109"><a href="#lineage-109"><span class="linenos">109</span></a> <span class="n">to_node</span><span class="p">(</span> +</span><span id="lineage-110"><a href="#lineage-110"><span class="linenos">110</span></a> <span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="lineage-111"><a href="#lineage-111"><span class="linenos">111</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> +</span><span id="lineage-112"><a href="#lineage-112"><span class="linenos">112</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> +</span><span id="lineage-113"><a href="#lineage-113"><span class="linenos">113</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">node</span><span class="p">,</span> +</span><span id="lineage-114"><a href="#lineage-114"><span class="linenos">114</span></a> <span class="p">)</span> +</span><span id="lineage-115"><a href="#lineage-115"><span class="linenos">115</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="lineage-116"><a href="#lineage-116"><span class="linenos">116</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="lineage-117"><a href="#lineage-117"><span class="linenos">117</span></a> <span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">)</span> +</span><span id="lineage-118"><a href="#lineage-118"><span class="linenos">118</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">tables</span><span class="p">[</span><span class="n">table</span><span class="p">])</span> +</span><span id="lineage-119"><a href="#lineage-119"><span class="linenos">119</span></a> +</span><span id="lineage-120"><a href="#lineage-120"><span class="linenos">120</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="lineage-121"><a href="#lineage-121"><span class="linenos">121</span></a> +</span><span id="lineage-122"><a href="#lineage-122"><span class="linenos">122</span></a> <span class="k">return</span> <span class="n">to_node</span><span class="p">(</span><span class="n">column</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">scope</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Build the lineage graph for a column of a SQL query.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>column:</strong> The column to build the lineage for.</li> +<li><strong>sql:</strong> The SQL string or expression.</li> +<li><strong>schema:</strong> The schema of tables.</li> +<li><strong>sources:</strong> A mapping of queries which will be used to continue building lineage.</li> +<li><strong>rules:</strong> Optimizer rules to apply, by default only qualifying tables and columns.</li> +<li><strong>dialect:</strong> The dialect of input SQL.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A lineage node.</p> +</blockquote> +</div> + + + </section> + <section id="LineageHTML"> + <input id="LineageHTML-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">LineageHTML</span>: + + <label class="view-source-button" for="LineageHTML-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LineageHTML"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LineageHTML-125"><a href="#LineageHTML-125"><span class="linenos">125</span></a><span class="k">class</span> <span class="nc">LineageHTML</span><span class="p">:</span> +</span><span id="LineageHTML-126"><a href="#LineageHTML-126"><span class="linenos">126</span></a><span class="w"> </span><span class="sd">"""Node to HTML generator using vis.js.</span> +</span><span id="LineageHTML-127"><a href="#LineageHTML-127"><span class="linenos">127</span></a> +</span><span id="LineageHTML-128"><a href="#LineageHTML-128"><span class="linenos">128</span></a><span class="sd"> https://visjs.github.io/vis-network/docs/network/</span> +</span><span id="LineageHTML-129"><a href="#LineageHTML-129"><span class="linenos">129</span></a><span class="sd"> """</span> +</span><span id="LineageHTML-130"><a href="#LineageHTML-130"><span class="linenos">130</span></a> +</span><span id="LineageHTML-131"><a href="#LineageHTML-131"><span class="linenos">131</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="LineageHTML-132"><a href="#LineageHTML-132"><span class="linenos">132</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="LineageHTML-133"><a href="#LineageHTML-133"><span class="linenos">133</span></a> <span class="n">node</span><span class="p">:</span> <span class="n">Node</span><span class="p">,</span> +</span><span id="LineageHTML-134"><a href="#LineageHTML-134"><span class="linenos">134</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="LineageHTML-135"><a href="#LineageHTML-135"><span class="linenos">135</span></a> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="LineageHTML-136"><a href="#LineageHTML-136"><span class="linenos">136</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="LineageHTML-137"><a href="#LineageHTML-137"><span class="linenos">137</span></a> <span class="p">):</span> +</span><span id="LineageHTML-138"><a href="#LineageHTML-138"><span class="linenos">138</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">node</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="LineageHTML-139"><a href="#LineageHTML-139"><span class="linenos">139</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> +</span><span id="LineageHTML-140"><a href="#LineageHTML-140"><span class="linenos">140</span></a> +</span><span id="LineageHTML-141"><a href="#LineageHTML-141"><span class="linenos">141</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="LineageHTML-142"><a href="#LineageHTML-142"><span class="linenos">142</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> +</span><span id="LineageHTML-143"><a href="#LineageHTML-143"><span class="linenos">143</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> +</span><span id="LineageHTML-144"><a href="#LineageHTML-144"><span class="linenos">144</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-145"><a href="#LineageHTML-145"><span class="linenos">145</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-146"><a href="#LineageHTML-146"><span class="linenos">146</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="LineageHTML-147"><a href="#LineageHTML-147"><span class="linenos">147</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> +</span><span id="LineageHTML-148"><a href="#LineageHTML-148"><span class="linenos">148</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> +</span><span id="LineageHTML-149"><a href="#LineageHTML-149"><span class="linenos">149</span></a> <span class="p">},</span> +</span><span id="LineageHTML-150"><a href="#LineageHTML-150"><span class="linenos">150</span></a> <span class="p">},</span> +</span><span id="LineageHTML-151"><a href="#LineageHTML-151"><span class="linenos">151</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-152"><a href="#LineageHTML-152"><span class="linenos">152</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML-153"><a href="#LineageHTML-153"><span class="linenos">153</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML-154"><a href="#LineageHTML-154"><span class="linenos">154</span></a> <span class="p">},</span> +</span><span id="LineageHTML-155"><a href="#LineageHTML-155"><span class="linenos">155</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-156"><a href="#LineageHTML-156"><span class="linenos">156</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML-157"><a href="#LineageHTML-157"><span class="linenos">157</span></a> <span class="p">},</span> +</span><span id="LineageHTML-158"><a href="#LineageHTML-158"><span class="linenos">158</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-159"><a href="#LineageHTML-159"><span class="linenos">159</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="LineageHTML-160"><a href="#LineageHTML-160"><span class="linenos">160</span></a> <span class="p">},</span> +</span><span id="LineageHTML-161"><a href="#LineageHTML-161"><span class="linenos">161</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-162"><a href="#LineageHTML-162"><span class="linenos">162</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> +</span><span id="LineageHTML-163"><a href="#LineageHTML-163"><span class="linenos">163</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> +</span><span id="LineageHTML-164"><a href="#LineageHTML-164"><span class="linenos">164</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML-165"><a href="#LineageHTML-165"><span class="linenos">165</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> +</span><span id="LineageHTML-166"><a href="#LineageHTML-166"><span class="linenos">166</span></a> <span class="p">},</span> +</span><span id="LineageHTML-167"><a href="#LineageHTML-167"><span class="linenos">167</span></a> <span class="p">},</span> +</span><span id="LineageHTML-168"><a href="#LineageHTML-168"><span class="linenos">168</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="LineageHTML-169"><a href="#LineageHTML-169"><span class="linenos">169</span></a> <span class="p">}</span> +</span><span id="LineageHTML-170"><a href="#LineageHTML-170"><span class="linenos">170</span></a> +</span><span id="LineageHTML-171"><a href="#LineageHTML-171"><span class="linenos">171</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="LineageHTML-172"><a href="#LineageHTML-172"><span class="linenos">172</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="LineageHTML-173"><a href="#LineageHTML-173"><span class="linenos">173</span></a> +</span><span id="LineageHTML-174"><a href="#LineageHTML-174"><span class="linenos">174</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">walk</span><span class="p">():</span> +</span><span id="LineageHTML-175"><a href="#LineageHTML-175"><span class="linenos">175</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="LineageHTML-176"><a href="#LineageHTML-176"><span class="linenos">176</span></a> <span class="n">label</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"FROM </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="LineageHTML-177"><a href="#LineageHTML-177"><span class="linenos">177</span></a> <span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"<pre>SELECT </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> FROM </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2"></pre>"</span> +</span><span id="LineageHTML-178"><a href="#LineageHTML-178"><span class="linenos">178</span></a> <span class="n">group</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="LineageHTML-179"><a href="#LineageHTML-179"><span class="linenos">179</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="LineageHTML-180"><a href="#LineageHTML-180"><span class="linenos">180</span></a> <span class="n">label</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="LineageHTML-181"><a href="#LineageHTML-181"><span class="linenos">181</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="LineageHTML-182"><a href="#LineageHTML-182"><span class="linenos">182</span></a> <span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tag</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">n</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"<b>"</span><span class="p">,</span> <span class="n">postfix</span><span class="o">=</span><span class="s2">"</b>"</span><span class="p">)</span> +</span><span id="LineageHTML-183"><a href="#LineageHTML-183"><span class="linenos">183</span></a> <span class="k">if</span> <span class="n">n</span> <span class="ow">is</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span> +</span><span id="LineageHTML-184"><a href="#LineageHTML-184"><span class="linenos">184</span></a> <span class="k">else</span> <span class="n">n</span><span class="p">,</span> +</span><span id="LineageHTML-185"><a href="#LineageHTML-185"><span class="linenos">185</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML-186"><a href="#LineageHTML-186"><span class="linenos">186</span></a> <span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="LineageHTML-187"><a href="#LineageHTML-187"><span class="linenos">187</span></a> <span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"<pre></span><span class="si">{</span><span class="n">source</span><span class="si">}</span><span class="s2"></pre>"</span> +</span><span id="LineageHTML-188"><a href="#LineageHTML-188"><span class="linenos">188</span></a> <span class="n">group</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="LineageHTML-189"><a href="#LineageHTML-189"><span class="linenos">189</span></a> +</span><span id="LineageHTML-190"><a href="#LineageHTML-190"><span class="linenos">190</span></a> <span class="n">node_id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="LineageHTML-191"><a href="#LineageHTML-191"><span class="linenos">191</span></a> +</span><span id="LineageHTML-192"><a href="#LineageHTML-192"><span class="linenos">192</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="n">node_id</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="LineageHTML-193"><a href="#LineageHTML-193"><span class="linenos">193</span></a> <span class="s2">"id"</span><span class="p">:</span> <span class="n">node_id</span><span class="p">,</span> +</span><span id="LineageHTML-194"><a href="#LineageHTML-194"><span class="linenos">194</span></a> <span class="s2">"label"</span><span class="p">:</span> <span class="n">label</span><span class="p">,</span> +</span><span id="LineageHTML-195"><a href="#LineageHTML-195"><span class="linenos">195</span></a> <span class="s2">"title"</span><span class="p">:</span> <span class="n">title</span><span class="p">,</span> +</span><span id="LineageHTML-196"><a href="#LineageHTML-196"><span class="linenos">196</span></a> <span class="s2">"group"</span><span class="p">:</span> <span class="n">group</span><span class="p">,</span> +</span><span id="LineageHTML-197"><a href="#LineageHTML-197"><span class="linenos">197</span></a> <span class="p">}</span> +</span><span id="LineageHTML-198"><a href="#LineageHTML-198"><span class="linenos">198</span></a> +</span><span id="LineageHTML-199"><a href="#LineageHTML-199"><span class="linenos">199</span></a> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="p">:</span> +</span><span id="LineageHTML-200"><a href="#LineageHTML-200"><span class="linenos">200</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"from"</span><span class="p">:</span> <span class="n">node_id</span><span class="p">,</span> <span class="s2">"to"</span><span class="p">:</span> <span class="nb">id</span><span class="p">(</span><span class="n">d</span><span class="p">)})</span> +</span><span id="LineageHTML-201"><a href="#LineageHTML-201"><span class="linenos">201</span></a> +</span><span id="LineageHTML-202"><a href="#LineageHTML-202"><span class="linenos">202</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="LineageHTML-203"><a href="#LineageHTML-203"><span class="linenos">203</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span> +</span><span id="LineageHTML-204"><a href="#LineageHTML-204"><span class="linenos">204</span></a> <span class="n">edges</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> +</span><span id="LineageHTML-205"><a href="#LineageHTML-205"><span class="linenos">205</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">)</span> +</span><span id="LineageHTML-206"><a href="#LineageHTML-206"><span class="linenos">206</span></a> <span class="n">imports</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="LineageHTML-207"><a href="#LineageHTML-207"><span class="linenos">207</span></a><span class="w"> </span><span class="sd">"""<script type="text/javascript" src="https://unpkg.com/vis-data@latest/peer/umd/vis-data.min.js"></script></span> +</span><span id="LineageHTML-208"><a href="#LineageHTML-208"><span class="linenos">208</span></a><span class="sd"> <script type="text/javascript" src="https://unpkg.com/vis-network@latest/peer/umd/vis-network.min.js"></script></span> +</span><span id="LineageHTML-209"><a href="#LineageHTML-209"><span class="linenos">209</span></a><span class="sd"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/vis-network/styles/vis-network.min.css" />"""</span> +</span><span id="LineageHTML-210"><a href="#LineageHTML-210"><span class="linenos">210</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> +</span><span id="LineageHTML-211"><a href="#LineageHTML-211"><span class="linenos">211</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="LineageHTML-212"><a href="#LineageHTML-212"><span class="linenos">212</span></a> <span class="p">)</span> +</span><span id="LineageHTML-213"><a href="#LineageHTML-213"><span class="linenos">213</span></a> +</span><span id="LineageHTML-214"><a href="#LineageHTML-214"><span class="linenos">214</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"""<div></span> +</span><span id="LineageHTML-215"><a href="#LineageHTML-215"><span class="linenos">215</span></a><span class="s2"> <div id="sqlglot-lineage"></div></span> +</span><span id="LineageHTML-216"><a href="#LineageHTML-216"><span class="linenos">216</span></a><span class="s2"> </span><span class="si">{</span><span class="n">imports</span><span class="si">}</span> +</span><span id="LineageHTML-217"><a href="#LineageHTML-217"><span class="linenos">217</span></a><span class="s2"> <script type="text/javascript"></span> +</span><span id="LineageHTML-218"><a href="#LineageHTML-218"><span class="linenos">218</span></a><span class="s2"> var nodes = new vis.DataSet(</span><span class="si">{</span><span class="n">nodes</span><span class="si">}</span><span class="s2">)</span> +</span><span id="LineageHTML-219"><a href="#LineageHTML-219"><span class="linenos">219</span></a><span class="s2"> nodes.forEach(row => row["title"] = new DOMParser().parseFromString(row["title"], "text/html").body.childNodes[0])</span> +</span><span id="LineageHTML-220"><a href="#LineageHTML-220"><span class="linenos">220</span></a> +</span><span id="LineageHTML-221"><a href="#LineageHTML-221"><span class="linenos">221</span></a><span class="s2"> new vis.Network(</span> +</span><span id="LineageHTML-222"><a href="#LineageHTML-222"><span class="linenos">222</span></a><span class="s2"> document.getElementById("sqlglot-lineage"),</span> +</span><span id="LineageHTML-223"><a href="#LineageHTML-223"><span class="linenos">223</span></a><span class="s2"> </span><span class="se">{{</span> +</span><span id="LineageHTML-224"><a href="#LineageHTML-224"><span class="linenos">224</span></a><span class="s2"> nodes: nodes,</span> +</span><span id="LineageHTML-225"><a href="#LineageHTML-225"><span class="linenos">225</span></a><span class="s2"> edges: new vis.DataSet(</span><span class="si">{</span><span class="n">edges</span><span class="si">}</span><span class="s2">)</span> +</span><span id="LineageHTML-226"><a href="#LineageHTML-226"><span class="linenos">226</span></a><span class="s2"> </span><span class="se">}}</span><span class="s2">,</span> +</span><span id="LineageHTML-227"><a href="#LineageHTML-227"><span class="linenos">227</span></a><span class="s2"> </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">,</span> +</span><span id="LineageHTML-228"><a href="#LineageHTML-228"><span class="linenos">228</span></a><span class="s2"> )</span> +</span><span id="LineageHTML-229"><a href="#LineageHTML-229"><span class="linenos">229</span></a><span class="s2"> </script></span> +</span><span id="LineageHTML-230"><a href="#LineageHTML-230"><span class="linenos">230</span></a><span class="s2"></div>"""</span> +</span><span id="LineageHTML-231"><a href="#LineageHTML-231"><span class="linenos">231</span></a> +</span><span id="LineageHTML-232"><a href="#LineageHTML-232"><span class="linenos">232</span></a> <span class="k">def</span> <span class="nf">_repr_html_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="LineageHTML-233"><a href="#LineageHTML-233"><span class="linenos">233</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Node to HTML generator using vis.js.</p> + +<p><a href="https://visjs.github.io/vis-network/docs/network/">https://visjs.github.io/vis-network/docs/network/</a></p> +</div> + + + <div id="LineageHTML.__init__" class="classattr"> + <input id="LineageHTML.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">LineageHTML</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">node</span><span class="p">:</span> <span class="n"><a href="#Node">sqlglot.lineage.Node</a></span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>,</span><span class="param"> <span class="o">**</span><span class="n">opts</span><span class="p">:</span> <span class="n">Any</span></span>)</span> + + <label class="view-source-button" for="LineageHTML.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#LineageHTML.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="LineageHTML.__init__-131"><a href="#LineageHTML.__init__-131"><span class="linenos">131</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="LineageHTML.__init__-132"><a href="#LineageHTML.__init__-132"><span class="linenos">132</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-133"><a href="#LineageHTML.__init__-133"><span class="linenos">133</span></a> <span class="n">node</span><span class="p">:</span> <span class="n">Node</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-134"><a href="#LineageHTML.__init__-134"><span class="linenos">134</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-135"><a href="#LineageHTML.__init__-135"><span class="linenos">135</span></a> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-136"><a href="#LineageHTML.__init__-136"><span class="linenos">136</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-137"><a href="#LineageHTML.__init__-137"><span class="linenos">137</span></a> <span class="p">):</span> +</span><span id="LineageHTML.__init__-138"><a href="#LineageHTML.__init__-138"><span class="linenos">138</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">node</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="LineageHTML.__init__-139"><a href="#LineageHTML.__init__-139"><span class="linenos">139</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> +</span><span id="LineageHTML.__init__-140"><a href="#LineageHTML.__init__-140"><span class="linenos">140</span></a> +</span><span id="LineageHTML.__init__-141"><a href="#LineageHTML.__init__-141"><span class="linenos">141</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-142"><a href="#LineageHTML.__init__-142"><span class="linenos">142</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-143"><a href="#LineageHTML.__init__-143"><span class="linenos">143</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-144"><a href="#LineageHTML.__init__-144"><span class="linenos">144</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-145"><a href="#LineageHTML.__init__-145"><span class="linenos">145</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-146"><a href="#LineageHTML.__init__-146"><span class="linenos">146</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-147"><a href="#LineageHTML.__init__-147"><span class="linenos">147</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-148"><a href="#LineageHTML.__init__-148"><span class="linenos">148</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-149"><a href="#LineageHTML.__init__-149"><span class="linenos">149</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-150"><a href="#LineageHTML.__init__-150"><span class="linenos">150</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-151"><a href="#LineageHTML.__init__-151"><span class="linenos">151</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-152"><a href="#LineageHTML.__init__-152"><span class="linenos">152</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-153"><a href="#LineageHTML.__init__-153"><span class="linenos">153</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-154"><a href="#LineageHTML.__init__-154"><span class="linenos">154</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-155"><a href="#LineageHTML.__init__-155"><span class="linenos">155</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-156"><a href="#LineageHTML.__init__-156"><span class="linenos">156</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-157"><a href="#LineageHTML.__init__-157"><span class="linenos">157</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-158"><a href="#LineageHTML.__init__-158"><span class="linenos">158</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-159"><a href="#LineageHTML.__init__-159"><span class="linenos">159</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-160"><a href="#LineageHTML.__init__-160"><span class="linenos">160</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-161"><a href="#LineageHTML.__init__-161"><span class="linenos">161</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-162"><a href="#LineageHTML.__init__-162"><span class="linenos">162</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-163"><a href="#LineageHTML.__init__-163"><span class="linenos">163</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-164"><a href="#LineageHTML.__init__-164"><span class="linenos">164</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-165"><a href="#LineageHTML.__init__-165"><span class="linenos">165</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-166"><a href="#LineageHTML.__init__-166"><span class="linenos">166</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-167"><a href="#LineageHTML.__init__-167"><span class="linenos">167</span></a> <span class="p">},</span> +</span><span id="LineageHTML.__init__-168"><a href="#LineageHTML.__init__-168"><span class="linenos">168</span></a> <span class="o">**</span><span class="n">opts</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-169"><a href="#LineageHTML.__init__-169"><span class="linenos">169</span></a> <span class="p">}</span> +</span><span id="LineageHTML.__init__-170"><a href="#LineageHTML.__init__-170"><span class="linenos">170</span></a> +</span><span id="LineageHTML.__init__-171"><a href="#LineageHTML.__init__-171"><span class="linenos">171</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="LineageHTML.__init__-172"><a href="#LineageHTML.__init__-172"><span class="linenos">172</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="LineageHTML.__init__-173"><a href="#LineageHTML.__init__-173"><span class="linenos">173</span></a> +</span><span id="LineageHTML.__init__-174"><a href="#LineageHTML.__init__-174"><span class="linenos">174</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">walk</span><span class="p">():</span> +</span><span id="LineageHTML.__init__-175"><a href="#LineageHTML.__init__-175"><span class="linenos">175</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="LineageHTML.__init__-176"><a href="#LineageHTML.__init__-176"><span class="linenos">176</span></a> <span class="n">label</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"FROM </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2">"</span> +</span><span id="LineageHTML.__init__-177"><a href="#LineageHTML.__init__-177"><span class="linenos">177</span></a> <span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"<pre>SELECT </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> FROM </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2"></pre>"</span> +</span><span id="LineageHTML.__init__-178"><a href="#LineageHTML.__init__-178"><span class="linenos">178</span></a> <span class="n">group</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="LineageHTML.__init__-179"><a href="#LineageHTML.__init__-179"><span class="linenos">179</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="LineageHTML.__init__-180"><a href="#LineageHTML.__init__-180"><span class="linenos">180</span></a> <span class="n">label</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="LineageHTML.__init__-181"><a href="#LineageHTML.__init__-181"><span class="linenos">181</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="LineageHTML.__init__-182"><a href="#LineageHTML.__init__-182"><span class="linenos">182</span></a> <span class="k">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tag</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">n</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">"<b>"</span><span class="p">,</span> <span class="n">postfix</span><span class="o">=</span><span class="s2">"</b>"</span><span class="p">)</span> +</span><span id="LineageHTML.__init__-183"><a href="#LineageHTML.__init__-183"><span class="linenos">183</span></a> <span class="k">if</span> <span class="n">n</span> <span class="ow">is</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span> +</span><span id="LineageHTML.__init__-184"><a href="#LineageHTML.__init__-184"><span class="linenos">184</span></a> <span class="k">else</span> <span class="n">n</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-185"><a href="#LineageHTML.__init__-185"><span class="linenos">185</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-186"><a href="#LineageHTML.__init__-186"><span class="linenos">186</span></a> <span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">pretty</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="LineageHTML.__init__-187"><a href="#LineageHTML.__init__-187"><span class="linenos">187</span></a> <span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"<pre></span><span class="si">{</span><span class="n">source</span><span class="si">}</span><span class="s2"></pre>"</span> +</span><span id="LineageHTML.__init__-188"><a href="#LineageHTML.__init__-188"><span class="linenos">188</span></a> <span class="n">group</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="LineageHTML.__init__-189"><a href="#LineageHTML.__init__-189"><span class="linenos">189</span></a> +</span><span id="LineageHTML.__init__-190"><a href="#LineageHTML.__init__-190"><span class="linenos">190</span></a> <span class="n">node_id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="LineageHTML.__init__-191"><a href="#LineageHTML.__init__-191"><span class="linenos">191</span></a> +</span><span id="LineageHTML.__init__-192"><a href="#LineageHTML.__init__-192"><span class="linenos">192</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="n">node_id</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="LineageHTML.__init__-193"><a href="#LineageHTML.__init__-193"><span class="linenos">193</span></a> <span class="s2">"id"</span><span class="p">:</span> <span class="n">node_id</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-194"><a href="#LineageHTML.__init__-194"><span class="linenos">194</span></a> <span class="s2">"label"</span><span class="p">:</span> <span class="n">label</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-195"><a href="#LineageHTML.__init__-195"><span class="linenos">195</span></a> <span class="s2">"title"</span><span class="p">:</span> <span class="n">title</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-196"><a href="#LineageHTML.__init__-196"><span class="linenos">196</span></a> <span class="s2">"group"</span><span class="p">:</span> <span class="n">group</span><span class="p">,</span> +</span><span id="LineageHTML.__init__-197"><a href="#LineageHTML.__init__-197"><span class="linenos">197</span></a> <span class="p">}</span> +</span><span id="LineageHTML.__init__-198"><a href="#LineageHTML.__init__-198"><span class="linenos">198</span></a> +</span><span id="LineageHTML.__init__-199"><a href="#LineageHTML.__init__-199"><span class="linenos">199</span></a> <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="p">:</span> +</span><span id="LineageHTML.__init__-200"><a href="#LineageHTML.__init__-200"><span class="linenos">200</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s2">"from"</span><span class="p">:</span> <span class="n">node_id</span><span class="p">,</span> <span class="s2">"to"</span><span class="p">:</span> <span class="nb">id</span><span class="p">(</span><span class="n">d</span><span class="p">)})</span> +</span></pre></div> + + + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer.html b/docs/sqlglot/optimizer.html new file mode 100644 index 0000000..1321d62 --- /dev/null +++ b/docs/sqlglot/optimizer.html @@ -0,0 +1,264 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + <h2>Submodules</h2> + <ul> + <li><a href="optimizer/annotate_types.html">annotate_types</a></li> + <li><a href="optimizer/canonicalize.html">canonicalize</a></li> + <li><a href="optimizer/eliminate_ctes.html">eliminate_ctes</a></li> + <li><a href="optimizer/eliminate_joins.html">eliminate_joins</a></li> + <li><a href="optimizer/eliminate_subqueries.html">eliminate_subqueries</a></li> + <li><a href="optimizer/expand_laterals.html">expand_laterals</a></li> + <li><a href="optimizer/expand_multi_table_selects.html">expand_multi_table_selects</a></li> + <li><a href="optimizer/isolate_table_selects.html">isolate_table_selects</a></li> + <li><a href="optimizer/lower_identities.html">lower_identities</a></li> + <li><a href="optimizer/merge_subqueries.html">merge_subqueries</a></li> + <li><a href="optimizer/normalize.html">normalize</a></li> + <li><a href="optimizer/optimize_joins.html">optimize_joins</a></li> + <li><a href="optimizer/optimizer.html">optimizer</a></li> + <li><a href="optimizer/pushdown_predicates.html">pushdown_predicates</a></li> + <li><a href="optimizer/pushdown_projections.html">pushdown_projections</a></li> + <li><a href="optimizer/qualify_columns.html">qualify_columns</a></li> + <li><a href="optimizer/qualify_tables.html">qualify_tables</a></li> + <li><a href="optimizer/scope.html">scope</a></li> + <li><a href="optimizer/simplify.html">simplify</a></li> + <li><a href="optimizer/unnest_subqueries.html">unnest_subqueries</a></li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/__init__.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.optimizer </h1> + + + <input id="mod-optimizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-optimizer-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos">1</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.optimizer</span> <span class="kn">import</span> <span class="n">RULES</span><span class="p">,</span> <span class="n">optimize</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos">2</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">build_scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span></pre></div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/annotate_types.html b/docs/sqlglot/optimizer/annotate_types.html new file mode 100644 index 0000000..2d84d3e --- /dev/null +++ b/docs/sqlglot/optimizer/annotate_types.html @@ -0,0 +1,1179 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.annotate_types API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#annotate_types">annotate_types</a> + </li> + <li> + <a class="class" href="#TypeAnnotator">TypeAnnotator</a> + <ul class="memberlist"> + <li> + <a class="function" href="#TypeAnnotator.__init__">TypeAnnotator</a> + </li> + <li> + <a class="function" href="#TypeAnnotator.annotate">annotate</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/annotate_types.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.annotate_types </h1> + + + <input id="mod-annotate_types-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-annotate_types-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">ensure_collection</span><span class="p">,</span> <span class="n">ensure_list</span><span class="p">,</span> <span class="n">subclasses</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">ensure_schema</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">annotators</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> Recursively infer & annotate types in an expression syntax tree against a schema.</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="sd"> Assumes that we've already executed the optimizer's qualify_columns step.</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="sd"> Example:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> >>> schema = {"y": {"cola": "SMALLINT"}}</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> >>> sql = "SELECT x.cola + 2.5 AS cola FROM (SELECT y.cola AS cola FROM y AS y) AS x"</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> >>> annotated_expr = annotate_types(sqlglot.parse_one(sql), schema=schema)</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> >>> annotated_expr.expressions[0].type.this # Get the type of "x.cola + 2.5 AS cola"</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> <Type.DOUBLE: 'DOUBLE'></span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Args:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> expression (sqlglot.Expression): Expression to annotate.</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> schema (dict|sqlglot.optimizer.Schema): Database schema.</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> annotators (dict): Maps expression type to corresponding annotation function.</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> coerces_to (dict): Maps expression type to set of types that it can be coerced into.</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> Returns:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> sqlglot.Expression: expression annotated with types</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> """</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">return</span> <span class="n">TypeAnnotator</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">annotators</span><span class="p">,</span> <span class="n">coerces_to</span><span class="p">)</span><span class="o">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="k">class</span> <span class="nc">TypeAnnotator</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">ANNOTATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">expr_type</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_unary</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">for</span> <span class="n">expr_type</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unary</span><span class="p">)</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="p">},</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">expr_type</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_binary</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">for</span> <span class="n">expr_type</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="p">},</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]),</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]),</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">copy</span><span class="p">()),</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_unary</span><span class="p">(</span><span class="n">expr</span><span class="p">),</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">),</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">),</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_literal</span><span class="p">(</span><span class="n">expr</span><span class="p">),</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">),</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span><span class="p">),</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">),</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="p">),</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Avg</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Sum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">,</span> <span class="n">promote</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ceil</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">),</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDatetime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="p">),</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="p">),</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="p">),</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="p">),</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="p">),</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="p">),</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="p">),</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">),</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">),</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="p">),</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDateStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="p">),</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Day</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Exp</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Floor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">,</span> <span class="s2">"ifs"</span><span class="p">),</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">),</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">),</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IfNull</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">),</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ConcatWs</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="p">),</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="p">),</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">),</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ln</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Log</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Log2</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Log10</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lower</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Month</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="p">),</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="p">),</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Round</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="p">),</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Sqrt</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Stddev</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StddevPop</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StddevSamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="p">),</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="p">),</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="p">),</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDateStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="p">),</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="p">),</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="p">),</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Upper</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Variance</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="p">),</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Week</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Year</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="p">}</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="c1"># Reference: https://spark.apache.org/docs/3.2.0/sql-ref-ansi-compliance.html</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">COERCES_TO</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="c1"># CHAR < NCHAR < VARCHAR < NVARCHAR < TEXT</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="nb">set</span><span class="p">(),</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">},</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">},</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="p">},</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="p">},</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="c1"># TINYINT < SMALLINT < INT < BIGINT < DECIMAL < FLOAT < DOUBLE</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="nb">set</span><span class="p">(),</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">},</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">},</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="p">},</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="p">},</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="p">},</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="p">},</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="c1"># DATE < DATETIME < TIMESTAMP < TIMESTAMPTZ < TIMESTAMPLTZ</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">:</span> <span class="nb">set</span><span class="p">(),</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">},</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="p">},</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="p">},</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="p">},</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="p">}</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">TRAVERSABLES</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">annotators</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span> <span class="o">=</span> <span class="n">schema</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">annotators</span> <span class="o">=</span> <span class="n">annotators</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">ANNOTATORS</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">coerces_to</span> <span class="o">=</span> <span class="n">coerces_to</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">COERCES_TO</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="k">def</span> <span class="nf">annotate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">TRAVERSABLES</span><span class="p">):</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="k">continue</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">):</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">):</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">]</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="n">values</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">values</span><span class="p">:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="k">continue</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">column</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="k">for</span> <span class="n">alias</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_column_names</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">values</span><span class="p">,</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="p">)</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="p">}</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">select</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="p">}</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="c1"># First annotate the current scope's column references</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">col</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">get_column_type</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="k">elif</span> <span class="n">source</span> <span class="ow">and</span> <span class="n">col</span><span class="o">.</span><span class="n">table</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">:</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">col</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="n">col</span><span class="o">.</span><span class="n">table</span><span class="p">][</span><span class="n">col</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="c1"># Then (possibly) annotate the remaining expressions in the scope</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="c1"># This takes care of non-traversable expressions</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="k">def</span> <span class="nf">_maybe_annotate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="p">:</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="k">return</span> <span class="n">expression</span> <span class="c1"># We've already inferred the expression's type</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">annotator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">annotators</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="n">annotator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="k">if</span> <span class="n">annotator</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">)</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="p">)</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="k">def</span> <span class="nf">_annotate_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="k">def</span> <span class="nf">_maybe_coerce</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type1</span><span class="p">,</span> <span class="n">type2</span><span class="p">):</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="c1"># We propagate the NULL / UNKNOWN types upwards if found</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="n">type1</span> <span class="o">=</span> <span class="n">type1</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">type2</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">type2</span> <span class="o">=</span> <span class="n">type2</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">if</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="n">type2</span><span class="p">):</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="k">if</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span> <span class="ow">in</span> <span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="n">type2</span><span class="p">):</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="k">return</span> <span class="n">type2</span> <span class="k">if</span> <span class="n">type2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">coerces_to</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="p">{})</span> <span class="k">else</span> <span class="n">type1</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="k">def</span> <span class="nf">_annotate_binary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">left_type</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">right_type</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)):</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="k">if</span> <span class="n">left_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> <span class="ow">and</span> <span class="n">right_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span><span class="p">:</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="k">elif</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">left_type</span><span class="p">,</span> <span class="n">right_type</span><span class="p">):</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="s2">"NULLABLE"</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"BOOLEAN"</span><span class="p">)</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="p">)</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Predicate</span><span class="p">)):</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_coerce</span><span class="p">(</span><span class="n">left_type</span><span class="p">,</span> <span class="n">right_type</span><span class="p">)</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="k">def</span> <span class="nf">_annotate_unary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">):</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="k">def</span> <span class="nf">_annotate_literal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_int</span><span class="p">:</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="k">def</span> <span class="nf">_annotate_with_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">target_type</span><span class="p">):</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">target_type</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="k">def</span> <span class="nf">_annotate_by_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">promote</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">:</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="n">arg_expr</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expr</span> <span class="k">for</span> <span class="n">expr</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_expr</span><span class="p">)</span> <span class="k">if</span> <span class="n">expr</span><span class="p">)</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="n">last_datatype</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">for</span> <span class="n">expr</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="n">last_datatype</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_coerce</span><span class="p">(</span><span class="n">last_datatype</span> <span class="ow">or</span> <span class="n">expr</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">type</span><span class="p">)</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">last_datatype</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="k">if</span> <span class="n">promote</span><span class="p">:</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">INTEGER_TYPES</span><span class="p">:</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">FLOAT_TYPES</span><span class="p">:</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="annotate_types"> + <input id="annotate_types-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">annotate_types</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">schema</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">annotators</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="annotate_types-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#annotate_types"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="annotate_types-8"><a href="#annotate_types-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">annotate_types</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">annotators</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="annotate_types-9"><a href="#annotate_types-9"><span class="linenos"> 9</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="annotate_types-10"><a href="#annotate_types-10"><span class="linenos">10</span></a><span class="sd"> Recursively infer & annotate types in an expression syntax tree against a schema.</span> +</span><span id="annotate_types-11"><a href="#annotate_types-11"><span class="linenos">11</span></a><span class="sd"> Assumes that we've already executed the optimizer's qualify_columns step.</span> +</span><span id="annotate_types-12"><a href="#annotate_types-12"><span class="linenos">12</span></a> +</span><span id="annotate_types-13"><a href="#annotate_types-13"><span class="linenos">13</span></a><span class="sd"> Example:</span> +</span><span id="annotate_types-14"><a href="#annotate_types-14"><span class="linenos">14</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="annotate_types-15"><a href="#annotate_types-15"><span class="linenos">15</span></a><span class="sd"> >>> schema = {"y": {"cola": "SMALLINT"}}</span> +</span><span id="annotate_types-16"><a href="#annotate_types-16"><span class="linenos">16</span></a><span class="sd"> >>> sql = "SELECT x.cola + 2.5 AS cola FROM (SELECT y.cola AS cola FROM y AS y) AS x"</span> +</span><span id="annotate_types-17"><a href="#annotate_types-17"><span class="linenos">17</span></a><span class="sd"> >>> annotated_expr = annotate_types(sqlglot.parse_one(sql), schema=schema)</span> +</span><span id="annotate_types-18"><a href="#annotate_types-18"><span class="linenos">18</span></a><span class="sd"> >>> annotated_expr.expressions[0].type.this # Get the type of "x.cola + 2.5 AS cola"</span> +</span><span id="annotate_types-19"><a href="#annotate_types-19"><span class="linenos">19</span></a><span class="sd"> <Type.DOUBLE: 'DOUBLE'></span> +</span><span id="annotate_types-20"><a href="#annotate_types-20"><span class="linenos">20</span></a> +</span><span id="annotate_types-21"><a href="#annotate_types-21"><span class="linenos">21</span></a><span class="sd"> Args:</span> +</span><span id="annotate_types-22"><a href="#annotate_types-22"><span class="linenos">22</span></a><span class="sd"> expression (sqlglot.Expression): Expression to annotate.</span> +</span><span id="annotate_types-23"><a href="#annotate_types-23"><span class="linenos">23</span></a><span class="sd"> schema (dict|sqlglot.optimizer.Schema): Database schema.</span> +</span><span id="annotate_types-24"><a href="#annotate_types-24"><span class="linenos">24</span></a><span class="sd"> annotators (dict): Maps expression type to corresponding annotation function.</span> +</span><span id="annotate_types-25"><a href="#annotate_types-25"><span class="linenos">25</span></a><span class="sd"> coerces_to (dict): Maps expression type to set of types that it can be coerced into.</span> +</span><span id="annotate_types-26"><a href="#annotate_types-26"><span class="linenos">26</span></a><span class="sd"> Returns:</span> +</span><span id="annotate_types-27"><a href="#annotate_types-27"><span class="linenos">27</span></a><span class="sd"> sqlglot.Expression: expression annotated with types</span> +</span><span id="annotate_types-28"><a href="#annotate_types-28"><span class="linenos">28</span></a><span class="sd"> """</span> +</span><span id="annotate_types-29"><a href="#annotate_types-29"><span class="linenos">29</span></a> +</span><span id="annotate_types-30"><a href="#annotate_types-30"><span class="linenos">30</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="annotate_types-31"><a href="#annotate_types-31"><span class="linenos">31</span></a> +</span><span id="annotate_types-32"><a href="#annotate_types-32"><span class="linenos">32</span></a> <span class="k">return</span> <span class="n">TypeAnnotator</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">annotators</span><span class="p">,</span> <span class="n">coerces_to</span><span class="p">)</span><span class="o">.</span><span class="n">annotate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Recursively infer & annotate types in an expression syntax tree against a schema. +Assumes that we've already executed the optimizer's qualify_columns step.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">schema</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"y"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"cola"</span><span class="p">:</span> <span class="s2">"SMALLINT"</span><span class="p">}}</span> +<span class="gp">>>> </span><span class="n">sql</span> <span class="o">=</span> <span class="s2">"SELECT x.cola + 2.5 AS cola FROM (SELECT y.cola AS cola FROM y AS y) AS x"</span> +<span class="gp">>>> </span><span class="n">annotated_expr</span> <span class="o">=</span> <span class="n">annotate_types</span><span class="p">(</span><span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="n">sql</span><span class="p">),</span> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">annotated_expr</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="c1"># Get the type of "x.cola + 2.5 AS cola"</span> +<span class="go"><Type.DOUBLE: 'DOUBLE'></span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> Expression to annotate.</li> +<li><strong>schema (dict|sqlglot.optimizer.Schema):</strong> Database schema.</li> +<li><strong>annotators (dict):</strong> Maps expression type to corresponding annotation function.</li> +<li><strong>coerces_to (dict):</strong> Maps expression type to set of types that it can be coerced into.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: expression annotated with types</p> +</blockquote> +</div> + + + </section> + <section id="TypeAnnotator"> + <input id="TypeAnnotator-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TypeAnnotator</span>: + + <label class="view-source-button" for="TypeAnnotator-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TypeAnnotator"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TypeAnnotator-35"><a href="#TypeAnnotator-35"><span class="linenos"> 35</span></a><span class="k">class</span> <span class="nc">TypeAnnotator</span><span class="p">:</span> +</span><span id="TypeAnnotator-36"><a href="#TypeAnnotator-36"><span class="linenos"> 36</span></a> <span class="n">ANNOTATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TypeAnnotator-37"><a href="#TypeAnnotator-37"><span class="linenos"> 37</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="TypeAnnotator-38"><a href="#TypeAnnotator-38"><span class="linenos"> 38</span></a> <span class="n">expr_type</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_unary</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span> +</span><span id="TypeAnnotator-39"><a href="#TypeAnnotator-39"><span class="linenos"> 39</span></a> <span class="k">for</span> <span class="n">expr_type</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Unary</span><span class="p">)</span> +</span><span id="TypeAnnotator-40"><a href="#TypeAnnotator-40"><span class="linenos"> 40</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-41"><a href="#TypeAnnotator-41"><span class="linenos"> 41</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="TypeAnnotator-42"><a href="#TypeAnnotator-42"><span class="linenos"> 42</span></a> <span class="n">expr_type</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_binary</span><span class="p">(</span><span class="n">expr</span><span class="p">)</span> +</span><span id="TypeAnnotator-43"><a href="#TypeAnnotator-43"><span class="linenos"> 43</span></a> <span class="k">for</span> <span class="n">expr_type</span> <span class="ow">in</span> <span class="n">subclasses</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)</span> +</span><span id="TypeAnnotator-44"><a href="#TypeAnnotator-44"><span class="linenos"> 44</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-45"><a href="#TypeAnnotator-45"><span class="linenos"> 45</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]),</span> +</span><span id="TypeAnnotator-46"><a href="#TypeAnnotator-46"><span class="linenos"> 46</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]),</span> +</span><span id="TypeAnnotator-47"><a href="#TypeAnnotator-47"><span class="linenos"> 47</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">copy</span><span class="p">()),</span> +</span><span id="TypeAnnotator-48"><a href="#TypeAnnotator-48"><span class="linenos"> 48</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_unary</span><span class="p">(</span><span class="n">expr</span><span class="p">),</span> +</span><span id="TypeAnnotator-49"><a href="#TypeAnnotator-49"><span class="linenos"> 49</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">),</span> +</span><span id="TypeAnnotator-50"><a href="#TypeAnnotator-50"><span class="linenos"> 50</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">),</span> +</span><span id="TypeAnnotator-51"><a href="#TypeAnnotator-51"><span class="linenos"> 51</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_literal</span><span class="p">(</span><span class="n">expr</span><span class="p">),</span> +</span><span id="TypeAnnotator-52"><a href="#TypeAnnotator-52"><span class="linenos"> 52</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">),</span> +</span><span id="TypeAnnotator-53"><a href="#TypeAnnotator-53"><span class="linenos"> 53</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span><span class="p">),</span> +</span><span id="TypeAnnotator-54"><a href="#TypeAnnotator-54"><span class="linenos"> 54</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">),</span> +</span><span id="TypeAnnotator-55"><a href="#TypeAnnotator-55"><span class="linenos"> 55</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-56"><a href="#TypeAnnotator-56"><span class="linenos"> 56</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span> +</span><span id="TypeAnnotator-57"><a href="#TypeAnnotator-57"><span class="linenos"> 57</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-58"><a href="#TypeAnnotator-58"><span class="linenos"> 58</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Avg</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-59"><a href="#TypeAnnotator-59"><span class="linenos"> 59</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="TypeAnnotator-60"><a href="#TypeAnnotator-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">),</span> +</span><span id="TypeAnnotator-61"><a href="#TypeAnnotator-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Sum</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">,</span> <span class="n">promote</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="TypeAnnotator-62"><a href="#TypeAnnotator-62"><span class="linenos"> 62</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ceil</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-63"><a href="#TypeAnnotator-63"><span class="linenos"> 63</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">),</span> +</span><span id="TypeAnnotator-64"><a href="#TypeAnnotator-64"><span class="linenos"> 64</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="TypeAnnotator-65"><a href="#TypeAnnotator-65"><span class="linenos"> 65</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDatetime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-66"><a href="#TypeAnnotator-66"><span class="linenos"> 66</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span> +</span><span id="TypeAnnotator-67"><a href="#TypeAnnotator-67"><span class="linenos"> 67</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-68"><a href="#TypeAnnotator-68"><span class="linenos"> 68</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-69"><a href="#TypeAnnotator-69"><span class="linenos"> 69</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-70"><a href="#TypeAnnotator-70"><span class="linenos"> 70</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-71"><a href="#TypeAnnotator-71"><span class="linenos"> 71</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-72"><a href="#TypeAnnotator-72"><span class="linenos"> 72</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-73"><a href="#TypeAnnotator-73"><span class="linenos"> 73</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-74"><a href="#TypeAnnotator-74"><span class="linenos"> 74</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="TypeAnnotator-75"><a href="#TypeAnnotator-75"><span class="linenos"> 75</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="TypeAnnotator-76"><a href="#TypeAnnotator-76"><span class="linenos"> 76</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-77"><a href="#TypeAnnotator-77"><span class="linenos"> 77</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-78"><a href="#TypeAnnotator-78"><span class="linenos"> 78</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span> +</span><span id="TypeAnnotator-79"><a href="#TypeAnnotator-79"><span class="linenos"> 79</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-80"><a href="#TypeAnnotator-80"><span class="linenos"> 80</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-81"><a href="#TypeAnnotator-81"><span class="linenos"> 81</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span> +</span><span id="TypeAnnotator-82"><a href="#TypeAnnotator-82"><span class="linenos"> 82</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-83"><a href="#TypeAnnotator-83"><span class="linenos"> 83</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DatetimeDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-84"><a href="#TypeAnnotator-84"><span class="linenos"> 84</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-85"><a href="#TypeAnnotator-85"><span class="linenos"> 85</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-86"><a href="#TypeAnnotator-86"><span class="linenos"> 86</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-87"><a href="#TypeAnnotator-87"><span class="linenos"> 87</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-88"><a href="#TypeAnnotator-88"><span class="linenos"> 88</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-89"><a href="#TypeAnnotator-89"><span class="linenos"> 89</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-90"><a href="#TypeAnnotator-90"><span class="linenos"> 90</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-91"><a href="#TypeAnnotator-91"><span class="linenos"> 91</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimestampDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-92"><a href="#TypeAnnotator-92"><span class="linenos"> 92</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeAdd</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">),</span> +</span><span id="TypeAnnotator-93"><a href="#TypeAnnotator-93"><span class="linenos"> 93</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeSub</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">),</span> +</span><span id="TypeAnnotator-94"><a href="#TypeAnnotator-94"><span class="linenos"> 94</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeDiff</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-95"><a href="#TypeAnnotator-95"><span class="linenos"> 95</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-96"><a href="#TypeAnnotator-96"><span class="linenos"> 96</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> +</span><span id="TypeAnnotator-97"><a href="#TypeAnnotator-97"><span class="linenos"> 97</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-98"><a href="#TypeAnnotator-98"><span class="linenos"> 98</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDateStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-99"><a href="#TypeAnnotator-99"><span class="linenos"> 99</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-100"><a href="#TypeAnnotator-100"><span class="linenos">100</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-101"><a href="#TypeAnnotator-101"><span class="linenos">101</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-102"><a href="#TypeAnnotator-102"><span class="linenos">102</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Day</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="TypeAnnotator-103"><a href="#TypeAnnotator-103"><span class="linenos">103</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DiToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="TypeAnnotator-104"><a href="#TypeAnnotator-104"><span class="linenos">104</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Exp</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-105"><a href="#TypeAnnotator-105"><span class="linenos">105</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Floor</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-106"><a href="#TypeAnnotator-106"><span class="linenos">106</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"default"</span><span class="p">,</span> <span class="s2">"ifs"</span><span class="p">),</span> +</span><span id="TypeAnnotator-107"><a href="#TypeAnnotator-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">),</span> +</span><span id="TypeAnnotator-108"><a href="#TypeAnnotator-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">,</span> <span class="s2">"expressions"</span><span class="p">),</span> +</span><span id="TypeAnnotator-109"><a href="#TypeAnnotator-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IfNull</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_by_args</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">),</span> +</span><span id="TypeAnnotator-110"><a href="#TypeAnnotator-110"><span class="linenos">110</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ConcatWs</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-111"><a href="#TypeAnnotator-111"><span class="linenos">111</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-112"><a href="#TypeAnnotator-112"><span class="linenos">112</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-113"><a href="#TypeAnnotator-113"><span class="linenos">113</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-114"><a href="#TypeAnnotator-114"><span class="linenos">114</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayConcat</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-115"><a href="#TypeAnnotator-115"><span class="linenos">115</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-116"><a href="#TypeAnnotator-116"><span class="linenos">116</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-117"><a href="#TypeAnnotator-117"><span class="linenos">117</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Initcap</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-118"><a href="#TypeAnnotator-118"><span class="linenos">118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Length</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">),</span> +</span><span id="TypeAnnotator-119"><a href="#TypeAnnotator-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Levenshtein</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-120"><a href="#TypeAnnotator-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ln</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-121"><a href="#TypeAnnotator-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Log</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-122"><a href="#TypeAnnotator-122"><span class="linenos">122</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Log2</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-123"><a href="#TypeAnnotator-123"><span class="linenos">123</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Log10</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-124"><a href="#TypeAnnotator-124"><span class="linenos">124</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lower</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-125"><a href="#TypeAnnotator-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Month</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="TypeAnnotator-126"><a href="#TypeAnnotator-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-127"><a href="#TypeAnnotator-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Quantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-128"><a href="#TypeAnnotator-128"><span class="linenos">128</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxQuantile</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-129"><a href="#TypeAnnotator-129"><span class="linenos">129</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="TypeAnnotator-130"><a href="#TypeAnnotator-130"><span class="linenos">130</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-131"><a href="#TypeAnnotator-131"><span class="linenos">131</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-132"><a href="#TypeAnnotator-132"><span class="linenos">132</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="TypeAnnotator-133"><a href="#TypeAnnotator-133"><span class="linenos">133</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-134"><a href="#TypeAnnotator-134"><span class="linenos">134</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Round</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-135"><a href="#TypeAnnotator-135"><span class="linenos">135</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SafeDivide</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-136"><a href="#TypeAnnotator-136"><span class="linenos">136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-137"><a href="#TypeAnnotator-137"><span class="linenos">137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-138"><a href="#TypeAnnotator-138"><span class="linenos">138</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="TypeAnnotator-139"><a href="#TypeAnnotator-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-140"><a href="#TypeAnnotator-140"><span class="linenos">140</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-141"><a href="#TypeAnnotator-141"><span class="linenos">141</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-142"><a href="#TypeAnnotator-142"><span class="linenos">142</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Sqrt</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-143"><a href="#TypeAnnotator-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Stddev</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-144"><a href="#TypeAnnotator-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StddevPop</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-145"><a href="#TypeAnnotator-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StddevSamp</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-146"><a href="#TypeAnnotator-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-147"><a href="#TypeAnnotator-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-148"><a href="#TypeAnnotator-148"><span class="linenos">148</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-149"><a href="#TypeAnnotator-149"><span class="linenos">149</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-150"><a href="#TypeAnnotator-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-151"><a href="#TypeAnnotator-151"><span class="linenos">151</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> +</span><span id="TypeAnnotator-152"><a href="#TypeAnnotator-152"><span class="linenos">152</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-153"><a href="#TypeAnnotator-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeStrToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-154"><a href="#TypeAnnotator-154"><span class="linenos">154</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-155"><a href="#TypeAnnotator-155"><span class="linenos">155</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-156"><a href="#TypeAnnotator-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-157"><a href="#TypeAnnotator-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDateStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-158"><a href="#TypeAnnotator-158"><span class="linenos">158</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-159"><a href="#TypeAnnotator-159"><span class="linenos">159</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-160"><a href="#TypeAnnotator-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">),</span> +</span><span id="TypeAnnotator-161"><a href="#TypeAnnotator-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDiToDi</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">),</span> +</span><span id="TypeAnnotator-162"><a href="#TypeAnnotator-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-163"><a href="#TypeAnnotator-163"><span class="linenos">163</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-164"><a href="#TypeAnnotator-164"><span class="linenos">164</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span> +</span><span id="TypeAnnotator-165"><a href="#TypeAnnotator-165"><span class="linenos">165</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-166"><a href="#TypeAnnotator-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTimeStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-167"><a href="#TypeAnnotator-167"><span class="linenos">167</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-168"><a href="#TypeAnnotator-168"><span class="linenos">168</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-169"><a href="#TypeAnnotator-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Upper</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">),</span> +</span><span id="TypeAnnotator-170"><a href="#TypeAnnotator-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Variance</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">),</span> +</span><span id="TypeAnnotator-171"><a href="#TypeAnnotator-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VariancePop</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span> +</span><span id="TypeAnnotator-172"><a href="#TypeAnnotator-172"><span class="linenos">172</span></a> <span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="TypeAnnotator-173"><a href="#TypeAnnotator-173"><span class="linenos">173</span></a> <span class="p">),</span> +</span><span id="TypeAnnotator-174"><a href="#TypeAnnotator-174"><span class="linenos">174</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Week</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="TypeAnnotator-175"><a href="#TypeAnnotator-175"><span class="linenos">175</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Year</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expr</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expr</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">),</span> +</span><span id="TypeAnnotator-176"><a href="#TypeAnnotator-176"><span class="linenos">176</span></a> <span class="p">}</span> +</span><span id="TypeAnnotator-177"><a href="#TypeAnnotator-177"><span class="linenos">177</span></a> +</span><span id="TypeAnnotator-178"><a href="#TypeAnnotator-178"><span class="linenos">178</span></a> <span class="c1"># Reference: https://spark.apache.org/docs/3.2.0/sql-ref-ansi-compliance.html</span> +</span><span id="TypeAnnotator-179"><a href="#TypeAnnotator-179"><span class="linenos">179</span></a> <span class="n">COERCES_TO</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TypeAnnotator-180"><a href="#TypeAnnotator-180"><span class="linenos">180</span></a> <span class="c1"># CHAR < NCHAR < VARCHAR < NVARCHAR < TEXT</span> +</span><span id="TypeAnnotator-181"><a href="#TypeAnnotator-181"><span class="linenos">181</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">:</span> <span class="nb">set</span><span class="p">(),</span> +</span><span id="TypeAnnotator-182"><a href="#TypeAnnotator-182"><span class="linenos">182</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">},</span> +</span><span id="TypeAnnotator-183"><a href="#TypeAnnotator-183"><span class="linenos">183</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">},</span> +</span><span id="TypeAnnotator-184"><a href="#TypeAnnotator-184"><span class="linenos">184</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-185"><a href="#TypeAnnotator-185"><span class="linenos">185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="TypeAnnotator-186"><a href="#TypeAnnotator-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="TypeAnnotator-187"><a href="#TypeAnnotator-187"><span class="linenos">187</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TypeAnnotator-188"><a href="#TypeAnnotator-188"><span class="linenos">188</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-189"><a href="#TypeAnnotator-189"><span class="linenos">189</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-190"><a href="#TypeAnnotator-190"><span class="linenos">190</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="TypeAnnotator-191"><a href="#TypeAnnotator-191"><span class="linenos">191</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="TypeAnnotator-192"><a href="#TypeAnnotator-192"><span class="linenos">192</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="TypeAnnotator-193"><a href="#TypeAnnotator-193"><span class="linenos">193</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="TypeAnnotator-194"><a href="#TypeAnnotator-194"><span class="linenos">194</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-195"><a href="#TypeAnnotator-195"><span class="linenos">195</span></a> <span class="c1"># TINYINT < SMALLINT < INT < BIGINT < DECIMAL < FLOAT < DOUBLE</span> +</span><span id="TypeAnnotator-196"><a href="#TypeAnnotator-196"><span class="linenos">196</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">:</span> <span class="nb">set</span><span class="p">(),</span> +</span><span id="TypeAnnotator-197"><a href="#TypeAnnotator-197"><span class="linenos">197</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">},</span> +</span><span id="TypeAnnotator-198"><a href="#TypeAnnotator-198"><span class="linenos">198</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">},</span> +</span><span id="TypeAnnotator-199"><a href="#TypeAnnotator-199"><span class="linenos">199</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-200"><a href="#TypeAnnotator-200"><span class="linenos">200</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="TypeAnnotator-201"><a href="#TypeAnnotator-201"><span class="linenos">201</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="TypeAnnotator-202"><a href="#TypeAnnotator-202"><span class="linenos">202</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="TypeAnnotator-203"><a href="#TypeAnnotator-203"><span class="linenos">203</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-204"><a href="#TypeAnnotator-204"><span class="linenos">204</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-205"><a href="#TypeAnnotator-205"><span class="linenos">205</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="TypeAnnotator-206"><a href="#TypeAnnotator-206"><span class="linenos">206</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="TypeAnnotator-207"><a href="#TypeAnnotator-207"><span class="linenos">207</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="TypeAnnotator-208"><a href="#TypeAnnotator-208"><span class="linenos">208</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="TypeAnnotator-209"><a href="#TypeAnnotator-209"><span class="linenos">209</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-210"><a href="#TypeAnnotator-210"><span class="linenos">210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-211"><a href="#TypeAnnotator-211"><span class="linenos">211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="TypeAnnotator-212"><a href="#TypeAnnotator-212"><span class="linenos">212</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="TypeAnnotator-213"><a href="#TypeAnnotator-213"><span class="linenos">213</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="TypeAnnotator-214"><a href="#TypeAnnotator-214"><span class="linenos">214</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="TypeAnnotator-215"><a href="#TypeAnnotator-215"><span class="linenos">215</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="TypeAnnotator-216"><a href="#TypeAnnotator-216"><span class="linenos">216</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-217"><a href="#TypeAnnotator-217"><span class="linenos">217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-218"><a href="#TypeAnnotator-218"><span class="linenos">218</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="TypeAnnotator-219"><a href="#TypeAnnotator-219"><span class="linenos">219</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="TypeAnnotator-220"><a href="#TypeAnnotator-220"><span class="linenos">220</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="TypeAnnotator-221"><a href="#TypeAnnotator-221"><span class="linenos">221</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="TypeAnnotator-222"><a href="#TypeAnnotator-222"><span class="linenos">222</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="TypeAnnotator-223"><a href="#TypeAnnotator-223"><span class="linenos">223</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="TypeAnnotator-224"><a href="#TypeAnnotator-224"><span class="linenos">224</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-225"><a href="#TypeAnnotator-225"><span class="linenos">225</span></a> <span class="c1"># DATE < DATETIME < TIMESTAMP < TIMESTAMPTZ < TIMESTAMPLTZ</span> +</span><span id="TypeAnnotator-226"><a href="#TypeAnnotator-226"><span class="linenos">226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">:</span> <span class="nb">set</span><span class="p">(),</span> +</span><span id="TypeAnnotator-227"><a href="#TypeAnnotator-227"><span class="linenos">227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">},</span> +</span><span id="TypeAnnotator-228"><a href="#TypeAnnotator-228"><span class="linenos">228</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-229"><a href="#TypeAnnotator-229"><span class="linenos">229</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="TypeAnnotator-230"><a href="#TypeAnnotator-230"><span class="linenos">230</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="TypeAnnotator-231"><a href="#TypeAnnotator-231"><span class="linenos">231</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-232"><a href="#TypeAnnotator-232"><span class="linenos">232</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-233"><a href="#TypeAnnotator-233"><span class="linenos">233</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="TypeAnnotator-234"><a href="#TypeAnnotator-234"><span class="linenos">234</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="TypeAnnotator-235"><a href="#TypeAnnotator-235"><span class="linenos">235</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="TypeAnnotator-236"><a href="#TypeAnnotator-236"><span class="linenos">236</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-237"><a href="#TypeAnnotator-237"><span class="linenos">237</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> <span class="p">{</span> +</span><span id="TypeAnnotator-238"><a href="#TypeAnnotator-238"><span class="linenos">238</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="TypeAnnotator-239"><a href="#TypeAnnotator-239"><span class="linenos">239</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="TypeAnnotator-240"><a href="#TypeAnnotator-240"><span class="linenos">240</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="TypeAnnotator-241"><a href="#TypeAnnotator-241"><span class="linenos">241</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="TypeAnnotator-242"><a href="#TypeAnnotator-242"><span class="linenos">242</span></a> <span class="p">},</span> +</span><span id="TypeAnnotator-243"><a href="#TypeAnnotator-243"><span class="linenos">243</span></a> <span class="p">}</span> +</span><span id="TypeAnnotator-244"><a href="#TypeAnnotator-244"><span class="linenos">244</span></a> +</span><span id="TypeAnnotator-245"><a href="#TypeAnnotator-245"><span class="linenos">245</span></a> <span class="n">TRAVERSABLES</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> +</span><span id="TypeAnnotator-246"><a href="#TypeAnnotator-246"><span class="linenos">246</span></a> +</span><span id="TypeAnnotator-247"><a href="#TypeAnnotator-247"><span class="linenos">247</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">annotators</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="TypeAnnotator-248"><a href="#TypeAnnotator-248"><span class="linenos">248</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span> <span class="o">=</span> <span class="n">schema</span> +</span><span id="TypeAnnotator-249"><a href="#TypeAnnotator-249"><span class="linenos">249</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">annotators</span> <span class="o">=</span> <span class="n">annotators</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">ANNOTATORS</span> +</span><span id="TypeAnnotator-250"><a href="#TypeAnnotator-250"><span class="linenos">250</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">coerces_to</span> <span class="o">=</span> <span class="n">coerces_to</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">COERCES_TO</span> +</span><span id="TypeAnnotator-251"><a href="#TypeAnnotator-251"><span class="linenos">251</span></a> +</span><span id="TypeAnnotator-252"><a href="#TypeAnnotator-252"><span class="linenos">252</span></a> <span class="k">def</span> <span class="nf">annotate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-253"><a href="#TypeAnnotator-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">TRAVERSABLES</span><span class="p">):</span> +</span><span id="TypeAnnotator-254"><a href="#TypeAnnotator-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-255"><a href="#TypeAnnotator-255"><span class="linenos">255</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="TypeAnnotator-256"><a href="#TypeAnnotator-256"><span class="linenos">256</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="TypeAnnotator-257"><a href="#TypeAnnotator-257"><span class="linenos">257</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="TypeAnnotator-258"><a href="#TypeAnnotator-258"><span class="linenos">258</span></a> <span class="k">continue</span> +</span><span id="TypeAnnotator-259"><a href="#TypeAnnotator-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="TypeAnnotator-260"><a href="#TypeAnnotator-260"><span class="linenos">260</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="TypeAnnotator-261"><a href="#TypeAnnotator-261"><span class="linenos">261</span></a> +</span><span id="TypeAnnotator-262"><a href="#TypeAnnotator-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">):</span> +</span><span id="TypeAnnotator-263"><a href="#TypeAnnotator-263"><span class="linenos">263</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">):</span> +</span><span id="TypeAnnotator-264"><a href="#TypeAnnotator-264"><span class="linenos">264</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">]</span> +</span><span id="TypeAnnotator-265"><a href="#TypeAnnotator-265"><span class="linenos">265</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator-266"><a href="#TypeAnnotator-266"><span class="linenos">266</span></a> <span class="n">values</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="TypeAnnotator-267"><a href="#TypeAnnotator-267"><span class="linenos">267</span></a> +</span><span id="TypeAnnotator-268"><a href="#TypeAnnotator-268"><span class="linenos">268</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">values</span><span class="p">:</span> +</span><span id="TypeAnnotator-269"><a href="#TypeAnnotator-269"><span class="linenos">269</span></a> <span class="k">continue</span> +</span><span id="TypeAnnotator-270"><a href="#TypeAnnotator-270"><span class="linenos">270</span></a> +</span><span id="TypeAnnotator-271"><a href="#TypeAnnotator-271"><span class="linenos">271</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TypeAnnotator-272"><a href="#TypeAnnotator-272"><span class="linenos">272</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">column</span> +</span><span id="TypeAnnotator-273"><a href="#TypeAnnotator-273"><span class="linenos">273</span></a> <span class="k">for</span> <span class="n">alias</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span> +</span><span id="TypeAnnotator-274"><a href="#TypeAnnotator-274"><span class="linenos">274</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_column_names</span><span class="p">,</span> +</span><span id="TypeAnnotator-275"><a href="#TypeAnnotator-275"><span class="linenos">275</span></a> <span class="n">values</span><span class="p">,</span> +</span><span id="TypeAnnotator-276"><a href="#TypeAnnotator-276"><span class="linenos">276</span></a> <span class="p">)</span> +</span><span id="TypeAnnotator-277"><a href="#TypeAnnotator-277"><span class="linenos">277</span></a> <span class="p">}</span> +</span><span id="TypeAnnotator-278"><a href="#TypeAnnotator-278"><span class="linenos">278</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator-279"><a href="#TypeAnnotator-279"><span class="linenos">279</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TypeAnnotator-280"><a href="#TypeAnnotator-280"><span class="linenos">280</span></a> <span class="n">select</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="TypeAnnotator-281"><a href="#TypeAnnotator-281"><span class="linenos">281</span></a> <span class="p">}</span> +</span><span id="TypeAnnotator-282"><a href="#TypeAnnotator-282"><span class="linenos">282</span></a> <span class="c1"># First annotate the current scope's column references</span> +</span><span id="TypeAnnotator-283"><a href="#TypeAnnotator-283"><span class="linenos">283</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="TypeAnnotator-284"><a href="#TypeAnnotator-284"><span class="linenos">284</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> +</span><span id="TypeAnnotator-285"><a href="#TypeAnnotator-285"><span class="linenos">285</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="TypeAnnotator-286"><a href="#TypeAnnotator-286"><span class="linenos">286</span></a> <span class="n">col</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">get_column_type</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span> +</span><span id="TypeAnnotator-287"><a href="#TypeAnnotator-287"><span class="linenos">287</span></a> <span class="k">elif</span> <span class="n">source</span> <span class="ow">and</span> <span class="n">col</span><span class="o">.</span><span class="n">table</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">:</span> +</span><span id="TypeAnnotator-288"><a href="#TypeAnnotator-288"><span class="linenos">288</span></a> <span class="n">col</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="n">col</span><span class="o">.</span><span class="n">table</span><span class="p">][</span><span class="n">col</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">type</span> +</span><span id="TypeAnnotator-289"><a href="#TypeAnnotator-289"><span class="linenos">289</span></a> <span class="c1"># Then (possibly) annotate the remaining expressions in the scope</span> +</span><span id="TypeAnnotator-290"><a href="#TypeAnnotator-290"><span class="linenos">290</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator-291"><a href="#TypeAnnotator-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="c1"># This takes care of non-traversable expressions</span> +</span><span id="TypeAnnotator-292"><a href="#TypeAnnotator-292"><span class="linenos">292</span></a> +</span><span id="TypeAnnotator-293"><a href="#TypeAnnotator-293"><span class="linenos">293</span></a> <span class="k">def</span> <span class="nf">_maybe_annotate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-294"><a href="#TypeAnnotator-294"><span class="linenos">294</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-295"><a href="#TypeAnnotator-295"><span class="linenos">295</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="TypeAnnotator-296"><a href="#TypeAnnotator-296"><span class="linenos">296</span></a> +</span><span id="TypeAnnotator-297"><a href="#TypeAnnotator-297"><span class="linenos">297</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="p">:</span> +</span><span id="TypeAnnotator-298"><a href="#TypeAnnotator-298"><span class="linenos">298</span></a> <span class="k">return</span> <span class="n">expression</span> <span class="c1"># We've already inferred the expression's type</span> +</span><span id="TypeAnnotator-299"><a href="#TypeAnnotator-299"><span class="linenos">299</span></a> +</span><span id="TypeAnnotator-300"><a href="#TypeAnnotator-300"><span class="linenos">300</span></a> <span class="n">annotator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">annotators</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">)</span> +</span><span id="TypeAnnotator-301"><a href="#TypeAnnotator-301"><span class="linenos">301</span></a> +</span><span id="TypeAnnotator-302"><a href="#TypeAnnotator-302"><span class="linenos">302</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="TypeAnnotator-303"><a href="#TypeAnnotator-303"><span class="linenos">303</span></a> <span class="n">annotator</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator-304"><a href="#TypeAnnotator-304"><span class="linenos">304</span></a> <span class="k">if</span> <span class="n">annotator</span> +</span><span id="TypeAnnotator-305"><a href="#TypeAnnotator-305"><span class="linenos">305</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_with_type</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">)</span> +</span><span id="TypeAnnotator-306"><a href="#TypeAnnotator-306"><span class="linenos">306</span></a> <span class="p">)</span> +</span><span id="TypeAnnotator-307"><a href="#TypeAnnotator-307"><span class="linenos">307</span></a> +</span><span id="TypeAnnotator-308"><a href="#TypeAnnotator-308"><span class="linenos">308</span></a> <span class="k">def</span> <span class="nf">_annotate_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-309"><a href="#TypeAnnotator-309"><span class="linenos">309</span></a> <span class="k">for</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="TypeAnnotator-310"><a href="#TypeAnnotator-310"><span class="linenos">310</span></a> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">value</span><span class="p">):</span> +</span><span id="TypeAnnotator-311"><a href="#TypeAnnotator-311"><span class="linenos">311</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> +</span><span id="TypeAnnotator-312"><a href="#TypeAnnotator-312"><span class="linenos">312</span></a> +</span><span id="TypeAnnotator-313"><a href="#TypeAnnotator-313"><span class="linenos">313</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="TypeAnnotator-314"><a href="#TypeAnnotator-314"><span class="linenos">314</span></a> +</span><span id="TypeAnnotator-315"><a href="#TypeAnnotator-315"><span class="linenos">315</span></a> <span class="k">def</span> <span class="nf">_maybe_coerce</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">type1</span><span class="p">,</span> <span class="n">type2</span><span class="p">):</span> +</span><span id="TypeAnnotator-316"><a href="#TypeAnnotator-316"><span class="linenos">316</span></a> <span class="c1"># We propagate the NULL / UNKNOWN types upwards if found</span> +</span><span id="TypeAnnotator-317"><a href="#TypeAnnotator-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="TypeAnnotator-318"><a href="#TypeAnnotator-318"><span class="linenos">318</span></a> <span class="n">type1</span> <span class="o">=</span> <span class="n">type1</span><span class="o">.</span><span class="n">this</span> +</span><span id="TypeAnnotator-319"><a href="#TypeAnnotator-319"><span class="linenos">319</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">type2</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="TypeAnnotator-320"><a href="#TypeAnnotator-320"><span class="linenos">320</span></a> <span class="n">type2</span> <span class="o">=</span> <span class="n">type2</span><span class="o">.</span><span class="n">this</span> +</span><span id="TypeAnnotator-321"><a href="#TypeAnnotator-321"><span class="linenos">321</span></a> +</span><span id="TypeAnnotator-322"><a href="#TypeAnnotator-322"><span class="linenos">322</span></a> <span class="k">if</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="n">type2</span><span class="p">):</span> +</span><span id="TypeAnnotator-323"><a href="#TypeAnnotator-323"><span class="linenos">323</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> +</span><span id="TypeAnnotator-324"><a href="#TypeAnnotator-324"><span class="linenos">324</span></a> <span class="k">if</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span> <span class="ow">in</span> <span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="n">type2</span><span class="p">):</span> +</span><span id="TypeAnnotator-325"><a href="#TypeAnnotator-325"><span class="linenos">325</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span> +</span><span id="TypeAnnotator-326"><a href="#TypeAnnotator-326"><span class="linenos">326</span></a> +</span><span id="TypeAnnotator-327"><a href="#TypeAnnotator-327"><span class="linenos">327</span></a> <span class="k">return</span> <span class="n">type2</span> <span class="k">if</span> <span class="n">type2</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">coerces_to</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">type1</span><span class="p">,</span> <span class="p">{})</span> <span class="k">else</span> <span class="n">type1</span> +</span><span id="TypeAnnotator-328"><a href="#TypeAnnotator-328"><span class="linenos">328</span></a> +</span><span id="TypeAnnotator-329"><a href="#TypeAnnotator-329"><span class="linenos">329</span></a> <span class="k">def</span> <span class="nf">_annotate_binary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-330"><a href="#TypeAnnotator-330"><span class="linenos">330</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator-331"><a href="#TypeAnnotator-331"><span class="linenos">331</span></a> +</span><span id="TypeAnnotator-332"><a href="#TypeAnnotator-332"><span class="linenos">332</span></a> <span class="n">left_type</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> +</span><span id="TypeAnnotator-333"><a href="#TypeAnnotator-333"><span class="linenos">333</span></a> <span class="n">right_type</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> +</span><span id="TypeAnnotator-334"><a href="#TypeAnnotator-334"><span class="linenos">334</span></a> +</span><span id="TypeAnnotator-335"><a href="#TypeAnnotator-335"><span class="linenos">335</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)):</span> +</span><span id="TypeAnnotator-336"><a href="#TypeAnnotator-336"><span class="linenos">336</span></a> <span class="k">if</span> <span class="n">left_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> <span class="ow">and</span> <span class="n">right_type</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span><span class="p">:</span> +</span><span id="TypeAnnotator-337"><a href="#TypeAnnotator-337"><span class="linenos">337</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> +</span><span id="TypeAnnotator-338"><a href="#TypeAnnotator-338"><span class="linenos">338</span></a> <span class="k">elif</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">left_type</span><span class="p">,</span> <span class="n">right_type</span><span class="p">):</span> +</span><span id="TypeAnnotator-339"><a href="#TypeAnnotator-339"><span class="linenos">339</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span> +</span><span id="TypeAnnotator-340"><a href="#TypeAnnotator-340"><span class="linenos">340</span></a> <span class="s2">"NULLABLE"</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="s2">"BOOLEAN"</span><span class="p">)</span> +</span><span id="TypeAnnotator-341"><a href="#TypeAnnotator-341"><span class="linenos">341</span></a> <span class="p">)</span> +</span><span id="TypeAnnotator-342"><a href="#TypeAnnotator-342"><span class="linenos">342</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator-343"><a href="#TypeAnnotator-343"><span class="linenos">343</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="TypeAnnotator-344"><a href="#TypeAnnotator-344"><span class="linenos">344</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Predicate</span><span class="p">)):</span> +</span><span id="TypeAnnotator-345"><a href="#TypeAnnotator-345"><span class="linenos">345</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="TypeAnnotator-346"><a href="#TypeAnnotator-346"><span class="linenos">346</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator-347"><a href="#TypeAnnotator-347"><span class="linenos">347</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_coerce</span><span class="p">(</span><span class="n">left_type</span><span class="p">,</span> <span class="n">right_type</span><span class="p">)</span> +</span><span id="TypeAnnotator-348"><a href="#TypeAnnotator-348"><span class="linenos">348</span></a> +</span><span id="TypeAnnotator-349"><a href="#TypeAnnotator-349"><span class="linenos">349</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="TypeAnnotator-350"><a href="#TypeAnnotator-350"><span class="linenos">350</span></a> +</span><span id="TypeAnnotator-351"><a href="#TypeAnnotator-351"><span class="linenos">351</span></a> <span class="k">def</span> <span class="nf">_annotate_unary</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-352"><a href="#TypeAnnotator-352"><span class="linenos">352</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator-353"><a href="#TypeAnnotator-353"><span class="linenos">353</span></a> +</span><span id="TypeAnnotator-354"><a href="#TypeAnnotator-354"><span class="linenos">354</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">):</span> +</span><span id="TypeAnnotator-355"><a href="#TypeAnnotator-355"><span class="linenos">355</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BOOLEAN</span> +</span><span id="TypeAnnotator-356"><a href="#TypeAnnotator-356"><span class="linenos">356</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator-357"><a href="#TypeAnnotator-357"><span class="linenos">357</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">type</span> +</span><span id="TypeAnnotator-358"><a href="#TypeAnnotator-358"><span class="linenos">358</span></a> +</span><span id="TypeAnnotator-359"><a href="#TypeAnnotator-359"><span class="linenos">359</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="TypeAnnotator-360"><a href="#TypeAnnotator-360"><span class="linenos">360</span></a> +</span><span id="TypeAnnotator-361"><a href="#TypeAnnotator-361"><span class="linenos">361</span></a> <span class="k">def</span> <span class="nf">_annotate_literal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator-362"><a href="#TypeAnnotator-362"><span class="linenos">362</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="TypeAnnotator-363"><a href="#TypeAnnotator-363"><span class="linenos">363</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARCHAR</span> +</span><span id="TypeAnnotator-364"><a href="#TypeAnnotator-364"><span class="linenos">364</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_int</span><span class="p">:</span> +</span><span id="TypeAnnotator-365"><a href="#TypeAnnotator-365"><span class="linenos">365</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">INT</span> +</span><span id="TypeAnnotator-366"><a href="#TypeAnnotator-366"><span class="linenos">366</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator-367"><a href="#TypeAnnotator-367"><span class="linenos">367</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="TypeAnnotator-368"><a href="#TypeAnnotator-368"><span class="linenos">368</span></a> +</span><span id="TypeAnnotator-369"><a href="#TypeAnnotator-369"><span class="linenos">369</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="TypeAnnotator-370"><a href="#TypeAnnotator-370"><span class="linenos">370</span></a> +</span><span id="TypeAnnotator-371"><a href="#TypeAnnotator-371"><span class="linenos">371</span></a> <span class="k">def</span> <span class="nf">_annotate_with_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">target_type</span><span class="p">):</span> +</span><span id="TypeAnnotator-372"><a href="#TypeAnnotator-372"><span class="linenos">372</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">target_type</span> +</span><span id="TypeAnnotator-373"><a href="#TypeAnnotator-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator-374"><a href="#TypeAnnotator-374"><span class="linenos">374</span></a> +</span><span id="TypeAnnotator-375"><a href="#TypeAnnotator-375"><span class="linenos">375</span></a> <span class="k">def</span> <span class="nf">_annotate_by_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="n">promote</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="TypeAnnotator-376"><a href="#TypeAnnotator-376"><span class="linenos">376</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_annotate_args</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator-377"><a href="#TypeAnnotator-377"><span class="linenos">377</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="TypeAnnotator-378"><a href="#TypeAnnotator-378"><span class="linenos">378</span></a> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">args</span><span class="p">:</span> +</span><span id="TypeAnnotator-379"><a href="#TypeAnnotator-379"><span class="linenos">379</span></a> <span class="n">arg_expr</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> +</span><span id="TypeAnnotator-380"><a href="#TypeAnnotator-380"><span class="linenos">380</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">expr</span> <span class="k">for</span> <span class="n">expr</span> <span class="ow">in</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">arg_expr</span><span class="p">)</span> <span class="k">if</span> <span class="n">expr</span><span class="p">)</span> +</span><span id="TypeAnnotator-381"><a href="#TypeAnnotator-381"><span class="linenos">381</span></a> +</span><span id="TypeAnnotator-382"><a href="#TypeAnnotator-382"><span class="linenos">382</span></a> <span class="n">last_datatype</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="TypeAnnotator-383"><a href="#TypeAnnotator-383"><span class="linenos">383</span></a> <span class="k">for</span> <span class="n">expr</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="TypeAnnotator-384"><a href="#TypeAnnotator-384"><span class="linenos">384</span></a> <span class="n">last_datatype</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_coerce</span><span class="p">(</span><span class="n">last_datatype</span> <span class="ow">or</span> <span class="n">expr</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">expr</span><span class="o">.</span><span class="n">type</span><span class="p">)</span> +</span><span id="TypeAnnotator-385"><a href="#TypeAnnotator-385"><span class="linenos">385</span></a> +</span><span id="TypeAnnotator-386"><a href="#TypeAnnotator-386"><span class="linenos">386</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">last_datatype</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span> +</span><span id="TypeAnnotator-387"><a href="#TypeAnnotator-387"><span class="linenos">387</span></a> +</span><span id="TypeAnnotator-388"><a href="#TypeAnnotator-388"><span class="linenos">388</span></a> <span class="k">if</span> <span class="n">promote</span><span class="p">:</span> +</span><span id="TypeAnnotator-389"><a href="#TypeAnnotator-389"><span class="linenos">389</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">INTEGER_TYPES</span><span class="p">:</span> +</span><span id="TypeAnnotator-390"><a href="#TypeAnnotator-390"><span class="linenos">390</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">BIGINT</span> +</span><span id="TypeAnnotator-391"><a href="#TypeAnnotator-391"><span class="linenos">391</span></a> <span class="k">elif</span> <span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">FLOAT_TYPES</span><span class="p">:</span> +</span><span id="TypeAnnotator-392"><a href="#TypeAnnotator-392"><span class="linenos">392</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DOUBLE</span> +</span><span id="TypeAnnotator-393"><a href="#TypeAnnotator-393"><span class="linenos">393</span></a> +</span><span id="TypeAnnotator-394"><a href="#TypeAnnotator-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + <div id="TypeAnnotator.__init__" class="classattr"> + <input id="TypeAnnotator.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">TypeAnnotator</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">schema</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">annotators</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="TypeAnnotator.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TypeAnnotator.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TypeAnnotator.__init__-247"><a href="#TypeAnnotator.__init__-247"><span class="linenos">247</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">annotators</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">coerces_to</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="TypeAnnotator.__init__-248"><a href="#TypeAnnotator.__init__-248"><span class="linenos">248</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span> <span class="o">=</span> <span class="n">schema</span> +</span><span id="TypeAnnotator.__init__-249"><a href="#TypeAnnotator.__init__-249"><span class="linenos">249</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">annotators</span> <span class="o">=</span> <span class="n">annotators</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">ANNOTATORS</span> +</span><span id="TypeAnnotator.__init__-250"><a href="#TypeAnnotator.__init__-250"><span class="linenos">250</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">coerces_to</span> <span class="o">=</span> <span class="n">coerces_to</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">COERCES_TO</span> +</span></pre></div> + + + + + </div> + <div id="TypeAnnotator.annotate" class="classattr"> + <input id="TypeAnnotator.annotate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">annotate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="TypeAnnotator.annotate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TypeAnnotator.annotate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TypeAnnotator.annotate-252"><a href="#TypeAnnotator.annotate-252"><span class="linenos">252</span></a> <span class="k">def</span> <span class="nf">annotate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-253"><a href="#TypeAnnotator.annotate-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">TRAVERSABLES</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-254"><a href="#TypeAnnotator.annotate-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-255"><a href="#TypeAnnotator.annotate-255"><span class="linenos">255</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="TypeAnnotator.annotate-256"><a href="#TypeAnnotator.annotate-256"><span class="linenos">256</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="TypeAnnotator.annotate-257"><a href="#TypeAnnotator.annotate-257"><span class="linenos">257</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-258"><a href="#TypeAnnotator.annotate-258"><span class="linenos">258</span></a> <span class="k">continue</span> +</span><span id="TypeAnnotator.annotate-259"><a href="#TypeAnnotator.annotate-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-260"><a href="#TypeAnnotator.annotate-260"><span class="linenos">260</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="TypeAnnotator.annotate-261"><a href="#TypeAnnotator.annotate-261"><span class="linenos">261</span></a> +</span><span id="TypeAnnotator.annotate-262"><a href="#TypeAnnotator.annotate-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-263"><a href="#TypeAnnotator.annotate-263"><span class="linenos">263</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Explode</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-264"><a href="#TypeAnnotator.annotate-264"><span class="linenos">264</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">]</span> +</span><span id="TypeAnnotator.annotate-265"><a href="#TypeAnnotator.annotate-265"><span class="linenos">265</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator.annotate-266"><a href="#TypeAnnotator.annotate-266"><span class="linenos">266</span></a> <span class="n">values</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="TypeAnnotator.annotate-267"><a href="#TypeAnnotator.annotate-267"><span class="linenos">267</span></a> +</span><span id="TypeAnnotator.annotate-268"><a href="#TypeAnnotator.annotate-268"><span class="linenos">268</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">values</span><span class="p">:</span> +</span><span id="TypeAnnotator.annotate-269"><a href="#TypeAnnotator.annotate-269"><span class="linenos">269</span></a> <span class="k">continue</span> +</span><span id="TypeAnnotator.annotate-270"><a href="#TypeAnnotator.annotate-270"><span class="linenos">270</span></a> +</span><span id="TypeAnnotator.annotate-271"><a href="#TypeAnnotator.annotate-271"><span class="linenos">271</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TypeAnnotator.annotate-272"><a href="#TypeAnnotator.annotate-272"><span class="linenos">272</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">column</span> +</span><span id="TypeAnnotator.annotate-273"><a href="#TypeAnnotator.annotate-273"><span class="linenos">273</span></a> <span class="k">for</span> <span class="n">alias</span><span class="p">,</span> <span class="n">column</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span> +</span><span id="TypeAnnotator.annotate-274"><a href="#TypeAnnotator.annotate-274"><span class="linenos">274</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_column_names</span><span class="p">,</span> +</span><span id="TypeAnnotator.annotate-275"><a href="#TypeAnnotator.annotate-275"><span class="linenos">275</span></a> <span class="n">values</span><span class="p">,</span> +</span><span id="TypeAnnotator.annotate-276"><a href="#TypeAnnotator.annotate-276"><span class="linenos">276</span></a> <span class="p">)</span> +</span><span id="TypeAnnotator.annotate-277"><a href="#TypeAnnotator.annotate-277"><span class="linenos">277</span></a> <span class="p">}</span> +</span><span id="TypeAnnotator.annotate-278"><a href="#TypeAnnotator.annotate-278"><span class="linenos">278</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="TypeAnnotator.annotate-279"><a href="#TypeAnnotator.annotate-279"><span class="linenos">279</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="TypeAnnotator.annotate-280"><a href="#TypeAnnotator.annotate-280"><span class="linenos">280</span></a> <span class="n">select</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="TypeAnnotator.annotate-281"><a href="#TypeAnnotator.annotate-281"><span class="linenos">281</span></a> <span class="p">}</span> +</span><span id="TypeAnnotator.annotate-282"><a href="#TypeAnnotator.annotate-282"><span class="linenos">282</span></a> <span class="c1"># First annotate the current scope's column references</span> +</span><span id="TypeAnnotator.annotate-283"><a href="#TypeAnnotator.annotate-283"><span class="linenos">283</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="TypeAnnotator.annotate-284"><a href="#TypeAnnotator.annotate-284"><span class="linenos">284</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">col</span><span class="o">.</span><span class="n">table</span><span class="p">)</span> +</span><span id="TypeAnnotator.annotate-285"><a href="#TypeAnnotator.annotate-285"><span class="linenos">285</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="TypeAnnotator.annotate-286"><a href="#TypeAnnotator.annotate-286"><span class="linenos">286</span></a> <span class="n">col</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">get_column_type</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span> +</span><span id="TypeAnnotator.annotate-287"><a href="#TypeAnnotator.annotate-287"><span class="linenos">287</span></a> <span class="k">elif</span> <span class="n">source</span> <span class="ow">and</span> <span class="n">col</span><span class="o">.</span><span class="n">table</span> <span class="ow">in</span> <span class="n">selects</span><span class="p">:</span> +</span><span id="TypeAnnotator.annotate-288"><a href="#TypeAnnotator.annotate-288"><span class="linenos">288</span></a> <span class="n">col</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">selects</span><span class="p">[</span><span class="n">col</span><span class="o">.</span><span class="n">table</span><span class="p">][</span><span class="n">col</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">type</span> +</span><span id="TypeAnnotator.annotate-289"><a href="#TypeAnnotator.annotate-289"><span class="linenos">289</span></a> <span class="c1"># Then (possibly) annotate the remaining expressions in the scope</span> +</span><span id="TypeAnnotator.annotate-290"><a href="#TypeAnnotator.annotate-290"><span class="linenos">290</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="TypeAnnotator.annotate-291"><a href="#TypeAnnotator.annotate-291"><span class="linenos">291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_maybe_annotate</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="c1"># This takes care of non-traversable expressions</span> +</span></pre></div> + + + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/canonicalize.html b/docs/sqlglot/optimizer/canonicalize.html new file mode 100644 index 0000000..15e3120 --- /dev/null +++ b/docs/sqlglot/optimizer/canonicalize.html @@ -0,0 +1,445 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.canonicalize API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#canonicalize">canonicalize</a> + </li> + <li> + <a class="function" href="#add_text_to_concat">add_text_to_concat</a> + </li> + <li> + <a class="function" href="#coerce_type">coerce_type</a> + </li> + <li> + <a class="function" href="#remove_redundant_casts">remove_redundant_casts</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/canonicalize.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.canonicalize </h1> + + + <input id="mod-canonicalize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-canonicalize-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="k">def</span> <span class="nf">canonicalize</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="w"> </span><span class="sd">"""Converts a sql expression into a standard form.</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> This method relies on annotate_types because many of the</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> conversions rely on type inference.</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> Args:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd"> expression: The expression to canonicalize.</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> """</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">canonicalize</span><span class="p">)</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">add_text_to_concat</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">coerce_type</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">remove_redundant_casts</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">):</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a><span class="k">def</span> <span class="nf">add_text_to_concat</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEXT_TYPES</span><span class="p">:</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a><span class="k">def</span> <span class="nf">coerce_type</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="n">_coerce_date</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">right</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">):</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="n">_coerce_date</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"low"</span><span class="p">])</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">):</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEMPORAL_TYPES</span><span class="p">:</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="n">_replace_cast</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"datetime"</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a><span class="k">def</span> <span class="nf">remove_redundant_casts</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> <span class="p">):</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a><span class="k">def</span> <span class="nf">_coerce_date</span><span class="p">(</span><span class="n">a</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">b</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">([</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">]):</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="n">a</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> <span class="ow">and</span> <span class="n">a</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="ow">and</span> <span class="n">b</span><span class="o">.</span><span class="n">type</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> <span class="ow">and</span> <span class="n">b</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="o">!=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="p">):</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="n">_replace_cast</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="s2">"date"</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a><span class="k">def</span> <span class="nf">_replace_cast</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">to</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="n">cast</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">node</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">to</span><span class="o">=</span><span class="n">data_type</span><span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="n">cast</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">data_type</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> <span class="n">node</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">cast</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="canonicalize"> + <input id="canonicalize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">canonicalize</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="canonicalize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#canonicalize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="canonicalize-7"><a href="#canonicalize-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">canonicalize</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="canonicalize-8"><a href="#canonicalize-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""Converts a sql expression into a standard form.</span> +</span><span id="canonicalize-9"><a href="#canonicalize-9"><span class="linenos"> 9</span></a> +</span><span id="canonicalize-10"><a href="#canonicalize-10"><span class="linenos">10</span></a><span class="sd"> This method relies on annotate_types because many of the</span> +</span><span id="canonicalize-11"><a href="#canonicalize-11"><span class="linenos">11</span></a><span class="sd"> conversions rely on type inference.</span> +</span><span id="canonicalize-12"><a href="#canonicalize-12"><span class="linenos">12</span></a> +</span><span id="canonicalize-13"><a href="#canonicalize-13"><span class="linenos">13</span></a><span class="sd"> Args:</span> +</span><span id="canonicalize-14"><a href="#canonicalize-14"><span class="linenos">14</span></a><span class="sd"> expression: The expression to canonicalize.</span> +</span><span id="canonicalize-15"><a href="#canonicalize-15"><span class="linenos">15</span></a><span class="sd"> """</span> +</span><span id="canonicalize-16"><a href="#canonicalize-16"><span class="linenos">16</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">canonicalize</span><span class="p">)</span> +</span><span id="canonicalize-17"><a href="#canonicalize-17"><span class="linenos">17</span></a> +</span><span id="canonicalize-18"><a href="#canonicalize-18"><span class="linenos">18</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">add_text_to_concat</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="canonicalize-19"><a href="#canonicalize-19"><span class="linenos">19</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">coerce_type</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="canonicalize-20"><a href="#canonicalize-20"><span class="linenos">20</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">remove_redundant_casts</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="canonicalize-21"><a href="#canonicalize-21"><span class="linenos">21</span></a> +</span><span id="canonicalize-22"><a href="#canonicalize-22"><span class="linenos">22</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">):</span> +</span><span id="canonicalize-23"><a href="#canonicalize-23"><span class="linenos">23</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"quoted"</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> +</span><span id="canonicalize-24"><a href="#canonicalize-24"><span class="linenos">24</span></a> +</span><span id="canonicalize-25"><a href="#canonicalize-25"><span class="linenos">25</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Converts a sql expression into a standard form.</p> + +<p>This method relies on annotate_types because many of the +conversions rely on type inference.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> The expression to canonicalize.</li> +</ul> +</div> + + + </section> + <section id="add_text_to_concat"> + <input id="add_text_to_concat-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_text_to_concat</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">node</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="add_text_to_concat-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#add_text_to_concat"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="add_text_to_concat-28"><a href="#add_text_to_concat-28"><span class="linenos">28</span></a><span class="k">def</span> <span class="nf">add_text_to_concat</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="add_text_to_concat-29"><a href="#add_text_to_concat-29"><span class="linenos">29</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">)</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEXT_TYPES</span><span class="p">:</span> +</span><span id="add_text_to_concat-30"><a href="#add_text_to_concat-30"><span class="linenos">30</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="add_text_to_concat-31"><a href="#add_text_to_concat-31"><span class="linenos">31</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + + + </section> + <section id="coerce_type"> + <input id="coerce_type-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">coerce_type</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">node</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="coerce_type-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#coerce_type"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="coerce_type-34"><a href="#coerce_type-34"><span class="linenos">34</span></a><span class="k">def</span> <span class="nf">coerce_type</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="coerce_type-35"><a href="#coerce_type-35"><span class="linenos">35</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="coerce_type-36"><a href="#coerce_type-36"><span class="linenos">36</span></a> <span class="n">_coerce_date</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">right</span><span class="p">)</span> +</span><span id="coerce_type-37"><a href="#coerce_type-37"><span class="linenos">37</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">):</span> +</span><span id="coerce_type-38"><a href="#coerce_type-38"><span class="linenos">38</span></a> <span class="n">_coerce_date</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"low"</span><span class="p">])</span> +</span><span id="coerce_type-39"><a href="#coerce_type-39"><span class="linenos">39</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">):</span> +</span><span id="coerce_type-40"><a href="#coerce_type-40"><span class="linenos">40</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">TEMPORAL_TYPES</span><span class="p">:</span> +</span><span id="coerce_type-41"><a href="#coerce_type-41"><span class="linenos">41</span></a> <span class="n">_replace_cast</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"datetime"</span><span class="p">)</span> +</span><span id="coerce_type-42"><a href="#coerce_type-42"><span class="linenos">42</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + + + </section> + <section id="remove_redundant_casts"> + <input id="remove_redundant_casts-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">remove_redundant_casts</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="remove_redundant_casts-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#remove_redundant_casts"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="remove_redundant_casts-45"><a href="#remove_redundant_casts-45"><span class="linenos">45</span></a><span class="k">def</span> <span class="nf">remove_redundant_casts</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="remove_redundant_casts-46"><a href="#remove_redundant_casts-46"><span class="linenos">46</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="remove_redundant_casts-47"><a href="#remove_redundant_casts-47"><span class="linenos">47</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> +</span><span id="remove_redundant_casts-48"><a href="#remove_redundant_casts-48"><span class="linenos">48</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">type</span> +</span><span id="remove_redundant_casts-49"><a href="#remove_redundant_casts-49"><span class="linenos">49</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">type</span> +</span><span id="remove_redundant_casts-50"><a href="#remove_redundant_casts-50"><span class="linenos">50</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">this</span> +</span><span id="remove_redundant_casts-51"><a href="#remove_redundant_casts-51"><span class="linenos">51</span></a> <span class="p">):</span> +</span><span id="remove_redundant_casts-52"><a href="#remove_redundant_casts-52"><span class="linenos">52</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="remove_redundant_casts-53"><a href="#remove_redundant_casts-53"><span class="linenos">53</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/eliminate_ctes.html b/docs/sqlglot/optimizer/eliminate_ctes.html new file mode 100644 index 0000000..2cad407 --- /dev/null +++ b/docs/sqlglot/optimizer/eliminate_ctes.html @@ -0,0 +1,371 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.eliminate_ctes API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#eliminate_ctes">eliminate_ctes</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/eliminate_ctes.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.eliminate_ctes </h1> + + + <input id="mod-eliminate_ctes-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-eliminate_ctes-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">build_scope</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="k">def</span> <span class="nf">eliminate_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="sd"> Remove unused CTEs from an expression.</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd"> Example:</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> >>> sql = "WITH y AS (SELECT a FROM x) SELECT a FROM z"</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> >>> eliminate_ctes(expression).sql()</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd"> 'SELECT a FROM z'</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> Args:</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="sd"> Returns:</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="sd"> """</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">ref_count</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">ref_count</span><span class="p">()</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="c1"># Traverse the scope tree in reverse so we can remove chains of unused CTEs</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">root</span><span class="o">.</span><span class="n">traverse</span><span class="p">())):</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_cte</span><span class="p">:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">scope</span><span class="p">)]</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="k">if</span> <span class="n">count</span> <span class="o"><=</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="n">cte_node</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">with_node</span> <span class="o">=</span> <span class="n">cte_node</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">cte_node</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="c1"># Pop the entire WITH clause if this is the last CTE</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">with_node</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> <span class="o"><=</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="n">with_node</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="c1"># Decrement the ref count for all sources this CTE selects from</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="n">ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="eliminate_ctes"> + <input id="eliminate_ctes-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eliminate_ctes</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="eliminate_ctes-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#eliminate_ctes"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="eliminate_ctes-5"><a href="#eliminate_ctes-5"><span class="linenos"> 5</span></a><span class="k">def</span> <span class="nf">eliminate_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="eliminate_ctes-6"><a href="#eliminate_ctes-6"><span class="linenos"> 6</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="eliminate_ctes-7"><a href="#eliminate_ctes-7"><span class="linenos"> 7</span></a><span class="sd"> Remove unused CTEs from an expression.</span> +</span><span id="eliminate_ctes-8"><a href="#eliminate_ctes-8"><span class="linenos"> 8</span></a> +</span><span id="eliminate_ctes-9"><a href="#eliminate_ctes-9"><span class="linenos"> 9</span></a><span class="sd"> Example:</span> +</span><span id="eliminate_ctes-10"><a href="#eliminate_ctes-10"><span class="linenos">10</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="eliminate_ctes-11"><a href="#eliminate_ctes-11"><span class="linenos">11</span></a><span class="sd"> >>> sql = "WITH y AS (SELECT a FROM x) SELECT a FROM z"</span> +</span><span id="eliminate_ctes-12"><a href="#eliminate_ctes-12"><span class="linenos">12</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="eliminate_ctes-13"><a href="#eliminate_ctes-13"><span class="linenos">13</span></a><span class="sd"> >>> eliminate_ctes(expression).sql()</span> +</span><span id="eliminate_ctes-14"><a href="#eliminate_ctes-14"><span class="linenos">14</span></a><span class="sd"> 'SELECT a FROM z'</span> +</span><span id="eliminate_ctes-15"><a href="#eliminate_ctes-15"><span class="linenos">15</span></a> +</span><span id="eliminate_ctes-16"><a href="#eliminate_ctes-16"><span class="linenos">16</span></a><span class="sd"> Args:</span> +</span><span id="eliminate_ctes-17"><a href="#eliminate_ctes-17"><span class="linenos">17</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="eliminate_ctes-18"><a href="#eliminate_ctes-18"><span class="linenos">18</span></a><span class="sd"> Returns:</span> +</span><span id="eliminate_ctes-19"><a href="#eliminate_ctes-19"><span class="linenos">19</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="eliminate_ctes-20"><a href="#eliminate_ctes-20"><span class="linenos">20</span></a><span class="sd"> """</span> +</span><span id="eliminate_ctes-21"><a href="#eliminate_ctes-21"><span class="linenos">21</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="eliminate_ctes-22"><a href="#eliminate_ctes-22"><span class="linenos">22</span></a> +</span><span id="eliminate_ctes-23"><a href="#eliminate_ctes-23"><span class="linenos">23</span></a> <span class="n">ref_count</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">ref_count</span><span class="p">()</span> +</span><span id="eliminate_ctes-24"><a href="#eliminate_ctes-24"><span class="linenos">24</span></a> +</span><span id="eliminate_ctes-25"><a href="#eliminate_ctes-25"><span class="linenos">25</span></a> <span class="c1"># Traverse the scope tree in reverse so we can remove chains of unused CTEs</span> +</span><span id="eliminate_ctes-26"><a href="#eliminate_ctes-26"><span class="linenos">26</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">root</span><span class="o">.</span><span class="n">traverse</span><span class="p">())):</span> +</span><span id="eliminate_ctes-27"><a href="#eliminate_ctes-27"><span class="linenos">27</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_cte</span><span class="p">:</span> +</span><span id="eliminate_ctes-28"><a href="#eliminate_ctes-28"><span class="linenos">28</span></a> <span class="n">count</span> <span class="o">=</span> <span class="n">ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">scope</span><span class="p">)]</span> +</span><span id="eliminate_ctes-29"><a href="#eliminate_ctes-29"><span class="linenos">29</span></a> <span class="k">if</span> <span class="n">count</span> <span class="o"><=</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="eliminate_ctes-30"><a href="#eliminate_ctes-30"><span class="linenos">30</span></a> <span class="n">cte_node</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="eliminate_ctes-31"><a href="#eliminate_ctes-31"><span class="linenos">31</span></a> <span class="n">with_node</span> <span class="o">=</span> <span class="n">cte_node</span><span class="o">.</span><span class="n">parent</span> +</span><span id="eliminate_ctes-32"><a href="#eliminate_ctes-32"><span class="linenos">32</span></a> <span class="n">cte_node</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="eliminate_ctes-33"><a href="#eliminate_ctes-33"><span class="linenos">33</span></a> +</span><span id="eliminate_ctes-34"><a href="#eliminate_ctes-34"><span class="linenos">34</span></a> <span class="c1"># Pop the entire WITH clause if this is the last CTE</span> +</span><span id="eliminate_ctes-35"><a href="#eliminate_ctes-35"><span class="linenos">35</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">with_node</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> <span class="o"><=</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="eliminate_ctes-36"><a href="#eliminate_ctes-36"><span class="linenos">36</span></a> <span class="n">with_node</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="eliminate_ctes-37"><a href="#eliminate_ctes-37"><span class="linenos">37</span></a> +</span><span id="eliminate_ctes-38"><a href="#eliminate_ctes-38"><span class="linenos">38</span></a> <span class="c1"># Decrement the ref count for all sources this CTE selects from</span> +</span><span id="eliminate_ctes-39"><a href="#eliminate_ctes-39"><span class="linenos">39</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="eliminate_ctes-40"><a href="#eliminate_ctes-40"><span class="linenos">40</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="eliminate_ctes-41"><a href="#eliminate_ctes-41"><span class="linenos">41</span></a> <span class="n">ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="eliminate_ctes-42"><a href="#eliminate_ctes-42"><span class="linenos">42</span></a> +</span><span id="eliminate_ctes-43"><a href="#eliminate_ctes-43"><span class="linenos">43</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Remove unused CTEs from an expression.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">sql</span> <span class="o">=</span> <span class="s2">"WITH y AS (SELECT a FROM x) SELECT a FROM z"</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">eliminate_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT a FROM z'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: optimized expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/eliminate_joins.html b/docs/sqlglot/optimizer/eliminate_joins.html new file mode 100644 index 0000000..1696908 --- /dev/null +++ b/docs/sqlglot/optimizer/eliminate_joins.html @@ -0,0 +1,610 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.eliminate_joins API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#eliminate_joins">eliminate_joins</a> + </li> + <li> + <a class="function" href="#join_condition">join_condition</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/eliminate_joins.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.eliminate_joins </h1> + + + <input id="mod-eliminate_joins-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-eliminate_joins-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.normalize</span> <span class="kn">import</span> <span class="n">normalized</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">simplify</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">eliminate_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> Remove unused joins from an expression.</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd"> This only removes joins when we know that the join condition doesn't produce duplicate rows.</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> Example:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> >>> sql = "SELECT x.a FROM x LEFT JOIN (SELECT DISTINCT y.b FROM y) AS y ON x.b = y.b"</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> >>> eliminate_joins(expression).sql()</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> 'SELECT x.a FROM x'</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Args:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> Returns:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> """</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="c1"># If any columns in this scope aren't qualified, it's hard to determine if a join isn't used.</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="c1"># It's probably possible to infer this from the outputs of derived tables.</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="c1"># But for now, let's just skip this rule.</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">unqualified_columns</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">continue</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="c1"># Reverse the joins so we can remove chains of unused joins</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">joins</span><span class="p">):</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">if</span> <span class="n">_should_eliminate_join</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">join</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">remove_source</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="k">def</span> <span class="nf">_should_eliminate_join</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">inner_source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">inner_source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">_join_is_used</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">side</span> <span class="o">==</span> <span class="s2">"LEFT"</span> <span class="ow">and</span> <span class="n">_is_joined_on_all_unique_outputs</span><span class="p">(</span><span class="n">inner_source</span><span class="p">,</span> <span class="n">join</span><span class="p">))</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="ow">or</span> <span class="p">(</span><span class="ow">not</span> <span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">_has_single_output_row</span><span class="p">(</span><span class="n">inner_source</span><span class="p">))</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="p">)</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="k">def</span> <span class="nf">_join_is_used</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="c1"># We need to find all columns that reference this join.</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="c1"># But columns in the ON clause shouldn't count.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">if</span> <span class="n">on</span><span class="p">:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">on_clause_columns</span> <span class="o">=</span> <span class="p">{</span><span class="nb">id</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)}</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">on_clause_columns</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">source_columns</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> <span class="k">if</span> <span class="nb">id</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">on_clause_columns</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="k">def</span> <span class="nf">_is_joined_on_all_unique_outputs</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">join</span><span class="p">):</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">unique_outputs</span> <span class="o">=</span> <span class="n">_unique_outputs</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">unique_outputs</span><span class="p">:</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">_</span><span class="p">,</span> <span class="n">join_keys</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">join_condition</span><span class="p">(</span><span class="n">join</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">remaining_unique_outputs</span> <span class="o">=</span> <span class="n">unique_outputs</span> <span class="o">-</span> <span class="p">{</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">join_keys</span><span class="p">}</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">return</span> <span class="ow">not</span> <span class="n">remaining_unique_outputs</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="k">def</span> <span class="nf">_unique_outputs</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="w"> </span><span class="sd">"""Determine output columns of `scope` that must have a unique combination per row"""</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">):</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="k">return</span> <span class="nb">set</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="n">group</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">grouped_expressions</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">group</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">grouped_outputs</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">unique_outputs</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">:</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">output</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">unalias</span><span class="p">()</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">output</span> <span class="ow">in</span> <span class="n">grouped_expressions</span><span class="p">:</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">grouped_outputs</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">output</span><span class="p">)</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">unique_outputs</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="c1"># All the grouped expressions must be in the output</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">grouped_expressions</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="n">grouped_outputs</span><span class="p">):</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">return</span> <span class="n">unique_outputs</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">return</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="n">_has_single_output_row</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="nb">set</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="k">def</span> <span class="nf">_has_single_output_row</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="nb">all</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">unalias</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">)</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="ow">or</span> <span class="n">_is_limit_1</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="ow">or</span> <span class="ow">not</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a><span class="k">def</span> <span class="nf">_is_limit_1</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"limit"</span><span class="p">)</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">return</span> <span class="n">limit</span> <span class="ow">and</span> <span class="n">limit</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="s2">"1"</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a><span class="k">def</span> <span class="nf">join_condition</span><span class="p">(</span><span class="n">join</span><span class="p">):</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a><span class="sd"> Extract the join condition from a join expression.</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a><span class="sd"> Args:</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a><span class="sd"> join (exp.Join)</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a><span class="sd"> Returns:</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a><span class="sd"> tuple[list[str], list[str], exp.Expression]:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a><span class="sd"> Tuple of (source key, join key, remaining predicate)</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a><span class="sd"> """</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">on</span> <span class="o">=</span> <span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">source_key</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">join_key</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">extract_condition</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">left</span><span class="p">,</span> <span class="n">right</span> <span class="o">=</span> <span class="n">condition</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">left_tables</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">right_tables</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">left_tables</span> <span class="ow">and</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">right_tables</span><span class="p">:</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">join_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">source_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">condition</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">elif</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">right_tables</span> <span class="ow">and</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">left_tables</span><span class="p">:</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">join_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">source_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">condition</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="c1"># find the join keys</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="c1"># SELECT</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="c1"># FROM x</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="c1"># JOIN y</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="c1"># ON x.a = y.b AND y.b > 1</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="c1">#</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="c1"># should pull y.b as the join key and x.a as the source key</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="k">if</span> <span class="n">normalized</span><span class="p">(</span><span class="n">on</span><span class="p">):</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">on</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">for</span> <span class="n">condition</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">flatten</span><span class="p">():</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">extract_condition</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">elif</span> <span class="n">normalized</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="k">for</span> <span class="n">condition</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">flatten</span><span class="p">():</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="p">[</span><span class="n">part</span> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="n">condition</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">part</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)]</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="k">if</span> <span class="n">conditions</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="n">parts</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">temp</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">parts</span><span class="p">:</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">cs</span> <span class="o">=</span> <span class="p">[</span><span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">conditions</span> <span class="k">if</span> <span class="n">p</span> <span class="o">==</span> <span class="n">c</span><span class="p">]</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="n">cs</span><span class="p">:</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">temp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">temp</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">cs</span><span class="p">)</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="n">temp</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="k">for</span> <span class="n">condition</span> <span class="ow">in</span> <span class="n">conditions</span><span class="p">:</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">extract_condition</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">on</span><span class="p">)</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">remaining_condition</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">on</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">else</span> <span class="n">on</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="n">source_key</span><span class="p">,</span> <span class="n">join_key</span><span class="p">,</span> <span class="n">remaining_condition</span> +</span></pre></div> + + + </section> + <section id="eliminate_joins"> + <input id="eliminate_joins-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eliminate_joins</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="eliminate_joins-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#eliminate_joins"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="eliminate_joins-8"><a href="#eliminate_joins-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">eliminate_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="eliminate_joins-9"><a href="#eliminate_joins-9"><span class="linenos"> 9</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="eliminate_joins-10"><a href="#eliminate_joins-10"><span class="linenos">10</span></a><span class="sd"> Remove unused joins from an expression.</span> +</span><span id="eliminate_joins-11"><a href="#eliminate_joins-11"><span class="linenos">11</span></a> +</span><span id="eliminate_joins-12"><a href="#eliminate_joins-12"><span class="linenos">12</span></a><span class="sd"> This only removes joins when we know that the join condition doesn't produce duplicate rows.</span> +</span><span id="eliminate_joins-13"><a href="#eliminate_joins-13"><span class="linenos">13</span></a> +</span><span id="eliminate_joins-14"><a href="#eliminate_joins-14"><span class="linenos">14</span></a><span class="sd"> Example:</span> +</span><span id="eliminate_joins-15"><a href="#eliminate_joins-15"><span class="linenos">15</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="eliminate_joins-16"><a href="#eliminate_joins-16"><span class="linenos">16</span></a><span class="sd"> >>> sql = "SELECT x.a FROM x LEFT JOIN (SELECT DISTINCT y.b FROM y) AS y ON x.b = y.b"</span> +</span><span id="eliminate_joins-17"><a href="#eliminate_joins-17"><span class="linenos">17</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="eliminate_joins-18"><a href="#eliminate_joins-18"><span class="linenos">18</span></a><span class="sd"> >>> eliminate_joins(expression).sql()</span> +</span><span id="eliminate_joins-19"><a href="#eliminate_joins-19"><span class="linenos">19</span></a><span class="sd"> 'SELECT x.a FROM x'</span> +</span><span id="eliminate_joins-20"><a href="#eliminate_joins-20"><span class="linenos">20</span></a> +</span><span id="eliminate_joins-21"><a href="#eliminate_joins-21"><span class="linenos">21</span></a><span class="sd"> Args:</span> +</span><span id="eliminate_joins-22"><a href="#eliminate_joins-22"><span class="linenos">22</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="eliminate_joins-23"><a href="#eliminate_joins-23"><span class="linenos">23</span></a><span class="sd"> Returns:</span> +</span><span id="eliminate_joins-24"><a href="#eliminate_joins-24"><span class="linenos">24</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="eliminate_joins-25"><a href="#eliminate_joins-25"><span class="linenos">25</span></a><span class="sd"> """</span> +</span><span id="eliminate_joins-26"><a href="#eliminate_joins-26"><span class="linenos">26</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="eliminate_joins-27"><a href="#eliminate_joins-27"><span class="linenos">27</span></a> <span class="c1"># If any columns in this scope aren't qualified, it's hard to determine if a join isn't used.</span> +</span><span id="eliminate_joins-28"><a href="#eliminate_joins-28"><span class="linenos">28</span></a> <span class="c1"># It's probably possible to infer this from the outputs of derived tables.</span> +</span><span id="eliminate_joins-29"><a href="#eliminate_joins-29"><span class="linenos">29</span></a> <span class="c1"># But for now, let's just skip this rule.</span> +</span><span id="eliminate_joins-30"><a href="#eliminate_joins-30"><span class="linenos">30</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">unqualified_columns</span><span class="p">:</span> +</span><span id="eliminate_joins-31"><a href="#eliminate_joins-31"><span class="linenos">31</span></a> <span class="k">continue</span> +</span><span id="eliminate_joins-32"><a href="#eliminate_joins-32"><span class="linenos">32</span></a> +</span><span id="eliminate_joins-33"><a href="#eliminate_joins-33"><span class="linenos">33</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="eliminate_joins-34"><a href="#eliminate_joins-34"><span class="linenos">34</span></a> +</span><span id="eliminate_joins-35"><a href="#eliminate_joins-35"><span class="linenos">35</span></a> <span class="c1"># Reverse the joins so we can remove chains of unused joins</span> +</span><span id="eliminate_joins-36"><a href="#eliminate_joins-36"><span class="linenos">36</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">joins</span><span class="p">):</span> +</span><span id="eliminate_joins-37"><a href="#eliminate_joins-37"><span class="linenos">37</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="eliminate_joins-38"><a href="#eliminate_joins-38"><span class="linenos">38</span></a> <span class="k">if</span> <span class="n">_should_eliminate_join</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">join</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="eliminate_joins-39"><a href="#eliminate_joins-39"><span class="linenos">39</span></a> <span class="n">join</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="eliminate_joins-40"><a href="#eliminate_joins-40"><span class="linenos">40</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">remove_source</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="eliminate_joins-41"><a href="#eliminate_joins-41"><span class="linenos">41</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Remove unused joins from an expression.</p> + +<p>This only removes joins when we know that the join condition doesn't produce duplicate rows.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">sql</span> <span class="o">=</span> <span class="s2">"SELECT x.a FROM x LEFT JOIN (SELECT DISTINCT y.b FROM y) AS y ON x.b = y.b"</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">eliminate_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x.a FROM x'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: optimized expression</p> +</blockquote> +</div> + + + </section> + <section id="join_condition"> + <input id="join_condition-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">join_condition</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">join</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="join_condition-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#join_condition"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="join_condition-121"><a href="#join_condition-121"><span class="linenos">121</span></a><span class="k">def</span> <span class="nf">join_condition</span><span class="p">(</span><span class="n">join</span><span class="p">):</span> +</span><span id="join_condition-122"><a href="#join_condition-122"><span class="linenos">122</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="join_condition-123"><a href="#join_condition-123"><span class="linenos">123</span></a><span class="sd"> Extract the join condition from a join expression.</span> +</span><span id="join_condition-124"><a href="#join_condition-124"><span class="linenos">124</span></a> +</span><span id="join_condition-125"><a href="#join_condition-125"><span class="linenos">125</span></a><span class="sd"> Args:</span> +</span><span id="join_condition-126"><a href="#join_condition-126"><span class="linenos">126</span></a><span class="sd"> join (exp.Join)</span> +</span><span id="join_condition-127"><a href="#join_condition-127"><span class="linenos">127</span></a><span class="sd"> Returns:</span> +</span><span id="join_condition-128"><a href="#join_condition-128"><span class="linenos">128</span></a><span class="sd"> tuple[list[str], list[str], exp.Expression]:</span> +</span><span id="join_condition-129"><a href="#join_condition-129"><span class="linenos">129</span></a><span class="sd"> Tuple of (source key, join key, remaining predicate)</span> +</span><span id="join_condition-130"><a href="#join_condition-130"><span class="linenos">130</span></a><span class="sd"> """</span> +</span><span id="join_condition-131"><a href="#join_condition-131"><span class="linenos">131</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="join_condition-132"><a href="#join_condition-132"><span class="linenos">132</span></a> <span class="n">on</span> <span class="o">=</span> <span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="join_condition-133"><a href="#join_condition-133"><span class="linenos">133</span></a> <span class="n">source_key</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="join_condition-134"><a href="#join_condition-134"><span class="linenos">134</span></a> <span class="n">join_key</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="join_condition-135"><a href="#join_condition-135"><span class="linenos">135</span></a> +</span><span id="join_condition-136"><a href="#join_condition-136"><span class="linenos">136</span></a> <span class="k">def</span> <span class="nf">extract_condition</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="join_condition-137"><a href="#join_condition-137"><span class="linenos">137</span></a> <span class="n">left</span><span class="p">,</span> <span class="n">right</span> <span class="o">=</span> <span class="n">condition</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="join_condition-138"><a href="#join_condition-138"><span class="linenos">138</span></a> <span class="n">left_tables</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="join_condition-139"><a href="#join_condition-139"><span class="linenos">139</span></a> <span class="n">right_tables</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="join_condition-140"><a href="#join_condition-140"><span class="linenos">140</span></a> +</span><span id="join_condition-141"><a href="#join_condition-141"><span class="linenos">141</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">left_tables</span> <span class="ow">and</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">right_tables</span><span class="p">:</span> +</span><span id="join_condition-142"><a href="#join_condition-142"><span class="linenos">142</span></a> <span class="n">join_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="join_condition-143"><a href="#join_condition-143"><span class="linenos">143</span></a> <span class="n">source_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="join_condition-144"><a href="#join_condition-144"><span class="linenos">144</span></a> <span class="n">condition</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="join_condition-145"><a href="#join_condition-145"><span class="linenos">145</span></a> <span class="k">elif</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">right_tables</span> <span class="ow">and</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">left_tables</span><span class="p">:</span> +</span><span id="join_condition-146"><a href="#join_condition-146"><span class="linenos">146</span></a> <span class="n">join_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="join_condition-147"><a href="#join_condition-147"><span class="linenos">147</span></a> <span class="n">source_key</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="join_condition-148"><a href="#join_condition-148"><span class="linenos">148</span></a> <span class="n">condition</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="join_condition-149"><a href="#join_condition-149"><span class="linenos">149</span></a> +</span><span id="join_condition-150"><a href="#join_condition-150"><span class="linenos">150</span></a> <span class="c1"># find the join keys</span> +</span><span id="join_condition-151"><a href="#join_condition-151"><span class="linenos">151</span></a> <span class="c1"># SELECT</span> +</span><span id="join_condition-152"><a href="#join_condition-152"><span class="linenos">152</span></a> <span class="c1"># FROM x</span> +</span><span id="join_condition-153"><a href="#join_condition-153"><span class="linenos">153</span></a> <span class="c1"># JOIN y</span> +</span><span id="join_condition-154"><a href="#join_condition-154"><span class="linenos">154</span></a> <span class="c1"># ON x.a = y.b AND y.b > 1</span> +</span><span id="join_condition-155"><a href="#join_condition-155"><span class="linenos">155</span></a> <span class="c1">#</span> +</span><span id="join_condition-156"><a href="#join_condition-156"><span class="linenos">156</span></a> <span class="c1"># should pull y.b as the join key and x.a as the source key</span> +</span><span id="join_condition-157"><a href="#join_condition-157"><span class="linenos">157</span></a> <span class="k">if</span> <span class="n">normalized</span><span class="p">(</span><span class="n">on</span><span class="p">):</span> +</span><span id="join_condition-158"><a href="#join_condition-158"><span class="linenos">158</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">on</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="join_condition-159"><a href="#join_condition-159"><span class="linenos">159</span></a> +</span><span id="join_condition-160"><a href="#join_condition-160"><span class="linenos">160</span></a> <span class="k">for</span> <span class="n">condition</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">flatten</span><span class="p">():</span> +</span><span id="join_condition-161"><a href="#join_condition-161"><span class="linenos">161</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="join_condition-162"><a href="#join_condition-162"><span class="linenos">162</span></a> <span class="n">extract_condition</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="join_condition-163"><a href="#join_condition-163"><span class="linenos">163</span></a> <span class="k">elif</span> <span class="n">normalized</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="join_condition-164"><a href="#join_condition-164"><span class="linenos">164</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="join_condition-165"><a href="#join_condition-165"><span class="linenos">165</span></a> +</span><span id="join_condition-166"><a href="#join_condition-166"><span class="linenos">166</span></a> <span class="k">for</span> <span class="n">condition</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">flatten</span><span class="p">():</span> +</span><span id="join_condition-167"><a href="#join_condition-167"><span class="linenos">167</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="p">[</span><span class="n">part</span> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="n">condition</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">part</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)]</span> +</span><span id="join_condition-168"><a href="#join_condition-168"><span class="linenos">168</span></a> <span class="k">if</span> <span class="n">conditions</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="join_condition-169"><a href="#join_condition-169"><span class="linenos">169</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="n">parts</span> +</span><span id="join_condition-170"><a href="#join_condition-170"><span class="linenos">170</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="join_condition-171"><a href="#join_condition-171"><span class="linenos">171</span></a> <span class="n">temp</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="join_condition-172"><a href="#join_condition-172"><span class="linenos">172</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">parts</span><span class="p">:</span> +</span><span id="join_condition-173"><a href="#join_condition-173"><span class="linenos">173</span></a> <span class="n">cs</span> <span class="o">=</span> <span class="p">[</span><span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">conditions</span> <span class="k">if</span> <span class="n">p</span> <span class="o">==</span> <span class="n">c</span><span class="p">]</span> +</span><span id="join_condition-174"><a href="#join_condition-174"><span class="linenos">174</span></a> +</span><span id="join_condition-175"><a href="#join_condition-175"><span class="linenos">175</span></a> <span class="k">if</span> <span class="n">cs</span><span class="p">:</span> +</span><span id="join_condition-176"><a href="#join_condition-176"><span class="linenos">176</span></a> <span class="n">temp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="join_condition-177"><a href="#join_condition-177"><span class="linenos">177</span></a> <span class="n">temp</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">cs</span><span class="p">)</span> +</span><span id="join_condition-178"><a href="#join_condition-178"><span class="linenos">178</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="n">temp</span> +</span><span id="join_condition-179"><a href="#join_condition-179"><span class="linenos">179</span></a> +</span><span id="join_condition-180"><a href="#join_condition-180"><span class="linenos">180</span></a> <span class="k">for</span> <span class="n">condition</span> <span class="ow">in</span> <span class="n">conditions</span><span class="p">:</span> +</span><span id="join_condition-181"><a href="#join_condition-181"><span class="linenos">181</span></a> <span class="n">extract_condition</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> +</span><span id="join_condition-182"><a href="#join_condition-182"><span class="linenos">182</span></a> +</span><span id="join_condition-183"><a href="#join_condition-183"><span class="linenos">183</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">on</span><span class="p">)</span> +</span><span id="join_condition-184"><a href="#join_condition-184"><span class="linenos">184</span></a> <span class="n">remaining_condition</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">on</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">else</span> <span class="n">on</span> +</span><span id="join_condition-185"><a href="#join_condition-185"><span class="linenos">185</span></a> <span class="k">return</span> <span class="n">source_key</span><span class="p">,</span> <span class="n">join_key</span><span class="p">,</span> <span class="n">remaining_condition</span> +</span></pre></div> + + + <div class="docstring"><p>Extract the join condition from a join expression.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li>join (exp.Join)</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>tuple[list[str], list[str], exp.Expression]: + Tuple of (source key, join key, remaining predicate)</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/eliminate_subqueries.html b/docs/sqlglot/optimizer/eliminate_subqueries.html new file mode 100644 index 0000000..34e38b8 --- /dev/null +++ b/docs/sqlglot/optimizer/eliminate_subqueries.html @@ -0,0 +1,582 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.eliminate_subqueries API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#eliminate_subqueries">eliminate_subqueries</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/eliminate_subqueries.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.eliminate_subqueries </h1> + + + <input id="mod-eliminate_subqueries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-eliminate_subqueries-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">find_new_name</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">build_scope</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">simplify</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">eliminate_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd"> Rewrite derived tables as CTES, deduplicating if possible.</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> Example:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT * FROM x) AS y")</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> >>> eliminate_subqueries(expression).sql()</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> 'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y'</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> This also deduplicates common subqueries:</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT * FROM x) AS y JOIN (SELECT * FROM x) AS z")</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> >>> eliminate_subqueries(expression).sql()</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> 'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y JOIN y AS z'</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> Args:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> expression (sqlglot.Expression): expression</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> Returns:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> sqlglot.Expression: expression</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a><span class="sd"> """</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="c1"># It's possible to have subqueries at the root, e.g. (SELECT * FROM x) LIMIT 1</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">eliminate_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="c1"># Map of alias->Scope|Table</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="c1"># These are all aliases that are already used in the expression.</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="c1"># We don't want to create new CTEs that conflict with these names.</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">taken</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="c1"># All CTE aliases in the root scope are taken</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">:</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">taken</span><span class="p">[</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">scope</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="c1"># All table names are taken</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">taken</span><span class="o">.</span><span class="n">update</span><span class="p">(</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="p">{</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">source</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">source</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="p">}</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="c1"># Map of Expression->alias</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="c1"># Existing CTES in the root expression. We'll use this for deduplication.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">existing_ctes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="n">with_</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">existing_ctes</span><span class="p">[</span><span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="p">]</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">new_ctes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="c1"># We're adding more CTEs, but we want to maintain the DAG order.</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="c1"># Derived tables within an existing CTE need to come before the existing CTE.</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="k">for</span> <span class="n">cte_scope</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">:</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="c1"># Append all the new CTEs from this existing CTE</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">cte_scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">if</span> <span class="n">scope</span> <span class="ow">is</span> <span class="n">cte_scope</span><span class="p">:</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="c1"># Don't try to eliminate this CTE itself</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">continue</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">new_cte</span> <span class="o">=</span> <span class="n">_eliminate</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">if</span> <span class="n">new_cte</span><span class="p">:</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">new_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_cte</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="c1"># Append the existing CTE itself</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">new_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cte_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="c1"># Now append the rest</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">(</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">root</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">,</span> <span class="n">root</span><span class="o">.</span><span class="n">subquery_scopes</span><span class="p">,</span> <span class="n">root</span><span class="o">.</span><span class="n">derived_table_scopes</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="p">):</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">new_cte</span> <span class="o">=</span> <span class="n">_eliminate</span><span class="p">(</span><span class="n">child_scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">if</span> <span class="n">new_cte</span><span class="p">:</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">new_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_cte</span><span class="p">)</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="n">new_ctes</span><span class="p">:</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">new_ctes</span><span class="p">,</span> <span class="n">recursive</span><span class="o">=</span><span class="n">recursive</span><span class="p">))</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a><span class="k">def</span> <span class="nf">_eliminate</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">):</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_union</span><span class="p">:</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="n">_eliminate_union</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_derived_table</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="n">_eliminate_derived_table</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_cte</span><span class="p">:</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="n">_eliminate_cte</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="k">def</span> <span class="nf">_eliminate_union</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">):</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">duplicate_cte_alias</span> <span class="o">=</span> <span class="n">existing_ctes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">duplicate_cte_alias</span> <span class="ow">or</span> <span class="n">find_new_name</span><span class="p">(</span><span class="n">taken</span><span class="o">=</span><span class="n">taken</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="s2">"cte"</span><span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">taken</span><span class="p">[</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">scope</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="c1"># Try to maintain the selections</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">alias</span><span class="p">),</span> <span class="n">alias</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expressions</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="p">]</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="c1"># If not all selections have an alias, just select *</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">selects</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"*"</span><span class="p">]</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">selects</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">table_</span><span class="p">(</span><span class="n">alias</span><span class="p">),</span> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">)))</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">duplicate_cte_alias</span><span class="p">:</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">existing_ctes</span><span class="p">[</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">alias</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">(</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">this</span><span class="o">=</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias</span><span class="p">)),</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="p">)</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a><span class="k">def</span> <span class="nf">_eliminate_derived_table</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">):</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">name</span><span class="p">,</span> <span class="n">cte</span> <span class="o">=</span> <span class="n">_new_cte</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">table_</span><span class="p">(</span><span class="n">name</span><span class="p">),</span> <span class="n">alias</span><span class="o">=</span><span class="n">parent</span><span class="o">.</span><span class="n">alias</span> <span class="ow">or</span> <span class="n">name</span><span class="p">)</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">parent</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="k">return</span> <span class="n">cte</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a><span class="k">def</span> <span class="nf">_eliminate_cte</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">):</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">name</span><span class="p">,</span> <span class="n">cte</span> <span class="o">=</span> <span class="n">_new_cte</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">parent</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">with_</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="c1"># Rename references to this CTE</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">for</span> <span class="n">table</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">child_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">if</span> <span class="n">source</span> <span class="ow">is</span> <span class="n">scope</span><span class="p">:</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">new_table</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">table_</span><span class="p">(</span><span class="n">name</span><span class="p">),</span> <span class="n">alias</span><span class="o">=</span><span class="n">table</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">)</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">table</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">new_table</span><span class="p">)</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="n">cte</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a><span class="k">def</span> <span class="nf">_new_cte</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">):</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a><span class="sd"> Returns:</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a><span class="sd"> tuple of (name, cte)</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a><span class="sd"> where `name` is a new name for this CTE in the root scope and `cte` is a new CTE instance.</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a><span class="sd"> If this CTE duplicates an existing CTE, `cte` will be None.</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a><span class="sd"> """</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">duplicate_cte_alias</span> <span class="o">=</span> <span class="n">existing_ctes</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">name</span><span class="p">:</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">find_new_name</span><span class="p">(</span><span class="n">taken</span><span class="o">=</span><span class="n">taken</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="s2">"cte"</span><span class="p">)</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="k">if</span> <span class="n">duplicate_cte_alias</span><span class="p">:</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">duplicate_cte_alias</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">elif</span> <span class="n">taken</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">):</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">find_new_name</span><span class="p">(</span><span class="n">taken</span><span class="o">=</span><span class="n">taken</span><span class="p">,</span> <span class="n">base</span><span class="o">=</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">taken</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">scope</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">duplicate_cte_alias</span><span class="p">:</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">existing_ctes</span><span class="p">[</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">name</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">(</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">this</span><span class="o">=</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">)),</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="p">)</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">return</span> <span class="n">name</span><span class="p">,</span> <span class="n">cte</span> +</span></pre></div> + + + </section> + <section id="eliminate_subqueries"> + <input id="eliminate_subqueries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eliminate_subqueries</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="eliminate_subqueries-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#eliminate_subqueries"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="eliminate_subqueries-10"><a href="#eliminate_subqueries-10"><span class="linenos">10</span></a><span class="k">def</span> <span class="nf">eliminate_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="eliminate_subqueries-11"><a href="#eliminate_subqueries-11"><span class="linenos">11</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="eliminate_subqueries-12"><a href="#eliminate_subqueries-12"><span class="linenos">12</span></a><span class="sd"> Rewrite derived tables as CTES, deduplicating if possible.</span> +</span><span id="eliminate_subqueries-13"><a href="#eliminate_subqueries-13"><span class="linenos">13</span></a> +</span><span id="eliminate_subqueries-14"><a href="#eliminate_subqueries-14"><span class="linenos">14</span></a><span class="sd"> Example:</span> +</span><span id="eliminate_subqueries-15"><a href="#eliminate_subqueries-15"><span class="linenos">15</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="eliminate_subqueries-16"><a href="#eliminate_subqueries-16"><span class="linenos">16</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT * FROM x) AS y")</span> +</span><span id="eliminate_subqueries-17"><a href="#eliminate_subqueries-17"><span class="linenos">17</span></a><span class="sd"> >>> eliminate_subqueries(expression).sql()</span> +</span><span id="eliminate_subqueries-18"><a href="#eliminate_subqueries-18"><span class="linenos">18</span></a><span class="sd"> 'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y'</span> +</span><span id="eliminate_subqueries-19"><a href="#eliminate_subqueries-19"><span class="linenos">19</span></a> +</span><span id="eliminate_subqueries-20"><a href="#eliminate_subqueries-20"><span class="linenos">20</span></a><span class="sd"> This also deduplicates common subqueries:</span> +</span><span id="eliminate_subqueries-21"><a href="#eliminate_subqueries-21"><span class="linenos">21</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT * FROM x) AS y JOIN (SELECT * FROM x) AS z")</span> +</span><span id="eliminate_subqueries-22"><a href="#eliminate_subqueries-22"><span class="linenos">22</span></a><span class="sd"> >>> eliminate_subqueries(expression).sql()</span> +</span><span id="eliminate_subqueries-23"><a href="#eliminate_subqueries-23"><span class="linenos">23</span></a><span class="sd"> 'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y JOIN y AS z'</span> +</span><span id="eliminate_subqueries-24"><a href="#eliminate_subqueries-24"><span class="linenos">24</span></a> +</span><span id="eliminate_subqueries-25"><a href="#eliminate_subqueries-25"><span class="linenos">25</span></a><span class="sd"> Args:</span> +</span><span id="eliminate_subqueries-26"><a href="#eliminate_subqueries-26"><span class="linenos">26</span></a><span class="sd"> expression (sqlglot.Expression): expression</span> +</span><span id="eliminate_subqueries-27"><a href="#eliminate_subqueries-27"><span class="linenos">27</span></a><span class="sd"> Returns:</span> +</span><span id="eliminate_subqueries-28"><a href="#eliminate_subqueries-28"><span class="linenos">28</span></a><span class="sd"> sqlglot.Expression: expression</span> +</span><span id="eliminate_subqueries-29"><a href="#eliminate_subqueries-29"><span class="linenos">29</span></a><span class="sd"> """</span> +</span><span id="eliminate_subqueries-30"><a href="#eliminate_subqueries-30"><span class="linenos">30</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="eliminate_subqueries-31"><a href="#eliminate_subqueries-31"><span class="linenos">31</span></a> <span class="c1"># It's possible to have subqueries at the root, e.g. (SELECT * FROM x) LIMIT 1</span> +</span><span id="eliminate_subqueries-32"><a href="#eliminate_subqueries-32"><span class="linenos">32</span></a> <span class="n">eliminate_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="eliminate_subqueries-33"><a href="#eliminate_subqueries-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="eliminate_subqueries-34"><a href="#eliminate_subqueries-34"><span class="linenos">34</span></a> +</span><span id="eliminate_subqueries-35"><a href="#eliminate_subqueries-35"><span class="linenos">35</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="eliminate_subqueries-36"><a href="#eliminate_subqueries-36"><span class="linenos">36</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="eliminate_subqueries-37"><a href="#eliminate_subqueries-37"><span class="linenos">37</span></a> +</span><span id="eliminate_subqueries-38"><a href="#eliminate_subqueries-38"><span class="linenos">38</span></a> <span class="c1"># Map of alias->Scope|Table</span> +</span><span id="eliminate_subqueries-39"><a href="#eliminate_subqueries-39"><span class="linenos">39</span></a> <span class="c1"># These are all aliases that are already used in the expression.</span> +</span><span id="eliminate_subqueries-40"><a href="#eliminate_subqueries-40"><span class="linenos">40</span></a> <span class="c1"># We don't want to create new CTEs that conflict with these names.</span> +</span><span id="eliminate_subqueries-41"><a href="#eliminate_subqueries-41"><span class="linenos">41</span></a> <span class="n">taken</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="eliminate_subqueries-42"><a href="#eliminate_subqueries-42"><span class="linenos">42</span></a> +</span><span id="eliminate_subqueries-43"><a href="#eliminate_subqueries-43"><span class="linenos">43</span></a> <span class="c1"># All CTE aliases in the root scope are taken</span> +</span><span id="eliminate_subqueries-44"><a href="#eliminate_subqueries-44"><span class="linenos">44</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">:</span> +</span><span id="eliminate_subqueries-45"><a href="#eliminate_subqueries-45"><span class="linenos">45</span></a> <span class="n">taken</span><span class="p">[</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">scope</span> +</span><span id="eliminate_subqueries-46"><a href="#eliminate_subqueries-46"><span class="linenos">46</span></a> +</span><span id="eliminate_subqueries-47"><a href="#eliminate_subqueries-47"><span class="linenos">47</span></a> <span class="c1"># All table names are taken</span> +</span><span id="eliminate_subqueries-48"><a href="#eliminate_subqueries-48"><span class="linenos">48</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="eliminate_subqueries-49"><a href="#eliminate_subqueries-49"><span class="linenos">49</span></a> <span class="n">taken</span><span class="o">.</span><span class="n">update</span><span class="p">(</span> +</span><span id="eliminate_subqueries-50"><a href="#eliminate_subqueries-50"><span class="linenos">50</span></a> <span class="p">{</span> +</span><span id="eliminate_subqueries-51"><a href="#eliminate_subqueries-51"><span class="linenos">51</span></a> <span class="n">source</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">source</span> +</span><span id="eliminate_subqueries-52"><a href="#eliminate_subqueries-52"><span class="linenos">52</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="eliminate_subqueries-53"><a href="#eliminate_subqueries-53"><span class="linenos">53</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="eliminate_subqueries-54"><a href="#eliminate_subqueries-54"><span class="linenos">54</span></a> <span class="p">}</span> +</span><span id="eliminate_subqueries-55"><a href="#eliminate_subqueries-55"><span class="linenos">55</span></a> <span class="p">)</span> +</span><span id="eliminate_subqueries-56"><a href="#eliminate_subqueries-56"><span class="linenos">56</span></a> +</span><span id="eliminate_subqueries-57"><a href="#eliminate_subqueries-57"><span class="linenos">57</span></a> <span class="c1"># Map of Expression->alias</span> +</span><span id="eliminate_subqueries-58"><a href="#eliminate_subqueries-58"><span class="linenos">58</span></a> <span class="c1"># Existing CTES in the root expression. We'll use this for deduplication.</span> +</span><span id="eliminate_subqueries-59"><a href="#eliminate_subqueries-59"><span class="linenos">59</span></a> <span class="n">existing_ctes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="eliminate_subqueries-60"><a href="#eliminate_subqueries-60"><span class="linenos">60</span></a> +</span><span id="eliminate_subqueries-61"><a href="#eliminate_subqueries-61"><span class="linenos">61</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="eliminate_subqueries-62"><a href="#eliminate_subqueries-62"><span class="linenos">62</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="eliminate_subqueries-63"><a href="#eliminate_subqueries-63"><span class="linenos">63</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="eliminate_subqueries-64"><a href="#eliminate_subqueries-64"><span class="linenos">64</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="n">with_</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"recursive"</span><span class="p">)</span> +</span><span id="eliminate_subqueries-65"><a href="#eliminate_subqueries-65"><span class="linenos">65</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="eliminate_subqueries-66"><a href="#eliminate_subqueries-66"><span class="linenos">66</span></a> <span class="n">existing_ctes</span><span class="p">[</span><span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="p">]</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias</span> +</span><span id="eliminate_subqueries-67"><a href="#eliminate_subqueries-67"><span class="linenos">67</span></a> <span class="n">new_ctes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="eliminate_subqueries-68"><a href="#eliminate_subqueries-68"><span class="linenos">68</span></a> +</span><span id="eliminate_subqueries-69"><a href="#eliminate_subqueries-69"><span class="linenos">69</span></a> <span class="c1"># We're adding more CTEs, but we want to maintain the DAG order.</span> +</span><span id="eliminate_subqueries-70"><a href="#eliminate_subqueries-70"><span class="linenos">70</span></a> <span class="c1"># Derived tables within an existing CTE need to come before the existing CTE.</span> +</span><span id="eliminate_subqueries-71"><a href="#eliminate_subqueries-71"><span class="linenos">71</span></a> <span class="k">for</span> <span class="n">cte_scope</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">:</span> +</span><span id="eliminate_subqueries-72"><a href="#eliminate_subqueries-72"><span class="linenos">72</span></a> <span class="c1"># Append all the new CTEs from this existing CTE</span> +</span><span id="eliminate_subqueries-73"><a href="#eliminate_subqueries-73"><span class="linenos">73</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">cte_scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="eliminate_subqueries-74"><a href="#eliminate_subqueries-74"><span class="linenos">74</span></a> <span class="k">if</span> <span class="n">scope</span> <span class="ow">is</span> <span class="n">cte_scope</span><span class="p">:</span> +</span><span id="eliminate_subqueries-75"><a href="#eliminate_subqueries-75"><span class="linenos">75</span></a> <span class="c1"># Don't try to eliminate this CTE itself</span> +</span><span id="eliminate_subqueries-76"><a href="#eliminate_subqueries-76"><span class="linenos">76</span></a> <span class="k">continue</span> +</span><span id="eliminate_subqueries-77"><a href="#eliminate_subqueries-77"><span class="linenos">77</span></a> <span class="n">new_cte</span> <span class="o">=</span> <span class="n">_eliminate</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="eliminate_subqueries-78"><a href="#eliminate_subqueries-78"><span class="linenos">78</span></a> <span class="k">if</span> <span class="n">new_cte</span><span class="p">:</span> +</span><span id="eliminate_subqueries-79"><a href="#eliminate_subqueries-79"><span class="linenos">79</span></a> <span class="n">new_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_cte</span><span class="p">)</span> +</span><span id="eliminate_subqueries-80"><a href="#eliminate_subqueries-80"><span class="linenos">80</span></a> +</span><span id="eliminate_subqueries-81"><a href="#eliminate_subqueries-81"><span class="linenos">81</span></a> <span class="c1"># Append the existing CTE itself</span> +</span><span id="eliminate_subqueries-82"><a href="#eliminate_subqueries-82"><span class="linenos">82</span></a> <span class="n">new_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cte_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">)</span> +</span><span id="eliminate_subqueries-83"><a href="#eliminate_subqueries-83"><span class="linenos">83</span></a> +</span><span id="eliminate_subqueries-84"><a href="#eliminate_subqueries-84"><span class="linenos">84</span></a> <span class="c1"># Now append the rest</span> +</span><span id="eliminate_subqueries-85"><a href="#eliminate_subqueries-85"><span class="linenos">85</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">(</span> +</span><span id="eliminate_subqueries-86"><a href="#eliminate_subqueries-86"><span class="linenos">86</span></a> <span class="n">root</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">,</span> <span class="n">root</span><span class="o">.</span><span class="n">subquery_scopes</span><span class="p">,</span> <span class="n">root</span><span class="o">.</span><span class="n">derived_table_scopes</span> +</span><span id="eliminate_subqueries-87"><a href="#eliminate_subqueries-87"><span class="linenos">87</span></a> <span class="p">):</span> +</span><span id="eliminate_subqueries-88"><a href="#eliminate_subqueries-88"><span class="linenos">88</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="eliminate_subqueries-89"><a href="#eliminate_subqueries-89"><span class="linenos">89</span></a> <span class="n">new_cte</span> <span class="o">=</span> <span class="n">_eliminate</span><span class="p">(</span><span class="n">child_scope</span><span class="p">,</span> <span class="n">existing_ctes</span><span class="p">,</span> <span class="n">taken</span><span class="p">)</span> +</span><span id="eliminate_subqueries-90"><a href="#eliminate_subqueries-90"><span class="linenos">90</span></a> <span class="k">if</span> <span class="n">new_cte</span><span class="p">:</span> +</span><span id="eliminate_subqueries-91"><a href="#eliminate_subqueries-91"><span class="linenos">91</span></a> <span class="n">new_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">new_cte</span><span class="p">)</span> +</span><span id="eliminate_subqueries-92"><a href="#eliminate_subqueries-92"><span class="linenos">92</span></a> +</span><span id="eliminate_subqueries-93"><a href="#eliminate_subqueries-93"><span class="linenos">93</span></a> <span class="k">if</span> <span class="n">new_ctes</span><span class="p">:</span> +</span><span id="eliminate_subqueries-94"><a href="#eliminate_subqueries-94"><span class="linenos">94</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">new_ctes</span><span class="p">,</span> <span class="n">recursive</span><span class="o">=</span><span class="n">recursive</span><span class="p">))</span> +</span><span id="eliminate_subqueries-95"><a href="#eliminate_subqueries-95"><span class="linenos">95</span></a> +</span><span id="eliminate_subqueries-96"><a href="#eliminate_subqueries-96"><span class="linenos">96</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite derived tables as CTES, deduplicating if possible.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT a FROM (SELECT * FROM x) AS y"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">eliminate_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="this-also-deduplicates-common-subqueries">This also deduplicates common subqueries:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT a FROM (SELECT * FROM x) AS y JOIN (SELECT * FROM x) AS z"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">eliminate_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'WITH y AS (SELECT * FROM x) SELECT a FROM y AS y JOIN y AS z'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/expand_laterals.html b/docs/sqlglot/optimizer/expand_laterals.html new file mode 100644 index 0000000..89944f9 --- /dev/null +++ b/docs/sqlglot/optimizer/expand_laterals.html @@ -0,0 +1,353 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.expand_laterals API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#expand_laterals">expand_laterals</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/expand_laterals.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.expand_laterals </h1> + + + <input id="mod-expand_laterals-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-expand_laterals-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">expand_laterals</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> Expand lateral column alias references.</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> This assumes `qualify_columns` as already run.</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> Example:</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="sd"> >>> sql = "SELECT x.a + 1 AS b, b + 1 AS c FROM x"</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd"> >>> expand_laterals(expression).sql()</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="sd"> 'SELECT x.a + 1 AS b, x.a + 1 + 1 AS c FROM x'</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="sd"> Args:</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a><span class="sd"> expression: expression to optimize</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a><span class="sd"> Returns:</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a><span class="sd"> optimized expression</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a><span class="sd"> """</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">alias_to_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="k">for</span> <span class="n">projection</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">projection</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">alias_to_expression</span><span class="p">:</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">column</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">alias_to_expression</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">projection</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="n">alias_to_expression</span><span class="p">[</span><span class="n">projection</span><span class="o">.</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">projection</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="expand_laterals"> + <input id="expand_laterals-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">expand_laterals</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="expand_laterals-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#expand_laterals"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="expand_laterals-9"><a href="#expand_laterals-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">expand_laterals</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="expand_laterals-10"><a href="#expand_laterals-10"><span class="linenos">10</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="expand_laterals-11"><a href="#expand_laterals-11"><span class="linenos">11</span></a><span class="sd"> Expand lateral column alias references.</span> +</span><span id="expand_laterals-12"><a href="#expand_laterals-12"><span class="linenos">12</span></a> +</span><span id="expand_laterals-13"><a href="#expand_laterals-13"><span class="linenos">13</span></a><span class="sd"> This assumes `qualify_columns` as already run.</span> +</span><span id="expand_laterals-14"><a href="#expand_laterals-14"><span class="linenos">14</span></a> +</span><span id="expand_laterals-15"><a href="#expand_laterals-15"><span class="linenos">15</span></a><span class="sd"> Example:</span> +</span><span id="expand_laterals-16"><a href="#expand_laterals-16"><span class="linenos">16</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="expand_laterals-17"><a href="#expand_laterals-17"><span class="linenos">17</span></a><span class="sd"> >>> sql = "SELECT x.a + 1 AS b, b + 1 AS c FROM x"</span> +</span><span id="expand_laterals-18"><a href="#expand_laterals-18"><span class="linenos">18</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="expand_laterals-19"><a href="#expand_laterals-19"><span class="linenos">19</span></a><span class="sd"> >>> expand_laterals(expression).sql()</span> +</span><span id="expand_laterals-20"><a href="#expand_laterals-20"><span class="linenos">20</span></a><span class="sd"> 'SELECT x.a + 1 AS b, x.a + 1 + 1 AS c FROM x'</span> +</span><span id="expand_laterals-21"><a href="#expand_laterals-21"><span class="linenos">21</span></a> +</span><span id="expand_laterals-22"><a href="#expand_laterals-22"><span class="linenos">22</span></a><span class="sd"> Args:</span> +</span><span id="expand_laterals-23"><a href="#expand_laterals-23"><span class="linenos">23</span></a><span class="sd"> expression: expression to optimize</span> +</span><span id="expand_laterals-24"><a href="#expand_laterals-24"><span class="linenos">24</span></a><span class="sd"> Returns:</span> +</span><span id="expand_laterals-25"><a href="#expand_laterals-25"><span class="linenos">25</span></a><span class="sd"> optimized expression</span> +</span><span id="expand_laterals-26"><a href="#expand_laterals-26"><span class="linenos">26</span></a><span class="sd"> """</span> +</span><span id="expand_laterals-27"><a href="#expand_laterals-27"><span class="linenos">27</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="expand_laterals-28"><a href="#expand_laterals-28"><span class="linenos">28</span></a> <span class="n">alias_to_expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="expand_laterals-29"><a href="#expand_laterals-29"><span class="linenos">29</span></a> <span class="k">for</span> <span class="n">projection</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="expand_laterals-30"><a href="#expand_laterals-30"><span class="linenos">30</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">projection</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="expand_laterals-31"><a href="#expand_laterals-31"><span class="linenos">31</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">alias_to_expression</span><span class="p">:</span> +</span><span id="expand_laterals-32"><a href="#expand_laterals-32"><span class="linenos">32</span></a> <span class="n">column</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">alias_to_expression</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="expand_laterals-33"><a href="#expand_laterals-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">projection</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="expand_laterals-34"><a href="#expand_laterals-34"><span class="linenos">34</span></a> <span class="n">alias_to_expression</span><span class="p">[</span><span class="n">projection</span><span class="o">.</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">projection</span><span class="o">.</span><span class="n">this</span> +</span><span id="expand_laterals-35"><a href="#expand_laterals-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Expand lateral column alias references.</p> + +<p>This assumes <code>qualify_columns</code> as already run.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">sql</span> <span class="o">=</span> <span class="s2">"SELECT x.a + 1 AS b, b + 1 AS c FROM x"</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">expand_laterals</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x.a + 1 AS b, x.a + 1 + 1 AS c FROM x'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> expression to optimize</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>optimized expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/expand_multi_table_selects.html b/docs/sqlglot/optimizer/expand_multi_table_selects.html new file mode 100644 index 0000000..d0751a3 --- /dev/null +++ b/docs/sqlglot/optimizer/expand_multi_table_selects.html @@ -0,0 +1,321 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.expand_multi_table_selects API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#expand_multi_table_selects">expand_multi_table_selects</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/expand_multi_table_selects.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.expand_multi_table_selects </h1> + + + <input id="mod-expand_multi_table_selects-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-expand_multi_table_selects-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="k">def</span> <span class="nf">expand_multi_table_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="sd"> Replace multiple FROM expressions with JOINs.</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd"> Example:</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> >>> expand_multi_table_selects(parse_one("SELECT * FROM x, y")).sql()</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd"> 'SELECT * FROM x CROSS JOIN y'</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> """</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="k">for</span> <span class="n">from_</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="k">for</span> <span class="n">query</span> <span class="ow">in</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="n">parent</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="n">query</span><span class="p">,</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"CROSS"</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="p">)</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">query</span><span class="p">)</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="expand_multi_table_selects"> + <input id="expand_multi_table_selects-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">expand_multi_table_selects</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="expand_multi_table_selects-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#expand_multi_table_selects"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="expand_multi_table_selects-5"><a href="#expand_multi_table_selects-5"><span class="linenos"> 5</span></a><span class="k">def</span> <span class="nf">expand_multi_table_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="expand_multi_table_selects-6"><a href="#expand_multi_table_selects-6"><span class="linenos"> 6</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="expand_multi_table_selects-7"><a href="#expand_multi_table_selects-7"><span class="linenos"> 7</span></a><span class="sd"> Replace multiple FROM expressions with JOINs.</span> +</span><span id="expand_multi_table_selects-8"><a href="#expand_multi_table_selects-8"><span class="linenos"> 8</span></a> +</span><span id="expand_multi_table_selects-9"><a href="#expand_multi_table_selects-9"><span class="linenos"> 9</span></a><span class="sd"> Example:</span> +</span><span id="expand_multi_table_selects-10"><a href="#expand_multi_table_selects-10"><span class="linenos">10</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="expand_multi_table_selects-11"><a href="#expand_multi_table_selects-11"><span class="linenos">11</span></a><span class="sd"> >>> expand_multi_table_selects(parse_one("SELECT * FROM x, y")).sql()</span> +</span><span id="expand_multi_table_selects-12"><a href="#expand_multi_table_selects-12"><span class="linenos">12</span></a><span class="sd"> 'SELECT * FROM x CROSS JOIN y'</span> +</span><span id="expand_multi_table_selects-13"><a href="#expand_multi_table_selects-13"><span class="linenos">13</span></a><span class="sd"> """</span> +</span><span id="expand_multi_table_selects-14"><a href="#expand_multi_table_selects-14"><span class="linenos">14</span></a> <span class="k">for</span> <span class="n">from_</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="expand_multi_table_selects-15"><a href="#expand_multi_table_selects-15"><span class="linenos">15</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">parent</span> +</span><span id="expand_multi_table_selects-16"><a href="#expand_multi_table_selects-16"><span class="linenos">16</span></a> +</span><span id="expand_multi_table_selects-17"><a href="#expand_multi_table_selects-17"><span class="linenos">17</span></a> <span class="k">for</span> <span class="n">query</span> <span class="ow">in</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="expand_multi_table_selects-18"><a href="#expand_multi_table_selects-18"><span class="linenos">18</span></a> <span class="n">parent</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="expand_multi_table_selects-19"><a href="#expand_multi_table_selects-19"><span class="linenos">19</span></a> <span class="n">query</span><span class="p">,</span> +</span><span id="expand_multi_table_selects-20"><a href="#expand_multi_table_selects-20"><span class="linenos">20</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"CROSS"</span><span class="p">,</span> +</span><span id="expand_multi_table_selects-21"><a href="#expand_multi_table_selects-21"><span class="linenos">21</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="expand_multi_table_selects-22"><a href="#expand_multi_table_selects-22"><span class="linenos">22</span></a> <span class="p">)</span> +</span><span id="expand_multi_table_selects-23"><a href="#expand_multi_table_selects-23"><span class="linenos">23</span></a> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">query</span><span class="p">)</span> +</span><span id="expand_multi_table_selects-24"><a href="#expand_multi_table_selects-24"><span class="linenos">24</span></a> +</span><span id="expand_multi_table_selects-25"><a href="#expand_multi_table_selects-25"><span class="linenos">25</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Replace multiple FROM expressions with JOINs.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">expand_multi_table_selects</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT * FROM x, y"</span><span class="p">))</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM x CROSS JOIN y'</span> +</code></pre> + </div> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/isolate_table_selects.html b/docs/sqlglot/optimizer/isolate_table_selects.html new file mode 100644 index 0000000..10413e3 --- /dev/null +++ b/docs/sqlglot/optimizer/isolate_table_selects.html @@ -0,0 +1,317 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.isolate_table_selects API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#isolate_table_selects">isolate_table_selects</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/isolate_table_selects.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.isolate_table_selects </h1> + + + <input id="mod-isolate_table_selects-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-isolate_table_selects-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">alias</span><span class="p">,</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">OptimizeError</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">traverse_scope</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">ensure_schema</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">isolate_table_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="k">continue</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">source</span><span class="p">):</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="k">continue</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="s2">"Tables require an alias. Run qualify_tables optimization."</span><span class="p">)</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="n">source</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="o">.</span><span class="n">from_</span><span class="p">(</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">alias</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="p">)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="p">)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="isolate_table_selects"> + <input id="isolate_table_selects-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">isolate_table_selects</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">schema</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="isolate_table_selects-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#isolate_table_selects"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="isolate_table_selects-8"><a href="#isolate_table_selects-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">isolate_table_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="isolate_table_selects-9"><a href="#isolate_table_selects-9"><span class="linenos"> 9</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="isolate_table_selects-10"><a href="#isolate_table_selects-10"><span class="linenos">10</span></a> +</span><span id="isolate_table_selects-11"><a href="#isolate_table_selects-11"><span class="linenos">11</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="isolate_table_selects-12"><a href="#isolate_table_selects-12"><span class="linenos">12</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="isolate_table_selects-13"><a href="#isolate_table_selects-13"><span class="linenos">13</span></a> <span class="k">continue</span> +</span><span id="isolate_table_selects-14"><a href="#isolate_table_selects-14"><span class="linenos">14</span></a> +</span><span id="isolate_table_selects-15"><a href="#isolate_table_selects-15"><span class="linenos">15</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="isolate_table_selects-16"><a href="#isolate_table_selects-16"><span class="linenos">16</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">source</span><span class="p">):</span> +</span><span id="isolate_table_selects-17"><a href="#isolate_table_selects-17"><span class="linenos">17</span></a> <span class="k">continue</span> +</span><span id="isolate_table_selects-18"><a href="#isolate_table_selects-18"><span class="linenos">18</span></a> +</span><span id="isolate_table_selects-19"><a href="#isolate_table_selects-19"><span class="linenos">19</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="isolate_table_selects-20"><a href="#isolate_table_selects-20"><span class="linenos">20</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="s2">"Tables require an alias. Run qualify_tables optimization."</span><span class="p">)</span> +</span><span id="isolate_table_selects-21"><a href="#isolate_table_selects-21"><span class="linenos">21</span></a> +</span><span id="isolate_table_selects-22"><a href="#isolate_table_selects-22"><span class="linenos">22</span></a> <span class="n">source</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span> +</span><span id="isolate_table_selects-23"><a href="#isolate_table_selects-23"><span class="linenos">23</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span> +</span><span id="isolate_table_selects-24"><a href="#isolate_table_selects-24"><span class="linenos">24</span></a> <span class="o">.</span><span class="n">from_</span><span class="p">(</span> +</span><span id="isolate_table_selects-25"><a href="#isolate_table_selects-25"><span class="linenos">25</span></a> <span class="n">alias</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">source</span><span class="o">.</span><span class="n">name</span> <span class="ow">or</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="isolate_table_selects-26"><a href="#isolate_table_selects-26"><span class="linenos">26</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="isolate_table_selects-27"><a href="#isolate_table_selects-27"><span class="linenos">27</span></a> <span class="p">)</span> +</span><span id="isolate_table_selects-28"><a href="#isolate_table_selects-28"><span class="linenos">28</span></a> <span class="o">.</span><span class="n">subquery</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="isolate_table_selects-29"><a href="#isolate_table_selects-29"><span class="linenos">29</span></a> <span class="p">)</span> +</span><span id="isolate_table_selects-30"><a href="#isolate_table_selects-30"><span class="linenos">30</span></a> +</span><span id="isolate_table_selects-31"><a href="#isolate_table_selects-31"><span class="linenos">31</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/lower_identities.html b/docs/sqlglot/optimizer/lower_identities.html new file mode 100644 index 0000000..cf760a6 --- /dev/null +++ b/docs/sqlglot/optimizer/lower_identities.html @@ -0,0 +1,430 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.lower_identities API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#lower_identities">lower_identities</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/lower_identities.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.lower_identities </h1> + + + <input id="mod-lower_identities-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-lower_identities-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">ensure_collection</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="k">def</span> <span class="nf">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="sd"> Convert all unquoted identifiers to lower case.</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> Assuming the schema is all lower case, this essentially makes identifiers case-insensitive.</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd"> Example:</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd"> >>> expression = sqlglot.parse_one('SELECT Bar.A AS A FROM "Foo".Bar')</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> >>> lower_identities(expression).sql()</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> 'SELECT bar.a AS A FROM "Foo".bar'</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="sd"> Args:</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd"> expression (sqlglot.Expression): expression to quote</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="sd"> Returns:</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="sd"> sqlglot.Expression: quoted expression</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="sd"> """</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="c1"># We need to leave the output aliases unchanged, so the selects need special handling</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="n">_lower_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="c1"># These clauses can reference output aliases and also need special handling</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">_lower_order</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">_lower_having</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="c1"># We've already handled these args, so don't traverse into them</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">traversed</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">}</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="c1"># Root subquery, e.g. (SELECT A AS A FROM X) LIMIT 1</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="n">traversed</span> <span class="o">|=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">}</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="c1"># Union, e.g. SELECT A AS A FROM X UNION SELECT A AS A FROM X</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="n">traversed</span> <span class="o">|=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">}</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> <span class="k">if</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">traversed</span><span class="p">:</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="k">continue</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> <span class="k">for</span> <span class="n">child</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">child</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="n">child</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_lower</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a><span class="k">def</span> <span class="nf">_lower_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="c1"># Leave output aliases as-is</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="n">e</span><span class="o">.</span><span class="n">unalias</span><span class="p">()</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_lower</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a><span class="k">def</span> <span class="nf">_lower_order</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">order</span><span class="p">:</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> <span class="k">return</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> <span class="n">output_aliases</span> <span class="o">=</span> <span class="p">{</span><span class="n">e</span><span class="o">.</span><span class="n">alias</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)}</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="k">for</span> <span class="n">ordered</span> <span class="ow">in</span> <span class="n">order</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="c1"># Don't lower references to output aliases</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ordered</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">ordered</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a> <span class="ow">and</span> <span class="n">ordered</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">output_aliases</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a> <span class="p">):</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a> <span class="n">ordered</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_lower</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos">77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos">78</span></a><span class="k">def</span> <span class="nf">_lower_having</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos">79</span></a> <span class="n">having</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"having"</span><span class="p">)</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos">80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos">81</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">having</span><span class="p">:</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos">82</span></a> <span class="k">return</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos">83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos">84</span></a> <span class="c1"># Don't lower references to output aliases</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos">85</span></a> <span class="k">for</span> <span class="n">agg</span> <span class="ow">in</span> <span class="n">having</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos">86</span></a> <span class="n">agg</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_lower</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos">87</span></a> +</span><span id="L-88"><a href="#L-88"><span class="linenos">88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos">89</span></a><span class="k">def</span> <span class="nf">_lower</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos">90</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">node</span><span class="o">.</span><span class="n">quoted</span><span class="p">:</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos">91</span></a> <span class="n">node</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos">92</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + </section> + <section id="lower_identities"> + <input id="lower_identities-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">lower_identities</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="lower_identities-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#lower_identities"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="lower_identities-6"><a href="#lower_identities-6"><span class="linenos"> 6</span></a><span class="k">def</span> <span class="nf">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="lower_identities-7"><a href="#lower_identities-7"><span class="linenos"> 7</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="lower_identities-8"><a href="#lower_identities-8"><span class="linenos"> 8</span></a><span class="sd"> Convert all unquoted identifiers to lower case.</span> +</span><span id="lower_identities-9"><a href="#lower_identities-9"><span class="linenos"> 9</span></a> +</span><span id="lower_identities-10"><a href="#lower_identities-10"><span class="linenos">10</span></a><span class="sd"> Assuming the schema is all lower case, this essentially makes identifiers case-insensitive.</span> +</span><span id="lower_identities-11"><a href="#lower_identities-11"><span class="linenos">11</span></a> +</span><span id="lower_identities-12"><a href="#lower_identities-12"><span class="linenos">12</span></a><span class="sd"> Example:</span> +</span><span id="lower_identities-13"><a href="#lower_identities-13"><span class="linenos">13</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="lower_identities-14"><a href="#lower_identities-14"><span class="linenos">14</span></a><span class="sd"> >>> expression = sqlglot.parse_one('SELECT Bar.A AS A FROM "Foo".Bar')</span> +</span><span id="lower_identities-15"><a href="#lower_identities-15"><span class="linenos">15</span></a><span class="sd"> >>> lower_identities(expression).sql()</span> +</span><span id="lower_identities-16"><a href="#lower_identities-16"><span class="linenos">16</span></a><span class="sd"> 'SELECT bar.a AS A FROM "Foo".bar'</span> +</span><span id="lower_identities-17"><a href="#lower_identities-17"><span class="linenos">17</span></a> +</span><span id="lower_identities-18"><a href="#lower_identities-18"><span class="linenos">18</span></a><span class="sd"> Args:</span> +</span><span id="lower_identities-19"><a href="#lower_identities-19"><span class="linenos">19</span></a><span class="sd"> expression (sqlglot.Expression): expression to quote</span> +</span><span id="lower_identities-20"><a href="#lower_identities-20"><span class="linenos">20</span></a><span class="sd"> Returns:</span> +</span><span id="lower_identities-21"><a href="#lower_identities-21"><span class="linenos">21</span></a><span class="sd"> sqlglot.Expression: quoted expression</span> +</span><span id="lower_identities-22"><a href="#lower_identities-22"><span class="linenos">22</span></a><span class="sd"> """</span> +</span><span id="lower_identities-23"><a href="#lower_identities-23"><span class="linenos">23</span></a> <span class="c1"># We need to leave the output aliases unchanged, so the selects need special handling</span> +</span><span id="lower_identities-24"><a href="#lower_identities-24"><span class="linenos">24</span></a> <span class="n">_lower_selects</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="lower_identities-25"><a href="#lower_identities-25"><span class="linenos">25</span></a> +</span><span id="lower_identities-26"><a href="#lower_identities-26"><span class="linenos">26</span></a> <span class="c1"># These clauses can reference output aliases and also need special handling</span> +</span><span id="lower_identities-27"><a href="#lower_identities-27"><span class="linenos">27</span></a> <span class="n">_lower_order</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="lower_identities-28"><a href="#lower_identities-28"><span class="linenos">28</span></a> <span class="n">_lower_having</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="lower_identities-29"><a href="#lower_identities-29"><span class="linenos">29</span></a> +</span><span id="lower_identities-30"><a href="#lower_identities-30"><span class="linenos">30</span></a> <span class="c1"># We've already handled these args, so don't traverse into them</span> +</span><span id="lower_identities-31"><a href="#lower_identities-31"><span class="linenos">31</span></a> <span class="n">traversed</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">}</span> +</span><span id="lower_identities-32"><a href="#lower_identities-32"><span class="linenos">32</span></a> +</span><span id="lower_identities-33"><a href="#lower_identities-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="lower_identities-34"><a href="#lower_identities-34"><span class="linenos">34</span></a> <span class="c1"># Root subquery, e.g. (SELECT A AS A FROM X) LIMIT 1</span> +</span><span id="lower_identities-35"><a href="#lower_identities-35"><span class="linenos">35</span></a> <span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="lower_identities-36"><a href="#lower_identities-36"><span class="linenos">36</span></a> <span class="n">traversed</span> <span class="o">|=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">}</span> +</span><span id="lower_identities-37"><a href="#lower_identities-37"><span class="linenos">37</span></a> +</span><span id="lower_identities-38"><a href="#lower_identities-38"><span class="linenos">38</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="lower_identities-39"><a href="#lower_identities-39"><span class="linenos">39</span></a> <span class="c1"># Union, e.g. SELECT A AS A FROM X UNION SELECT A AS A FROM X</span> +</span><span id="lower_identities-40"><a href="#lower_identities-40"><span class="linenos">40</span></a> <span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">)</span> +</span><span id="lower_identities-41"><a href="#lower_identities-41"><span class="linenos">41</span></a> <span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="p">)</span> +</span><span id="lower_identities-42"><a href="#lower_identities-42"><span class="linenos">42</span></a> <span class="n">traversed</span> <span class="o">|=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">,</span> <span class="s2">"expression"</span><span class="p">}</span> +</span><span id="lower_identities-43"><a href="#lower_identities-43"><span class="linenos">43</span></a> +</span><span id="lower_identities-44"><a href="#lower_identities-44"><span class="linenos">44</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="lower_identities-45"><a href="#lower_identities-45"><span class="linenos">45</span></a> <span class="k">if</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">traversed</span><span class="p">:</span> +</span><span id="lower_identities-46"><a href="#lower_identities-46"><span class="linenos">46</span></a> <span class="k">continue</span> +</span><span id="lower_identities-47"><a href="#lower_identities-47"><span class="linenos">47</span></a> +</span><span id="lower_identities-48"><a href="#lower_identities-48"><span class="linenos">48</span></a> <span class="k">for</span> <span class="n">child</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">v</span><span class="p">):</span> +</span><span id="lower_identities-49"><a href="#lower_identities-49"><span class="linenos">49</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">child</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="lower_identities-50"><a href="#lower_identities-50"><span class="linenos">50</span></a> <span class="n">child</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_lower</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="lower_identities-51"><a href="#lower_identities-51"><span class="linenos">51</span></a> +</span><span id="lower_identities-52"><a href="#lower_identities-52"><span class="linenos">52</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Convert all unquoted identifiers to lower case.</p> + +<p>Assuming the schema is all lower case, this essentially makes identifiers case-insensitive.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s1">'SELECT Bar.A AS A FROM "Foo".Bar'</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">lower_identities</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT bar.a AS A FROM "Foo".bar'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to quote</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: quoted expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/merge_subqueries.html b/docs/sqlglot/optimizer/merge_subqueries.html new file mode 100644 index 0000000..9ffb070 --- /dev/null +++ b/docs/sqlglot/optimizer/merge_subqueries.html @@ -0,0 +1,794 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.merge_subqueries API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#merge_subqueries">merge_subqueries</a> + </li> + <li> + <a class="function" href="#merge_ctes">merge_ctes</a> + </li> + <li> + <a class="function" href="#merge_derived_tables">merge_derived_tables</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/merge_subqueries.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.merge_subqueries </h1> + + + <input id="mod-merge_subqueries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-merge_subqueries-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">find_new_name</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">simplify</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">merge_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd"> Rewrite sqlglot AST to merge derived tables into the outer query.</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> This also merges CTEs if they are selected from only once.</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> Example:</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT x.a FROM x) JOIN y")</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> >>> merge_subqueries(expression).sql()</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> 'SELECT x.a FROM x JOIN y'</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> If `leave_tables_isolated` is True, this will not merge inner queries into outer</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> queries if it would result in multiple table selects in a single query:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT x.a FROM x) JOIN y")</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> >>> merge_subqueries(expression, leave_tables_isolated=True).sql()</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> 'SELECT a FROM (SELECT x.a FROM x) JOIN y'</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> Inspired by https://dev.mysql.com/doc/refman/8.0/en/derived-table-optimization.html</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a><span class="sd"> Args:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a><span class="sd"> leave_tables_isolated (bool):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="sd"> Returns:</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="sd"> """</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">merge_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">merge_derived_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="c1"># If a derived table has these Select args, it can't be merged</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="n">UNMERGABLE_ARGS</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="o">.</span><span class="n">arg_types</span><span class="p">)</span> <span class="o">-</span> <span class="p">{</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="s2">"expressions"</span><span class="p">,</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="s2">"from"</span><span class="p">,</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="s2">"joins"</span><span class="p">,</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="s2">"where"</span><span class="p">,</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="s2">"order"</span><span class="p">,</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="s2">"hint"</span><span class="p">,</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="p">}</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="k">def</span> <span class="nf">merge_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">scopes</span> <span class="o">=</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="c1"># All places where we select from CTEs.</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="c1"># We key on the CTE scope so we can detect CTES that are selected from multiple times.</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">cte_selections</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="k">for</span> <span class="n">outer_scope</span> <span class="ow">in</span> <span class="n">scopes</span><span class="p">:</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">for</span> <span class="n">table</span><span class="p">,</span> <span class="n">inner_scope</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">is_cte</span><span class="p">:</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">cte_selections</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">)]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="p">(</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">outer_scope</span><span class="p">,</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">inner_scope</span><span class="p">,</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">table</span><span class="p">,</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">singular_cte_selections</span> <span class="o">=</span> <span class="p">[</span><span class="n">v</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">cte_selections</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">]</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">for</span> <span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">singular_cte_selections</span><span class="p">:</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">from_or_join</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="n">_mergeable</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">_rename_inner_sources</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">_merge_from</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">_merge_expressions</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">_merge_joins</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">_merge_where</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">_merge_order</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">_merge_hints</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">_pop_cte</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="k">def</span> <span class="nf">merge_derived_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">for</span> <span class="n">outer_scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">for</span> <span class="n">subquery</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">:</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">from_or_join</span> <span class="o">=</span> <span class="n">subquery</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">subquery</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">inner_scope</span> <span class="o">=</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">alias</span><span class="p">]</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">_mergeable</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">_rename_inner_sources</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">_merge_from</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">subquery</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">_merge_expressions</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">_merge_joins</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">_merge_where</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">_merge_order</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">_merge_hints</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a><span class="k">def</span> <span class="nf">_mergeable</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a><span class="sd"> Return True if `inner_select` can be merged into outer query.</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="sd"> Args:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a><span class="sd"> outer_scope (Scope)</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="sd"> inner_scope (Scope)</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a><span class="sd"> leave_tables_isolated (bool)</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a><span class="sd"> from_or_join (exp.From|exp.Join)</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a><span class="sd"> Returns:</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a><span class="sd"> bool: True if can be merged</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a><span class="sd"> """</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">inner_select</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">_is_a_window_expression_in_unmergable_operation</span><span class="p">():</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">window_expressions</span> <span class="o">=</span> <span class="n">inner_select</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">)</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">window_alias_names</span> <span class="o">=</span> <span class="p">{</span><span class="n">window</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="k">for</span> <span class="n">window</span> <span class="ow">in</span> <span class="n">window_expressions</span><span class="p">}</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">inner_select_name</span> <span class="o">=</span> <span class="n">inner_select</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">unmergable_window_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">column</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">columns</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="p">)</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="p">]</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">window_expressions_in_unmergable</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">column</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">unmergable_window_columns</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">inner_select_name</span> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">window_alias_names</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="p">]</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span><span class="n">window_expressions_in_unmergable</span><span class="p">)</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">_outer_select_joins_on_inner_select_join</span><span class="p">():</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a><span class="sd"> All columns from the inner select in the ON clause must be from the first FROM table.</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a><span class="sd"> That is, this can be merged:</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a><span class="sd"> SELECT * FROM x JOIN (SELECT y.a AS a FROM y JOIN z) AS q ON x.a = q.a</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a><span class="sd"> ^^^ ^</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="sd"> But this can't:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a><span class="sd"> SELECT * FROM x JOIN (SELECT z.a AS a FROM y JOIN z) AS q ON x.a = q.a</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a><span class="sd"> ^^^ ^</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a><span class="sd"> """</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">from_or_join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">from_or_join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">from_or_join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">on</span><span class="p">:</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">selections</span> <span class="o">=</span> <span class="p">[</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">alias</span><span class="p">]</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">inner_from</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">inner_from</span><span class="p">:</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">inner_from_table</span> <span class="o">=</span> <span class="n">inner_from</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">inner_projections</span> <span class="o">=</span> <span class="p">{</span><span class="n">s</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">s</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">selects</span><span class="p">}</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">return</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">col</span><span class="o">.</span><span class="n">table</span> <span class="o">!=</span> <span class="n">inner_from_table</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">for</span> <span class="n">selection</span> <span class="ow">in</span> <span class="n">selections</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">inner_projections</span><span class="p">[</span><span class="n">selection</span><span class="p">]</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="p">)</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">inner_select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">inner_select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">UNMERGABLE_ARGS</span><span class="p">)</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="ow">and</span> <span class="n">inner_select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">inner_select</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="p">(</span><span class="n">leave_tables_isolated</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">outer_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="p">(</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">from_or_join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="ow">and</span> <span class="n">inner_select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="ow">and</span> <span class="n">from_or_join</span><span class="o">.</span><span class="n">side</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"FULL"</span><span class="p">,</span> <span class="s2">"LEFT"</span><span class="p">,</span> <span class="s2">"RIGHT"</span><span class="p">}</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="p">)</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="p">(</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">from_or_join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="ow">and</span> <span class="n">inner_select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="ow">and</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">j</span><span class="o">.</span><span class="n">side</span> <span class="ow">in</span> <span class="p">{</span><span class="s2">"FULL"</span><span class="p">,</span> <span class="s2">"RIGHT"</span><span class="p">}</span> <span class="k">for</span> <span class="n">j</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="p">)</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="p">)</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">_outer_select_joins_on_inner_select_join</span><span class="p">()</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">_is_a_window_expression_in_unmergable_operation</span><span class="p">()</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="p">)</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a><span class="k">def</span> <span class="nf">_rename_inner_sources</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a><span class="sd"> Renames any sources in the inner query that conflict with names in the outer query.</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a><span class="sd"> Args:</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a><span class="sd"> outer_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a><span class="sd"> alias (str)</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a><span class="sd"> """</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">taken</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">outer_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">)</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="n">conflicts</span> <span class="o">=</span> <span class="n">taken</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">inner_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">))</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">conflicts</span> <span class="o">-=</span> <span class="p">{</span><span class="n">alias</span><span class="p">}</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="k">for</span> <span class="n">conflict</span> <span class="ow">in</span> <span class="n">conflicts</span><span class="p">:</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">new_name</span> <span class="o">=</span> <span class="n">find_new_name</span><span class="p">(</span><span class="n">taken</span><span class="p">,</span> <span class="n">conflict</span><span class="p">)</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="n">source</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">[</span><span class="n">conflict</span><span class="p">]</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="n">new_alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">new_name</span><span class="p">)</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">source</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">new_alias</span><span class="p">))</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="n">source</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">new_alias</span><span class="p">)</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">source</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">new_alias</span><span class="p">))</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">source_columns</span><span class="p">(</span><span class="n">conflict</span><span class="p">):</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">new_name</span><span class="p">))</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">inner_scope</span><span class="o">.</span><span class="n">rename_source</span><span class="p">(</span><span class="n">conflict</span><span class="p">,</span> <span class="n">new_name</span><span class="p">)</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a><span class="k">def</span> <span class="nf">_merge_from</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">node_to_replace</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a><span class="sd"> Merge FROM clause of inner query into outer query.</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a><span class="sd"> Args:</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a><span class="sd"> outer_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a><span class="sd"> node_to_replace (exp.Subquery|exp.Table)</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a><span class="sd"> alias (str)</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a><span class="sd"> """</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">new_subquery</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">node_to_replace</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">new_subquery</span><span class="p">)</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="k">for</span> <span class="n">join_hint</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">join_hints</span><span class="p">:</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">join_hint</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="k">if</span> <span class="n">table</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="o">==</span> <span class="n">node_to_replace</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">new_subquery</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">))</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">remove_source</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">add_source</span><span class="p">(</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">new_subquery</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">new_subquery</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="p">)</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a><span class="k">def</span> <span class="nf">_merge_joins</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a><span class="sd"> Merge JOIN clauses of inner query into outer query.</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a><span class="sd"> Args:</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a><span class="sd"> outer_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a><span class="sd"> from_or_join (exp.From|exp.Join)</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a><span class="sd"> """</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">new_joins</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">comma_joins</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="k">for</span> <span class="n">subquery</span> <span class="ow">in</span> <span class="n">comma_joins</span><span class="p">:</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">new_joins</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">subquery</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="s2">"CROSS"</span><span class="p">))</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">add_source</span><span class="p">(</span><span class="n">subquery</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">subquery</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">])</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">new_joins</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">join</span><span class="p">)</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">add_source</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">join</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">])</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="k">if</span> <span class="n">new_joins</span><span class="p">:</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="n">outer_joins</span> <span class="o">=</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="c1"># Maintain the join order</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">from_or_join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">position</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">position</span> <span class="o">=</span> <span class="n">outer_joins</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">from_or_join</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">outer_joins</span><span class="p">[</span><span class="n">position</span><span class="p">:</span><span class="n">position</span><span class="p">]</span> <span class="o">=</span> <span class="n">new_joins</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="n">outer_joins</span><span class="p">)</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a><span class="k">def</span> <span class="nf">_merge_expressions</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">):</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a><span class="sd"> Merge projections of inner query into outer query.</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a><span class="sd"> Args:</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a><span class="sd"> outer_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a><span class="sd"> alias (str)</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a><span class="sd"> """</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="c1"># Collect all columns that reference the alias of the inner query</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">outer_columns</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">outer_columns</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="c1"># Replace columns with the projection expression in the inner query</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">projection_name</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">projection_name</span><span class="p">:</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="k">continue</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">columns_to_replace</span> <span class="o">=</span> <span class="n">outer_columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">projection_name</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns_to_replace</span><span class="p">:</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="n">column</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unalias</span><span class="p">()</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a><span class="k">def</span> <span class="nf">_merge_where</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a><span class="sd"> Merge WHERE clause of inner query into outer query.</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a><span class="sd"> Args:</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a><span class="sd"> outer_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a><span class="sd"> from_or_join (exp.From|exp.Join)</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a><span class="sd"> """</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">where</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="k">return</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">from_or_join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="c1"># Merge predicates from an outer join to the ON clause</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">from_or_join</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="n">from_or_join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="n">simplify</span><span class="p">(</span><span class="n">from_or_join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)))</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"where"</span><span class="p">,</span> <span class="n">simplify</span><span class="p">(</span><span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)))</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a><span class="k">def</span> <span class="nf">_merge_order</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">):</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a><span class="sd"> Merge ORDER clause of inner query into outer query.</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a><span class="sd"> Args:</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a><span class="sd"> outer_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a><span class="sd"> """</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="nb">any</span><span class="p">(</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">"group"</span><span class="p">,</span> <span class="s2">"distinct"</span><span class="p">,</span> <span class="s2">"having"</span><span class="p">,</span> <span class="s2">"order"</span><span class="p">]</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="p">)</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">outer_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">1</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="ow">or</span> <span class="nb">any</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">)</span> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="p">):</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="k">return</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"order"</span><span class="p">,</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">))</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a><span class="k">def</span> <span class="nf">_merge_hints</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">):</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="n">inner_scope_hint</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"hint"</span><span class="p">)</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">inner_scope_hint</span><span class="p">:</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="k">return</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="n">outer_scope_hint</span> <span class="o">=</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"hint"</span><span class="p">)</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="k">if</span> <span class="n">outer_scope_hint</span><span class="p">:</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="k">for</span> <span class="n">hint_expression</span> <span class="ow">in</span> <span class="n">inner_scope_hint</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="n">outer_scope_hint</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">hint_expression</span><span class="p">)</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"hint"</span><span class="p">,</span> <span class="n">inner_scope_hint</span><span class="p">)</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a><span class="k">def</span> <span class="nf">_pop_cte</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">):</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a><span class="sd"> Remove CTE from the AST.</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a><span class="sd"> Args:</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a><span class="sd"> inner_scope (sqlglot.optimizer.scope.Scope)</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a><span class="sd"> """</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">with_</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">cte</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span></pre></div> + + + </section> + <section id="merge_subqueries"> + <input id="merge_subqueries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">merge_subqueries</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="merge_subqueries-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#merge_subqueries"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="merge_subqueries-10"><a href="#merge_subqueries-10"><span class="linenos">10</span></a><span class="k">def</span> <span class="nf">merge_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="merge_subqueries-11"><a href="#merge_subqueries-11"><span class="linenos">11</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="merge_subqueries-12"><a href="#merge_subqueries-12"><span class="linenos">12</span></a><span class="sd"> Rewrite sqlglot AST to merge derived tables into the outer query.</span> +</span><span id="merge_subqueries-13"><a href="#merge_subqueries-13"><span class="linenos">13</span></a> +</span><span id="merge_subqueries-14"><a href="#merge_subqueries-14"><span class="linenos">14</span></a><span class="sd"> This also merges CTEs if they are selected from only once.</span> +</span><span id="merge_subqueries-15"><a href="#merge_subqueries-15"><span class="linenos">15</span></a> +</span><span id="merge_subqueries-16"><a href="#merge_subqueries-16"><span class="linenos">16</span></a><span class="sd"> Example:</span> +</span><span id="merge_subqueries-17"><a href="#merge_subqueries-17"><span class="linenos">17</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="merge_subqueries-18"><a href="#merge_subqueries-18"><span class="linenos">18</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT x.a FROM x) JOIN y")</span> +</span><span id="merge_subqueries-19"><a href="#merge_subqueries-19"><span class="linenos">19</span></a><span class="sd"> >>> merge_subqueries(expression).sql()</span> +</span><span id="merge_subqueries-20"><a href="#merge_subqueries-20"><span class="linenos">20</span></a><span class="sd"> 'SELECT x.a FROM x JOIN y'</span> +</span><span id="merge_subqueries-21"><a href="#merge_subqueries-21"><span class="linenos">21</span></a> +</span><span id="merge_subqueries-22"><a href="#merge_subqueries-22"><span class="linenos">22</span></a><span class="sd"> If `leave_tables_isolated` is True, this will not merge inner queries into outer</span> +</span><span id="merge_subqueries-23"><a href="#merge_subqueries-23"><span class="linenos">23</span></a><span class="sd"> queries if it would result in multiple table selects in a single query:</span> +</span><span id="merge_subqueries-24"><a href="#merge_subqueries-24"><span class="linenos">24</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT x.a FROM x) JOIN y")</span> +</span><span id="merge_subqueries-25"><a href="#merge_subqueries-25"><span class="linenos">25</span></a><span class="sd"> >>> merge_subqueries(expression, leave_tables_isolated=True).sql()</span> +</span><span id="merge_subqueries-26"><a href="#merge_subqueries-26"><span class="linenos">26</span></a><span class="sd"> 'SELECT a FROM (SELECT x.a FROM x) JOIN y'</span> +</span><span id="merge_subqueries-27"><a href="#merge_subqueries-27"><span class="linenos">27</span></a> +</span><span id="merge_subqueries-28"><a href="#merge_subqueries-28"><span class="linenos">28</span></a><span class="sd"> Inspired by https://dev.mysql.com/doc/refman/8.0/en/derived-table-optimization.html</span> +</span><span id="merge_subqueries-29"><a href="#merge_subqueries-29"><span class="linenos">29</span></a> +</span><span id="merge_subqueries-30"><a href="#merge_subqueries-30"><span class="linenos">30</span></a><span class="sd"> Args:</span> +</span><span id="merge_subqueries-31"><a href="#merge_subqueries-31"><span class="linenos">31</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="merge_subqueries-32"><a href="#merge_subqueries-32"><span class="linenos">32</span></a><span class="sd"> leave_tables_isolated (bool):</span> +</span><span id="merge_subqueries-33"><a href="#merge_subqueries-33"><span class="linenos">33</span></a><span class="sd"> Returns:</span> +</span><span id="merge_subqueries-34"><a href="#merge_subqueries-34"><span class="linenos">34</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="merge_subqueries-35"><a href="#merge_subqueries-35"><span class="linenos">35</span></a><span class="sd"> """</span> +</span><span id="merge_subqueries-36"><a href="#merge_subqueries-36"><span class="linenos">36</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">merge_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">)</span> +</span><span id="merge_subqueries-37"><a href="#merge_subqueries-37"><span class="linenos">37</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">merge_derived_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">)</span> +</span><span id="merge_subqueries-38"><a href="#merge_subqueries-38"><span class="linenos">38</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to merge derived tables into the outer query.</p> + +<p>This also merges CTEs if they are selected from only once.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT a FROM (SELECT x.a FROM x) JOIN y"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">merge_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT x.a FROM x JOIN y'</span> +</code></pre> + </div> +</blockquote> + +<p>If <code>leave_tables_isolated</code> is True, this will not merge inner queries into outer +queries if it would result in multiple table selects in a single query:</p> + +<blockquote> + <blockquote> + <blockquote> + <p>expression = <a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a>("SELECT a FROM (SELECT x.a FROM x) JOIN y") + merge_subqueries(expression, leave_tables_isolated=True).sql() + 'SELECT a FROM (SELECT x.a FROM x) JOIN y'</p> + </blockquote> + </blockquote> +</blockquote> + +<p>Inspired by <a href="https://dev.mysql.com/doc/refman/8.0/en/derived-table-optimization.html">https://dev.mysql.com/doc/refman/8.0/en/derived-table-optimization.html</a></p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li> +<li><strong>leave_tables_isolated (bool):</strong> </li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: optimized expression</p> +</blockquote> +</div> + + + </section> + <section id="merge_ctes"> + <input id="merge_ctes-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">merge_ctes</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="merge_ctes-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#merge_ctes"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="merge_ctes-52"><a href="#merge_ctes-52"><span class="linenos">52</span></a><span class="k">def</span> <span class="nf">merge_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="merge_ctes-53"><a href="#merge_ctes-53"><span class="linenos">53</span></a> <span class="n">scopes</span> <span class="o">=</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="merge_ctes-54"><a href="#merge_ctes-54"><span class="linenos">54</span></a> +</span><span id="merge_ctes-55"><a href="#merge_ctes-55"><span class="linenos">55</span></a> <span class="c1"># All places where we select from CTEs.</span> +</span><span id="merge_ctes-56"><a href="#merge_ctes-56"><span class="linenos">56</span></a> <span class="c1"># We key on the CTE scope so we can detect CTES that are selected from multiple times.</span> +</span><span id="merge_ctes-57"><a href="#merge_ctes-57"><span class="linenos">57</span></a> <span class="n">cte_selections</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">list</span><span class="p">)</span> +</span><span id="merge_ctes-58"><a href="#merge_ctes-58"><span class="linenos">58</span></a> <span class="k">for</span> <span class="n">outer_scope</span> <span class="ow">in</span> <span class="n">scopes</span><span class="p">:</span> +</span><span id="merge_ctes-59"><a href="#merge_ctes-59"><span class="linenos">59</span></a> <span class="k">for</span> <span class="n">table</span><span class="p">,</span> <span class="n">inner_scope</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="merge_ctes-60"><a href="#merge_ctes-60"><span class="linenos">60</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">inner_scope</span><span class="o">.</span><span class="n">is_cte</span><span class="p">:</span> +</span><span id="merge_ctes-61"><a href="#merge_ctes-61"><span class="linenos">61</span></a> <span class="n">cte_selections</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">)]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="merge_ctes-62"><a href="#merge_ctes-62"><span class="linenos">62</span></a> <span class="p">(</span> +</span><span id="merge_ctes-63"><a href="#merge_ctes-63"><span class="linenos">63</span></a> <span class="n">outer_scope</span><span class="p">,</span> +</span><span id="merge_ctes-64"><a href="#merge_ctes-64"><span class="linenos">64</span></a> <span class="n">inner_scope</span><span class="p">,</span> +</span><span id="merge_ctes-65"><a href="#merge_ctes-65"><span class="linenos">65</span></a> <span class="n">table</span><span class="p">,</span> +</span><span id="merge_ctes-66"><a href="#merge_ctes-66"><span class="linenos">66</span></a> <span class="p">)</span> +</span><span id="merge_ctes-67"><a href="#merge_ctes-67"><span class="linenos">67</span></a> <span class="p">)</span> +</span><span id="merge_ctes-68"><a href="#merge_ctes-68"><span class="linenos">68</span></a> +</span><span id="merge_ctes-69"><a href="#merge_ctes-69"><span class="linenos">69</span></a> <span class="n">singular_cte_selections</span> <span class="o">=</span> <span class="p">[</span><span class="n">v</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">cte_selections</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">]</span> +</span><span id="merge_ctes-70"><a href="#merge_ctes-70"><span class="linenos">70</span></a> <span class="k">for</span> <span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">singular_cte_selections</span><span class="p">:</span> +</span><span id="merge_ctes-71"><a href="#merge_ctes-71"><span class="linenos">71</span></a> <span class="n">from_or_join</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> +</span><span id="merge_ctes-72"><a href="#merge_ctes-72"><span class="linenos">72</span></a> <span class="k">if</span> <span class="n">_mergeable</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="merge_ctes-73"><a href="#merge_ctes-73"><span class="linenos">73</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="merge_ctes-74"><a href="#merge_ctes-74"><span class="linenos">74</span></a> <span class="n">_rename_inner_sources</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="merge_ctes-75"><a href="#merge_ctes-75"><span class="linenos">75</span></a> <span class="n">_merge_from</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="merge_ctes-76"><a href="#merge_ctes-76"><span class="linenos">76</span></a> <span class="n">_merge_expressions</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="merge_ctes-77"><a href="#merge_ctes-77"><span class="linenos">77</span></a> <span class="n">_merge_joins</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="merge_ctes-78"><a href="#merge_ctes-78"><span class="linenos">78</span></a> <span class="n">_merge_where</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="merge_ctes-79"><a href="#merge_ctes-79"><span class="linenos">79</span></a> <span class="n">_merge_order</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="merge_ctes-80"><a href="#merge_ctes-80"><span class="linenos">80</span></a> <span class="n">_merge_hints</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="merge_ctes-81"><a href="#merge_ctes-81"><span class="linenos">81</span></a> <span class="n">_pop_cte</span><span class="p">(</span><span class="n">inner_scope</span><span class="p">)</span> +</span><span id="merge_ctes-82"><a href="#merge_ctes-82"><span class="linenos">82</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="merge_ctes-83"><a href="#merge_ctes-83"><span class="linenos">83</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </section> + <section id="merge_derived_tables"> + <input id="merge_derived_tables-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">merge_derived_tables</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="merge_derived_tables-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#merge_derived_tables"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="merge_derived_tables-86"><a href="#merge_derived_tables-86"><span class="linenos"> 86</span></a><span class="k">def</span> <span class="nf">merge_derived_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="merge_derived_tables-87"><a href="#merge_derived_tables-87"><span class="linenos"> 87</span></a> <span class="k">for</span> <span class="n">outer_scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="merge_derived_tables-88"><a href="#merge_derived_tables-88"><span class="linenos"> 88</span></a> <span class="k">for</span> <span class="n">subquery</span> <span class="ow">in</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">:</span> +</span><span id="merge_derived_tables-89"><a href="#merge_derived_tables-89"><span class="linenos"> 89</span></a> <span class="n">from_or_join</span> <span class="o">=</span> <span class="n">subquery</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> +</span><span id="merge_derived_tables-90"><a href="#merge_derived_tables-90"><span class="linenos"> 90</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">subquery</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="merge_derived_tables-91"><a href="#merge_derived_tables-91"><span class="linenos"> 91</span></a> <span class="n">inner_scope</span> <span class="o">=</span> <span class="n">outer_scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">alias</span><span class="p">]</span> +</span><span id="merge_derived_tables-92"><a href="#merge_derived_tables-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="n">_mergeable</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">leave_tables_isolated</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">):</span> +</span><span id="merge_derived_tables-93"><a href="#merge_derived_tables-93"><span class="linenos"> 93</span></a> <span class="n">_rename_inner_sources</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="merge_derived_tables-94"><a href="#merge_derived_tables-94"><span class="linenos"> 94</span></a> <span class="n">_merge_from</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">subquery</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="merge_derived_tables-95"><a href="#merge_derived_tables-95"><span class="linenos"> 95</span></a> <span class="n">_merge_expressions</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="merge_derived_tables-96"><a href="#merge_derived_tables-96"><span class="linenos"> 96</span></a> <span class="n">_merge_joins</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="merge_derived_tables-97"><a href="#merge_derived_tables-97"><span class="linenos"> 97</span></a> <span class="n">_merge_where</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">,</span> <span class="n">from_or_join</span><span class="p">)</span> +</span><span id="merge_derived_tables-98"><a href="#merge_derived_tables-98"><span class="linenos"> 98</span></a> <span class="n">_merge_order</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="merge_derived_tables-99"><a href="#merge_derived_tables-99"><span class="linenos"> 99</span></a> <span class="n">_merge_hints</span><span class="p">(</span><span class="n">outer_scope</span><span class="p">,</span> <span class="n">inner_scope</span><span class="p">)</span> +</span><span id="merge_derived_tables-100"><a href="#merge_derived_tables-100"><span class="linenos">100</span></a> <span class="n">outer_scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="merge_derived_tables-101"><a href="#merge_derived_tables-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/normalize.html b/docs/sqlglot/optimizer/normalize.html new file mode 100644 index 0000000..a93d820 --- /dev/null +++ b/docs/sqlglot/optimizer/normalize.html @@ -0,0 +1,585 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.normalize API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#normalize">normalize</a> + </li> + <li> + <a class="function" href="#normalized">normalized</a> + </li> + <li> + <a class="function" href="#normalization_distance">normalization_distance</a> + </li> + <li> + <a class="function" href="#distributive_law">distributive_law</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/normalize.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.normalize </h1> + + + <input id="mod-normalize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-normalize-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">while_changing</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">flatten</span><span class="p">,</span> <span class="n">simplify</span><span class="p">,</span> <span class="n">uniq_sort</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="k">def</span> <span class="nf">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">max_distance</span><span class="o">=</span><span class="mi">128</span><span class="p">):</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd"> Rewrite sqlglot AST into conjunctive normal form.</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="sd"> Example:</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="sd"> >>> expression = sqlglot.parse_one("(x AND y) OR z")</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> >>> normalize(expression).sql()</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> '(x OR z) AND (y OR z)'</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> Args:</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> expression (sqlglot.Expression): expression to normalize</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> dnf (bool): rewrite in disjunctive normal form instead</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> max_distance (int): the maximal estimated distance from cnf to attempt conversion</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Returns:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> sqlglot.Expression: normalized expression</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> """</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">while_changing</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">distributive_law</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">dnf</span><span class="p">,</span> <span class="n">max_distance</span><span class="p">))</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="k">return</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a><span class="k">def</span> <span class="nf">normalized</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">ancestor</span><span class="p">,</span> <span class="n">root</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="k">if</span> <span class="n">dnf</span> <span class="k">else</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">return</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">connector</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">ancestor</span><span class="p">)</span> <span class="k">for</span> <span class="n">connector</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">root</span><span class="p">))</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="k">def</span> <span class="nf">normalization_distance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="sd"> The difference in the number of predicates between the current expression and the normalized form.</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a><span class="sd"> This is used as an estimate of the cost of the conversion which is exponential in complexity.</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="sd"> Example:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="sd"> >>> expression = sqlglot.parse_one("(a AND b) OR (c AND d)")</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="sd"> >>> normalization_distance(expression)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="sd"> 4</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="sd"> Args:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> expression (sqlglot.Expression): expression to compute distance</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd"> dnf (bool): compute to dnf distance instead</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> Returns:</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="sd"> int: difference</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> """</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">_predicate_lengths</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">))</span> <span class="o">-</span> <span class="p">(</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">)))</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="p">)</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="k">def</span> <span class="nf">_predicate_lengths</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">):</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a><span class="sd"> Returns a list of predicate lengths when expanded to normalized form.</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> (A AND B) OR C -> [2, 2] because len(A OR C), len(B OR C).</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="sd"> """</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">return</span> <span class="p">[</span><span class="mi">1</span><span class="p">]</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">left</span><span class="p">,</span> <span class="n">right</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">if</span> <span class="n">dnf</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">):</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">a</span> <span class="o">+</span> <span class="n">b</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">_predicate_lengths</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">dnf</span><span class="p">)</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">_predicate_lengths</span><span class="p">(</span><span class="n">right</span><span class="p">,</span> <span class="n">dnf</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="p">]</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">return</span> <span class="n">_predicate_lengths</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">dnf</span><span class="p">)</span> <span class="o">+</span> <span class="n">_predicate_lengths</span><span class="p">(</span><span class="n">right</span><span class="p">,</span> <span class="n">dnf</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="k">def</span> <span class="nf">distributive_law</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">,</span> <span class="n">max_distance</span><span class="p">):</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd"> x OR (y AND z) -> (x OR y) AND (x OR z)</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a><span class="sd"> (x AND y) OR (y AND z) -> (x OR y) AND (x OR z) AND (y OR y) AND (y OR z)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="sd"> """</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="n">normalization_distance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">)</span> <span class="o">></span> <span class="n">max_distance</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">to_exp</span><span class="p">,</span> <span class="n">from_exp</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">if</span> <span class="n">dnf</span> <span class="k">else</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">distributive_law</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">dnf</span><span class="p">,</span> <span class="n">max_distance</span><span class="p">))</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">from_exp</span><span class="p">):</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">from_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span> <span class="k">if</span> <span class="n">from_exp</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">to_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span> <span class="k">if</span> <span class="n">to_exp</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">):</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">)))</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">))):</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">):</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="k">def</span> <span class="nf">_distribute</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">):</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">a</span><span class="p">,</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">lambda</span> <span class="n">c</span><span class="p">:</span> <span class="n">to_func</span><span class="p">(</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">paren</span><span class="p">(</span><span class="n">from_func</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">b</span><span class="o">.</span><span class="n">left</span><span class="p">)),</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">paren</span><span class="p">(</span><span class="n">from_func</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">b</span><span class="o">.</span><span class="n">right</span><span class="p">)),</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="p">),</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="p">)</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">a</span> <span class="o">=</span> <span class="n">to_func</span><span class="p">(</span><span class="n">from_func</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">.</span><span class="n">left</span><span class="p">),</span> <span class="n">from_func</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="o">.</span><span class="n">right</span><span class="p">))</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">return</span> <span class="n">_simplify</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a><span class="k">def</span> <span class="nf">_simplify</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">uniq_sort</span><span class="p">(</span><span class="n">flatten</span><span class="p">(</span><span class="n">node</span><span class="p">))</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">_simplify</span><span class="p">)</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + </section> + <section id="normalize"> + <input id="normalize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">normalize</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">dnf</span><span class="o">=</span><span class="kc">False</span>, </span><span class="param"><span class="n">max_distance</span><span class="o">=</span><span class="mi">128</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="normalize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#normalize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="normalize-7"><a href="#normalize-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">max_distance</span><span class="o">=</span><span class="mi">128</span><span class="p">):</span> +</span><span id="normalize-8"><a href="#normalize-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="normalize-9"><a href="#normalize-9"><span class="linenos"> 9</span></a><span class="sd"> Rewrite sqlglot AST into conjunctive normal form.</span> +</span><span id="normalize-10"><a href="#normalize-10"><span class="linenos">10</span></a> +</span><span id="normalize-11"><a href="#normalize-11"><span class="linenos">11</span></a><span class="sd"> Example:</span> +</span><span id="normalize-12"><a href="#normalize-12"><span class="linenos">12</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="normalize-13"><a href="#normalize-13"><span class="linenos">13</span></a><span class="sd"> >>> expression = sqlglot.parse_one("(x AND y) OR z")</span> +</span><span id="normalize-14"><a href="#normalize-14"><span class="linenos">14</span></a><span class="sd"> >>> normalize(expression).sql()</span> +</span><span id="normalize-15"><a href="#normalize-15"><span class="linenos">15</span></a><span class="sd"> '(x OR z) AND (y OR z)'</span> +</span><span id="normalize-16"><a href="#normalize-16"><span class="linenos">16</span></a> +</span><span id="normalize-17"><a href="#normalize-17"><span class="linenos">17</span></a><span class="sd"> Args:</span> +</span><span id="normalize-18"><a href="#normalize-18"><span class="linenos">18</span></a><span class="sd"> expression (sqlglot.Expression): expression to normalize</span> +</span><span id="normalize-19"><a href="#normalize-19"><span class="linenos">19</span></a><span class="sd"> dnf (bool): rewrite in disjunctive normal form instead</span> +</span><span id="normalize-20"><a href="#normalize-20"><span class="linenos">20</span></a><span class="sd"> max_distance (int): the maximal estimated distance from cnf to attempt conversion</span> +</span><span id="normalize-21"><a href="#normalize-21"><span class="linenos">21</span></a><span class="sd"> Returns:</span> +</span><span id="normalize-22"><a href="#normalize-22"><span class="linenos">22</span></a><span class="sd"> sqlglot.Expression: normalized expression</span> +</span><span id="normalize-23"><a href="#normalize-23"><span class="linenos">23</span></a><span class="sd"> """</span> +</span><span id="normalize-24"><a href="#normalize-24"><span class="linenos">24</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="normalize-25"><a href="#normalize-25"><span class="linenos">25</span></a> +</span><span id="normalize-26"><a href="#normalize-26"><span class="linenos">26</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">while_changing</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">distributive_law</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">dnf</span><span class="p">,</span> <span class="n">max_distance</span><span class="p">))</span> +</span><span id="normalize-27"><a href="#normalize-27"><span class="linenos">27</span></a> <span class="k">return</span> <span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST into conjunctive normal form.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"(x AND y) OR z"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'(x OR z) AND (y OR z)'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to normalize</li> +<li><strong>dnf (bool):</strong> rewrite in disjunctive normal form instead</li> +<li><strong>max_distance (int):</strong> the maximal estimated distance from cnf to attempt conversion</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: normalized expression</p> +</blockquote> +</div> + + + </section> + <section id="normalized"> + <input id="normalized-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">normalized</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">dnf</span><span class="o">=</span><span class="kc">False</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="normalized-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#normalized"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="normalized-30"><a href="#normalized-30"><span class="linenos">30</span></a><span class="k">def</span> <span class="nf">normalized</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="normalized-31"><a href="#normalized-31"><span class="linenos">31</span></a> <span class="n">ancestor</span><span class="p">,</span> <span class="n">root</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="k">if</span> <span class="n">dnf</span> <span class="k">else</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> +</span><span id="normalized-32"><a href="#normalized-32"><span class="linenos">32</span></a> +</span><span id="normalized-33"><a href="#normalized-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="n">connector</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">ancestor</span><span class="p">)</span> <span class="k">for</span> <span class="n">connector</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">root</span><span class="p">))</span> +</span></pre></div> + + + + + </section> + <section id="normalization_distance"> + <input id="normalization_distance-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">normalization_distance</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">dnf</span><span class="o">=</span><span class="kc">False</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="normalization_distance-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#normalization_distance"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="normalization_distance-36"><a href="#normalization_distance-36"><span class="linenos">36</span></a><span class="k">def</span> <span class="nf">normalization_distance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="normalization_distance-37"><a href="#normalization_distance-37"><span class="linenos">37</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="normalization_distance-38"><a href="#normalization_distance-38"><span class="linenos">38</span></a><span class="sd"> The difference in the number of predicates between the current expression and the normalized form.</span> +</span><span id="normalization_distance-39"><a href="#normalization_distance-39"><span class="linenos">39</span></a> +</span><span id="normalization_distance-40"><a href="#normalization_distance-40"><span class="linenos">40</span></a><span class="sd"> This is used as an estimate of the cost of the conversion which is exponential in complexity.</span> +</span><span id="normalization_distance-41"><a href="#normalization_distance-41"><span class="linenos">41</span></a> +</span><span id="normalization_distance-42"><a href="#normalization_distance-42"><span class="linenos">42</span></a><span class="sd"> Example:</span> +</span><span id="normalization_distance-43"><a href="#normalization_distance-43"><span class="linenos">43</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="normalization_distance-44"><a href="#normalization_distance-44"><span class="linenos">44</span></a><span class="sd"> >>> expression = sqlglot.parse_one("(a AND b) OR (c AND d)")</span> +</span><span id="normalization_distance-45"><a href="#normalization_distance-45"><span class="linenos">45</span></a><span class="sd"> >>> normalization_distance(expression)</span> +</span><span id="normalization_distance-46"><a href="#normalization_distance-46"><span class="linenos">46</span></a><span class="sd"> 4</span> +</span><span id="normalization_distance-47"><a href="#normalization_distance-47"><span class="linenos">47</span></a> +</span><span id="normalization_distance-48"><a href="#normalization_distance-48"><span class="linenos">48</span></a><span class="sd"> Args:</span> +</span><span id="normalization_distance-49"><a href="#normalization_distance-49"><span class="linenos">49</span></a><span class="sd"> expression (sqlglot.Expression): expression to compute distance</span> +</span><span id="normalization_distance-50"><a href="#normalization_distance-50"><span class="linenos">50</span></a><span class="sd"> dnf (bool): compute to dnf distance instead</span> +</span><span id="normalization_distance-51"><a href="#normalization_distance-51"><span class="linenos">51</span></a><span class="sd"> Returns:</span> +</span><span id="normalization_distance-52"><a href="#normalization_distance-52"><span class="linenos">52</span></a><span class="sd"> int: difference</span> +</span><span id="normalization_distance-53"><a href="#normalization_distance-53"><span class="linenos">53</span></a><span class="sd"> """</span> +</span><span id="normalization_distance-54"><a href="#normalization_distance-54"><span class="linenos">54</span></a> <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">_predicate_lengths</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">))</span> <span class="o">-</span> <span class="p">(</span> +</span><span id="normalization_distance-55"><a href="#normalization_distance-55"><span class="linenos">55</span></a> <span class="nb">len</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">)))</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="normalization_distance-56"><a href="#normalization_distance-56"><span class="linenos">56</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>The difference in the number of predicates between the current expression and the normalized form.</p> + +<p>This is used as an estimate of the cost of the conversion which is exponential in complexity.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"(a AND b) OR (c AND d)"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">normalization_distance</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +<span class="go">4</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to compute distance</li> +<li><strong>dnf (bool):</strong> compute to dnf distance instead</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>int: difference</p> +</blockquote> +</div> + + + </section> + <section id="distributive_law"> + <input id="distributive_law-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">distributive_law</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">dnf</span>, </span><span class="param"><span class="n">max_distance</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="distributive_law-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#distributive_law"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="distributive_law-79"><a href="#distributive_law-79"><span class="linenos"> 79</span></a><span class="k">def</span> <span class="nf">distributive_law</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">,</span> <span class="n">max_distance</span><span class="p">):</span> +</span><span id="distributive_law-80"><a href="#distributive_law-80"><span class="linenos"> 80</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="distributive_law-81"><a href="#distributive_law-81"><span class="linenos"> 81</span></a><span class="sd"> x OR (y AND z) -> (x OR y) AND (x OR z)</span> +</span><span id="distributive_law-82"><a href="#distributive_law-82"><span class="linenos"> 82</span></a><span class="sd"> (x AND y) OR (y AND z) -> (x OR y) AND (x OR z) AND (y OR y) AND (y OR z)</span> +</span><span id="distributive_law-83"><a href="#distributive_law-83"><span class="linenos"> 83</span></a><span class="sd"> """</span> +</span><span id="distributive_law-84"><a href="#distributive_law-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="distributive_law-85"><a href="#distributive_law-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="n">normalization_distance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">dnf</span><span class="p">)</span> <span class="o">></span> <span class="n">max_distance</span><span class="p">:</span> +</span><span id="distributive_law-86"><a href="#distributive_law-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="distributive_law-87"><a href="#distributive_law-87"><span class="linenos"> 87</span></a> +</span><span id="distributive_law-88"><a href="#distributive_law-88"><span class="linenos"> 88</span></a> <span class="n">to_exp</span><span class="p">,</span> <span class="n">from_exp</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">if</span> <span class="n">dnf</span> <span class="k">else</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> +</span><span id="distributive_law-89"><a href="#distributive_law-89"><span class="linenos"> 89</span></a> +</span><span id="distributive_law-90"><a href="#distributive_law-90"><span class="linenos"> 90</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">distributive_law</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">dnf</span><span class="p">,</span> <span class="n">max_distance</span><span class="p">))</span> +</span><span id="distributive_law-91"><a href="#distributive_law-91"><span class="linenos"> 91</span></a> +</span><span id="distributive_law-92"><a href="#distributive_law-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">from_exp</span><span class="p">):</span> +</span><span id="distributive_law-93"><a href="#distributive_law-93"><span class="linenos"> 93</span></a> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="distributive_law-94"><a href="#distributive_law-94"><span class="linenos"> 94</span></a> +</span><span id="distributive_law-95"><a href="#distributive_law-95"><span class="linenos"> 95</span></a> <span class="n">from_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span> <span class="k">if</span> <span class="n">from_exp</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span> +</span><span id="distributive_law-96"><a href="#distributive_law-96"><span class="linenos"> 96</span></a> <span class="n">to_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span> <span class="k">if</span> <span class="n">to_exp</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span> +</span><span id="distributive_law-97"><a href="#distributive_law-97"><span class="linenos"> 97</span></a> +</span><span id="distributive_law-98"><a href="#distributive_law-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">):</span> +</span><span id="distributive_law-99"><a href="#distributive_law-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">)))</span> <span class="o">></span> <span class="nb">len</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">))):</span> +</span><span id="distributive_law-100"><a href="#distributive_law-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="distributive_law-101"><a href="#distributive_law-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="distributive_law-102"><a href="#distributive_law-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">):</span> +</span><span id="distributive_law-103"><a href="#distributive_law-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="distributive_law-104"><a href="#distributive_law-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">to_exp</span><span class="p">):</span> +</span><span id="distributive_law-105"><a href="#distributive_law-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="n">_distribute</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">from_func</span><span class="p">,</span> <span class="n">to_func</span><span class="p">)</span> +</span><span id="distributive_law-106"><a href="#distributive_law-106"><span class="linenos">106</span></a> +</span><span id="distributive_law-107"><a href="#distributive_law-107"><span class="linenos">107</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>x OR (y AND z) -> (x OR y) AND (x OR z) +(x AND y) OR (y AND z) -> (x OR y) AND (x OR z) AND (y OR y) AND (y OR z)</p> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/optimize_joins.html b/docs/sqlglot/optimizer/optimize_joins.html new file mode 100644 index 0000000..66891c7 --- /dev/null +++ b/docs/sqlglot/optimizer/optimize_joins.html @@ -0,0 +1,489 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.optimize_joins API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#optimize_joins">optimize_joins</a> + </li> + <li> + <a class="function" href="#reorder_joins">reorder_joins</a> + </li> + <li> + <a class="function" href="#normalize">normalize</a> + </li> + <li> + <a class="function" href="#other_table_names">other_table_names</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/optimize_joins.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.optimize_joins </h1> + + + <input id="mod-optimize_joins-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-optimize_joins-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">tsort</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">simplify</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="k">def</span> <span class="nf">optimize_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd"> Removes cross joins if possible and reorder joins based on predicate dependencies.</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> Example:</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> >>> optimize_joins(parse_one("SELECT * FROM x CROSS JOIN y JOIN z ON x.a = z.a AND y.a = z.a")).sql()</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd"> 'SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = z.a'</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> """</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="n">references</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="n">cross_joins</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[]):</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">other_table_names</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="k">if</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">references</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">references</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="p">[])</span> <span class="o">+</span> <span class="p">[</span><span class="n">join</span><span class="p">]</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">cross_joins</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">name</span><span class="p">,</span> <span class="n">join</span><span class="p">))</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">cross_joins</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">references</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">[]):</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">dep</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"on"</span><span class="p">]</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">on</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">simplify</span><span class="p">(</span><span class="n">on</span><span class="p">))</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="k">for</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">flatten</span><span class="p">():</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">predicate</span><span class="p">):</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="n">join</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">reorder_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a><span class="k">def</span> <span class="nf">reorder_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a><span class="sd"> Reorder joins by topological sort order based on predicate references.</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a><span class="sd"> """</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="k">for</span> <span class="n">from_</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> <span class="n">head</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="p">{</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">join</span> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">parent</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[])}</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> <span class="n">dag</span> <span class="o">=</span> <span class="p">{</span><span class="n">head</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="p">[]}</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="n">dag</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">other_table_names</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="n">parent</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> <span class="s2">"joins"</span><span class="p">,</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="p">[</span><span class="n">joins</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">tsort</span><span class="p">(</span><span class="n">dag</span><span class="p">)</span> <span class="k">if</span> <span class="n">name</span> <span class="o">!=</span> <span class="n">head</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">],</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> <span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a><span class="k">def</span> <span class="nf">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a><span class="sd"> Remove INNER and OUTER from joins as they are optional.</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a><span class="sd"> """</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">!=</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a><span class="k">def</span> <span class="nf">other_table_names</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">exclude</span><span class="p">):</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos">77</span></a> <span class="n">name</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos">78</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()))</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos">79</span></a> <span class="k">if</span> <span class="n">name</span> <span class="o">!=</span> <span class="n">exclude</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos">80</span></a> <span class="p">]</span> +</span></pre></div> + + + </section> + <section id="optimize_joins"> + <input id="optimize_joins-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">optimize_joins</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="optimize_joins-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#optimize_joins"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="optimize_joins-7"><a href="#optimize_joins-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">optimize_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="optimize_joins-8"><a href="#optimize_joins-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="optimize_joins-9"><a href="#optimize_joins-9"><span class="linenos"> 9</span></a><span class="sd"> Removes cross joins if possible and reorder joins based on predicate dependencies.</span> +</span><span id="optimize_joins-10"><a href="#optimize_joins-10"><span class="linenos">10</span></a> +</span><span id="optimize_joins-11"><a href="#optimize_joins-11"><span class="linenos">11</span></a><span class="sd"> Example:</span> +</span><span id="optimize_joins-12"><a href="#optimize_joins-12"><span class="linenos">12</span></a><span class="sd"> >>> from sqlglot import parse_one</span> +</span><span id="optimize_joins-13"><a href="#optimize_joins-13"><span class="linenos">13</span></a><span class="sd"> >>> optimize_joins(parse_one("SELECT * FROM x CROSS JOIN y JOIN z ON x.a = z.a AND y.a = z.a")).sql()</span> +</span><span id="optimize_joins-14"><a href="#optimize_joins-14"><span class="linenos">14</span></a><span class="sd"> 'SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = z.a'</span> +</span><span id="optimize_joins-15"><a href="#optimize_joins-15"><span class="linenos">15</span></a><span class="sd"> """</span> +</span><span id="optimize_joins-16"><a href="#optimize_joins-16"><span class="linenos">16</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="optimize_joins-17"><a href="#optimize_joins-17"><span class="linenos">17</span></a> <span class="n">references</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="optimize_joins-18"><a href="#optimize_joins-18"><span class="linenos">18</span></a> <span class="n">cross_joins</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="optimize_joins-19"><a href="#optimize_joins-19"><span class="linenos">19</span></a> +</span><span id="optimize_joins-20"><a href="#optimize_joins-20"><span class="linenos">20</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[]):</span> +</span><span id="optimize_joins-21"><a href="#optimize_joins-21"><span class="linenos">21</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="optimize_joins-22"><a href="#optimize_joins-22"><span class="linenos">22</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">other_table_names</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="optimize_joins-23"><a href="#optimize_joins-23"><span class="linenos">23</span></a> +</span><span id="optimize_joins-24"><a href="#optimize_joins-24"><span class="linenos">24</span></a> <span class="k">if</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="optimize_joins-25"><a href="#optimize_joins-25"><span class="linenos">25</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="optimize_joins-26"><a href="#optimize_joins-26"><span class="linenos">26</span></a> <span class="n">references</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">references</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="p">[])</span> <span class="o">+</span> <span class="p">[</span><span class="n">join</span><span class="p">]</span> +</span><span id="optimize_joins-27"><a href="#optimize_joins-27"><span class="linenos">27</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="optimize_joins-28"><a href="#optimize_joins-28"><span class="linenos">28</span></a> <span class="n">cross_joins</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">name</span><span class="p">,</span> <span class="n">join</span><span class="p">))</span> +</span><span id="optimize_joins-29"><a href="#optimize_joins-29"><span class="linenos">29</span></a> +</span><span id="optimize_joins-30"><a href="#optimize_joins-30"><span class="linenos">30</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">cross_joins</span><span class="p">:</span> +</span><span id="optimize_joins-31"><a href="#optimize_joins-31"><span class="linenos">31</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">references</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="p">[]):</span> +</span><span id="optimize_joins-32"><a href="#optimize_joins-32"><span class="linenos">32</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">dep</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"on"</span><span class="p">]</span> +</span><span id="optimize_joins-33"><a href="#optimize_joins-33"><span class="linenos">33</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">on</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">simplify</span><span class="p">(</span><span class="n">on</span><span class="p">))</span> +</span><span id="optimize_joins-34"><a href="#optimize_joins-34"><span class="linenos">34</span></a> +</span><span id="optimize_joins-35"><a href="#optimize_joins-35"><span class="linenos">35</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">on</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="optimize_joins-36"><a href="#optimize_joins-36"><span class="linenos">36</span></a> <span class="k">for</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">on</span><span class="o">.</span><span class="n">flatten</span><span class="p">():</span> +</span><span id="optimize_joins-37"><a href="#optimize_joins-37"><span class="linenos">37</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">predicate</span><span class="p">):</span> +</span><span id="optimize_joins-38"><a href="#optimize_joins-38"><span class="linenos">38</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="optimize_joins-39"><a href="#optimize_joins-39"><span class="linenos">39</span></a> <span class="n">join</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="optimize_joins-40"><a href="#optimize_joins-40"><span class="linenos">40</span></a> +</span><span id="optimize_joins-41"><a href="#optimize_joins-41"><span class="linenos">41</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">reorder_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="optimize_joins-42"><a href="#optimize_joins-42"><span class="linenos">42</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="optimize_joins-43"><a href="#optimize_joins-43"><span class="linenos">43</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Removes cross joins if possible and reorder joins based on predicate dependencies.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">parse_one</span> +<span class="gp">>>> </span><span class="n">optimize_joins</span><span class="p">(</span><span class="n">parse_one</span><span class="p">(</span><span class="s2">"SELECT * FROM x CROSS JOIN y JOIN z ON x.a = z.a AND y.a = z.a"</span><span class="p">))</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = z.a'</span> +</code></pre> + </div> +</blockquote> +</div> + + + </section> + <section id="reorder_joins"> + <input id="reorder_joins-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">reorder_joins</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="reorder_joins-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#reorder_joins"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="reorder_joins-46"><a href="#reorder_joins-46"><span class="linenos">46</span></a><span class="k">def</span> <span class="nf">reorder_joins</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="reorder_joins-47"><a href="#reorder_joins-47"><span class="linenos">47</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="reorder_joins-48"><a href="#reorder_joins-48"><span class="linenos">48</span></a><span class="sd"> Reorder joins by topological sort order based on predicate references.</span> +</span><span id="reorder_joins-49"><a href="#reorder_joins-49"><span class="linenos">49</span></a><span class="sd"> """</span> +</span><span id="reorder_joins-50"><a href="#reorder_joins-50"><span class="linenos">50</span></a> <span class="k">for</span> <span class="n">from_</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">):</span> +</span><span id="reorder_joins-51"><a href="#reorder_joins-51"><span class="linenos">51</span></a> <span class="n">head</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="reorder_joins-52"><a href="#reorder_joins-52"><span class="linenos">52</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">parent</span> +</span><span id="reorder_joins-53"><a href="#reorder_joins-53"><span class="linenos">53</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="p">{</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">join</span> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">parent</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="p">[])}</span> +</span><span id="reorder_joins-54"><a href="#reorder_joins-54"><span class="linenos">54</span></a> <span class="n">dag</span> <span class="o">=</span> <span class="p">{</span><span class="n">head</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="p">[]}</span> +</span><span id="reorder_joins-55"><a href="#reorder_joins-55"><span class="linenos">55</span></a> +</span><span id="reorder_joins-56"><a href="#reorder_joins-56"><span class="linenos">56</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="reorder_joins-57"><a href="#reorder_joins-57"><span class="linenos">57</span></a> <span class="n">dag</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">other_table_names</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="reorder_joins-58"><a href="#reorder_joins-58"><span class="linenos">58</span></a> +</span><span id="reorder_joins-59"><a href="#reorder_joins-59"><span class="linenos">59</span></a> <span class="n">parent</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="reorder_joins-60"><a href="#reorder_joins-60"><span class="linenos">60</span></a> <span class="s2">"joins"</span><span class="p">,</span> +</span><span id="reorder_joins-61"><a href="#reorder_joins-61"><span class="linenos">61</span></a> <span class="p">[</span><span class="n">joins</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">tsort</span><span class="p">(</span><span class="n">dag</span><span class="p">)</span> <span class="k">if</span> <span class="n">name</span> <span class="o">!=</span> <span class="n">head</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">],</span> +</span><span id="reorder_joins-62"><a href="#reorder_joins-62"><span class="linenos">62</span></a> <span class="p">)</span> +</span><span id="reorder_joins-63"><a href="#reorder_joins-63"><span class="linenos">63</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Reorder joins by topological sort order based on predicate references.</p> +</div> + + + </section> + <section id="normalize"> + <input id="normalize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">normalize</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="normalize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#normalize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="normalize-66"><a href="#normalize-66"><span class="linenos">66</span></a><span class="k">def</span> <span class="nf">normalize</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="normalize-67"><a href="#normalize-67"><span class="linenos">67</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="normalize-68"><a href="#normalize-68"><span class="linenos">68</span></a><span class="sd"> Remove INNER and OUTER from joins as they are optional.</span> +</span><span id="normalize-69"><a href="#normalize-69"><span class="linenos">69</span></a><span class="sd"> """</span> +</span><span id="normalize-70"><a href="#normalize-70"><span class="linenos">70</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="normalize-71"><a href="#normalize-71"><span class="linenos">71</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">kind</span> <span class="o">!=</span> <span class="s2">"CROSS"</span><span class="p">:</span> +</span><span id="normalize-72"><a href="#normalize-72"><span class="linenos">72</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="normalize-73"><a href="#normalize-73"><span class="linenos">73</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Remove INNER and OUTER from joins as they are optional.</p> +</div> + + + </section> + <section id="other_table_names"> + <input id="other_table_names-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">other_table_names</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">join</span>, </span><span class="param"><span class="n">exclude</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="other_table_names-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#other_table_names"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="other_table_names-76"><a href="#other_table_names-76"><span class="linenos">76</span></a><span class="k">def</span> <span class="nf">other_table_names</span><span class="p">(</span><span class="n">join</span><span class="p">,</span> <span class="n">exclude</span><span class="p">):</span> +</span><span id="other_table_names-77"><a href="#other_table_names-77"><span class="linenos">77</span></a> <span class="k">return</span> <span class="p">[</span> +</span><span id="other_table_names-78"><a href="#other_table_names-78"><span class="linenos">78</span></a> <span class="n">name</span> +</span><span id="other_table_names-79"><a href="#other_table_names-79"><span class="linenos">79</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()))</span> +</span><span id="other_table_names-80"><a href="#other_table_names-80"><span class="linenos">80</span></a> <span class="k">if</span> <span class="n">name</span> <span class="o">!=</span> <span class="n">exclude</span> +</span><span id="other_table_names-81"><a href="#other_table_names-81"><span class="linenos">81</span></a> <span class="p">]</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/optimizer.html b/docs/sqlglot/optimizer/optimizer.html new file mode 100644 index 0000000..ca82c2f --- /dev/null +++ b/docs/sqlglot/optimizer/optimizer.html @@ -0,0 +1,401 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.optimizer API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#optimize">optimize</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/optimizer.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.optimizer </h1> + + + <input id="mod-optimizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-optimizer-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.annotate_types</span> <span class="kn">import</span> <span class="n">annotate_types</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.canonicalize</span> <span class="kn">import</span> <span class="n">canonicalize</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.eliminate_ctes</span> <span class="kn">import</span> <span class="n">eliminate_ctes</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.eliminate_joins</span> <span class="kn">import</span> <span class="n">eliminate_joins</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.eliminate_subqueries</span> <span class="kn">import</span> <span class="n">eliminate_subqueries</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.expand_laterals</span> <span class="kn">import</span> <span class="n">expand_laterals</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.expand_multi_table_selects</span> <span class="kn">import</span> <span class="n">expand_multi_table_selects</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.isolate_table_selects</span> <span class="kn">import</span> <span class="n">isolate_table_selects</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.lower_identities</span> <span class="kn">import</span> <span class="n">lower_identities</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.merge_subqueries</span> <span class="kn">import</span> <span class="n">merge_subqueries</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.normalize</span> <span class="kn">import</span> <span class="n">normalize</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.optimize_joins</span> <span class="kn">import</span> <span class="n">optimize_joins</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.pushdown_predicates</span> <span class="kn">import</span> <span class="n">pushdown_predicates</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.pushdown_projections</span> <span class="kn">import</span> <span class="n">pushdown_projections</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.qualify_columns</span> <span class="kn">import</span> <span class="n">qualify_columns</span><span class="p">,</span> <span class="n">validate_qualify_columns</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.qualify_tables</span> <span class="kn">import</span> <span class="n">qualify_tables</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.unnest_subqueries</span> <span class="kn">import</span> <span class="n">unnest_subqueries</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">ensure_schema</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="n">RULES</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="n">lower_identities</span><span class="p">,</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="n">qualify_tables</span><span class="p">,</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">isolate_table_selects</span><span class="p">,</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">qualify_columns</span><span class="p">,</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">expand_laterals</span><span class="p">,</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">validate_qualify_columns</span><span class="p">,</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="n">pushdown_projections</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="n">normalize</span><span class="p">,</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">unnest_subqueries</span><span class="p">,</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">expand_multi_table_selects</span><span class="p">,</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">pushdown_predicates</span><span class="p">,</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="n">optimize_joins</span><span class="p">,</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">eliminate_subqueries</span><span class="p">,</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="n">merge_subqueries</span><span class="p">,</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="n">eliminate_joins</span><span class="p">,</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="n">eliminate_ctes</span><span class="p">,</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="n">annotate_types</span><span class="p">,</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="n">canonicalize</span><span class="p">,</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a><span class="k">def</span> <span class="nf">optimize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">rules</span><span class="o">=</span><span class="n">RULES</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a><span class="sd"> Rewrite a sqlglot AST into an optimized form.</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a><span class="sd"> Args:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a><span class="sd"> schema (dict|sqlglot.optimizer.Schema): database schema.</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a><span class="sd"> This can either be an instance of `sqlglot.optimizer.Schema` or a mapping in one of</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a><span class="sd"> the following forms:</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a><span class="sd"> 1. {table: {col: type}}</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a><span class="sd"> 2. {db: {table: {col: type}}}</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a><span class="sd"> 3. {catalog: {db: {table: {col: type}}}}</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a><span class="sd"> If no schema is provided then the default schema defined at `sqlgot.schema` will be used</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a><span class="sd"> db (str): specify the default database, as might be set by a `USE DATABASE db` statement</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a><span class="sd"> catalog (str): specify the default catalog, as might be set by a `USE CATALOG c` statement</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a><span class="sd"> rules (sequence): sequence of optimizer rules to use.</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a><span class="sd"> Many of the rules require tables and columns to be qualified.</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a><span class="sd"> Do not remove qualify_tables or qualify_columns from the sequence of rules unless you know</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a><span class="sd"> what you're doing!</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a><span class="sd"> **kwargs: If a rule has a keyword argument with a same name in **kwargs, it will be passed in.</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a><span class="sd"> Returns:</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a><span class="sd"> """</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span> <span class="ow">or</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> <span class="n">possible_kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"db"</span><span class="p">:</span> <span class="n">db</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">:</span> <span class="n">catalog</span><span class="p">,</span> <span class="s2">"schema"</span><span class="p">:</span> <span class="n">schema</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">}</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="k">for</span> <span class="n">rule</span> <span class="ow">in</span> <span class="n">rules</span><span class="p">:</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> <span class="c1"># Find any additional rule parameters, beyond `expression`</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> <span class="n">rule_params</span> <span class="o">=</span> <span class="n">rule</span><span class="o">.</span><span class="vm">__code__</span><span class="o">.</span><span class="n">co_varnames</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos">72</span></a> <span class="n">rule_kwargs</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos">73</span></a> <span class="n">param</span><span class="p">:</span> <span class="n">possible_kwargs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">rule_params</span> <span class="k">if</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">possible_kwargs</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos">74</span></a> <span class="p">}</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos">75</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">rule</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">rule_kwargs</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos">76</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="optimize"> + <input id="optimize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">optimize</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">db</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">rules</span><span class="o">=</span><span class="p">(</span><span class="o"><</span><span class="n">function</span> <span class="n">lower_identities</span> <span class="n">at</span> <span class="mh">0x7ff75a9b2f80</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">qualify_tables</span> <span class="n">at</span> <span class="mh">0x7ff75a9d9240</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">isolate_table_selects</span> <span class="n">at</span> <span class="mh">0x7ff75a9b2e60</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">qualify_columns</span> <span class="n">at</span> <span class="mh">0x7ff75a9d8820</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">expand_laterals</span> <span class="n">at</span> <span class="mh">0x7ff75a9b2b90</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">validate_qualify_columns</span> <span class="n">at</span> <span class="mh">0x7ff75a9d8c10</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">pushdown_projections</span> <span class="n">at</span> <span class="mh">0x7ff75a9d85e0</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">normalize</span> <span class="n">at</span> <span class="mh">0x7ff75a9b0820</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">unnest_subqueries</span> <span class="n">at</span> <span class="mh">0x7ff75a9d9900</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">expand_multi_table_selects</span> <span class="n">at</span> <span class="mh">0x7ff75a9b2dd0</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">pushdown_predicates</span> <span class="n">at</span> <span class="mh">0x7ff75a9d81f0</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">optimize_joins</span> <span class="n">at</span> <span class="mh">0x7ff75a9b3d00</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">eliminate_subqueries</span> <span class="n">at</span> <span class="mh">0x7ff75a9b2830</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">merge_subqueries</span> <span class="n">at</span> <span class="mh">0x7ff75a9b35b0</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">eliminate_joins</span> <span class="n">at</span> <span class="mh">0x7ff75a9b0700</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">eliminate_ctes</span> <span class="n">at</span> <span class="mh">0x7ff75a9b05e0</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">annotate_types</span> <span class="n">at</span> <span class="mh">0x7ff75a989480</span><span class="o">></span><span class="p">,</span> <span class="o"><</span><span class="n">function</span> <span class="n">canonicalize</span> <span class="n">at</span> <span class="mh">0x7ff75a9b0160</span><span class="o">></span><span class="p">)</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="optimize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#optimize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="optimize-44"><a href="#optimize-44"><span class="linenos">44</span></a><span class="k">def</span> <span class="nf">optimize</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">rules</span><span class="o">=</span><span class="n">RULES</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="optimize-45"><a href="#optimize-45"><span class="linenos">45</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="optimize-46"><a href="#optimize-46"><span class="linenos">46</span></a><span class="sd"> Rewrite a sqlglot AST into an optimized form.</span> +</span><span id="optimize-47"><a href="#optimize-47"><span class="linenos">47</span></a> +</span><span id="optimize-48"><a href="#optimize-48"><span class="linenos">48</span></a><span class="sd"> Args:</span> +</span><span id="optimize-49"><a href="#optimize-49"><span class="linenos">49</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="optimize-50"><a href="#optimize-50"><span class="linenos">50</span></a><span class="sd"> schema (dict|sqlglot.optimizer.Schema): database schema.</span> +</span><span id="optimize-51"><a href="#optimize-51"><span class="linenos">51</span></a><span class="sd"> This can either be an instance of `sqlglot.optimizer.Schema` or a mapping in one of</span> +</span><span id="optimize-52"><a href="#optimize-52"><span class="linenos">52</span></a><span class="sd"> the following forms:</span> +</span><span id="optimize-53"><a href="#optimize-53"><span class="linenos">53</span></a><span class="sd"> 1. {table: {col: type}}</span> +</span><span id="optimize-54"><a href="#optimize-54"><span class="linenos">54</span></a><span class="sd"> 2. {db: {table: {col: type}}}</span> +</span><span id="optimize-55"><a href="#optimize-55"><span class="linenos">55</span></a><span class="sd"> 3. {catalog: {db: {table: {col: type}}}}</span> +</span><span id="optimize-56"><a href="#optimize-56"><span class="linenos">56</span></a><span class="sd"> If no schema is provided then the default schema defined at `sqlgot.schema` will be used</span> +</span><span id="optimize-57"><a href="#optimize-57"><span class="linenos">57</span></a><span class="sd"> db (str): specify the default database, as might be set by a `USE DATABASE db` statement</span> +</span><span id="optimize-58"><a href="#optimize-58"><span class="linenos">58</span></a><span class="sd"> catalog (str): specify the default catalog, as might be set by a `USE CATALOG c` statement</span> +</span><span id="optimize-59"><a href="#optimize-59"><span class="linenos">59</span></a><span class="sd"> rules (sequence): sequence of optimizer rules to use.</span> +</span><span id="optimize-60"><a href="#optimize-60"><span class="linenos">60</span></a><span class="sd"> Many of the rules require tables and columns to be qualified.</span> +</span><span id="optimize-61"><a href="#optimize-61"><span class="linenos">61</span></a><span class="sd"> Do not remove qualify_tables or qualify_columns from the sequence of rules unless you know</span> +</span><span id="optimize-62"><a href="#optimize-62"><span class="linenos">62</span></a><span class="sd"> what you're doing!</span> +</span><span id="optimize-63"><a href="#optimize-63"><span class="linenos">63</span></a><span class="sd"> **kwargs: If a rule has a keyword argument with a same name in **kwargs, it will be passed in.</span> +</span><span id="optimize-64"><a href="#optimize-64"><span class="linenos">64</span></a><span class="sd"> Returns:</span> +</span><span id="optimize-65"><a href="#optimize-65"><span class="linenos">65</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="optimize-66"><a href="#optimize-66"><span class="linenos">66</span></a><span class="sd"> """</span> +</span><span id="optimize-67"><a href="#optimize-67"><span class="linenos">67</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span> <span class="ow">or</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="p">)</span> +</span><span id="optimize-68"><a href="#optimize-68"><span class="linenos">68</span></a> <span class="n">possible_kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"db"</span><span class="p">:</span> <span class="n">db</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">:</span> <span class="n">catalog</span><span class="p">,</span> <span class="s2">"schema"</span><span class="p">:</span> <span class="n">schema</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">}</span> +</span><span id="optimize-69"><a href="#optimize-69"><span class="linenos">69</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="optimize-70"><a href="#optimize-70"><span class="linenos">70</span></a> <span class="k">for</span> <span class="n">rule</span> <span class="ow">in</span> <span class="n">rules</span><span class="p">:</span> +</span><span id="optimize-71"><a href="#optimize-71"><span class="linenos">71</span></a> <span class="c1"># Find any additional rule parameters, beyond `expression`</span> +</span><span id="optimize-72"><a href="#optimize-72"><span class="linenos">72</span></a> <span class="n">rule_params</span> <span class="o">=</span> <span class="n">rule</span><span class="o">.</span><span class="vm">__code__</span><span class="o">.</span><span class="n">co_varnames</span> +</span><span id="optimize-73"><a href="#optimize-73"><span class="linenos">73</span></a> <span class="n">rule_kwargs</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="optimize-74"><a href="#optimize-74"><span class="linenos">74</span></a> <span class="n">param</span><span class="p">:</span> <span class="n">possible_kwargs</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">rule_params</span> <span class="k">if</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">possible_kwargs</span> +</span><span id="optimize-75"><a href="#optimize-75"><span class="linenos">75</span></a> <span class="p">}</span> +</span><span id="optimize-76"><a href="#optimize-76"><span class="linenos">76</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">rule</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="o">**</span><span class="n">rule_kwargs</span><span class="p">)</span> +</span><span id="optimize-77"><a href="#optimize-77"><span class="linenos">77</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite a sqlglot AST into an optimized form.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li> +<li><strong>schema (dict|sqlglot.optimizer.Schema):</strong> database schema. +This can either be an instance of <code>sqlglot.optimizer.Schema</code> or a mapping in one of +the following forms: + 1. {table: {col: type}} + 2. {db: {table: {col: type}}} + 3. {catalog: {db: {table: {col: type}}}} +If no schema is provided then the default schema defined at <code>sqlgot.schema</code> will be used</li> +<li><strong>db (str):</strong> specify the default database, as might be set by a <code>USE DATABASE db</code> statement</li> +<li><strong>catalog (str):</strong> specify the default catalog, as might be set by a <code>USE CATALOG c</code> statement</li> +<li><strong>rules (sequence):</strong> sequence of optimizer rules to use. +Many of the rules require tables and columns to be qualified. +Do not remove qualify_tables or qualify_columns from the sequence of rules unless you know +what you're doing!</li> +<li><strong><em>*kwargs:</strong> If a rule has a keyword argument with a same name in *</em>kwargs, it will be passed in.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: optimized expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/pushdown_predicates.html b/docs/sqlglot/optimizer/pushdown_predicates.html new file mode 100644 index 0000000..e4e1add --- /dev/null +++ b/docs/sqlglot/optimizer/pushdown_predicates.html @@ -0,0 +1,773 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.pushdown_predicates API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#pushdown_predicates">pushdown_predicates</a> + </li> + <li> + <a class="function" href="#pushdown">pushdown</a> + </li> + <li> + <a class="function" href="#pushdown_cnf">pushdown_cnf</a> + </li> + <li> + <a class="function" href="#pushdown_dnf">pushdown_dnf</a> + </li> + <li> + <a class="function" href="#nodes_for_predicate">nodes_for_predicate</a> + </li> + <li> + <a class="function" href="#replace_aliases">replace_aliases</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/pushdown_predicates.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.pushdown_predicates </h1> + + + <input id="mod-pushdown_predicates-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-pushdown_predicates-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.normalize</span> <span class="kn">import</span> <span class="n">normalized</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">build_scope</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.simplify</span> <span class="kn">import</span> <span class="n">simplify</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">pushdown_predicates</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> Rewrite sqlglot AST to pushdown predicates in FROMS and JOINS</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd"> Example:</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="sd"> >>> sql = "SELECT * FROM (SELECT * FROM x AS x) AS y WHERE y.a = 1"</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> >>> pushdown_predicates(expression).sql()</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> 'SELECT * FROM (SELECT * FROM x AS x WHERE y.a = 1) AS y WHERE TRUE'</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> Args:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Returns:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> """</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="n">scope_ref_count</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">ref_count</span><span class="p">()</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">root</span><span class="o">.</span><span class="n">traverse</span><span class="p">())):</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">selected_sources</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="c1"># a right join can only push down to itself and not the source FROM table</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">source</span><span class="p">)</span> <span class="ow">in</span> <span class="n">selected_sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> <span class="ow">and</span> <span class="n">parent</span><span class="o">.</span><span class="n">side</span> <span class="o">==</span> <span class="s2">"RIGHT"</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">selected_sources</span> <span class="o">=</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">source</span><span class="p">)}</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">break</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">pushdown</span><span class="p">(</span><span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">selected_sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="c1"># joins should only pushdown into itself, not to other joins</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="c1"># so we limit the selected sources to only itself</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">pushdown</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">),</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">[</span><span class="n">name</span><span class="p">]},</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="k">def</span> <span class="nf">pushdown</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">return</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="n">condition</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">simplify</span><span class="p">(</span><span class="n">condition</span><span class="p">))</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">cnf_like</span> <span class="o">=</span> <span class="n">normalized</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">normalized</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">predicates</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">condition</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">if</span> <span class="n">cnf_like</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">else</span> <span class="p">[</span><span class="n">condition</span><span class="p">]</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="k">if</span> <span class="n">cnf_like</span><span class="p">:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">pushdown_cnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">pushdown_dnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="k">def</span> <span class="nf">pushdown_cnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="sd"> If the predicates are in CNF like form, we can simply replace each block in the parent.</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a><span class="sd"> """</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="k">for</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">nodes_for_predicate</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">node</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="k">break</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">node</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">replace_aliases</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">predicate</span><span class="p">),</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="k">def</span> <span class="nf">pushdown_dnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="sd"> If the predicates are in DNF form, we can only push down conditions that are in all blocks.</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="sd"> Additionally, we can't remove predicates from their original form.</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a><span class="sd"> """</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="c1"># find all the tables that can be pushdown too</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="c1"># these are tables that are referenced in all blocks of a DNF</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="c1"># (a.x AND b.x) OR (a.y AND c.y)</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="c1"># only table a can be push down</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">pushdown_tables</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">a_tables</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">a</span><span class="p">))</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">a_tables</span> <span class="o">&=</span> <span class="nb">set</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">b</span><span class="p">))</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">pushdown_tables</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">a_tables</span><span class="p">)</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="c1"># for every pushdown table, find all related conditions in all predicates</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="c1"># combine them with ORS</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="c1"># (a.x AND and a.y AND b.x) OR (a.z AND c.y) -> (a.x AND a.y) OR (a.z)</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">pushdown_tables</span><span class="p">):</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">for</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes_for_predicate</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">continue</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="n">predicate_condition</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">)</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">predicate_condition</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="n">predicate_condition</span><span class="p">,</span> <span class="n">condition</span><span class="p">)</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="k">if</span> <span class="n">predicate_condition</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">else</span> <span class="n">condition</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="p">)</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">if</span> <span class="n">predicate_condition</span><span class="p">:</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">conditions</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span><span class="p">(</span><span class="n">conditions</span><span class="p">[</span><span class="n">table</span><span class="p">],</span> <span class="n">predicate_condition</span><span class="p">)</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">conditions</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">else</span> <span class="n">predicate_condition</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="p">)</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">nodes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">conditions</span><span class="p">:</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">continue</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">conditions</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">node</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">node</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">replace_aliases</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">predicate</span><span class="p">),</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a><span class="k">def</span> <span class="nf">nodes_for_predicate</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">predicate</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">where_condition</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">node</span><span class="p">,</span> <span class="n">source</span> <span class="o">=</span> <span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="c1"># if the predicate is in a where statement we can try to push it down</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="c1"># we want to find the root join or from statement</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">and</span> <span class="n">where_condition</span><span class="p">:</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="c1"># a node can reference a CTE which should be pushed down</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">if</span> <span class="n">with_</span> <span class="ow">and</span> <span class="n">with_</span><span class="o">.</span><span class="n">recursive</span><span class="p">:</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">side</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">side</span> <span class="o">!=</span> <span class="s2">"RIGHT"</span><span class="p">:</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">nodes</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">tables</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="c1"># We can't push down window expressions</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">has_window_expression</span> <span class="o">=</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">selects</span> <span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">)</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="p">)</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="c1"># we can't push down predicates to select statements if they are referenced in</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="c1"># multiple places.</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="ow">not</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="ow">and</span> <span class="n">scope_ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o"><</span> <span class="mi">2</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">has_window_expression</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="p">):</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">nodes</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="k">return</span> <span class="n">nodes</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a><span class="k">def</span> <span class="nf">replace_aliases</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">predicate</span><span class="p">):</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">aliases</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">selects</span><span class="p">:</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">aliases</span><span class="p">[</span><span class="n">select</span><span class="o">.</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">aliases</span><span class="p">[</span><span class="n">select</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">select</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="k">def</span> <span class="nf">_replace_alias</span><span class="p">(</span><span class="n">column</span><span class="p">):</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">aliases</span><span class="p">:</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="k">return</span> <span class="n">aliases</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">return</span> <span class="n">column</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="k">return</span> <span class="n">predicate</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_replace_alias</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="pushdown_predicates"> + <input id="pushdown_predicates-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pushdown_predicates</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="pushdown_predicates-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#pushdown_predicates"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="pushdown_predicates-8"><a href="#pushdown_predicates-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">pushdown_predicates</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="pushdown_predicates-9"><a href="#pushdown_predicates-9"><span class="linenos"> 9</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="pushdown_predicates-10"><a href="#pushdown_predicates-10"><span class="linenos">10</span></a><span class="sd"> Rewrite sqlglot AST to pushdown predicates in FROMS and JOINS</span> +</span><span id="pushdown_predicates-11"><a href="#pushdown_predicates-11"><span class="linenos">11</span></a> +</span><span id="pushdown_predicates-12"><a href="#pushdown_predicates-12"><span class="linenos">12</span></a><span class="sd"> Example:</span> +</span><span id="pushdown_predicates-13"><a href="#pushdown_predicates-13"><span class="linenos">13</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="pushdown_predicates-14"><a href="#pushdown_predicates-14"><span class="linenos">14</span></a><span class="sd"> >>> sql = "SELECT * FROM (SELECT * FROM x AS x) AS y WHERE y.a = 1"</span> +</span><span id="pushdown_predicates-15"><a href="#pushdown_predicates-15"><span class="linenos">15</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="pushdown_predicates-16"><a href="#pushdown_predicates-16"><span class="linenos">16</span></a><span class="sd"> >>> pushdown_predicates(expression).sql()</span> +</span><span id="pushdown_predicates-17"><a href="#pushdown_predicates-17"><span class="linenos">17</span></a><span class="sd"> 'SELECT * FROM (SELECT * FROM x AS x WHERE y.a = 1) AS y WHERE TRUE'</span> +</span><span id="pushdown_predicates-18"><a href="#pushdown_predicates-18"><span class="linenos">18</span></a> +</span><span id="pushdown_predicates-19"><a href="#pushdown_predicates-19"><span class="linenos">19</span></a><span class="sd"> Args:</span> +</span><span id="pushdown_predicates-20"><a href="#pushdown_predicates-20"><span class="linenos">20</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="pushdown_predicates-21"><a href="#pushdown_predicates-21"><span class="linenos">21</span></a><span class="sd"> Returns:</span> +</span><span id="pushdown_predicates-22"><a href="#pushdown_predicates-22"><span class="linenos">22</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="pushdown_predicates-23"><a href="#pushdown_predicates-23"><span class="linenos">23</span></a><span class="sd"> """</span> +</span><span id="pushdown_predicates-24"><a href="#pushdown_predicates-24"><span class="linenos">24</span></a> <span class="n">root</span> <span class="o">=</span> <span class="n">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="pushdown_predicates-25"><a href="#pushdown_predicates-25"><span class="linenos">25</span></a> <span class="n">scope_ref_count</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">ref_count</span><span class="p">()</span> +</span><span id="pushdown_predicates-26"><a href="#pushdown_predicates-26"><span class="linenos">26</span></a> +</span><span id="pushdown_predicates-27"><a href="#pushdown_predicates-27"><span class="linenos">27</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">root</span><span class="o">.</span><span class="n">traverse</span><span class="p">())):</span> +</span><span id="pushdown_predicates-28"><a href="#pushdown_predicates-28"><span class="linenos">28</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span> +</span><span id="pushdown_predicates-29"><a href="#pushdown_predicates-29"><span class="linenos">29</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="pushdown_predicates-30"><a href="#pushdown_predicates-30"><span class="linenos">30</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="pushdown_predicates-31"><a href="#pushdown_predicates-31"><span class="linenos">31</span></a> <span class="n">selected_sources</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span> +</span><span id="pushdown_predicates-32"><a href="#pushdown_predicates-32"><span class="linenos">32</span></a> <span class="c1"># a right join can only push down to itself and not the source FROM table</span> +</span><span id="pushdown_predicates-33"><a href="#pushdown_predicates-33"><span class="linenos">33</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">source</span><span class="p">)</span> <span class="ow">in</span> <span class="n">selected_sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="pushdown_predicates-34"><a href="#pushdown_predicates-34"><span class="linenos">34</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> +</span><span id="pushdown_predicates-35"><a href="#pushdown_predicates-35"><span class="linenos">35</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)</span> <span class="ow">and</span> <span class="n">parent</span><span class="o">.</span><span class="n">side</span> <span class="o">==</span> <span class="s2">"RIGHT"</span><span class="p">:</span> +</span><span id="pushdown_predicates-36"><a href="#pushdown_predicates-36"><span class="linenos">36</span></a> <span class="n">selected_sources</span> <span class="o">=</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">source</span><span class="p">)}</span> +</span><span id="pushdown_predicates-37"><a href="#pushdown_predicates-37"><span class="linenos">37</span></a> <span class="k">break</span> +</span><span id="pushdown_predicates-38"><a href="#pushdown_predicates-38"><span class="linenos">38</span></a> <span class="n">pushdown</span><span class="p">(</span><span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">selected_sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="pushdown_predicates-39"><a href="#pushdown_predicates-39"><span class="linenos">39</span></a> +</span><span id="pushdown_predicates-40"><a href="#pushdown_predicates-40"><span class="linenos">40</span></a> <span class="c1"># joins should only pushdown into itself, not to other joins</span> +</span><span id="pushdown_predicates-41"><a href="#pushdown_predicates-41"><span class="linenos">41</span></a> <span class="c1"># so we limit the selected sources to only itself</span> +</span><span id="pushdown_predicates-42"><a href="#pushdown_predicates-42"><span class="linenos">42</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[]:</span> +</span><span id="pushdown_predicates-43"><a href="#pushdown_predicates-43"><span class="linenos">43</span></a> <span class="n">name</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="pushdown_predicates-44"><a href="#pushdown_predicates-44"><span class="linenos">44</span></a> <span class="n">pushdown</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">),</span> <span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">[</span><span class="n">name</span><span class="p">]},</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="pushdown_predicates-45"><a href="#pushdown_predicates-45"><span class="linenos">45</span></a> +</span><span id="pushdown_predicates-46"><a href="#pushdown_predicates-46"><span class="linenos">46</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to pushdown predicates in FROMS and JOINS</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">sql</span> <span class="o">=</span> <span class="s2">"SELECT * FROM (SELECT * FROM x AS x) AS y WHERE y.a = 1"</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">pushdown_predicates</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM (SELECT * FROM x AS x WHERE y.a = 1) AS y WHERE TRUE'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: optimized expression</p> +</blockquote> +</div> + + + </section> + <section id="pushdown"> + <input id="pushdown-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pushdown</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">condition</span>, </span><span class="param"><span class="n">sources</span>, </span><span class="param"><span class="n">scope_ref_count</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="pushdown-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#pushdown"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="pushdown-49"><a href="#pushdown-49"><span class="linenos">49</span></a><span class="k">def</span> <span class="nf">pushdown</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="pushdown-50"><a href="#pushdown-50"><span class="linenos">50</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">condition</span><span class="p">:</span> +</span><span id="pushdown-51"><a href="#pushdown-51"><span class="linenos">51</span></a> <span class="k">return</span> +</span><span id="pushdown-52"><a href="#pushdown-52"><span class="linenos">52</span></a> +</span><span id="pushdown-53"><a href="#pushdown-53"><span class="linenos">53</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="n">condition</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">simplify</span><span class="p">(</span><span class="n">condition</span><span class="p">))</span> +</span><span id="pushdown-54"><a href="#pushdown-54"><span class="linenos">54</span></a> <span class="n">cnf_like</span> <span class="o">=</span> <span class="n">normalized</span><span class="p">(</span><span class="n">condition</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">normalized</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">dnf</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="pushdown-55"><a href="#pushdown-55"><span class="linenos">55</span></a> +</span><span id="pushdown-56"><a href="#pushdown-56"><span class="linenos">56</span></a> <span class="n">predicates</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span> +</span><span id="pushdown-57"><a href="#pushdown-57"><span class="linenos">57</span></a> <span class="n">condition</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span> +</span><span id="pushdown-58"><a href="#pushdown-58"><span class="linenos">58</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">if</span> <span class="n">cnf_like</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> +</span><span id="pushdown-59"><a href="#pushdown-59"><span class="linenos">59</span></a> <span class="k">else</span> <span class="p">[</span><span class="n">condition</span><span class="p">]</span> +</span><span id="pushdown-60"><a href="#pushdown-60"><span class="linenos">60</span></a> <span class="p">)</span> +</span><span id="pushdown-61"><a href="#pushdown-61"><span class="linenos">61</span></a> +</span><span id="pushdown-62"><a href="#pushdown-62"><span class="linenos">62</span></a> <span class="k">if</span> <span class="n">cnf_like</span><span class="p">:</span> +</span><span id="pushdown-63"><a href="#pushdown-63"><span class="linenos">63</span></a> <span class="n">pushdown_cnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="pushdown-64"><a href="#pushdown-64"><span class="linenos">64</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="pushdown-65"><a href="#pushdown-65"><span class="linenos">65</span></a> <span class="n">pushdown_dnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="pushdown_cnf"> + <input id="pushdown_cnf-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pushdown_cnf</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">predicates</span>, </span><span class="param"><span class="n">scope</span>, </span><span class="param"><span class="n">scope_ref_count</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="pushdown_cnf-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#pushdown_cnf"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="pushdown_cnf-68"><a href="#pushdown_cnf-68"><span class="linenos">68</span></a><span class="k">def</span> <span class="nf">pushdown_cnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="pushdown_cnf-69"><a href="#pushdown_cnf-69"><span class="linenos">69</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="pushdown_cnf-70"><a href="#pushdown_cnf-70"><span class="linenos">70</span></a><span class="sd"> If the predicates are in CNF like form, we can simply replace each block in the parent.</span> +</span><span id="pushdown_cnf-71"><a href="#pushdown_cnf-71"><span class="linenos">71</span></a><span class="sd"> """</span> +</span><span id="pushdown_cnf-72"><a href="#pushdown_cnf-72"><span class="linenos">72</span></a> <span class="k">for</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="pushdown_cnf-73"><a href="#pushdown_cnf-73"><span class="linenos">73</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">nodes_for_predicate</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="pushdown_cnf-74"><a href="#pushdown_cnf-74"><span class="linenos">74</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="pushdown_cnf-75"><a href="#pushdown_cnf-75"><span class="linenos">75</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="pushdown_cnf-76"><a href="#pushdown_cnf-76"><span class="linenos">76</span></a> <span class="n">node</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="pushdown_cnf-77"><a href="#pushdown_cnf-77"><span class="linenos">77</span></a> <span class="k">break</span> +</span><span id="pushdown_cnf-78"><a href="#pushdown_cnf-78"><span class="linenos">78</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="pushdown_cnf-79"><a href="#pushdown_cnf-79"><span class="linenos">79</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="pushdown_cnf-80"><a href="#pushdown_cnf-80"><span class="linenos">80</span></a> <span class="n">node</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">replace_aliases</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">predicate</span><span class="p">),</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>If the predicates are in CNF like form, we can simply replace each block in the parent.</p> +</div> + + + </section> + <section id="pushdown_dnf"> + <input id="pushdown_dnf-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pushdown_dnf</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">predicates</span>, </span><span class="param"><span class="n">scope</span>, </span><span class="param"><span class="n">scope_ref_count</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="pushdown_dnf-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#pushdown_dnf"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="pushdown_dnf-83"><a href="#pushdown_dnf-83"><span class="linenos"> 83</span></a><span class="k">def</span> <span class="nf">pushdown_dnf</span><span class="p">(</span><span class="n">predicates</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="pushdown_dnf-84"><a href="#pushdown_dnf-84"><span class="linenos"> 84</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="pushdown_dnf-85"><a href="#pushdown_dnf-85"><span class="linenos"> 85</span></a><span class="sd"> If the predicates are in DNF form, we can only push down conditions that are in all blocks.</span> +</span><span id="pushdown_dnf-86"><a href="#pushdown_dnf-86"><span class="linenos"> 86</span></a><span class="sd"> Additionally, we can't remove predicates from their original form.</span> +</span><span id="pushdown_dnf-87"><a href="#pushdown_dnf-87"><span class="linenos"> 87</span></a><span class="sd"> """</span> +</span><span id="pushdown_dnf-88"><a href="#pushdown_dnf-88"><span class="linenos"> 88</span></a> <span class="c1"># find all the tables that can be pushdown too</span> +</span><span id="pushdown_dnf-89"><a href="#pushdown_dnf-89"><span class="linenos"> 89</span></a> <span class="c1"># these are tables that are referenced in all blocks of a DNF</span> +</span><span id="pushdown_dnf-90"><a href="#pushdown_dnf-90"><span class="linenos"> 90</span></a> <span class="c1"># (a.x AND b.x) OR (a.y AND c.y)</span> +</span><span id="pushdown_dnf-91"><a href="#pushdown_dnf-91"><span class="linenos"> 91</span></a> <span class="c1"># only table a can be push down</span> +</span><span id="pushdown_dnf-92"><a href="#pushdown_dnf-92"><span class="linenos"> 92</span></a> <span class="n">pushdown_tables</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="pushdown_dnf-93"><a href="#pushdown_dnf-93"><span class="linenos"> 93</span></a> +</span><span id="pushdown_dnf-94"><a href="#pushdown_dnf-94"><span class="linenos"> 94</span></a> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="pushdown_dnf-95"><a href="#pushdown_dnf-95"><span class="linenos"> 95</span></a> <span class="n">a_tables</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">a</span><span class="p">))</span> +</span><span id="pushdown_dnf-96"><a href="#pushdown_dnf-96"><span class="linenos"> 96</span></a> +</span><span id="pushdown_dnf-97"><a href="#pushdown_dnf-97"><span class="linenos"> 97</span></a> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="pushdown_dnf-98"><a href="#pushdown_dnf-98"><span class="linenos"> 98</span></a> <span class="n">a_tables</span> <span class="o">&=</span> <span class="nb">set</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">b</span><span class="p">))</span> +</span><span id="pushdown_dnf-99"><a href="#pushdown_dnf-99"><span class="linenos"> 99</span></a> +</span><span id="pushdown_dnf-100"><a href="#pushdown_dnf-100"><span class="linenos">100</span></a> <span class="n">pushdown_tables</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">a_tables</span><span class="p">)</span> +</span><span id="pushdown_dnf-101"><a href="#pushdown_dnf-101"><span class="linenos">101</span></a> +</span><span id="pushdown_dnf-102"><a href="#pushdown_dnf-102"><span class="linenos">102</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="pushdown_dnf-103"><a href="#pushdown_dnf-103"><span class="linenos">103</span></a> +</span><span id="pushdown_dnf-104"><a href="#pushdown_dnf-104"><span class="linenos">104</span></a> <span class="c1"># for every pushdown table, find all related conditions in all predicates</span> +</span><span id="pushdown_dnf-105"><a href="#pushdown_dnf-105"><span class="linenos">105</span></a> <span class="c1"># combine them with ORS</span> +</span><span id="pushdown_dnf-106"><a href="#pushdown_dnf-106"><span class="linenos">106</span></a> <span class="c1"># (a.x AND and a.y AND b.x) OR (a.z AND c.y) -> (a.x AND a.y) OR (a.z)</span> +</span><span id="pushdown_dnf-107"><a href="#pushdown_dnf-107"><span class="linenos">107</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">pushdown_tables</span><span class="p">):</span> +</span><span id="pushdown_dnf-108"><a href="#pushdown_dnf-108"><span class="linenos">108</span></a> <span class="k">for</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">predicates</span><span class="p">:</span> +</span><span id="pushdown_dnf-109"><a href="#pushdown_dnf-109"><span class="linenos">109</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes_for_predicate</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">)</span> +</span><span id="pushdown_dnf-110"><a href="#pushdown_dnf-110"><span class="linenos">110</span></a> +</span><span id="pushdown_dnf-111"><a href="#pushdown_dnf-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">nodes</span><span class="p">:</span> +</span><span id="pushdown_dnf-112"><a href="#pushdown_dnf-112"><span class="linenos">112</span></a> <span class="k">continue</span> +</span><span id="pushdown_dnf-113"><a href="#pushdown_dnf-113"><span class="linenos">113</span></a> +</span><span id="pushdown_dnf-114"><a href="#pushdown_dnf-114"><span class="linenos">114</span></a> <span class="n">predicate_condition</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="pushdown_dnf-115"><a href="#pushdown_dnf-115"><span class="linenos">115</span></a> +</span><span id="pushdown_dnf-116"><a href="#pushdown_dnf-116"><span class="linenos">116</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="pushdown_dnf-117"><a href="#pushdown_dnf-117"><span class="linenos">117</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">table</span><span class="p">:</span> +</span><span id="pushdown_dnf-118"><a href="#pushdown_dnf-118"><span class="linenos">118</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">)</span> +</span><span id="pushdown_dnf-119"><a href="#pushdown_dnf-119"><span class="linenos">119</span></a> <span class="n">predicate_condition</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="pushdown_dnf-120"><a href="#pushdown_dnf-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="n">predicate_condition</span><span class="p">,</span> <span class="n">condition</span><span class="p">)</span> +</span><span id="pushdown_dnf-121"><a href="#pushdown_dnf-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">predicate_condition</span> +</span><span id="pushdown_dnf-122"><a href="#pushdown_dnf-122"><span class="linenos">122</span></a> <span class="k">else</span> <span class="n">condition</span> +</span><span id="pushdown_dnf-123"><a href="#pushdown_dnf-123"><span class="linenos">123</span></a> <span class="p">)</span> +</span><span id="pushdown_dnf-124"><a href="#pushdown_dnf-124"><span class="linenos">124</span></a> +</span><span id="pushdown_dnf-125"><a href="#pushdown_dnf-125"><span class="linenos">125</span></a> <span class="k">if</span> <span class="n">predicate_condition</span><span class="p">:</span> +</span><span id="pushdown_dnf-126"><a href="#pushdown_dnf-126"><span class="linenos">126</span></a> <span class="n">conditions</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="pushdown_dnf-127"><a href="#pushdown_dnf-127"><span class="linenos">127</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span><span class="p">(</span><span class="n">conditions</span><span class="p">[</span><span class="n">table</span><span class="p">],</span> <span class="n">predicate_condition</span><span class="p">)</span> +</span><span id="pushdown_dnf-128"><a href="#pushdown_dnf-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">conditions</span> +</span><span id="pushdown_dnf-129"><a href="#pushdown_dnf-129"><span class="linenos">129</span></a> <span class="k">else</span> <span class="n">predicate_condition</span> +</span><span id="pushdown_dnf-130"><a href="#pushdown_dnf-130"><span class="linenos">130</span></a> <span class="p">)</span> +</span><span id="pushdown_dnf-131"><a href="#pushdown_dnf-131"><span class="linenos">131</span></a> +</span><span id="pushdown_dnf-132"><a href="#pushdown_dnf-132"><span class="linenos">132</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">nodes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="pushdown_dnf-133"><a href="#pushdown_dnf-133"><span class="linenos">133</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">conditions</span><span class="p">:</span> +</span><span id="pushdown_dnf-134"><a href="#pushdown_dnf-134"><span class="linenos">134</span></a> <span class="k">continue</span> +</span><span id="pushdown_dnf-135"><a href="#pushdown_dnf-135"><span class="linenos">135</span></a> +</span><span id="pushdown_dnf-136"><a href="#pushdown_dnf-136"><span class="linenos">136</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">conditions</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="pushdown_dnf-137"><a href="#pushdown_dnf-137"><span class="linenos">137</span></a> +</span><span id="pushdown_dnf-138"><a href="#pushdown_dnf-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="pushdown_dnf-139"><a href="#pushdown_dnf-139"><span class="linenos">139</span></a> <span class="n">node</span><span class="o">.</span><span class="n">on</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="pushdown_dnf-140"><a href="#pushdown_dnf-140"><span class="linenos">140</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="pushdown_dnf-141"><a href="#pushdown_dnf-141"><span class="linenos">141</span></a> <span class="n">node</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">replace_aliases</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">predicate</span><span class="p">),</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>If the predicates are in DNF form, we can only push down conditions that are in all blocks. +Additionally, we can't remove predicates from their original form.</p> +</div> + + + </section> + <section id="nodes_for_predicate"> + <input id="nodes_for_predicate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">nodes_for_predicate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">predicate</span>, </span><span class="param"><span class="n">sources</span>, </span><span class="param"><span class="n">scope_ref_count</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="nodes_for_predicate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#nodes_for_predicate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="nodes_for_predicate-144"><a href="#nodes_for_predicate-144"><span class="linenos">144</span></a><span class="k">def</span> <span class="nf">nodes_for_predicate</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">sources</span><span class="p">,</span> <span class="n">scope_ref_count</span><span class="p">):</span> +</span><span id="nodes_for_predicate-145"><a href="#nodes_for_predicate-145"><span class="linenos">145</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="nodes_for_predicate-146"><a href="#nodes_for_predicate-146"><span class="linenos">146</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column_table_names</span><span class="p">(</span><span class="n">predicate</span><span class="p">)</span> +</span><span id="nodes_for_predicate-147"><a href="#nodes_for_predicate-147"><span class="linenos">147</span></a> <span class="n">where_condition</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> +</span><span id="nodes_for_predicate-148"><a href="#nodes_for_predicate-148"><span class="linenos">148</span></a> +</span><span id="nodes_for_predicate-149"><a href="#nodes_for_predicate-149"><span class="linenos">149</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="nodes_for_predicate-150"><a href="#nodes_for_predicate-150"><span class="linenos">150</span></a> <span class="n">node</span><span class="p">,</span> <span class="n">source</span> <span class="o">=</span> <span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="ow">or</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="nodes_for_predicate-151"><a href="#nodes_for_predicate-151"><span class="linenos">151</span></a> +</span><span id="nodes_for_predicate-152"><a href="#nodes_for_predicate-152"><span class="linenos">152</span></a> <span class="c1"># if the predicate is in a where statement we can try to push it down</span> +</span><span id="nodes_for_predicate-153"><a href="#nodes_for_predicate-153"><span class="linenos">153</span></a> <span class="c1"># we want to find the root join or from statement</span> +</span><span id="nodes_for_predicate-154"><a href="#nodes_for_predicate-154"><span class="linenos">154</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">and</span> <span class="n">where_condition</span><span class="p">:</span> +</span><span id="nodes_for_predicate-155"><a href="#nodes_for_predicate-155"><span class="linenos">155</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> +</span><span id="nodes_for_predicate-156"><a href="#nodes_for_predicate-156"><span class="linenos">156</span></a> +</span><span id="nodes_for_predicate-157"><a href="#nodes_for_predicate-157"><span class="linenos">157</span></a> <span class="c1"># a node can reference a CTE which should be pushed down</span> +</span><span id="nodes_for_predicate-158"><a href="#nodes_for_predicate-158"><span class="linenos">158</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="nodes_for_predicate-159"><a href="#nodes_for_predicate-159"><span class="linenos">159</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="nodes_for_predicate-160"><a href="#nodes_for_predicate-160"><span class="linenos">160</span></a> <span class="k">if</span> <span class="n">with_</span> <span class="ow">and</span> <span class="n">with_</span><span class="o">.</span><span class="n">recursive</span><span class="p">:</span> +</span><span id="nodes_for_predicate-161"><a href="#nodes_for_predicate-161"><span class="linenos">161</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="nodes_for_predicate-162"><a href="#nodes_for_predicate-162"><span class="linenos">162</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span> +</span><span id="nodes_for_predicate-163"><a href="#nodes_for_predicate-163"><span class="linenos">163</span></a> +</span><span id="nodes_for_predicate-164"><a href="#nodes_for_predicate-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="nodes_for_predicate-165"><a href="#nodes_for_predicate-165"><span class="linenos">165</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">side</span> <span class="ow">and</span> <span class="n">node</span><span class="o">.</span><span class="n">side</span> <span class="o">!=</span> <span class="s2">"RIGHT"</span><span class="p">:</span> +</span><span id="nodes_for_predicate-166"><a href="#nodes_for_predicate-166"><span class="linenos">166</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="nodes_for_predicate-167"><a href="#nodes_for_predicate-167"><span class="linenos">167</span></a> <span class="n">nodes</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="nodes_for_predicate-168"><a href="#nodes_for_predicate-168"><span class="linenos">168</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">tables</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="nodes_for_predicate-169"><a href="#nodes_for_predicate-169"><span class="linenos">169</span></a> <span class="c1"># We can't push down window expressions</span> +</span><span id="nodes_for_predicate-170"><a href="#nodes_for_predicate-170"><span class="linenos">170</span></a> <span class="n">has_window_expression</span> <span class="o">=</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="nodes_for_predicate-171"><a href="#nodes_for_predicate-171"><span class="linenos">171</span></a> <span class="n">select</span> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">selects</span> <span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">)</span> +</span><span id="nodes_for_predicate-172"><a href="#nodes_for_predicate-172"><span class="linenos">172</span></a> <span class="p">)</span> +</span><span id="nodes_for_predicate-173"><a href="#nodes_for_predicate-173"><span class="linenos">173</span></a> <span class="c1"># we can't push down predicates to select statements if they are referenced in</span> +</span><span id="nodes_for_predicate-174"><a href="#nodes_for_predicate-174"><span class="linenos">174</span></a> <span class="c1"># multiple places.</span> +</span><span id="nodes_for_predicate-175"><a href="#nodes_for_predicate-175"><span class="linenos">175</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="nodes_for_predicate-176"><a href="#nodes_for_predicate-176"><span class="linenos">176</span></a> <span class="ow">not</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="nodes_for_predicate-177"><a href="#nodes_for_predicate-177"><span class="linenos">177</span></a> <span class="ow">and</span> <span class="n">scope_ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o"><</span> <span class="mi">2</span> +</span><span id="nodes_for_predicate-178"><a href="#nodes_for_predicate-178"><span class="linenos">178</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">has_window_expression</span> +</span><span id="nodes_for_predicate-179"><a href="#nodes_for_predicate-179"><span class="linenos">179</span></a> <span class="p">):</span> +</span><span id="nodes_for_predicate-180"><a href="#nodes_for_predicate-180"><span class="linenos">180</span></a> <span class="n">nodes</span><span class="p">[</span><span class="n">table</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span> +</span><span id="nodes_for_predicate-181"><a href="#nodes_for_predicate-181"><span class="linenos">181</span></a> <span class="k">return</span> <span class="n">nodes</span> +</span></pre></div> + + + + + </section> + <section id="replace_aliases"> + <input id="replace_aliases-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace_aliases</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">source</span>, </span><span class="param"><span class="n">predicate</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="replace_aliases-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#replace_aliases"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="replace_aliases-184"><a href="#replace_aliases-184"><span class="linenos">184</span></a><span class="k">def</span> <span class="nf">replace_aliases</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">predicate</span><span class="p">):</span> +</span><span id="replace_aliases-185"><a href="#replace_aliases-185"><span class="linenos">185</span></a> <span class="n">aliases</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="replace_aliases-186"><a href="#replace_aliases-186"><span class="linenos">186</span></a> +</span><span id="replace_aliases-187"><a href="#replace_aliases-187"><span class="linenos">187</span></a> <span class="k">for</span> <span class="n">select</span> <span class="ow">in</span> <span class="n">source</span><span class="o">.</span><span class="n">selects</span><span class="p">:</span> +</span><span id="replace_aliases-188"><a href="#replace_aliases-188"><span class="linenos">188</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="replace_aliases-189"><a href="#replace_aliases-189"><span class="linenos">189</span></a> <span class="n">aliases</span><span class="p">[</span><span class="n">select</span><span class="o">.</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">this</span> +</span><span id="replace_aliases-190"><a href="#replace_aliases-190"><span class="linenos">190</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="replace_aliases-191"><a href="#replace_aliases-191"><span class="linenos">191</span></a> <span class="n">aliases</span><span class="p">[</span><span class="n">select</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">select</span> +</span><span id="replace_aliases-192"><a href="#replace_aliases-192"><span class="linenos">192</span></a> +</span><span id="replace_aliases-193"><a href="#replace_aliases-193"><span class="linenos">193</span></a> <span class="k">def</span> <span class="nf">_replace_alias</span><span class="p">(</span><span class="n">column</span><span class="p">):</span> +</span><span id="replace_aliases-194"><a href="#replace_aliases-194"><span class="linenos">194</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">aliases</span><span class="p">:</span> +</span><span id="replace_aliases-195"><a href="#replace_aliases-195"><span class="linenos">195</span></a> <span class="k">return</span> <span class="n">aliases</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">]</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="replace_aliases-196"><a href="#replace_aliases-196"><span class="linenos">196</span></a> <span class="k">return</span> <span class="n">column</span> +</span><span id="replace_aliases-197"><a href="#replace_aliases-197"><span class="linenos">197</span></a> +</span><span id="replace_aliases-198"><a href="#replace_aliases-198"><span class="linenos">198</span></a> <span class="k">return</span> <span class="n">predicate</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">_replace_alias</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/pushdown_projections.html b/docs/sqlglot/optimizer/pushdown_projections.html new file mode 100644 index 0000000..385a18a --- /dev/null +++ b/docs/sqlglot/optimizer/pushdown_projections.html @@ -0,0 +1,477 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.pushdown_projections API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#DEFAULT_SELECTION">DEFAULT_SELECTION</a> + </li> + <li> + <a class="function" href="#pushdown_projections">pushdown_projections</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/pushdown_projections.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.pushdown_projections </h1> + + + <input id="mod-pushdown_projections-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-pushdown_projections-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">alias</span><span class="p">,</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="c1"># Sentinel value that means an outer query selecting ALL columns</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="n">SELECT_ALL</span> <span class="o">=</span> <span class="nb">object</span><span class="p">()</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="c1"># Selection to use if selection list is empty</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="n">DEFAULT_SELECTION</span> <span class="o">=</span> <span class="k">lambda</span><span class="p">:</span> <span class="n">alias</span><span class="p">(</span><span class="s2">"1"</span><span class="p">,</span> <span class="s2">"_"</span><span class="p">)</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="k">def</span> <span class="nf">pushdown_projections</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> Rewrite sqlglot AST to remove unused columns projections.</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> Example:</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> >>> sql = "SELECT y.a AS a FROM (SELECT x.a AS a, x.b AS b FROM x) AS y"</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> >>> pushdown_projections(expression).sql()</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> 'SELECT y.a AS a FROM (SELECT x.a AS a FROM x) AS y'</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> Args:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> Returns:</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a><span class="sd"> """</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="c1"># Map of Scope to all columns being selected by outer queries.</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">referenced_columns</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">set</span><span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">left_union</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">right_union</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="c1"># We build the scope tree (which is traversed in DFS postorder), then iterate</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="c1"># over the result in reverse order. This should ensure that the set of selected</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="c1"># columns for a particular scope are completely build by the time we get to it.</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)):</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">parent_selections</span> <span class="o">=</span> <span class="n">referenced_columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="p">{</span><span class="n">SELECT_ALL</span><span class="p">})</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">):</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="c1"># We can't remove columns SELECT DISTINCT nor UNION DISTINCT</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">parent_selections</span> <span class="o">=</span> <span class="p">{</span><span class="n">SELECT_ALL</span><span class="p">}</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">left_union</span><span class="p">,</span> <span class="n">right_union</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">union_scopes</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">referenced_columns</span><span class="p">[</span><span class="n">left_union</span><span class="p">]</span> <span class="o">=</span> <span class="n">parent_selections</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">referenced_columns</span><span class="p">[</span><span class="n">right_union</span><span class="p">]</span> <span class="o">=</span> <span class="n">parent_selections</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">scope</span> <span class="o">!=</span> <span class="n">right_union</span><span class="p">:</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">removed_indexes</span> <span class="o">=</span> <span class="n">_remove_unused_selections</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">parent_selections</span><span class="p">)</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="c1"># The left union is used for column names to select and if we remove columns from the left</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="c1"># we need to also remove those same columns in the right that were at the same position</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">if</span> <span class="n">scope</span> <span class="ow">is</span> <span class="n">left_union</span><span class="p">:</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">_remove_indexed_selections</span><span class="p">(</span><span class="n">right_union</span><span class="p">,</span> <span class="n">removed_indexes</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="c1"># Group columns by source name</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">set</span><span class="p">)</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">table_name</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">col_name</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">table_name</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">col_name</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="c1"># Push the selected columns down to the next scope</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">source</span><span class="p">)</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">selects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">referenced_columns</span><span class="p">[</span><span class="n">source</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a><span class="k">def</span> <span class="nf">_remove_unused_selections</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">parent_selections</span><span class="p">):</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">removed_indexes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">if</span> <span class="n">order</span><span class="p">:</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="c1"># Assume columns without a qualified table are references to output columns</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">order_refs</span> <span class="o">=</span> <span class="p">{</span><span class="n">c</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">order</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span><span class="p">}</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">order_refs</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">new_selections</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">removed</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">selection</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">):</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">SELECT_ALL</span> <span class="ow">in</span> <span class="n">parent_selections</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="ow">or</span> <span class="n">selection</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">parent_selections</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="ow">or</span> <span class="n">selection</span><span class="o">.</span><span class="n">alias_or_name</span> <span class="ow">in</span> <span class="n">order_refs</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="p">):</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">new_selections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">removed_indexes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">removed</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="c1"># If there are no remaining selections, just select a single constant</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">new_selections</span><span class="p">:</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">new_selections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">DEFAULT_SELECTION</span><span class="p">())</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">new_selections</span><span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="n">removed</span><span class="p">:</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="n">removed_indexes</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a><span class="k">def</span> <span class="nf">_remove_indexed_selections</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">indexes_to_remove</span><span class="p">):</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">new_selections</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="n">selection</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">selection</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">)</span> <span class="k">if</span> <span class="n">i</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">indexes_to_remove</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="p">]</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">new_selections</span><span class="p">:</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">new_selections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">DEFAULT_SELECTION</span><span class="p">())</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">new_selections</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="DEFAULT_SELECTION"> + <input id="DEFAULT_SELECTION-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">DEFAULT_SELECTION</span><span class="signature pdoc-code condensed">(<span class="return-annotation">):</span></span> + + <label class="view-source-button" for="DEFAULT_SELECTION-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#DEFAULT_SELECTION"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="DEFAULT_SELECTION-11"><a href="#DEFAULT_SELECTION-11"><span class="linenos">11</span></a><span class="n">DEFAULT_SELECTION</span> <span class="o">=</span> <span class="k">lambda</span><span class="p">:</span> <span class="n">alias</span><span class="p">(</span><span class="s2">"1"</span><span class="p">,</span> <span class="s2">"_"</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="pushdown_projections"> + <input id="pushdown_projections-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">pushdown_projections</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="pushdown_projections-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#pushdown_projections"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="pushdown_projections-14"><a href="#pushdown_projections-14"><span class="linenos">14</span></a><span class="k">def</span> <span class="nf">pushdown_projections</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="pushdown_projections-15"><a href="#pushdown_projections-15"><span class="linenos">15</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="pushdown_projections-16"><a href="#pushdown_projections-16"><span class="linenos">16</span></a><span class="sd"> Rewrite sqlglot AST to remove unused columns projections.</span> +</span><span id="pushdown_projections-17"><a href="#pushdown_projections-17"><span class="linenos">17</span></a> +</span><span id="pushdown_projections-18"><a href="#pushdown_projections-18"><span class="linenos">18</span></a><span class="sd"> Example:</span> +</span><span id="pushdown_projections-19"><a href="#pushdown_projections-19"><span class="linenos">19</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="pushdown_projections-20"><a href="#pushdown_projections-20"><span class="linenos">20</span></a><span class="sd"> >>> sql = "SELECT y.a AS a FROM (SELECT x.a AS a, x.b AS b FROM x) AS y"</span> +</span><span id="pushdown_projections-21"><a href="#pushdown_projections-21"><span class="linenos">21</span></a><span class="sd"> >>> expression = sqlglot.parse_one(sql)</span> +</span><span id="pushdown_projections-22"><a href="#pushdown_projections-22"><span class="linenos">22</span></a><span class="sd"> >>> pushdown_projections(expression).sql()</span> +</span><span id="pushdown_projections-23"><a href="#pushdown_projections-23"><span class="linenos">23</span></a><span class="sd"> 'SELECT y.a AS a FROM (SELECT x.a AS a FROM x) AS y'</span> +</span><span id="pushdown_projections-24"><a href="#pushdown_projections-24"><span class="linenos">24</span></a> +</span><span id="pushdown_projections-25"><a href="#pushdown_projections-25"><span class="linenos">25</span></a><span class="sd"> Args:</span> +</span><span id="pushdown_projections-26"><a href="#pushdown_projections-26"><span class="linenos">26</span></a><span class="sd"> expression (sqlglot.Expression): expression to optimize</span> +</span><span id="pushdown_projections-27"><a href="#pushdown_projections-27"><span class="linenos">27</span></a><span class="sd"> Returns:</span> +</span><span id="pushdown_projections-28"><a href="#pushdown_projections-28"><span class="linenos">28</span></a><span class="sd"> sqlglot.Expression: optimized expression</span> +</span><span id="pushdown_projections-29"><a href="#pushdown_projections-29"><span class="linenos">29</span></a><span class="sd"> """</span> +</span><span id="pushdown_projections-30"><a href="#pushdown_projections-30"><span class="linenos">30</span></a> <span class="c1"># Map of Scope to all columns being selected by outer queries.</span> +</span><span id="pushdown_projections-31"><a href="#pushdown_projections-31"><span class="linenos">31</span></a> <span class="n">referenced_columns</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">set</span><span class="p">)</span> +</span><span id="pushdown_projections-32"><a href="#pushdown_projections-32"><span class="linenos">32</span></a> <span class="n">left_union</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="pushdown_projections-33"><a href="#pushdown_projections-33"><span class="linenos">33</span></a> <span class="n">right_union</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="pushdown_projections-34"><a href="#pushdown_projections-34"><span class="linenos">34</span></a> <span class="c1"># We build the scope tree (which is traversed in DFS postorder), then iterate</span> +</span><span id="pushdown_projections-35"><a href="#pushdown_projections-35"><span class="linenos">35</span></a> <span class="c1"># over the result in reverse order. This should ensure that the set of selected</span> +</span><span id="pushdown_projections-36"><a href="#pushdown_projections-36"><span class="linenos">36</span></a> <span class="c1"># columns for a particular scope are completely build by the time we get to it.</span> +</span><span id="pushdown_projections-37"><a href="#pushdown_projections-37"><span class="linenos">37</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)):</span> +</span><span id="pushdown_projections-38"><a href="#pushdown_projections-38"><span class="linenos">38</span></a> <span class="n">parent_selections</span> <span class="o">=</span> <span class="n">referenced_columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="p">{</span><span class="n">SELECT_ALL</span><span class="p">})</span> +</span><span id="pushdown_projections-39"><a href="#pushdown_projections-39"><span class="linenos">39</span></a> +</span><span id="pushdown_projections-40"><a href="#pushdown_projections-40"><span class="linenos">40</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">):</span> +</span><span id="pushdown_projections-41"><a href="#pushdown_projections-41"><span class="linenos">41</span></a> <span class="c1"># We can't remove columns SELECT DISTINCT nor UNION DISTINCT</span> +</span><span id="pushdown_projections-42"><a href="#pushdown_projections-42"><span class="linenos">42</span></a> <span class="n">parent_selections</span> <span class="o">=</span> <span class="p">{</span><span class="n">SELECT_ALL</span><span class="p">}</span> +</span><span id="pushdown_projections-43"><a href="#pushdown_projections-43"><span class="linenos">43</span></a> +</span><span id="pushdown_projections-44"><a href="#pushdown_projections-44"><span class="linenos">44</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="pushdown_projections-45"><a href="#pushdown_projections-45"><span class="linenos">45</span></a> <span class="n">left_union</span><span class="p">,</span> <span class="n">right_union</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">union_scopes</span> +</span><span id="pushdown_projections-46"><a href="#pushdown_projections-46"><span class="linenos">46</span></a> <span class="n">referenced_columns</span><span class="p">[</span><span class="n">left_union</span><span class="p">]</span> <span class="o">=</span> <span class="n">parent_selections</span> +</span><span id="pushdown_projections-47"><a href="#pushdown_projections-47"><span class="linenos">47</span></a> <span class="n">referenced_columns</span><span class="p">[</span><span class="n">right_union</span><span class="p">]</span> <span class="o">=</span> <span class="n">parent_selections</span> +</span><span id="pushdown_projections-48"><a href="#pushdown_projections-48"><span class="linenos">48</span></a> +</span><span id="pushdown_projections-49"><a href="#pushdown_projections-49"><span class="linenos">49</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">scope</span> <span class="o">!=</span> <span class="n">right_union</span><span class="p">:</span> +</span><span id="pushdown_projections-50"><a href="#pushdown_projections-50"><span class="linenos">50</span></a> <span class="n">removed_indexes</span> <span class="o">=</span> <span class="n">_remove_unused_selections</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">parent_selections</span><span class="p">)</span> +</span><span id="pushdown_projections-51"><a href="#pushdown_projections-51"><span class="linenos">51</span></a> <span class="c1"># The left union is used for column names to select and if we remove columns from the left</span> +</span><span id="pushdown_projections-52"><a href="#pushdown_projections-52"><span class="linenos">52</span></a> <span class="c1"># we need to also remove those same columns in the right that were at the same position</span> +</span><span id="pushdown_projections-53"><a href="#pushdown_projections-53"><span class="linenos">53</span></a> <span class="k">if</span> <span class="n">scope</span> <span class="ow">is</span> <span class="n">left_union</span><span class="p">:</span> +</span><span id="pushdown_projections-54"><a href="#pushdown_projections-54"><span class="linenos">54</span></a> <span class="n">_remove_indexed_selections</span><span class="p">(</span><span class="n">right_union</span><span class="p">,</span> <span class="n">removed_indexes</span><span class="p">)</span> +</span><span id="pushdown_projections-55"><a href="#pushdown_projections-55"><span class="linenos">55</span></a> +</span><span id="pushdown_projections-56"><a href="#pushdown_projections-56"><span class="linenos">56</span></a> <span class="c1"># Group columns by source name</span> +</span><span id="pushdown_projections-57"><a href="#pushdown_projections-57"><span class="linenos">57</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="nb">set</span><span class="p">)</span> +</span><span id="pushdown_projections-58"><a href="#pushdown_projections-58"><span class="linenos">58</span></a> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="pushdown_projections-59"><a href="#pushdown_projections-59"><span class="linenos">59</span></a> <span class="n">table_name</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">table</span> +</span><span id="pushdown_projections-60"><a href="#pushdown_projections-60"><span class="linenos">60</span></a> <span class="n">col_name</span> <span class="o">=</span> <span class="n">col</span><span class="o">.</span><span class="n">name</span> +</span><span id="pushdown_projections-61"><a href="#pushdown_projections-61"><span class="linenos">61</span></a> <span class="n">selects</span><span class="p">[</span><span class="n">table_name</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">col_name</span><span class="p">)</span> +</span><span id="pushdown_projections-62"><a href="#pushdown_projections-62"><span class="linenos">62</span></a> +</span><span id="pushdown_projections-63"><a href="#pushdown_projections-63"><span class="linenos">63</span></a> <span class="c1"># Push the selected columns down to the next scope</span> +</span><span id="pushdown_projections-64"><a href="#pushdown_projections-64"><span class="linenos">64</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">source</span><span class="p">)</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="pushdown_projections-65"><a href="#pushdown_projections-65"><span class="linenos">65</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="pushdown_projections-66"><a href="#pushdown_projections-66"><span class="linenos">66</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">selects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="ow">or</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="pushdown_projections-67"><a href="#pushdown_projections-67"><span class="linenos">67</span></a> <span class="n">referenced_columns</span><span class="p">[</span><span class="n">source</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="pushdown_projections-68"><a href="#pushdown_projections-68"><span class="linenos">68</span></a> +</span><span id="pushdown_projections-69"><a href="#pushdown_projections-69"><span class="linenos">69</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to remove unused columns projections.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">sql</span> <span class="o">=</span> <span class="s2">"SELECT y.a AS a FROM (SELECT x.a AS a, x.b AS b FROM x) AS y"</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">pushdown_projections</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT y.a AS a FROM (SELECT x.a AS a FROM x) AS y'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to optimize</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: optimized expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/qualify_columns.html b/docs/sqlglot/optimizer/qualify_columns.html new file mode 100644 index 0000000..9722c27 --- /dev/null +++ b/docs/sqlglot/optimizer/qualify_columns.html @@ -0,0 +1,804 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.qualify_columns API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#qualify_columns">qualify_columns</a> + </li> + <li> + <a class="function" href="#validate_qualify_columns">validate_qualify_columns</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/qualify_columns.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.qualify_columns </h1> + + + <input id="mod-qualify_columns-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-qualify_columns-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">alias</span><span class="p">,</span> <span class="n">exp</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">OptimizeError</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.schema</span> <span class="kn">import</span> <span class="n">ensure_schema</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="k">def</span> <span class="nf">qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="p">):</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="sd"> Rewrite sqlglot AST to have fully qualified columns.</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> Example:</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> >>> schema = {"tbl": {"col": "INT"}}</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT col FROM tbl")</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> >>> qualify_columns(expression, schema).sql()</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> 'SELECT tbl.col AS col FROM tbl'</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> Args:</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> expression (sqlglot.Expression): expression to qualify</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> schema (dict|sqlglot.optimizer.Schema): Database schema</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> Returns:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> sqlglot.Expression: qualified expression</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> """</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">resolver</span> <span class="o">=</span> <span class="n">_Resolver</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">_pop_table_column_aliases</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">ctes</span><span class="p">)</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">_pop_table_column_aliases</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">)</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">_expand_using</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">_expand_group_by</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">_qualify_columns</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">_expand_order_by</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">_expand_stars</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">_qualify_outputs</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="k">def</span> <span class="nf">validate_qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="w"> </span><span class="sd">"""Raise an `OptimizeError` if any columns aren't qualified"""</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">unqualified_columns</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">unqualified_columns</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">unqualified_columns</span><span class="p">)</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_correlated_subquery</span><span class="p">:</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown table: </span><span class="si">{</span><span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="k">if</span> <span class="n">unqualified_columns</span><span class="p">:</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Ambiguous columns: </span><span class="si">{</span><span class="n">unqualified_columns</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="k">def</span> <span class="nf">_pop_table_column_aliases</span><span class="p">(</span><span class="n">derived_tables</span><span class="p">):</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a><span class="sd"> Remove table column aliases.</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> (e.g. SELECT ... FROM (SELECT ...) AS foo(col1, col2)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="sd"> """</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">for</span> <span class="n">derived_table</span> <span class="ow">in</span> <span class="n">derived_tables</span><span class="p">:</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">derived_table</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">continue</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="k">if</span> <span class="n">table_alias</span><span class="p">:</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">table_alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="k">def</span> <span class="nf">_expand_using</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">):</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">))</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">names</span> <span class="o">=</span> <span class="p">{</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias</span> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="p">}</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">ordered</span> <span class="o">=</span> <span class="p">[</span><span class="n">key</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">names</span><span class="p">]</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="c1"># Mapping of automatically joined column names to source names</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">column_tables</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">using</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">using</span><span class="p">:</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">continue</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">join_table</span> <span class="o">=</span> <span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">:</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">ordered</span><span class="p">:</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_source_columns</span><span class="p">(</span><span class="n">k</span><span class="p">):</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">if</span> <span class="n">column</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">columns</span><span class="p">[</span><span class="n">column</span><span class="p">]</span> <span class="o">=</span> <span class="n">k</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">ordered</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">join_table</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">join_columns</span> <span class="o">=</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_source_columns</span><span class="p">(</span><span class="n">join_table</span><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">conditions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">for</span> <span class="n">identifier</span> <span class="ow">in</span> <span class="n">using</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">identifier</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">identifier</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table</span> <span class="ow">or</span> <span class="n">identifier</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">join_columns</span><span class="p">:</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Cannot automatically join: </span><span class="si">{</span><span class="n">identifier</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">conditions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">condition</span><span class="p">(</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">(</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">identifier</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">table</span><span class="p">),</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">identifier</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">join_table</span><span class="p">),</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="p">)</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="p">)</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">column_tables</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">identifier</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">if</span> <span class="n">join_table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">join_table</span><span class="p">)</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"using"</span><span class="p">)</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="o">*</span><span class="n">conditions</span><span class="p">))</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">if</span> <span class="n">column_tables</span><span class="p">:</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">column_tables</span><span class="p">:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="n">column_tables</span><span class="p">[</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">coalesce</span> <span class="o">=</span> <span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">table</span><span class="p">)</span> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">]</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">replacement</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">coalesce</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">expressions</span><span class="o">=</span><span class="n">coalesce</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="c1"># Ensure selects keep their output name</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">replacement</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">replacement</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">replacement</span><span class="p">)</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a><span class="k">def</span> <span class="nf">_expand_group_by</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">):</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">group</span><span class="p">:</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="k">return</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="c1"># Replace references to select aliases</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="k">def</span> <span class="nf">transform</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span><span class="p">):</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">node</span><span class="o">.</span><span class="n">table</span><span class="p">:</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_table</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="c1"># Source columns get priority over select aliases</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">if</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">node</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">table</span><span class="p">))</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">selects</span> <span class="o">=</span> <span class="p">{</span><span class="n">s</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">s</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">}</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">selects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">if</span> <span class="n">select</span><span class="p">:</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="k">return</span> <span class="n">select</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">group</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">transform</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">group</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">_expand_positional_references</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">group</span><span class="o">.</span><span class="n">expressions</span><span class="p">))</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"group"</span><span class="p">,</span> <span class="n">group</span><span class="p">)</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a><span class="k">def</span> <span class="nf">_expand_order_by</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">order</span><span class="p">:</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">return</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">ordereds</span> <span class="o">=</span> <span class="n">order</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="k">for</span> <span class="n">ordered</span><span class="p">,</span> <span class="n">new_expression</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">ordereds</span><span class="p">,</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">_expand_positional_references</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="p">(</span><span class="n">o</span><span class="o">.</span><span class="n">this</span> <span class="k">for</span> <span class="n">o</span> <span class="ow">in</span> <span class="n">ordereds</span><span class="p">)),</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="p">):</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">ordered</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">new_expression</span><span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a><span class="k">def</span> <span class="nf">_expand_positional_references</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">expressions</span><span class="p">):</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">new_nodes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">is_int</span><span class="p">:</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="k">except</span> <span class="ne">IndexError</span><span class="p">:</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown output column: </span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="n">new_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">new_nodes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="k">return</span> <span class="n">new_nodes</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a><span class="k">def</span> <span class="nf">_qualify_columns</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">):</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a><span class="w"> </span><span class="sd">"""Disambiguate columns, ensuring each column specifies a source"""</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">columns</span><span class="p">:</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">column_table</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="n">column_name</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="k">if</span> <span class="n">column_table</span> <span class="ow">and</span> <span class="n">column_table</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">:</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="n">source_columns</span> <span class="o">=</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_source_columns</span><span class="p">(</span><span class="n">column_table</span><span class="p">)</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="n">source_columns</span> <span class="ow">and</span> <span class="n">column_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">source_columns</span><span class="p">:</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown column: </span><span class="si">{</span><span class="n">column_name</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">column_table</span><span class="p">:</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="n">column_table</span> <span class="o">=</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_table</span><span class="p">(</span><span class="n">column_name</span><span class="p">)</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="c1"># column_table can be a '' because bigquery unnest has no table alias</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="k">if</span> <span class="n">column_table</span><span class="p">:</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">column_table</span><span class="p">))</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">columns_missing_from_scope</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="c1"># Determine whether each reference in the order by clause is to a column or an alias.</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="k">for</span> <span class="n">ordered</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">):</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">ordered</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="ow">not</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">ordered</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">resolver</span><span class="o">.</span><span class="n">all_columns</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="p">):</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">columns_missing_from_scope</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="c1"># Determine whether each reference in the having clause is to a column or an alias.</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="k">for</span> <span class="n">having</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">):</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">having</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="ow">not</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">)</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="ow">and</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">resolver</span><span class="o">.</span><span class="n">all_columns</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="p">):</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">columns_missing_from_scope</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns_missing_from_scope</span><span class="p">:</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">column_table</span> <span class="o">=</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_table</span><span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="k">if</span> <span class="n">column_table</span><span class="p">:</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">column</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"table"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">column_table</span><span class="p">))</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a><span class="k">def</span> <span class="nf">_expand_stars</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">):</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a><span class="w"> </span><span class="sd">"""Expand stars to lists of column selections"""</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">new_selections</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="n">except_columns</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="n">replace_columns</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">:</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="p">)</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="n">_add_except_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">except_columns</span><span class="p">)</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">_add_replace_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">replace_columns</span><span class="p">)</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="p">[</span><span class="n">expression</span><span class="o">.</span><span class="n">table</span><span class="p">]</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">_add_except_columns</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">except_columns</span><span class="p">)</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="n">_add_replace_columns</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">replace_columns</span><span class="p">)</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">new_selections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">continue</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="k">if</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">:</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown table: </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">resolver</span><span class="o">.</span><span class="n">get_source_columns</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">only_visible</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="sa">f</span><span class="s2">"Table has no schema/columns. Cannot expand star for table: </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">."</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="p">)</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">table_id</span> <span class="o">=</span> <span class="nb">id</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">except_columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table_id</span><span class="p">,</span> <span class="nb">set</span><span class="p">()):</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="n">replace_columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table_id</span><span class="p">,</span> <span class="p">{})</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">table</span><span class="p">)</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="n">new_selections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">alias</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">alias_</span><span class="p">)</span> <span class="k">if</span> <span class="n">alias_</span> <span class="o">!=</span> <span class="n">name</span> <span class="k">else</span> <span class="n">column</span><span class="p">)</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">new_selections</span><span class="p">)</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a><span class="k">def</span> <span class="nf">_add_except_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">except_columns</span><span class="p">):</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="n">except_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"except"</span><span class="p">)</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">except_</span><span class="p">:</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="k">return</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">{</span><span class="n">e</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">except_</span><span class="p">}</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="n">except_columns</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">table</span><span class="p">)]</span> <span class="o">=</span> <span class="n">columns</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a><span class="k">def</span> <span class="nf">_add_replace_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">tables</span><span class="p">,</span> <span class="n">replace_columns</span><span class="p">):</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"replace"</span><span class="p">)</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">replace</span><span class="p">:</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="k">return</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">{</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">e</span><span class="o">.</span><span class="n">alias</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">replace</span><span class="p">}</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">tables</span><span class="p">:</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="n">replace_columns</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">table</span><span class="p">)]</span> <span class="o">=</span> <span class="n">columns</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a><span class="k">def</span> <span class="nf">_qualify_outputs</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a><span class="w"> </span><span class="sd">"""Ensure all output columns are aliased"""</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">new_selections</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">selection</span><span class="p">,</span> <span class="n">aliased_column</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="n">itertools</span><span class="o">.</span><span class="n">zip_longest</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">selects</span><span class="p">,</span> <span class="n">scope</span><span class="o">.</span><span class="n">outer_column_list</span><span class="p">)</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="p">):</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">selection</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">selection</span><span class="o">.</span><span class="n">output_name</span><span class="p">:</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="n">selection</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="sa">f</span><span class="s2">"_col_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">)))</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">selection</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">):</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="n">alias</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="s2">""</span><span class="p">),</span> <span class="n">alias</span><span class="o">=</span><span class="n">selection</span><span class="o">.</span><span class="n">output_name</span> <span class="ow">or</span> <span class="sa">f</span><span class="s2">"_col_</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="n">alias_</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">selection</span><span class="p">)</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">selection</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="k">if</span> <span class="n">aliased_column</span><span class="p">:</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">selection</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">aliased_column</span><span class="p">))</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="n">new_selections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">new_selections</span><span class="p">)</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a><span class="k">class</span> <span class="nc">_Resolver</span><span class="p">:</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a><span class="sd"> Helper for resolving columns.</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a><span class="sd"> This is a class so we can lazily load some things and easily share them across functions.</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a><span class="sd"> """</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">schema</span><span class="p">):</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">scope</span> <span class="o">=</span> <span class="n">scope</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span> <span class="o">=</span> <span class="n">schema</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unambiguous_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_all_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">get_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">column_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a><span class="sd"> Get the table for a column name.</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a><span class="sd"> Args:</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a><span class="sd"> column_name: The column name to find the table for.</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a><span class="sd"> Returns:</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a><span class="sd"> The table name if it can be found/inferred.</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a><span class="sd"> """</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unambiguous_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_unambiguous_columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_unambiguous_columns</span><span class="p">(</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_get_all_source_columns</span><span class="p">()</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="p">)</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_unambiguous_columns</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">column_name</span><span class="p">)</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="n">sources_without_schema</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="n">source</span> <span class="k">for</span> <span class="n">source</span><span class="p">,</span> <span class="n">columns</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_all_source_columns</span><span class="p">()</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">columns</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="p">)</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sources_without_schema</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">return</span> <span class="n">sources_without_schema</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">return</span> <span class="n">table</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="nd">@property</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="k">def</span> <span class="nf">all_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a><span class="w"> </span><span class="sd">"""All available columns of all sources in this scope"""</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_all_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_all_columns</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="n">column</span> <span class="k">for</span> <span class="n">columns</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_get_all_source_columns</span><span class="p">()</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="p">}</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_all_columns</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="k">def</span> <span class="nf">get_source_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">only_visible</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a><span class="w"> </span><span class="sd">"""Resolve the source columns for a given source `name`"""</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">:</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown table: </span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="n">source</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="c1"># If referencing a table, return the columns from the schema</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">column_names</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">)</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">):</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> <span class="k">return</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">alias_column_names</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="c1"># Otherwise, if referencing another scope, return that scope's named selects</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="k">return</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="k">def</span> <span class="nf">_get_all_source_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_source_columns</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="n">k</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_source_columns</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="p">}</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_source_columns</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="k">def</span> <span class="nf">_get_unambiguous_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source_columns</span><span class="p">):</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a><span class="sd"> Find all the unambiguous columns in sources.</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a><span class="sd"> Args:</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a><span class="sd"> source_columns (dict): Mapping of names to source columns</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a><span class="sd"> Returns:</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a><span class="sd"> dict: Mapping of column name to source name</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a><span class="sd"> """</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source_columns</span><span class="p">:</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="n">source_columns</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">source_columns</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="n">first_table</span><span class="p">,</span> <span class="n">first_columns</span> <span class="o">=</span> <span class="n">source_columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="n">unambiguous_columns</span> <span class="o">=</span> <span class="p">{</span><span class="n">col</span><span class="p">:</span> <span class="n">first_table</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_unique_columns</span><span class="p">(</span><span class="n">first_columns</span><span class="p">)}</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="n">all_columns</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">unambiguous_columns</span><span class="p">)</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="k">for</span> <span class="n">table</span><span class="p">,</span> <span class="n">columns</span> <span class="ow">in</span> <span class="n">source_columns</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_unique_columns</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> <span class="n">ambiguous</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">all_columns</span><span class="p">)</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="n">unique</span><span class="p">)</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> <span class="n">all_columns</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">ambiguous</span><span class="p">:</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="n">unambiguous_columns</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">unique</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="n">ambiguous</span><span class="p">):</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">unambiguous_columns</span><span class="p">[</span><span class="n">column</span><span class="p">]</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="k">return</span> <span class="n">unambiguous_columns</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="nd">@staticmethod</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</span></a> <span class="k">def</span> <span class="nf">_find_unique_columns</span><span class="p">(</span><span class="n">columns</span><span class="p">):</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos">436</span></a><span class="sd"> Find the unique columns in a list of columns.</span> +</span><span id="L-437"><a href="#L-437"><span class="linenos">437</span></a> +</span><span id="L-438"><a href="#L-438"><span class="linenos">438</span></a><span class="sd"> Example:</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos">439</span></a><span class="sd"> >>> sorted(_Resolver._find_unique_columns(["a", "b", "b", "c"]))</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos">440</span></a><span class="sd"> ['a', 'c']</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos">441</span></a> +</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a><span class="sd"> This is necessary because duplicate column names are ambiguous.</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a><span class="sd"> """</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> <span class="n">counts</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-445"><a href="#L-445"><span class="linenos">445</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> <span class="n">counts</span><span class="p">[</span><span class="n">column</span><span class="p">]</span> <span class="o">=</span> <span class="n">counts</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">column</span> <span class="k">for</span> <span class="n">column</span><span class="p">,</span> <span class="n">count</span> <span class="ow">in</span> <span class="n">counts</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">count</span> <span class="o">==</span> <span class="mi">1</span><span class="p">}</span> +</span></pre></div> + + + </section> + <section id="qualify_columns"> + <input id="qualify_columns-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">qualify_columns</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">schema</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="qualify_columns-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#qualify_columns"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="qualify_columns-11"><a href="#qualify_columns-11"><span class="linenos">11</span></a><span class="k">def</span> <span class="nf">qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="p">):</span> +</span><span id="qualify_columns-12"><a href="#qualify_columns-12"><span class="linenos">12</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="qualify_columns-13"><a href="#qualify_columns-13"><span class="linenos">13</span></a><span class="sd"> Rewrite sqlglot AST to have fully qualified columns.</span> +</span><span id="qualify_columns-14"><a href="#qualify_columns-14"><span class="linenos">14</span></a> +</span><span id="qualify_columns-15"><a href="#qualify_columns-15"><span class="linenos">15</span></a><span class="sd"> Example:</span> +</span><span id="qualify_columns-16"><a href="#qualify_columns-16"><span class="linenos">16</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="qualify_columns-17"><a href="#qualify_columns-17"><span class="linenos">17</span></a><span class="sd"> >>> schema = {"tbl": {"col": "INT"}}</span> +</span><span id="qualify_columns-18"><a href="#qualify_columns-18"><span class="linenos">18</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT col FROM tbl")</span> +</span><span id="qualify_columns-19"><a href="#qualify_columns-19"><span class="linenos">19</span></a><span class="sd"> >>> qualify_columns(expression, schema).sql()</span> +</span><span id="qualify_columns-20"><a href="#qualify_columns-20"><span class="linenos">20</span></a><span class="sd"> 'SELECT tbl.col AS col FROM tbl'</span> +</span><span id="qualify_columns-21"><a href="#qualify_columns-21"><span class="linenos">21</span></a> +</span><span id="qualify_columns-22"><a href="#qualify_columns-22"><span class="linenos">22</span></a><span class="sd"> Args:</span> +</span><span id="qualify_columns-23"><a href="#qualify_columns-23"><span class="linenos">23</span></a><span class="sd"> expression (sqlglot.Expression): expression to qualify</span> +</span><span id="qualify_columns-24"><a href="#qualify_columns-24"><span class="linenos">24</span></a><span class="sd"> schema (dict|sqlglot.optimizer.Schema): Database schema</span> +</span><span id="qualify_columns-25"><a href="#qualify_columns-25"><span class="linenos">25</span></a><span class="sd"> Returns:</span> +</span><span id="qualify_columns-26"><a href="#qualify_columns-26"><span class="linenos">26</span></a><span class="sd"> sqlglot.Expression: qualified expression</span> +</span><span id="qualify_columns-27"><a href="#qualify_columns-27"><span class="linenos">27</span></a><span class="sd"> """</span> +</span><span id="qualify_columns-28"><a href="#qualify_columns-28"><span class="linenos">28</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="n">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="qualify_columns-29"><a href="#qualify_columns-29"><span class="linenos">29</span></a> +</span><span id="qualify_columns-30"><a href="#qualify_columns-30"><span class="linenos">30</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="qualify_columns-31"><a href="#qualify_columns-31"><span class="linenos">31</span></a> <span class="n">resolver</span> <span class="o">=</span> <span class="n">_Resolver</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span> +</span><span id="qualify_columns-32"><a href="#qualify_columns-32"><span class="linenos">32</span></a> <span class="n">_pop_table_column_aliases</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">ctes</span><span class="p">)</span> +</span><span id="qualify_columns-33"><a href="#qualify_columns-33"><span class="linenos">33</span></a> <span class="n">_pop_table_column_aliases</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">)</span> +</span><span id="qualify_columns-34"><a href="#qualify_columns-34"><span class="linenos">34</span></a> <span class="n">_expand_using</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="qualify_columns-35"><a href="#qualify_columns-35"><span class="linenos">35</span></a> <span class="n">_expand_group_by</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="qualify_columns-36"><a href="#qualify_columns-36"><span class="linenos">36</span></a> <span class="n">_qualify_columns</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="qualify_columns-37"><a href="#qualify_columns-37"><span class="linenos">37</span></a> <span class="n">_expand_order_by</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="qualify_columns-38"><a href="#qualify_columns-38"><span class="linenos">38</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="qualify_columns-39"><a href="#qualify_columns-39"><span class="linenos">39</span></a> <span class="n">_expand_stars</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">resolver</span><span class="p">)</span> +</span><span id="qualify_columns-40"><a href="#qualify_columns-40"><span class="linenos">40</span></a> <span class="n">_qualify_outputs</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="qualify_columns-41"><a href="#qualify_columns-41"><span class="linenos">41</span></a> +</span><span id="qualify_columns-42"><a href="#qualify_columns-42"><span class="linenos">42</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to have fully qualified columns.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">schema</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"tbl"</span><span class="p">:</span> <span class="p">{</span><span class="s2">"col"</span><span class="p">:</span> <span class="s2">"INT"</span><span class="p">}}</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT col FROM tbl"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">schema</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT tbl.col AS col FROM tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to qualify</li> +<li><strong>schema (dict|sqlglot.optimizer.Schema):</strong> Database schema</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: qualified expression</p> +</blockquote> +</div> + + + </section> + <section id="validate_qualify_columns"> + <input id="validate_qualify_columns-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">validate_qualify_columns</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="validate_qualify_columns-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#validate_qualify_columns"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="validate_qualify_columns-45"><a href="#validate_qualify_columns-45"><span class="linenos">45</span></a><span class="k">def</span> <span class="nf">validate_qualify_columns</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="validate_qualify_columns-46"><a href="#validate_qualify_columns-46"><span class="linenos">46</span></a><span class="w"> </span><span class="sd">"""Raise an `OptimizeError` if any columns aren't qualified"""</span> +</span><span id="validate_qualify_columns-47"><a href="#validate_qualify_columns-47"><span class="linenos">47</span></a> <span class="n">unqualified_columns</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="validate_qualify_columns-48"><a href="#validate_qualify_columns-48"><span class="linenos">48</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="validate_qualify_columns-49"><a href="#validate_qualify_columns-49"><span class="linenos">49</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="validate_qualify_columns-50"><a href="#validate_qualify_columns-50"><span class="linenos">50</span></a> <span class="n">unqualified_columns</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">unqualified_columns</span><span class="p">)</span> +</span><span id="validate_qualify_columns-51"><a href="#validate_qualify_columns-51"><span class="linenos">51</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_correlated_subquery</span><span class="p">:</span> +</span><span id="validate_qualify_columns-52"><a href="#validate_qualify_columns-52"><span class="linenos">52</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown table: </span><span class="si">{</span><span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">table</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="validate_qualify_columns-53"><a href="#validate_qualify_columns-53"><span class="linenos">53</span></a> +</span><span id="validate_qualify_columns-54"><a href="#validate_qualify_columns-54"><span class="linenos">54</span></a> <span class="k">if</span> <span class="n">unqualified_columns</span><span class="p">:</span> +</span><span id="validate_qualify_columns-55"><a href="#validate_qualify_columns-55"><span class="linenos">55</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Ambiguous columns: </span><span class="si">{</span><span class="n">unqualified_columns</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="validate_qualify_columns-56"><a href="#validate_qualify_columns-56"><span class="linenos">56</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Raise an <code>OptimizeError</code> if any columns aren't qualified</p> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/qualify_tables.html b/docs/sqlglot/optimizer/qualify_tables.html new file mode 100644 index 0000000..acde3e6 --- /dev/null +++ b/docs/sqlglot/optimizer/qualify_tables.html @@ -0,0 +1,427 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.qualify_tables API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#qualify_tables">qualify_tables</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/qualify_tables.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.qualify_tables </h1> + + + <input id="mod-qualify_tables-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-qualify_tables-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">alias</span><span class="p">,</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">csv_reader</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">Scope</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">qualify_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> Rewrite sqlglot AST to have fully qualified tables.</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> Example:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT 1 FROM tbl")</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> >>> qualify_tables(expression, db="db").sql()</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="sd"> 'SELECT 1 FROM db.tbl AS tbl'</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd"> Args:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="sd"> expression (sqlglot.Expression): expression to qualify</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="sd"> db (str): Database name</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="sd"> catalog (str): Catalog name</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a><span class="sd"> schema: A schema to populate</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a><span class="sd"> Returns:</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a><span class="sd"> sqlglot.Expression: qualified expression</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a><span class="sd"> """</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="n">next_name</span> <span class="o">=</span> <span class="k">lambda</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"_q_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="k">for</span> <span class="n">derived_table</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">ctes</span> <span class="o">+</span> <span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">:</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">):</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"_q_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">derived_table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias_</span><span class="p">)))</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">rename_source</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">alias_</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="k">if</span> <span class="n">identifier</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"db"</span><span class="p">):</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> <span class="n">source</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"db"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">db</span><span class="p">))</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"catalog"</span><span class="p">):</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="n">source</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"catalog"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">catalog</span><span class="p">))</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="n">alias</span><span class="p">(</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> <span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="n">source</span><span class="o">.</span><span class="n">this</span> <span class="k">if</span> <span class="n">identifier</span> <span class="k">else</span> <span class="n">next_name</span><span class="p">(),</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> <span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> <span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="k">with</span> <span class="n">csv_reader</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="k">as</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="n">header</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> <span class="n">source</span><span class="p">,</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="nb">type</span><span class="p">(</span><span class="n">v</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="n">columns</span><span class="p">)}</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">is_udtf</span><span class="p">:</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> <span class="n">udtf</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">udtf</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">next_name</span><span class="p">())</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> <span class="n">udtf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_alias</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="n">table_alias</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">next_name</span><span class="p">())</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos">70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos">71</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="qualify_tables"> + <input id="qualify_tables-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">qualify_tables</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">db</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">catalog</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="n">schema</span><span class="o">=</span><span class="kc">None</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="qualify_tables-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#qualify_tables"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="qualify_tables-9"><a href="#qualify_tables-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">qualify_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">schema</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="qualify_tables-10"><a href="#qualify_tables-10"><span class="linenos">10</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="qualify_tables-11"><a href="#qualify_tables-11"><span class="linenos">11</span></a><span class="sd"> Rewrite sqlglot AST to have fully qualified tables.</span> +</span><span id="qualify_tables-12"><a href="#qualify_tables-12"><span class="linenos">12</span></a> +</span><span id="qualify_tables-13"><a href="#qualify_tables-13"><span class="linenos">13</span></a><span class="sd"> Example:</span> +</span><span id="qualify_tables-14"><a href="#qualify_tables-14"><span class="linenos">14</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="qualify_tables-15"><a href="#qualify_tables-15"><span class="linenos">15</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT 1 FROM tbl")</span> +</span><span id="qualify_tables-16"><a href="#qualify_tables-16"><span class="linenos">16</span></a><span class="sd"> >>> qualify_tables(expression, db="db").sql()</span> +</span><span id="qualify_tables-17"><a href="#qualify_tables-17"><span class="linenos">17</span></a><span class="sd"> 'SELECT 1 FROM db.tbl AS tbl'</span> +</span><span id="qualify_tables-18"><a href="#qualify_tables-18"><span class="linenos">18</span></a> +</span><span id="qualify_tables-19"><a href="#qualify_tables-19"><span class="linenos">19</span></a><span class="sd"> Args:</span> +</span><span id="qualify_tables-20"><a href="#qualify_tables-20"><span class="linenos">20</span></a><span class="sd"> expression (sqlglot.Expression): expression to qualify</span> +</span><span id="qualify_tables-21"><a href="#qualify_tables-21"><span class="linenos">21</span></a><span class="sd"> db (str): Database name</span> +</span><span id="qualify_tables-22"><a href="#qualify_tables-22"><span class="linenos">22</span></a><span class="sd"> catalog (str): Catalog name</span> +</span><span id="qualify_tables-23"><a href="#qualify_tables-23"><span class="linenos">23</span></a><span class="sd"> schema: A schema to populate</span> +</span><span id="qualify_tables-24"><a href="#qualify_tables-24"><span class="linenos">24</span></a><span class="sd"> Returns:</span> +</span><span id="qualify_tables-25"><a href="#qualify_tables-25"><span class="linenos">25</span></a><span class="sd"> sqlglot.Expression: qualified expression</span> +</span><span id="qualify_tables-26"><a href="#qualify_tables-26"><span class="linenos">26</span></a><span class="sd"> """</span> +</span><span id="qualify_tables-27"><a href="#qualify_tables-27"><span class="linenos">27</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="qualify_tables-28"><a href="#qualify_tables-28"><span class="linenos">28</span></a> +</span><span id="qualify_tables-29"><a href="#qualify_tables-29"><span class="linenos">29</span></a> <span class="n">next_name</span> <span class="o">=</span> <span class="k">lambda</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"_q_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="qualify_tables-30"><a href="#qualify_tables-30"><span class="linenos">30</span></a> +</span><span id="qualify_tables-31"><a href="#qualify_tables-31"><span class="linenos">31</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="qualify_tables-32"><a href="#qualify_tables-32"><span class="linenos">32</span></a> <span class="k">for</span> <span class="n">derived_table</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">ctes</span> <span class="o">+</span> <span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">:</span> +</span><span id="qualify_tables-33"><a href="#qualify_tables-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">):</span> +</span><span id="qualify_tables-34"><a href="#qualify_tables-34"><span class="linenos">34</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"_q_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="qualify_tables-35"><a href="#qualify_tables-35"><span class="linenos">35</span></a> <span class="n">derived_table</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">alias_</span><span class="p">)))</span> +</span><span id="qualify_tables-36"><a href="#qualify_tables-36"><span class="linenos">36</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">rename_source</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="n">alias_</span><span class="p">)</span> +</span><span id="qualify_tables-37"><a href="#qualify_tables-37"><span class="linenos">37</span></a> +</span><span id="qualify_tables-38"><a href="#qualify_tables-38"><span class="linenos">38</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="qualify_tables-39"><a href="#qualify_tables-39"><span class="linenos">39</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="qualify_tables-40"><a href="#qualify_tables-40"><span class="linenos">40</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="qualify_tables-41"><a href="#qualify_tables-41"><span class="linenos">41</span></a> +</span><span id="qualify_tables-42"><a href="#qualify_tables-42"><span class="linenos">42</span></a> <span class="k">if</span> <span class="n">identifier</span><span class="p">:</span> +</span><span id="qualify_tables-43"><a href="#qualify_tables-43"><span class="linenos">43</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"db"</span><span class="p">):</span> +</span><span id="qualify_tables-44"><a href="#qualify_tables-44"><span class="linenos">44</span></a> <span class="n">source</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"db"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">db</span><span class="p">))</span> +</span><span id="qualify_tables-45"><a href="#qualify_tables-45"><span class="linenos">45</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"catalog"</span><span class="p">):</span> +</span><span id="qualify_tables-46"><a href="#qualify_tables-46"><span class="linenos">46</span></a> <span class="n">source</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"catalog"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">catalog</span><span class="p">))</span> +</span><span id="qualify_tables-47"><a href="#qualify_tables-47"><span class="linenos">47</span></a> +</span><span id="qualify_tables-48"><a href="#qualify_tables-48"><span class="linenos">48</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">source</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="qualify_tables-49"><a href="#qualify_tables-49"><span class="linenos">49</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span> +</span><span id="qualify_tables-50"><a href="#qualify_tables-50"><span class="linenos">50</span></a> <span class="n">alias</span><span class="p">(</span> +</span><span id="qualify_tables-51"><a href="#qualify_tables-51"><span class="linenos">51</span></a> <span class="n">source</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="qualify_tables-52"><a href="#qualify_tables-52"><span class="linenos">52</span></a> <span class="n">source</span><span class="o">.</span><span class="n">this</span> <span class="k">if</span> <span class="n">identifier</span> <span class="k">else</span> <span class="n">next_name</span><span class="p">(),</span> +</span><span id="qualify_tables-53"><a href="#qualify_tables-53"><span class="linenos">53</span></a> <span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="qualify_tables-54"><a href="#qualify_tables-54"><span class="linenos">54</span></a> <span class="p">)</span> +</span><span id="qualify_tables-55"><a href="#qualify_tables-55"><span class="linenos">55</span></a> <span class="p">)</span> +</span><span id="qualify_tables-56"><a href="#qualify_tables-56"><span class="linenos">56</span></a> +</span><span id="qualify_tables-57"><a href="#qualify_tables-57"><span class="linenos">57</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="qualify_tables-58"><a href="#qualify_tables-58"><span class="linenos">58</span></a> <span class="k">with</span> <span class="n">csv_reader</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> <span class="k">as</span> <span class="n">reader</span><span class="p">:</span> +</span><span id="qualify_tables-59"><a href="#qualify_tables-59"><span class="linenos">59</span></a> <span class="n">header</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="qualify_tables-60"><a href="#qualify_tables-60"><span class="linenos">60</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="nb">next</span><span class="p">(</span><span class="n">reader</span><span class="p">)</span> +</span><span id="qualify_tables-61"><a href="#qualify_tables-61"><span class="linenos">61</span></a> <span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span> +</span><span id="qualify_tables-62"><a href="#qualify_tables-62"><span class="linenos">62</span></a> <span class="n">source</span><span class="p">,</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="nb">type</span><span class="p">(</span><span class="n">v</span><span class="p">)</span><span class="o">.</span><span class="vm">__name__</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">header</span><span class="p">,</span> <span class="n">columns</span><span class="p">)}</span> +</span><span id="qualify_tables-63"><a href="#qualify_tables-63"><span class="linenos">63</span></a> <span class="p">)</span> +</span><span id="qualify_tables-64"><a href="#qualify_tables-64"><span class="linenos">64</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">is_udtf</span><span class="p">:</span> +</span><span id="qualify_tables-65"><a href="#qualify_tables-65"><span class="linenos">65</span></a> <span class="n">udtf</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span> +</span><span id="qualify_tables-66"><a href="#qualify_tables-66"><span class="linenos">66</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">udtf</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">next_name</span><span class="p">())</span> +</span><span id="qualify_tables-67"><a href="#qualify_tables-67"><span class="linenos">67</span></a> <span class="n">udtf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="qualify_tables-68"><a href="#qualify_tables-68"><span class="linenos">68</span></a> +</span><span id="qualify_tables-69"><a href="#qualify_tables-69"><span class="linenos">69</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_alias</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> +</span><span id="qualify_tables-70"><a href="#qualify_tables-70"><span class="linenos">70</span></a> <span class="n">table_alias</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">next_name</span><span class="p">())</span> +</span><span id="qualify_tables-71"><a href="#qualify_tables-71"><span class="linenos">71</span></a> +</span><span id="qualify_tables-72"><a href="#qualify_tables-72"><span class="linenos">72</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to have fully qualified tables.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT 1 FROM tbl"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">qualify_tables</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="s2">"db"</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT 1 FROM db.tbl AS tbl'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to qualify</li> +<li><strong>db (str):</strong> Database name</li> +<li><strong>catalog (str):</strong> Catalog name</li> +<li><strong>schema:</strong> A schema to populate</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: qualified expression</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/scope.html b/docs/sqlglot/optimizer/scope.html new file mode 100644 index 0000000..94b5f5b --- /dev/null +++ b/docs/sqlglot/optimizer/scope.html @@ -0,0 +1,2512 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.scope API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#ScopeType">ScopeType</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#ScopeType.ROOT">ROOT</a> + </li> + <li> + <a class="variable" href="#ScopeType.SUBQUERY">SUBQUERY</a> + </li> + <li> + <a class="variable" href="#ScopeType.DERIVED_TABLE">DERIVED_TABLE</a> + </li> + <li> + <a class="variable" href="#ScopeType.CTE">CTE</a> + </li> + <li> + <a class="variable" href="#ScopeType.UNION">UNION</a> + </li> + <li> + <a class="variable" href="#ScopeType.UDTF">UDTF</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Scope">Scope</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Scope.__init__">Scope</a> + </li> + <li> + <a class="function" href="#Scope.clear_cache">clear_cache</a> + </li> + <li> + <a class="function" href="#Scope.branch">branch</a> + </li> + <li> + <a class="function" href="#Scope.walk">walk</a> + </li> + <li> + <a class="function" href="#Scope.find">find</a> + </li> + <li> + <a class="function" href="#Scope.find_all">find_all</a> + </li> + <li> + <a class="function" href="#Scope.replace">replace</a> + </li> + <li> + <a class="variable" href="#Scope.tables">tables</a> + </li> + <li> + <a class="variable" href="#Scope.ctes">ctes</a> + </li> + <li> + <a class="variable" href="#Scope.derived_tables">derived_tables</a> + </li> + <li> + <a class="variable" href="#Scope.subqueries">subqueries</a> + </li> + <li> + <a class="variable" href="#Scope.columns">columns</a> + </li> + <li> + <a class="variable" href="#Scope.selected_sources">selected_sources</a> + </li> + <li> + <a class="variable" href="#Scope.cte_sources">cte_sources</a> + </li> + <li> + <a class="variable" href="#Scope.selects">selects</a> + </li> + <li> + <a class="variable" href="#Scope.external_columns">external_columns</a> + </li> + <li> + <a class="variable" href="#Scope.unqualified_columns">unqualified_columns</a> + </li> + <li> + <a class="variable" href="#Scope.join_hints">join_hints</a> + </li> + <li> + <a class="function" href="#Scope.source_columns">source_columns</a> + </li> + <li> + <a class="variable" href="#Scope.is_subquery">is_subquery</a> + </li> + <li> + <a class="variable" href="#Scope.is_derived_table">is_derived_table</a> + </li> + <li> + <a class="variable" href="#Scope.is_union">is_union</a> + </li> + <li> + <a class="variable" href="#Scope.is_cte">is_cte</a> + </li> + <li> + <a class="variable" href="#Scope.is_root">is_root</a> + </li> + <li> + <a class="variable" href="#Scope.is_udtf">is_udtf</a> + </li> + <li> + <a class="variable" href="#Scope.is_correlated_subquery">is_correlated_subquery</a> + </li> + <li> + <a class="function" href="#Scope.rename_source">rename_source</a> + </li> + <li> + <a class="function" href="#Scope.add_source">add_source</a> + </li> + <li> + <a class="function" href="#Scope.remove_source">remove_source</a> + </li> + <li> + <a class="function" href="#Scope.traverse">traverse</a> + </li> + <li> + <a class="function" href="#Scope.ref_count">ref_count</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#traverse_scope">traverse_scope</a> + </li> + <li> + <a class="function" href="#build_scope">build_scope</a> + </li> + <li> + <a class="function" href="#walk_in_scope">walk_in_scope</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/scope.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.scope </h1> + + + <input id="mod-scope-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-scope-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">defaultdict</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">Enum</span><span class="p">,</span> <span class="n">auto</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">OptimizeError</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">ScopeType</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">ROOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">SUBQUERY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">DERIVED_TABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">CTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">UNION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="n">UDTF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="k">class</span> <span class="nc">Scope</span><span class="p">:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Selection scope.</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> Attributes:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> expression (exp.Select|exp.Union): Root expression of this scope</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> sources (dict[str, exp.Table|Scope]): Mapping of source name to either</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> a Table expression or another Scope instance. For example:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> SELECT * FROM x {"x": Table(this="x")}</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> SELECT * FROM x AS y {"y": Table(this="x")}</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a><span class="sd"> SELECT * FROM (SELECT ...) AS y {"y": Scope(...)}</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a><span class="sd"> outer_column_list (list[str]): If this is a derived table or CTE, and the outer query</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a><span class="sd"> defines a column list of it's alias of this scope, this is that list of columns.</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a><span class="sd"> For example:</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a><span class="sd"> SELECT * FROM (SELECT ...) AS y(col1, col2)</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="sd"> The inner query would have `["col1", "col2"]` for its `outer_column_list`</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="sd"> parent (Scope): Parent scope</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="sd"> scope_type (ScopeType): Type of this scope, relative to it's parent</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a><span class="sd"> subquery_scopes (list[Scope]): List of all child scopes for subqueries</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a><span class="sd"> cte_scopes = (list[Scope]) List of all child scopes for CTEs</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a><span class="sd"> derived_table_scopes = (list[Scope]) List of all child scopes for derived_tables</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a><span class="sd"> union_scopes (list[Scope, Scope]): If this Scope is for a Union expression, this will be</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="sd"> a list of the left and right child scopes.</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="sd"> """</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">sources</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">outer_column_list</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">ROOT</span><span class="p">,</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="p">):</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span> <span class="o">=</span> <span class="n">sources</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">outer_column_list</span> <span class="o">=</span> <span class="n">outer_column_list</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">=</span> <span class="n">scope_type</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">derived_table_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">cte_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">union_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="k">def</span> <span class="nf">clear_cache</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">def</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">scope_type</span><span class="p">,</span> <span class="n">chain_sources</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a><span class="w"> </span><span class="sd">"""Branch from the current scope to a new, inner scope"""</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="k">return</span> <span class="n">Scope</span><span class="p">(</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">sources</span><span class="o">=</span><span class="p">{</span><span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">cte_sources</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">chain_sources</span> <span class="ow">or</span> <span class="p">{})},</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">scope_type</span><span class="p">,</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="p">)</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">def</span> <span class="nf">_collect</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">is</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">:</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">continue</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">):</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">):</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">):</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)):</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">def</span> <span class="nf">_ensure_collected</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span><span class="p">:</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collect</span><span class="p">()</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">return</span> <span class="n">walk_in_scope</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">)</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a><span class="sd"> Returns the first node in this scope which matches at least one of the specified types.</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a><span class="sd"> This does NOT traverse into subscopes.</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a><span class="sd"> Args:</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a><span class="sd"> bfs (bool): True to use breadth-first search, False to use depth-first.</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a><span class="sd"> Returns:</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a><span class="sd"> exp.Expression: the node which matches the criteria or None if no node matching</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a><span class="sd"> the criteria was found.</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a><span class="sd"> """</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a><span class="sd"> Returns a generator object which visits all nodes in this scope and only yields those that</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a><span class="sd"> match at least one of the specified expression types.</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a><span class="sd"> This does NOT traverse into subscopes.</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="sd"> Args:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a><span class="sd"> bfs (bool): True to use breadth-first search, False to use depth-first.</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a><span class="sd"> Yields:</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a><span class="sd"> exp.Expression: nodes</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a><span class="sd"> """</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">):</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">old</span><span class="p">,</span> <span class="n">new</span><span class="p">):</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a><span class="sd"> Replace `old` with `new`.</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a><span class="sd"> This can be used instead of `exp.Expression.replace` to ensure the `Scope` is kept up-to-date.</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a><span class="sd"> Args:</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a><span class="sd"> old (exp.Expression): old node</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a><span class="sd"> new (exp.Expression): new node</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a><span class="sd"> """</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="n">old</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">new</span><span class="p">)</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="nd">@property</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="k">def</span> <span class="nf">tables</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a><span class="sd"> List of tables in this scope.</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a><span class="sd"> Returns:</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a><span class="sd"> list[exp.Table]: tables</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a><span class="sd"> """</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="nd">@property</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">def</span> <span class="nf">ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a><span class="sd"> List of CTEs in this scope.</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a><span class="sd"> Returns:</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a><span class="sd"> list[exp.CTE]: ctes</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a><span class="sd"> """</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="nd">@property</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="k">def</span> <span class="nf">derived_tables</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a><span class="sd"> List of derived tables in this scope.</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a><span class="sd"> For example:</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a><span class="sd"> SELECT * FROM (SELECT ...) <- that's a derived table</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a><span class="sd"> Returns:</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a><span class="sd"> list[exp.Subquery]: derived tables</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a><span class="sd"> """</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="nd">@property</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="k">def</span> <span class="nf">subqueries</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a><span class="sd"> List of subqueries in this scope.</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a><span class="sd"> For example:</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a><span class="sd"> SELECT * FROM x WHERE a IN (SELECT ...) <- that's a subquery</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a><span class="sd"> Returns:</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a><span class="sd"> list[exp.Subqueryable]: subqueries</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a><span class="sd"> """</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="nd">@property</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a><span class="sd"> List of columns in this scope.</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a><span class="sd"> Returns:</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a><span class="sd"> list[exp.Column]: Column instances in this scope, plus any</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a><span class="sd"> Columns that reference this scope from correlated subqueries.</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a><span class="sd"> """</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">external_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="n">column</span> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="p">]</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">named_selects</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span><span class="p">)</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span> <span class="o">+</span> <span class="n">external_columns</span><span class="p">:</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">)</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="ow">not</span> <span class="n">ancestor</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="c1"># Window functions can have an ORDER BY clause</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="ow">or</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">named_selects</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">))</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="p">):</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="nd">@property</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="k">def</span> <span class="nf">selected_sources</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a><span class="sd"> Mapping of nodes and sources that are actually selected from in this scope.</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a><span class="sd"> That is, all tables in a schema are selectable at any point. But a</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a><span class="sd"> table only becomes a selected source if it's included in a FROM or JOIN clause.</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a><span class="sd"> Returns:</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a><span class="sd"> dict[str, (exp.Table|exp.Select, exp.Table|Scope)]: selected sources and nodes</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a><span class="sd"> """</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">referenced_names</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">:</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">referenced_names</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">table</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">table</span><span class="p">))</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">for</span> <span class="n">derived_table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">:</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">referenced_names</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">derived_table</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">unnest</span><span class="p">()))</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="n">result</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">referenced_names</span><span class="p">:</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">:</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">result</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">name</span><span class="p">])</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="o">=</span> <span class="n">result</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="nd">@property</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="k">def</span> <span class="nf">cte_sources</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a><span class="sd"> Sources that are CTEs.</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a><span class="sd"> Returns:</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a><span class="sd"> dict[str, Scope]: Mapping of source alias to Scope</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a><span class="sd"> """</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">scope</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="k">for</span> <span class="n">alias</span><span class="p">,</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_cte</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="p">}</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="nd">@property</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a><span class="sd"> Select expressions of this scope.</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a><span class="sd"> For example, for the following expression:</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a><span class="sd"> SELECT 1 as a, 2 as b FROM x</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a><span class="sd"> The outputs are the "1 as a" and "2 as b" expressions.</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a><span class="sd"> Returns:</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a><span class="sd"> list[exp.Expression]: expressions</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a><span class="sd"> """</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">selects</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="nd">@property</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="k">def</span> <span class="nf">external_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a><span class="sd"> Columns that appear to reference sources in outer scopes.</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a><span class="sd"> Returns:</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a><span class="sd"> list[exp.Column]: Column instances that don't reference</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a><span class="sd"> sources in the current scope.</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a><span class="sd"> """</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">selected_sources</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="p">]</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="nd">@property</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="k">def</span> <span class="nf">unqualified_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a><span class="sd"> Unqualified columns in the current scope.</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a><span class="sd"> Returns:</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a><span class="sd"> list[exp.Column]: Unqualified columns</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a><span class="sd"> """</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span><span class="p">]</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="nd">@property</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="k">def</span> <span class="nf">join_hints</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a><span class="sd"> Hints that exist in the scope that reference tables</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a><span class="sd"> Returns:</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a><span class="sd"> list[exp.JoinHint]: Join hints that are referenced within the scope</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a><span class="sd"> """</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="k">def</span> <span class="nf">source_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source_name</span><span class="p">):</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a><span class="sd"> Get all columns in the current scope for a particular source.</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a><span class="sd"> Args:</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a><span class="sd"> source_name (str): Name of the source</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a><span class="sd"> Returns:</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a><span class="sd"> list[exp.Column]: Column instances that reference `source_name`</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a><span class="sd"> """</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">source_name</span><span class="p">]</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="nd">@property</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="k">def</span> <span class="nf">is_subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a subquery"""</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">SUBQUERY</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="nd">@property</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="k">def</span> <span class="nf">is_derived_table</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a derived table"""</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="nd">@property</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">def</span> <span class="nf">is_union</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a union"""</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">UNION</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="nd">@property</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="k">def</span> <span class="nf">is_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a common table expression"""</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="nd">@property</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="k">def</span> <span class="nf">is_root</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a><span class="w"> </span><span class="sd">"""Determine if this is the root scope"""</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">ROOT</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="nd">@property</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">def</span> <span class="nf">is_udtf</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a UDTF (User Defined Table Function)"""</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">UDTF</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="nd">@property</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="k">def</span> <span class="nf">is_correlated_subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a correlated subquery"""</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">is_subquery</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">external_columns</span><span class="p">)</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="k">def</span> <span class="nf">rename_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">old_name</span><span class="p">,</span> <span class="n">new_name</span><span class="p">):</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a><span class="w"> </span><span class="sd">"""Rename a source in this scope"""</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">old_name</span> <span class="ow">or</span> <span class="s2">""</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">columns</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="k">def</span> <span class="nf">add_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">source</span><span class="p">):</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a><span class="w"> </span><span class="sd">"""Add a source to this scope"""</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="k">def</span> <span class="nf">remove_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a><span class="w"> </span><span class="sd">"""Remove a source from this scope"""</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"Scope<</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">>"</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a><span class="sd"> Traverse the scope tree from this node.</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a><span class="sd"> Yields:</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a><span class="sd"> Scope: scope instances in depth-first-search post-order</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a><span class="sd"> """</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">(</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">derived_table_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="p">):</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="k">yield from</span> <span class="n">child_scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">()</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="k">yield</span> <span class="bp">self</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="k">def</span> <span class="nf">ref_count</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a><span class="sd"> Count the number of times each scope in this tree is referenced.</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a><span class="sd"> Returns:</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a><span class="sd"> dict[int, int]: Mapping of Scope instance ID to reference count</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a><span class="sd"> """</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="n">scope_ref_count</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="n">scope_ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</span></a> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> <span class="k">return</span> <span class="n">scope_ref_count</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos">436</span></a> +</span><span id="L-437"><a href="#L-437"><span class="linenos">437</span></a> +</span><span id="L-438"><a href="#L-438"><span class="linenos">438</span></a><span class="k">def</span> <span class="nf">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos">439</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos">440</span></a><span class="sd"> Traverse an expression by it's "scopes".</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos">441</span></a> +</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a><span class="sd"> "Scope" represents the current context of a Select statement.</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a> +</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a><span class="sd"> This is helpful for optimizing queries, where we need more information than</span> +</span><span id="L-445"><a href="#L-445"><span class="linenos">445</span></a><span class="sd"> the expression tree itself. For example, we might care about the source</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a><span class="sd"> names within a subquery. Returns a list because a generator could result in</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a><span class="sd"> incomplete properties which is confusing.</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> +</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a><span class="sd"> Examples:</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos">450</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT a FROM x) AS y")</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos">452</span></a><span class="sd"> >>> scopes = traverse_scope(expression)</span> +</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a><span class="sd"> >>> scopes[0].expression.sql(), list(scopes[0].sources)</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos">454</span></a><span class="sd"> ('SELECT a FROM x', ['x'])</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a><span class="sd"> >>> scopes[1].expression.sql(), list(scopes[1].sources)</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a><span class="sd"> ('SELECT a FROM (SELECT a FROM x) AS y', ['y'])</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> +</span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a><span class="sd"> Args:</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos">459</span></a><span class="sd"> expression (exp.Expression): expression to traverse</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a><span class="sd"> Returns:</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos">461</span></a><span class="sd"> list[Scope]: scope instances</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos">462</span></a><span class="sd"> """</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos">463</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">_traverse_scope</span><span class="p">(</span><span class="n">Scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)))</span> +</span><span id="L-464"><a href="#L-464"><span class="linenos">464</span></a> +</span><span id="L-465"><a href="#L-465"><span class="linenos">465</span></a> +</span><span id="L-466"><a href="#L-466"><span class="linenos">466</span></a><span class="k">def</span> <span class="nf">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos">467</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-468"><a href="#L-468"><span class="linenos">468</span></a><span class="sd"> Build a scope tree.</span> +</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a> +</span><span id="L-470"><a href="#L-470"><span class="linenos">470</span></a><span class="sd"> Args:</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos">471</span></a><span class="sd"> expression (exp.Expression): expression to build the scope tree for</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos">472</span></a><span class="sd"> Returns:</span> +</span><span id="L-473"><a href="#L-473"><span class="linenos">473</span></a><span class="sd"> Scope: root scope</span> +</span><span id="L-474"><a href="#L-474"><span class="linenos">474</span></a><span class="sd"> """</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos">475</span></a> <span class="k">return</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span><span id="L-476"><a href="#L-476"><span class="linenos">476</span></a> +</span><span id="L-477"><a href="#L-477"><span class="linenos">477</span></a> +</span><span id="L-478"><a href="#L-478"><span class="linenos">478</span></a><span class="k">def</span> <span class="nf">_traverse_scope</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos">479</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos">480</span></a> <span class="k">yield from</span> <span class="n">_traverse_select</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-481"><a href="#L-481"><span class="linenos">481</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-482"><a href="#L-482"><span class="linenos">482</span></a> <span class="k">yield from</span> <span class="n">_traverse_union</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos">483</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos">484</span></a> <span class="n">_set_udtf_scope</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos">485</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos">486</span></a> <span class="k">yield from</span> <span class="n">_traverse_subqueries</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-487"><a href="#L-487"><span class="linenos">487</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos">488</span></a> <span class="k">raise</span> <span class="n">OptimizeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unexpected expression type: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos">489</span></a> <span class="k">yield</span> <span class="n">scope</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos">490</span></a> +</span><span id="L-491"><a href="#L-491"><span class="linenos">491</span></a> +</span><span id="L-492"><a href="#L-492"><span class="linenos">492</span></a><span class="k">def</span> <span class="nf">_traverse_select</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos">493</span></a> <span class="k">yield from</span> <span class="n">_traverse_derived_tables</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">ctes</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> +</span><span id="L-494"><a href="#L-494"><span class="linenos">494</span></a> <span class="k">yield from</span> <span class="n">_traverse_derived_tables</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span><span class="p">)</span> +</span><span id="L-495"><a href="#L-495"><span class="linenos">495</span></a> <span class="k">yield from</span> <span class="n">_traverse_subqueries</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos">496</span></a> <span class="n">_add_table_sources</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-497"><a href="#L-497"><span class="linenos">497</span></a> +</span><span id="L-498"><a href="#L-498"><span class="linenos">498</span></a> +</span><span id="L-499"><a href="#L-499"><span class="linenos">499</span></a><span class="k">def</span> <span class="nf">_traverse_union</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-500"><a href="#L-500"><span class="linenos">500</span></a> <span class="k">yield from</span> <span class="n">_traverse_derived_tables</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">ctes</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> +</span><span id="L-501"><a href="#L-501"><span class="linenos">501</span></a> +</span><span id="L-502"><a href="#L-502"><span class="linenos">502</span></a> <span class="c1"># The last scope to be yield should be the top most scope</span> +</span><span id="L-503"><a href="#L-503"><span class="linenos">503</span></a> <span class="n">left</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-504"><a href="#L-504"><span class="linenos">504</span></a> <span class="k">for</span> <span class="n">left</span> <span class="ow">in</span> <span class="n">_traverse_scope</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">branch</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">UNION</span><span class="p">)):</span> +</span><span id="L-505"><a href="#L-505"><span class="linenos">505</span></a> <span class="k">yield</span> <span class="n">left</span> +</span><span id="L-506"><a href="#L-506"><span class="linenos">506</span></a> +</span><span id="L-507"><a href="#L-507"><span class="linenos">507</span></a> <span class="n">right</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-508"><a href="#L-508"><span class="linenos">508</span></a> <span class="k">for</span> <span class="n">right</span> <span class="ow">in</span> <span class="n">_traverse_scope</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">branch</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="p">,</span> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">UNION</span><span class="p">)):</span> +</span><span id="L-509"><a href="#L-509"><span class="linenos">509</span></a> <span class="k">yield</span> <span class="n">right</span> +</span><span id="L-510"><a href="#L-510"><span class="linenos">510</span></a> +</span><span id="L-511"><a href="#L-511"><span class="linenos">511</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">union_scopes</span> <span class="o">=</span> <span class="p">[</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">]</span> +</span><span id="L-512"><a href="#L-512"><span class="linenos">512</span></a> +</span><span id="L-513"><a href="#L-513"><span class="linenos">513</span></a> +</span><span id="L-514"><a href="#L-514"><span class="linenos">514</span></a><span class="k">def</span> <span class="nf">_set_udtf_scope</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-515"><a href="#L-515"><span class="linenos">515</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-516"><a href="#L-516"><span class="linenos">516</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">parent</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-517"><a href="#L-517"><span class="linenos">517</span></a> +</span><span id="L-518"><a href="#L-518"><span class="linenos">518</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="L-519"><a href="#L-519"><span class="linenos">519</span></a> <span class="k">return</span> +</span><span id="L-520"><a href="#L-520"><span class="linenos">520</span></a> +</span><span id="L-521"><a href="#L-521"><span class="linenos">521</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-522"><a href="#L-522"><span class="linenos">522</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">):</span> +</span><span id="L-523"><a href="#L-523"><span class="linenos">523</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-524"><a href="#L-524"><span class="linenos">524</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-525"><a href="#L-525"><span class="linenos">525</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">subqueries</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-526"><a href="#L-526"><span class="linenos">526</span></a> <span class="n">_add_table_sources</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-527"><a href="#L-527"><span class="linenos">527</span></a> <span class="n">_traverse_subqueries</span><span class="p">(</span><span class="n">scope</span><span class="p">)</span> +</span><span id="L-528"><a href="#L-528"><span class="linenos">528</span></a> +</span><span id="L-529"><a href="#L-529"><span class="linenos">529</span></a> +</span><span id="L-530"><a href="#L-530"><span class="linenos">530</span></a><span class="k">def</span> <span class="nf">_traverse_derived_tables</span><span class="p">(</span><span class="n">derived_tables</span><span class="p">,</span> <span class="n">scope</span><span class="p">,</span> <span class="n">scope_type</span><span class="p">):</span> +</span><span id="L-531"><a href="#L-531"><span class="linenos">531</span></a> <span class="n">sources</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-532"><a href="#L-532"><span class="linenos">532</span></a> <span class="n">is_cte</span> <span class="o">=</span> <span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span> +</span><span id="L-533"><a href="#L-533"><span class="linenos">533</span></a> +</span><span id="L-534"><a href="#L-534"><span class="linenos">534</span></a> <span class="k">for</span> <span class="n">derived_table</span> <span class="ow">in</span> <span class="n">derived_tables</span><span class="p">:</span> +</span><span id="L-535"><a href="#L-535"><span class="linenos">535</span></a> <span class="n">recursive_scope</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-536"><a href="#L-536"><span class="linenos">536</span></a> +</span><span id="L-537"><a href="#L-537"><span class="linenos">537</span></a> <span class="c1"># if the scope is a recursive cte, it must be in the form of</span> +</span><span id="L-538"><a href="#L-538"><span class="linenos">538</span></a> <span class="c1"># base_case UNION recursive. thus the recursive scope is the first</span> +</span><span id="L-539"><a href="#L-539"><span class="linenos">539</span></a> <span class="c1"># section of the union.</span> +</span><span id="L-540"><a href="#L-540"><span class="linenos">540</span></a> <span class="k">if</span> <span class="n">is_cte</span> <span class="ow">and</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"with"</span><span class="p">]</span><span class="o">.</span><span class="n">recursive</span><span class="p">:</span> +</span><span id="L-541"><a href="#L-541"><span class="linenos">541</span></a> <span class="n">union</span> <span class="o">=</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-542"><a href="#L-542"><span class="linenos">542</span></a> +</span><span id="L-543"><a href="#L-543"><span class="linenos">543</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">union</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-544"><a href="#L-544"><span class="linenos">544</span></a> <span class="n">recursive_scope</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">branch</span><span class="p">(</span><span class="n">union</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">)</span> +</span><span id="L-545"><a href="#L-545"><span class="linenos">545</span></a> +</span><span id="L-546"><a href="#L-546"><span class="linenos">546</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">_traverse_scope</span><span class="p">(</span> +</span><span id="L-547"><a href="#L-547"><span class="linenos">547</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">branch</span><span class="p">(</span> +</span><span id="L-548"><a href="#L-548"><span class="linenos">548</span></a> <span class="n">derived_table</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">derived_table</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">)</span> <span class="k">else</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-549"><a href="#L-549"><span class="linenos">549</span></a> <span class="n">chain_sources</span><span class="o">=</span><span class="n">sources</span> <span class="k">if</span> <span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-550"><a href="#L-550"><span class="linenos">550</span></a> <span class="n">outer_column_list</span><span class="o">=</span><span class="n">derived_table</span><span class="o">.</span><span class="n">alias_column_names</span><span class="p">,</span> +</span><span id="L-551"><a href="#L-551"><span class="linenos">551</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">UDTF</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">derived_table</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">)</span> <span class="k">else</span> <span class="n">scope_type</span><span class="p">,</span> +</span><span id="L-552"><a href="#L-552"><span class="linenos">552</span></a> <span class="p">)</span> +</span><span id="L-553"><a href="#L-553"><span class="linenos">553</span></a> <span class="p">):</span> +</span><span id="L-554"><a href="#L-554"><span class="linenos">554</span></a> <span class="k">yield</span> <span class="n">child_scope</span> +</span><span id="L-555"><a href="#L-555"><span class="linenos">555</span></a> +</span><span id="L-556"><a href="#L-556"><span class="linenos">556</span></a> <span class="c1"># Tables without aliases will be set as ""</span> +</span><span id="L-557"><a href="#L-557"><span class="linenos">557</span></a> <span class="c1"># This shouldn't be a problem once qualify_columns runs, as it adds aliases on everything.</span> +</span><span id="L-558"><a href="#L-558"><span class="linenos">558</span></a> <span class="c1"># Until then, this means that only a single, unaliased derived table is allowed (rather,</span> +</span><span id="L-559"><a href="#L-559"><span class="linenos">559</span></a> <span class="c1"># the latest one wins.</span> +</span><span id="L-560"><a href="#L-560"><span class="linenos">560</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-561"><a href="#L-561"><span class="linenos">561</span></a> <span class="n">sources</span><span class="p">[</span><span class="n">alias</span><span class="p">]</span> <span class="o">=</span> <span class="n">child_scope</span> +</span><span id="L-562"><a href="#L-562"><span class="linenos">562</span></a> +</span><span id="L-563"><a href="#L-563"><span class="linenos">563</span></a> <span class="k">if</span> <span class="n">recursive_scope</span><span class="p">:</span> +</span><span id="L-564"><a href="#L-564"><span class="linenos">564</span></a> <span class="n">child_scope</span><span class="o">.</span><span class="n">add_source</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">recursive_scope</span><span class="p">)</span> +</span><span id="L-565"><a href="#L-565"><span class="linenos">565</span></a> +</span><span id="L-566"><a href="#L-566"><span class="linenos">566</span></a> <span class="c1"># append the final child_scope yielded</span> +</span><span id="L-567"><a href="#L-567"><span class="linenos">567</span></a> <span class="k">if</span> <span class="n">is_cte</span><span class="p">:</span> +</span><span id="L-568"><a href="#L-568"><span class="linenos">568</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">cte_scopes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">child_scope</span><span class="p">)</span> +</span><span id="L-569"><a href="#L-569"><span class="linenos">569</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-570"><a href="#L-570"><span class="linenos">570</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">derived_table_scopes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">child_scope</span><span class="p">)</span> +</span><span id="L-571"><a href="#L-571"><span class="linenos">571</span></a> +</span><span id="L-572"><a href="#L-572"><span class="linenos">572</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">sources</span><span class="p">)</span> +</span><span id="L-573"><a href="#L-573"><span class="linenos">573</span></a> +</span><span id="L-574"><a href="#L-574"><span class="linenos">574</span></a> +</span><span id="L-575"><a href="#L-575"><span class="linenos">575</span></a><span class="k">def</span> <span class="nf">_add_table_sources</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-576"><a href="#L-576"><span class="linenos">576</span></a> <span class="n">sources</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-577"><a href="#L-577"><span class="linenos">577</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">tables</span><span class="p">:</span> +</span><span id="L-578"><a href="#L-578"><span class="linenos">578</span></a> <span class="n">table_name</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-579"><a href="#L-579"><span class="linenos">579</span></a> +</span><span id="L-580"><a href="#L-580"><span class="linenos">580</span></a> <span class="k">if</span> <span class="n">table</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> +</span><span id="L-581"><a href="#L-581"><span class="linenos">581</span></a> <span class="n">source_name</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-582"><a href="#L-582"><span class="linenos">582</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-583"><a href="#L-583"><span class="linenos">583</span></a> <span class="n">source_name</span> <span class="o">=</span> <span class="n">table_name</span> +</span><span id="L-584"><a href="#L-584"><span class="linenos">584</span></a> +</span><span id="L-585"><a href="#L-585"><span class="linenos">585</span></a> <span class="k">if</span> <span class="n">table_name</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">:</span> +</span><span id="L-586"><a href="#L-586"><span class="linenos">586</span></a> <span class="c1"># This is a reference to a parent source (e.g. a CTE), not an actual table.</span> +</span><span id="L-587"><a href="#L-587"><span class="linenos">587</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">source_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">table_name</span><span class="p">]</span> +</span><span id="L-588"><a href="#L-588"><span class="linenos">588</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-589"><a href="#L-589"><span class="linenos">589</span></a> <span class="n">sources</span><span class="p">[</span><span class="n">source_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-590"><a href="#L-590"><span class="linenos">590</span></a> +</span><span id="L-591"><a href="#L-591"><span class="linenos">591</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">sources</span><span class="p">)</span> +</span><span id="L-592"><a href="#L-592"><span class="linenos">592</span></a> +</span><span id="L-593"><a href="#L-593"><span class="linenos">593</span></a> +</span><span id="L-594"><a href="#L-594"><span class="linenos">594</span></a><span class="k">def</span> <span class="nf">_traverse_subqueries</span><span class="p">(</span><span class="n">scope</span><span class="p">):</span> +</span><span id="L-595"><a href="#L-595"><span class="linenos">595</span></a> <span class="k">for</span> <span class="n">subquery</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">subqueries</span><span class="p">:</span> +</span><span id="L-596"><a href="#L-596"><span class="linenos">596</span></a> <span class="n">top</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-597"><a href="#L-597"><span class="linenos">597</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">_traverse_scope</span><span class="p">(</span><span class="n">scope</span><span class="o">.</span><span class="n">branch</span><span class="p">(</span><span class="n">subquery</span><span class="p">,</span> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">SUBQUERY</span><span class="p">)):</span> +</span><span id="L-598"><a href="#L-598"><span class="linenos">598</span></a> <span class="k">yield</span> <span class="n">child_scope</span> +</span><span id="L-599"><a href="#L-599"><span class="linenos">599</span></a> <span class="n">top</span> <span class="o">=</span> <span class="n">child_scope</span> +</span><span id="L-600"><a href="#L-600"><span class="linenos">600</span></a> <span class="n">scope</span><span class="o">.</span><span class="n">subquery_scopes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">top</span><span class="p">)</span> +</span><span id="L-601"><a href="#L-601"><span class="linenos">601</span></a> +</span><span id="L-602"><a href="#L-602"><span class="linenos">602</span></a> +</span><span id="L-603"><a href="#L-603"><span class="linenos">603</span></a><span class="k">def</span> <span class="nf">walk_in_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-604"><a href="#L-604"><span class="linenos">604</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-605"><a href="#L-605"><span class="linenos">605</span></a><span class="sd"> Returns a generator object which visits all nodes in the syntrax tree, stopping at</span> +</span><span id="L-606"><a href="#L-606"><span class="linenos">606</span></a><span class="sd"> nodes that start child scopes.</span> +</span><span id="L-607"><a href="#L-607"><span class="linenos">607</span></a> +</span><span id="L-608"><a href="#L-608"><span class="linenos">608</span></a><span class="sd"> Args:</span> +</span><span id="L-609"><a href="#L-609"><span class="linenos">609</span></a><span class="sd"> expression (exp.Expression):</span> +</span><span id="L-610"><a href="#L-610"><span class="linenos">610</span></a><span class="sd"> bfs (bool): if set to True the BFS traversal order will be applied,</span> +</span><span id="L-611"><a href="#L-611"><span class="linenos">611</span></a><span class="sd"> otherwise the DFS traversal will be used instead.</span> +</span><span id="L-612"><a href="#L-612"><span class="linenos">612</span></a> +</span><span id="L-613"><a href="#L-613"><span class="linenos">613</span></a><span class="sd"> Yields:</span> +</span><span id="L-614"><a href="#L-614"><span class="linenos">614</span></a><span class="sd"> tuple[exp.Expression, Optional[exp.Expression], str]: node, parent, arg key</span> +</span><span id="L-615"><a href="#L-615"><span class="linenos">615</span></a><span class="sd"> """</span> +</span><span id="L-616"><a href="#L-616"><span class="linenos">616</span></a> <span class="c1"># We'll use this variable to pass state into the dfs generator.</span> +</span><span id="L-617"><a href="#L-617"><span class="linenos">617</span></a> <span class="c1"># Whenever we set it to True, we exclude a subtree from traversal.</span> +</span><span id="L-618"><a href="#L-618"><span class="linenos">618</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-619"><a href="#L-619"><span class="linenos">619</span></a> +</span><span id="L-620"><a href="#L-620"><span class="linenos">620</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="n">prune</span><span class="p">):</span> +</span><span id="L-621"><a href="#L-621"><span class="linenos">621</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-622"><a href="#L-622"><span class="linenos">622</span></a> +</span><span id="L-623"><a href="#L-623"><span class="linenos">623</span></a> <span class="k">yield</span> <span class="n">node</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="L-624"><a href="#L-624"><span class="linenos">624</span></a> +</span><span id="L-625"><a href="#L-625"><span class="linenos">625</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">is</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-626"><a href="#L-626"><span class="linenos">626</span></a> <span class="k">continue</span> +</span><span id="L-627"><a href="#L-627"><span class="linenos">627</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">):</span> +</span><span id="L-628"><a href="#L-628"><span class="linenos">628</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-629"><a href="#L-629"><span class="linenos">629</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)):</span> +</span><span id="L-630"><a href="#L-630"><span class="linenos">630</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-631"><a href="#L-631"><span class="linenos">631</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-632"><a href="#L-632"><span class="linenos">632</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + </section> + <section id="ScopeType"> + <input id="ScopeType-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">ScopeType</span><wbr>(<span class="base">enum.Enum</span>): + + <label class="view-source-button" for="ScopeType-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ScopeType"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ScopeType-10"><a href="#ScopeType-10"><span class="linenos">10</span></a><span class="k">class</span> <span class="nc">ScopeType</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span> +</span><span id="ScopeType-11"><a href="#ScopeType-11"><span class="linenos">11</span></a> <span class="n">ROOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ScopeType-12"><a href="#ScopeType-12"><span class="linenos">12</span></a> <span class="n">SUBQUERY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ScopeType-13"><a href="#ScopeType-13"><span class="linenos">13</span></a> <span class="n">DERIVED_TABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ScopeType-14"><a href="#ScopeType-14"><span class="linenos">14</span></a> <span class="n">CTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ScopeType-15"><a href="#ScopeType-15"><span class="linenos">15</span></a> <span class="n">UNION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="ScopeType-16"><a href="#ScopeType-16"><span class="linenos">16</span></a> <span class="n">UDTF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>An enumeration.</p> +</div> + + + <div id="ScopeType.ROOT" class="classattr"> + <div class="attr variable"> + <span class="name">ROOT</span><span class="default_value"> = <<a href="#ScopeType.ROOT">ScopeType.ROOT</a>: 1></span> + + + </div> + <a class="headerlink" href="#ScopeType.ROOT"></a> + + + + </div> + <div id="ScopeType.SUBQUERY" class="classattr"> + <div class="attr variable"> + <span class="name">SUBQUERY</span><span class="default_value"> = <<a href="#ScopeType.SUBQUERY">ScopeType.SUBQUERY</a>: 2></span> + + + </div> + <a class="headerlink" href="#ScopeType.SUBQUERY"></a> + + + + </div> + <div id="ScopeType.DERIVED_TABLE" class="classattr"> + <div class="attr variable"> + <span class="name">DERIVED_TABLE</span><span class="default_value"> = <<a href="#ScopeType.DERIVED_TABLE">ScopeType.DERIVED_TABLE</a>: 3></span> + + + </div> + <a class="headerlink" href="#ScopeType.DERIVED_TABLE"></a> + + + + </div> + <div id="ScopeType.CTE" class="classattr"> + <div class="attr variable"> + <span class="name">CTE</span><span class="default_value"> = <<a href="#ScopeType.CTE">ScopeType.CTE</a>: 4></span> + + + </div> + <a class="headerlink" href="#ScopeType.CTE"></a> + + + + </div> + <div id="ScopeType.UNION" class="classattr"> + <div class="attr variable"> + <span class="name">UNION</span><span class="default_value"> = <<a href="#ScopeType.UNION">ScopeType.UNION</a>: 5></span> + + + </div> + <a class="headerlink" href="#ScopeType.UNION"></a> + + + + </div> + <div id="ScopeType.UDTF" class="classattr"> + <div class="attr variable"> + <span class="name">UDTF</span><span class="default_value"> = <<a href="#ScopeType.UDTF">ScopeType.UDTF</a>: 6></span> + + + </div> + <a class="headerlink" href="#ScopeType.UDTF"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="ScopeType.name" class="variable">name</dd> + <dd id="ScopeType.value" class="variable">value</dd> + + </div> + </dl> + </div> + </section> + <section id="Scope"> + <input id="Scope-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Scope</span>: + + <label class="view-source-button" for="Scope-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope-19"><a href="#Scope-19"><span class="linenos"> 19</span></a><span class="k">class</span> <span class="nc">Scope</span><span class="p">:</span> +</span><span id="Scope-20"><a href="#Scope-20"><span class="linenos"> 20</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-21"><a href="#Scope-21"><span class="linenos"> 21</span></a><span class="sd"> Selection scope.</span> +</span><span id="Scope-22"><a href="#Scope-22"><span class="linenos"> 22</span></a> +</span><span id="Scope-23"><a href="#Scope-23"><span class="linenos"> 23</span></a><span class="sd"> Attributes:</span> +</span><span id="Scope-24"><a href="#Scope-24"><span class="linenos"> 24</span></a><span class="sd"> expression (exp.Select|exp.Union): Root expression of this scope</span> +</span><span id="Scope-25"><a href="#Scope-25"><span class="linenos"> 25</span></a><span class="sd"> sources (dict[str, exp.Table|Scope]): Mapping of source name to either</span> +</span><span id="Scope-26"><a href="#Scope-26"><span class="linenos"> 26</span></a><span class="sd"> a Table expression or another Scope instance. For example:</span> +</span><span id="Scope-27"><a href="#Scope-27"><span class="linenos"> 27</span></a><span class="sd"> SELECT * FROM x {"x": Table(this="x")}</span> +</span><span id="Scope-28"><a href="#Scope-28"><span class="linenos"> 28</span></a><span class="sd"> SELECT * FROM x AS y {"y": Table(this="x")}</span> +</span><span id="Scope-29"><a href="#Scope-29"><span class="linenos"> 29</span></a><span class="sd"> SELECT * FROM (SELECT ...) AS y {"y": Scope(...)}</span> +</span><span id="Scope-30"><a href="#Scope-30"><span class="linenos"> 30</span></a><span class="sd"> outer_column_list (list[str]): If this is a derived table or CTE, and the outer query</span> +</span><span id="Scope-31"><a href="#Scope-31"><span class="linenos"> 31</span></a><span class="sd"> defines a column list of it's alias of this scope, this is that list of columns.</span> +</span><span id="Scope-32"><a href="#Scope-32"><span class="linenos"> 32</span></a><span class="sd"> For example:</span> +</span><span id="Scope-33"><a href="#Scope-33"><span class="linenos"> 33</span></a><span class="sd"> SELECT * FROM (SELECT ...) AS y(col1, col2)</span> +</span><span id="Scope-34"><a href="#Scope-34"><span class="linenos"> 34</span></a><span class="sd"> The inner query would have `["col1", "col2"]` for its `outer_column_list`</span> +</span><span id="Scope-35"><a href="#Scope-35"><span class="linenos"> 35</span></a><span class="sd"> parent (Scope): Parent scope</span> +</span><span id="Scope-36"><a href="#Scope-36"><span class="linenos"> 36</span></a><span class="sd"> scope_type (ScopeType): Type of this scope, relative to it's parent</span> +</span><span id="Scope-37"><a href="#Scope-37"><span class="linenos"> 37</span></a><span class="sd"> subquery_scopes (list[Scope]): List of all child scopes for subqueries</span> +</span><span id="Scope-38"><a href="#Scope-38"><span class="linenos"> 38</span></a><span class="sd"> cte_scopes = (list[Scope]) List of all child scopes for CTEs</span> +</span><span id="Scope-39"><a href="#Scope-39"><span class="linenos"> 39</span></a><span class="sd"> derived_table_scopes = (list[Scope]) List of all child scopes for derived_tables</span> +</span><span id="Scope-40"><a href="#Scope-40"><span class="linenos"> 40</span></a><span class="sd"> union_scopes (list[Scope, Scope]): If this Scope is for a Union expression, this will be</span> +</span><span id="Scope-41"><a href="#Scope-41"><span class="linenos"> 41</span></a><span class="sd"> a list of the left and right child scopes.</span> +</span><span id="Scope-42"><a href="#Scope-42"><span class="linenos"> 42</span></a><span class="sd"> """</span> +</span><span id="Scope-43"><a href="#Scope-43"><span class="linenos"> 43</span></a> +</span><span id="Scope-44"><a href="#Scope-44"><span class="linenos"> 44</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Scope-45"><a href="#Scope-45"><span class="linenos"> 45</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Scope-46"><a href="#Scope-46"><span class="linenos"> 46</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Scope-47"><a href="#Scope-47"><span class="linenos"> 47</span></a> <span class="n">sources</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Scope-48"><a href="#Scope-48"><span class="linenos"> 48</span></a> <span class="n">outer_column_list</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Scope-49"><a href="#Scope-49"><span class="linenos"> 49</span></a> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Scope-50"><a href="#Scope-50"><span class="linenos"> 50</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">ROOT</span><span class="p">,</span> +</span><span id="Scope-51"><a href="#Scope-51"><span class="linenos"> 51</span></a> <span class="p">):</span> +</span><span id="Scope-52"><a href="#Scope-52"><span class="linenos"> 52</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Scope-53"><a href="#Scope-53"><span class="linenos"> 53</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span> <span class="o">=</span> <span class="n">sources</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="Scope-54"><a href="#Scope-54"><span class="linenos"> 54</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">outer_column_list</span> <span class="o">=</span> <span class="n">outer_column_list</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="Scope-55"><a href="#Scope-55"><span class="linenos"> 55</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> +</span><span id="Scope-56"><a href="#Scope-56"><span class="linenos"> 56</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">=</span> <span class="n">scope_type</span> +</span><span id="Scope-57"><a href="#Scope-57"><span class="linenos"> 57</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-58"><a href="#Scope-58"><span class="linenos"> 58</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">derived_table_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-59"><a href="#Scope-59"><span class="linenos"> 59</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">cte_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-60"><a href="#Scope-60"><span class="linenos"> 60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">union_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-61"><a href="#Scope-61"><span class="linenos"> 61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="Scope-62"><a href="#Scope-62"><span class="linenos"> 62</span></a> +</span><span id="Scope-63"><a href="#Scope-63"><span class="linenos"> 63</span></a> <span class="k">def</span> <span class="nf">clear_cache</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-64"><a href="#Scope-64"><span class="linenos"> 64</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Scope-65"><a href="#Scope-65"><span class="linenos"> 65</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-66"><a href="#Scope-66"><span class="linenos"> 66</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-67"><a href="#Scope-67"><span class="linenos"> 67</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-68"><a href="#Scope-68"><span class="linenos"> 68</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-69"><a href="#Scope-69"><span class="linenos"> 69</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-70"><a href="#Scope-70"><span class="linenos"> 70</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-71"><a href="#Scope-71"><span class="linenos"> 71</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-72"><a href="#Scope-72"><span class="linenos"> 72</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-73"><a href="#Scope-73"><span class="linenos"> 73</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope-74"><a href="#Scope-74"><span class="linenos"> 74</span></a> +</span><span id="Scope-75"><a href="#Scope-75"><span class="linenos"> 75</span></a> <span class="k">def</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">scope_type</span><span class="p">,</span> <span class="n">chain_sources</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="Scope-76"><a href="#Scope-76"><span class="linenos"> 76</span></a><span class="w"> </span><span class="sd">"""Branch from the current scope to a new, inner scope"""</span> +</span><span id="Scope-77"><a href="#Scope-77"><span class="linenos"> 77</span></a> <span class="k">return</span> <span class="n">Scope</span><span class="p">(</span> +</span><span id="Scope-78"><a href="#Scope-78"><span class="linenos"> 78</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> +</span><span id="Scope-79"><a href="#Scope-79"><span class="linenos"> 79</span></a> <span class="n">sources</span><span class="o">=</span><span class="p">{</span><span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">cte_sources</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">chain_sources</span> <span class="ow">or</span> <span class="p">{})},</span> +</span><span id="Scope-80"><a href="#Scope-80"><span class="linenos"> 80</span></a> <span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Scope-81"><a href="#Scope-81"><span class="linenos"> 81</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">scope_type</span><span class="p">,</span> +</span><span id="Scope-82"><a href="#Scope-82"><span class="linenos"> 82</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="Scope-83"><a href="#Scope-83"><span class="linenos"> 83</span></a> <span class="p">)</span> +</span><span id="Scope-84"><a href="#Scope-84"><span class="linenos"> 84</span></a> +</span><span id="Scope-85"><a href="#Scope-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="nf">_collect</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-86"><a href="#Scope-86"><span class="linenos"> 86</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-87"><a href="#Scope-87"><span class="linenos"> 87</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-88"><a href="#Scope-88"><span class="linenos"> 88</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-89"><a href="#Scope-89"><span class="linenos"> 89</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-90"><a href="#Scope-90"><span class="linenos"> 90</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-91"><a href="#Scope-91"><span class="linenos"> 91</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-92"><a href="#Scope-92"><span class="linenos"> 92</span></a> +</span><span id="Scope-93"><a href="#Scope-93"><span class="linenos"> 93</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Scope-94"><a href="#Scope-94"><span class="linenos"> 94</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">is</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">:</span> +</span><span id="Scope-95"><a href="#Scope-95"><span class="linenos"> 95</span></a> <span class="k">continue</span> +</span><span id="Scope-96"><a href="#Scope-96"><span class="linenos"> 96</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="Scope-97"><a href="#Scope-97"><span class="linenos"> 97</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-98"><a href="#Scope-98"><span class="linenos"> 98</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">):</span> +</span><span id="Scope-99"><a href="#Scope-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-100"><a href="#Scope-100"><span class="linenos">100</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">):</span> +</span><span id="Scope-101"><a href="#Scope-101"><span class="linenos">101</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-102"><a href="#Scope-102"><span class="linenos">102</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="Scope-103"><a href="#Scope-103"><span class="linenos">103</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-104"><a href="#Scope-104"><span class="linenos">104</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">):</span> +</span><span id="Scope-105"><a href="#Scope-105"><span class="linenos">105</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-106"><a href="#Scope-106"><span class="linenos">106</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)):</span> +</span><span id="Scope-107"><a href="#Scope-107"><span class="linenos">107</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-108"><a href="#Scope-108"><span class="linenos">108</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="Scope-109"><a href="#Scope-109"><span class="linenos">109</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="Scope-110"><a href="#Scope-110"><span class="linenos">110</span></a> +</span><span id="Scope-111"><a href="#Scope-111"><span class="linenos">111</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Scope-112"><a href="#Scope-112"><span class="linenos">112</span></a> +</span><span id="Scope-113"><a href="#Scope-113"><span class="linenos">113</span></a> <span class="k">def</span> <span class="nf">_ensure_collected</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-114"><a href="#Scope-114"><span class="linenos">114</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span><span class="p">:</span> +</span><span id="Scope-115"><a href="#Scope-115"><span class="linenos">115</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collect</span><span class="p">()</span> +</span><span id="Scope-116"><a href="#Scope-116"><span class="linenos">116</span></a> +</span><span id="Scope-117"><a href="#Scope-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Scope-118"><a href="#Scope-118"><span class="linenos">118</span></a> <span class="k">return</span> <span class="n">walk_in_scope</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">)</span> +</span><span id="Scope-119"><a href="#Scope-119"><span class="linenos">119</span></a> +</span><span id="Scope-120"><a href="#Scope-120"><span class="linenos">120</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Scope-121"><a href="#Scope-121"><span class="linenos">121</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-122"><a href="#Scope-122"><span class="linenos">122</span></a><span class="sd"> Returns the first node in this scope which matches at least one of the specified types.</span> +</span><span id="Scope-123"><a href="#Scope-123"><span class="linenos">123</span></a> +</span><span id="Scope-124"><a href="#Scope-124"><span class="linenos">124</span></a><span class="sd"> This does NOT traverse into subscopes.</span> +</span><span id="Scope-125"><a href="#Scope-125"><span class="linenos">125</span></a> +</span><span id="Scope-126"><a href="#Scope-126"><span class="linenos">126</span></a><span class="sd"> Args:</span> +</span><span id="Scope-127"><a href="#Scope-127"><span class="linenos">127</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Scope-128"><a href="#Scope-128"><span class="linenos">128</span></a><span class="sd"> bfs (bool): True to use breadth-first search, False to use depth-first.</span> +</span><span id="Scope-129"><a href="#Scope-129"><span class="linenos">129</span></a> +</span><span id="Scope-130"><a href="#Scope-130"><span class="linenos">130</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-131"><a href="#Scope-131"><span class="linenos">131</span></a><span class="sd"> exp.Expression: the node which matches the criteria or None if no node matching</span> +</span><span id="Scope-132"><a href="#Scope-132"><span class="linenos">132</span></a><span class="sd"> the criteria was found.</span> +</span><span id="Scope-133"><a href="#Scope-133"><span class="linenos">133</span></a><span class="sd"> """</span> +</span><span id="Scope-134"><a href="#Scope-134"><span class="linenos">134</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Scope-135"><a href="#Scope-135"><span class="linenos">135</span></a> +</span><span id="Scope-136"><a href="#Scope-136"><span class="linenos">136</span></a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Scope-137"><a href="#Scope-137"><span class="linenos">137</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-138"><a href="#Scope-138"><span class="linenos">138</span></a><span class="sd"> Returns a generator object which visits all nodes in this scope and only yields those that</span> +</span><span id="Scope-139"><a href="#Scope-139"><span class="linenos">139</span></a><span class="sd"> match at least one of the specified expression types.</span> +</span><span id="Scope-140"><a href="#Scope-140"><span class="linenos">140</span></a> +</span><span id="Scope-141"><a href="#Scope-141"><span class="linenos">141</span></a><span class="sd"> This does NOT traverse into subscopes.</span> +</span><span id="Scope-142"><a href="#Scope-142"><span class="linenos">142</span></a> +</span><span id="Scope-143"><a href="#Scope-143"><span class="linenos">143</span></a><span class="sd"> Args:</span> +</span><span id="Scope-144"><a href="#Scope-144"><span class="linenos">144</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Scope-145"><a href="#Scope-145"><span class="linenos">145</span></a><span class="sd"> bfs (bool): True to use breadth-first search, False to use depth-first.</span> +</span><span id="Scope-146"><a href="#Scope-146"><span class="linenos">146</span></a> +</span><span id="Scope-147"><a href="#Scope-147"><span class="linenos">147</span></a><span class="sd"> Yields:</span> +</span><span id="Scope-148"><a href="#Scope-148"><span class="linenos">148</span></a><span class="sd"> exp.Expression: nodes</span> +</span><span id="Scope-149"><a href="#Scope-149"><span class="linenos">149</span></a><span class="sd"> """</span> +</span><span id="Scope-150"><a href="#Scope-150"><span class="linenos">150</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">):</span> +</span><span id="Scope-151"><a href="#Scope-151"><span class="linenos">151</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="Scope-152"><a href="#Scope-152"><span class="linenos">152</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span><span id="Scope-153"><a href="#Scope-153"><span class="linenos">153</span></a> +</span><span id="Scope-154"><a href="#Scope-154"><span class="linenos">154</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">old</span><span class="p">,</span> <span class="n">new</span><span class="p">):</span> +</span><span id="Scope-155"><a href="#Scope-155"><span class="linenos">155</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-156"><a href="#Scope-156"><span class="linenos">156</span></a><span class="sd"> Replace `old` with `new`.</span> +</span><span id="Scope-157"><a href="#Scope-157"><span class="linenos">157</span></a> +</span><span id="Scope-158"><a href="#Scope-158"><span class="linenos">158</span></a><span class="sd"> This can be used instead of `exp.Expression.replace` to ensure the `Scope` is kept up-to-date.</span> +</span><span id="Scope-159"><a href="#Scope-159"><span class="linenos">159</span></a> +</span><span id="Scope-160"><a href="#Scope-160"><span class="linenos">160</span></a><span class="sd"> Args:</span> +</span><span id="Scope-161"><a href="#Scope-161"><span class="linenos">161</span></a><span class="sd"> old (exp.Expression): old node</span> +</span><span id="Scope-162"><a href="#Scope-162"><span class="linenos">162</span></a><span class="sd"> new (exp.Expression): new node</span> +</span><span id="Scope-163"><a href="#Scope-163"><span class="linenos">163</span></a><span class="sd"> """</span> +</span><span id="Scope-164"><a href="#Scope-164"><span class="linenos">164</span></a> <span class="n">old</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">new</span><span class="p">)</span> +</span><span id="Scope-165"><a href="#Scope-165"><span class="linenos">165</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="Scope-166"><a href="#Scope-166"><span class="linenos">166</span></a> +</span><span id="Scope-167"><a href="#Scope-167"><span class="linenos">167</span></a> <span class="nd">@property</span> +</span><span id="Scope-168"><a href="#Scope-168"><span class="linenos">168</span></a> <span class="k">def</span> <span class="nf">tables</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-169"><a href="#Scope-169"><span class="linenos">169</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-170"><a href="#Scope-170"><span class="linenos">170</span></a><span class="sd"> List of tables in this scope.</span> +</span><span id="Scope-171"><a href="#Scope-171"><span class="linenos">171</span></a> +</span><span id="Scope-172"><a href="#Scope-172"><span class="linenos">172</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-173"><a href="#Scope-173"><span class="linenos">173</span></a><span class="sd"> list[exp.Table]: tables</span> +</span><span id="Scope-174"><a href="#Scope-174"><span class="linenos">174</span></a><span class="sd"> """</span> +</span><span id="Scope-175"><a href="#Scope-175"><span class="linenos">175</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="Scope-176"><a href="#Scope-176"><span class="linenos">176</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> +</span><span id="Scope-177"><a href="#Scope-177"><span class="linenos">177</span></a> +</span><span id="Scope-178"><a href="#Scope-178"><span class="linenos">178</span></a> <span class="nd">@property</span> +</span><span id="Scope-179"><a href="#Scope-179"><span class="linenos">179</span></a> <span class="k">def</span> <span class="nf">ctes</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-180"><a href="#Scope-180"><span class="linenos">180</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-181"><a href="#Scope-181"><span class="linenos">181</span></a><span class="sd"> List of CTEs in this scope.</span> +</span><span id="Scope-182"><a href="#Scope-182"><span class="linenos">182</span></a> +</span><span id="Scope-183"><a href="#Scope-183"><span class="linenos">183</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-184"><a href="#Scope-184"><span class="linenos">184</span></a><span class="sd"> list[exp.CTE]: ctes</span> +</span><span id="Scope-185"><a href="#Scope-185"><span class="linenos">185</span></a><span class="sd"> """</span> +</span><span id="Scope-186"><a href="#Scope-186"><span class="linenos">186</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="Scope-187"><a href="#Scope-187"><span class="linenos">187</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> +</span><span id="Scope-188"><a href="#Scope-188"><span class="linenos">188</span></a> +</span><span id="Scope-189"><a href="#Scope-189"><span class="linenos">189</span></a> <span class="nd">@property</span> +</span><span id="Scope-190"><a href="#Scope-190"><span class="linenos">190</span></a> <span class="k">def</span> <span class="nf">derived_tables</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-191"><a href="#Scope-191"><span class="linenos">191</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-192"><a href="#Scope-192"><span class="linenos">192</span></a><span class="sd"> List of derived tables in this scope.</span> +</span><span id="Scope-193"><a href="#Scope-193"><span class="linenos">193</span></a> +</span><span id="Scope-194"><a href="#Scope-194"><span class="linenos">194</span></a><span class="sd"> For example:</span> +</span><span id="Scope-195"><a href="#Scope-195"><span class="linenos">195</span></a><span class="sd"> SELECT * FROM (SELECT ...) <- that's a derived table</span> +</span><span id="Scope-196"><a href="#Scope-196"><span class="linenos">196</span></a> +</span><span id="Scope-197"><a href="#Scope-197"><span class="linenos">197</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-198"><a href="#Scope-198"><span class="linenos">198</span></a><span class="sd"> list[exp.Subquery]: derived tables</span> +</span><span id="Scope-199"><a href="#Scope-199"><span class="linenos">199</span></a><span class="sd"> """</span> +</span><span id="Scope-200"><a href="#Scope-200"><span class="linenos">200</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="Scope-201"><a href="#Scope-201"><span class="linenos">201</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> +</span><span id="Scope-202"><a href="#Scope-202"><span class="linenos">202</span></a> +</span><span id="Scope-203"><a href="#Scope-203"><span class="linenos">203</span></a> <span class="nd">@property</span> +</span><span id="Scope-204"><a href="#Scope-204"><span class="linenos">204</span></a> <span class="k">def</span> <span class="nf">subqueries</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-205"><a href="#Scope-205"><span class="linenos">205</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-206"><a href="#Scope-206"><span class="linenos">206</span></a><span class="sd"> List of subqueries in this scope.</span> +</span><span id="Scope-207"><a href="#Scope-207"><span class="linenos">207</span></a> +</span><span id="Scope-208"><a href="#Scope-208"><span class="linenos">208</span></a><span class="sd"> For example:</span> +</span><span id="Scope-209"><a href="#Scope-209"><span class="linenos">209</span></a><span class="sd"> SELECT * FROM x WHERE a IN (SELECT ...) <- that's a subquery</span> +</span><span id="Scope-210"><a href="#Scope-210"><span class="linenos">210</span></a> +</span><span id="Scope-211"><a href="#Scope-211"><span class="linenos">211</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-212"><a href="#Scope-212"><span class="linenos">212</span></a><span class="sd"> list[exp.Subqueryable]: subqueries</span> +</span><span id="Scope-213"><a href="#Scope-213"><span class="linenos">213</span></a><span class="sd"> """</span> +</span><span id="Scope-214"><a href="#Scope-214"><span class="linenos">214</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="Scope-215"><a href="#Scope-215"><span class="linenos">215</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> +</span><span id="Scope-216"><a href="#Scope-216"><span class="linenos">216</span></a> +</span><span id="Scope-217"><a href="#Scope-217"><span class="linenos">217</span></a> <span class="nd">@property</span> +</span><span id="Scope-218"><a href="#Scope-218"><span class="linenos">218</span></a> <span class="k">def</span> <span class="nf">columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-219"><a href="#Scope-219"><span class="linenos">219</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-220"><a href="#Scope-220"><span class="linenos">220</span></a><span class="sd"> List of columns in this scope.</span> +</span><span id="Scope-221"><a href="#Scope-221"><span class="linenos">221</span></a> +</span><span id="Scope-222"><a href="#Scope-222"><span class="linenos">222</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-223"><a href="#Scope-223"><span class="linenos">223</span></a><span class="sd"> list[exp.Column]: Column instances in this scope, plus any</span> +</span><span id="Scope-224"><a href="#Scope-224"><span class="linenos">224</span></a><span class="sd"> Columns that reference this scope from correlated subqueries.</span> +</span><span id="Scope-225"><a href="#Scope-225"><span class="linenos">225</span></a><span class="sd"> """</span> +</span><span id="Scope-226"><a href="#Scope-226"><span class="linenos">226</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Scope-227"><a href="#Scope-227"><span class="linenos">227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_collected</span><span class="p">()</span> +</span><span id="Scope-228"><a href="#Scope-228"><span class="linenos">228</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> +</span><span id="Scope-229"><a href="#Scope-229"><span class="linenos">229</span></a> +</span><span id="Scope-230"><a href="#Scope-230"><span class="linenos">230</span></a> <span class="n">external_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Scope-231"><a href="#Scope-231"><span class="linenos">231</span></a> <span class="n">column</span> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span> +</span><span id="Scope-232"><a href="#Scope-232"><span class="linenos">232</span></a> <span class="p">]</span> +</span><span id="Scope-233"><a href="#Scope-233"><span class="linenos">233</span></a> +</span><span id="Scope-234"><a href="#Scope-234"><span class="linenos">234</span></a> <span class="n">named_selects</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span><span class="p">)</span> +</span><span id="Scope-235"><a href="#Scope-235"><span class="linenos">235</span></a> +</span><span id="Scope-236"><a href="#Scope-236"><span class="linenos">236</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-237"><a href="#Scope-237"><span class="linenos">237</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">columns</span> <span class="o">+</span> <span class="n">external_columns</span><span class="p">:</span> +</span><span id="Scope-238"><a href="#Scope-238"><span class="linenos">238</span></a> <span class="n">ancestor</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">)</span> +</span><span id="Scope-239"><a href="#Scope-239"><span class="linenos">239</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Scope-240"><a href="#Scope-240"><span class="linenos">240</span></a> <span class="ow">not</span> <span class="n">ancestor</span> +</span><span id="Scope-241"><a href="#Scope-241"><span class="linenos">241</span></a> <span class="c1"># Window functions can have an ORDER BY clause</span> +</span><span id="Scope-242"><a href="#Scope-242"><span class="linenos">242</span></a> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="Scope-243"><a href="#Scope-243"><span class="linenos">243</span></a> <span class="ow">or</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> +</span><span id="Scope-244"><a href="#Scope-244"><span class="linenos">244</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">column</span><span class="o">.</span><span class="n">name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">named_selects</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ancestor</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">))</span> +</span><span id="Scope-245"><a href="#Scope-245"><span class="linenos">245</span></a> <span class="p">):</span> +</span><span id="Scope-246"><a href="#Scope-246"><span class="linenos">246</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">column</span><span class="p">)</span> +</span><span id="Scope-247"><a href="#Scope-247"><span class="linenos">247</span></a> +</span><span id="Scope-248"><a href="#Scope-248"><span class="linenos">248</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> +</span><span id="Scope-249"><a href="#Scope-249"><span class="linenos">249</span></a> +</span><span id="Scope-250"><a href="#Scope-250"><span class="linenos">250</span></a> <span class="nd">@property</span> +</span><span id="Scope-251"><a href="#Scope-251"><span class="linenos">251</span></a> <span class="k">def</span> <span class="nf">selected_sources</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-252"><a href="#Scope-252"><span class="linenos">252</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-253"><a href="#Scope-253"><span class="linenos">253</span></a><span class="sd"> Mapping of nodes and sources that are actually selected from in this scope.</span> +</span><span id="Scope-254"><a href="#Scope-254"><span class="linenos">254</span></a> +</span><span id="Scope-255"><a href="#Scope-255"><span class="linenos">255</span></a><span class="sd"> That is, all tables in a schema are selectable at any point. But a</span> +</span><span id="Scope-256"><a href="#Scope-256"><span class="linenos">256</span></a><span class="sd"> table only becomes a selected source if it's included in a FROM or JOIN clause.</span> +</span><span id="Scope-257"><a href="#Scope-257"><span class="linenos">257</span></a> +</span><span id="Scope-258"><a href="#Scope-258"><span class="linenos">258</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-259"><a href="#Scope-259"><span class="linenos">259</span></a><span class="sd"> dict[str, (exp.Table|exp.Select, exp.Table|Scope)]: selected sources and nodes</span> +</span><span id="Scope-260"><a href="#Scope-260"><span class="linenos">260</span></a><span class="sd"> """</span> +</span><span id="Scope-261"><a href="#Scope-261"><span class="linenos">261</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Scope-262"><a href="#Scope-262"><span class="linenos">262</span></a> <span class="n">referenced_names</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope-263"><a href="#Scope-263"><span class="linenos">263</span></a> +</span><span id="Scope-264"><a href="#Scope-264"><span class="linenos">264</span></a> <span class="k">for</span> <span class="n">table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tables</span><span class="p">:</span> +</span><span id="Scope-265"><a href="#Scope-265"><span class="linenos">265</span></a> <span class="n">referenced_names</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">table</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">table</span><span class="p">))</span> +</span><span id="Scope-266"><a href="#Scope-266"><span class="linenos">266</span></a> <span class="k">for</span> <span class="n">derived_table</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">derived_tables</span><span class="p">:</span> +</span><span id="Scope-267"><a href="#Scope-267"><span class="linenos">267</span></a> <span class="n">referenced_names</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">derived_table</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">derived_table</span><span class="o">.</span><span class="n">unnest</span><span class="p">()))</span> +</span><span id="Scope-268"><a href="#Scope-268"><span class="linenos">268</span></a> +</span><span id="Scope-269"><a href="#Scope-269"><span class="linenos">269</span></a> <span class="n">result</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Scope-270"><a href="#Scope-270"><span class="linenos">270</span></a> +</span><span id="Scope-271"><a href="#Scope-271"><span class="linenos">271</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">referenced_names</span><span class="p">:</span> +</span><span id="Scope-272"><a href="#Scope-272"><span class="linenos">272</span></a> <span class="k">if</span> <span class="n">name</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">:</span> +</span><span id="Scope-273"><a href="#Scope-273"><span class="linenos">273</span></a> <span class="n">result</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">name</span><span class="p">])</span> +</span><span id="Scope-274"><a href="#Scope-274"><span class="linenos">274</span></a> +</span><span id="Scope-275"><a href="#Scope-275"><span class="linenos">275</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="o">=</span> <span class="n">result</span> +</span><span id="Scope-276"><a href="#Scope-276"><span class="linenos">276</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> +</span><span id="Scope-277"><a href="#Scope-277"><span class="linenos">277</span></a> +</span><span id="Scope-278"><a href="#Scope-278"><span class="linenos">278</span></a> <span class="nd">@property</span> +</span><span id="Scope-279"><a href="#Scope-279"><span class="linenos">279</span></a> <span class="k">def</span> <span class="nf">cte_sources</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-280"><a href="#Scope-280"><span class="linenos">280</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-281"><a href="#Scope-281"><span class="linenos">281</span></a><span class="sd"> Sources that are CTEs.</span> +</span><span id="Scope-282"><a href="#Scope-282"><span class="linenos">282</span></a> +</span><span id="Scope-283"><a href="#Scope-283"><span class="linenos">283</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-284"><a href="#Scope-284"><span class="linenos">284</span></a><span class="sd"> dict[str, Scope]: Mapping of source alias to Scope</span> +</span><span id="Scope-285"><a href="#Scope-285"><span class="linenos">285</span></a><span class="sd"> """</span> +</span><span id="Scope-286"><a href="#Scope-286"><span class="linenos">286</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="Scope-287"><a href="#Scope-287"><span class="linenos">287</span></a> <span class="n">alias</span><span class="p">:</span> <span class="n">scope</span> +</span><span id="Scope-288"><a href="#Scope-288"><span class="linenos">288</span></a> <span class="k">for</span> <span class="n">alias</span><span class="p">,</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Scope-289"><a href="#Scope-289"><span class="linenos">289</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">scope</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">scope</span><span class="o">.</span><span class="n">is_cte</span> +</span><span id="Scope-290"><a href="#Scope-290"><span class="linenos">290</span></a> <span class="p">}</span> +</span><span id="Scope-291"><a href="#Scope-291"><span class="linenos">291</span></a> +</span><span id="Scope-292"><a href="#Scope-292"><span class="linenos">292</span></a> <span class="nd">@property</span> +</span><span id="Scope-293"><a href="#Scope-293"><span class="linenos">293</span></a> <span class="k">def</span> <span class="nf">selects</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-294"><a href="#Scope-294"><span class="linenos">294</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-295"><a href="#Scope-295"><span class="linenos">295</span></a><span class="sd"> Select expressions of this scope.</span> +</span><span id="Scope-296"><a href="#Scope-296"><span class="linenos">296</span></a> +</span><span id="Scope-297"><a href="#Scope-297"><span class="linenos">297</span></a><span class="sd"> For example, for the following expression:</span> +</span><span id="Scope-298"><a href="#Scope-298"><span class="linenos">298</span></a><span class="sd"> SELECT 1 as a, 2 as b FROM x</span> +</span><span id="Scope-299"><a href="#Scope-299"><span class="linenos">299</span></a> +</span><span id="Scope-300"><a href="#Scope-300"><span class="linenos">300</span></a><span class="sd"> The outputs are the "1 as a" and "2 as b" expressions.</span> +</span><span id="Scope-301"><a href="#Scope-301"><span class="linenos">301</span></a> +</span><span id="Scope-302"><a href="#Scope-302"><span class="linenos">302</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-303"><a href="#Scope-303"><span class="linenos">303</span></a><span class="sd"> list[exp.Expression]: expressions</span> +</span><span id="Scope-304"><a href="#Scope-304"><span class="linenos">304</span></a><span class="sd"> """</span> +</span><span id="Scope-305"><a href="#Scope-305"><span class="linenos">305</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="Scope-306"><a href="#Scope-306"><span class="linenos">306</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span><span class="o">.</span><span class="n">selects</span> +</span><span id="Scope-307"><a href="#Scope-307"><span class="linenos">307</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="Scope-308"><a href="#Scope-308"><span class="linenos">308</span></a> +</span><span id="Scope-309"><a href="#Scope-309"><span class="linenos">309</span></a> <span class="nd">@property</span> +</span><span id="Scope-310"><a href="#Scope-310"><span class="linenos">310</span></a> <span class="k">def</span> <span class="nf">external_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-311"><a href="#Scope-311"><span class="linenos">311</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-312"><a href="#Scope-312"><span class="linenos">312</span></a><span class="sd"> Columns that appear to reference sources in outer scopes.</span> +</span><span id="Scope-313"><a href="#Scope-313"><span class="linenos">313</span></a> +</span><span id="Scope-314"><a href="#Scope-314"><span class="linenos">314</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-315"><a href="#Scope-315"><span class="linenos">315</span></a><span class="sd"> list[exp.Column]: Column instances that don't reference</span> +</span><span id="Scope-316"><a href="#Scope-316"><span class="linenos">316</span></a><span class="sd"> sources in the current scope.</span> +</span><span id="Scope-317"><a href="#Scope-317"><span class="linenos">317</span></a><span class="sd"> """</span> +</span><span id="Scope-318"><a href="#Scope-318"><span class="linenos">318</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Scope-319"><a href="#Scope-319"><span class="linenos">319</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Scope-320"><a href="#Scope-320"><span class="linenos">320</span></a> <span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">selected_sources</span> +</span><span id="Scope-321"><a href="#Scope-321"><span class="linenos">321</span></a> <span class="p">]</span> +</span><span id="Scope-322"><a href="#Scope-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> +</span><span id="Scope-323"><a href="#Scope-323"><span class="linenos">323</span></a> +</span><span id="Scope-324"><a href="#Scope-324"><span class="linenos">324</span></a> <span class="nd">@property</span> +</span><span id="Scope-325"><a href="#Scope-325"><span class="linenos">325</span></a> <span class="k">def</span> <span class="nf">unqualified_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-326"><a href="#Scope-326"><span class="linenos">326</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-327"><a href="#Scope-327"><span class="linenos">327</span></a><span class="sd"> Unqualified columns in the current scope.</span> +</span><span id="Scope-328"><a href="#Scope-328"><span class="linenos">328</span></a> +</span><span id="Scope-329"><a href="#Scope-329"><span class="linenos">329</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-330"><a href="#Scope-330"><span class="linenos">330</span></a><span class="sd"> list[exp.Column]: Unqualified columns</span> +</span><span id="Scope-331"><a href="#Scope-331"><span class="linenos">331</span></a><span class="sd"> """</span> +</span><span id="Scope-332"><a href="#Scope-332"><span class="linenos">332</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">c</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span><span class="p">]</span> +</span><span id="Scope-333"><a href="#Scope-333"><span class="linenos">333</span></a> +</span><span id="Scope-334"><a href="#Scope-334"><span class="linenos">334</span></a> <span class="nd">@property</span> +</span><span id="Scope-335"><a href="#Scope-335"><span class="linenos">335</span></a> <span class="k">def</span> <span class="nf">join_hints</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-336"><a href="#Scope-336"><span class="linenos">336</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-337"><a href="#Scope-337"><span class="linenos">337</span></a><span class="sd"> Hints that exist in the scope that reference tables</span> +</span><span id="Scope-338"><a href="#Scope-338"><span class="linenos">338</span></a> +</span><span id="Scope-339"><a href="#Scope-339"><span class="linenos">339</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-340"><a href="#Scope-340"><span class="linenos">340</span></a><span class="sd"> list[exp.JoinHint]: Join hints that are referenced within the scope</span> +</span><span id="Scope-341"><a href="#Scope-341"><span class="linenos">341</span></a><span class="sd"> """</span> +</span><span id="Scope-342"><a href="#Scope-342"><span class="linenos">342</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Scope-343"><a href="#Scope-343"><span class="linenos">343</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="Scope-344"><a href="#Scope-344"><span class="linenos">344</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> +</span><span id="Scope-345"><a href="#Scope-345"><span class="linenos">345</span></a> +</span><span id="Scope-346"><a href="#Scope-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">source_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source_name</span><span class="p">):</span> +</span><span id="Scope-347"><a href="#Scope-347"><span class="linenos">347</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-348"><a href="#Scope-348"><span class="linenos">348</span></a><span class="sd"> Get all columns in the current scope for a particular source.</span> +</span><span id="Scope-349"><a href="#Scope-349"><span class="linenos">349</span></a> +</span><span id="Scope-350"><a href="#Scope-350"><span class="linenos">350</span></a><span class="sd"> Args:</span> +</span><span id="Scope-351"><a href="#Scope-351"><span class="linenos">351</span></a><span class="sd"> source_name (str): Name of the source</span> +</span><span id="Scope-352"><a href="#Scope-352"><span class="linenos">352</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-353"><a href="#Scope-353"><span class="linenos">353</span></a><span class="sd"> list[exp.Column]: Column instances that reference `source_name`</span> +</span><span id="Scope-354"><a href="#Scope-354"><span class="linenos">354</span></a><span class="sd"> """</span> +</span><span id="Scope-355"><a href="#Scope-355"><span class="linenos">355</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">source_name</span><span class="p">]</span> +</span><span id="Scope-356"><a href="#Scope-356"><span class="linenos">356</span></a> +</span><span id="Scope-357"><a href="#Scope-357"><span class="linenos">357</span></a> <span class="nd">@property</span> +</span><span id="Scope-358"><a href="#Scope-358"><span class="linenos">358</span></a> <span class="k">def</span> <span class="nf">is_subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-359"><a href="#Scope-359"><span class="linenos">359</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a subquery"""</span> +</span><span id="Scope-360"><a href="#Scope-360"><span class="linenos">360</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">SUBQUERY</span> +</span><span id="Scope-361"><a href="#Scope-361"><span class="linenos">361</span></a> +</span><span id="Scope-362"><a href="#Scope-362"><span class="linenos">362</span></a> <span class="nd">@property</span> +</span><span id="Scope-363"><a href="#Scope-363"><span class="linenos">363</span></a> <span class="k">def</span> <span class="nf">is_derived_table</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-364"><a href="#Scope-364"><span class="linenos">364</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a derived table"""</span> +</span><span id="Scope-365"><a href="#Scope-365"><span class="linenos">365</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span> +</span><span id="Scope-366"><a href="#Scope-366"><span class="linenos">366</span></a> +</span><span id="Scope-367"><a href="#Scope-367"><span class="linenos">367</span></a> <span class="nd">@property</span> +</span><span id="Scope-368"><a href="#Scope-368"><span class="linenos">368</span></a> <span class="k">def</span> <span class="nf">is_union</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-369"><a href="#Scope-369"><span class="linenos">369</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a union"""</span> +</span><span id="Scope-370"><a href="#Scope-370"><span class="linenos">370</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">UNION</span> +</span><span id="Scope-371"><a href="#Scope-371"><span class="linenos">371</span></a> +</span><span id="Scope-372"><a href="#Scope-372"><span class="linenos">372</span></a> <span class="nd">@property</span> +</span><span id="Scope-373"><a href="#Scope-373"><span class="linenos">373</span></a> <span class="k">def</span> <span class="nf">is_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-374"><a href="#Scope-374"><span class="linenos">374</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a common table expression"""</span> +</span><span id="Scope-375"><a href="#Scope-375"><span class="linenos">375</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span> +</span><span id="Scope-376"><a href="#Scope-376"><span class="linenos">376</span></a> +</span><span id="Scope-377"><a href="#Scope-377"><span class="linenos">377</span></a> <span class="nd">@property</span> +</span><span id="Scope-378"><a href="#Scope-378"><span class="linenos">378</span></a> <span class="k">def</span> <span class="nf">is_root</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-379"><a href="#Scope-379"><span class="linenos">379</span></a><span class="w"> </span><span class="sd">"""Determine if this is the root scope"""</span> +</span><span id="Scope-380"><a href="#Scope-380"><span class="linenos">380</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">ROOT</span> +</span><span id="Scope-381"><a href="#Scope-381"><span class="linenos">381</span></a> +</span><span id="Scope-382"><a href="#Scope-382"><span class="linenos">382</span></a> <span class="nd">@property</span> +</span><span id="Scope-383"><a href="#Scope-383"><span class="linenos">383</span></a> <span class="k">def</span> <span class="nf">is_udtf</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-384"><a href="#Scope-384"><span class="linenos">384</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a UDTF (User Defined Table Function)"""</span> +</span><span id="Scope-385"><a href="#Scope-385"><span class="linenos">385</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">UDTF</span> +</span><span id="Scope-386"><a href="#Scope-386"><span class="linenos">386</span></a> +</span><span id="Scope-387"><a href="#Scope-387"><span class="linenos">387</span></a> <span class="nd">@property</span> +</span><span id="Scope-388"><a href="#Scope-388"><span class="linenos">388</span></a> <span class="k">def</span> <span class="nf">is_correlated_subquery</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-389"><a href="#Scope-389"><span class="linenos">389</span></a><span class="w"> </span><span class="sd">"""Determine if this scope is a correlated subquery"""</span> +</span><span id="Scope-390"><a href="#Scope-390"><span class="linenos">390</span></a> <span class="k">return</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">is_subquery</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">external_columns</span><span class="p">)</span> +</span><span id="Scope-391"><a href="#Scope-391"><span class="linenos">391</span></a> +</span><span id="Scope-392"><a href="#Scope-392"><span class="linenos">392</span></a> <span class="k">def</span> <span class="nf">rename_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">old_name</span><span class="p">,</span> <span class="n">new_name</span><span class="p">):</span> +</span><span id="Scope-393"><a href="#Scope-393"><span class="linenos">393</span></a><span class="w"> </span><span class="sd">"""Rename a source in this scope"""</span> +</span><span id="Scope-394"><a href="#Scope-394"><span class="linenos">394</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">old_name</span> <span class="ow">or</span> <span class="s2">""</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="Scope-395"><a href="#Scope-395"><span class="linenos">395</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">columns</span> +</span><span id="Scope-396"><a href="#Scope-396"><span class="linenos">396</span></a> +</span><span id="Scope-397"><a href="#Scope-397"><span class="linenos">397</span></a> <span class="k">def</span> <span class="nf">add_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">source</span><span class="p">):</span> +</span><span id="Scope-398"><a href="#Scope-398"><span class="linenos">398</span></a><span class="w"> </span><span class="sd">"""Add a source to this scope"""</span> +</span><span id="Scope-399"><a href="#Scope-399"><span class="linenos">399</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span> +</span><span id="Scope-400"><a href="#Scope-400"><span class="linenos">400</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="Scope-401"><a href="#Scope-401"><span class="linenos">401</span></a> +</span><span id="Scope-402"><a href="#Scope-402"><span class="linenos">402</span></a> <span class="k">def</span> <span class="nf">remove_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span> +</span><span id="Scope-403"><a href="#Scope-403"><span class="linenos">403</span></a><span class="w"> </span><span class="sd">"""Remove a source from this scope"""</span> +</span><span id="Scope-404"><a href="#Scope-404"><span class="linenos">404</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Scope-405"><a href="#Scope-405"><span class="linenos">405</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span><span id="Scope-406"><a href="#Scope-406"><span class="linenos">406</span></a> +</span><span id="Scope-407"><a href="#Scope-407"><span class="linenos">407</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-408"><a href="#Scope-408"><span class="linenos">408</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"Scope<</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">>"</span> +</span><span id="Scope-409"><a href="#Scope-409"><span class="linenos">409</span></a> +</span><span id="Scope-410"><a href="#Scope-410"><span class="linenos">410</span></a> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-411"><a href="#Scope-411"><span class="linenos">411</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-412"><a href="#Scope-412"><span class="linenos">412</span></a><span class="sd"> Traverse the scope tree from this node.</span> +</span><span id="Scope-413"><a href="#Scope-413"><span class="linenos">413</span></a> +</span><span id="Scope-414"><a href="#Scope-414"><span class="linenos">414</span></a><span class="sd"> Yields:</span> +</span><span id="Scope-415"><a href="#Scope-415"><span class="linenos">415</span></a><span class="sd"> Scope: scope instances in depth-first-search post-order</span> +</span><span id="Scope-416"><a href="#Scope-416"><span class="linenos">416</span></a><span class="sd"> """</span> +</span><span id="Scope-417"><a href="#Scope-417"><span class="linenos">417</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">(</span> +</span><span id="Scope-418"><a href="#Scope-418"><span class="linenos">418</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">derived_table_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> +</span><span id="Scope-419"><a href="#Scope-419"><span class="linenos">419</span></a> <span class="p">):</span> +</span><span id="Scope-420"><a href="#Scope-420"><span class="linenos">420</span></a> <span class="k">yield from</span> <span class="n">child_scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">()</span> +</span><span id="Scope-421"><a href="#Scope-421"><span class="linenos">421</span></a> <span class="k">yield</span> <span class="bp">self</span> +</span><span id="Scope-422"><a href="#Scope-422"><span class="linenos">422</span></a> +</span><span id="Scope-423"><a href="#Scope-423"><span class="linenos">423</span></a> <span class="k">def</span> <span class="nf">ref_count</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope-424"><a href="#Scope-424"><span class="linenos">424</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope-425"><a href="#Scope-425"><span class="linenos">425</span></a><span class="sd"> Count the number of times each scope in this tree is referenced.</span> +</span><span id="Scope-426"><a href="#Scope-426"><span class="linenos">426</span></a> +</span><span id="Scope-427"><a href="#Scope-427"><span class="linenos">427</span></a><span class="sd"> Returns:</span> +</span><span id="Scope-428"><a href="#Scope-428"><span class="linenos">428</span></a><span class="sd"> dict[int, int]: Mapping of Scope instance ID to reference count</span> +</span><span id="Scope-429"><a href="#Scope-429"><span class="linenos">429</span></a><span class="sd"> """</span> +</span><span id="Scope-430"><a href="#Scope-430"><span class="linenos">430</span></a> <span class="n">scope_ref_count</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Scope-431"><a href="#Scope-431"><span class="linenos">431</span></a> +</span><span id="Scope-432"><a href="#Scope-432"><span class="linenos">432</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="Scope-433"><a href="#Scope-433"><span class="linenos">433</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Scope-434"><a href="#Scope-434"><span class="linenos">434</span></a> <span class="n">scope_ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Scope-435"><a href="#Scope-435"><span class="linenos">435</span></a> +</span><span id="Scope-436"><a href="#Scope-436"><span class="linenos">436</span></a> <span class="k">return</span> <span class="n">scope_ref_count</span> +</span></pre></div> + + + <div class="docstring"><p>Selection scope.</p> + +<h6 id="attributes">Attributes:</h6> + +<ul> +<li><strong>expression (exp.Select|exp.Union):</strong> Root expression of this scope</li> +<li><strong>sources (dict[str, exp.Table|Scope]):</strong> Mapping of source name to either +a Table expression or another Scope instance. For example: + SELECT * FROM x {"x": Table(this="x")} + SELECT * FROM x AS y {"y": Table(this="x")} + SELECT * FROM (SELECT ...) AS y {"y": Scope(...)}</li> +<li><strong>outer_column_list (list[str]):</strong> If this is a derived table or CTE, and the outer query +defines a column list of it's alias of this scope, this is that list of columns. +For example: + SELECT * FROM (SELECT ...) AS y(col1, col2) +The inner query would have <code>["col1", "col2"]</code> for its <code>outer_column_list</code></li> +<li><strong>parent (Scope):</strong> Parent scope</li> +<li><strong>scope_type (ScopeType):</strong> Type of this scope, relative to it's parent</li> +<li><strong>subquery_scopes (list[Scope]):</strong> List of all child scopes for subqueries</li> +<li>cte_scopes = (list[Scope]) List of all child scopes for CTEs</li> +<li>derived_table_scopes = (list[Scope]) List of all child scopes for derived_tables</li> +<li><strong>union_scopes (list[Scope, Scope]):</strong> If this Scope is for a Union expression, this will be +a list of the left and right child scopes.</li> +</ul> +</div> + + + <div id="Scope.__init__" class="classattr"> + <input id="Scope.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Scope</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span>,</span><span class="param"> <span class="n">sources</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">outer_column_list</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span>,</span><span class="param"> <span class="n">scope_type</span><span class="o">=<</span><span class="n"><a href="#ScopeType.ROOT">ScopeType.ROOT</a></span><span class="p">:</span> <span class="mi">1</span><span class="o">></span></span>)</span> + + <label class="view-source-button" for="Scope.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.__init__-44"><a href="#Scope.__init__-44"><span class="linenos">44</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Scope.__init__-45"><a href="#Scope.__init__-45"><span class="linenos">45</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Scope.__init__-46"><a href="#Scope.__init__-46"><span class="linenos">46</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Scope.__init__-47"><a href="#Scope.__init__-47"><span class="linenos">47</span></a> <span class="n">sources</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Scope.__init__-48"><a href="#Scope.__init__-48"><span class="linenos">48</span></a> <span class="n">outer_column_list</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Scope.__init__-49"><a href="#Scope.__init__-49"><span class="linenos">49</span></a> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> +</span><span id="Scope.__init__-50"><a href="#Scope.__init__-50"><span class="linenos">50</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">ScopeType</span><span class="o">.</span><span class="n">ROOT</span><span class="p">,</span> +</span><span id="Scope.__init__-51"><a href="#Scope.__init__-51"><span class="linenos">51</span></a> <span class="p">):</span> +</span><span id="Scope.__init__-52"><a href="#Scope.__init__-52"><span class="linenos">52</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Scope.__init__-53"><a href="#Scope.__init__-53"><span class="linenos">53</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span> <span class="o">=</span> <span class="n">sources</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="Scope.__init__-54"><a href="#Scope.__init__-54"><span class="linenos">54</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">outer_column_list</span> <span class="o">=</span> <span class="n">outer_column_list</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="Scope.__init__-55"><a href="#Scope.__init__-55"><span class="linenos">55</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span> +</span><span id="Scope.__init__-56"><a href="#Scope.__init__-56"><span class="linenos">56</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">=</span> <span class="n">scope_type</span> +</span><span id="Scope.__init__-57"><a href="#Scope.__init__-57"><span class="linenos">57</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope.__init__-58"><a href="#Scope.__init__-58"><span class="linenos">58</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">derived_table_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope.__init__-59"><a href="#Scope.__init__-59"><span class="linenos">59</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">cte_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope.__init__-60"><a href="#Scope.__init__-60"><span class="linenos">60</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">union_scopes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Scope.__init__-61"><a href="#Scope.__init__-61"><span class="linenos">61</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="Scope.clear_cache" class="classattr"> + <input id="Scope.clear_cache-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">clear_cache</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.clear_cache-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.clear_cache"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.clear_cache-63"><a href="#Scope.clear_cache-63"><span class="linenos">63</span></a> <span class="k">def</span> <span class="nf">clear_cache</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope.clear_cache-64"><a href="#Scope.clear_cache-64"><span class="linenos">64</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_collected</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Scope.clear_cache-65"><a href="#Scope.clear_cache-65"><span class="linenos">65</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_raw_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-66"><a href="#Scope.clear_cache-66"><span class="linenos">66</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_derived_tables</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-67"><a href="#Scope.clear_cache-67"><span class="linenos">67</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tables</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-68"><a href="#Scope.clear_cache-68"><span class="linenos">68</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_ctes</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-69"><a href="#Scope.clear_cache-69"><span class="linenos">69</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_subqueries</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-70"><a href="#Scope.clear_cache-70"><span class="linenos">70</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_selected_sources</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-71"><a href="#Scope.clear_cache-71"><span class="linenos">71</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-72"><a href="#Scope.clear_cache-72"><span class="linenos">72</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_external_columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scope.clear_cache-73"><a href="#Scope.clear_cache-73"><span class="linenos">73</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_join_hints</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div id="Scope.branch" class="classattr"> + <input id="Scope.branch-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">branch</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">scope_type</span>, </span><span class="param"><span class="n">chain_sources</span><span class="o">=</span><span class="kc">None</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.branch-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.branch"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.branch-75"><a href="#Scope.branch-75"><span class="linenos">75</span></a> <span class="k">def</span> <span class="nf">branch</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">,</span> <span class="n">scope_type</span><span class="p">,</span> <span class="n">chain_sources</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="Scope.branch-76"><a href="#Scope.branch-76"><span class="linenos">76</span></a><span class="w"> </span><span class="sd">"""Branch from the current scope to a new, inner scope"""</span> +</span><span id="Scope.branch-77"><a href="#Scope.branch-77"><span class="linenos">77</span></a> <span class="k">return</span> <span class="n">Scope</span><span class="p">(</span> +</span><span id="Scope.branch-78"><a href="#Scope.branch-78"><span class="linenos">78</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">unnest</span><span class="p">(),</span> +</span><span id="Scope.branch-79"><a href="#Scope.branch-79"><span class="linenos">79</span></a> <span class="n">sources</span><span class="o">=</span><span class="p">{</span><span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">cte_sources</span><span class="p">,</span> <span class="o">**</span><span class="p">(</span><span class="n">chain_sources</span> <span class="ow">or</span> <span class="p">{})},</span> +</span><span id="Scope.branch-80"><a href="#Scope.branch-80"><span class="linenos">80</span></a> <span class="n">parent</span><span class="o">=</span><span class="bp">self</span><span class="p">,</span> +</span><span id="Scope.branch-81"><a href="#Scope.branch-81"><span class="linenos">81</span></a> <span class="n">scope_type</span><span class="o">=</span><span class="n">scope_type</span><span class="p">,</span> +</span><span id="Scope.branch-82"><a href="#Scope.branch-82"><span class="linenos">82</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="Scope.branch-83"><a href="#Scope.branch-83"><span class="linenos">83</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Branch from the current scope to a new, inner scope</p> +</div> + + + </div> + <div id="Scope.walk" class="classattr"> + <input id="Scope.walk-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">walk</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.walk-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.walk"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.walk-117"><a href="#Scope.walk-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">walk</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Scope.walk-118"><a href="#Scope.walk-118"><span class="linenos">118</span></a> <span class="k">return</span> <span class="n">walk_in_scope</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Scope.find" class="classattr"> + <input id="Scope.find-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expression_types</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.find-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.find"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.find-120"><a href="#Scope.find-120"><span class="linenos">120</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Scope.find-121"><a href="#Scope.find-121"><span class="linenos">121</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope.find-122"><a href="#Scope.find-122"><span class="linenos">122</span></a><span class="sd"> Returns the first node in this scope which matches at least one of the specified types.</span> +</span><span id="Scope.find-123"><a href="#Scope.find-123"><span class="linenos">123</span></a> +</span><span id="Scope.find-124"><a href="#Scope.find-124"><span class="linenos">124</span></a><span class="sd"> This does NOT traverse into subscopes.</span> +</span><span id="Scope.find-125"><a href="#Scope.find-125"><span class="linenos">125</span></a> +</span><span id="Scope.find-126"><a href="#Scope.find-126"><span class="linenos">126</span></a><span class="sd"> Args:</span> +</span><span id="Scope.find-127"><a href="#Scope.find-127"><span class="linenos">127</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Scope.find-128"><a href="#Scope.find-128"><span class="linenos">128</span></a><span class="sd"> bfs (bool): True to use breadth-first search, False to use depth-first.</span> +</span><span id="Scope.find-129"><a href="#Scope.find-129"><span class="linenos">129</span></a> +</span><span id="Scope.find-130"><a href="#Scope.find-130"><span class="linenos">130</span></a><span class="sd"> Returns:</span> +</span><span id="Scope.find-131"><a href="#Scope.find-131"><span class="linenos">131</span></a><span class="sd"> exp.Expression: the node which matches the criteria or None if no node matching</span> +</span><span id="Scope.find-132"><a href="#Scope.find-132"><span class="linenos">132</span></a><span class="sd"> the criteria was found.</span> +</span><span id="Scope.find-133"><a href="#Scope.find-133"><span class="linenos">133</span></a><span class="sd"> """</span> +</span><span id="Scope.find-134"><a href="#Scope.find-134"><span class="linenos">134</span></a> <span class="k">return</span> <span class="nb">next</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">),</span> <span class="kc">None</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns the first node in this scope which matches at least one of the specified types.</p> + +<p>This does NOT traverse into subscopes.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression_types (type):</strong> the expression type(s) to match.</li> +<li><strong>bfs (bool):</strong> True to use breadth-first search, False to use depth-first.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>exp.Expression: the node which matches the criteria or None if no node matching + the criteria was found.</p> +</blockquote> +</div> + + + </div> + <div id="Scope.find_all" class="classattr"> + <input id="Scope.find_all-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find_all</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">*</span><span class="n">expression_types</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.find_all-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.find_all"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.find_all-136"><a href="#Scope.find_all-136"><span class="linenos">136</span></a> <span class="k">def</span> <span class="nf">find_all</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">expression_types</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Scope.find_all-137"><a href="#Scope.find_all-137"><span class="linenos">137</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope.find_all-138"><a href="#Scope.find_all-138"><span class="linenos">138</span></a><span class="sd"> Returns a generator object which visits all nodes in this scope and only yields those that</span> +</span><span id="Scope.find_all-139"><a href="#Scope.find_all-139"><span class="linenos">139</span></a><span class="sd"> match at least one of the specified expression types.</span> +</span><span id="Scope.find_all-140"><a href="#Scope.find_all-140"><span class="linenos">140</span></a> +</span><span id="Scope.find_all-141"><a href="#Scope.find_all-141"><span class="linenos">141</span></a><span class="sd"> This does NOT traverse into subscopes.</span> +</span><span id="Scope.find_all-142"><a href="#Scope.find_all-142"><span class="linenos">142</span></a> +</span><span id="Scope.find_all-143"><a href="#Scope.find_all-143"><span class="linenos">143</span></a><span class="sd"> Args:</span> +</span><span id="Scope.find_all-144"><a href="#Scope.find_all-144"><span class="linenos">144</span></a><span class="sd"> expression_types (type): the expression type(s) to match.</span> +</span><span id="Scope.find_all-145"><a href="#Scope.find_all-145"><span class="linenos">145</span></a><span class="sd"> bfs (bool): True to use breadth-first search, False to use depth-first.</span> +</span><span id="Scope.find_all-146"><a href="#Scope.find_all-146"><span class="linenos">146</span></a> +</span><span id="Scope.find_all-147"><a href="#Scope.find_all-147"><span class="linenos">147</span></a><span class="sd"> Yields:</span> +</span><span id="Scope.find_all-148"><a href="#Scope.find_all-148"><span class="linenos">148</span></a><span class="sd"> exp.Expression: nodes</span> +</span><span id="Scope.find_all-149"><a href="#Scope.find_all-149"><span class="linenos">149</span></a><span class="sd"> """</span> +</span><span id="Scope.find_all-150"><a href="#Scope.find_all-150"><span class="linenos">150</span></a> <span class="k">for</span> <span class="n">expression</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">):</span> +</span><span id="Scope.find_all-151"><a href="#Scope.find_all-151"><span class="linenos">151</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">expression_types</span><span class="p">):</span> +</span><span id="Scope.find_all-152"><a href="#Scope.find_all-152"><span class="linenos">152</span></a> <span class="k">yield</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator object which visits all nodes in this scope and only yields those that +match at least one of the specified expression types.</p> + +<p>This does NOT traverse into subscopes.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression_types (type):</strong> the expression type(s) to match.</li> +<li><strong>bfs (bool):</strong> True to use breadth-first search, False to use depth-first.</li> +</ul> + +<h6 id="yields">Yields:</h6> + +<blockquote> + <p>exp.Expression: nodes</p> +</blockquote> +</div> + + + </div> + <div id="Scope.replace" class="classattr"> + <input id="Scope.replace-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">replace</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">old</span>, </span><span class="param"><span class="n">new</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.replace-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.replace"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.replace-154"><a href="#Scope.replace-154"><span class="linenos">154</span></a> <span class="k">def</span> <span class="nf">replace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">old</span><span class="p">,</span> <span class="n">new</span><span class="p">):</span> +</span><span id="Scope.replace-155"><a href="#Scope.replace-155"><span class="linenos">155</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope.replace-156"><a href="#Scope.replace-156"><span class="linenos">156</span></a><span class="sd"> Replace `old` with `new`.</span> +</span><span id="Scope.replace-157"><a href="#Scope.replace-157"><span class="linenos">157</span></a> +</span><span id="Scope.replace-158"><a href="#Scope.replace-158"><span class="linenos">158</span></a><span class="sd"> This can be used instead of `exp.Expression.replace` to ensure the `Scope` is kept up-to-date.</span> +</span><span id="Scope.replace-159"><a href="#Scope.replace-159"><span class="linenos">159</span></a> +</span><span id="Scope.replace-160"><a href="#Scope.replace-160"><span class="linenos">160</span></a><span class="sd"> Args:</span> +</span><span id="Scope.replace-161"><a href="#Scope.replace-161"><span class="linenos">161</span></a><span class="sd"> old (exp.Expression): old node</span> +</span><span id="Scope.replace-162"><a href="#Scope.replace-162"><span class="linenos">162</span></a><span class="sd"> new (exp.Expression): new node</span> +</span><span id="Scope.replace-163"><a href="#Scope.replace-163"><span class="linenos">163</span></a><span class="sd"> """</span> +</span><span id="Scope.replace-164"><a href="#Scope.replace-164"><span class="linenos">164</span></a> <span class="n">old</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">new</span><span class="p">)</span> +</span><span id="Scope.replace-165"><a href="#Scope.replace-165"><span class="linenos">165</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Replace <code>old</code> with <code>new</code>.</p> + +<p>This can be used instead of <code>exp.Expression.replace</code> to ensure the <code><a href="#Scope">Scope</a></code> is kept up-to-date.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>old (exp.Expression):</strong> old node</li> +<li><strong>new (exp.Expression):</strong> new node</li> +</ul> +</div> + + + </div> + <div id="Scope.tables" class="classattr"> + <div class="attr variable"> + <span class="name">tables</span> + + + </div> + <a class="headerlink" href="#Scope.tables"></a> + + <div class="docstring"><p>List of tables in this scope.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Table]: tables</p> +</blockquote> +</div> + + + </div> + <div id="Scope.ctes" class="classattr"> + <div class="attr variable"> + <span class="name">ctes</span> + + + </div> + <a class="headerlink" href="#Scope.ctes"></a> + + <div class="docstring"><p>List of CTEs in this scope.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.CTE]: ctes</p> +</blockquote> +</div> + + + </div> + <div id="Scope.derived_tables" class="classattr"> + <div class="attr variable"> + <span class="name">derived_tables</span> + + + </div> + <a class="headerlink" href="#Scope.derived_tables"></a> + + <div class="docstring"><p>List of derived tables in this scope.</p> + +<h6 id="for-example">For example:</h6> + +<blockquote> + <p>SELECT * FROM (SELECT ...) <- that's a derived table</p> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Subquery]: derived tables</p> +</blockquote> +</div> + + + </div> + <div id="Scope.subqueries" class="classattr"> + <div class="attr variable"> + <span class="name">subqueries</span> + + + </div> + <a class="headerlink" href="#Scope.subqueries"></a> + + <div class="docstring"><p>List of subqueries in this scope.</p> + +<h6 id="for-example">For example:</h6> + +<blockquote> + <p>SELECT * FROM x WHERE a IN (SELECT ...) <- that's a subquery</p> +</blockquote> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Subqueryable]: subqueries</p> +</blockquote> +</div> + + + </div> + <div id="Scope.columns" class="classattr"> + <div class="attr variable"> + <span class="name">columns</span> + + + </div> + <a class="headerlink" href="#Scope.columns"></a> + + <div class="docstring"><p>List of columns in this scope.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Column]: Column instances in this scope, plus any + Columns that reference this scope from correlated subqueries.</p> +</blockquote> +</div> + + + </div> + <div id="Scope.selected_sources" class="classattr"> + <div class="attr variable"> + <span class="name">selected_sources</span> + + + </div> + <a class="headerlink" href="#Scope.selected_sources"></a> + + <div class="docstring"><p>Mapping of nodes and sources that are actually selected from in this scope.</p> + +<p>That is, all tables in a schema are selectable at any point. But a +table only becomes a selected source if it's included in a FROM or JOIN clause.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>dict[str, (exp.Table|exp.Select, exp.Table|Scope)]: selected sources and nodes</p> +</blockquote> +</div> + + + </div> + <div id="Scope.cte_sources" class="classattr"> + <div class="attr variable"> + <span class="name">cte_sources</span> + + + </div> + <a class="headerlink" href="#Scope.cte_sources"></a> + + <div class="docstring"><p>Sources that are CTEs.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>dict[str, Scope]: Mapping of source alias to Scope</p> +</blockquote> +</div> + + + </div> + <div id="Scope.selects" class="classattr"> + <div class="attr variable"> + <span class="name">selects</span> + + + </div> + <a class="headerlink" href="#Scope.selects"></a> + + <div class="docstring"><p>Select expressions of this scope.</p> + +<p>For example, for the following expression: + SELECT 1 as a, 2 as b FROM x</p> + +<p>The outputs are the "1 as a" and "2 as b" expressions.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Expression]: expressions</p> +</blockquote> +</div> + + + </div> + <div id="Scope.external_columns" class="classattr"> + <div class="attr variable"> + <span class="name">external_columns</span> + + + </div> + <a class="headerlink" href="#Scope.external_columns"></a> + + <div class="docstring"><p>Columns that appear to reference sources in outer scopes.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Column]: Column instances that don't reference + sources in the current scope.</p> +</blockquote> +</div> + + + </div> + <div id="Scope.unqualified_columns" class="classattr"> + <div class="attr variable"> + <span class="name">unqualified_columns</span> + + + </div> + <a class="headerlink" href="#Scope.unqualified_columns"></a> + + <div class="docstring"><p>Unqualified columns in the current scope.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Column]: Unqualified columns</p> +</blockquote> +</div> + + + </div> + <div id="Scope.join_hints" class="classattr"> + <div class="attr variable"> + <span class="name">join_hints</span> + + + </div> + <a class="headerlink" href="#Scope.join_hints"></a> + + <div class="docstring"><p>Hints that exist in the scope that reference tables</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.JoinHint]: Join hints that are referenced within the scope</p> +</blockquote> +</div> + + + </div> + <div id="Scope.source_columns" class="classattr"> + <input id="Scope.source_columns-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">source_columns</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">source_name</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.source_columns-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.source_columns"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.source_columns-346"><a href="#Scope.source_columns-346"><span class="linenos">346</span></a> <span class="k">def</span> <span class="nf">source_columns</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source_name</span><span class="p">):</span> +</span><span id="Scope.source_columns-347"><a href="#Scope.source_columns-347"><span class="linenos">347</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope.source_columns-348"><a href="#Scope.source_columns-348"><span class="linenos">348</span></a><span class="sd"> Get all columns in the current scope for a particular source.</span> +</span><span id="Scope.source_columns-349"><a href="#Scope.source_columns-349"><span class="linenos">349</span></a> +</span><span id="Scope.source_columns-350"><a href="#Scope.source_columns-350"><span class="linenos">350</span></a><span class="sd"> Args:</span> +</span><span id="Scope.source_columns-351"><a href="#Scope.source_columns-351"><span class="linenos">351</span></a><span class="sd"> source_name (str): Name of the source</span> +</span><span id="Scope.source_columns-352"><a href="#Scope.source_columns-352"><span class="linenos">352</span></a><span class="sd"> Returns:</span> +</span><span id="Scope.source_columns-353"><a href="#Scope.source_columns-353"><span class="linenos">353</span></a><span class="sd"> list[exp.Column]: Column instances that reference `source_name`</span> +</span><span id="Scope.source_columns-354"><a href="#Scope.source_columns-354"><span class="linenos">354</span></a><span class="sd"> """</span> +</span><span id="Scope.source_columns-355"><a href="#Scope.source_columns-355"><span class="linenos">355</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">column</span> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">columns</span> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">table</span> <span class="o">==</span> <span class="n">source_name</span><span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Get all columns in the current scope for a particular source.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>source_name (str):</strong> Name of the source</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[exp.Column]: Column instances that reference <code>source_name</code></p> +</blockquote> +</div> + + + </div> + <div id="Scope.is_subquery" class="classattr"> + <div class="attr variable"> + <span class="name">is_subquery</span> + + + </div> + <a class="headerlink" href="#Scope.is_subquery"></a> + + <div class="docstring"><p>Determine if this scope is a subquery</p> +</div> + + + </div> + <div id="Scope.is_derived_table" class="classattr"> + <div class="attr variable"> + <span class="name">is_derived_table</span> + + + </div> + <a class="headerlink" href="#Scope.is_derived_table"></a> + + <div class="docstring"><p>Determine if this scope is a derived table</p> +</div> + + + </div> + <div id="Scope.is_union" class="classattr"> + <div class="attr variable"> + <span class="name">is_union</span> + + + </div> + <a class="headerlink" href="#Scope.is_union"></a> + + <div class="docstring"><p>Determine if this scope is a union</p> +</div> + + + </div> + <div id="Scope.is_cte" class="classattr"> + <div class="attr variable"> + <span class="name">is_cte</span> + + + </div> + <a class="headerlink" href="#Scope.is_cte"></a> + + <div class="docstring"><p>Determine if this scope is a common table expression</p> +</div> + + + </div> + <div id="Scope.is_root" class="classattr"> + <div class="attr variable"> + <span class="name">is_root</span> + + + </div> + <a class="headerlink" href="#Scope.is_root"></a> + + <div class="docstring"><p>Determine if this is the root scope</p> +</div> + + + </div> + <div id="Scope.is_udtf" class="classattr"> + <div class="attr variable"> + <span class="name">is_udtf</span> + + + </div> + <a class="headerlink" href="#Scope.is_udtf"></a> + + <div class="docstring"><p>Determine if this scope is a UDTF (User Defined Table Function)</p> +</div> + + + </div> + <div id="Scope.is_correlated_subquery" class="classattr"> + <div class="attr variable"> + <span class="name">is_correlated_subquery</span> + + + </div> + <a class="headerlink" href="#Scope.is_correlated_subquery"></a> + + <div class="docstring"><p>Determine if this scope is a correlated subquery</p> +</div> + + + </div> + <div id="Scope.rename_source" class="classattr"> + <input id="Scope.rename_source-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rename_source</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">old_name</span>, </span><span class="param"><span class="n">new_name</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.rename_source-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.rename_source"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.rename_source-392"><a href="#Scope.rename_source-392"><span class="linenos">392</span></a> <span class="k">def</span> <span class="nf">rename_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">old_name</span><span class="p">,</span> <span class="n">new_name</span><span class="p">):</span> +</span><span id="Scope.rename_source-393"><a href="#Scope.rename_source-393"><span class="linenos">393</span></a><span class="w"> </span><span class="sd">"""Rename a source in this scope"""</span> +</span><span id="Scope.rename_source-394"><a href="#Scope.rename_source-394"><span class="linenos">394</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">old_name</span> <span class="ow">or</span> <span class="s2">""</span><span class="p">,</span> <span class="p">[])</span> +</span><span id="Scope.rename_source-395"><a href="#Scope.rename_source-395"><span class="linenos">395</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">new_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">columns</span> +</span></pre></div> + + + <div class="docstring"><p>Rename a source in this scope</p> +</div> + + + </div> + <div id="Scope.add_source" class="classattr"> + <input id="Scope.add_source-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_source</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">name</span>, </span><span class="param"><span class="n">source</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.add_source-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.add_source"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.add_source-397"><a href="#Scope.add_source-397"><span class="linenos">397</span></a> <span class="k">def</span> <span class="nf">add_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">source</span><span class="p">):</span> +</span><span id="Scope.add_source-398"><a href="#Scope.add_source-398"><span class="linenos">398</span></a><span class="w"> </span><span class="sd">"""Add a source to this scope"""</span> +</span><span id="Scope.add_source-399"><a href="#Scope.add_source-399"><span class="linenos">399</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">source</span> +</span><span id="Scope.add_source-400"><a href="#Scope.add_source-400"><span class="linenos">400</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Add a source to this scope</p> +</div> + + + </div> + <div id="Scope.remove_source" class="classattr"> + <input id="Scope.remove_source-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">remove_source</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">name</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.remove_source-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.remove_source"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.remove_source-402"><a href="#Scope.remove_source-402"><span class="linenos">402</span></a> <span class="k">def</span> <span class="nf">remove_source</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span> +</span><span id="Scope.remove_source-403"><a href="#Scope.remove_source-403"><span class="linenos">403</span></a><span class="w"> </span><span class="sd">"""Remove a source from this scope"""</span> +</span><span id="Scope.remove_source-404"><a href="#Scope.remove_source-404"><span class="linenos">404</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Scope.remove_source-405"><a href="#Scope.remove_source-405"><span class="linenos">405</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">clear_cache</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>Remove a source from this scope</p> +</div> + + + </div> + <div id="Scope.traverse" class="classattr"> + <input id="Scope.traverse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">traverse</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.traverse-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.traverse"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.traverse-410"><a href="#Scope.traverse-410"><span class="linenos">410</span></a> <span class="k">def</span> <span class="nf">traverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope.traverse-411"><a href="#Scope.traverse-411"><span class="linenos">411</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope.traverse-412"><a href="#Scope.traverse-412"><span class="linenos">412</span></a><span class="sd"> Traverse the scope tree from this node.</span> +</span><span id="Scope.traverse-413"><a href="#Scope.traverse-413"><span class="linenos">413</span></a> +</span><span id="Scope.traverse-414"><a href="#Scope.traverse-414"><span class="linenos">414</span></a><span class="sd"> Yields:</span> +</span><span id="Scope.traverse-415"><a href="#Scope.traverse-415"><span class="linenos">415</span></a><span class="sd"> Scope: scope instances in depth-first-search post-order</span> +</span><span id="Scope.traverse-416"><a href="#Scope.traverse-416"><span class="linenos">416</span></a><span class="sd"> """</span> +</span><span id="Scope.traverse-417"><a href="#Scope.traverse-417"><span class="linenos">417</span></a> <span class="k">for</span> <span class="n">child_scope</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">(</span> +</span><span id="Scope.traverse-418"><a href="#Scope.traverse-418"><span class="linenos">418</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">cte_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">union_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">derived_table_scopes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">subquery_scopes</span> +</span><span id="Scope.traverse-419"><a href="#Scope.traverse-419"><span class="linenos">419</span></a> <span class="p">):</span> +</span><span id="Scope.traverse-420"><a href="#Scope.traverse-420"><span class="linenos">420</span></a> <span class="k">yield from</span> <span class="n">child_scope</span><span class="o">.</span><span class="n">traverse</span><span class="p">()</span> +</span><span id="Scope.traverse-421"><a href="#Scope.traverse-421"><span class="linenos">421</span></a> <span class="k">yield</span> <span class="bp">self</span> +</span></pre></div> + + + <div class="docstring"><p>Traverse the scope tree from this node.</p> + +<h6 id="yields">Yields:</h6> + +<blockquote> + <p>Scope: scope instances in depth-first-search post-order</p> +</blockquote> +</div> + + + </div> + <div id="Scope.ref_count" class="classattr"> + <input id="Scope.ref_count-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ref_count</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Scope.ref_count-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scope.ref_count"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scope.ref_count-423"><a href="#Scope.ref_count-423"><span class="linenos">423</span></a> <span class="k">def</span> <span class="nf">ref_count</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Scope.ref_count-424"><a href="#Scope.ref_count-424"><span class="linenos">424</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Scope.ref_count-425"><a href="#Scope.ref_count-425"><span class="linenos">425</span></a><span class="sd"> Count the number of times each scope in this tree is referenced.</span> +</span><span id="Scope.ref_count-426"><a href="#Scope.ref_count-426"><span class="linenos">426</span></a> +</span><span id="Scope.ref_count-427"><a href="#Scope.ref_count-427"><span class="linenos">427</span></a><span class="sd"> Returns:</span> +</span><span id="Scope.ref_count-428"><a href="#Scope.ref_count-428"><span class="linenos">428</span></a><span class="sd"> dict[int, int]: Mapping of Scope instance ID to reference count</span> +</span><span id="Scope.ref_count-429"><a href="#Scope.ref_count-429"><span class="linenos">429</span></a><span class="sd"> """</span> +</span><span id="Scope.ref_count-430"><a href="#Scope.ref_count-430"><span class="linenos">430</span></a> <span class="n">scope_ref_count</span> <span class="o">=</span> <span class="n">defaultdict</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Scope.ref_count-431"><a href="#Scope.ref_count-431"><span class="linenos">431</span></a> +</span><span id="Scope.ref_count-432"><a href="#Scope.ref_count-432"><span class="linenos">432</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">traverse</span><span class="p">():</span> +</span><span id="Scope.ref_count-433"><a href="#Scope.ref_count-433"><span class="linenos">433</span></a> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Scope.ref_count-434"><a href="#Scope.ref_count-434"><span class="linenos">434</span></a> <span class="n">scope_ref_count</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="n">source</span><span class="p">)]</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Scope.ref_count-435"><a href="#Scope.ref_count-435"><span class="linenos">435</span></a> +</span><span id="Scope.ref_count-436"><a href="#Scope.ref_count-436"><span class="linenos">436</span></a> <span class="k">return</span> <span class="n">scope_ref_count</span> +</span></pre></div> + + + <div class="docstring"><p>Count the number of times each scope in this tree is referenced.</p> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>dict[int, int]: Mapping of Scope instance ID to reference count</p> +</blockquote> +</div> + + + </div> + </section> + <section id="traverse_scope"> + <input id="traverse_scope-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">traverse_scope</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="traverse_scope-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#traverse_scope"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="traverse_scope-439"><a href="#traverse_scope-439"><span class="linenos">439</span></a><span class="k">def</span> <span class="nf">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="traverse_scope-440"><a href="#traverse_scope-440"><span class="linenos">440</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="traverse_scope-441"><a href="#traverse_scope-441"><span class="linenos">441</span></a><span class="sd"> Traverse an expression by it's "scopes".</span> +</span><span id="traverse_scope-442"><a href="#traverse_scope-442"><span class="linenos">442</span></a> +</span><span id="traverse_scope-443"><a href="#traverse_scope-443"><span class="linenos">443</span></a><span class="sd"> "Scope" represents the current context of a Select statement.</span> +</span><span id="traverse_scope-444"><a href="#traverse_scope-444"><span class="linenos">444</span></a> +</span><span id="traverse_scope-445"><a href="#traverse_scope-445"><span class="linenos">445</span></a><span class="sd"> This is helpful for optimizing queries, where we need more information than</span> +</span><span id="traverse_scope-446"><a href="#traverse_scope-446"><span class="linenos">446</span></a><span class="sd"> the expression tree itself. For example, we might care about the source</span> +</span><span id="traverse_scope-447"><a href="#traverse_scope-447"><span class="linenos">447</span></a><span class="sd"> names within a subquery. Returns a list because a generator could result in</span> +</span><span id="traverse_scope-448"><a href="#traverse_scope-448"><span class="linenos">448</span></a><span class="sd"> incomplete properties which is confusing.</span> +</span><span id="traverse_scope-449"><a href="#traverse_scope-449"><span class="linenos">449</span></a> +</span><span id="traverse_scope-450"><a href="#traverse_scope-450"><span class="linenos">450</span></a><span class="sd"> Examples:</span> +</span><span id="traverse_scope-451"><a href="#traverse_scope-451"><span class="linenos">451</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="traverse_scope-452"><a href="#traverse_scope-452"><span class="linenos">452</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT a FROM (SELECT a FROM x) AS y")</span> +</span><span id="traverse_scope-453"><a href="#traverse_scope-453"><span class="linenos">453</span></a><span class="sd"> >>> scopes = traverse_scope(expression)</span> +</span><span id="traverse_scope-454"><a href="#traverse_scope-454"><span class="linenos">454</span></a><span class="sd"> >>> scopes[0].expression.sql(), list(scopes[0].sources)</span> +</span><span id="traverse_scope-455"><a href="#traverse_scope-455"><span class="linenos">455</span></a><span class="sd"> ('SELECT a FROM x', ['x'])</span> +</span><span id="traverse_scope-456"><a href="#traverse_scope-456"><span class="linenos">456</span></a><span class="sd"> >>> scopes[1].expression.sql(), list(scopes[1].sources)</span> +</span><span id="traverse_scope-457"><a href="#traverse_scope-457"><span class="linenos">457</span></a><span class="sd"> ('SELECT a FROM (SELECT a FROM x) AS y', ['y'])</span> +</span><span id="traverse_scope-458"><a href="#traverse_scope-458"><span class="linenos">458</span></a> +</span><span id="traverse_scope-459"><a href="#traverse_scope-459"><span class="linenos">459</span></a><span class="sd"> Args:</span> +</span><span id="traverse_scope-460"><a href="#traverse_scope-460"><span class="linenos">460</span></a><span class="sd"> expression (exp.Expression): expression to traverse</span> +</span><span id="traverse_scope-461"><a href="#traverse_scope-461"><span class="linenos">461</span></a><span class="sd"> Returns:</span> +</span><span id="traverse_scope-462"><a href="#traverse_scope-462"><span class="linenos">462</span></a><span class="sd"> list[Scope]: scope instances</span> +</span><span id="traverse_scope-463"><a href="#traverse_scope-463"><span class="linenos">463</span></a><span class="sd"> """</span> +</span><span id="traverse_scope-464"><a href="#traverse_scope-464"><span class="linenos">464</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">_traverse_scope</span><span class="p">(</span><span class="n">Scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)))</span> +</span></pre></div> + + + <div class="docstring"><p>Traverse an expression by it's "scopes".</p> + +<p>"Scope" represents the current context of a Select statement.</p> + +<p>This is helpful for optimizing queries, where we need more information than +the expression tree itself. For example, we might care about the source +names within a subquery. Returns a list because a generator could result in +incomplete properties which is confusing.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT a FROM (SELECT a FROM x) AS y"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">scopes</span> <span class="o">=</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">scopes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(),</span> <span class="nb">list</span><span class="p">(</span><span class="n">scopes</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">sources</span><span class="p">)</span> +<span class="go">('SELECT a FROM x', ['x'])</span> +<span class="gp">>>> </span><span class="n">scopes</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">(),</span> <span class="nb">list</span><span class="p">(</span><span class="n">scopes</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">sources</span><span class="p">)</span> +<span class="go">('SELECT a FROM (SELECT a FROM x) AS y', ['y'])</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (exp.Expression):</strong> expression to traverse</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>list[Scope]: scope instances</p> +</blockquote> +</div> + + + </section> + <section id="build_scope"> + <input id="build_scope-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">build_scope</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="build_scope-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#build_scope"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="build_scope-467"><a href="#build_scope-467"><span class="linenos">467</span></a><span class="k">def</span> <span class="nf">build_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="build_scope-468"><a href="#build_scope-468"><span class="linenos">468</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="build_scope-469"><a href="#build_scope-469"><span class="linenos">469</span></a><span class="sd"> Build a scope tree.</span> +</span><span id="build_scope-470"><a href="#build_scope-470"><span class="linenos">470</span></a> +</span><span id="build_scope-471"><a href="#build_scope-471"><span class="linenos">471</span></a><span class="sd"> Args:</span> +</span><span id="build_scope-472"><a href="#build_scope-472"><span class="linenos">472</span></a><span class="sd"> expression (exp.Expression): expression to build the scope tree for</span> +</span><span id="build_scope-473"><a href="#build_scope-473"><span class="linenos">473</span></a><span class="sd"> Returns:</span> +</span><span id="build_scope-474"><a href="#build_scope-474"><span class="linenos">474</span></a><span class="sd"> Scope: root scope</span> +</span><span id="build_scope-475"><a href="#build_scope-475"><span class="linenos">475</span></a><span class="sd"> """</span> +</span><span id="build_scope-476"><a href="#build_scope-476"><span class="linenos">476</span></a> <span class="k">return</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Build a scope tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (exp.Expression):</strong> expression to build the scope tree for</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Scope: root scope</p> +</blockquote> +</div> + + + </section> + <section id="walk_in_scope"> + <input id="walk_in_scope-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">walk_in_scope</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">bfs</span><span class="o">=</span><span class="kc">True</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="walk_in_scope-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#walk_in_scope"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="walk_in_scope-604"><a href="#walk_in_scope-604"><span class="linenos">604</span></a><span class="k">def</span> <span class="nf">walk_in_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">bfs</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="walk_in_scope-605"><a href="#walk_in_scope-605"><span class="linenos">605</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="walk_in_scope-606"><a href="#walk_in_scope-606"><span class="linenos">606</span></a><span class="sd"> Returns a generator object which visits all nodes in the syntrax tree, stopping at</span> +</span><span id="walk_in_scope-607"><a href="#walk_in_scope-607"><span class="linenos">607</span></a><span class="sd"> nodes that start child scopes.</span> +</span><span id="walk_in_scope-608"><a href="#walk_in_scope-608"><span class="linenos">608</span></a> +</span><span id="walk_in_scope-609"><a href="#walk_in_scope-609"><span class="linenos">609</span></a><span class="sd"> Args:</span> +</span><span id="walk_in_scope-610"><a href="#walk_in_scope-610"><span class="linenos">610</span></a><span class="sd"> expression (exp.Expression):</span> +</span><span id="walk_in_scope-611"><a href="#walk_in_scope-611"><span class="linenos">611</span></a><span class="sd"> bfs (bool): if set to True the BFS traversal order will be applied,</span> +</span><span id="walk_in_scope-612"><a href="#walk_in_scope-612"><span class="linenos">612</span></a><span class="sd"> otherwise the DFS traversal will be used instead.</span> +</span><span id="walk_in_scope-613"><a href="#walk_in_scope-613"><span class="linenos">613</span></a> +</span><span id="walk_in_scope-614"><a href="#walk_in_scope-614"><span class="linenos">614</span></a><span class="sd"> Yields:</span> +</span><span id="walk_in_scope-615"><a href="#walk_in_scope-615"><span class="linenos">615</span></a><span class="sd"> tuple[exp.Expression, Optional[exp.Expression], str]: node, parent, arg key</span> +</span><span id="walk_in_scope-616"><a href="#walk_in_scope-616"><span class="linenos">616</span></a><span class="sd"> """</span> +</span><span id="walk_in_scope-617"><a href="#walk_in_scope-617"><span class="linenos">617</span></a> <span class="c1"># We'll use this variable to pass state into the dfs generator.</span> +</span><span id="walk_in_scope-618"><a href="#walk_in_scope-618"><span class="linenos">618</span></a> <span class="c1"># Whenever we set it to True, we exclude a subtree from traversal.</span> +</span><span id="walk_in_scope-619"><a href="#walk_in_scope-619"><span class="linenos">619</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="walk_in_scope-620"><a href="#walk_in_scope-620"><span class="linenos">620</span></a> +</span><span id="walk_in_scope-621"><a href="#walk_in_scope-621"><span class="linenos">621</span></a> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">bfs</span><span class="o">=</span><span class="n">bfs</span><span class="p">,</span> <span class="n">prune</span><span class="o">=</span><span class="k">lambda</span> <span class="o">*</span><span class="n">_</span><span class="p">:</span> <span class="n">prune</span><span class="p">):</span> +</span><span id="walk_in_scope-622"><a href="#walk_in_scope-622"><span class="linenos">622</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="walk_in_scope-623"><a href="#walk_in_scope-623"><span class="linenos">623</span></a> +</span><span id="walk_in_scope-624"><a href="#walk_in_scope-624"><span class="linenos">624</span></a> <span class="k">yield</span> <span class="n">node</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">key</span> +</span><span id="walk_in_scope-625"><a href="#walk_in_scope-625"><span class="linenos">625</span></a> +</span><span id="walk_in_scope-626"><a href="#walk_in_scope-626"><span class="linenos">626</span></a> <span class="k">if</span> <span class="n">node</span> <span class="ow">is</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="walk_in_scope-627"><a href="#walk_in_scope-627"><span class="linenos">627</span></a> <span class="k">continue</span> +</span><span id="walk_in_scope-628"><a href="#walk_in_scope-628"><span class="linenos">628</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">):</span> +</span><span id="walk_in_scope-629"><a href="#walk_in_scope-629"><span class="linenos">629</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="walk_in_scope-630"><a href="#walk_in_scope-630"><span class="linenos">630</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">)):</span> +</span><span id="walk_in_scope-631"><a href="#walk_in_scope-631"><span class="linenos">631</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="walk_in_scope-632"><a href="#walk_in_scope-632"><span class="linenos">632</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="walk_in_scope-633"><a href="#walk_in_scope-633"><span class="linenos">633</span></a> <span class="n">prune</span> <span class="o">=</span> <span class="kc">True</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a generator object which visits all nodes in the syntrax tree, stopping at +nodes that start child scopes.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (exp.Expression):</strong> </li> +<li><strong>bfs (bool):</strong> if set to True the BFS traversal order will be applied, +otherwise the DFS traversal will be used instead.</li> +</ul> + +<h6 id="yields">Yields:</h6> + +<blockquote> + <p>tuple[exp.Expression, Optional[exp.Expression], str]: node, parent, arg key</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/simplify.html b/docs/sqlglot/optimizer/simplify.html new file mode 100644 index 0000000..cc83534 --- /dev/null +++ b/docs/sqlglot/optimizer/simplify.html @@ -0,0 +1,1428 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.simplify API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#simplify">simplify</a> + </li> + <li> + <a class="function" href="#rewrite_between">rewrite_between</a> + </li> + <li> + <a class="function" href="#simplify_not">simplify_not</a> + </li> + <li> + <a class="function" href="#flatten">flatten</a> + </li> + <li> + <a class="function" href="#simplify_connectors">simplify_connectors</a> + </li> + <li> + <a class="function" href="#remove_compliments">remove_compliments</a> + </li> + <li> + <a class="function" href="#uniq_sort">uniq_sort</a> + </li> + <li> + <a class="function" href="#absorb_and_eliminate">absorb_and_eliminate</a> + </li> + <li> + <a class="function" href="#simplify_literals">simplify_literals</a> + </li> + <li> + <a class="function" href="#simplify_parens">simplify_parens</a> + </li> + <li> + <a class="function" href="#remove_where_true">remove_where_true</a> + </li> + <li> + <a class="function" href="#always_true">always_true</a> + </li> + <li> + <a class="function" href="#is_complement">is_complement</a> + </li> + <li> + <a class="function" href="#eval_boolean">eval_boolean</a> + </li> + <li> + <a class="function" href="#extract_date">extract_date</a> + </li> + <li> + <a class="function" href="#extract_interval">extract_interval</a> + </li> + <li> + <a class="function" href="#date_literal">date_literal</a> + </li> + <li> + <a class="function" href="#boolean_literal">boolean_literal</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/simplify.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.simplify </h1> + + + <input id="mod-simplify-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-simplify-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">datetime</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a><span class="kn">import</span> <span class="nn">functools</span> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">deque</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">decimal</span> <span class="kn">import</span> <span class="n">Decimal</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.expressions</span> <span class="kn">import</span> <span class="n">FALSE</span><span class="p">,</span> <span class="n">NULL</span><span class="p">,</span> <span class="n">TRUE</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.generator</span> <span class="kn">import</span> <span class="n">Generator</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">first</span><span class="p">,</span> <span class="n">while_changing</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="n">GENERATOR</span> <span class="o">=</span> <span class="n">Generator</span><span class="p">(</span><span class="n">normalize</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">identify</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="k">def</span> <span class="nf">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> Rewrite sqlglot AST to simplify expressions.</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> Example:</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> >>> expression = sqlglot.parse_one("TRUE AND TRUE")</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> >>> simplify(expression).sql()</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> 'TRUE'</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> Args:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> expression (sqlglot.Expression): expression to simplify</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> Returns:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a><span class="sd"> sqlglot.Expression: simplified expression</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a><span class="sd"> """</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">def</span> <span class="nf">_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">rewrite_between</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">uniq_sort</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">absorb_and_eliminate</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">_simplify</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="kc">False</span><span class="p">))</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_not</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_connectors</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">remove_compliments</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_literals</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_parens</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">if</span> <span class="n">root</span><span class="p">:</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">while_changing</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">_simplify</span><span class="p">)</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">remove_where_true</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="k">def</span> <span class="nf">rewrite_between</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="w"> </span><span class="sd">"""Rewrite x between y and z to x >= y AND x <= z.</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> This is done because comparison simplification is only done on lt/lte/gt/gte.</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> """</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">):</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"low"</span><span class="p">]),</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"high"</span><span class="p">]),</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a><span class="k">def</span> <span class="nf">simplify_not</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="sd"> Demorgan's Law</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="sd"> NOT (x OR y) -> NOT x AND NOT y</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a><span class="sd"> NOT (x AND y) -> NOT x OR NOT y</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a><span class="sd"> """</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">):</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">):</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">):</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">):</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">left</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">right</span><span class="p">))</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">):</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">left</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">right</span><span class="p">))</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">):</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">):</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">):</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="c1"># double negation</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="c1"># NOT NOT x -> x</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a><span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a><span class="sd"> A AND (B AND C) -> A AND B AND C</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a><span class="sd"> A OR (B OR C) -> A OR B OR C</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a><span class="sd"> """</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">child</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">child</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">):</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">node</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">child</span><span class="p">)</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="k">def</span> <span class="nf">simplify_connectors</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">def</span> <span class="nf">_simplify_connectors</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">):</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="n">left</span> <span class="o">==</span> <span class="n">right</span><span class="p">:</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">return</span> <span class="n">left</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">):</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="n">FALSE</span> <span class="ow">in</span> <span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">):</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">if</span> <span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">):</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> <span class="ow">and</span> <span class="n">always_true</span><span class="p">(</span><span class="n">right</span><span class="p">):</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">left</span><span class="p">):</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="k">return</span> <span class="n">right</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">right</span><span class="p">):</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">return</span> <span class="n">left</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">_simplify_comparison</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">)</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">):</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> <span class="ow">or</span> <span class="n">always_true</span><span class="p">(</span><span class="n">right</span><span class="p">):</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="n">left</span> <span class="o">==</span> <span class="n">FALSE</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="p">(</span><span class="n">left</span> <span class="o">==</span> <span class="n">NULL</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">left</span> <span class="o">==</span> <span class="n">NULL</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">)</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">left</span> <span class="o">==</span> <span class="n">FALSE</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="p">):</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">if</span> <span class="n">left</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="n">right</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">if</span> <span class="n">right</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">left</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">_simplify_comparison</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">or_</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="k">return</span> <span class="n">_flat_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">_simplify_connectors</span><span class="p">)</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a><span class="n">LT_LTE</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a><span class="n">GT_GTE</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">)</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a><span class="n">COMPARISONS</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="o">*</span><span class="n">LT_LTE</span><span class="p">,</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="o">*</span><span class="n">GT_GTE</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a><span class="p">)</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a><span class="n">INVERSE_COMPARISONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a><span class="p">}</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a><span class="k">def</span> <span class="nf">_simplify_comparison</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">or_</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">COMPARISONS</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">right</span><span class="p">,</span> <span class="n">COMPARISONS</span><span class="p">):</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">ll</span><span class="p">,</span> <span class="n">lr</span> <span class="o">=</span> <span class="n">left</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">rl</span><span class="p">,</span> <span class="n">rr</span> <span class="o">=</span> <span class="n">right</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">largs</span> <span class="o">=</span> <span class="p">{</span><span class="n">ll</span><span class="p">,</span> <span class="n">lr</span><span class="p">}</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">rargs</span> <span class="o">=</span> <span class="p">{</span><span class="n">rl</span><span class="p">,</span> <span class="n">rr</span><span class="p">}</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">matching</span> <span class="o">=</span> <span class="n">largs</span> <span class="o">&</span> <span class="n">rargs</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="p">{</span><span class="n">m</span> <span class="k">for</span> <span class="n">m</span> <span class="ow">in</span> <span class="n">matching</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)}</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="n">matching</span> <span class="ow">and</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">l</span> <span class="o">=</span> <span class="n">first</span><span class="p">(</span><span class="n">largs</span> <span class="o">-</span> <span class="n">columns</span><span class="p">)</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">r</span> <span class="o">=</span> <span class="n">first</span><span class="p">(</span><span class="n">rargs</span> <span class="o">-</span> <span class="n">columns</span><span class="p">)</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="c1"># make sure the comparison is always of the form x > 1 instead of 1 < x</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">if</span> <span class="n">left</span><span class="o">.</span><span class="vm">__class__</span> <span class="ow">in</span> <span class="n">INVERSE_COMPARISONS</span> <span class="ow">and</span> <span class="n">l</span> <span class="o">==</span> <span class="n">ll</span><span class="p">:</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">INVERSE_COMPARISONS</span><span class="p">[</span><span class="n">left</span><span class="o">.</span><span class="vm">__class__</span><span class="p">](</span><span class="n">this</span><span class="o">=</span><span class="n">lr</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">ll</span><span class="p">)</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="k">if</span> <span class="n">right</span><span class="o">.</span><span class="vm">__class__</span> <span class="ow">in</span> <span class="n">INVERSE_COMPARISONS</span> <span class="ow">and</span> <span class="n">r</span> <span class="o">==</span> <span class="n">rl</span><span class="p">:</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">INVERSE_COMPARISONS</span><span class="p">[</span><span class="n">right</span><span class="o">.</span><span class="vm">__class__</span><span class="p">](</span><span class="n">this</span><span class="o">=</span><span class="n">rr</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">rl</span><span class="p">)</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="k">if</span> <span class="n">l</span><span class="o">.</span><span class="n">is_number</span> <span class="ow">and</span> <span class="n">r</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">l</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">l</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">r</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="k">elif</span> <span class="n">l</span><span class="o">.</span><span class="n">is_string</span> <span class="ow">and</span> <span class="n">r</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">l</span> <span class="o">=</span> <span class="n">l</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">r</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="k">for</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">av</span><span class="p">),</span> <span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">bv</span><span class="p">)</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">(((</span><span class="n">left</span><span class="p">,</span> <span class="n">l</span><span class="p">),</span> <span class="p">(</span><span class="n">right</span><span class="p">,</span> <span class="n">r</span><span class="p">))):</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">LT_LTE</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">LT_LTE</span><span class="p">):</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="k">return</span> <span class="n">left</span> <span class="k">if</span> <span class="p">(</span><span class="n">av</span> <span class="o">></span> <span class="n">bv</span> <span class="k">if</span> <span class="n">or_</span> <span class="k">else</span> <span class="n">av</span> <span class="o"><=</span> <span class="n">bv</span><span class="p">)</span> <span class="k">else</span> <span class="n">right</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">GT_GTE</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">GT_GTE</span><span class="p">):</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="k">return</span> <span class="n">left</span> <span class="k">if</span> <span class="p">(</span><span class="n">av</span> <span class="o"><</span> <span class="n">bv</span> <span class="k">if</span> <span class="n">or_</span> <span class="k">else</span> <span class="n">av</span> <span class="o">>=</span> <span class="n">bv</span><span class="p">)</span> <span class="k">else</span> <span class="n">right</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="c1"># we can't ever shortcut to true because the column could be null</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">GT_GTE</span><span class="p">):</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">or_</span> <span class="ow">and</span> <span class="n">av</span> <span class="o"><=</span> <span class="n">bv</span><span class="p">:</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">LT_LTE</span><span class="p">):</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">or_</span> <span class="ow">and</span> <span class="n">av</span> <span class="o">>=</span> <span class="n">bv</span><span class="p">:</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">av</span> <span class="o">>=</span> <span class="n">bv</span> <span class="k">else</span> <span class="n">a</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">):</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">av</span> <span class="o">></span> <span class="n">bv</span> <span class="k">else</span> <span class="n">a</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">av</span> <span class="o"><=</span> <span class="n">bv</span> <span class="k">else</span> <span class="n">a</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">):</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">av</span> <span class="o"><</span> <span class="n">bv</span> <span class="k">else</span> <span class="n">a</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">):</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">av</span> <span class="o">==</span> <span class="n">bv</span> <span class="k">else</span> <span class="n">a</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a><span class="k">def</span> <span class="nf">remove_compliments</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a><span class="sd"> Removing compliments.</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a><span class="sd"> A AND NOT A -> FALSE</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a><span class="sd"> A OR NOT A -> TRUE</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a><span class="sd"> """</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">compliment</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(),</span> <span class="mi">2</span><span class="p">):</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="k">if</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="k">return</span> <span class="n">compliment</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a><span class="k">def</span> <span class="nf">uniq_sort</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a><span class="sd"> Uniq and sort a connector.</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a><span class="sd"> C AND A AND B AND B -> A AND B AND C</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a><span class="sd"> """</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="n">result_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="n">flattened</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">())</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="n">deduped</span> <span class="o">=</span> <span class="p">{</span><span class="n">GENERATOR</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">e</span><span class="p">):</span> <span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">flattened</span><span class="p">}</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="n">arr</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">deduped</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="c1"># check if the operands are already sorted, if not sort them</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="c1"># A AND C AND B -> A AND B AND C</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">arr</span><span class="p">[</span><span class="mi">1</span><span class="p">:]):</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">if</span> <span class="n">sql</span> <span class="o"><</span> <span class="n">arr</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">result_func</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="n">deduped</span><span class="p">[</span><span class="n">sql</span><span class="p">]</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">deduped</span><span class="p">)))</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="k">break</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="c1"># we didn't have to sort but maybe we need to dedup</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">deduped</span><span class="p">)</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="n">flattened</span><span class="p">):</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">result_func</span><span class="p">(</span><span class="o">*</span><span class="n">deduped</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a><span class="k">def</span> <span class="nf">absorb_and_eliminate</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a><span class="sd"> absorption:</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a><span class="sd"> A AND (A OR B) -> A</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a><span class="sd"> A OR (A AND B) -> A</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a><span class="sd"> A AND (NOT A OR B) -> A AND B</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a><span class="sd"> A OR (NOT A AND B) -> A OR B</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a><span class="sd"> elimination:</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a><span class="sd"> (A AND B) OR (A AND NOT B) -> A</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a><span class="sd"> (A OR B) AND (A OR NOT B) -> A</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a><span class="sd"> """</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(),</span> <span class="mi">2</span><span class="p">):</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="n">aa</span><span class="p">,</span> <span class="n">ab</span> <span class="o">=</span> <span class="n">a</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="c1"># absorb</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">if</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">aa</span><span class="p">):</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="n">aa</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">())</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="k">elif</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">ab</span><span class="p">):</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">ab</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">())</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="k">elif</span> <span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">flatten</span><span class="p">())</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">kind</span><span class="p">)</span> <span class="k">else</span> <span class="p">{</span><span class="n">b</span><span class="p">})</span> <span class="o"><</span> <span class="nb">set</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">flatten</span><span class="p">()):</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">a</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="c1"># eliminate</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="n">rhs</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="n">ba</span><span class="p">,</span> <span class="n">bb</span> <span class="o">=</span> <span class="n">rhs</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="k">if</span> <span class="n">aa</span> <span class="ow">in</span> <span class="n">rhs</span> <span class="ow">and</span> <span class="p">(</span><span class="n">is_complement</span><span class="p">(</span><span class="n">ab</span><span class="p">,</span> <span class="n">ba</span><span class="p">)</span> <span class="ow">or</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">ab</span><span class="p">,</span> <span class="n">bb</span><span class="p">)):</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="n">a</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">aa</span><span class="p">)</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="n">b</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">aa</span><span class="p">)</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="k">elif</span> <span class="n">ab</span> <span class="ow">in</span> <span class="n">rhs</span> <span class="ow">and</span> <span class="p">(</span><span class="n">is_complement</span><span class="p">(</span><span class="n">aa</span><span class="p">,</span> <span class="n">ba</span><span class="p">)</span> <span class="ow">or</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">aa</span><span class="p">,</span> <span class="n">bb</span><span class="p">)):</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">a</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">ab</span><span class="p">)</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="n">b</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">ab</span><span class="p">)</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a><span class="k">def</span> <span class="nf">simplify_literals</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="k">return</span> <span class="n">_flat_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">_simplify_binary</span><span class="p">)</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">):</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="k">if</span> <span class="n">this</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="k">if</span> <span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"-"</span><span class="p">:</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="sa">f</span><span class="s2">"-</span><span class="si">{</span><span class="n">value</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a><span class="k">def</span> <span class="nf">_simplify_binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">):</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">):</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">c</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="n">not_</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="n">c</span> <span class="o">=</span> <span class="n">b</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="n">not_</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="k">if</span> <span class="n">c</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">:</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">):</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">not_</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="k">if</span> <span class="n">a</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">:</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">not_</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span><span class="p">)):</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="k">elif</span> <span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="k">if</span> <span class="n">a</span><span class="o">.</span><span class="n">is_number</span> <span class="ow">and</span> <span class="n">b</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="n">a</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="k">if</span> <span class="n">a</span><span class="o">.</span><span class="n">is_int</span> <span class="k">else</span> <span class="n">Decimal</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="n">b</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> <span class="k">if</span> <span class="n">b</span><span class="o">.</span><span class="n">is_int</span> <span class="k">else</span> <span class="n">Decimal</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">):</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">):</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">a</span> <span class="o">-</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">):</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">a</span> <span class="o">*</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">):</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">a</span> <span class="o">//</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">a</span> <span class="o">/</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="n">boolean</span> <span class="o">=</span> <span class="n">eval_boolean</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="k">if</span> <span class="n">boolean</span><span class="p">:</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="k">return</span> <span class="n">boolean</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="k">elif</span> <span class="n">a</span><span class="o">.</span><span class="n">is_string</span> <span class="ow">and</span> <span class="n">b</span><span class="o">.</span><span class="n">is_string</span><span class="p">:</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="n">boolean</span> <span class="o">=</span> <span class="n">eval_boolean</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="k">if</span> <span class="n">boolean</span><span class="p">:</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="k">return</span> <span class="n">boolean</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">):</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">extract_date</span><span class="p">(</span><span class="n">a</span><span class="p">),</span> <span class="n">extract_interval</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="k">if</span> <span class="n">a</span> <span class="ow">and</span> <span class="n">b</span><span class="p">:</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">):</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="k">return</span> <span class="n">date_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">):</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="k">return</span> <span class="n">date_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">-</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">):</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">extract_interval</span><span class="p">(</span><span class="n">a</span><span class="p">),</span> <span class="n">extract_date</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="c1"># you cannot subtract a date from an interval</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="k">if</span> <span class="n">a</span> <span class="ow">and</span> <span class="n">b</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">):</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="n">date_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a><span class="k">def</span> <span class="nf">simplify_parens</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">))</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">))</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="p">)</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="p">):</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a><span class="k">def</span> <span class="nf">remove_where_true</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="k">for</span> <span class="n">where</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">):</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">):</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="n">where</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"where"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)):</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="s2">"CROSS"</span><span class="p">)</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a><span class="k">def</span> <span class="nf">always_true</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="k">return</span> <span class="n">expression</span> <span class="o">==</span> <span class="n">TRUE</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a><span class="k">def</span> <span class="nf">is_complement</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">)</span> <span class="ow">and</span> <span class="n">b</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">a</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a><span class="k">def</span> <span class="nf">eval_boolean</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">)):</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">):</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">!=</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">></span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">):</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">>=</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos">419</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos">420</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o"><</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos">421</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">):</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos">422</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o"><=</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos">423</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos">424</span></a> +</span><span id="L-425"><a href="#L-425"><span class="linenos">425</span></a> +</span><span id="L-426"><a href="#L-426"><span class="linenos">426</span></a><span class="k">def</span> <span class="nf">extract_date</span><span class="p">(</span><span class="n">cast</span><span class="p">):</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos">427</span></a> <span class="c1"># The "fromisoformat" conversion could fail if the cast is used on an identifier,</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos">428</span></a> <span class="c1"># so in that case we can't extract the date.</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos">429</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos">430</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos">431</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">cast</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos">432</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos">433</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">cast</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos">434</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos">435</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos">436</span></a> +</span><span id="L-437"><a href="#L-437"><span class="linenos">437</span></a> +</span><span id="L-438"><a href="#L-438"><span class="linenos">438</span></a><span class="k">def</span> <span class="nf">extract_interval</span><span class="p">(</span><span class="n">interval</span><span class="p">):</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos">439</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos">440</span></a> <span class="kn">from</span> <span class="nn">dateutil.relativedelta</span> <span class="kn">import</span> <span class="n">relativedelta</span> <span class="c1"># type: ignore</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos">441</span></a> <span class="k">except</span> <span class="ne">ModuleNotFoundError</span><span class="p">:</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos">442</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos">443</span></a> +</span><span id="L-444"><a href="#L-444"><span class="linenos">444</span></a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">interval</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-445"><a href="#L-445"><span class="linenos">445</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">interval</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos">446</span></a> +</span><span id="L-447"><a href="#L-447"><span class="linenos">447</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"year"</span><span class="p">:</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos">448</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">years</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="L-449"><a href="#L-449"><span class="linenos">449</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"month"</span><span class="p">:</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos">450</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">months</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos">451</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"week"</span><span class="p">:</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos">452</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">weeks</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="L-453"><a href="#L-453"><span class="linenos">453</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"day"</span><span class="p">:</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos">454</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos">455</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos">456</span></a> +</span><span id="L-457"><a href="#L-457"><span class="linenos">457</span></a> +</span><span id="L-458"><a href="#L-458"><span class="linenos">458</span></a><span class="k">def</span> <span class="nf">date_literal</span><span class="p">(</span><span class="n">date</span><span class="p">):</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos">459</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos">460</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">date</span><span class="p">),</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos">461</span></a> <span class="s2">"DATETIME"</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">date</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"DATE"</span><span class="p">,</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos">462</span></a> <span class="p">)</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos">463</span></a> +</span><span id="L-464"><a href="#L-464"><span class="linenos">464</span></a> +</span><span id="L-465"><a href="#L-465"><span class="linenos">465</span></a><span class="k">def</span> <span class="nf">boolean_literal</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="L-466"><a href="#L-466"><span class="linenos">466</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">condition</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos">467</span></a> +</span><span id="L-468"><a href="#L-468"><span class="linenos">468</span></a> +</span><span id="L-469"><a href="#L-469"><span class="linenos">469</span></a><span class="k">def</span> <span class="nf">_flat_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">simplifier</span><span class="p">):</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos">470</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos">471</span></a> <span class="n">queue</span> <span class="o">=</span> <span class="n">deque</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(</span><span class="n">unnest</span><span class="o">=</span><span class="kc">False</span><span class="p">))</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos">472</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">queue</span><span class="p">)</span> +</span><span id="L-473"><a href="#L-473"><span class="linenos">473</span></a> +</span><span id="L-474"><a href="#L-474"><span class="linenos">474</span></a> <span class="k">while</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos">475</span></a> <span class="n">a</span> <span class="o">=</span> <span class="n">queue</span><span class="o">.</span><span class="n">popleft</span><span class="p">()</span> +</span><span id="L-476"><a href="#L-476"><span class="linenos">476</span></a> +</span><span id="L-477"><a href="#L-477"><span class="linenos">477</span></a> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">queue</span><span class="p">:</span> +</span><span id="L-478"><a href="#L-478"><span class="linenos">478</span></a> <span class="n">result</span> <span class="o">=</span> <span class="n">simplifier</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos">479</span></a> +</span><span id="L-480"><a href="#L-480"><span class="linenos">480</span></a> <span class="k">if</span> <span class="n">result</span><span class="p">:</span> +</span><span id="L-481"><a href="#L-481"><span class="linenos">481</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> +</span><span id="L-482"><a href="#L-482"><span class="linenos">482</span></a> <span class="n">queue</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">result</span><span class="p">)</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos">483</span></a> <span class="k">break</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos">484</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos">485</span></a> <span class="n">operands</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos">486</span></a> +</span><span id="L-487"><a href="#L-487"><span class="linenos">487</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">operands</span><span class="p">)</span> <span class="o"><</span> <span class="n">size</span><span class="p">:</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos">488</span></a> <span class="k">return</span> <span class="n">functools</span><span class="o">.</span><span class="n">reduce</span><span class="p">(</span><span class="k">lambda</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">:</span> <span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">a</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">b</span><span class="p">),</span> <span class="n">operands</span><span class="p">)</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos">489</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + </section> + <section id="simplify"> + <input id="simplify-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">simplify</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="simplify-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#simplify"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="simplify-16"><a href="#simplify-16"><span class="linenos">16</span></a><span class="k">def</span> <span class="nf">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="simplify-17"><a href="#simplify-17"><span class="linenos">17</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="simplify-18"><a href="#simplify-18"><span class="linenos">18</span></a><span class="sd"> Rewrite sqlglot AST to simplify expressions.</span> +</span><span id="simplify-19"><a href="#simplify-19"><span class="linenos">19</span></a> +</span><span id="simplify-20"><a href="#simplify-20"><span class="linenos">20</span></a><span class="sd"> Example:</span> +</span><span id="simplify-21"><a href="#simplify-21"><span class="linenos">21</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="simplify-22"><a href="#simplify-22"><span class="linenos">22</span></a><span class="sd"> >>> expression = sqlglot.parse_one("TRUE AND TRUE")</span> +</span><span id="simplify-23"><a href="#simplify-23"><span class="linenos">23</span></a><span class="sd"> >>> simplify(expression).sql()</span> +</span><span id="simplify-24"><a href="#simplify-24"><span class="linenos">24</span></a><span class="sd"> 'TRUE'</span> +</span><span id="simplify-25"><a href="#simplify-25"><span class="linenos">25</span></a> +</span><span id="simplify-26"><a href="#simplify-26"><span class="linenos">26</span></a><span class="sd"> Args:</span> +</span><span id="simplify-27"><a href="#simplify-27"><span class="linenos">27</span></a><span class="sd"> expression (sqlglot.Expression): expression to simplify</span> +</span><span id="simplify-28"><a href="#simplify-28"><span class="linenos">28</span></a><span class="sd"> Returns:</span> +</span><span id="simplify-29"><a href="#simplify-29"><span class="linenos">29</span></a><span class="sd"> sqlglot.Expression: simplified expression</span> +</span><span id="simplify-30"><a href="#simplify-30"><span class="linenos">30</span></a><span class="sd"> """</span> +</span><span id="simplify-31"><a href="#simplify-31"><span class="linenos">31</span></a> +</span><span id="simplify-32"><a href="#simplify-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="simplify-33"><a href="#simplify-33"><span class="linenos">33</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="simplify-34"><a href="#simplify-34"><span class="linenos">34</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">rewrite_between</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-35"><a href="#simplify-35"><span class="linenos">35</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">uniq_sort</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-36"><a href="#simplify-36"><span class="linenos">36</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">absorb_and_eliminate</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-37"><a href="#simplify-37"><span class="linenos">37</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">_simplify</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="kc">False</span><span class="p">))</span> +</span><span id="simplify-38"><a href="#simplify-38"><span class="linenos">38</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_not</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-39"><a href="#simplify-39"><span class="linenos">39</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">flatten</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-40"><a href="#simplify-40"><span class="linenos">40</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_connectors</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-41"><a href="#simplify-41"><span class="linenos">41</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">remove_compliments</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-42"><a href="#simplify-42"><span class="linenos">42</span></a> <span class="n">node</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="simplify-43"><a href="#simplify-43"><span class="linenos">43</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_literals</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-44"><a href="#simplify-44"><span class="linenos">44</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">simplify_parens</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-45"><a href="#simplify-45"><span class="linenos">45</span></a> <span class="k">if</span> <span class="n">root</span><span class="p">:</span> +</span><span id="simplify-46"><a href="#simplify-46"><span class="linenos">46</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> +</span><span id="simplify-47"><a href="#simplify-47"><span class="linenos">47</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="simplify-48"><a href="#simplify-48"><span class="linenos">48</span></a> +</span><span id="simplify-49"><a href="#simplify-49"><span class="linenos">49</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">while_changing</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">_simplify</span><span class="p">)</span> +</span><span id="simplify-50"><a href="#simplify-50"><span class="linenos">50</span></a> <span class="n">remove_where_true</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="simplify-51"><a href="#simplify-51"><span class="linenos">51</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to simplify expressions.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"TRUE AND TRUE"</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'TRUE'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to simplify</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: simplified expression</p> +</blockquote> +</div> + + + </section> + <section id="rewrite_between"> + <input id="rewrite_between-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">rewrite_between</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="../expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="rewrite_between-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#rewrite_between"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="rewrite_between-54"><a href="#rewrite_between-54"><span class="linenos">54</span></a><span class="k">def</span> <span class="nf">rewrite_between</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="rewrite_between-55"><a href="#rewrite_between-55"><span class="linenos">55</span></a><span class="w"> </span><span class="sd">"""Rewrite x between y and z to x >= y AND x <= z.</span> +</span><span id="rewrite_between-56"><a href="#rewrite_between-56"><span class="linenos">56</span></a> +</span><span id="rewrite_between-57"><a href="#rewrite_between-57"><span class="linenos">57</span></a><span class="sd"> This is done because comparison simplification is only done on lt/lte/gt/gte.</span> +</span><span id="rewrite_between-58"><a href="#rewrite_between-58"><span class="linenos">58</span></a><span class="sd"> """</span> +</span><span id="rewrite_between-59"><a href="#rewrite_between-59"><span class="linenos">59</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">):</span> +</span><span id="rewrite_between-60"><a href="#rewrite_between-60"><span class="linenos">60</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span> +</span><span id="rewrite_between-61"><a href="#rewrite_between-61"><span class="linenos">61</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"low"</span><span class="p">]),</span> +</span><span id="rewrite_between-62"><a href="#rewrite_between-62"><span class="linenos">62</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"high"</span><span class="p">]),</span> +</span><span id="rewrite_between-63"><a href="#rewrite_between-63"><span class="linenos">63</span></a> <span class="p">)</span> +</span><span id="rewrite_between-64"><a href="#rewrite_between-64"><span class="linenos">64</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite x between y and z to x >= y AND x <= z.</p> + +<p>This is done because comparison simplification is only done on lt/lte/gt/gte.</p> +</div> + + + </section> + <section id="simplify_not"> + <input id="simplify_not-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">simplify_not</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="simplify_not-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#simplify_not"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="simplify_not-67"><a href="#simplify_not-67"><span class="linenos">67</span></a><span class="k">def</span> <span class="nf">simplify_not</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="simplify_not-68"><a href="#simplify_not-68"><span class="linenos">68</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="simplify_not-69"><a href="#simplify_not-69"><span class="linenos">69</span></a><span class="sd"> Demorgan's Law</span> +</span><span id="simplify_not-70"><a href="#simplify_not-70"><span class="linenos">70</span></a><span class="sd"> NOT (x OR y) -> NOT x AND NOT y</span> +</span><span id="simplify_not-71"><a href="#simplify_not-71"><span class="linenos">71</span></a><span class="sd"> NOT (x AND y) -> NOT x OR NOT y</span> +</span><span id="simplify_not-72"><a href="#simplify_not-72"><span class="linenos">72</span></a><span class="sd"> """</span> +</span><span id="simplify_not-73"><a href="#simplify_not-73"><span class="linenos">73</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">):</span> +</span><span id="simplify_not-74"><a href="#simplify_not-74"><span class="linenos">74</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">):</span> +</span><span id="simplify_not-75"><a href="#simplify_not-75"><span class="linenos">75</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="simplify_not-76"><a href="#simplify_not-76"><span class="linenos">76</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">):</span> +</span><span id="simplify_not-77"><a href="#simplify_not-77"><span class="linenos">77</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> +</span><span id="simplify_not-78"><a href="#simplify_not-78"><span class="linenos">78</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">):</span> +</span><span id="simplify_not-79"><a href="#simplify_not-79"><span class="linenos">79</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">left</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">right</span><span class="p">))</span> +</span><span id="simplify_not-80"><a href="#simplify_not-80"><span class="linenos">80</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">):</span> +</span><span id="simplify_not-81"><a href="#simplify_not-81"><span class="linenos">81</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">left</span><span class="p">),</span> <span class="n">exp</span><span class="o">.</span><span class="n">not_</span><span class="p">(</span><span class="n">condition</span><span class="o">.</span><span class="n">right</span><span class="p">))</span> +</span><span id="simplify_not-82"><a href="#simplify_not-82"><span class="linenos">82</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">):</span> +</span><span id="simplify_not-83"><a href="#simplify_not-83"><span class="linenos">83</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="simplify_not-84"><a href="#simplify_not-84"><span class="linenos">84</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">):</span> +</span><span id="simplify_not-85"><a href="#simplify_not-85"><span class="linenos">85</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="simplify_not-86"><a href="#simplify_not-86"><span class="linenos">86</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="simplify_not-87"><a href="#simplify_not-87"><span class="linenos">87</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="simplify_not-88"><a href="#simplify_not-88"><span class="linenos">88</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">):</span> +</span><span id="simplify_not-89"><a href="#simplify_not-89"><span class="linenos">89</span></a> <span class="c1"># double negation</span> +</span><span id="simplify_not-90"><a href="#simplify_not-90"><span class="linenos">90</span></a> <span class="c1"># NOT NOT x -> x</span> +</span><span id="simplify_not-91"><a href="#simplify_not-91"><span class="linenos">91</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">this</span> +</span><span id="simplify_not-92"><a href="#simplify_not-92"><span class="linenos">92</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Demorgan's Law +NOT (x OR y) -> NOT x AND NOT y +NOT (x AND y) -> NOT x OR NOT y</p> +</div> + + + </section> + <section id="flatten"> + <input id="flatten-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">flatten</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="flatten-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#flatten"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="flatten-95"><a href="#flatten-95"><span class="linenos"> 95</span></a><span class="k">def</span> <span class="nf">flatten</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="flatten-96"><a href="#flatten-96"><span class="linenos"> 96</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="flatten-97"><a href="#flatten-97"><span class="linenos"> 97</span></a><span class="sd"> A AND (B AND C) -> A AND B AND C</span> +</span><span id="flatten-98"><a href="#flatten-98"><span class="linenos"> 98</span></a><span class="sd"> A OR (B OR C) -> A OR B OR C</span> +</span><span id="flatten-99"><a href="#flatten-99"><span class="linenos"> 99</span></a><span class="sd"> """</span> +</span><span id="flatten-100"><a href="#flatten-100"><span class="linenos">100</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="flatten-101"><a href="#flatten-101"><span class="linenos">101</span></a> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="flatten-102"><a href="#flatten-102"><span class="linenos">102</span></a> <span class="n">child</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">unnest</span><span class="p">()</span> +</span><span id="flatten-103"><a href="#flatten-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">child</span><span class="p">,</span> <span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">):</span> +</span><span id="flatten-104"><a href="#flatten-104"><span class="linenos">104</span></a> <span class="n">node</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">child</span><span class="p">)</span> +</span><span id="flatten-105"><a href="#flatten-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>A AND (B AND C) -> A AND B AND C +A OR (B OR C) -> A OR B OR C</p> +</div> + + + </section> + <section id="simplify_connectors"> + <input id="simplify_connectors-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">simplify_connectors</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="simplify_connectors-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#simplify_connectors"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="simplify_connectors-108"><a href="#simplify_connectors-108"><span class="linenos">108</span></a><span class="k">def</span> <span class="nf">simplify_connectors</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="simplify_connectors-109"><a href="#simplify_connectors-109"><span class="linenos">109</span></a> <span class="k">def</span> <span class="nf">_simplify_connectors</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">):</span> +</span><span id="simplify_connectors-110"><a href="#simplify_connectors-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="simplify_connectors-111"><a href="#simplify_connectors-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="n">left</span> <span class="o">==</span> <span class="n">right</span><span class="p">:</span> +</span><span id="simplify_connectors-112"><a href="#simplify_connectors-112"><span class="linenos">112</span></a> <span class="k">return</span> <span class="n">left</span> +</span><span id="simplify_connectors-113"><a href="#simplify_connectors-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">):</span> +</span><span id="simplify_connectors-114"><a href="#simplify_connectors-114"><span class="linenos">114</span></a> <span class="k">if</span> <span class="n">FALSE</span> <span class="ow">in</span> <span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">):</span> +</span><span id="simplify_connectors-115"><a href="#simplify_connectors-115"><span class="linenos">115</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="simplify_connectors-116"><a href="#simplify_connectors-116"><span class="linenos">116</span></a> <span class="k">if</span> <span class="n">NULL</span> <span class="ow">in</span> <span class="p">(</span><span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">):</span> +</span><span id="simplify_connectors-117"><a href="#simplify_connectors-117"><span class="linenos">117</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="simplify_connectors-118"><a href="#simplify_connectors-118"><span class="linenos">118</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> <span class="ow">and</span> <span class="n">always_true</span><span class="p">(</span><span class="n">right</span><span class="p">):</span> +</span><span id="simplify_connectors-119"><a href="#simplify_connectors-119"><span class="linenos">119</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="simplify_connectors-120"><a href="#simplify_connectors-120"><span class="linenos">120</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">left</span><span class="p">):</span> +</span><span id="simplify_connectors-121"><a href="#simplify_connectors-121"><span class="linenos">121</span></a> <span class="k">return</span> <span class="n">right</span> +</span><span id="simplify_connectors-122"><a href="#simplify_connectors-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">right</span><span class="p">):</span> +</span><span id="simplify_connectors-123"><a href="#simplify_connectors-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">left</span> +</span><span id="simplify_connectors-124"><a href="#simplify_connectors-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="n">_simplify_comparison</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">)</span> +</span><span id="simplify_connectors-125"><a href="#simplify_connectors-125"><span class="linenos">125</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">):</span> +</span><span id="simplify_connectors-126"><a href="#simplify_connectors-126"><span class="linenos">126</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> <span class="ow">or</span> <span class="n">always_true</span><span class="p">(</span><span class="n">right</span><span class="p">):</span> +</span><span id="simplify_connectors-127"><a href="#simplify_connectors-127"><span class="linenos">127</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="simplify_connectors-128"><a href="#simplify_connectors-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="n">left</span> <span class="o">==</span> <span class="n">FALSE</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="simplify_connectors-129"><a href="#simplify_connectors-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span><span id="simplify_connectors-130"><a href="#simplify_connectors-130"><span class="linenos">130</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="simplify_connectors-131"><a href="#simplify_connectors-131"><span class="linenos">131</span></a> <span class="p">(</span><span class="n">left</span> <span class="o">==</span> <span class="n">NULL</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span> +</span><span id="simplify_connectors-132"><a href="#simplify_connectors-132"><span class="linenos">132</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">left</span> <span class="o">==</span> <span class="n">NULL</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">)</span> +</span><span id="simplify_connectors-133"><a href="#simplify_connectors-133"><span class="linenos">133</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">left</span> <span class="o">==</span> <span class="n">FALSE</span> <span class="ow">and</span> <span class="n">right</span> <span class="o">==</span> <span class="n">NULL</span><span class="p">)</span> +</span><span id="simplify_connectors-134"><a href="#simplify_connectors-134"><span class="linenos">134</span></a> <span class="p">):</span> +</span><span id="simplify_connectors-135"><a href="#simplify_connectors-135"><span class="linenos">135</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="simplify_connectors-136"><a href="#simplify_connectors-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="n">left</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="simplify_connectors-137"><a href="#simplify_connectors-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="n">right</span> +</span><span id="simplify_connectors-138"><a href="#simplify_connectors-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="n">right</span> <span class="o">==</span> <span class="n">FALSE</span><span class="p">:</span> +</span><span id="simplify_connectors-139"><a href="#simplify_connectors-139"><span class="linenos">139</span></a> <span class="k">return</span> <span class="n">left</span> +</span><span id="simplify_connectors-140"><a href="#simplify_connectors-140"><span class="linenos">140</span></a> <span class="k">return</span> <span class="n">_simplify_comparison</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">left</span><span class="p">,</span> <span class="n">right</span><span class="p">,</span> <span class="n">or_</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="simplify_connectors-141"><a href="#simplify_connectors-141"><span class="linenos">141</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="simplify_connectors-142"><a href="#simplify_connectors-142"><span class="linenos">142</span></a> +</span><span id="simplify_connectors-143"><a href="#simplify_connectors-143"><span class="linenos">143</span></a> <span class="k">return</span> <span class="n">_flat_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">_simplify_connectors</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="remove_compliments"> + <input id="remove_compliments-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">remove_compliments</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="remove_compliments-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#remove_compliments"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="remove_compliments-224"><a href="#remove_compliments-224"><span class="linenos">224</span></a><span class="k">def</span> <span class="nf">remove_compliments</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="remove_compliments-225"><a href="#remove_compliments-225"><span class="linenos">225</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="remove_compliments-226"><a href="#remove_compliments-226"><span class="linenos">226</span></a><span class="sd"> Removing compliments.</span> +</span><span id="remove_compliments-227"><a href="#remove_compliments-227"><span class="linenos">227</span></a> +</span><span id="remove_compliments-228"><a href="#remove_compliments-228"><span class="linenos">228</span></a><span class="sd"> A AND NOT A -> FALSE</span> +</span><span id="remove_compliments-229"><a href="#remove_compliments-229"><span class="linenos">229</span></a><span class="sd"> A OR NOT A -> TRUE</span> +</span><span id="remove_compliments-230"><a href="#remove_compliments-230"><span class="linenos">230</span></a><span class="sd"> """</span> +</span><span id="remove_compliments-231"><a href="#remove_compliments-231"><span class="linenos">231</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="remove_compliments-232"><a href="#remove_compliments-232"><span class="linenos">232</span></a> <span class="n">compliment</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> +</span><span id="remove_compliments-233"><a href="#remove_compliments-233"><span class="linenos">233</span></a> +</span><span id="remove_compliments-234"><a href="#remove_compliments-234"><span class="linenos">234</span></a> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(),</span> <span class="mi">2</span><span class="p">):</span> +</span><span id="remove_compliments-235"><a href="#remove_compliments-235"><span class="linenos">235</span></a> <span class="k">if</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="remove_compliments-236"><a href="#remove_compliments-236"><span class="linenos">236</span></a> <span class="k">return</span> <span class="n">compliment</span> +</span><span id="remove_compliments-237"><a href="#remove_compliments-237"><span class="linenos">237</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Removing compliments.</p> + +<p>A AND NOT A -> FALSE +A OR NOT A -> TRUE</p> +</div> + + + </section> + <section id="uniq_sort"> + <input id="uniq_sort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">uniq_sort</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="uniq_sort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#uniq_sort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="uniq_sort-240"><a href="#uniq_sort-240"><span class="linenos">240</span></a><span class="k">def</span> <span class="nf">uniq_sort</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="uniq_sort-241"><a href="#uniq_sort-241"><span class="linenos">241</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="uniq_sort-242"><a href="#uniq_sort-242"><span class="linenos">242</span></a><span class="sd"> Uniq and sort a connector.</span> +</span><span id="uniq_sort-243"><a href="#uniq_sort-243"><span class="linenos">243</span></a> +</span><span id="uniq_sort-244"><a href="#uniq_sort-244"><span class="linenos">244</span></a><span class="sd"> C AND A AND B AND B -> A AND B AND C</span> +</span><span id="uniq_sort-245"><a href="#uniq_sort-245"><span class="linenos">245</span></a><span class="sd"> """</span> +</span><span id="uniq_sort-246"><a href="#uniq_sort-246"><span class="linenos">246</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="uniq_sort-247"><a href="#uniq_sort-247"><span class="linenos">247</span></a> <span class="n">result_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">and_</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">or_</span> +</span><span id="uniq_sort-248"><a href="#uniq_sort-248"><span class="linenos">248</span></a> <span class="n">flattened</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">())</span> +</span><span id="uniq_sort-249"><a href="#uniq_sort-249"><span class="linenos">249</span></a> <span class="n">deduped</span> <span class="o">=</span> <span class="p">{</span><span class="n">GENERATOR</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="n">e</span><span class="p">):</span> <span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">flattened</span><span class="p">}</span> +</span><span id="uniq_sort-250"><a href="#uniq_sort-250"><span class="linenos">250</span></a> <span class="n">arr</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">deduped</span><span class="o">.</span><span class="n">items</span><span class="p">())</span> +</span><span id="uniq_sort-251"><a href="#uniq_sort-251"><span class="linenos">251</span></a> +</span><span id="uniq_sort-252"><a href="#uniq_sort-252"><span class="linenos">252</span></a> <span class="c1"># check if the operands are already sorted, if not sort them</span> +</span><span id="uniq_sort-253"><a href="#uniq_sort-253"><span class="linenos">253</span></a> <span class="c1"># A AND C AND B -> A AND B AND C</span> +</span><span id="uniq_sort-254"><a href="#uniq_sort-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="p">(</span><span class="n">sql</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">arr</span><span class="p">[</span><span class="mi">1</span><span class="p">:]):</span> +</span><span id="uniq_sort-255"><a href="#uniq_sort-255"><span class="linenos">255</span></a> <span class="k">if</span> <span class="n">sql</span> <span class="o"><</span> <span class="n">arr</span><span class="p">[</span><span class="n">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]:</span> +</span><span id="uniq_sort-256"><a href="#uniq_sort-256"><span class="linenos">256</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">result_func</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="n">deduped</span><span class="p">[</span><span class="n">sql</span><span class="p">]</span> <span class="k">for</span> <span class="n">sql</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">deduped</span><span class="p">)))</span> +</span><span id="uniq_sort-257"><a href="#uniq_sort-257"><span class="linenos">257</span></a> <span class="k">break</span> +</span><span id="uniq_sort-258"><a href="#uniq_sort-258"><span class="linenos">258</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="uniq_sort-259"><a href="#uniq_sort-259"><span class="linenos">259</span></a> <span class="c1"># we didn't have to sort but maybe we need to dedup</span> +</span><span id="uniq_sort-260"><a href="#uniq_sort-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">deduped</span><span class="p">)</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="n">flattened</span><span class="p">):</span> +</span><span id="uniq_sort-261"><a href="#uniq_sort-261"><span class="linenos">261</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">result_func</span><span class="p">(</span><span class="o">*</span><span class="n">deduped</span><span class="o">.</span><span class="n">values</span><span class="p">())</span> +</span><span id="uniq_sort-262"><a href="#uniq_sort-262"><span class="linenos">262</span></a> +</span><span id="uniq_sort-263"><a href="#uniq_sort-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Uniq and sort a connector.</p> + +<p>C AND A AND B AND B -> A AND B AND C</p> +</div> + + + </section> + <section id="absorb_and_eliminate"> + <input id="absorb_and_eliminate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">absorb_and_eliminate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="absorb_and_eliminate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#absorb_and_eliminate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="absorb_and_eliminate-266"><a href="#absorb_and_eliminate-266"><span class="linenos">266</span></a><span class="k">def</span> <span class="nf">absorb_and_eliminate</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-267"><a href="#absorb_and_eliminate-267"><span class="linenos">267</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="absorb_and_eliminate-268"><a href="#absorb_and_eliminate-268"><span class="linenos">268</span></a><span class="sd"> absorption:</span> +</span><span id="absorb_and_eliminate-269"><a href="#absorb_and_eliminate-269"><span class="linenos">269</span></a><span class="sd"> A AND (A OR B) -> A</span> +</span><span id="absorb_and_eliminate-270"><a href="#absorb_and_eliminate-270"><span class="linenos">270</span></a><span class="sd"> A OR (A AND B) -> A</span> +</span><span id="absorb_and_eliminate-271"><a href="#absorb_and_eliminate-271"><span class="linenos">271</span></a><span class="sd"> A AND (NOT A OR B) -> A AND B</span> +</span><span id="absorb_and_eliminate-272"><a href="#absorb_and_eliminate-272"><span class="linenos">272</span></a><span class="sd"> A OR (NOT A AND B) -> A OR B</span> +</span><span id="absorb_and_eliminate-273"><a href="#absorb_and_eliminate-273"><span class="linenos">273</span></a><span class="sd"> elimination:</span> +</span><span id="absorb_and_eliminate-274"><a href="#absorb_and_eliminate-274"><span class="linenos">274</span></a><span class="sd"> (A AND B) OR (A AND NOT B) -> A</span> +</span><span id="absorb_and_eliminate-275"><a href="#absorb_and_eliminate-275"><span class="linenos">275</span></a><span class="sd"> (A OR B) AND (A OR NOT B) -> A</span> +</span><span id="absorb_and_eliminate-276"><a href="#absorb_and_eliminate-276"><span class="linenos">276</span></a><span class="sd"> """</span> +</span><span id="absorb_and_eliminate-277"><a href="#absorb_and_eliminate-277"><span class="linenos">277</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Connector</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-278"><a href="#absorb_and_eliminate-278"><span class="linenos">278</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">)</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> +</span><span id="absorb_and_eliminate-279"><a href="#absorb_and_eliminate-279"><span class="linenos">279</span></a> +</span><span id="absorb_and_eliminate-280"><a href="#absorb_and_eliminate-280"><span class="linenos">280</span></a> <span class="k">for</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">itertools</span><span class="o">.</span><span class="n">permutations</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">flatten</span><span class="p">(),</span> <span class="mi">2</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-281"><a href="#absorb_and_eliminate-281"><span class="linenos">281</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-282"><a href="#absorb_and_eliminate-282"><span class="linenos">282</span></a> <span class="n">aa</span><span class="p">,</span> <span class="n">ab</span> <span class="o">=</span> <span class="n">a</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="absorb_and_eliminate-283"><a href="#absorb_and_eliminate-283"><span class="linenos">283</span></a> +</span><span id="absorb_and_eliminate-284"><a href="#absorb_and_eliminate-284"><span class="linenos">284</span></a> <span class="c1"># absorb</span> +</span><span id="absorb_and_eliminate-285"><a href="#absorb_and_eliminate-285"><span class="linenos">285</span></a> <span class="k">if</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">aa</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-286"><a href="#absorb_and_eliminate-286"><span class="linenos">286</span></a> <span class="n">aa</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">())</span> +</span><span id="absorb_and_eliminate-287"><a href="#absorb_and_eliminate-287"><span class="linenos">287</span></a> <span class="k">elif</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">ab</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-288"><a href="#absorb_and_eliminate-288"><span class="linenos">288</span></a> <span class="n">ab</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">())</span> +</span><span id="absorb_and_eliminate-289"><a href="#absorb_and_eliminate-289"><span class="linenos">289</span></a> <span class="k">elif</span> <span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">flatten</span><span class="p">())</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">kind</span><span class="p">)</span> <span class="k">else</span> <span class="p">{</span><span class="n">b</span><span class="p">})</span> <span class="o"><</span> <span class="nb">set</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">flatten</span><span class="p">()):</span> +</span><span id="absorb_and_eliminate-290"><a href="#absorb_and_eliminate-290"><span class="linenos">290</span></a> <span class="n">a</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="absorb_and_eliminate-291"><a href="#absorb_and_eliminate-291"><span class="linenos">291</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">kind</span><span class="p">):</span> +</span><span id="absorb_and_eliminate-292"><a href="#absorb_and_eliminate-292"><span class="linenos">292</span></a> <span class="c1"># eliminate</span> +</span><span id="absorb_and_eliminate-293"><a href="#absorb_and_eliminate-293"><span class="linenos">293</span></a> <span class="n">rhs</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">()</span> +</span><span id="absorb_and_eliminate-294"><a href="#absorb_and_eliminate-294"><span class="linenos">294</span></a> <span class="n">ba</span><span class="p">,</span> <span class="n">bb</span> <span class="o">=</span> <span class="n">rhs</span> +</span><span id="absorb_and_eliminate-295"><a href="#absorb_and_eliminate-295"><span class="linenos">295</span></a> +</span><span id="absorb_and_eliminate-296"><a href="#absorb_and_eliminate-296"><span class="linenos">296</span></a> <span class="k">if</span> <span class="n">aa</span> <span class="ow">in</span> <span class="n">rhs</span> <span class="ow">and</span> <span class="p">(</span><span class="n">is_complement</span><span class="p">(</span><span class="n">ab</span><span class="p">,</span> <span class="n">ba</span><span class="p">)</span> <span class="ow">or</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">ab</span><span class="p">,</span> <span class="n">bb</span><span class="p">)):</span> +</span><span id="absorb_and_eliminate-297"><a href="#absorb_and_eliminate-297"><span class="linenos">297</span></a> <span class="n">a</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">aa</span><span class="p">)</span> +</span><span id="absorb_and_eliminate-298"><a href="#absorb_and_eliminate-298"><span class="linenos">298</span></a> <span class="n">b</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">aa</span><span class="p">)</span> +</span><span id="absorb_and_eliminate-299"><a href="#absorb_and_eliminate-299"><span class="linenos">299</span></a> <span class="k">elif</span> <span class="n">ab</span> <span class="ow">in</span> <span class="n">rhs</span> <span class="ow">and</span> <span class="p">(</span><span class="n">is_complement</span><span class="p">(</span><span class="n">aa</span><span class="p">,</span> <span class="n">ba</span><span class="p">)</span> <span class="ow">or</span> <span class="n">is_complement</span><span class="p">(</span><span class="n">aa</span><span class="p">,</span> <span class="n">bb</span><span class="p">)):</span> +</span><span id="absorb_and_eliminate-300"><a href="#absorb_and_eliminate-300"><span class="linenos">300</span></a> <span class="n">a</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">ab</span><span class="p">)</span> +</span><span id="absorb_and_eliminate-301"><a href="#absorb_and_eliminate-301"><span class="linenos">301</span></a> <span class="n">b</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">ab</span><span class="p">)</span> +</span><span id="absorb_and_eliminate-302"><a href="#absorb_and_eliminate-302"><span class="linenos">302</span></a> +</span><span id="absorb_and_eliminate-303"><a href="#absorb_and_eliminate-303"><span class="linenos">303</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>absorption: + A AND (A OR B) -> A + A OR (A AND B) -> A + A AND (NOT A OR B) -> A AND B + A OR (NOT A AND B) -> A OR B +elimination: + (A AND B) OR (A AND NOT B) -> A + (A OR B) AND (A OR NOT B) -> A</p> +</div> + + + </section> + <section id="simplify_literals"> + <input id="simplify_literals-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">simplify_literals</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="simplify_literals-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#simplify_literals"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="simplify_literals-306"><a href="#simplify_literals-306"><span class="linenos">306</span></a><span class="k">def</span> <span class="nf">simplify_literals</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="simplify_literals-307"><a href="#simplify_literals-307"><span class="linenos">307</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="simplify_literals-308"><a href="#simplify_literals-308"><span class="linenos">308</span></a> <span class="k">return</span> <span class="n">_flat_simplify</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">_simplify_binary</span><span class="p">)</span> +</span><span id="simplify_literals-309"><a href="#simplify_literals-309"><span class="linenos">309</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">):</span> +</span><span id="simplify_literals-310"><a href="#simplify_literals-310"><span class="linenos">310</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="simplify_literals-311"><a href="#simplify_literals-311"><span class="linenos">311</span></a> <span class="k">if</span> <span class="n">this</span><span class="o">.</span><span class="n">is_number</span><span class="p">:</span> +</span><span id="simplify_literals-312"><a href="#simplify_literals-312"><span class="linenos">312</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span> +</span><span id="simplify_literals-313"><a href="#simplify_literals-313"><span class="linenos">313</span></a> <span class="k">if</span> <span class="n">value</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">"-"</span><span class="p">:</span> +</span><span id="simplify_literals-314"><a href="#simplify_literals-314"><span class="linenos">314</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">value</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span> +</span><span id="simplify_literals-315"><a href="#simplify_literals-315"><span class="linenos">315</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="sa">f</span><span class="s2">"-</span><span class="si">{</span><span class="n">value</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="simplify_literals-316"><a href="#simplify_literals-316"><span class="linenos">316</span></a> +</span><span id="simplify_literals-317"><a href="#simplify_literals-317"><span class="linenos">317</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </section> + <section id="simplify_parens"> + <input id="simplify_parens-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">simplify_parens</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="simplify_parens-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#simplify_parens"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="simplify_parens-379"><a href="#simplify_parens-379"><span class="linenos">379</span></a><span class="k">def</span> <span class="nf">simplify_parens</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="simplify_parens-380"><a href="#simplify_parens-380"><span class="linenos">380</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="simplify_parens-381"><a href="#simplify_parens-381"><span class="linenos">381</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">)</span> +</span><span id="simplify_parens-382"><a href="#simplify_parens-382"><span class="linenos">382</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="simplify_parens-383"><a href="#simplify_parens-383"><span class="linenos">383</span></a> <span class="ow">and</span> <span class="p">(</span> +</span><span id="simplify_parens-384"><a href="#simplify_parens-384"><span class="linenos">384</span></a> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">))</span> +</span><span id="simplify_parens-385"><a href="#simplify_parens-385"><span class="linenos">385</span></a> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">))</span> +</span><span id="simplify_parens-386"><a href="#simplify_parens-386"><span class="linenos">386</span></a> <span class="ow">or</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">)</span> +</span><span id="simplify_parens-387"><a href="#simplify_parens-387"><span class="linenos">387</span></a> <span class="p">)</span> +</span><span id="simplify_parens-388"><a href="#simplify_parens-388"><span class="linenos">388</span></a> <span class="p">):</span> +</span><span id="simplify_parens-389"><a href="#simplify_parens-389"><span class="linenos">389</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="simplify_parens-390"><a href="#simplify_parens-390"><span class="linenos">390</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + + + </section> + <section id="remove_where_true"> + <input id="remove_where_true-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">remove_where_true</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="remove_where_true-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#remove_where_true"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="remove_where_true-393"><a href="#remove_where_true-393"><span class="linenos">393</span></a><span class="k">def</span> <span class="nf">remove_where_true</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="remove_where_true-394"><a href="#remove_where_true-394"><span class="linenos">394</span></a> <span class="k">for</span> <span class="n">where</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">):</span> +</span><span id="remove_where_true-395"><a href="#remove_where_true-395"><span class="linenos">395</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">where</span><span class="o">.</span><span class="n">this</span><span class="p">):</span> +</span><span id="remove_where_true-396"><a href="#remove_where_true-396"><span class="linenos">396</span></a> <span class="n">where</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"where"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="remove_where_true-397"><a href="#remove_where_true-397"><span class="linenos">397</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">):</span> +</span><span id="remove_where_true-398"><a href="#remove_where_true-398"><span class="linenos">398</span></a> <span class="k">if</span> <span class="n">always_true</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)):</span> +</span><span id="remove_where_true-399"><a href="#remove_where_true-399"><span class="linenos">399</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"kind"</span><span class="p">,</span> <span class="s2">"CROSS"</span><span class="p">)</span> +</span><span id="remove_where_true-400"><a href="#remove_where_true-400"><span class="linenos">400</span></a> <span class="n">join</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"on"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="always_true"> + <input id="always_true-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">always_true</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="always_true-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#always_true"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="always_true-403"><a href="#always_true-403"><span class="linenos">403</span></a><span class="k">def</span> <span class="nf">always_true</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="always_true-404"><a href="#always_true-404"><span class="linenos">404</span></a> <span class="k">return</span> <span class="n">expression</span> <span class="o">==</span> <span class="n">TRUE</span> <span class="ow">or</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="is_complement"> + <input id="is_complement-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">is_complement</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">a</span>, </span><span class="param"><span class="n">b</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="is_complement-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#is_complement"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="is_complement-407"><a href="#is_complement-407"><span class="linenos">407</span></a><span class="k">def</span> <span class="nf">is_complement</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="is_complement-408"><a href="#is_complement-408"><span class="linenos">408</span></a> <span class="k">return</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">)</span> <span class="ow">and</span> <span class="n">b</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">a</span> +</span></pre></div> + + + + + </section> + <section id="eval_boolean"> + <input id="eval_boolean-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eval_boolean</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span>, </span><span class="param"><span class="n">a</span>, </span><span class="param"><span class="n">b</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="eval_boolean-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#eval_boolean"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="eval_boolean-411"><a href="#eval_boolean-411"><span class="linenos">411</span></a><span class="k">def</span> <span class="nf">eval_boolean</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span> +</span><span id="eval_boolean-412"><a href="#eval_boolean-412"><span class="linenos">412</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">)):</span> +</span><span id="eval_boolean-413"><a href="#eval_boolean-413"><span class="linenos">413</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">==</span> <span class="n">b</span><span class="p">)</span> +</span><span id="eval_boolean-414"><a href="#eval_boolean-414"><span class="linenos">414</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">):</span> +</span><span id="eval_boolean-415"><a href="#eval_boolean-415"><span class="linenos">415</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">!=</span> <span class="n">b</span><span class="p">)</span> +</span><span id="eval_boolean-416"><a href="#eval_boolean-416"><span class="linenos">416</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="eval_boolean-417"><a href="#eval_boolean-417"><span class="linenos">417</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">></span> <span class="n">b</span><span class="p">)</span> +</span><span id="eval_boolean-418"><a href="#eval_boolean-418"><span class="linenos">418</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">):</span> +</span><span id="eval_boolean-419"><a href="#eval_boolean-419"><span class="linenos">419</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o">>=</span> <span class="n">b</span><span class="p">)</span> +</span><span id="eval_boolean-420"><a href="#eval_boolean-420"><span class="linenos">420</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="eval_boolean-421"><a href="#eval_boolean-421"><span class="linenos">421</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o"><</span> <span class="n">b</span><span class="p">)</span> +</span><span id="eval_boolean-422"><a href="#eval_boolean-422"><span class="linenos">422</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">):</span> +</span><span id="eval_boolean-423"><a href="#eval_boolean-423"><span class="linenos">423</span></a> <span class="k">return</span> <span class="n">boolean_literal</span><span class="p">(</span><span class="n">a</span> <span class="o"><=</span> <span class="n">b</span><span class="p">)</span> +</span><span id="eval_boolean-424"><a href="#eval_boolean-424"><span class="linenos">424</span></a> <span class="k">return</span> <span class="kc">None</span> +</span></pre></div> + + + + + </section> + <section id="extract_date"> + <input id="extract_date-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">extract_date</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">cast</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="extract_date-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#extract_date"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="extract_date-427"><a href="#extract_date-427"><span class="linenos">427</span></a><span class="k">def</span> <span class="nf">extract_date</span><span class="p">(</span><span class="n">cast</span><span class="p">):</span> +</span><span id="extract_date-428"><a href="#extract_date-428"><span class="linenos">428</span></a> <span class="c1"># The "fromisoformat" conversion could fail if the cast is used on an identifier,</span> +</span><span id="extract_date-429"><a href="#extract_date-429"><span class="linenos">429</span></a> <span class="c1"># so in that case we can't extract the date.</span> +</span><span id="extract_date-430"><a href="#extract_date-430"><span class="linenos">430</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="extract_date-431"><a href="#extract_date-431"><span class="linenos">431</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span><span class="p">:</span> +</span><span id="extract_date-432"><a href="#extract_date-432"><span class="linenos">432</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">cast</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="extract_date-433"><a href="#extract_date-433"><span class="linenos">433</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"to"</span><span class="p">]</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">:</span> +</span><span id="extract_date-434"><a href="#extract_date-434"><span class="linenos">434</span></a> <span class="k">return</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="o">.</span><span class="n">fromisoformat</span><span class="p">(</span><span class="n">cast</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="extract_date-435"><a href="#extract_date-435"><span class="linenos">435</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="extract_date-436"><a href="#extract_date-436"><span class="linenos">436</span></a> <span class="k">return</span> <span class="kc">None</span> +</span></pre></div> + + + + + </section> + <section id="extract_interval"> + <input id="extract_interval-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">extract_interval</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">interval</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="extract_interval-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#extract_interval"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="extract_interval-439"><a href="#extract_interval-439"><span class="linenos">439</span></a><span class="k">def</span> <span class="nf">extract_interval</span><span class="p">(</span><span class="n">interval</span><span class="p">):</span> +</span><span id="extract_interval-440"><a href="#extract_interval-440"><span class="linenos">440</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="extract_interval-441"><a href="#extract_interval-441"><span class="linenos">441</span></a> <span class="kn">from</span> <span class="nn">dateutil.relativedelta</span> <span class="kn">import</span> <span class="n">relativedelta</span> <span class="c1"># type: ignore</span> +</span><span id="extract_interval-442"><a href="#extract_interval-442"><span class="linenos">442</span></a> <span class="k">except</span> <span class="ne">ModuleNotFoundError</span><span class="p">:</span> +</span><span id="extract_interval-443"><a href="#extract_interval-443"><span class="linenos">443</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="extract_interval-444"><a href="#extract_interval-444"><span class="linenos">444</span></a> +</span><span id="extract_interval-445"><a href="#extract_interval-445"><span class="linenos">445</span></a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">interval</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="extract_interval-446"><a href="#extract_interval-446"><span class="linenos">446</span></a> <span class="n">unit</span> <span class="o">=</span> <span class="n">interval</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"unit"</span><span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="extract_interval-447"><a href="#extract_interval-447"><span class="linenos">447</span></a> +</span><span id="extract_interval-448"><a href="#extract_interval-448"><span class="linenos">448</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"year"</span><span class="p">:</span> +</span><span id="extract_interval-449"><a href="#extract_interval-449"><span class="linenos">449</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">years</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="extract_interval-450"><a href="#extract_interval-450"><span class="linenos">450</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"month"</span><span class="p">:</span> +</span><span id="extract_interval-451"><a href="#extract_interval-451"><span class="linenos">451</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">months</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="extract_interval-452"><a href="#extract_interval-452"><span class="linenos">452</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"week"</span><span class="p">:</span> +</span><span id="extract_interval-453"><a href="#extract_interval-453"><span class="linenos">453</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">weeks</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="extract_interval-454"><a href="#extract_interval-454"><span class="linenos">454</span></a> <span class="k">if</span> <span class="n">unit</span> <span class="o">==</span> <span class="s2">"day"</span><span class="p">:</span> +</span><span id="extract_interval-455"><a href="#extract_interval-455"><span class="linenos">455</span></a> <span class="k">return</span> <span class="n">relativedelta</span><span class="p">(</span><span class="n">days</span><span class="o">=</span><span class="n">n</span><span class="p">)</span> +</span><span id="extract_interval-456"><a href="#extract_interval-456"><span class="linenos">456</span></a> <span class="k">return</span> <span class="kc">None</span> +</span></pre></div> + + + + + </section> + <section id="date_literal"> + <input id="date_literal-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">date_literal</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">date</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="date_literal-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#date_literal"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="date_literal-459"><a href="#date_literal-459"><span class="linenos">459</span></a><span class="k">def</span> <span class="nf">date_literal</span><span class="p">(</span><span class="n">date</span><span class="p">):</span> +</span><span id="date_literal-460"><a href="#date_literal-460"><span class="linenos">460</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span> +</span><span id="date_literal-461"><a href="#date_literal-461"><span class="linenos">461</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">date</span><span class="p">),</span> +</span><span id="date_literal-462"><a href="#date_literal-462"><span class="linenos">462</span></a> <span class="s2">"DATETIME"</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">date</span><span class="p">,</span> <span class="n">datetime</span><span class="o">.</span><span class="n">datetime</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"DATE"</span><span class="p">,</span> +</span><span id="date_literal-463"><a href="#date_literal-463"><span class="linenos">463</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="boolean_literal"> + <input id="boolean_literal-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">boolean_literal</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">condition</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="boolean_literal-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#boolean_literal"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="boolean_literal-466"><a href="#boolean_literal-466"><span class="linenos">466</span></a><span class="k">def</span> <span class="nf">boolean_literal</span><span class="p">(</span><span class="n">condition</span><span class="p">):</span> +</span><span id="boolean_literal-467"><a href="#boolean_literal-467"><span class="linenos">467</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">()</span> <span class="k">if</span> <span class="n">condition</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">false</span><span class="p">()</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/optimizer/unnest_subqueries.html b/docs/sqlglot/optimizer/unnest_subqueries.html new file mode 100644 index 0000000..0102e43 --- /dev/null +++ b/docs/sqlglot/optimizer/unnest_subqueries.html @@ -0,0 +1,835 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.optimizer.unnest_subqueries API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../optimizer.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot.optimizer</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#unnest_subqueries">unnest_subqueries</a> + </li> + <li> + <a class="function" href="#unnest">unnest</a> + </li> + <li> + <a class="function" href="#decorrelate">decorrelate</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/optimizer/unnest_subqueries.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../../sqlglot.html">sqlglot</a><wbr>.<a href="./../optimizer.html">optimizer</a><wbr>.unnest_subqueries </h1> + + + <input id="mod-unnest_subqueries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-unnest_subqueries-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.scope</span> <span class="kn">import</span> <span class="n">ScopeType</span><span class="p">,</span> <span class="n">traverse_scope</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">unnest_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="sd"> Rewrite sqlglot AST to convert some predicates with subqueries into joins.</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="sd"> Convert scalar subqueries into cross joins.</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="sd"> Convert correlated or vectorized subqueries into a group by so it is not a many to many left join.</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="sd"> Example:</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT * FROM x AS x WHERE (SELECT y.a AS a FROM y AS y WHERE x.a = y.a) = 1 ")</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> >>> unnest_subqueries(expression).sql()</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> 'SELECT * FROM x AS x LEFT JOIN (SELECT y.a AS a FROM y AS y WHERE TRUE GROUP BY y.a) AS _u_0 ON x.a = _u_0.a WHERE _u_0.a = 1'</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> Args:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="sd"> expression (sqlglot.Expression): expression to unnest</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> Returns:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> sqlglot.Expression: unnested expression</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="sd"> """</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">parent_select</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">parent</span><span class="p">:</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">continue</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span><span class="p">:</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">decorrelate</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span><span class="p">,</span> <span class="n">sequence</span><span class="p">)</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">elif</span> <span class="n">scope</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">SUBQUERY</span><span class="p">:</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">unnest</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">sequence</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent_select</span><span class="p">,</span> <span class="n">sequence</span><span class="p">):</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="k">return</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">)</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">predicate</span> <span class="ow">or</span> <span class="n">parent_select</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">predicate</span><span class="o">.</span><span class="n">parent_select</span><span class="p">:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="k">return</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="c1"># this subquery returns a scalar and can just be converted to a cross join</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">)):</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">having</span> <span class="o">=</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="k">if</span> <span class="n">having</span> <span class="ow">and</span> <span class="n">having</span><span class="o">.</span><span class="n">parent_select</span> <span class="ow">is</span> <span class="n">parent_select</span><span class="p">:</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">)</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">_replace</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">column</span><span class="p">)</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">parent_select</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="n">select</span><span class="p">,</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"CROSS"</span><span class="p">,</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="k">return</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">):</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="k">return</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">predicate</span> <span class="ow">or</span> <span class="n">parent_select</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">predicate</span><span class="o">.</span><span class="n">parent_select</span><span class="p">:</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">return</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">_other_operand</span><span class="p">(</span><span class="n">predicate</span><span class="p">)</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">condition</span><span class="p">(</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">column</span><span class="si">}</span><span class="s1"> = "</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s1">"."</span><span class="si">{</span><span class="n">value</span><span class="o">.</span><span class="n">alias</span><span class="si">}</span><span class="s1">"'</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">_replace</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="n">on</span><span class="o">.</span><span class="n">right</span><span class="si">}</span><span class="s2"> IS NULL"</span><span class="p">)</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">parent_select</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">select</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">on</span><span class="o">=</span><span class="n">on</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"LEFT"</span><span class="p">,</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a><span class="k">def</span> <span class="nf">decorrelate</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent_select</span><span class="p">,</span> <span class="n">external_columns</span><span class="p">,</span> <span class="n">sequence</span><span class="p">):</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">where</span> <span class="ow">or</span> <span class="n">where</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="ow">or</span> <span class="n">select</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">):</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">return</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="c1"># for all external columns in the where statement, find the relevant predicate</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="c1"># keys to convert it into a join</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">external_columns</span><span class="p">:</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">where</span><span class="p">:</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">return</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Predicate</span><span class="p">)</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">predicate</span> <span class="ow">or</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">where</span><span class="p">:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">return</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="n">key</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">right</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">node</span> <span class="ow">is</span> <span class="n">column</span> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span> <span class="ow">in</span> <span class="n">predicate</span><span class="o">.</span><span class="n">left</span><span class="o">.</span><span class="n">walk</span><span class="p">())</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">else</span> <span class="n">predicate</span><span class="o">.</span><span class="n">left</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="p">)</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">return</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">keys</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">key</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">predicate</span><span class="p">))</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="k">for</span> <span class="o">*</span><span class="n">_</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">):</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">return</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">is_subquery_projection</span> <span class="o">=</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">node</span> <span class="ow">is</span> <span class="n">select</span><span class="o">.</span><span class="n">parent</span> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">parent_select</span><span class="o">.</span><span class="n">selects</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="p">)</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">key_aliases</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="c1"># if we filter on the value of the subquery, it needs to be unique</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">key_aliases</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">group_by</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">key_aliases</span><span class="p">:</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">key_aliases</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="c1"># all predicates that are equalities must also be in the unique</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="c1"># so that we don't do a many to many join</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="ow">and</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">group_by</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Predicate</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="c1"># if the value of the subquery is not an agg or a key, we need to collect it into an array</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="c1"># so that it can be grouped. For subquery projections, we use a MAX aggregation instead.</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">agg_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span> <span class="k">if</span> <span class="n">is_subquery_projection</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">)</span> <span class="ow">and</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">(</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">agg_func</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">value</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="p">)</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="c1"># exists queries should not have any selects as it only checks if there are any rows</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="c1"># all selects will be added by the optimizer and only used for join keys</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">):</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expressions"</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">alias</span> <span class="ow">in</span> <span class="n">key_aliases</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="c1"># add all keys to the projections of the subquery</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="c1"># so that we can use it as a join key</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">)</span> <span class="ow">or</span> <span class="n">key</span> <span class="o">!=</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">agg_func</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">key</span><span class="o">.</span><span class="n">copy</span><span class="p">()),</span> <span class="n">alias</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">other</span> <span class="o">=</span> <span class="n">_other_operand</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">)</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">):</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">key_aliases</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">],</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2"> IS NULL"</span><span class="p">)</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">):</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">parent_predicate</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"ARRAY_ALL(</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">, _x -> _x = </span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"ARRAY_ANY(</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">, _x -> _x = </span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">):</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">parent_predicate</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="sa">f</span><span class="s2">"ARRAY_ANY(</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">, _x -> _x = </span><span class="si">{</span><span class="n">parent_predicate</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="p">)</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">if</span> <span class="n">is_subquery_projection</span><span class="p">:</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">select</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="c1"># COUNT always returns 0 on empty datasets, so we need take that into consideration here</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="c1"># by transforming all counts into 0 and using that as the coalesced value</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">):</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="k">def</span> <span class="nf">remove_aggs</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">):</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">(</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">remove_aggs</span><span class="p">)],</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="p">)</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="n">select</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">key_aliases</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="k">if</span> <span class="n">is_subquery_projection</span><span class="p">:</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">key</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">nested</span><span class="p">)</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="k">continue</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="n">key</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">nested</span><span class="p">)</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="n">parent_predicate</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">parent_predicate</span><span class="si">}</span><span class="s2"> AND ARRAY_CONTAINS(</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">column</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="p">)</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">key</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="s2">"_x"</span><span class="p">))</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="n">parent_predicate</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="sa">f</span><span class="s1">'(</span><span class="si">{</span><span class="n">parent_predicate</span><span class="si">}</span><span class="s1"> AND ARRAY_ANY(</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s1">, "_x" -> </span><span class="si">{</span><span class="n">predicate</span><span class="si">}</span><span class="s1">))'</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="p">)</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="n">parent_select</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="n">select</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span><span class="o">*</span><span class="n">group_by</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">on</span><span class="o">=</span><span class="p">[</span><span class="n">predicate</span> <span class="k">for</span> <span class="o">*</span><span class="n">_</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)],</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"LEFT"</span><span class="p">,</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="n">table_alias</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="p">)</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a><span class="k">def</span> <span class="nf">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">):</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"_u_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a><span class="k">def</span> <span class="nf">_replace</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">condition</span><span class="p">):</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">condition</span><span class="p">(</span><span class="n">condition</span><span class="p">))</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a><span class="k">def</span> <span class="nf">_other_operand</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">):</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">)):</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="k">return</span> <span class="n">_other_operand</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">)</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">right</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">))</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="k">else</span> <span class="n">expression</span><span class="o">.</span><span class="n">left</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="p">)</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="k">return</span> <span class="kc">None</span> +</span></pre></div> + + + </section> + <section id="unnest_subqueries"> + <input id="unnest_subqueries-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unnest_subqueries</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="unnest_subqueries-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#unnest_subqueries"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="unnest_subqueries-8"><a href="#unnest_subqueries-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">unnest_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="unnest_subqueries-9"><a href="#unnest_subqueries-9"><span class="linenos"> 9</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="unnest_subqueries-10"><a href="#unnest_subqueries-10"><span class="linenos">10</span></a><span class="sd"> Rewrite sqlglot AST to convert some predicates with subqueries into joins.</span> +</span><span id="unnest_subqueries-11"><a href="#unnest_subqueries-11"><span class="linenos">11</span></a> +</span><span id="unnest_subqueries-12"><a href="#unnest_subqueries-12"><span class="linenos">12</span></a><span class="sd"> Convert scalar subqueries into cross joins.</span> +</span><span id="unnest_subqueries-13"><a href="#unnest_subqueries-13"><span class="linenos">13</span></a><span class="sd"> Convert correlated or vectorized subqueries into a group by so it is not a many to many left join.</span> +</span><span id="unnest_subqueries-14"><a href="#unnest_subqueries-14"><span class="linenos">14</span></a> +</span><span id="unnest_subqueries-15"><a href="#unnest_subqueries-15"><span class="linenos">15</span></a><span class="sd"> Example:</span> +</span><span id="unnest_subqueries-16"><a href="#unnest_subqueries-16"><span class="linenos">16</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="unnest_subqueries-17"><a href="#unnest_subqueries-17"><span class="linenos">17</span></a><span class="sd"> >>> expression = sqlglot.parse_one("SELECT * FROM x AS x WHERE (SELECT y.a AS a FROM y AS y WHERE x.a = y.a) = 1 ")</span> +</span><span id="unnest_subqueries-18"><a href="#unnest_subqueries-18"><span class="linenos">18</span></a><span class="sd"> >>> unnest_subqueries(expression).sql()</span> +</span><span id="unnest_subqueries-19"><a href="#unnest_subqueries-19"><span class="linenos">19</span></a><span class="sd"> 'SELECT * FROM x AS x LEFT JOIN (SELECT y.a AS a FROM y AS y WHERE TRUE GROUP BY y.a) AS _u_0 ON x.a = _u_0.a WHERE _u_0.a = 1'</span> +</span><span id="unnest_subqueries-20"><a href="#unnest_subqueries-20"><span class="linenos">20</span></a> +</span><span id="unnest_subqueries-21"><a href="#unnest_subqueries-21"><span class="linenos">21</span></a><span class="sd"> Args:</span> +</span><span id="unnest_subqueries-22"><a href="#unnest_subqueries-22"><span class="linenos">22</span></a><span class="sd"> expression (sqlglot.Expression): expression to unnest</span> +</span><span id="unnest_subqueries-23"><a href="#unnest_subqueries-23"><span class="linenos">23</span></a><span class="sd"> Returns:</span> +</span><span id="unnest_subqueries-24"><a href="#unnest_subqueries-24"><span class="linenos">24</span></a><span class="sd"> sqlglot.Expression: unnested expression</span> +</span><span id="unnest_subqueries-25"><a href="#unnest_subqueries-25"><span class="linenos">25</span></a><span class="sd"> """</span> +</span><span id="unnest_subqueries-26"><a href="#unnest_subqueries-26"><span class="linenos">26</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="unnest_subqueries-27"><a href="#unnest_subqueries-27"><span class="linenos">27</span></a> +</span><span id="unnest_subqueries-28"><a href="#unnest_subqueries-28"><span class="linenos">28</span></a> <span class="k">for</span> <span class="n">scope</span> <span class="ow">in</span> <span class="n">traverse_scope</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="unnest_subqueries-29"><a href="#unnest_subqueries-29"><span class="linenos">29</span></a> <span class="n">select</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">expression</span> +</span><span id="unnest_subqueries-30"><a href="#unnest_subqueries-30"><span class="linenos">30</span></a> <span class="n">parent</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">parent_select</span> +</span><span id="unnest_subqueries-31"><a href="#unnest_subqueries-31"><span class="linenos">31</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">parent</span><span class="p">:</span> +</span><span id="unnest_subqueries-32"><a href="#unnest_subqueries-32"><span class="linenos">32</span></a> <span class="k">continue</span> +</span><span id="unnest_subqueries-33"><a href="#unnest_subqueries-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span><span class="p">:</span> +</span><span id="unnest_subqueries-34"><a href="#unnest_subqueries-34"><span class="linenos">34</span></a> <span class="n">decorrelate</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">scope</span><span class="o">.</span><span class="n">external_columns</span><span class="p">,</span> <span class="n">sequence</span><span class="p">)</span> +</span><span id="unnest_subqueries-35"><a href="#unnest_subqueries-35"><span class="linenos">35</span></a> <span class="k">elif</span> <span class="n">scope</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">SUBQUERY</span><span class="p">:</span> +</span><span id="unnest_subqueries-36"><a href="#unnest_subqueries-36"><span class="linenos">36</span></a> <span class="n">unnest</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent</span><span class="p">,</span> <span class="n">sequence</span><span class="p">)</span> +</span><span id="unnest_subqueries-37"><a href="#unnest_subqueries-37"><span class="linenos">37</span></a> +</span><span id="unnest_subqueries-38"><a href="#unnest_subqueries-38"><span class="linenos">38</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Rewrite sqlglot AST to convert some predicates with subqueries into joins.</p> + +<p>Convert scalar subqueries into cross joins. +Convert correlated or vectorized subqueries into a group by so it is not a many to many left join.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n">expression</span> <span class="o">=</span> <span class="n"><a href="../../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT * FROM x AS x WHERE (SELECT y.a AS a FROM y AS y WHERE x.a = y.a) = 1 "</span><span class="p">)</span> +<span class="gp">>>> </span><span class="n">unnest_subqueries</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT * FROM x AS x LEFT JOIN (SELECT y.a AS a FROM y AS y WHERE TRUE GROUP BY y.a) AS _u_0 ON x.a = _u_0.a WHERE _u_0.a = 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression (sqlglot.Expression):</strong> expression to unnest</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>sqlglot.Expression: unnested expression</p> +</blockquote> +</div> + + + </section> + <section id="unnest"> + <input id="unnest-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unnest</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">select</span>, </span><span class="param"><span class="n">parent_select</span>, </span><span class="param"><span class="n">sequence</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="unnest-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#unnest"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="unnest-41"><a href="#unnest-41"><span class="linenos">41</span></a><span class="k">def</span> <span class="nf">unnest</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent_select</span><span class="p">,</span> <span class="n">sequence</span><span class="p">):</span> +</span><span id="unnest-42"><a href="#unnest-42"><span class="linenos">42</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="unnest-43"><a href="#unnest-43"><span class="linenos">43</span></a> <span class="k">return</span> +</span><span id="unnest-44"><a href="#unnest-44"><span class="linenos">44</span></a> +</span><span id="unnest-45"><a href="#unnest-45"><span class="linenos">45</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">)</span> +</span><span id="unnest-46"><a href="#unnest-46"><span class="linenos">46</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> +</span><span id="unnest-47"><a href="#unnest-47"><span class="linenos">47</span></a> +</span><span id="unnest-48"><a href="#unnest-48"><span class="linenos">48</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">predicate</span> <span class="ow">or</span> <span class="n">parent_select</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">predicate</span><span class="o">.</span><span class="n">parent_select</span><span class="p">:</span> +</span><span id="unnest-49"><a href="#unnest-49"><span class="linenos">49</span></a> <span class="k">return</span> +</span><span id="unnest-50"><a href="#unnest-50"><span class="linenos">50</span></a> +</span><span id="unnest-51"><a href="#unnest-51"><span class="linenos">51</span></a> <span class="c1"># this subquery returns a scalar and can just be converted to a cross join</span> +</span><span id="unnest-52"><a href="#unnest-52"><span class="linenos">52</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">)):</span> +</span><span id="unnest-53"><a href="#unnest-53"><span class="linenos">53</span></a> <span class="n">having</span> <span class="o">=</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">)</span> +</span><span id="unnest-54"><a href="#unnest-54"><span class="linenos">54</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="unnest-55"><a href="#unnest-55"><span class="linenos">55</span></a> <span class="k">if</span> <span class="n">having</span> <span class="ow">and</span> <span class="n">having</span><span class="o">.</span><span class="n">parent_select</span> <span class="ow">is</span> <span class="n">parent_select</span><span class="p">:</span> +</span><span id="unnest-56"><a href="#unnest-56"><span class="linenos">56</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">)</span> +</span><span id="unnest-57"><a href="#unnest-57"><span class="linenos">57</span></a> <span class="n">_replace</span><span class="p">(</span><span class="n">select</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">column</span><span class="p">)</span> +</span><span id="unnest-58"><a href="#unnest-58"><span class="linenos">58</span></a> +</span><span id="unnest-59"><a href="#unnest-59"><span class="linenos">59</span></a> <span class="n">parent_select</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="unnest-60"><a href="#unnest-60"><span class="linenos">60</span></a> <span class="n">select</span><span class="p">,</span> +</span><span id="unnest-61"><a href="#unnest-61"><span class="linenos">61</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"CROSS"</span><span class="p">,</span> +</span><span id="unnest-62"><a href="#unnest-62"><span class="linenos">62</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="unnest-63"><a href="#unnest-63"><span class="linenos">63</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="unnest-64"><a href="#unnest-64"><span class="linenos">64</span></a> <span class="p">)</span> +</span><span id="unnest-65"><a href="#unnest-65"><span class="linenos">65</span></a> <span class="k">return</span> +</span><span id="unnest-66"><a href="#unnest-66"><span class="linenos">66</span></a> +</span><span id="unnest-67"><a href="#unnest-67"><span class="linenos">67</span></a> <span class="k">if</span> <span class="n">select</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">):</span> +</span><span id="unnest-68"><a href="#unnest-68"><span class="linenos">68</span></a> <span class="k">return</span> +</span><span id="unnest-69"><a href="#unnest-69"><span class="linenos">69</span></a> +</span><span id="unnest-70"><a href="#unnest-70"><span class="linenos">70</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="unnest-71"><a href="#unnest-71"><span class="linenos">71</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="unnest-72"><a href="#unnest-72"><span class="linenos">72</span></a> +</span><span id="unnest-73"><a href="#unnest-73"><span class="linenos">73</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">predicate</span> <span class="ow">or</span> <span class="n">parent_select</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">predicate</span><span class="o">.</span><span class="n">parent_select</span><span class="p">:</span> +</span><span id="unnest-74"><a href="#unnest-74"><span class="linenos">74</span></a> <span class="k">return</span> +</span><span id="unnest-75"><a href="#unnest-75"><span class="linenos">75</span></a> +</span><span id="unnest-76"><a href="#unnest-76"><span class="linenos">76</span></a> <span class="n">column</span> <span class="o">=</span> <span class="n">_other_operand</span><span class="p">(</span><span class="n">predicate</span><span class="p">)</span> +</span><span id="unnest-77"><a href="#unnest-77"><span class="linenos">77</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="unnest-78"><a href="#unnest-78"><span class="linenos">78</span></a> +</span><span id="unnest-79"><a href="#unnest-79"><span class="linenos">79</span></a> <span class="n">on</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">condition</span><span class="p">(</span><span class="sa">f</span><span class="s1">'</span><span class="si">{</span><span class="n">column</span><span class="si">}</span><span class="s1"> = "</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s1">"."</span><span class="si">{</span><span class="n">value</span><span class="o">.</span><span class="n">alias</span><span class="si">}</span><span class="s1">"'</span><span class="p">)</span> +</span><span id="unnest-80"><a href="#unnest-80"><span class="linenos">80</span></a> <span class="n">_replace</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="n">on</span><span class="o">.</span><span class="n">right</span><span class="si">}</span><span class="s2"> IS NULL"</span><span class="p">)</span> +</span><span id="unnest-81"><a href="#unnest-81"><span class="linenos">81</span></a> +</span><span id="unnest-82"><a href="#unnest-82"><span class="linenos">82</span></a> <span class="n">parent_select</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="unnest-83"><a href="#unnest-83"><span class="linenos">83</span></a> <span class="n">select</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="unnest-84"><a href="#unnest-84"><span class="linenos">84</span></a> <span class="n">on</span><span class="o">=</span><span class="n">on</span><span class="p">,</span> +</span><span id="unnest-85"><a href="#unnest-85"><span class="linenos">85</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"LEFT"</span><span class="p">,</span> +</span><span id="unnest-86"><a href="#unnest-86"><span class="linenos">86</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="unnest-87"><a href="#unnest-87"><span class="linenos">87</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="unnest-88"><a href="#unnest-88"><span class="linenos">88</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="decorrelate"> + <input id="decorrelate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">decorrelate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">select</span>, </span><span class="param"><span class="n">parent_select</span>, </span><span class="param"><span class="n">external_columns</span>, </span><span class="param"><span class="n">sequence</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="decorrelate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#decorrelate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="decorrelate-91"><a href="#decorrelate-91"><span class="linenos"> 91</span></a><span class="k">def</span> <span class="nf">decorrelate</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">parent_select</span><span class="p">,</span> <span class="n">external_columns</span><span class="p">,</span> <span class="n">sequence</span><span class="p">):</span> +</span><span id="decorrelate-92"><a href="#decorrelate-92"><span class="linenos"> 92</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="decorrelate-93"><a href="#decorrelate-93"><span class="linenos"> 93</span></a> +</span><span id="decorrelate-94"><a href="#decorrelate-94"><span class="linenos"> 94</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">where</span> <span class="ow">or</span> <span class="n">where</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">)</span> <span class="ow">or</span> <span class="n">select</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">):</span> +</span><span id="decorrelate-95"><a href="#decorrelate-95"><span class="linenos"> 95</span></a> <span class="k">return</span> +</span><span id="decorrelate-96"><a href="#decorrelate-96"><span class="linenos"> 96</span></a> +</span><span id="decorrelate-97"><a href="#decorrelate-97"><span class="linenos"> 97</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="n">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> +</span><span id="decorrelate-98"><a href="#decorrelate-98"><span class="linenos"> 98</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="decorrelate-99"><a href="#decorrelate-99"><span class="linenos"> 99</span></a> +</span><span id="decorrelate-100"><a href="#decorrelate-100"><span class="linenos">100</span></a> <span class="c1"># for all external columns in the where statement, find the relevant predicate</span> +</span><span id="decorrelate-101"><a href="#decorrelate-101"><span class="linenos">101</span></a> <span class="c1"># keys to convert it into a join</span> +</span><span id="decorrelate-102"><a href="#decorrelate-102"><span class="linenos">102</span></a> <span class="k">for</span> <span class="n">column</span> <span class="ow">in</span> <span class="n">external_columns</span><span class="p">:</span> +</span><span id="decorrelate-103"><a href="#decorrelate-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">where</span><span class="p">:</span> +</span><span id="decorrelate-104"><a href="#decorrelate-104"><span class="linenos">104</span></a> <span class="k">return</span> +</span><span id="decorrelate-105"><a href="#decorrelate-105"><span class="linenos">105</span></a> +</span><span id="decorrelate-106"><a href="#decorrelate-106"><span class="linenos">106</span></a> <span class="n">predicate</span> <span class="o">=</span> <span class="n">column</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Predicate</span><span class="p">)</span> +</span><span id="decorrelate-107"><a href="#decorrelate-107"><span class="linenos">107</span></a> +</span><span id="decorrelate-108"><a href="#decorrelate-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">predicate</span> <span class="ow">or</span> <span class="n">predicate</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">where</span><span class="p">:</span> +</span><span id="decorrelate-109"><a href="#decorrelate-109"><span class="linenos">109</span></a> <span class="k">return</span> +</span><span id="decorrelate-110"><a href="#decorrelate-110"><span class="linenos">110</span></a> +</span><span id="decorrelate-111"><a href="#decorrelate-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Binary</span><span class="p">):</span> +</span><span id="decorrelate-112"><a href="#decorrelate-112"><span class="linenos">112</span></a> <span class="n">key</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="decorrelate-113"><a href="#decorrelate-113"><span class="linenos">113</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">right</span> +</span><span id="decorrelate-114"><a href="#decorrelate-114"><span class="linenos">114</span></a> <span class="k">if</span> <span class="nb">any</span><span class="p">(</span><span class="n">node</span> <span class="ow">is</span> <span class="n">column</span> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="o">*</span><span class="n">_</span> <span class="ow">in</span> <span class="n">predicate</span><span class="o">.</span><span class="n">left</span><span class="o">.</span><span class="n">walk</span><span class="p">())</span> +</span><span id="decorrelate-115"><a href="#decorrelate-115"><span class="linenos">115</span></a> <span class="k">else</span> <span class="n">predicate</span><span class="o">.</span><span class="n">left</span> +</span><span id="decorrelate-116"><a href="#decorrelate-116"><span class="linenos">116</span></a> <span class="p">)</span> +</span><span id="decorrelate-117"><a href="#decorrelate-117"><span class="linenos">117</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-118"><a href="#decorrelate-118"><span class="linenos">118</span></a> <span class="k">return</span> +</span><span id="decorrelate-119"><a href="#decorrelate-119"><span class="linenos">119</span></a> +</span><span id="decorrelate-120"><a href="#decorrelate-120"><span class="linenos">120</span></a> <span class="n">keys</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">key</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">predicate</span><span class="p">))</span> +</span><span id="decorrelate-121"><a href="#decorrelate-121"><span class="linenos">121</span></a> +</span><span id="decorrelate-122"><a href="#decorrelate-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">any</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="k">for</span> <span class="o">*</span><span class="n">_</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">):</span> +</span><span id="decorrelate-123"><a href="#decorrelate-123"><span class="linenos">123</span></a> <span class="k">return</span> +</span><span id="decorrelate-124"><a href="#decorrelate-124"><span class="linenos">124</span></a> +</span><span id="decorrelate-125"><a href="#decorrelate-125"><span class="linenos">125</span></a> <span class="n">is_subquery_projection</span> <span class="o">=</span> <span class="nb">any</span><span class="p">(</span> +</span><span id="decorrelate-126"><a href="#decorrelate-126"><span class="linenos">126</span></a> <span class="n">node</span> <span class="ow">is</span> <span class="n">select</span><span class="o">.</span><span class="n">parent</span> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">parent_select</span><span class="o">.</span><span class="n">selects</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">)</span> +</span><span id="decorrelate-127"><a href="#decorrelate-127"><span class="linenos">127</span></a> <span class="p">)</span> +</span><span id="decorrelate-128"><a href="#decorrelate-128"><span class="linenos">128</span></a> +</span><span id="decorrelate-129"><a href="#decorrelate-129"><span class="linenos">129</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">selects</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> +</span><span id="decorrelate-130"><a href="#decorrelate-130"><span class="linenos">130</span></a> <span class="n">key_aliases</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="decorrelate-131"><a href="#decorrelate-131"><span class="linenos">131</span></a> <span class="n">group_by</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="decorrelate-132"><a href="#decorrelate-132"><span class="linenos">132</span></a> +</span><span id="decorrelate-133"><a href="#decorrelate-133"><span class="linenos">133</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span> +</span><span id="decorrelate-134"><a href="#decorrelate-134"><span class="linenos">134</span></a> <span class="c1"># if we filter on the value of the subquery, it needs to be unique</span> +</span><span id="decorrelate-135"><a href="#decorrelate-135"><span class="linenos">135</span></a> <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="decorrelate-136"><a href="#decorrelate-136"><span class="linenos">136</span></a> <span class="n">key_aliases</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span><span class="o">.</span><span class="n">alias</span> +</span><span id="decorrelate-137"><a href="#decorrelate-137"><span class="linenos">137</span></a> <span class="n">group_by</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="decorrelate-138"><a href="#decorrelate-138"><span class="linenos">138</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-139"><a href="#decorrelate-139"><span class="linenos">139</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">key_aliases</span><span class="p">:</span> +</span><span id="decorrelate-140"><a href="#decorrelate-140"><span class="linenos">140</span></a> <span class="n">key_aliases</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">_alias</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span> +</span><span id="decorrelate-141"><a href="#decorrelate-141"><span class="linenos">141</span></a> <span class="c1"># all predicates that are equalities must also be in the unique</span> +</span><span id="decorrelate-142"><a href="#decorrelate-142"><span class="linenos">142</span></a> <span class="c1"># so that we don't do a many to many join</span> +</span><span id="decorrelate-143"><a href="#decorrelate-143"><span class="linenos">143</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> <span class="ow">and</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="decorrelate-144"><a href="#decorrelate-144"><span class="linenos">144</span></a> <span class="n">group_by</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> +</span><span id="decorrelate-145"><a href="#decorrelate-145"><span class="linenos">145</span></a> +</span><span id="decorrelate-146"><a href="#decorrelate-146"><span class="linenos">146</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">select</span><span class="o">.</span><span class="n">find_ancestor</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Predicate</span><span class="p">)</span> +</span><span id="decorrelate-147"><a href="#decorrelate-147"><span class="linenos">147</span></a> +</span><span id="decorrelate-148"><a href="#decorrelate-148"><span class="linenos">148</span></a> <span class="c1"># if the value of the subquery is not an agg or a key, we need to collect it into an array</span> +</span><span id="decorrelate-149"><a href="#decorrelate-149"><span class="linenos">149</span></a> <span class="c1"># so that it can be grouped. For subquery projections, we use a MAX aggregation instead.</span> +</span><span id="decorrelate-150"><a href="#decorrelate-150"><span class="linenos">150</span></a> <span class="n">agg_func</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span> <span class="k">if</span> <span class="n">is_subquery_projection</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">ArrayAgg</span> +</span><span id="decorrelate-151"><a href="#decorrelate-151"><span class="linenos">151</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">)</span> <span class="ow">and</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="decorrelate-152"><a href="#decorrelate-152"><span class="linenos">152</span></a> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">(</span> +</span><span id="decorrelate-153"><a href="#decorrelate-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">agg_func</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> <span class="n">value</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="decorrelate-154"><a href="#decorrelate-154"><span class="linenos">154</span></a> <span class="n">append</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="decorrelate-155"><a href="#decorrelate-155"><span class="linenos">155</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="decorrelate-156"><a href="#decorrelate-156"><span class="linenos">156</span></a> <span class="p">)</span> +</span><span id="decorrelate-157"><a href="#decorrelate-157"><span class="linenos">157</span></a> +</span><span id="decorrelate-158"><a href="#decorrelate-158"><span class="linenos">158</span></a> <span class="c1"># exists queries should not have any selects as it only checks if there are any rows</span> +</span><span id="decorrelate-159"><a href="#decorrelate-159"><span class="linenos">159</span></a> <span class="c1"># all selects will be added by the optimizer and only used for join keys</span> +</span><span id="decorrelate-160"><a href="#decorrelate-160"><span class="linenos">160</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">):</span> +</span><span id="decorrelate-161"><a href="#decorrelate-161"><span class="linenos">161</span></a> <span class="n">select</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"expressions"</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="decorrelate-162"><a href="#decorrelate-162"><span class="linenos">162</span></a> +</span><span id="decorrelate-163"><a href="#decorrelate-163"><span class="linenos">163</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">alias</span> <span class="ow">in</span> <span class="n">key_aliases</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="decorrelate-164"><a href="#decorrelate-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="decorrelate-165"><a href="#decorrelate-165"><span class="linenos">165</span></a> <span class="c1"># add all keys to the projections of the subquery</span> +</span><span id="decorrelate-166"><a href="#decorrelate-166"><span class="linenos">166</span></a> <span class="c1"># so that we can use it as a join key</span> +</span><span id="decorrelate-167"><a href="#decorrelate-167"><span class="linenos">167</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">)</span> <span class="ow">or</span> <span class="n">key</span> <span class="o">!=</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="decorrelate-168"><a href="#decorrelate-168"><span class="linenos">168</span></a> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="decorrelate-169"><a href="#decorrelate-169"><span class="linenos">169</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-170"><a href="#decorrelate-170"><span class="linenos">170</span></a> <span class="n">select</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">agg_func</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">key</span><span class="o">.</span><span class="n">copy</span><span class="p">()),</span> <span class="n">alias</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="decorrelate-171"><a href="#decorrelate-171"><span class="linenos">171</span></a> +</span><span id="decorrelate-172"><a href="#decorrelate-172"><span class="linenos">172</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">value</span><span class="o">.</span><span class="n">alias</span><span class="p">,</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="decorrelate-173"><a href="#decorrelate-173"><span class="linenos">173</span></a> <span class="n">other</span> <span class="o">=</span> <span class="n">_other_operand</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">)</span> +</span><span id="decorrelate-174"><a href="#decorrelate-174"><span class="linenos">174</span></a> +</span><span id="decorrelate-175"><a href="#decorrelate-175"><span class="linenos">175</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">):</span> +</span><span id="decorrelate-176"><a href="#decorrelate-176"><span class="linenos">176</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="n">key_aliases</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">],</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="decorrelate-177"><a href="#decorrelate-177"><span class="linenos">177</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"NOT </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2"> IS NULL"</span><span class="p">)</span> +</span><span id="decorrelate-178"><a href="#decorrelate-178"><span class="linenos">178</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">):</span> +</span><span id="decorrelate-179"><a href="#decorrelate-179"><span class="linenos">179</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="decorrelate-180"><a href="#decorrelate-180"><span class="linenos">180</span></a> <span class="n">parent_predicate</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"ARRAY_ALL(</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">, _x -> _x = </span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="decorrelate-181"><a href="#decorrelate-181"><span class="linenos">181</span></a> <span class="p">)</span> +</span><span id="decorrelate-182"><a href="#decorrelate-182"><span class="linenos">182</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">):</span> +</span><span id="decorrelate-183"><a href="#decorrelate-183"><span class="linenos">183</span></a> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="decorrelate-184"><a href="#decorrelate-184"><span class="linenos">184</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="decorrelate-185"><a href="#decorrelate-185"><span class="linenos">185</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-186"><a href="#decorrelate-186"><span class="linenos">186</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"ARRAY_ANY(</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">, _x -> _x = </span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2">)"</span><span class="p">)</span> +</span><span id="decorrelate-187"><a href="#decorrelate-187"><span class="linenos">187</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">):</span> +</span><span id="decorrelate-188"><a href="#decorrelate-188"><span class="linenos">188</span></a> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">this</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="decorrelate-189"><a href="#decorrelate-189"><span class="linenos">189</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span><span class="n">parent_predicate</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">other</span><span class="si">}</span><span class="s2"> = </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="decorrelate-190"><a href="#decorrelate-190"><span class="linenos">190</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-191"><a href="#decorrelate-191"><span class="linenos">191</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="decorrelate-192"><a href="#decorrelate-192"><span class="linenos">192</span></a> <span class="n">parent_predicate</span><span class="p">,</span> +</span><span id="decorrelate-193"><a href="#decorrelate-193"><span class="linenos">193</span></a> <span class="sa">f</span><span class="s2">"ARRAY_ANY(</span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">, _x -> _x = </span><span class="si">{</span><span class="n">parent_predicate</span><span class="o">.</span><span class="n">this</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="decorrelate-194"><a href="#decorrelate-194"><span class="linenos">194</span></a> <span class="p">)</span> +</span><span id="decorrelate-195"><a href="#decorrelate-195"><span class="linenos">195</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-196"><a href="#decorrelate-196"><span class="linenos">196</span></a> <span class="k">if</span> <span class="n">is_subquery_projection</span><span class="p">:</span> +</span><span id="decorrelate-197"><a href="#decorrelate-197"><span class="linenos">197</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">alias</span><span class="p">,</span> <span class="n">select</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">alias</span><span class="p">)</span> +</span><span id="decorrelate-198"><a href="#decorrelate-198"><span class="linenos">198</span></a> +</span><span id="decorrelate-199"><a href="#decorrelate-199"><span class="linenos">199</span></a> <span class="c1"># COUNT always returns 0 on empty datasets, so we need take that into consideration here</span> +</span><span id="decorrelate-200"><a href="#decorrelate-200"><span class="linenos">200</span></a> <span class="c1"># by transforming all counts into 0 and using that as the coalesced value</span> +</span><span id="decorrelate-201"><a href="#decorrelate-201"><span class="linenos">201</span></a> <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">):</span> +</span><span id="decorrelate-202"><a href="#decorrelate-202"><span class="linenos">202</span></a> +</span><span id="decorrelate-203"><a href="#decorrelate-203"><span class="linenos">203</span></a> <span class="k">def</span> <span class="nf">remove_aggs</span><span class="p">(</span><span class="n">node</span><span class="p">):</span> +</span><span id="decorrelate-204"><a href="#decorrelate-204"><span class="linenos">204</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">):</span> +</span><span id="decorrelate-205"><a href="#decorrelate-205"><span class="linenos">205</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> +</span><span id="decorrelate-206"><a href="#decorrelate-206"><span class="linenos">206</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="decorrelate-207"><a href="#decorrelate-207"><span class="linenos">207</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">null</span><span class="p">()</span> +</span><span id="decorrelate-208"><a href="#decorrelate-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="decorrelate-209"><a href="#decorrelate-209"><span class="linenos">209</span></a> +</span><span id="decorrelate-210"><a href="#decorrelate-210"><span class="linenos">210</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">(</span> +</span><span id="decorrelate-211"><a href="#decorrelate-211"><span class="linenos">211</span></a> <span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="decorrelate-212"><a href="#decorrelate-212"><span class="linenos">212</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">value</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">remove_aggs</span><span class="p">)],</span> +</span><span id="decorrelate-213"><a href="#decorrelate-213"><span class="linenos">213</span></a> <span class="p">)</span> +</span><span id="decorrelate-214"><a href="#decorrelate-214"><span class="linenos">214</span></a> +</span><span id="decorrelate-215"><a href="#decorrelate-215"><span class="linenos">215</span></a> <span class="n">select</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">alias</span><span class="p">)</span> +</span><span id="decorrelate-216"><a href="#decorrelate-216"><span class="linenos">216</span></a> +</span><span id="decorrelate-217"><a href="#decorrelate-217"><span class="linenos">217</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span> +</span><span id="decorrelate-218"><a href="#decorrelate-218"><span class="linenos">218</span></a> <span class="n">predicate</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">true</span><span class="p">())</span> +</span><span id="decorrelate-219"><a href="#decorrelate-219"><span class="linenos">219</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">key_aliases</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="n">table_alias</span><span class="p">)</span> +</span><span id="decorrelate-220"><a href="#decorrelate-220"><span class="linenos">220</span></a> +</span><span id="decorrelate-221"><a href="#decorrelate-221"><span class="linenos">221</span></a> <span class="k">if</span> <span class="n">is_subquery_projection</span><span class="p">:</span> +</span><span id="decorrelate-222"><a href="#decorrelate-222"><span class="linenos">222</span></a> <span class="n">key</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">nested</span><span class="p">)</span> +</span><span id="decorrelate-223"><a href="#decorrelate-223"><span class="linenos">223</span></a> <span class="k">continue</span> +</span><span id="decorrelate-224"><a href="#decorrelate-224"><span class="linenos">224</span></a> +</span><span id="decorrelate-225"><a href="#decorrelate-225"><span class="linenos">225</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">group_by</span><span class="p">:</span> +</span><span id="decorrelate-226"><a href="#decorrelate-226"><span class="linenos">226</span></a> <span class="n">key</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">nested</span><span class="p">)</span> +</span><span id="decorrelate-227"><a href="#decorrelate-227"><span class="linenos">227</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="decorrelate-228"><a href="#decorrelate-228"><span class="linenos">228</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="decorrelate-229"><a href="#decorrelate-229"><span class="linenos">229</span></a> <span class="n">parent_predicate</span><span class="p">,</span> +</span><span id="decorrelate-230"><a href="#decorrelate-230"><span class="linenos">230</span></a> <span class="sa">f</span><span class="s2">"(</span><span class="si">{</span><span class="n">parent_predicate</span><span class="si">}</span><span class="s2"> AND ARRAY_CONTAINS(</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="n">column</span><span class="si">}</span><span class="s2">))"</span><span class="p">,</span> +</span><span id="decorrelate-231"><a href="#decorrelate-231"><span class="linenos">231</span></a> <span class="p">)</span> +</span><span id="decorrelate-232"><a href="#decorrelate-232"><span class="linenos">232</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="decorrelate-233"><a href="#decorrelate-233"><span class="linenos">233</span></a> <span class="n">key</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="s2">"_x"</span><span class="p">))</span> +</span><span id="decorrelate-234"><a href="#decorrelate-234"><span class="linenos">234</span></a> <span class="n">parent_predicate</span> <span class="o">=</span> <span class="n">_replace</span><span class="p">(</span> +</span><span id="decorrelate-235"><a href="#decorrelate-235"><span class="linenos">235</span></a> <span class="n">parent_predicate</span><span class="p">,</span> +</span><span id="decorrelate-236"><a href="#decorrelate-236"><span class="linenos">236</span></a> <span class="sa">f</span><span class="s1">'(</span><span class="si">{</span><span class="n">parent_predicate</span><span class="si">}</span><span class="s1"> AND ARRAY_ANY(</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s1">, "_x" -> </span><span class="si">{</span><span class="n">predicate</span><span class="si">}</span><span class="s1">))'</span><span class="p">,</span> +</span><span id="decorrelate-237"><a href="#decorrelate-237"><span class="linenos">237</span></a> <span class="p">)</span> +</span><span id="decorrelate-238"><a href="#decorrelate-238"><span class="linenos">238</span></a> +</span><span id="decorrelate-239"><a href="#decorrelate-239"><span class="linenos">239</span></a> <span class="n">parent_select</span><span class="o">.</span><span class="n">join</span><span class="p">(</span> +</span><span id="decorrelate-240"><a href="#decorrelate-240"><span class="linenos">240</span></a> <span class="n">select</span><span class="o">.</span><span class="n">group_by</span><span class="p">(</span><span class="o">*</span><span class="n">group_by</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="decorrelate-241"><a href="#decorrelate-241"><span class="linenos">241</span></a> <span class="n">on</span><span class="o">=</span><span class="p">[</span><span class="n">predicate</span> <span class="k">for</span> <span class="o">*</span><span class="n">_</span><span class="p">,</span> <span class="n">predicate</span> <span class="ow">in</span> <span class="n">keys</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">predicate</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">)],</span> +</span><span id="decorrelate-242"><a href="#decorrelate-242"><span class="linenos">242</span></a> <span class="n">join_type</span><span class="o">=</span><span class="s2">"LEFT"</span><span class="p">,</span> +</span><span id="decorrelate-243"><a href="#decorrelate-243"><span class="linenos">243</span></a> <span class="n">join_alias</span><span class="o">=</span><span class="n">table_alias</span><span class="p">,</span> +</span><span id="decorrelate-244"><a href="#decorrelate-244"><span class="linenos">244</span></a> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> +</span><span id="decorrelate-245"><a href="#decorrelate-245"><span class="linenos">245</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/parser.html b/docs/sqlglot/parser.html new file mode 100644 index 0000000..28aa800 --- /dev/null +++ b/docs/sqlglot/parser.html @@ -0,0 +1,8049 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.parser API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#parse_var_map">parse_var_map</a> + </li> + <li> + <a class="class" href="#Parser">Parser</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Parser.__init__">Parser</a> + </li> + <li> + <a class="function" href="#Parser.reset">reset</a> + </li> + <li> + <a class="function" href="#Parser.parse">parse</a> + </li> + <li> + <a class="function" href="#Parser.parse_into">parse_into</a> + </li> + <li> + <a class="function" href="#Parser.check_errors">check_errors</a> + </li> + <li> + <a class="function" href="#Parser.raise_error">raise_error</a> + </li> + <li> + <a class="function" href="#Parser.expression">expression</a> + </li> + <li> + <a class="function" href="#Parser.validate_expression">validate_expression</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/parser.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.parser </h1> + + + <input id="mod-parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-parser-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">logging</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">ErrorLevel</span><span class="p">,</span> <span class="n">ParseError</span><span class="p">,</span> <span class="n">concat_messages</span><span class="p">,</span> <span class="n">merge_errors</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="p">(</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">apply_index_offset</span><span class="p">,</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">count_params</span><span class="p">,</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">ensure_collection</span><span class="p">,</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">ensure_list</span><span class="p">,</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">seq_get</span><span class="p">,</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="p">)</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">Token</span><span class="p">,</span> <span class="n">Tokenizer</span><span class="p">,</span> <span class="n">TokenType</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a><span class="kn">from</span> <span class="nn">sqlglot.trie</span> <span class="kn">import</span> <span class="n">in_trie</span><span class="p">,</span> <span class="n">new_trie</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">"sqlglot"</span><span class="p">)</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a><span class="k">def</span> <span class="nf">parse_var_map</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">),</span> <span class="mi">2</span><span class="p">):</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">keys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">])</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">(</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">keys</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">keys</span><span class="p">),</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">values</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">values</span><span class="p">),</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="k">class</span> <span class="nc">_Parser</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">):</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">)</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_show_trie</span> <span class="o">=</span> <span class="n">new_trie</span><span class="p">(</span><span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">SHOW_PARSERS</span><span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_set_trie</span> <span class="o">=</span> <span class="n">new_trie</span><span class="p">(</span><span class="n">key</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">SET_PARSERS</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">return</span> <span class="n">klass</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Parser</span><span class="p">):</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="sd"> Parser consumes a list of tokens produced by the `sqlglot.tokens.Tokenizer` and produces</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="sd"> a parsed syntax tree.</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="sd"> Args:</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="sd"> error_level: the desired error level.</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> Default: ErrorLevel.RAISE</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd"> error_message_context: determines the amount of context to capture from a</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> query string when displaying the error message (in number of characters).</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a><span class="sd"> Default: 50.</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> index_offset: Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="sd"> Default: 0</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="sd"> alias_post_tablesample: If the table alias comes after tablesample.</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> Default: False</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> max_errors: Maximum number of error messages to include in a raised ParseError.</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> This is only relevant if error_level is ErrorLevel.RAISE.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="sd"> Default: 3</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a><span class="sd"> null_ordering: Indicates the default null ordering method to use if not explicitly set.</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a><span class="sd"> Options are "nulls_are_small", "nulls_are_large", "nulls_are_last".</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a><span class="sd"> Default: "nulls_are_small"</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> """</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">FUNCTIONS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="o">**</span><span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">f</span><span class="o">.</span><span class="n">from_arg_list</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">ALL_FUNCTIONS</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">f</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()},</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="s2">"DATE_TO_DATE_STR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">),</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="p">),</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="s2">"TIME_TO_TIME_STR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">),</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="p">),</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="s2">"TS_OR_DS_TO_DATE_STR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">),</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="p">),</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">length</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">10</span><span class="p">),</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="p">),</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="s2">"VAR_MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="s2">"IFNULL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="p">}</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">NO_PAREN_FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">,</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">,</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIMESTAMP</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="p">}</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">NESTED_TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MAP</span><span class="p">,</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">,</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="p">}</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos"> 100</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos"> 101</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos"> 102</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos"> 103</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos"> 104</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos"> 105</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos"> 106</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos"> 107</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos"> 108</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos"> 109</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos"> 110</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos"> 111</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos"> 112</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">,</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos"> 113</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">,</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos"> 114</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">,</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos"> 115</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">,</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos"> 116</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BINARY</span><span class="p">,</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos"> 117</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos"> 118</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSON</span><span class="p">,</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos"> 119</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSONB</span><span class="p">,</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos"> 120</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">,</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos"> 121</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos"> 122</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos"> 123</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos"> 124</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos"> 125</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos"> 126</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos"> 127</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos"> 128</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UUID</span><span class="p">,</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos"> 129</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos"> 130</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos"> 131</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos"> 132</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HSTORE</span><span class="p">,</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos"> 133</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">,</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos"> 134</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos"> 135</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">,</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos"> 136</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">,</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos"> 137</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">,</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos"> 138</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">XML</span><span class="p">,</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos"> 139</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUEIDENTIFIER</span><span class="p">,</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos"> 140</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MONEY</span><span class="p">,</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos"> 141</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLMONEY</span><span class="p">,</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos"> 142</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">,</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos"> 143</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IMAGE</span><span class="p">,</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos"> 144</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos"> 145</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OBJECT</span><span class="p">,</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos"> 146</span></a> <span class="o">*</span><span class="n">NESTED_TYPE_TOKENS</span><span class="p">,</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos"> 147</span></a> <span class="p">}</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos"> 148</span></a> +</span><span id="L-149"><a href="#L-149"><span class="linenos"> 149</span></a> <span class="n">SUBQUERY_PREDICATES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos"> 150</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos"> 151</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">,</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos"> 152</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXISTS</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">,</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos"> 153</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SOME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos"> 154</span></a> <span class="p">}</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos"> 155</span></a> +</span><span id="L-156"><a href="#L-156"><span class="linenos"> 156</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">values</span><span class="p">(),</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">}</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos"> 157</span></a> +</span><span id="L-158"><a href="#L-158"><span class="linenos"> 158</span></a> <span class="n">ID_VAR_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos"> 159</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos"> 160</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos"> 161</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANTI</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos"> 162</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">,</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos"> 163</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos"> 164</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos"> 165</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOTH</span><span class="p">,</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos"> 166</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BUCKET</span><span class="p">,</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos"> 167</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CACHE</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos"> 168</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos"> 169</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">,</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos"> 170</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">,</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos"> 171</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos"> 172</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMIT</span><span class="p">,</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos"> 173</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMPOUND</span><span class="p">,</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos"> 174</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">,</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos"> 175</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos"> 176</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">,</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos"> 177</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos"> 178</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESCRIBE</span><span class="p">,</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos"> 179</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DIV</span><span class="p">,</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos"> 180</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">,</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos"> 181</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXECUTE</span><span class="p">,</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos"> 182</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ESCAPE</span><span class="p">,</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos"> 183</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">,</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos"> 184</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos"> 185</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos"> 186</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOLLOWING</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos"> 187</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos"> 188</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos"> 189</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GENERATED</span><span class="p">,</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos"> 190</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">,</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos"> 191</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos"> 192</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos"> 193</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">,</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos"> 194</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">,</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos"> 195</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LAZY</span><span class="p">,</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos"> 196</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEADING</span><span class="p">,</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos"> 197</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos"> 198</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">,</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos"> 199</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">,</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos"> 200</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">,</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos"> 201</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">,</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos"> 202</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEXT</span><span class="p">,</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos"> 203</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos"> 204</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ONLY</span><span class="p">,</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos"> 205</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OPTIONS</span><span class="p">,</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos"> 206</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ORDINALITY</span><span class="p">,</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos"> 207</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos"> 208</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIVOT</span><span class="p">,</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos"> 209</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRECEDING</span><span class="p">,</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos"> 210</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RANGE</span><span class="p">,</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos"> 211</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REFERENCES</span><span class="p">,</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos"> 212</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos"> 213</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos"> 214</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">,</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos"> 215</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos"> 216</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA_COMMENT</span><span class="p">,</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos"> 217</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEED</span><span class="p">,</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos"> 218</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMI</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos"> 219</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos"> 220</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos"> 221</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORTKEY</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos"> 222</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos"> 223</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos"> 224</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos"> 225</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRAILING</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos"> 226</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">,</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos"> 227</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNBOUNDED</span><span class="p">,</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos"> 228</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos"> 229</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNLOGGED</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos"> 230</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNPIVOT</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos"> 231</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos"> 232</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos"> 233</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos"> 234</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos"> 235</span></a> <span class="o">*</span><span class="n">SUBQUERY_PREDICATES</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos"> 236</span></a> <span class="o">*</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos"> 237</span></a> <span class="o">*</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">,</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos"> 238</span></a> <span class="p">}</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos"> 239</span></a> +</span><span id="L-240"><a href="#L-240"><span class="linenos"> 240</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos"> 241</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">,</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos"> 242</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos"> 243</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">,</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos"> 244</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos"> 245</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos"> 246</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos"> 247</span></a> <span class="p">}</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos"> 248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos"> 249</span></a> <span class="n">UPDATE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">}</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos"> 250</span></a> +</span><span id="L-251"><a href="#L-251"><span class="linenos"> 251</span></a> <span class="n">TRIM_TYPES</span> <span class="o">=</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LEADING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRAILING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOTH</span><span class="p">}</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos"> 252</span></a> +</span><span id="L-253"><a href="#L-253"><span class="linenos"> 253</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos"> 254</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos"> 255</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATE</span><span class="p">,</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos"> 256</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">,</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos"> 257</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIMESTAMP</span><span class="p">,</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos"> 258</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos"> 259</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">,</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos"> 260</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos"> 261</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">,</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos"> 262</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos"> 263</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos"> 264</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">,</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos"> 265</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos"> 266</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos"> 267</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">,</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos"> 268</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos"> 269</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">,</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos"> 270</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos"> 271</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos"> 272</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNNEST</span><span class="p">,</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos"> 273</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos"> 274</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos"> 275</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos"> 276</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos"> 277</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos"> 278</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos"> 279</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos"> 280</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos"> 281</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos"> 282</span></a> <span class="o">*</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos"> 283</span></a> <span class="o">*</span><span class="n">SUBQUERY_PREDICATES</span><span class="p">,</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos"> 284</span></a> <span class="p">}</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos"> 285</span></a> +</span><span id="L-286"><a href="#L-286"><span class="linenos"> 286</span></a> <span class="n">CONJUNCTION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos"> 287</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos"> 288</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OR</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos"> 289</span></a> <span class="p">}</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos"> 290</span></a> +</span><span id="L-291"><a href="#L-291"><span class="linenos"> 291</span></a> <span class="n">EQUALITY</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos"> 292</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos"> 293</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos"> 294</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLSAFE_EQ</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">,</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos"> 295</span></a> <span class="p">}</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos"> 296</span></a> +</span><span id="L-297"><a href="#L-297"><span class="linenos"> 297</span></a> <span class="n">COMPARISON</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos"> 298</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos"> 299</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos"> 300</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos"> 301</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos"> 302</span></a> <span class="p">}</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos"> 303</span></a> +</span><span id="L-304"><a href="#L-304"><span class="linenos"> 304</span></a> <span class="n">BITWISE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos"> 305</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AMP</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">,</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos"> 306</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">,</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos"> 307</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIPE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos"> 308</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DPIPE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DPipe</span><span class="p">,</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos"> 309</span></a> <span class="p">}</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos"> 310</span></a> +</span><span id="L-311"><a href="#L-311"><span class="linenos"> 311</span></a> <span class="n">TERM</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos"> 312</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">,</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos"> 313</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLUS</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">,</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos"> 314</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">,</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos"> 315</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Collate</span><span class="p">,</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos"> 316</span></a> <span class="p">}</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos"> 317</span></a> +</span><span id="L-318"><a href="#L-318"><span class="linenos"> 318</span></a> <span class="n">FACTOR</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos"> 319</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DIV</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">,</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos"> 320</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LR_ARROW</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distance</span><span class="p">,</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos"> 321</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SLASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">,</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos"> 322</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">,</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos"> 323</span></a> <span class="p">}</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos"> 324</span></a> +</span><span id="L-325"><a href="#L-325"><span class="linenos"> 325</span></a> <span class="n">TIMESTAMPS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos"> 326</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos"> 327</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos"> 328</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos"> 329</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos"> 330</span></a> <span class="p">}</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos"> 331</span></a> +</span><span id="L-332"><a href="#L-332"><span class="linenos"> 332</span></a> <span class="n">SET_OPERATIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos"> 333</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNION</span><span class="p">,</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos"> 334</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERSECT</span><span class="p">,</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos"> 335</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos"> 336</span></a> <span class="p">}</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos"> 337</span></a> +</span><span id="L-338"><a href="#L-338"><span class="linenos"> 338</span></a> <span class="n">JOIN_SIDES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos"> 339</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos"> 340</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos"> 341</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FULL</span><span class="p">,</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos"> 342</span></a> <span class="p">}</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos"> 343</span></a> +</span><span id="L-344"><a href="#L-344"><span class="linenos"> 344</span></a> <span class="n">JOIN_KINDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos"> 345</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INNER</span><span class="p">,</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos"> 346</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">,</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos"> 347</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CROSS</span><span class="p">,</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos"> 348</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMI</span><span class="p">,</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos"> 349</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANTI</span><span class="p">,</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos"> 350</span></a> <span class="p">}</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos"> 351</span></a> +</span><span id="L-352"><a href="#L-352"><span class="linenos"> 352</span></a> <span class="n">LAMBDAS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos"> 353</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos"> 354</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">,</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos"> 355</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos"> 356</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_lambda</span><span class="p">,</span> <span class="p">{</span><span class="n">node</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">}</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos"> 357</span></a> <span class="p">),</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos"> 358</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos"> 359</span></a> <span class="p">),</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos"> 360</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos"> 361</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Kwarg</span><span class="p">,</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos"> 362</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos"> 363</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos"> 364</span></a> <span class="p">),</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos"> 365</span></a> <span class="p">}</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos"> 366</span></a> +</span><span id="L-367"><a href="#L-367"><span class="linenos"> 367</span></a> <span class="n">COLUMN_OPERATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos"> 368</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos"> 369</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos"> 370</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos"> 371</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos"> 372</span></a> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">,</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos"> 373</span></a> <span class="p">),</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos"> 374</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos"> 375</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">,</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos"> 376</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos"> 377</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos"> 378</span></a> <span class="p">),</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos"> 379</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos"> 380</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">,</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos"> 381</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos"> 382</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos"> 383</span></a> <span class="p">),</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos"> 384</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH_ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos"> 385</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">,</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos"> 386</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos"> 387</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos"> 388</span></a> <span class="p">),</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos"> 389</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DHASH_ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos"> 390</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">,</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos"> 391</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos"> 392</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos"> 393</span></a> <span class="p">),</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos"> 394</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLACEHOLDER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos"> 395</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBContains</span><span class="p">,</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos"> 396</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos"> 397</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">key</span><span class="p">,</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos"> 398</span></a> <span class="p">),</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos"> 399</span></a> <span class="p">}</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos"> 400</span></a> +</span><span id="L-401"><a href="#L-401"><span class="linenos"> 401</span></a> <span class="n">EXPRESSION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos"> 402</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">(),</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos"> 403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(),</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos"> 404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos"> 405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_group</span><span class="p">(),</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos"> 406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(),</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos"> 407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lateral</span><span class="p">(),</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos"> 408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join</span><span class="p">(),</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos"> 409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(),</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos"> 410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CLUSTER_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">),</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos"> 411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SORT_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">),</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos"> 412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">(),</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos"> 413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(),</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos"> 414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_offset</span><span class="p">(),</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos"> 415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">(),</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos"> 416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(),</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos"> 417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos"> 418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">(),</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos"> 419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">(),</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos"> 420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos"> 421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_ordered</span><span class="p">(),</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos"> 422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_having</span><span class="p">(),</span> +</span><span id="L-423"><a href="#L-423"><span class="linenos"> 423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_with</span><span class="p">(),</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos"> 424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_named_window</span><span class="p">(),</span> +</span><span id="L-425"><a href="#L-425"><span class="linenos"> 425</span></a> <span class="s2">"JOIN_TYPE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_side_and_kind</span><span class="p">(),</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos"> 426</span></a> <span class="p">}</span> +</span><span id="L-427"><a href="#L-427"><span class="linenos"> 427</span></a> +</span><span id="L-428"><a href="#L-428"><span class="linenos"> 428</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-429"><a href="#L-429"><span class="linenos"> 429</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALTER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alter</span><span class="p">(),</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos"> 430</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_transaction</span><span class="p">(),</span> +</span><span id="L-431"><a href="#L-431"><span class="linenos"> 431</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CACHE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_cache</span><span class="p">(),</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos"> 432</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMIT</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_commit_or_rollback</span><span class="p">(),</span> +</span><span id="L-433"><a href="#L-433"><span class="linenos"> 433</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CREATE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos"> 434</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_delete</span><span class="p">(),</span> +</span><span id="L-435"><a href="#L-435"><span class="linenos"> 435</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_describe</span><span class="p">(),</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos"> 436</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESCRIBE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_describe</span><span class="p">(),</span> +</span><span id="L-437"><a href="#L-437"><span class="linenos"> 437</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop</span><span class="p">(),</span> +</span><span id="L-438"><a href="#L-438"><span class="linenos"> 438</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_commit_or_rollback</span><span class="p">(),</span> +</span><span id="L-439"><a href="#L-439"><span class="linenos"> 439</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_insert</span><span class="p">(),</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos"> 440</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOAD_DATA</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_load_data</span><span class="p">(),</span> +</span><span id="L-441"><a href="#L-441"><span class="linenos"> 441</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_merge</span><span class="p">(),</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos"> 442</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLBACK</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_commit_or_rollback</span><span class="p">(),</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos"> 443</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNCACHE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_uncache</span><span class="p">(),</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos"> 444</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_update</span><span class="p">(),</span> +</span><span id="L-445"><a href="#L-445"><span class="linenos"> 445</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">USE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos"> 446</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Use</span><span class="p">,</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos"> 447</span></a> <span class="n">kind</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"ROLE"</span><span class="p">,</span> <span class="s2">"WAREHOUSE"</span><span class="p">,</span> <span class="s2">"DATABASE"</span><span class="p">,</span> <span class="s2">"SCHEMA"</span><span class="p">))</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos"> 448</span></a> <span class="ow">and</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="L-449"><a href="#L-449"><span class="linenos"> 449</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos"> 450</span></a> <span class="p">),</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos"> 451</span></a> <span class="p">}</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos"> 452</span></a> +</span><span id="L-453"><a href="#L-453"><span class="linenos"> 453</span></a> <span class="n">UNARY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos"> 454</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLUS</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">(),</span> <span class="c1"># Unary + is handled as a no-op</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos"> 455</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">()),</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos"> 456</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TILDA</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">()),</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos"> 457</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DASH</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">()),</span> +</span><span id="L-458"><a href="#L-458"><span class="linenos"> 458</span></a> <span class="p">}</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos"> 459</span></a> +</span><span id="L-460"><a href="#L-460"><span class="linenos"> 460</span></a> <span class="n">PRIMARY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos"> 461</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos"> 462</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">True</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos"> 463</span></a> <span class="p">),</span> +</span><span id="L-464"><a href="#L-464"><span class="linenos"> 464</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-465"><a href="#L-465"><span class="linenos"> 465</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">False</span> +</span><span id="L-466"><a href="#L-466"><span class="linenos"> 466</span></a> <span class="p">),</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos"> 467</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-468"><a href="#L-468"><span class="linenos"> 468</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">,</span> +</span><span id="L-469"><a href="#L-469"><span class="linenos"> 469</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"except"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_except</span><span class="p">(),</span> <span class="s2">"replace"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_replace</span><span class="p">()},</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos"> 470</span></a> <span class="p">),</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos"> 471</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">),</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos"> 472</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-473"><a href="#L-473"><span class="linenos"> 473</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-474"><a href="#L-474"><span class="linenos"> 474</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitString</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos"> 475</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">HexString</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="L-476"><a href="#L-476"><span class="linenos"> 476</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BYTE_STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ByteString</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="L-477"><a href="#L-477"><span class="linenos"> 477</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_introducer</span><span class="p">(</span><span class="n">token</span><span class="p">),</span> +</span><span id="L-478"><a href="#L-478"><span class="linenos"> 478</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATIONAL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_national</span><span class="p">(</span><span class="n">token</span><span class="p">),</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos"> 479</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SESSION_PARAMETER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_session_parameter</span><span class="p">(),</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos"> 480</span></a> <span class="p">}</span> +</span><span id="L-481"><a href="#L-481"><span class="linenos"> 481</span></a> +</span><span id="L-482"><a href="#L-482"><span class="linenos"> 482</span></a> <span class="n">PLACEHOLDER_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos"> 483</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLACEHOLDER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">),</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos"> 484</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos"> 485</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos"> 486</span></a> <span class="p">),</span> +</span><span id="L-487"><a href="#L-487"><span class="linenos"> 487</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos"> 488</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">))</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos"> 489</span></a> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos"> 490</span></a> <span class="p">}</span> +</span><span id="L-491"><a href="#L-491"><span class="linenos"> 491</span></a> +</span><span id="L-492"><a href="#L-492"><span class="linenos"> 492</span></a> <span class="n">RANGE_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos"> 493</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_between</span><span class="p">(</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-494"><a href="#L-494"><span class="linenos"> 494</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOB</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_escape</span><span class="p">(</span> +</span><span id="L-495"><a href="#L-495"><span class="linenos"> 495</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Glob</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos"> 496</span></a> <span class="p">),</span> +</span><span id="L-497"><a href="#L-497"><span class="linenos"> 497</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-498"><a href="#L-498"><span class="linenos"> 498</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IS</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_is</span><span class="p">(</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-499"><a href="#L-499"><span class="linenos"> 499</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_escape</span><span class="p">(</span> +</span><span id="L-500"><a href="#L-500"><span class="linenos"> 500</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-501"><a href="#L-501"><span class="linenos"> 501</span></a> <span class="p">),</span> +</span><span id="L-502"><a href="#L-502"><span class="linenos"> 502</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_escape</span><span class="p">(</span> +</span><span id="L-503"><a href="#L-503"><span class="linenos"> 503</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-504"><a href="#L-504"><span class="linenos"> 504</span></a> <span class="p">),</span> +</span><span id="L-505"><a href="#L-505"><span class="linenos"> 505</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IRLIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-506"><a href="#L-506"><span class="linenos"> 506</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpILike</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-507"><a href="#L-507"><span class="linenos"> 507</span></a> <span class="p">),</span> +</span><span id="L-508"><a href="#L-508"><span class="linenos"> 508</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-509"><a href="#L-509"><span class="linenos"> 509</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-510"><a href="#L-510"><span class="linenos"> 510</span></a> <span class="p">),</span> +</span><span id="L-511"><a href="#L-511"><span class="linenos"> 511</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SIMILAR_TO</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-512"><a href="#L-512"><span class="linenos"> 512</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SimilarTo</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-513"><a href="#L-513"><span class="linenos"> 513</span></a> <span class="p">),</span> +</span><span id="L-514"><a href="#L-514"><span class="linenos"> 514</span></a> <span class="p">}</span> +</span><span id="L-515"><a href="#L-515"><span class="linenos"> 515</span></a> +</span><span id="L-516"><a href="#L-516"><span class="linenos"> 516</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-517"><a href="#L-517"><span class="linenos"> 517</span></a> <span class="s2">"AUTO_INCREMENT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">),</span> +</span><span id="L-518"><a href="#L-518"><span class="linenos"> 518</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_character_set</span><span class="p">(),</span> +</span><span id="L-519"><a href="#L-519"><span class="linenos"> 519</span></a> <span class="s2">"LOCATION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">),</span> +</span><span id="L-520"><a href="#L-520"><span class="linenos"> 520</span></a> <span class="s2">"PARTITION BY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partitioned_by</span><span class="p">(),</span> +</span><span id="L-521"><a href="#L-521"><span class="linenos"> 521</span></a> <span class="s2">"PARTITIONED BY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partitioned_by</span><span class="p">(),</span> +</span><span id="L-522"><a href="#L-522"><span class="linenos"> 522</span></a> <span class="s2">"PARTITIONED_BY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partitioned_by</span><span class="p">(),</span> +</span><span id="L-523"><a href="#L-523"><span class="linenos"> 523</span></a> <span class="s2">"COMMENT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">),</span> +</span><span id="L-524"><a href="#L-524"><span class="linenos"> 524</span></a> <span class="s2">"STORED"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">),</span> +</span><span id="L-525"><a href="#L-525"><span class="linenos"> 525</span></a> <span class="s2">"DISTKEY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_distkey</span><span class="p">(),</span> +</span><span id="L-526"><a href="#L-526"><span class="linenos"> 526</span></a> <span class="s2">"DISTSTYLE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">),</span> +</span><span id="L-527"><a href="#L-527"><span class="linenos"> 527</span></a> <span class="s2">"SORTKEY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sortkey</span><span class="p">(),</span> +</span><span id="L-528"><a href="#L-528"><span class="linenos"> 528</span></a> <span class="s2">"LIKE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create_like</span><span class="p">(),</span> +</span><span id="L-529"><a href="#L-529"><span class="linenos"> 529</span></a> <span class="s2">"RETURNS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_returns</span><span class="p">(),</span> +</span><span id="L-530"><a href="#L-530"><span class="linenos"> 530</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_row</span><span class="p">(),</span> +</span><span id="L-531"><a href="#L-531"><span class="linenos"> 531</span></a> <span class="s2">"COLLATE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">),</span> +</span><span id="L-532"><a href="#L-532"><span class="linenos"> 532</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">),</span> +</span><span id="L-533"><a href="#L-533"><span class="linenos"> 533</span></a> <span class="s2">"TABLE_FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">),</span> +</span><span id="L-534"><a href="#L-534"><span class="linenos"> 534</span></a> <span class="s2">"USING"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">),</span> +</span><span id="L-535"><a href="#L-535"><span class="linenos"> 535</span></a> <span class="s2">"LANGUAGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LanguageProperty</span><span class="p">),</span> +</span><span id="L-536"><a href="#L-536"><span class="linenos"> 536</span></a> <span class="s2">"EXECUTE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ExecuteAsProperty</span><span class="p">),</span> +</span><span id="L-537"><a href="#L-537"><span class="linenos"> 537</span></a> <span class="s2">"DETERMINISTIC"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-538"><a href="#L-538"><span class="linenos"> 538</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"IMMUTABLE"</span><span class="p">)</span> +</span><span id="L-539"><a href="#L-539"><span class="linenos"> 539</span></a> <span class="p">),</span> +</span><span id="L-540"><a href="#L-540"><span class="linenos"> 540</span></a> <span class="s2">"IMMUTABLE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-541"><a href="#L-541"><span class="linenos"> 541</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"IMMUTABLE"</span><span class="p">)</span> +</span><span id="L-542"><a href="#L-542"><span class="linenos"> 542</span></a> <span class="p">),</span> +</span><span id="L-543"><a href="#L-543"><span class="linenos"> 543</span></a> <span class="s2">"STABLE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-544"><a href="#L-544"><span class="linenos"> 544</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"STABLE"</span><span class="p">)</span> +</span><span id="L-545"><a href="#L-545"><span class="linenos"> 545</span></a> <span class="p">),</span> +</span><span id="L-546"><a href="#L-546"><span class="linenos"> 546</span></a> <span class="s2">"VOLATILE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-547"><a href="#L-547"><span class="linenos"> 547</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"VOLATILE"</span><span class="p">)</span> +</span><span id="L-548"><a href="#L-548"><span class="linenos"> 548</span></a> <span class="p">),</span> +</span><span id="L-549"><a href="#L-549"><span class="linenos"> 549</span></a> <span class="s2">"WITH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_with_property</span><span class="p">(),</span> +</span><span id="L-550"><a href="#L-550"><span class="linenos"> 550</span></a> <span class="s2">"TBLPROPERTIES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">),</span> +</span><span id="L-551"><a href="#L-551"><span class="linenos"> 551</span></a> <span class="s2">"FALLBACK"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_fallback</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">),</span> +</span><span id="L-552"><a href="#L-552"><span class="linenos"> 552</span></a> <span class="s2">"LOG"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_log</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">),</span> +</span><span id="L-553"><a href="#L-553"><span class="linenos"> 553</span></a> <span class="s2">"BEFORE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_journal</span><span class="p">(</span> +</span><span id="L-554"><a href="#L-554"><span class="linenos"> 554</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DUAL"</span> +</span><span id="L-555"><a href="#L-555"><span class="linenos"> 555</span></a> <span class="p">),</span> +</span><span id="L-556"><a href="#L-556"><span class="linenos"> 556</span></a> <span class="s2">"JOURNAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_journal</span><span class="p">(</span> +</span><span id="L-557"><a href="#L-557"><span class="linenos"> 557</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DUAL"</span> +</span><span id="L-558"><a href="#L-558"><span class="linenos"> 558</span></a> <span class="p">),</span> +</span><span id="L-559"><a href="#L-559"><span class="linenos"> 559</span></a> <span class="s2">"AFTER"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_afterjournal</span><span class="p">(</span> +</span><span id="L-560"><a href="#L-560"><span class="linenos"> 560</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DUAL"</span> +</span><span id="L-561"><a href="#L-561"><span class="linenos"> 561</span></a> <span class="p">),</span> +</span><span id="L-562"><a href="#L-562"><span class="linenos"> 562</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_afterjournal</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-563"><a href="#L-563"><span class="linenos"> 563</span></a> <span class="s2">"NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_afterjournal</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-564"><a href="#L-564"><span class="linenos"> 564</span></a> <span class="s2">"CHECKSUM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_checksum</span><span class="p">(),</span> +</span><span id="L-565"><a href="#L-565"><span class="linenos"> 565</span></a> <span class="s2">"FREESPACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_freespace</span><span class="p">(),</span> +</span><span id="L-566"><a href="#L-566"><span class="linenos"> 566</span></a> <span class="s2">"MERGEBLOCKRATIO"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_mergeblockratio</span><span class="p">(</span> +</span><span id="L-567"><a href="#L-567"><span class="linenos"> 567</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DEFAULT"</span> +</span><span id="L-568"><a href="#L-568"><span class="linenos"> 568</span></a> <span class="p">),</span> +</span><span id="L-569"><a href="#L-569"><span class="linenos"> 569</span></a> <span class="s2">"MIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="L-570"><a href="#L-570"><span class="linenos"> 570</span></a> <span class="s2">"MINIMUM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="L-571"><a href="#L-571"><span class="linenos"> 571</span></a> <span class="s2">"MAX"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="L-572"><a href="#L-572"><span class="linenos"> 572</span></a> <span class="s2">"MAXIMUM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="L-573"><a href="#L-573"><span class="linenos"> 573</span></a> <span class="s2">"DATABLOCKSIZE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(</span> +</span><span id="L-574"><a href="#L-574"><span class="linenos"> 574</span></a> <span class="n">default</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DEFAULT"</span> +</span><span id="L-575"><a href="#L-575"><span class="linenos"> 575</span></a> <span class="p">),</span> +</span><span id="L-576"><a href="#L-576"><span class="linenos"> 576</span></a> <span class="s2">"BLOCKCOMPRESSION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_blockcompression</span><span class="p">(),</span> +</span><span id="L-577"><a href="#L-577"><span class="linenos"> 577</span></a> <span class="s2">"ALGORITHM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AlgorithmProperty</span><span class="p">),</span> +</span><span id="L-578"><a href="#L-578"><span class="linenos"> 578</span></a> <span class="s2">"DEFINER"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_definer</span><span class="p">(),</span> +</span><span id="L-579"><a href="#L-579"><span class="linenos"> 579</span></a> <span class="p">}</span> +</span><span id="L-580"><a href="#L-580"><span class="linenos"> 580</span></a> +</span><span id="L-581"><a href="#L-581"><span class="linenos"> 581</span></a> <span class="n">CONSTRAINT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-582"><a href="#L-582"><span class="linenos"> 582</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-583"><a href="#L-583"><span class="linenos"> 583</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Check</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-584"><a href="#L-584"><span class="linenos"> 584</span></a> <span class="p">),</span> +</span><span id="L-585"><a href="#L-585"><span class="linenos"> 585</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_foreign_key</span><span class="p">(),</span> +</span><span id="L-586"><a href="#L-586"><span class="linenos"> 586</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unique</span><span class="p">(),</span> +</span><span id="L-587"><a href="#L-587"><span class="linenos"> 587</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create_like</span><span class="p">(),</span> +</span><span id="L-588"><a href="#L-588"><span class="linenos"> 588</span></a> <span class="p">}</span> +</span><span id="L-589"><a href="#L-589"><span class="linenos"> 589</span></a> +</span><span id="L-590"><a href="#L-590"><span class="linenos"> 590</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-591"><a href="#L-591"><span class="linenos"> 591</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_case</span><span class="p">(),</span> +</span><span id="L-592"><a href="#L-592"><span class="linenos"> 592</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_if</span><span class="p">(),</span> +</span><span id="L-593"><a href="#L-593"><span class="linenos"> 593</span></a> <span class="p">}</span> +</span><span id="L-594"><a href="#L-594"><span class="linenos"> 594</span></a> +</span><span id="L-595"><a href="#L-595"><span class="linenos"> 595</span></a> <span class="n">FUNCTION_PARSERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-596"><a href="#L-596"><span class="linenos"> 596</span></a> <span class="s2">"CONVERT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="L-597"><a href="#L-597"><span class="linenos"> 597</span></a> <span class="s2">"TRY_CONVERT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_convert</span><span class="p">(</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-598"><a href="#L-598"><span class="linenos"> 598</span></a> <span class="s2">"EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_extract</span><span class="p">(),</span> +</span><span id="L-599"><a href="#L-599"><span class="linenos"> 599</span></a> <span class="s2">"POSITION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(),</span> +</span><span id="L-600"><a href="#L-600"><span class="linenos"> 600</span></a> <span class="s2">"SUBSTRING"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_substring</span><span class="p">(),</span> +</span><span id="L-601"><a href="#L-601"><span class="linenos"> 601</span></a> <span class="s2">"TRIM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_trim</span><span class="p">(),</span> +</span><span id="L-602"><a href="#L-602"><span class="linenos"> 602</span></a> <span class="s2">"CAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="L-603"><a href="#L-603"><span class="linenos"> 603</span></a> <span class="s2">"TRY_CAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-604"><a href="#L-604"><span class="linenos"> 604</span></a> <span class="s2">"STRING_AGG"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string_agg</span><span class="p">(),</span> +</span><span id="L-605"><a href="#L-605"><span class="linenos"> 605</span></a> <span class="p">}</span> +</span><span id="L-606"><a href="#L-606"><span class="linenos"> 606</span></a> +</span><span id="L-607"><a href="#L-607"><span class="linenos"> 607</span></a> <span class="n">QUERY_MODIFIER_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-608"><a href="#L-608"><span class="linenos"> 608</span></a> <span class="s2">"match"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_match_recognize</span><span class="p">(),</span> +</span><span id="L-609"><a href="#L-609"><span class="linenos"> 609</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="L-610"><a href="#L-610"><span class="linenos"> 610</span></a> <span class="s2">"group"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_group</span><span class="p">(),</span> +</span><span id="L-611"><a href="#L-611"><span class="linenos"> 611</span></a> <span class="s2">"having"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_having</span><span class="p">(),</span> +</span><span id="L-612"><a href="#L-612"><span class="linenos"> 612</span></a> <span class="s2">"qualify"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_qualify</span><span class="p">(),</span> +</span><span id="L-613"><a href="#L-613"><span class="linenos"> 613</span></a> <span class="s2">"windows"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window_clause</span><span class="p">(),</span> +</span><span id="L-614"><a href="#L-614"><span class="linenos"> 614</span></a> <span class="s2">"distribute"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTRIBUTE_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distribute</span><span class="p">),</span> +</span><span id="L-615"><a href="#L-615"><span class="linenos"> 615</span></a> <span class="s2">"sort"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SORT_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">),</span> +</span><span id="L-616"><a href="#L-616"><span class="linenos"> 616</span></a> <span class="s2">"cluster"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CLUSTER_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">),</span> +</span><span id="L-617"><a href="#L-617"><span class="linenos"> 617</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(),</span> +</span><span id="L-618"><a href="#L-618"><span class="linenos"> 618</span></a> <span class="s2">"limit"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(),</span> +</span><span id="L-619"><a href="#L-619"><span class="linenos"> 619</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_offset</span><span class="p">(),</span> +</span><span id="L-620"><a href="#L-620"><span class="linenos"> 620</span></a> <span class="s2">"lock"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lock</span><span class="p">(),</span> +</span><span id="L-621"><a href="#L-621"><span class="linenos"> 621</span></a> <span class="p">}</span> +</span><span id="L-622"><a href="#L-622"><span class="linenos"> 622</span></a> +</span><span id="L-623"><a href="#L-623"><span class="linenos"> 623</span></a> <span class="n">SHOW_PARSERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-624"><a href="#L-624"><span class="linenos"> 624</span></a> <span class="n">SET_PARSERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-625"><a href="#L-625"><span class="linenos"> 625</span></a> +</span><span id="L-626"><a href="#L-626"><span class="linenos"> 626</span></a> <span class="n">MODIFIABLES</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="L-627"><a href="#L-627"><span class="linenos"> 627</span></a> +</span><span id="L-628"><a href="#L-628"><span class="linenos"> 628</span></a> <span class="n">CREATABLES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-629"><a href="#L-629"><span class="linenos"> 629</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">,</span> +</span><span id="L-630"><a href="#L-630"><span class="linenos"> 630</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> +</span><span id="L-631"><a href="#L-631"><span class="linenos"> 631</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="L-632"><a href="#L-632"><span class="linenos"> 632</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="L-633"><a href="#L-633"><span class="linenos"> 633</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="L-634"><a href="#L-634"><span class="linenos"> 634</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-635"><a href="#L-635"><span class="linenos"> 635</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="L-636"><a href="#L-636"><span class="linenos"> 636</span></a> <span class="p">}</span> +</span><span id="L-637"><a href="#L-637"><span class="linenos"> 637</span></a> +</span><span id="L-638"><a href="#L-638"><span class="linenos"> 638</span></a> <span class="n">TRANSACTION_KIND</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"DEFERRED"</span><span class="p">,</span> <span class="s2">"IMMEDIATE"</span><span class="p">,</span> <span class="s2">"EXCLUSIVE"</span><span class="p">}</span> +</span><span id="L-639"><a href="#L-639"><span class="linenos"> 639</span></a> +</span><span id="L-640"><a href="#L-640"><span class="linenos"> 640</span></a> <span class="n">WINDOW_ALIAS_TOKENS</span> <span class="o">=</span> <span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">}</span> +</span><span id="L-641"><a href="#L-641"><span class="linenos"> 641</span></a> +</span><span id="L-642"><a href="#L-642"><span class="linenos"> 642</span></a> <span class="n">ADD_CONSTRAINT_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">}</span> +</span><span id="L-643"><a href="#L-643"><span class="linenos"> 643</span></a> +</span><span id="L-644"><a href="#L-644"><span class="linenos"> 644</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-645"><a href="#L-645"><span class="linenos"> 645</span></a> +</span><span id="L-646"><a href="#L-646"><span class="linenos"> 646</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-647"><a href="#L-647"><span class="linenos"> 647</span></a> <span class="s2">"error_level"</span><span class="p">,</span> +</span><span id="L-648"><a href="#L-648"><span class="linenos"> 648</span></a> <span class="s2">"error_message_context"</span><span class="p">,</span> +</span><span id="L-649"><a href="#L-649"><span class="linenos"> 649</span></a> <span class="s2">"sql"</span><span class="p">,</span> +</span><span id="L-650"><a href="#L-650"><span class="linenos"> 650</span></a> <span class="s2">"errors"</span><span class="p">,</span> +</span><span id="L-651"><a href="#L-651"><span class="linenos"> 651</span></a> <span class="s2">"index_offset"</span><span class="p">,</span> +</span><span id="L-652"><a href="#L-652"><span class="linenos"> 652</span></a> <span class="s2">"unnest_column_only"</span><span class="p">,</span> +</span><span id="L-653"><a href="#L-653"><span class="linenos"> 653</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">,</span> +</span><span id="L-654"><a href="#L-654"><span class="linenos"> 654</span></a> <span class="s2">"max_errors"</span><span class="p">,</span> +</span><span id="L-655"><a href="#L-655"><span class="linenos"> 655</span></a> <span class="s2">"null_ordering"</span><span class="p">,</span> +</span><span id="L-656"><a href="#L-656"><span class="linenos"> 656</span></a> <span class="s2">"_tokens"</span><span class="p">,</span> +</span><span id="L-657"><a href="#L-657"><span class="linenos"> 657</span></a> <span class="s2">"_index"</span><span class="p">,</span> +</span><span id="L-658"><a href="#L-658"><span class="linenos"> 658</span></a> <span class="s2">"_curr"</span><span class="p">,</span> +</span><span id="L-659"><a href="#L-659"><span class="linenos"> 659</span></a> <span class="s2">"_next"</span><span class="p">,</span> +</span><span id="L-660"><a href="#L-660"><span class="linenos"> 660</span></a> <span class="s2">"_prev"</span><span class="p">,</span> +</span><span id="L-661"><a href="#L-661"><span class="linenos"> 661</span></a> <span class="s2">"_prev_comments"</span><span class="p">,</span> +</span><span id="L-662"><a href="#L-662"><span class="linenos"> 662</span></a> <span class="s2">"_show_trie"</span><span class="p">,</span> +</span><span id="L-663"><a href="#L-663"><span class="linenos"> 663</span></a> <span class="s2">"_set_trie"</span><span class="p">,</span> +</span><span id="L-664"><a href="#L-664"><span class="linenos"> 664</span></a> <span class="p">)</span> +</span><span id="L-665"><a href="#L-665"><span class="linenos"> 665</span></a> +</span><span id="L-666"><a href="#L-666"><span class="linenos"> 666</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-667"><a href="#L-667"><span class="linenos"> 667</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-668"><a href="#L-668"><span class="linenos"> 668</span></a> <span class="n">error_level</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ErrorLevel</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-669"><a href="#L-669"><span class="linenos"> 669</span></a> <span class="n">error_message_context</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> +</span><span id="L-670"><a href="#L-670"><span class="linenos"> 670</span></a> <span class="n">index_offset</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +</span><span id="L-671"><a href="#L-671"><span class="linenos"> 671</span></a> <span class="n">unnest_column_only</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-672"><a href="#L-672"><span class="linenos"> 672</span></a> <span class="n">alias_post_tablesample</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-673"><a href="#L-673"><span class="linenos"> 673</span></a> <span class="n">max_errors</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</span><span class="p">,</span> +</span><span id="L-674"><a href="#L-674"><span class="linenos"> 674</span></a> <span class="n">null_ordering</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-675"><a href="#L-675"><span class="linenos"> 675</span></a> <span class="p">):</span> +</span><span id="L-676"><a href="#L-676"><span class="linenos"> 676</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">=</span> <span class="n">error_level</span> <span class="ow">or</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span> +</span><span id="L-677"><a href="#L-677"><span class="linenos"> 677</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span> <span class="o">=</span> <span class="n">error_message_context</span> +</span><span id="L-678"><a href="#L-678"><span class="linenos"> 678</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span> <span class="o">=</span> <span class="n">index_offset</span> +</span><span id="L-679"><a href="#L-679"><span class="linenos"> 679</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span> <span class="o">=</span> <span class="n">unnest_column_only</span> +</span><span id="L-680"><a href="#L-680"><span class="linenos"> 680</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="n">alias_post_tablesample</span> +</span><span id="L-681"><a href="#L-681"><span class="linenos"> 681</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">max_errors</span> <span class="o">=</span> <span class="n">max_errors</span> +</span><span id="L-682"><a href="#L-682"><span class="linenos"> 682</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">=</span> <span class="n">null_ordering</span> +</span><span id="L-683"><a href="#L-683"><span class="linenos"> 683</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="L-684"><a href="#L-684"><span class="linenos"> 684</span></a> +</span><span id="L-685"><a href="#L-685"><span class="linenos"> 685</span></a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-686"><a href="#L-686"><span class="linenos"> 686</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-687"><a href="#L-687"><span class="linenos"> 687</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-688"><a href="#L-688"><span class="linenos"> 688</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-689"><a href="#L-689"><span class="linenos"> 689</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-690"><a href="#L-690"><span class="linenos"> 690</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-691"><a href="#L-691"><span class="linenos"> 691</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-692"><a href="#L-692"><span class="linenos"> 692</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-693"><a href="#L-693"><span class="linenos"> 693</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-694"><a href="#L-694"><span class="linenos"> 694</span></a> +</span><span id="L-695"><a href="#L-695"><span class="linenos"> 695</span></a> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span> +</span><span id="L-696"><a href="#L-696"><span class="linenos"> 696</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-697"><a href="#L-697"><span class="linenos"> 697</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-698"><a href="#L-698"><span class="linenos"> 698</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-699"><a href="#L-699"><span class="linenos"> 699</span></a><span class="sd"> Parses a list of tokens and returns a list of syntax trees, one tree</span> +</span><span id="L-700"><a href="#L-700"><span class="linenos"> 700</span></a><span class="sd"> per parsed SQL statement.</span> +</span><span id="L-701"><a href="#L-701"><span class="linenos"> 701</span></a> +</span><span id="L-702"><a href="#L-702"><span class="linenos"> 702</span></a><span class="sd"> Args:</span> +</span><span id="L-703"><a href="#L-703"><span class="linenos"> 703</span></a><span class="sd"> raw_tokens: the list of tokens.</span> +</span><span id="L-704"><a href="#L-704"><span class="linenos"> 704</span></a><span class="sd"> sql: the original SQL string, used to produce helpful debug messages.</span> +</span><span id="L-705"><a href="#L-705"><span class="linenos"> 705</span></a> +</span><span id="L-706"><a href="#L-706"><span class="linenos"> 706</span></a><span class="sd"> Returns:</span> +</span><span id="L-707"><a href="#L-707"><span class="linenos"> 707</span></a><span class="sd"> The list of syntax trees.</span> +</span><span id="L-708"><a href="#L-708"><span class="linenos"> 708</span></a><span class="sd"> """</span> +</span><span id="L-709"><a href="#L-709"><span class="linenos"> 709</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse</span><span class="p">(</span> +</span><span id="L-710"><a href="#L-710"><span class="linenos"> 710</span></a> <span class="n">parse_method</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="o">=</span><span class="n">raw_tokens</span><span class="p">,</span> <span class="n">sql</span><span class="o">=</span><span class="n">sql</span> +</span><span id="L-711"><a href="#L-711"><span class="linenos"> 711</span></a> <span class="p">)</span> +</span><span id="L-712"><a href="#L-712"><span class="linenos"> 712</span></a> +</span><span id="L-713"><a href="#L-713"><span class="linenos"> 713</span></a> <span class="k">def</span> <span class="nf">parse_into</span><span class="p">(</span> +</span><span id="L-714"><a href="#L-714"><span class="linenos"> 714</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-715"><a href="#L-715"><span class="linenos"> 715</span></a> <span class="n">expression_types</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">,</span> +</span><span id="L-716"><a href="#L-716"><span class="linenos"> 716</span></a> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> +</span><span id="L-717"><a href="#L-717"><span class="linenos"> 717</span></a> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-718"><a href="#L-718"><span class="linenos"> 718</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-719"><a href="#L-719"><span class="linenos"> 719</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-720"><a href="#L-720"><span class="linenos"> 720</span></a><span class="sd"> Parses a list of tokens into a given Expression type. If a collection of Expression</span> +</span><span id="L-721"><a href="#L-721"><span class="linenos"> 721</span></a><span class="sd"> types is given instead, this method will try to parse the token list into each one</span> +</span><span id="L-722"><a href="#L-722"><span class="linenos"> 722</span></a><span class="sd"> of them, stopping at the first for which the parsing succeeds.</span> +</span><span id="L-723"><a href="#L-723"><span class="linenos"> 723</span></a> +</span><span id="L-724"><a href="#L-724"><span class="linenos"> 724</span></a><span class="sd"> Args:</span> +</span><span id="L-725"><a href="#L-725"><span class="linenos"> 725</span></a><span class="sd"> expression_types: the expression type(s) to try and parse the token list into.</span> +</span><span id="L-726"><a href="#L-726"><span class="linenos"> 726</span></a><span class="sd"> raw_tokens: the list of tokens.</span> +</span><span id="L-727"><a href="#L-727"><span class="linenos"> 727</span></a><span class="sd"> sql: the original SQL string, used to produce helpful debug messages.</span> +</span><span id="L-728"><a href="#L-728"><span class="linenos"> 728</span></a> +</span><span id="L-729"><a href="#L-729"><span class="linenos"> 729</span></a><span class="sd"> Returns:</span> +</span><span id="L-730"><a href="#L-730"><span class="linenos"> 730</span></a><span class="sd"> The target Expression.</span> +</span><span id="L-731"><a href="#L-731"><span class="linenos"> 731</span></a><span class="sd"> """</span> +</span><span id="L-732"><a href="#L-732"><span class="linenos"> 732</span></a> <span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-733"><a href="#L-733"><span class="linenos"> 733</span></a> <span class="k">for</span> <span class="n">expression_type</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">expression_types</span><span class="p">):</span> +</span><span id="L-734"><a href="#L-734"><span class="linenos"> 734</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXPRESSION_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression_type</span><span class="p">)</span> +</span><span id="L-735"><a href="#L-735"><span class="linenos"> 735</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="L-736"><a href="#L-736"><span class="linenos"> 736</span></a> <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No parser registered for </span><span class="si">{</span><span class="n">expression_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-737"><a href="#L-737"><span class="linenos"> 737</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-738"><a href="#L-738"><span class="linenos"> 738</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse</span><span class="p">(</span><span class="n">parser</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="L-739"><a href="#L-739"><span class="linenos"> 739</span></a> <span class="k">except</span> <span class="n">ParseError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> +</span><span id="L-740"><a href="#L-740"><span class="linenos"> 740</span></a> <span class="n">e</span><span class="o">.</span><span class="n">errors</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s2">"into_expression"</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression_type</span> +</span><span id="L-741"><a href="#L-741"><span class="linenos"> 741</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="L-742"><a href="#L-742"><span class="linenos"> 742</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span> +</span><span id="L-743"><a href="#L-743"><span class="linenos"> 743</span></a> <span class="sa">f</span><span class="s2">"Failed to parse into </span><span class="si">{</span><span class="n">expression_types</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-744"><a href="#L-744"><span class="linenos"> 744</span></a> <span class="n">errors</span><span class="o">=</span><span class="n">merge_errors</span><span class="p">(</span><span class="n">errors</span><span class="p">),</span> +</span><span id="L-745"><a href="#L-745"><span class="linenos"> 745</span></a> <span class="p">)</span> <span class="kn">from</span> <span class="nn">errors</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span><span id="L-746"><a href="#L-746"><span class="linenos"> 746</span></a> +</span><span id="L-747"><a href="#L-747"><span class="linenos"> 747</span></a> <span class="k">def</span> <span class="nf">_parse</span><span class="p">(</span> +</span><span id="L-748"><a href="#L-748"><span class="linenos"> 748</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-749"><a href="#L-749"><span class="linenos"> 749</span></a> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Parser</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]],</span> +</span><span id="L-750"><a href="#L-750"><span class="linenos"> 750</span></a> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> +</span><span id="L-751"><a href="#L-751"><span class="linenos"> 751</span></a> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-752"><a href="#L-752"><span class="linenos"> 752</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-753"><a href="#L-753"><span class="linenos"> 753</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="L-754"><a href="#L-754"><span class="linenos"> 754</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span> <span class="ow">or</span> <span class="s2">""</span> +</span><span id="L-755"><a href="#L-755"><span class="linenos"> 755</span></a> <span class="n">total</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">raw_tokens</span><span class="p">)</span> +</span><span id="L-756"><a href="#L-756"><span class="linenos"> 756</span></a> <span class="n">chunks</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[[]]</span> +</span><span id="L-757"><a href="#L-757"><span class="linenos"> 757</span></a> +</span><span id="L-758"><a href="#L-758"><span class="linenos"> 758</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">token</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">raw_tokens</span><span class="p">):</span> +</span><span id="L-759"><a href="#L-759"><span class="linenos"> 759</span></a> <span class="k">if</span> <span class="n">token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMICOLON</span><span class="p">:</span> +</span><span id="L-760"><a href="#L-760"><span class="linenos"> 760</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o"><</span> <span class="n">total</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-761"><a href="#L-761"><span class="linenos"> 761</span></a> <span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span> +</span><span id="L-762"><a href="#L-762"><span class="linenos"> 762</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-763"><a href="#L-763"><span class="linenos"> 763</span></a> <span class="n">chunks</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">token</span><span class="p">)</span> +</span><span id="L-764"><a href="#L-764"><span class="linenos"> 764</span></a> +</span><span id="L-765"><a href="#L-765"><span class="linenos"> 765</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-766"><a href="#L-766"><span class="linenos"> 766</span></a> +</span><span id="L-767"><a href="#L-767"><span class="linenos"> 767</span></a> <span class="k">for</span> <span class="n">tokens</span> <span class="ow">in</span> <span class="n">chunks</span><span class="p">:</span> +</span><span id="L-768"><a href="#L-768"><span class="linenos"> 768</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="L-769"><a href="#L-769"><span class="linenos"> 769</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span> <span class="o">=</span> <span class="n">tokens</span> +</span><span id="L-770"><a href="#L-770"><span class="linenos"> 770</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-771"><a href="#L-771"><span class="linenos"> 771</span></a> +</span><span id="L-772"><a href="#L-772"><span class="linenos"> 772</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">parse_method</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span> +</span><span id="L-773"><a href="#L-773"><span class="linenos"> 773</span></a> +</span><span id="L-774"><a href="#L-774"><span class="linenos"> 774</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">):</span> +</span><span id="L-775"><a href="#L-775"><span class="linenos"> 775</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Invalid expression / Unexpected token"</span><span class="p">)</span> +</span><span id="L-776"><a href="#L-776"><span class="linenos"> 776</span></a> +</span><span id="L-777"><a href="#L-777"><span class="linenos"> 777</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">check_errors</span><span class="p">()</span> +</span><span id="L-778"><a href="#L-778"><span class="linenos"> 778</span></a> +</span><span id="L-779"><a href="#L-779"><span class="linenos"> 779</span></a> <span class="k">return</span> <span class="n">expressions</span> +</span><span id="L-780"><a href="#L-780"><span class="linenos"> 780</span></a> +</span><span id="L-781"><a href="#L-781"><span class="linenos"> 781</span></a> <span class="k">def</span> <span class="nf">check_errors</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-782"><a href="#L-782"><span class="linenos"> 782</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-783"><a href="#L-783"><span class="linenos"> 783</span></a><span class="sd"> Logs or raises any found errors, depending on the chosen error level setting.</span> +</span><span id="L-784"><a href="#L-784"><span class="linenos"> 784</span></a><span class="sd"> """</span> +</span><span id="L-785"><a href="#L-785"><span class="linenos"> 785</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> +</span><span id="L-786"><a href="#L-786"><span class="linenos"> 786</span></a> <span class="k">for</span> <span class="n">error</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">:</span> +</span><span id="L-787"><a href="#L-787"><span class="linenos"> 787</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">error</span><span class="p">))</span> +</span><span id="L-788"><a href="#L-788"><span class="linenos"> 788</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">RAISE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">:</span> +</span><span id="L-789"><a href="#L-789"><span class="linenos"> 789</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span> +</span><span id="L-790"><a href="#L-790"><span class="linenos"> 790</span></a> <span class="n">concat_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_errors</span><span class="p">),</span> +</span><span id="L-791"><a href="#L-791"><span class="linenos"> 791</span></a> <span class="n">errors</span><span class="o">=</span><span class="n">merge_errors</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">),</span> +</span><span id="L-792"><a href="#L-792"><span class="linenos"> 792</span></a> <span class="p">)</span> +</span><span id="L-793"><a href="#L-793"><span class="linenos"> 793</span></a> +</span><span id="L-794"><a href="#L-794"><span class="linenos"> 794</span></a> <span class="k">def</span> <span class="nf">raise_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-795"><a href="#L-795"><span class="linenos"> 795</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-796"><a href="#L-796"><span class="linenos"> 796</span></a><span class="sd"> Appends an error in the list of recorded errors or raises it, depending on the chosen</span> +</span><span id="L-797"><a href="#L-797"><span class="linenos"> 797</span></a><span class="sd"> error level setting.</span> +</span><span id="L-798"><a href="#L-798"><span class="linenos"> 798</span></a><span class="sd"> """</span> +</span><span id="L-799"><a href="#L-799"><span class="linenos"> 799</span></a> <span class="n">token</span> <span class="o">=</span> <span class="n">token</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="ow">or</span> <span class="n">Token</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-800"><a href="#L-800"><span class="linenos"> 800</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">token</span><span class="p">)</span> +</span><span id="L-801"><a href="#L-801"><span class="linenos"> 801</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-802"><a href="#L-802"><span class="linenos"> 802</span></a> <span class="n">start_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="nb">max</span><span class="p">(</span><span class="n">start</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="p">:</span> <span class="n">start</span><span class="p">]</span> +</span><span id="L-803"><a href="#L-803"><span class="linenos"> 803</span></a> <span class="n">highlight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="L-804"><a href="#L-804"><span class="linenos"> 804</span></a> <span class="n">end_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">end</span> <span class="p">:</span> <span class="n">end</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span><span class="p">]</span> +</span><span id="L-805"><a href="#L-805"><span class="linenos"> 805</span></a> +</span><span id="L-806"><a href="#L-806"><span class="linenos"> 806</span></a> <span class="n">error</span> <span class="o">=</span> <span class="n">ParseError</span><span class="o">.</span><span class="n">new</span><span class="p">(</span> +</span><span id="L-807"><a href="#L-807"><span class="linenos"> 807</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">message</span><span class="si">}</span><span class="s2">. Line </span><span class="si">{</span><span class="n">token</span><span class="o">.</span><span class="n">line</span><span class="si">}</span><span class="s2">, Col: </span><span class="si">{</span><span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="si">}</span><span class="s2">.</span><span class="se">\n</span><span class="s2">"</span> +</span><span id="L-808"><a href="#L-808"><span class="linenos"> 808</span></a> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">start_context</span><span class="si">}</span><span class="se">\033</span><span class="s2">[4m</span><span class="si">{</span><span class="n">highlight</span><span class="si">}</span><span class="se">\033</span><span class="s2">[0m</span><span class="si">{</span><span class="n">end_context</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-809"><a href="#L-809"><span class="linenos"> 809</span></a> <span class="n">description</span><span class="o">=</span><span class="n">message</span><span class="p">,</span> +</span><span id="L-810"><a href="#L-810"><span class="linenos"> 810</span></a> <span class="n">line</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">line</span><span class="p">,</span> +</span><span id="L-811"><a href="#L-811"><span class="linenos"> 811</span></a> <span class="n">col</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="p">,</span> +</span><span id="L-812"><a href="#L-812"><span class="linenos"> 812</span></a> <span class="n">start_context</span><span class="o">=</span><span class="n">start_context</span><span class="p">,</span> +</span><span id="L-813"><a href="#L-813"><span class="linenos"> 813</span></a> <span class="n">highlight</span><span class="o">=</span><span class="n">highlight</span><span class="p">,</span> +</span><span id="L-814"><a href="#L-814"><span class="linenos"> 814</span></a> <span class="n">end_context</span><span class="o">=</span><span class="n">end_context</span><span class="p">,</span> +</span><span id="L-815"><a href="#L-815"><span class="linenos"> 815</span></a> <span class="p">)</span> +</span><span id="L-816"><a href="#L-816"><span class="linenos"> 816</span></a> +</span><span id="L-817"><a href="#L-817"><span class="linenos"> 817</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span><span class="p">:</span> +</span><span id="L-818"><a href="#L-818"><span class="linenos"> 818</span></a> <span class="k">raise</span> <span class="n">error</span> +</span><span id="L-819"><a href="#L-819"><span class="linenos"> 819</span></a> +</span><span id="L-820"><a href="#L-820"><span class="linenos"> 820</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">error</span><span class="p">)</span> +</span><span id="L-821"><a href="#L-821"><span class="linenos"> 821</span></a> +</span><span id="L-822"><a href="#L-822"><span class="linenos"> 822</span></a> <span class="k">def</span> <span class="nf">expression</span><span class="p">(</span> +</span><span id="L-823"><a href="#L-823"><span class="linenos"> 823</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="L-824"><a href="#L-824"><span class="linenos"> 824</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-825"><a href="#L-825"><span class="linenos"> 825</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-826"><a href="#L-826"><span class="linenos"> 826</span></a><span class="sd"> Creates a new, validated Expression.</span> +</span><span id="L-827"><a href="#L-827"><span class="linenos"> 827</span></a> +</span><span id="L-828"><a href="#L-828"><span class="linenos"> 828</span></a><span class="sd"> Args:</span> +</span><span id="L-829"><a href="#L-829"><span class="linenos"> 829</span></a><span class="sd"> exp_class: the expression class to instantiate.</span> +</span><span id="L-830"><a href="#L-830"><span class="linenos"> 830</span></a><span class="sd"> comments: an optional list of comments to attach to the expression.</span> +</span><span id="L-831"><a href="#L-831"><span class="linenos"> 831</span></a><span class="sd"> kwargs: the arguments to set for the expression along with their respective values.</span> +</span><span id="L-832"><a href="#L-832"><span class="linenos"> 832</span></a> +</span><span id="L-833"><a href="#L-833"><span class="linenos"> 833</span></a><span class="sd"> Returns:</span> +</span><span id="L-834"><a href="#L-834"><span class="linenos"> 834</span></a><span class="sd"> The target expression.</span> +</span><span id="L-835"><a href="#L-835"><span class="linenos"> 835</span></a><span class="sd"> """</span> +</span><span id="L-836"><a href="#L-836"><span class="linenos"> 836</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">exp_class</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-837"><a href="#L-837"><span class="linenos"> 837</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="L-838"><a href="#L-838"><span class="linenos"> 838</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-839"><a href="#L-839"><span class="linenos"> 839</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-840"><a href="#L-840"><span class="linenos"> 840</span></a> <span class="k">if</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="L-841"><a href="#L-841"><span class="linenos"> 841</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="L-842"><a href="#L-842"><span class="linenos"> 842</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span> +</span><span id="L-843"><a href="#L-843"><span class="linenos"> 843</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="L-844"><a href="#L-844"><span class="linenos"> 844</span></a> +</span><span id="L-845"><a href="#L-845"><span class="linenos"> 845</span></a> <span class="k">def</span> <span class="nf">validate_expression</span><span class="p">(</span> +</span><span id="L-846"><a href="#L-846"><span class="linenos"> 846</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-847"><a href="#L-847"><span class="linenos"> 847</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-848"><a href="#L-848"><span class="linenos"> 848</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-849"><a href="#L-849"><span class="linenos"> 849</span></a><span class="sd"> Validates an already instantiated expression, making sure that all its mandatory arguments</span> +</span><span id="L-850"><a href="#L-850"><span class="linenos"> 850</span></a><span class="sd"> are set.</span> +</span><span id="L-851"><a href="#L-851"><span class="linenos"> 851</span></a> +</span><span id="L-852"><a href="#L-852"><span class="linenos"> 852</span></a><span class="sd"> Args:</span> +</span><span id="L-853"><a href="#L-853"><span class="linenos"> 853</span></a><span class="sd"> expression: the expression to validate.</span> +</span><span id="L-854"><a href="#L-854"><span class="linenos"> 854</span></a><span class="sd"> args: an optional list of items that was used to instantiate the expression, if it's a Func.</span> +</span><span id="L-855"><a href="#L-855"><span class="linenos"> 855</span></a><span class="sd"> """</span> +</span><span id="L-856"><a href="#L-856"><span class="linenos"> 856</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IGNORE</span><span class="p">:</span> +</span><span id="L-857"><a href="#L-857"><span class="linenos"> 857</span></a> <span class="k">return</span> +</span><span id="L-858"><a href="#L-858"><span class="linenos"> 858</span></a> +</span><span id="L-859"><a href="#L-859"><span class="linenos"> 859</span></a> <span class="k">for</span> <span class="n">error_message</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">error_messages</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="L-860"><a href="#L-860"><span class="linenos"> 860</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="n">error_message</span><span class="p">)</span> +</span><span id="L-861"><a href="#L-861"><span class="linenos"> 861</span></a> +</span><span id="L-862"><a href="#L-862"><span class="linenos"> 862</span></a> <span class="k">def</span> <span class="nf">_find_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="n">Token</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-863"><a href="#L-863"><span class="linenos"> 863</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">start</span><span class="p">)</span> <span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">end</span><span class="p">)</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">end</span><span class="o">.</span><span class="n">text</span><span class="p">)]</span> +</span><span id="L-864"><a href="#L-864"><span class="linenos"> 864</span></a> +</span><span id="L-865"><a href="#L-865"><span class="linenos"> 865</span></a> <span class="k">def</span> <span class="nf">_find_token</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-866"><a href="#L-866"><span class="linenos"> 866</span></a> <span class="n">line</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-867"><a href="#L-867"><span class="linenos"> 867</span></a> <span class="n">col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-868"><a href="#L-868"><span class="linenos"> 868</span></a> <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-869"><a href="#L-869"><span class="linenos"> 869</span></a> +</span><span id="L-870"><a href="#L-870"><span class="linenos"> 870</span></a> <span class="k">while</span> <span class="n">line</span> <span class="o"><</span> <span class="n">token</span><span class="o">.</span><span class="n">line</span> <span class="ow">or</span> <span class="n">col</span> <span class="o"><</span> <span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="p">:</span> +</span><span id="L-871"><a href="#L-871"><span class="linenos"> 871</span></a> <span class="k">if</span> <span class="n">Tokenizer</span><span class="o">.</span><span class="n">WHITE_SPACE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">index</span><span class="p">])</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">:</span> +</span><span id="L-872"><a href="#L-872"><span class="linenos"> 872</span></a> <span class="n">line</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-873"><a href="#L-873"><span class="linenos"> 873</span></a> <span class="n">col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-874"><a href="#L-874"><span class="linenos"> 874</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-875"><a href="#L-875"><span class="linenos"> 875</span></a> <span class="n">col</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-876"><a href="#L-876"><span class="linenos"> 876</span></a> <span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-877"><a href="#L-877"><span class="linenos"> 877</span></a> +</span><span id="L-878"><a href="#L-878"><span class="linenos"> 878</span></a> <span class="k">return</span> <span class="n">index</span> +</span><span id="L-879"><a href="#L-879"><span class="linenos"> 879</span></a> +</span><span id="L-880"><a href="#L-880"><span class="linenos"> 880</span></a> <span class="k">def</span> <span class="nf">_advance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">times</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-881"><a href="#L-881"><span class="linenos"> 881</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">+=</span> <span class="n">times</span> +</span><span id="L-882"><a href="#L-882"><span class="linenos"> 882</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span><span class="p">)</span> +</span><span id="L-883"><a href="#L-883"><span class="linenos"> 883</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-884"><a href="#L-884"><span class="linenos"> 884</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-885"><a href="#L-885"><span class="linenos"> 885</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> +</span><span id="L-886"><a href="#L-886"><span class="linenos"> 886</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">comments</span> +</span><span id="L-887"><a href="#L-887"><span class="linenos"> 887</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-888"><a href="#L-888"><span class="linenos"> 888</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-889"><a href="#L-889"><span class="linenos"> 889</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-890"><a href="#L-890"><span class="linenos"> 890</span></a> +</span><span id="L-891"><a href="#L-891"><span class="linenos"> 891</span></a> <span class="k">def</span> <span class="nf">_retreat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-892"><a href="#L-892"><span class="linenos"> 892</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">index</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span><span class="p">)</span> +</span><span id="L-893"><a href="#L-893"><span class="linenos"> 893</span></a> +</span><span id="L-894"><a href="#L-894"><span class="linenos"> 894</span></a> <span class="k">def</span> <span class="nf">_parse_command</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-895"><a href="#L-895"><span class="linenos"> 895</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="L-896"><a href="#L-896"><span class="linenos"> 896</span></a> +</span><span id="L-897"><a href="#L-897"><span class="linenos"> 897</span></a> <span class="k">def</span> <span class="nf">_parse_statement</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-898"><a href="#L-898"><span class="linenos"> 898</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-899"><a href="#L-899"><span class="linenos"> 899</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-900"><a href="#L-900"><span class="linenos"> 900</span></a> +</span><span id="L-901"><a href="#L-901"><span class="linenos"> 901</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">):</span> +</span><span id="L-902"><a href="#L-902"><span class="linenos"> 902</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-903"><a href="#L-903"><span class="linenos"> 903</span></a> +</span><span id="L-904"><a href="#L-904"><span class="linenos"> 904</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">COMMANDS</span><span class="p">):</span> +</span><span id="L-905"><a href="#L-905"><span class="linenos"> 905</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_command</span><span class="p">()</span> +</span><span id="L-906"><a href="#L-906"><span class="linenos"> 906</span></a> +</span><span id="L-907"><a href="#L-907"><span class="linenos"> 907</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">()</span> +</span><span id="L-908"><a href="#L-908"><span class="linenos"> 908</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">()</span> +</span><span id="L-909"><a href="#L-909"><span class="linenos"> 909</span></a> +</span><span id="L-910"><a href="#L-910"><span class="linenos"> 910</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-911"><a href="#L-911"><span class="linenos"> 911</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-912"><a href="#L-912"><span class="linenos"> 912</span></a> +</span><span id="L-913"><a href="#L-913"><span class="linenos"> 913</span></a> <span class="k">def</span> <span class="nf">_parse_drop</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default_kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-914"><a href="#L-914"><span class="linenos"> 914</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="L-915"><a href="#L-915"><span class="linenos"> 915</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">)</span> +</span><span id="L-916"><a href="#L-916"><span class="linenos"> 916</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">)</span> +</span><span id="L-917"><a href="#L-917"><span class="linenos"> 917</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-918"><a href="#L-918"><span class="linenos"> 918</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="L-919"><a href="#L-919"><span class="linenos"> 919</span></a> <span class="k">if</span> <span class="n">default_kind</span><span class="p">:</span> +</span><span id="L-920"><a href="#L-920"><span class="linenos"> 920</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">default_kind</span> +</span><span id="L-921"><a href="#L-921"><span class="linenos"> 921</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-922"><a href="#L-922"><span class="linenos"> 922</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_as_command</span><span class="p">(</span><span class="n">start</span><span class="p">)</span> +</span><span id="L-923"><a href="#L-923"><span class="linenos"> 923</span></a> +</span><span id="L-924"><a href="#L-924"><span class="linenos"> 924</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-925"><a href="#L-925"><span class="linenos"> 925</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">,</span> +</span><span id="L-926"><a href="#L-926"><span class="linenos"> 926</span></a> <span class="n">exists</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(),</span> +</span><span id="L-927"><a href="#L-927"><span class="linenos"> 927</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-928"><a href="#L-928"><span class="linenos"> 928</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="L-929"><a href="#L-929"><span class="linenos"> 929</span></a> <span class="n">temporary</span><span class="o">=</span><span class="n">temporary</span><span class="p">,</span> +</span><span id="L-930"><a href="#L-930"><span class="linenos"> 930</span></a> <span class="n">materialized</span><span class="o">=</span><span class="n">materialized</span><span class="p">,</span> +</span><span id="L-931"><a href="#L-931"><span class="linenos"> 931</span></a> <span class="n">cascade</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">),</span> +</span><span id="L-932"><a href="#L-932"><span class="linenos"> 932</span></a> <span class="p">)</span> +</span><span id="L-933"><a href="#L-933"><span class="linenos"> 933</span></a> +</span><span id="L-934"><a href="#L-934"><span class="linenos"> 934</span></a> <span class="k">def</span> <span class="nf">_parse_exists</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">not_</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]:</span> +</span><span id="L-935"><a href="#L-935"><span class="linenos"> 935</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-936"><a href="#L-936"><span class="linenos"> 936</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">)</span> +</span><span id="L-937"><a href="#L-937"><span class="linenos"> 937</span></a> <span class="ow">and</span> <span class="p">(</span><span class="ow">not</span> <span class="n">not_</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">))</span> +</span><span id="L-938"><a href="#L-938"><span class="linenos"> 938</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EXISTS</span><span class="p">)</span> +</span><span id="L-939"><a href="#L-939"><span class="linenos"> 939</span></a> <span class="p">)</span> +</span><span id="L-940"><a href="#L-940"><span class="linenos"> 940</span></a> +</span><span id="L-941"><a href="#L-941"><span class="linenos"> 941</span></a> <span class="k">def</span> <span class="nf">_parse_create</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-942"><a href="#L-942"><span class="linenos"> 942</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="L-943"><a href="#L-943"><span class="linenos"> 943</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OR</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span> +</span><span id="L-944"><a href="#L-944"><span class="linenos"> 944</span></a> <span class="n">set_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="L-945"><a href="#L-945"><span class="linenos"> 945</span></a> <span class="n">multiset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MULTISET"</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="L-946"><a href="#L-946"><span class="linenos"> 946</span></a> <span class="n">global_temporary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"GLOBAL"</span><span class="p">,</span> <span class="s2">"TEMPORARY"</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="L-947"><a href="#L-947"><span class="linenos"> 947</span></a> <span class="n">volatile</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="L-948"><a href="#L-948"><span class="linenos"> 948</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">)</span> +</span><span id="L-949"><a href="#L-949"><span class="linenos"> 949</span></a> <span class="n">transient</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSIENT"</span><span class="p">)</span> +</span><span id="L-950"><a href="#L-950"><span class="linenos"> 950</span></a> <span class="n">external</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"EXTERNAL"</span><span class="p">)</span> +</span><span id="L-951"><a href="#L-951"><span class="linenos"> 951</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">)</span> +</span><span id="L-952"><a href="#L-952"><span class="linenos"> 952</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">)</span> +</span><span id="L-953"><a href="#L-953"><span class="linenos"> 953</span></a> +</span><span id="L-954"><a href="#L-954"><span class="linenos"> 954</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-955"><a href="#L-955"><span class="linenos"> 955</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="L-956"><a href="#L-956"><span class="linenos"> 956</span></a> +</span><span id="L-957"><a href="#L-957"><span class="linenos"> 957</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-958"><a href="#L-958"><span class="linenos"> 958</span></a> <span class="n">create_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="L-959"><a href="#L-959"><span class="linenos"> 959</span></a> +</span><span id="L-960"><a href="#L-960"><span class="linenos"> 960</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">create_token</span><span class="p">:</span> +</span><span id="L-961"><a href="#L-961"><span class="linenos"> 961</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="L-962"><a href="#L-962"><span class="linenos"> 962</span></a> <span class="n">create_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="L-963"><a href="#L-963"><span class="linenos"> 963</span></a> +</span><span id="L-964"><a href="#L-964"><span class="linenos"> 964</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">properties</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">create_token</span><span class="p">:</span> +</span><span id="L-965"><a href="#L-965"><span class="linenos"> 965</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_as_command</span><span class="p">(</span><span class="n">start</span><span class="p">)</span> +</span><span id="L-966"><a href="#L-966"><span class="linenos"> 966</span></a> +</span><span id="L-967"><a href="#L-967"><span class="linenos"> 967</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(</span><span class="n">not_</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-968"><a href="#L-968"><span class="linenos"> 968</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-969"><a href="#L-969"><span class="linenos"> 969</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-970"><a href="#L-970"><span class="linenos"> 970</span></a> <span class="n">data</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-971"><a href="#L-971"><span class="linenos"> 971</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-972"><a href="#L-972"><span class="linenos"> 972</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-973"><a href="#L-973"><span class="linenos"> 973</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-974"><a href="#L-974"><span class="linenos"> 974</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-975"><a href="#L-975"><span class="linenos"> 975</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-976"><a href="#L-976"><span class="linenos"> 976</span></a> +</span><span id="L-977"><a href="#L-977"><span class="linenos"> 977</span></a> <span class="k">if</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">):</span> +</span><span id="L-978"><a href="#L-978"><span class="linenos"> 978</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_user_defined_function</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span><span class="p">)</span> +</span><span id="L-979"><a href="#L-979"><span class="linenos"> 979</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="L-980"><a href="#L-980"><span class="linenos"> 980</span></a> +</span><span id="L-981"><a href="#L-981"><span class="linenos"> 981</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-982"><a href="#L-982"><span class="linenos"> 982</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">)</span> +</span><span id="L-983"><a href="#L-983"><span class="linenos"> 983</span></a> <span class="n">return_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"RETURN"</span><span class="p">)</span> +</span><span id="L-984"><a href="#L-984"><span class="linenos"> 984</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="L-985"><a href="#L-985"><span class="linenos"> 985</span></a> +</span><span id="L-986"><a href="#L-986"><span class="linenos"> 986</span></a> <span class="k">if</span> <span class="n">return_</span><span class="p">:</span> +</span><span id="L-987"><a href="#L-987"><span class="linenos"> 987</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Return</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-988"><a href="#L-988"><span class="linenos"> 988</span></a> <span class="k">elif</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">:</span> +</span><span id="L-989"><a href="#L-989"><span class="linenos"> 989</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_index</span><span class="p">()</span> +</span><span id="L-990"><a href="#L-990"><span class="linenos"> 990</span></a> <span class="k">elif</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="L-991"><a href="#L-991"><span class="linenos"> 991</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-992"><a href="#L-992"><span class="linenos"> 992</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="L-993"><a href="#L-993"><span class="linenos"> 993</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="L-994"><a href="#L-994"><span class="linenos"> 994</span></a> <span class="p">):</span> +</span><span id="L-995"><a href="#L-995"><span class="linenos"> 995</span></a> <span class="n">table_parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-996"><a href="#L-996"><span class="linenos"> 996</span></a> +</span><span id="L-997"><a href="#L-997"><span class="linenos"> 997</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> <span class="c1"># comma-separated properties before schema definition</span> +</span><span id="L-998"><a href="#L-998"><span class="linenos"> 998</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">(</span><span class="n">before</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-999"><a href="#L-999"><span class="linenos"> 999</span></a> +</span><span id="L-1000"><a href="#L-1000"><span class="linenos">1000</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">table_parts</span><span class="p">)</span> +</span><span id="L-1001"><a href="#L-1001"><span class="linenos">1001</span></a> +</span><span id="L-1002"><a href="#L-1002"><span class="linenos">1002</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">properties</span><span class="p">:</span> <span class="c1"># properties after schema definition</span> +</span><span id="L-1003"><a href="#L-1003"><span class="linenos">1003</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="L-1004"><a href="#L-1004"><span class="linenos">1004</span></a> +</span><span id="L-1005"><a href="#L-1005"><span class="linenos">1005</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-1006"><a href="#L-1006"><span class="linenos">1006</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_ddl_select</span><span class="p">()</span> +</span><span id="L-1007"><a href="#L-1007"><span class="linenos">1007</span></a> +</span><span id="L-1008"><a href="#L-1008"><span class="linenos">1008</span></a> <span class="k">if</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">:</span> +</span><span id="L-1009"><a href="#L-1009"><span class="linenos">1009</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"DATA"</span><span class="p">):</span> +</span><span id="L-1010"><a href="#L-1010"><span class="linenos">1010</span></a> <span class="n">data</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1011"><a href="#L-1011"><span class="linenos">1011</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"DATA"</span><span class="p">):</span> +</span><span id="L-1012"><a href="#L-1012"><span class="linenos">1012</span></a> <span class="n">data</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-1013"><a href="#L-1013"><span class="linenos">1013</span></a> +</span><span id="L-1014"><a href="#L-1014"><span class="linenos">1014</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AND"</span><span class="p">,</span> <span class="s2">"STATISTICS"</span><span class="p">):</span> +</span><span id="L-1015"><a href="#L-1015"><span class="linenos">1015</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1016"><a href="#L-1016"><span class="linenos">1016</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AND"</span><span class="p">,</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"STATISTICS"</span><span class="p">):</span> +</span><span id="L-1017"><a href="#L-1017"><span class="linenos">1017</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-1018"><a href="#L-1018"><span class="linenos">1018</span></a> +</span><span id="L-1019"><a href="#L-1019"><span class="linenos">1019</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"PRIMARY"</span><span class="p">,</span> <span class="s2">"INDEX"</span><span class="p">)</span> +</span><span id="L-1020"><a href="#L-1020"><span class="linenos">1020</span></a> +</span><span id="L-1021"><a href="#L-1021"><span class="linenos">1021</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1022"><a href="#L-1022"><span class="linenos">1022</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1023"><a href="#L-1023"><span class="linenos">1023</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create_table_index</span><span class="p">()</span> +</span><span id="L-1024"><a href="#L-1024"><span class="linenos">1024</span></a> +</span><span id="L-1025"><a href="#L-1025"><span class="linenos">1025</span></a> <span class="c1"># post index PARTITION BY property</span> +</span><span id="L-1026"><a href="#L-1026"><span class="linenos">1026</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-1027"><a href="#L-1027"><span class="linenos">1027</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="L-1028"><a href="#L-1028"><span class="linenos">1028</span></a> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">())</span> +</span><span id="L-1029"><a href="#L-1029"><span class="linenos">1029</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1030"><a href="#L-1030"><span class="linenos">1030</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="L-1031"><a href="#L-1031"><span class="linenos">1031</span></a> +</span><span id="L-1032"><a href="#L-1032"><span class="linenos">1032</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">index</span><span class="p">:</span> +</span><span id="L-1033"><a href="#L-1033"><span class="linenos">1033</span></a> <span class="k">break</span> +</span><span id="L-1034"><a href="#L-1034"><span class="linenos">1034</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1035"><a href="#L-1035"><span class="linenos">1035</span></a> <span class="n">indexes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-1036"><a href="#L-1036"><span class="linenos">1036</span></a> <span class="k">elif</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">:</span> +</span><span id="L-1037"><a href="#L-1037"><span class="linenos">1037</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"SCHEMA"</span><span class="p">,</span> <span class="s2">"BINDING"</span><span class="p">):</span> +</span><span id="L-1038"><a href="#L-1038"><span class="linenos">1038</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1039"><a href="#L-1039"><span class="linenos">1039</span></a> +</span><span id="L-1040"><a href="#L-1040"><span class="linenos">1040</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1041"><a href="#L-1041"><span class="linenos">1041</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span> +</span><span id="L-1042"><a href="#L-1042"><span class="linenos">1042</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-1043"><a href="#L-1043"><span class="linenos">1043</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">create_token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> +</span><span id="L-1044"><a href="#L-1044"><span class="linenos">1044</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-1045"><a href="#L-1045"><span class="linenos">1045</span></a> <span class="nb">set</span><span class="o">=</span><span class="n">set_</span><span class="p">,</span> +</span><span id="L-1046"><a href="#L-1046"><span class="linenos">1046</span></a> <span class="n">multiset</span><span class="o">=</span><span class="n">multiset</span><span class="p">,</span> +</span><span id="L-1047"><a href="#L-1047"><span class="linenos">1047</span></a> <span class="n">global_temporary</span><span class="o">=</span><span class="n">global_temporary</span><span class="p">,</span> +</span><span id="L-1048"><a href="#L-1048"><span class="linenos">1048</span></a> <span class="n">volatile</span><span class="o">=</span><span class="n">volatile</span><span class="p">,</span> +</span><span id="L-1049"><a href="#L-1049"><span class="linenos">1049</span></a> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span><span class="p">,</span> +</span><span id="L-1050"><a href="#L-1050"><span class="linenos">1050</span></a> <span class="n">properties</span><span class="o">=</span><span class="n">properties</span><span class="p">,</span> +</span><span id="L-1051"><a href="#L-1051"><span class="linenos">1051</span></a> <span class="n">temporary</span><span class="o">=</span><span class="n">temporary</span><span class="p">,</span> +</span><span id="L-1052"><a href="#L-1052"><span class="linenos">1052</span></a> <span class="n">transient</span><span class="o">=</span><span class="n">transient</span><span class="p">,</span> +</span><span id="L-1053"><a href="#L-1053"><span class="linenos">1053</span></a> <span class="n">external</span><span class="o">=</span><span class="n">external</span><span class="p">,</span> +</span><span id="L-1054"><a href="#L-1054"><span class="linenos">1054</span></a> <span class="n">replace</span><span class="o">=</span><span class="n">replace</span><span class="p">,</span> +</span><span id="L-1055"><a href="#L-1055"><span class="linenos">1055</span></a> <span class="n">unique</span><span class="o">=</span><span class="n">unique</span><span class="p">,</span> +</span><span id="L-1056"><a href="#L-1056"><span class="linenos">1056</span></a> <span class="n">materialized</span><span class="o">=</span><span class="n">materialized</span><span class="p">,</span> +</span><span id="L-1057"><a href="#L-1057"><span class="linenos">1057</span></a> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> +</span><span id="L-1058"><a href="#L-1058"><span class="linenos">1058</span></a> <span class="n">statistics</span><span class="o">=</span><span class="n">statistics</span><span class="p">,</span> +</span><span id="L-1059"><a href="#L-1059"><span class="linenos">1059</span></a> <span class="n">no_primary_index</span><span class="o">=</span><span class="n">no_primary_index</span><span class="p">,</span> +</span><span id="L-1060"><a href="#L-1060"><span class="linenos">1060</span></a> <span class="n">indexes</span><span class="o">=</span><span class="n">indexes</span><span class="p">,</span> +</span><span id="L-1061"><a href="#L-1061"><span class="linenos">1061</span></a> <span class="n">no_schema_binding</span><span class="o">=</span><span class="n">no_schema_binding</span><span class="p">,</span> +</span><span id="L-1062"><a href="#L-1062"><span class="linenos">1062</span></a> <span class="n">begin</span><span class="o">=</span><span class="n">begin</span><span class="p">,</span> +</span><span id="L-1063"><a href="#L-1063"><span class="linenos">1063</span></a> <span class="p">)</span> +</span><span id="L-1064"><a href="#L-1064"><span class="linenos">1064</span></a> +</span><span id="L-1065"><a href="#L-1065"><span class="linenos">1065</span></a> <span class="k">def</span> <span class="nf">_parse_property_before</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1066"><a href="#L-1066"><span class="linenos">1066</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="L-1067"><a href="#L-1067"><span class="linenos">1067</span></a> +</span><span id="L-1068"><a href="#L-1068"><span class="linenos">1068</span></a> <span class="c1"># parsers look to _prev for no/dual/default, so need to consume first</span> +</span><span id="L-1069"><a href="#L-1069"><span class="linenos">1069</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">)</span> +</span><span id="L-1070"><a href="#L-1070"><span class="linenos">1070</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DUAL"</span><span class="p">)</span> +</span><span id="L-1071"><a href="#L-1071"><span class="linenos">1071</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFAULT"</span><span class="p">)</span> +</span><span id="L-1072"><a href="#L-1072"><span class="linenos">1072</span></a> +</span><span id="L-1073"><a href="#L-1073"><span class="linenos">1073</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()):</span> +</span><span id="L-1074"><a href="#L-1074"><span class="linenos">1074</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-1075"><a href="#L-1075"><span class="linenos">1075</span></a> +</span><span id="L-1076"><a href="#L-1076"><span class="linenos">1076</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1077"><a href="#L-1077"><span class="linenos">1077</span></a> +</span><span id="L-1078"><a href="#L-1078"><span class="linenos">1078</span></a> <span class="k">def</span> <span class="nf">_parse_property</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1079"><a href="#L-1079"><span class="linenos">1079</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">):</span> +</span><span id="L-1080"><a href="#L-1080"><span class="linenos">1080</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-1081"><a href="#L-1081"><span class="linenos">1081</span></a> +</span><span id="L-1082"><a href="#L-1082"><span class="linenos">1082</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHARACTER_SET</span><span class="p">):</span> +</span><span id="L-1083"><a href="#L-1083"><span class="linenos">1083</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_character_set</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1084"><a href="#L-1084"><span class="linenos">1084</span></a> +</span><span id="L-1085"><a href="#L-1085"><span class="linenos">1085</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMPOUND</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORTKEY</span><span class="p">):</span> +</span><span id="L-1086"><a href="#L-1086"><span class="linenos">1086</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sortkey</span><span class="p">(</span><span class="n">compound</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1087"><a href="#L-1087"><span class="linenos">1087</span></a> +</span><span id="L-1088"><a href="#L-1088"><span class="linenos">1088</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SQL"</span><span class="p">,</span> <span class="s2">"SECURITY"</span><span class="p">):</span> +</span><span id="L-1089"><a href="#L-1089"><span class="linenos">1089</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SqlSecurityProperty</span><span class="p">,</span> <span class="n">definer</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFINER"</span><span class="p">))</span> +</span><span id="L-1090"><a href="#L-1090"><span class="linenos">1090</span></a> +</span><span id="L-1091"><a href="#L-1091"><span class="linenos">1091</span></a> <span class="n">assignment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span> +</span><span id="L-1092"><a href="#L-1092"><span class="linenos">1092</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span> +</span><span id="L-1093"><a href="#L-1093"><span class="linenos">1093</span></a> <span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1094"><a href="#L-1094"><span class="linenos">1094</span></a> +</span><span id="L-1095"><a href="#L-1095"><span class="linenos">1095</span></a> <span class="k">if</span> <span class="n">assignment</span><span class="p">:</span> +</span><span id="L-1096"><a href="#L-1096"><span class="linenos">1096</span></a> <span class="n">key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">()</span> +</span><span id="L-1097"><a href="#L-1097"><span class="linenos">1097</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1098"><a href="#L-1098"><span class="linenos">1098</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">())</span> +</span><span id="L-1099"><a href="#L-1099"><span class="linenos">1099</span></a> +</span><span id="L-1100"><a href="#L-1100"><span class="linenos">1100</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1101"><a href="#L-1101"><span class="linenos">1101</span></a> +</span><span id="L-1102"><a href="#L-1102"><span class="linenos">1102</span></a> <span class="k">def</span> <span class="nf">_parse_property_assignment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1103"><a href="#L-1103"><span class="linenos">1103</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1104"><a href="#L-1104"><span class="linenos">1104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-1105"><a href="#L-1105"><span class="linenos">1105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1106"><a href="#L-1106"><span class="linenos">1106</span></a> <span class="n">exp_class</span><span class="p">,</span> +</span><span id="L-1107"><a href="#L-1107"><span class="linenos">1107</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(),</span> +</span><span id="L-1108"><a href="#L-1108"><span class="linenos">1108</span></a> <span class="p">)</span> +</span><span id="L-1109"><a href="#L-1109"><span class="linenos">1109</span></a> +</span><span id="L-1110"><a href="#L-1110"><span class="linenos">1110</span></a> <span class="k">def</span> <span class="nf">_parse_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">before</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1111"><a href="#L-1111"><span class="linenos">1111</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1112"><a href="#L-1112"><span class="linenos">1112</span></a> +</span><span id="L-1113"><a href="#L-1113"><span class="linenos">1113</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1114"><a href="#L-1114"><span class="linenos">1114</span></a> <span class="k">if</span> <span class="n">before</span><span class="p">:</span> +</span><span id="L-1115"><a href="#L-1115"><span class="linenos">1115</span></a> <span class="n">identified_property</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_before</span><span class="p">()</span> +</span><span id="L-1116"><a href="#L-1116"><span class="linenos">1116</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1117"><a href="#L-1117"><span class="linenos">1117</span></a> <span class="n">identified_property</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">()</span> +</span><span id="L-1118"><a href="#L-1118"><span class="linenos">1118</span></a> +</span><span id="L-1119"><a href="#L-1119"><span class="linenos">1119</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">identified_property</span><span class="p">:</span> +</span><span id="L-1120"><a href="#L-1120"><span class="linenos">1120</span></a> <span class="k">break</span> +</span><span id="L-1121"><a href="#L-1121"><span class="linenos">1121</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">identified_property</span><span class="p">):</span> +</span><span id="L-1122"><a href="#L-1122"><span class="linenos">1122</span></a> <span class="n">properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="L-1123"><a href="#L-1123"><span class="linenos">1123</span></a> +</span><span id="L-1124"><a href="#L-1124"><span class="linenos">1124</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="L-1125"><a href="#L-1125"><span class="linenos">1125</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">properties</span><span class="p">)</span> +</span><span id="L-1126"><a href="#L-1126"><span class="linenos">1126</span></a> +</span><span id="L-1127"><a href="#L-1127"><span class="linenos">1127</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1128"><a href="#L-1128"><span class="linenos">1128</span></a> +</span><span id="L-1129"><a href="#L-1129"><span class="linenos">1129</span></a> <span class="k">def</span> <span class="nf">_parse_fallback</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1130"><a href="#L-1130"><span class="linenos">1130</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FALLBACK"</span><span class="p">)</span> +</span><span id="L-1131"><a href="#L-1131"><span class="linenos">1131</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1132"><a href="#L-1132"><span class="linenos">1132</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> <span class="n">protection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PROTECTION"</span><span class="p">)</span> +</span><span id="L-1133"><a href="#L-1133"><span class="linenos">1133</span></a> <span class="p">)</span> +</span><span id="L-1134"><a href="#L-1134"><span class="linenos">1134</span></a> +</span><span id="L-1135"><a href="#L-1135"><span class="linenos">1135</span></a> <span class="k">def</span> <span class="nf">_parse_with_property</span><span class="p">(</span> +</span><span id="L-1136"><a href="#L-1136"><span class="linenos">1136</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-1137"><a href="#L-1137"><span class="linenos">1137</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="L-1138"><a href="#L-1138"><span class="linenos">1138</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-1139"><a href="#L-1139"><span class="linenos">1139</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">)</span> +</span><span id="L-1140"><a href="#L-1140"><span class="linenos">1140</span></a> +</span><span id="L-1141"><a href="#L-1141"><span class="linenos">1141</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="p">:</span> +</span><span id="L-1142"><a href="#L-1142"><span class="linenos">1142</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1143"><a href="#L-1143"><span class="linenos">1143</span></a> +</span><span id="L-1144"><a href="#L-1144"><span class="linenos">1144</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"JOURNAL"</span><span class="p">:</span> +</span><span id="L-1145"><a href="#L-1145"><span class="linenos">1145</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_withjournaltable</span><span class="p">()</span> +</span><span id="L-1146"><a href="#L-1146"><span class="linenos">1146</span></a> +</span><span id="L-1147"><a href="#L-1147"><span class="linenos">1147</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_withisolatedloading</span><span class="p">()</span> +</span><span id="L-1148"><a href="#L-1148"><span class="linenos">1148</span></a> +</span><span id="L-1149"><a href="#L-1149"><span class="linenos">1149</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/create-view.html</span> +</span><span id="L-1150"><a href="#L-1150"><span class="linenos">1150</span></a> <span class="k">def</span> <span class="nf">_parse_definer</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1151"><a href="#L-1151"><span class="linenos">1151</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1152"><a href="#L-1152"><span class="linenos">1152</span></a> +</span><span id="L-1153"><a href="#L-1153"><span class="linenos">1153</span></a> <span class="n">user</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-1154"><a href="#L-1154"><span class="linenos">1154</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">)</span> +</span><span id="L-1155"><a href="#L-1155"><span class="linenos">1155</span></a> <span class="n">host</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="ow">or</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-1156"><a href="#L-1156"><span class="linenos">1156</span></a> +</span><span id="L-1157"><a href="#L-1157"><span class="linenos">1157</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">user</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">host</span><span class="p">:</span> +</span><span id="L-1158"><a href="#L-1158"><span class="linenos">1158</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1159"><a href="#L-1159"><span class="linenos">1159</span></a> +</span><span id="L-1160"><a href="#L-1160"><span class="linenos">1160</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DefinerProperty</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">user</span><span class="si">}</span><span class="s2">@</span><span class="si">{</span><span class="n">host</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1161"><a href="#L-1161"><span class="linenos">1161</span></a> +</span><span id="L-1162"><a href="#L-1162"><span class="linenos">1162</span></a> <span class="k">def</span> <span class="nf">_parse_withjournaltable</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1163"><a href="#L-1163"><span class="linenos">1163</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"JOURNAL"</span><span class="p">,</span> <span class="s2">"TABLE"</span><span class="p">)</span> +</span><span id="L-1164"><a href="#L-1164"><span class="linenos">1164</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1165"><a href="#L-1165"><span class="linenos">1165</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">WithJournalTableProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">())</span> +</span><span id="L-1166"><a href="#L-1166"><span class="linenos">1166</span></a> +</span><span id="L-1167"><a href="#L-1167"><span class="linenos">1167</span></a> <span class="k">def</span> <span class="nf">_parse_log</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1168"><a href="#L-1168"><span class="linenos">1168</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LOG"</span><span class="p">)</span> +</span><span id="L-1169"><a href="#L-1169"><span class="linenos">1169</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LogProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">)</span> +</span><span id="L-1170"><a href="#L-1170"><span class="linenos">1170</span></a> +</span><span id="L-1171"><a href="#L-1171"><span class="linenos">1171</span></a> <span class="k">def</span> <span class="nf">_parse_journal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1172"><a href="#L-1172"><span class="linenos">1172</span></a> <span class="n">before</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"BEFORE"</span><span class="p">)</span> +</span><span id="L-1173"><a href="#L-1173"><span class="linenos">1173</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"JOURNAL"</span><span class="p">)</span> +</span><span id="L-1174"><a href="#L-1174"><span class="linenos">1174</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="n">dual</span><span class="p">,</span> <span class="n">before</span><span class="o">=</span><span class="n">before</span><span class="p">)</span> +</span><span id="L-1175"><a href="#L-1175"><span class="linenos">1175</span></a> +</span><span id="L-1176"><a href="#L-1176"><span class="linenos">1176</span></a> <span class="k">def</span> <span class="nf">_parse_afterjournal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1177"><a href="#L-1177"><span class="linenos">1177</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NOT"</span><span class="p">)</span> +</span><span id="L-1178"><a href="#L-1178"><span class="linenos">1178</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LOCAL"</span><span class="p">)</span> +</span><span id="L-1179"><a href="#L-1179"><span class="linenos">1179</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AFTER"</span><span class="p">,</span> <span class="s2">"JOURNAL"</span><span class="p">)</span> +</span><span id="L-1180"><a href="#L-1180"><span class="linenos">1180</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="n">dual</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="n">local</span><span class="p">)</span> +</span><span id="L-1181"><a href="#L-1181"><span class="linenos">1181</span></a> +</span><span id="L-1182"><a href="#L-1182"><span class="linenos">1182</span></a> <span class="k">def</span> <span class="nf">_parse_checksum</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1183"><a href="#L-1183"><span class="linenos">1183</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CHECKSUM"</span><span class="p">)</span> +</span><span id="L-1184"><a href="#L-1184"><span class="linenos">1184</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1185"><a href="#L-1185"><span class="linenos">1185</span></a> +</span><span id="L-1186"><a href="#L-1186"><span class="linenos">1186</span></a> <span class="n">on</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1187"><a href="#L-1187"><span class="linenos">1187</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="L-1188"><a href="#L-1188"><span class="linenos">1188</span></a> <span class="n">on</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1189"><a href="#L-1189"><span class="linenos">1189</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OFF"</span><span class="p">):</span> +</span><span id="L-1190"><a href="#L-1190"><span class="linenos">1190</span></a> <span class="n">on</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-1191"><a href="#L-1191"><span class="linenos">1191</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)</span> +</span><span id="L-1192"><a href="#L-1192"><span class="linenos">1192</span></a> +</span><span id="L-1193"><a href="#L-1193"><span class="linenos">1193</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1194"><a href="#L-1194"><span class="linenos">1194</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">,</span> +</span><span id="L-1195"><a href="#L-1195"><span class="linenos">1195</span></a> <span class="n">on</span><span class="o">=</span><span class="n">on</span><span class="p">,</span> +</span><span id="L-1196"><a href="#L-1196"><span class="linenos">1196</span></a> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> +</span><span id="L-1197"><a href="#L-1197"><span class="linenos">1197</span></a> <span class="p">)</span> +</span><span id="L-1198"><a href="#L-1198"><span class="linenos">1198</span></a> +</span><span id="L-1199"><a href="#L-1199"><span class="linenos">1199</span></a> <span class="k">def</span> <span class="nf">_parse_freespace</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1200"><a href="#L-1200"><span class="linenos">1200</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FREESPACE"</span><span class="p">)</span> +</span><span id="L-1201"><a href="#L-1201"><span class="linenos">1201</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1202"><a href="#L-1202"><span class="linenos">1202</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1203"><a href="#L-1203"><span class="linenos">1203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">(),</span> <span class="n">percent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">)</span> +</span><span id="L-1204"><a href="#L-1204"><span class="linenos">1204</span></a> <span class="p">)</span> +</span><span id="L-1205"><a href="#L-1205"><span class="linenos">1205</span></a> +</span><span id="L-1206"><a href="#L-1206"><span class="linenos">1206</span></a> <span class="k">def</span> <span class="nf">_parse_mergeblockratio</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1207"><a href="#L-1207"><span class="linenos">1207</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MERGEBLOCKRATIO"</span><span class="p">)</span> +</span><span id="L-1208"><a href="#L-1208"><span class="linenos">1208</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="L-1209"><a href="#L-1209"><span class="linenos">1209</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1210"><a href="#L-1210"><span class="linenos">1210</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">,</span> +</span><span id="L-1211"><a href="#L-1211"><span class="linenos">1211</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">(),</span> +</span><span id="L-1212"><a href="#L-1212"><span class="linenos">1212</span></a> <span class="n">percent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">),</span> +</span><span id="L-1213"><a href="#L-1213"><span class="linenos">1213</span></a> <span class="p">)</span> +</span><span id="L-1214"><a href="#L-1214"><span class="linenos">1214</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1215"><a href="#L-1215"><span class="linenos">1215</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1216"><a href="#L-1216"><span class="linenos">1216</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">,</span> +</span><span id="L-1217"><a href="#L-1217"><span class="linenos">1217</span></a> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> +</span><span id="L-1218"><a href="#L-1218"><span class="linenos">1218</span></a> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> +</span><span id="L-1219"><a href="#L-1219"><span class="linenos">1219</span></a> <span class="p">)</span> +</span><span id="L-1220"><a href="#L-1220"><span class="linenos">1220</span></a> +</span><span id="L-1221"><a href="#L-1221"><span class="linenos">1221</span></a> <span class="k">def</span> <span class="nf">_parse_datablocksize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1222"><a href="#L-1222"><span class="linenos">1222</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="L-1223"><a href="#L-1223"><span class="linenos">1223</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="L-1224"><a href="#L-1224"><span class="linenos">1224</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1225"><a href="#L-1225"><span class="linenos">1225</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"MIN"</span><span class="p">,</span> <span class="s2">"MINIMUM"</span><span class="p">)):</span> +</span><span id="L-1226"><a href="#L-1226"><span class="linenos">1226</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="L-1227"><a href="#L-1227"><span class="linenos">1227</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="nb">min</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1228"><a href="#L-1228"><span class="linenos">1228</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"MAX"</span><span class="p">,</span> <span class="s2">"MAXIMUM"</span><span class="p">)):</span> +</span><span id="L-1229"><a href="#L-1229"><span class="linenos">1229</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="L-1230"><a href="#L-1230"><span class="linenos">1230</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="nb">min</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1231"><a href="#L-1231"><span class="linenos">1231</span></a> +</span><span id="L-1232"><a href="#L-1232"><span class="linenos">1232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="L-1233"><a href="#L-1233"><span class="linenos">1233</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1234"><a href="#L-1234"><span class="linenos">1234</span></a> <span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-1235"><a href="#L-1235"><span class="linenos">1235</span></a> <span class="n">units</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1236"><a href="#L-1236"><span class="linenos">1236</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"BYTES"</span><span class="p">,</span> <span class="s2">"KBYTES"</span><span class="p">,</span> <span class="s2">"KILOBYTES"</span><span class="p">)):</span> +</span><span id="L-1237"><a href="#L-1237"><span class="linenos">1237</span></a> <span class="n">units</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-1238"><a href="#L-1238"><span class="linenos">1238</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span> <span class="n">units</span><span class="o">=</span><span class="n">units</span><span class="p">)</span> +</span><span id="L-1239"><a href="#L-1239"><span class="linenos">1239</span></a> +</span><span id="L-1240"><a href="#L-1240"><span class="linenos">1240</span></a> <span class="k">def</span> <span class="nf">_parse_blockcompression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1241"><a href="#L-1241"><span class="linenos">1241</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"BLOCKCOMPRESSION"</span><span class="p">)</span> +</span><span id="L-1242"><a href="#L-1242"><span class="linenos">1242</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1243"><a href="#L-1243"><span class="linenos">1243</span></a> <span class="n">always</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">)</span> +</span><span id="L-1244"><a href="#L-1244"><span class="linenos">1244</span></a> <span class="n">manual</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MANUAL"</span><span class="p">)</span> +</span><span id="L-1245"><a href="#L-1245"><span class="linenos">1245</span></a> <span class="n">never</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NEVER"</span><span class="p">)</span> +</span><span id="L-1246"><a href="#L-1246"><span class="linenos">1246</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFAULT"</span><span class="p">)</span> +</span><span id="L-1247"><a href="#L-1247"><span class="linenos">1247</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1248"><a href="#L-1248"><span class="linenos">1248</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AUTOTEMP"</span><span class="p">):</span> +</span><span id="L-1249"><a href="#L-1249"><span class="linenos">1249</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> +</span><span id="L-1250"><a href="#L-1250"><span class="linenos">1250</span></a> +</span><span id="L-1251"><a href="#L-1251"><span class="linenos">1251</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1252"><a href="#L-1252"><span class="linenos">1252</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">,</span> +</span><span id="L-1253"><a href="#L-1253"><span class="linenos">1253</span></a> <span class="n">always</span><span class="o">=</span><span class="n">always</span><span class="p">,</span> +</span><span id="L-1254"><a href="#L-1254"><span class="linenos">1254</span></a> <span class="n">manual</span><span class="o">=</span><span class="n">manual</span><span class="p">,</span> +</span><span id="L-1255"><a href="#L-1255"><span class="linenos">1255</span></a> <span class="n">never</span><span class="o">=</span><span class="n">never</span><span class="p">,</span> +</span><span id="L-1256"><a href="#L-1256"><span class="linenos">1256</span></a> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> +</span><span id="L-1257"><a href="#L-1257"><span class="linenos">1257</span></a> <span class="n">autotemp</span><span class="o">=</span><span class="n">autotemp</span><span class="p">,</span> +</span><span id="L-1258"><a href="#L-1258"><span class="linenos">1258</span></a> <span class="p">)</span> +</span><span id="L-1259"><a href="#L-1259"><span class="linenos">1259</span></a> +</span><span id="L-1260"><a href="#L-1260"><span class="linenos">1260</span></a> <span class="k">def</span> <span class="nf">_parse_withisolatedloading</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1261"><a href="#L-1261"><span class="linenos">1261</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> +</span><span id="L-1262"><a href="#L-1262"><span class="linenos">1262</span></a> <span class="n">no</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">)</span> +</span><span id="L-1263"><a href="#L-1263"><span class="linenos">1263</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CONCURRENT"</span><span class="p">)</span> +</span><span id="L-1264"><a href="#L-1264"><span class="linenos">1264</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ISOLATED"</span><span class="p">,</span> <span class="s2">"LOADING"</span><span class="p">)</span> +</span><span id="L-1265"><a href="#L-1265"><span class="linenos">1265</span></a> <span class="n">for_all</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"ALL"</span><span class="p">)</span> +</span><span id="L-1266"><a href="#L-1266"><span class="linenos">1266</span></a> <span class="n">for_insert</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"INSERT"</span><span class="p">)</span> +</span><span id="L-1267"><a href="#L-1267"><span class="linenos">1267</span></a> <span class="n">for_none</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"NONE"</span><span class="p">)</span> +</span><span id="L-1268"><a href="#L-1268"><span class="linenos">1268</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1269"><a href="#L-1269"><span class="linenos">1269</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">,</span> +</span><span id="L-1270"><a href="#L-1270"><span class="linenos">1270</span></a> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> +</span><span id="L-1271"><a href="#L-1271"><span class="linenos">1271</span></a> <span class="n">concurrent</span><span class="o">=</span><span class="n">concurrent</span><span class="p">,</span> +</span><span id="L-1272"><a href="#L-1272"><span class="linenos">1272</span></a> <span class="n">for_all</span><span class="o">=</span><span class="n">for_all</span><span class="p">,</span> +</span><span id="L-1273"><a href="#L-1273"><span class="linenos">1273</span></a> <span class="n">for_insert</span><span class="o">=</span><span class="n">for_insert</span><span class="p">,</span> +</span><span id="L-1274"><a href="#L-1274"><span class="linenos">1274</span></a> <span class="n">for_none</span><span class="o">=</span><span class="n">for_none</span><span class="p">,</span> +</span><span id="L-1275"><a href="#L-1275"><span class="linenos">1275</span></a> <span class="p">)</span> +</span><span id="L-1276"><a href="#L-1276"><span class="linenos">1276</span></a> +</span><span id="L-1277"><a href="#L-1277"><span class="linenos">1277</span></a> <span class="k">def</span> <span class="nf">_parse_partition_by</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-1278"><a href="#L-1278"><span class="linenos">1278</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">):</span> +</span><span id="L-1279"><a href="#L-1279"><span class="linenos">1279</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-1280"><a href="#L-1280"><span class="linenos">1280</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-1281"><a href="#L-1281"><span class="linenos">1281</span></a> +</span><span id="L-1282"><a href="#L-1282"><span class="linenos">1282</span></a> <span class="k">def</span> <span class="nf">_parse_partitioned_by</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1283"><a href="#L-1283"><span class="linenos">1283</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1284"><a href="#L-1284"><span class="linenos">1284</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1285"><a href="#L-1285"><span class="linenos">1285</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">,</span> +</span><span id="L-1286"><a href="#L-1286"><span class="linenos">1286</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">()),</span> +</span><span id="L-1287"><a href="#L-1287"><span class="linenos">1287</span></a> <span class="p">)</span> +</span><span id="L-1288"><a href="#L-1288"><span class="linenos">1288</span></a> +</span><span id="L-1289"><a href="#L-1289"><span class="linenos">1289</span></a> <span class="k">def</span> <span class="nf">_parse_distkey</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1290"><a href="#L-1290"><span class="linenos">1290</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">))</span> +</span><span id="L-1291"><a href="#L-1291"><span class="linenos">1291</span></a> +</span><span id="L-1292"><a href="#L-1292"><span class="linenos">1292</span></a> <span class="k">def</span> <span class="nf">_parse_create_like</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1293"><a href="#L-1293"><span class="linenos">1293</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1294"><a href="#L-1294"><span class="linenos">1294</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1295"><a href="#L-1295"><span class="linenos">1295</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"INCLUDING"</span><span class="p">,</span> <span class="s2">"EXCLUDING"</span><span class="p">)):</span> +</span><span id="L-1296"><a href="#L-1296"><span class="linenos">1296</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-1297"><a href="#L-1297"><span class="linenos">1297</span></a> <span class="n">id_var</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-1298"><a href="#L-1298"><span class="linenos">1298</span></a> +</span><span id="L-1299"><a href="#L-1299"><span class="linenos">1299</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">id_var</span><span class="p">:</span> +</span><span id="L-1300"><a href="#L-1300"><span class="linenos">1300</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1301"><a href="#L-1301"><span class="linenos">1301</span></a> +</span><span id="L-1302"><a href="#L-1302"><span class="linenos">1302</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-1303"><a href="#L-1303"><span class="linenos">1303</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1304"><a href="#L-1304"><span class="linenos">1304</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">,</span> +</span><span id="L-1305"><a href="#L-1305"><span class="linenos">1305</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-1306"><a href="#L-1306"><span class="linenos">1306</span></a> <span class="n">value</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">id_var</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">upper</span><span class="p">()),</span> +</span><span id="L-1307"><a href="#L-1307"><span class="linenos">1307</span></a> <span class="p">)</span> +</span><span id="L-1308"><a href="#L-1308"><span class="linenos">1308</span></a> <span class="p">)</span> +</span><span id="L-1309"><a href="#L-1309"><span class="linenos">1309</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">options</span><span class="p">)</span> +</span><span id="L-1310"><a href="#L-1310"><span class="linenos">1310</span></a> +</span><span id="L-1311"><a href="#L-1311"><span class="linenos">1311</span></a> <span class="k">def</span> <span class="nf">_parse_sortkey</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">compound</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1312"><a href="#L-1312"><span class="linenos">1312</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1313"><a href="#L-1313"><span class="linenos">1313</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">),</span> <span class="n">compound</span><span class="o">=</span><span class="n">compound</span> +</span><span id="L-1314"><a href="#L-1314"><span class="linenos">1314</span></a> <span class="p">)</span> +</span><span id="L-1315"><a href="#L-1315"><span class="linenos">1315</span></a> +</span><span id="L-1316"><a href="#L-1316"><span class="linenos">1316</span></a> <span class="k">def</span> <span class="nf">_parse_character_set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1317"><a href="#L-1317"><span class="linenos">1317</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1318"><a href="#L-1318"><span class="linenos">1318</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1319"><a href="#L-1319"><span class="linenos">1319</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">(),</span> <span class="n">default</span><span class="o">=</span><span class="n">default</span> +</span><span id="L-1320"><a href="#L-1320"><span class="linenos">1320</span></a> <span class="p">)</span> +</span><span id="L-1321"><a href="#L-1321"><span class="linenos">1321</span></a> +</span><span id="L-1322"><a href="#L-1322"><span class="linenos">1322</span></a> <span class="k">def</span> <span class="nf">_parse_returns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1323"><a href="#L-1323"><span class="linenos">1323</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-1324"><a href="#L-1324"><span class="linenos">1324</span></a> <span class="n">is_table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="L-1325"><a href="#L-1325"><span class="linenos">1325</span></a> +</span><span id="L-1326"><a href="#L-1326"><span class="linenos">1326</span></a> <span class="k">if</span> <span class="n">is_table</span><span class="p">:</span> +</span><span id="L-1327"><a href="#L-1327"><span class="linenos">1327</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="L-1328"><a href="#L-1328"><span class="linenos">1328</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1329"><a href="#L-1329"><span class="linenos">1329</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">,</span> +</span><span id="L-1330"><a href="#L-1330"><span class="linenos">1330</span></a> <span class="n">this</span><span class="o">=</span><span class="s2">"TABLE"</span><span class="p">,</span> +</span><span id="L-1331"><a href="#L-1331"><span class="linenos">1331</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_struct_kwargs</span><span class="p">),</span> +</span><span id="L-1332"><a href="#L-1332"><span class="linenos">1332</span></a> <span class="p">)</span> +</span><span id="L-1333"><a href="#L-1333"><span class="linenos">1333</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="L-1334"><a href="#L-1334"><span class="linenos">1334</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting >"</span><span class="p">)</span> +</span><span id="L-1335"><a href="#L-1335"><span class="linenos">1335</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1336"><a href="#L-1336"><span class="linenos">1336</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"TABLE"</span><span class="p">))</span> +</span><span id="L-1337"><a href="#L-1337"><span class="linenos">1337</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1338"><a href="#L-1338"><span class="linenos">1338</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-1339"><a href="#L-1339"><span class="linenos">1339</span></a> +</span><span id="L-1340"><a href="#L-1340"><span class="linenos">1340</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">is_table</span><span class="o">=</span><span class="n">is_table</span><span class="p">)</span> +</span><span id="L-1341"><a href="#L-1341"><span class="linenos">1341</span></a> +</span><span id="L-1342"><a href="#L-1342"><span class="linenos">1342</span></a> <span class="k">def</span> <span class="nf">_parse_describe</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1343"><a href="#L-1343"><span class="linenos">1343</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-1344"><a href="#L-1344"><span class="linenos">1344</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> +</span><span id="L-1345"><a href="#L-1345"><span class="linenos">1345</span></a> +</span><span id="L-1346"><a href="#L-1346"><span class="linenos">1346</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="L-1347"><a href="#L-1347"><span class="linenos">1347</span></a> +</span><span id="L-1348"><a href="#L-1348"><span class="linenos">1348</span></a> <span class="k">def</span> <span class="nf">_parse_insert</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1349"><a href="#L-1349"><span class="linenos">1349</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OVERWRITE</span><span class="p">)</span> +</span><span id="L-1350"><a href="#L-1350"><span class="linenos">1350</span></a> <span class="n">local</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">)</span> +</span><span id="L-1351"><a href="#L-1351"><span class="linenos">1351</span></a> +</span><span id="L-1352"><a href="#L-1352"><span class="linenos">1352</span></a> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-1353"><a href="#L-1353"><span class="linenos">1353</span></a> +</span><span id="L-1354"><a href="#L-1354"><span class="linenos">1354</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DIRECTORY"</span><span class="p">):</span> +</span><span id="L-1355"><a href="#L-1355"><span class="linenos">1355</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1356"><a href="#L-1356"><span class="linenos">1356</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">,</span> +</span><span id="L-1357"><a href="#L-1357"><span class="linenos">1357</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">(),</span> +</span><span id="L-1358"><a href="#L-1358"><span class="linenos">1358</span></a> <span class="n">local</span><span class="o">=</span><span class="n">local</span><span class="p">,</span> +</span><span id="L-1359"><a href="#L-1359"><span class="linenos">1359</span></a> <span class="n">row_format</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_row_format</span><span class="p">(</span><span class="n">match_row</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-1360"><a href="#L-1360"><span class="linenos">1360</span></a> <span class="p">)</span> +</span><span id="L-1361"><a href="#L-1361"><span class="linenos">1361</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1362"><a href="#L-1362"><span class="linenos">1362</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">)</span> +</span><span id="L-1363"><a href="#L-1363"><span class="linenos">1363</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="L-1364"><a href="#L-1364"><span class="linenos">1364</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1365"><a href="#L-1365"><span class="linenos">1365</span></a> +</span><span id="L-1366"><a href="#L-1366"><span class="linenos">1366</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1367"><a href="#L-1367"><span class="linenos">1367</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">,</span> +</span><span id="L-1368"><a href="#L-1368"><span class="linenos">1368</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-1369"><a href="#L-1369"><span class="linenos">1369</span></a> <span class="n">exists</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(),</span> +</span><span id="L-1370"><a href="#L-1370"><span class="linenos">1370</span></a> <span class="n">partition</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition</span><span class="p">(),</span> +</span><span id="L-1371"><a href="#L-1371"><span class="linenos">1371</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_ddl_select</span><span class="p">(),</span> +</span><span id="L-1372"><a href="#L-1372"><span class="linenos">1372</span></a> <span class="n">overwrite</span><span class="o">=</span><span class="n">overwrite</span><span class="p">,</span> +</span><span id="L-1373"><a href="#L-1373"><span class="linenos">1373</span></a> <span class="p">)</span> +</span><span id="L-1374"><a href="#L-1374"><span class="linenos">1374</span></a> +</span><span id="L-1375"><a href="#L-1375"><span class="linenos">1375</span></a> <span class="k">def</span> <span class="nf">_parse_row</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1376"><a href="#L-1376"><span class="linenos">1376</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span> +</span><span id="L-1377"><a href="#L-1377"><span class="linenos">1377</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1378"><a href="#L-1378"><span class="linenos">1378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_row_format</span><span class="p">()</span> +</span><span id="L-1379"><a href="#L-1379"><span class="linenos">1379</span></a> +</span><span id="L-1380"><a href="#L-1380"><span class="linenos">1380</span></a> <span class="k">def</span> <span class="nf">_parse_row_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">match_row</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1381"><a href="#L-1381"><span class="linenos">1381</span></a> <span class="k">if</span> <span class="n">match_row</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span> +</span><span id="L-1382"><a href="#L-1382"><span class="linenos">1382</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1383"><a href="#L-1383"><span class="linenos">1383</span></a> +</span><span id="L-1384"><a href="#L-1384"><span class="linenos">1384</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SERDE"</span><span class="p">):</span> +</span><span id="L-1385"><a href="#L-1385"><span class="linenos">1385</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="L-1386"><a href="#L-1386"><span class="linenos">1386</span></a> +</span><span id="L-1387"><a href="#L-1387"><span class="linenos">1387</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DELIMITED"</span><span class="p">)</span> +</span><span id="L-1388"><a href="#L-1388"><span class="linenos">1388</span></a> +</span><span id="L-1389"><a href="#L-1389"><span class="linenos">1389</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-1390"><a href="#L-1390"><span class="linenos">1390</span></a> +</span><span id="L-1391"><a href="#L-1391"><span class="linenos">1391</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FIELDS"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="L-1392"><a href="#L-1392"><span class="linenos">1392</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"fields"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1393"><a href="#L-1393"><span class="linenos">1393</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ESCAPED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="L-1394"><a href="#L-1394"><span class="linenos">1394</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"escaped"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1395"><a href="#L-1395"><span class="linenos">1395</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"COLLECTION"</span><span class="p">,</span> <span class="s2">"ITEMS"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="L-1396"><a href="#L-1396"><span class="linenos">1396</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"collection_items"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1397"><a href="#L-1397"><span class="linenos">1397</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MAP"</span><span class="p">,</span> <span class="s2">"KEYS"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="L-1398"><a href="#L-1398"><span class="linenos">1398</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"map_keys"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1399"><a href="#L-1399"><span class="linenos">1399</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LINES"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="L-1400"><a href="#L-1400"><span class="linenos">1400</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"lines"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1401"><a href="#L-1401"><span class="linenos">1401</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NULL"</span><span class="p">,</span> <span class="s2">"DEFINED"</span><span class="p">,</span> <span class="s2">"AS"</span><span class="p">):</span> +</span><span id="L-1402"><a href="#L-1402"><span class="linenos">1402</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"null"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1403"><a href="#L-1403"><span class="linenos">1403</span></a> +</span><span id="L-1404"><a href="#L-1404"><span class="linenos">1404</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-1405"><a href="#L-1405"><span class="linenos">1405</span></a> +</span><span id="L-1406"><a href="#L-1406"><span class="linenos">1406</span></a> <span class="k">def</span> <span class="nf">_parse_load_data</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1407"><a href="#L-1407"><span class="linenos">1407</span></a> <span class="n">local</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">)</span> +</span><span id="L-1408"><a href="#L-1408"><span class="linenos">1408</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INPATH"</span><span class="p">)</span> +</span><span id="L-1409"><a href="#L-1409"><span class="linenos">1409</span></a> <span class="n">inpath</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1410"><a href="#L-1410"><span class="linenos">1410</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OVERWRITE</span><span class="p">)</span> +</span><span id="L-1411"><a href="#L-1411"><span class="linenos">1411</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="L-1412"><a href="#L-1412"><span class="linenos">1412</span></a> +</span><span id="L-1413"><a href="#L-1413"><span class="linenos">1413</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1414"><a href="#L-1414"><span class="linenos">1414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LoadData</span><span class="p">,</span> +</span><span id="L-1415"><a href="#L-1415"><span class="linenos">1415</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-1416"><a href="#L-1416"><span class="linenos">1416</span></a> <span class="n">local</span><span class="o">=</span><span class="n">local</span><span class="p">,</span> +</span><span id="L-1417"><a href="#L-1417"><span class="linenos">1417</span></a> <span class="n">overwrite</span><span class="o">=</span><span class="n">overwrite</span><span class="p">,</span> +</span><span id="L-1418"><a href="#L-1418"><span class="linenos">1418</span></a> <span class="n">inpath</span><span class="o">=</span><span class="n">inpath</span><span class="p">,</span> +</span><span id="L-1419"><a href="#L-1419"><span class="linenos">1419</span></a> <span class="n">partition</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition</span><span class="p">(),</span> +</span><span id="L-1420"><a href="#L-1420"><span class="linenos">1420</span></a> <span class="n">input_format</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INPUTFORMAT"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">(),</span> +</span><span id="L-1421"><a href="#L-1421"><span class="linenos">1421</span></a> <span class="n">serde</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SERDE"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">(),</span> +</span><span id="L-1422"><a href="#L-1422"><span class="linenos">1422</span></a> <span class="p">)</span> +</span><span id="L-1423"><a href="#L-1423"><span class="linenos">1423</span></a> +</span><span id="L-1424"><a href="#L-1424"><span class="linenos">1424</span></a> <span class="k">def</span> <span class="nf">_parse_delete</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1425"><a href="#L-1425"><span class="linenos">1425</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="L-1426"><a href="#L-1426"><span class="linenos">1426</span></a> +</span><span id="L-1427"><a href="#L-1427"><span class="linenos">1427</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1428"><a href="#L-1428"><span class="linenos">1428</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">,</span> +</span><span id="L-1429"><a href="#L-1429"><span class="linenos">1429</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-1430"><a href="#L-1430"><span class="linenos">1430</span></a> <span class="n">using</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()),</span> +</span><span id="L-1431"><a href="#L-1431"><span class="linenos">1431</span></a> <span class="n">where</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="L-1432"><a href="#L-1432"><span class="linenos">1432</span></a> <span class="p">)</span> +</span><span id="L-1433"><a href="#L-1433"><span class="linenos">1433</span></a> +</span><span id="L-1434"><a href="#L-1434"><span class="linenos">1434</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1435"><a href="#L-1435"><span class="linenos">1435</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1436"><a href="#L-1436"><span class="linenos">1436</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="L-1437"><a href="#L-1437"><span class="linenos">1437</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="L-1438"><a href="#L-1438"><span class="linenos">1438</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span> +</span><span id="L-1439"><a href="#L-1439"><span class="linenos">1439</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="L-1440"><a href="#L-1440"><span class="linenos">1440</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="L-1441"><a href="#L-1441"><span class="linenos">1441</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="L-1442"><a href="#L-1442"><span class="linenos">1442</span></a> <span class="p">},</span> +</span><span id="L-1443"><a href="#L-1443"><span class="linenos">1443</span></a> <span class="p">)</span> +</span><span id="L-1444"><a href="#L-1444"><span class="linenos">1444</span></a> +</span><span id="L-1445"><a href="#L-1445"><span class="linenos">1445</span></a> <span class="k">def</span> <span class="nf">_parse_uncache</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1446"><a href="#L-1446"><span class="linenos">1446</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">):</span> +</span><span id="L-1447"><a href="#L-1447"><span class="linenos">1447</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting TABLE after UNCACHE"</span><span class="p">)</span> +</span><span id="L-1448"><a href="#L-1448"><span class="linenos">1448</span></a> +</span><span id="L-1449"><a href="#L-1449"><span class="linenos">1449</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1450"><a href="#L-1450"><span class="linenos">1450</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Uncache</span><span class="p">,</span> +</span><span id="L-1451"><a href="#L-1451"><span class="linenos">1451</span></a> <span class="n">exists</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(),</span> +</span><span id="L-1452"><a href="#L-1452"><span class="linenos">1452</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-1453"><a href="#L-1453"><span class="linenos">1453</span></a> <span class="p">)</span> +</span><span id="L-1454"><a href="#L-1454"><span class="linenos">1454</span></a> +</span><span id="L-1455"><a href="#L-1455"><span class="linenos">1455</span></a> <span class="k">def</span> <span class="nf">_parse_cache</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1456"><a href="#L-1456"><span class="linenos">1456</span></a> <span class="n">lazy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LAZY</span><span class="p">)</span> +</span><span id="L-1457"><a href="#L-1457"><span class="linenos">1457</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="L-1458"><a href="#L-1458"><span class="linenos">1458</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1459"><a href="#L-1459"><span class="linenos">1459</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1460"><a href="#L-1460"><span class="linenos">1460</span></a> +</span><span id="L-1461"><a href="#L-1461"><span class="linenos">1461</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OPTIONS</span><span class="p">):</span> +</span><span id="L-1462"><a href="#L-1462"><span class="linenos">1462</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="L-1463"><a href="#L-1463"><span class="linenos">1463</span></a> <span class="n">k</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1464"><a href="#L-1464"><span class="linenos">1464</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="L-1465"><a href="#L-1465"><span class="linenos">1465</span></a> <span class="n">v</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-1466"><a href="#L-1466"><span class="linenos">1466</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">]</span> +</span><span id="L-1467"><a href="#L-1467"><span class="linenos">1467</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-1468"><a href="#L-1468"><span class="linenos">1468</span></a> +</span><span id="L-1469"><a href="#L-1469"><span class="linenos">1469</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-1470"><a href="#L-1470"><span class="linenos">1470</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1471"><a href="#L-1471"><span class="linenos">1471</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> +</span><span id="L-1472"><a href="#L-1472"><span class="linenos">1472</span></a> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> +</span><span id="L-1473"><a href="#L-1473"><span class="linenos">1473</span></a> <span class="n">lazy</span><span class="o">=</span><span class="n">lazy</span><span class="p">,</span> +</span><span id="L-1474"><a href="#L-1474"><span class="linenos">1474</span></a> <span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span> +</span><span id="L-1475"><a href="#L-1475"><span class="linenos">1475</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-1476"><a href="#L-1476"><span class="linenos">1476</span></a> <span class="p">)</span> +</span><span id="L-1477"><a href="#L-1477"><span class="linenos">1477</span></a> +</span><span id="L-1478"><a href="#L-1478"><span class="linenos">1478</span></a> <span class="k">def</span> <span class="nf">_parse_partition</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1479"><a href="#L-1479"><span class="linenos">1479</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION</span><span class="p">):</span> +</span><span id="L-1480"><a href="#L-1480"><span class="linenos">1480</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1481"><a href="#L-1481"><span class="linenos">1481</span></a> +</span><span id="L-1482"><a href="#L-1482"><span class="linenos">1482</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1483"><a href="#L-1483"><span class="linenos">1483</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Partition</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-1484"><a href="#L-1484"><span class="linenos">1484</span></a> <span class="p">)</span> +</span><span id="L-1485"><a href="#L-1485"><span class="linenos">1485</span></a> +</span><span id="L-1486"><a href="#L-1486"><span class="linenos">1486</span></a> <span class="k">def</span> <span class="nf">_parse_value</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1487"><a href="#L-1487"><span class="linenos">1487</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-1488"><a href="#L-1488"><span class="linenos">1488</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-1489"><a href="#L-1489"><span class="linenos">1489</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-1490"><a href="#L-1490"><span class="linenos">1490</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-1491"><a href="#L-1491"><span class="linenos">1491</span></a> +</span><span id="L-1492"><a href="#L-1492"><span class="linenos">1492</span></a> <span class="c1"># In presto we can have VALUES 1, 2 which results in 1 column & 2 rows.</span> +</span><span id="L-1493"><a href="#L-1493"><span class="linenos">1493</span></a> <span class="c1"># Source: https://prestodb.io/docs/current/sql/values.html</span> +</span><span id="L-1494"><a href="#L-1494"><span class="linenos">1494</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()])</span> +</span><span id="L-1495"><a href="#L-1495"><span class="linenos">1495</span></a> +</span><span id="L-1496"><a href="#L-1496"><span class="linenos">1496</span></a> <span class="k">def</span> <span class="nf">_parse_select</span><span class="p">(</span> +</span><span id="L-1497"><a href="#L-1497"><span class="linenos">1497</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nested</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">parse_subquery_alias</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1498"><a href="#L-1498"><span class="linenos">1498</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1499"><a href="#L-1499"><span class="linenos">1499</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_with</span><span class="p">()</span> +</span><span id="L-1500"><a href="#L-1500"><span class="linenos">1500</span></a> <span class="k">if</span> <span class="n">cte</span><span class="p">:</span> +</span><span id="L-1501"><a href="#L-1501"><span class="linenos">1501</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="L-1502"><a href="#L-1502"><span class="linenos">1502</span></a> +</span><span id="L-1503"><a href="#L-1503"><span class="linenos">1503</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="L-1504"><a href="#L-1504"><span class="linenos">1504</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Failed to parse any statement following CTE"</span><span class="p">)</span> +</span><span id="L-1505"><a href="#L-1505"><span class="linenos">1505</span></a> <span class="k">return</span> <span class="n">cte</span> +</span><span id="L-1506"><a href="#L-1506"><span class="linenos">1506</span></a> +</span><span id="L-1507"><a href="#L-1507"><span class="linenos">1507</span></a> <span class="k">if</span> <span class="s2">"with"</span> <span class="ow">in</span> <span class="n">this</span><span class="o">.</span><span class="n">arg_types</span><span class="p">:</span> +</span><span id="L-1508"><a href="#L-1508"><span class="linenos">1508</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">cte</span><span class="p">)</span> +</span><span id="L-1509"><a href="#L-1509"><span class="linenos">1509</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1510"><a href="#L-1510"><span class="linenos">1510</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> does not support CTE"</span><span class="p">)</span> +</span><span id="L-1511"><a href="#L-1511"><span class="linenos">1511</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">cte</span> +</span><span id="L-1512"><a href="#L-1512"><span class="linenos">1512</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">):</span> +</span><span id="L-1513"><a href="#L-1513"><span class="linenos">1513</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-1514"><a href="#L-1514"><span class="linenos">1514</span></a> +</span><span id="L-1515"><a href="#L-1515"><span class="linenos">1515</span></a> <span class="n">hint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_hint</span><span class="p">()</span> +</span><span id="L-1516"><a href="#L-1516"><span class="linenos">1516</span></a> <span class="n">all_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">)</span> +</span><span id="L-1517"><a href="#L-1517"><span class="linenos">1517</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">)</span> +</span><span id="L-1518"><a href="#L-1518"><span class="linenos">1518</span></a> +</span><span id="L-1519"><a href="#L-1519"><span class="linenos">1519</span></a> <span class="k">if</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="L-1520"><a href="#L-1520"><span class="linenos">1520</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1521"><a href="#L-1521"><span class="linenos">1521</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">,</span> +</span><span id="L-1522"><a href="#L-1522"><span class="linenos">1522</span></a> <span class="n">on</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-1523"><a href="#L-1523"><span class="linenos">1523</span></a> <span class="p">)</span> +</span><span id="L-1524"><a href="#L-1524"><span class="linenos">1524</span></a> +</span><span id="L-1525"><a href="#L-1525"><span class="linenos">1525</span></a> <span class="k">if</span> <span class="n">all_</span> <span class="ow">and</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="L-1526"><a href="#L-1526"><span class="linenos">1526</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Cannot specify both ALL and DISTINCT after SELECT"</span><span class="p">)</span> +</span><span id="L-1527"><a href="#L-1527"><span class="linenos">1527</span></a> +</span><span id="L-1528"><a href="#L-1528"><span class="linenos">1528</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(</span><span class="n">top</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1529"><a href="#L-1529"><span class="linenos">1529</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">)</span> +</span><span id="L-1530"><a href="#L-1530"><span class="linenos">1530</span></a> +</span><span id="L-1531"><a href="#L-1531"><span class="linenos">1531</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1532"><a href="#L-1532"><span class="linenos">1532</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> +</span><span id="L-1533"><a href="#L-1533"><span class="linenos">1533</span></a> <span class="n">hint</span><span class="o">=</span><span class="n">hint</span><span class="p">,</span> +</span><span id="L-1534"><a href="#L-1534"><span class="linenos">1534</span></a> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> +</span><span id="L-1535"><a href="#L-1535"><span class="linenos">1535</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1536"><a href="#L-1536"><span class="linenos">1536</span></a> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> +</span><span id="L-1537"><a href="#L-1537"><span class="linenos">1537</span></a> <span class="p">)</span> +</span><span id="L-1538"><a href="#L-1538"><span class="linenos">1538</span></a> <span class="n">this</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="L-1539"><a href="#L-1539"><span class="linenos">1539</span></a> +</span><span id="L-1540"><a href="#L-1540"><span class="linenos">1540</span></a> <span class="n">into</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_into</span><span class="p">()</span> +</span><span id="L-1541"><a href="#L-1541"><span class="linenos">1541</span></a> <span class="k">if</span> <span class="n">into</span><span class="p">:</span> +</span><span id="L-1542"><a href="#L-1542"><span class="linenos">1542</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"into"</span><span class="p">,</span> <span class="n">into</span><span class="p">)</span> +</span><span id="L-1543"><a href="#L-1543"><span class="linenos">1543</span></a> +</span><span id="L-1544"><a href="#L-1544"><span class="linenos">1544</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">()</span> +</span><span id="L-1545"><a href="#L-1545"><span class="linenos">1545</span></a> <span class="k">if</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="L-1546"><a href="#L-1546"><span class="linenos">1546</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"from"</span><span class="p">,</span> <span class="n">from_</span><span class="p">)</span> +</span><span id="L-1547"><a href="#L-1547"><span class="linenos">1547</span></a> +</span><span id="L-1548"><a href="#L-1548"><span class="linenos">1548</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-1549"><a href="#L-1549"><span class="linenos">1549</span></a> <span class="k">elif</span> <span class="p">(</span><span class="n">table</span> <span class="ow">or</span> <span class="n">nested</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-1550"><a href="#L-1550"><span class="linenos">1550</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1551"><a href="#L-1551"><span class="linenos">1551</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-1552"><a href="#L-1552"><span class="linenos">1552</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-1553"><a href="#L-1553"><span class="linenos">1553</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-1554"><a href="#L-1554"><span class="linenos">1554</span></a> +</span><span id="L-1555"><a href="#L-1555"><span class="linenos">1555</span></a> <span class="c1"># early return so that subquery unions aren't parsed again</span> +</span><span id="L-1556"><a href="#L-1556"><span class="linenos">1556</span></a> <span class="c1"># SELECT * FROM (SELECT 1) UNION ALL SELECT 1</span> +</span><span id="L-1557"><a href="#L-1557"><span class="linenos">1557</span></a> <span class="c1"># Union ALL should be a property of the top select node, not the subquery</span> +</span><span id="L-1558"><a href="#L-1558"><span class="linenos">1558</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_subquery</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">parse_alias</span><span class="o">=</span><span class="n">parse_subquery_alias</span><span class="p">)</span> +</span><span id="L-1559"><a href="#L-1559"><span class="linenos">1559</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">):</span> +</span><span id="L-1560"><a href="#L-1560"><span class="linenos">1560</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1561"><a href="#L-1561"><span class="linenos">1561</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">,</span> +</span><span id="L-1562"><a href="#L-1562"><span class="linenos">1562</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">),</span> +</span><span id="L-1563"><a href="#L-1563"><span class="linenos">1563</span></a> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">(),</span> +</span><span id="L-1564"><a href="#L-1564"><span class="linenos">1564</span></a> <span class="p">)</span> +</span><span id="L-1565"><a href="#L-1565"><span class="linenos">1565</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1566"><a href="#L-1566"><span class="linenos">1566</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1567"><a href="#L-1567"><span class="linenos">1567</span></a> +</span><span id="L-1568"><a href="#L-1568"><span class="linenos">1568</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-1569"><a href="#L-1569"><span class="linenos">1569</span></a> +</span><span id="L-1570"><a href="#L-1570"><span class="linenos">1570</span></a> <span class="k">def</span> <span class="nf">_parse_with</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_with_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1571"><a href="#L-1571"><span class="linenos">1571</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_with_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">):</span> +</span><span id="L-1572"><a href="#L-1572"><span class="linenos">1572</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1573"><a href="#L-1573"><span class="linenos">1573</span></a> +</span><span id="L-1574"><a href="#L-1574"><span class="linenos">1574</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">RECURSIVE</span><span class="p">)</span> +</span><span id="L-1575"><a href="#L-1575"><span class="linenos">1575</span></a> +</span><span id="L-1576"><a href="#L-1576"><span class="linenos">1576</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-1577"><a href="#L-1577"><span class="linenos">1577</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1578"><a href="#L-1578"><span class="linenos">1578</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">())</span> +</span><span id="L-1579"><a href="#L-1579"><span class="linenos">1579</span></a> +</span><span id="L-1580"><a href="#L-1580"><span class="linenos">1580</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">):</span> +</span><span id="L-1581"><a href="#L-1581"><span class="linenos">1581</span></a> <span class="k">break</span> +</span><span id="L-1582"><a href="#L-1582"><span class="linenos">1582</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1583"><a href="#L-1583"><span class="linenos">1583</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> +</span><span id="L-1584"><a href="#L-1584"><span class="linenos">1584</span></a> +</span><span id="L-1585"><a href="#L-1585"><span class="linenos">1585</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">recursive</span><span class="o">=</span><span class="n">recursive</span><span class="p">)</span> +</span><span id="L-1586"><a href="#L-1586"><span class="linenos">1586</span></a> +</span><span id="L-1587"><a href="#L-1587"><span class="linenos">1587</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1588"><a href="#L-1588"><span class="linenos">1588</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> +</span><span id="L-1589"><a href="#L-1589"><span class="linenos">1589</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">alias</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">alias</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="L-1590"><a href="#L-1590"><span class="linenos">1590</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> +</span><span id="L-1591"><a href="#L-1591"><span class="linenos">1591</span></a> +</span><span id="L-1592"><a href="#L-1592"><span class="linenos">1592</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-1593"><a href="#L-1593"><span class="linenos">1593</span></a> +</span><span id="L-1594"><a href="#L-1594"><span class="linenos">1594</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1595"><a href="#L-1595"><span class="linenos">1595</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> +</span><span id="L-1596"><a href="#L-1596"><span class="linenos">1596</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">),</span> +</span><span id="L-1597"><a href="#L-1597"><span class="linenos">1597</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="L-1598"><a href="#L-1598"><span class="linenos">1598</span></a> <span class="p">)</span> +</span><span id="L-1599"><a href="#L-1599"><span class="linenos">1599</span></a> +</span><span id="L-1600"><a href="#L-1600"><span class="linenos">1600</span></a> <span class="k">def</span> <span class="nf">_parse_table_alias</span><span class="p">(</span> +</span><span id="L-1601"><a href="#L-1601"><span class="linenos">1601</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1602"><a href="#L-1602"><span class="linenos">1602</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1603"><a href="#L-1603"><span class="linenos">1603</span></a> <span class="n">any_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-1604"><a href="#L-1604"><span class="linenos">1604</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span> +</span><span id="L-1605"><a href="#L-1605"><span class="linenos">1605</span></a> <span class="n">any_token</span><span class="o">=</span><span class="n">any_token</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="n">alias_tokens</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span> +</span><span id="L-1606"><a href="#L-1606"><span class="linenos">1606</span></a> <span class="p">)</span> +</span><span id="L-1607"><a href="#L-1607"><span class="linenos">1607</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-1608"><a href="#L-1608"><span class="linenos">1608</span></a> +</span><span id="L-1609"><a href="#L-1609"><span class="linenos">1609</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-1610"><a href="#L-1610"><span class="linenos">1610</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()))</span> +</span><span id="L-1611"><a href="#L-1611"><span class="linenos">1611</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-1612"><a href="#L-1612"><span class="linenos">1612</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1613"><a href="#L-1613"><span class="linenos">1613</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1614"><a href="#L-1614"><span class="linenos">1614</span></a> +</span><span id="L-1615"><a href="#L-1615"><span class="linenos">1615</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">alias</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="L-1616"><a href="#L-1616"><span class="linenos">1616</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1617"><a href="#L-1617"><span class="linenos">1617</span></a> +</span><span id="L-1618"><a href="#L-1618"><span class="linenos">1618</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-1619"><a href="#L-1619"><span class="linenos">1619</span></a> +</span><span id="L-1620"><a href="#L-1620"><span class="linenos">1620</span></a> <span class="k">def</span> <span class="nf">_parse_subquery</span><span class="p">(</span> +</span><span id="L-1621"><a href="#L-1621"><span class="linenos">1621</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">parse_alias</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1622"><a href="#L-1622"><span class="linenos">1622</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1623"><a href="#L-1623"><span class="linenos">1623</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1624"><a href="#L-1624"><span class="linenos">1624</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">,</span> +</span><span id="L-1625"><a href="#L-1625"><span class="linenos">1625</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-1626"><a href="#L-1626"><span class="linenos">1626</span></a> <span class="n">pivots</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_pivots</span><span class="p">(),</span> +</span><span id="L-1627"><a href="#L-1627"><span class="linenos">1627</span></a> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> <span class="k">if</span> <span class="n">parse_alias</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-1628"><a href="#L-1628"><span class="linenos">1628</span></a> <span class="p">)</span> +</span><span id="L-1629"><a href="#L-1629"><span class="linenos">1629</span></a> +</span><span id="L-1630"><a href="#L-1630"><span class="linenos">1630</span></a> <span class="k">def</span> <span class="nf">_parse_query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1631"><a href="#L-1631"><span class="linenos">1631</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">MODIFIABLES</span><span class="p">):</span> +</span><span id="L-1632"><a href="#L-1632"><span class="linenos">1632</span></a> <span class="k">return</span> +</span><span id="L-1633"><a href="#L-1633"><span class="linenos">1633</span></a> +</span><span id="L-1634"><a href="#L-1634"><span class="linenos">1634</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="L-1635"><a href="#L-1635"><span class="linenos">1635</span></a> +</span><span id="L-1636"><a href="#L-1636"><span class="linenos">1636</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1637"><a href="#L-1637"><span class="linenos">1637</span></a> <span class="n">lateral</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lateral</span><span class="p">()</span> +</span><span id="L-1638"><a href="#L-1638"><span class="linenos">1638</span></a> <span class="n">join</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join</span><span class="p">()</span> +</span><span id="L-1639"><a href="#L-1639"><span class="linenos">1639</span></a> <span class="n">comma</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="L-1640"><a href="#L-1640"><span class="linenos">1640</span></a> <span class="k">if</span> <span class="n">lateral</span><span class="p">:</span> +</span><span id="L-1641"><a href="#L-1641"><span class="linenos">1641</span></a> <span class="n">this</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">,</span> <span class="n">lateral</span><span class="p">)</span> +</span><span id="L-1642"><a href="#L-1642"><span class="linenos">1642</span></a> <span class="k">if</span> <span class="n">join</span><span class="p">:</span> +</span><span id="L-1643"><a href="#L-1643"><span class="linenos">1643</span></a> <span class="n">this</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="n">join</span><span class="p">)</span> +</span><span id="L-1644"><a href="#L-1644"><span class="linenos">1644</span></a> <span class="k">if</span> <span class="n">comma</span><span class="p">:</span> +</span><span id="L-1645"><a href="#L-1645"><span class="linenos">1645</span></a> <span class="n">this</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"from"</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">())</span> +</span><span id="L-1646"><a href="#L-1646"><span class="linenos">1646</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">lateral</span> <span class="ow">or</span> <span class="n">join</span> <span class="ow">or</span> <span class="n">comma</span><span class="p">):</span> +</span><span id="L-1647"><a href="#L-1647"><span class="linenos">1647</span></a> <span class="k">break</span> +</span><span id="L-1648"><a href="#L-1648"><span class="linenos">1648</span></a> +</span><span id="L-1649"><a href="#L-1649"><span class="linenos">1649</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">parser</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">QUERY_MODIFIER_PARSERS</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-1650"><a href="#L-1650"><span class="linenos">1650</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-1651"><a href="#L-1651"><span class="linenos">1651</span></a> +</span><span id="L-1652"><a href="#L-1652"><span class="linenos">1652</span></a> <span class="k">if</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-1653"><a href="#L-1653"><span class="linenos">1653</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-1654"><a href="#L-1654"><span class="linenos">1654</span></a> +</span><span id="L-1655"><a href="#L-1655"><span class="linenos">1655</span></a> <span class="k">def</span> <span class="nf">_parse_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1656"><a href="#L-1656"><span class="linenos">1656</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">HINT</span><span class="p">):</span> +</span><span id="L-1657"><a href="#L-1657"><span class="linenos">1657</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">)</span> +</span><span id="L-1658"><a href="#L-1658"><span class="linenos">1658</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SLASH</span><span class="p">):</span> +</span><span id="L-1659"><a href="#L-1659"><span class="linenos">1659</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected */ after HINT"</span><span class="p">)</span> +</span><span id="L-1660"><a href="#L-1660"><span class="linenos">1660</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">hints</span><span class="p">)</span> +</span><span id="L-1661"><a href="#L-1661"><span class="linenos">1661</span></a> +</span><span id="L-1662"><a href="#L-1662"><span class="linenos">1662</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1663"><a href="#L-1663"><span class="linenos">1663</span></a> +</span><span id="L-1664"><a href="#L-1664"><span class="linenos">1664</span></a> <span class="k">def</span> <span class="nf">_parse_into</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1665"><a href="#L-1665"><span class="linenos">1665</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">):</span> +</span><span id="L-1666"><a href="#L-1666"><span class="linenos">1666</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1667"><a href="#L-1667"><span class="linenos">1667</span></a> +</span><span id="L-1668"><a href="#L-1668"><span class="linenos">1668</span></a> <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">)</span> +</span><span id="L-1669"><a href="#L-1669"><span class="linenos">1669</span></a> <span class="n">unlogged</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNLOGGED</span><span class="p">)</span> +</span><span id="L-1670"><a href="#L-1670"><span class="linenos">1670</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="L-1671"><a href="#L-1671"><span class="linenos">1671</span></a> +</span><span id="L-1672"><a href="#L-1672"><span class="linenos">1672</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1673"><a href="#L-1673"><span class="linenos">1673</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Into</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> <span class="n">temporary</span><span class="o">=</span><span class="n">temp</span><span class="p">,</span> <span class="n">unlogged</span><span class="o">=</span><span class="n">unlogged</span> +</span><span id="L-1674"><a href="#L-1674"><span class="linenos">1674</span></a> <span class="p">)</span> +</span><span id="L-1675"><a href="#L-1675"><span class="linenos">1675</span></a> +</span><span id="L-1676"><a href="#L-1676"><span class="linenos">1676</span></a> <span class="k">def</span> <span class="nf">_parse_from</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1677"><a href="#L-1677"><span class="linenos">1677</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">):</span> +</span><span id="L-1678"><a href="#L-1678"><span class="linenos">1678</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1679"><a href="#L-1679"><span class="linenos">1679</span></a> +</span><span id="L-1680"><a href="#L-1680"><span class="linenos">1680</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1681"><a href="#L-1681"><span class="linenos">1681</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">)</span> +</span><span id="L-1682"><a href="#L-1682"><span class="linenos">1682</span></a> <span class="p">)</span> +</span><span id="L-1683"><a href="#L-1683"><span class="linenos">1683</span></a> +</span><span id="L-1684"><a href="#L-1684"><span class="linenos">1684</span></a> <span class="k">def</span> <span class="nf">_parse_match_recognize</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1685"><a href="#L-1685"><span class="linenos">1685</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">):</span> +</span><span id="L-1686"><a href="#L-1686"><span class="linenos">1686</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1687"><a href="#L-1687"><span class="linenos">1687</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="L-1688"><a href="#L-1688"><span class="linenos">1688</span></a> +</span><span id="L-1689"><a href="#L-1689"><span class="linenos">1689</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition_by</span><span class="p">()</span> +</span><span id="L-1690"><a href="#L-1690"><span class="linenos">1690</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">()</span> +</span><span id="L-1691"><a href="#L-1691"><span class="linenos">1691</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1692"><a href="#L-1692"><span class="linenos">1692</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="L-1693"><a href="#L-1693"><span class="linenos">1693</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MEASURES"</span><span class="p">)</span> +</span><span id="L-1694"><a href="#L-1694"><span class="linenos">1694</span></a> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-1695"><a href="#L-1695"><span class="linenos">1695</span></a> <span class="p">)</span> +</span><span id="L-1696"><a href="#L-1696"><span class="linenos">1696</span></a> +</span><span id="L-1697"><a href="#L-1697"><span class="linenos">1697</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ONE"</span><span class="p">,</span> <span class="s2">"ROW"</span><span class="p">,</span> <span class="s2">"PER"</span><span class="p">,</span> <span class="s2">"MATCH"</span><span class="p">):</span> +</span><span id="L-1698"><a href="#L-1698"><span class="linenos">1698</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"ONE ROW PER MATCH"</span><span class="p">)</span> +</span><span id="L-1699"><a href="#L-1699"><span class="linenos">1699</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ALL"</span><span class="p">,</span> <span class="s2">"ROWS"</span><span class="p">,</span> <span class="s2">"PER"</span><span class="p">,</span> <span class="s2">"MATCH"</span><span class="p">):</span> +</span><span id="L-1700"><a href="#L-1700"><span class="linenos">1700</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">"ALL ROWS PER MATCH"</span> +</span><span id="L-1701"><a href="#L-1701"><span class="linenos">1701</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SHOW"</span><span class="p">,</span> <span class="s2">"EMPTY"</span><span class="p">,</span> <span class="s2">"MATCHES"</span><span class="p">):</span> +</span><span id="L-1702"><a href="#L-1702"><span class="linenos">1702</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" SHOW EMPTY MATCHES"</span> +</span><span id="L-1703"><a href="#L-1703"><span class="linenos">1703</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OMIT"</span><span class="p">,</span> <span class="s2">"EMPTY"</span><span class="p">,</span> <span class="s2">"MATCHES"</span><span class="p">):</span> +</span><span id="L-1704"><a href="#L-1704"><span class="linenos">1704</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" OMIT EMPTY MATCHES"</span> +</span><span id="L-1705"><a href="#L-1705"><span class="linenos">1705</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"UNMATCHED"</span><span class="p">,</span> <span class="s2">"ROWS"</span><span class="p">):</span> +</span><span id="L-1706"><a href="#L-1706"><span class="linenos">1706</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" WITH UNMATCHED ROWS"</span> +</span><span id="L-1707"><a href="#L-1707"><span class="linenos">1707</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-1708"><a href="#L-1708"><span class="linenos">1708</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1709"><a href="#L-1709"><span class="linenos">1709</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1710"><a href="#L-1710"><span class="linenos">1710</span></a> +</span><span id="L-1711"><a href="#L-1711"><span class="linenos">1711</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AFTER"</span><span class="p">,</span> <span class="s2">"MATCH"</span><span class="p">,</span> <span class="s2">"SKIP"</span><span class="p">):</span> +</span><span id="L-1712"><a href="#L-1712"><span class="linenos">1712</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">"AFTER MATCH SKIP"</span> +</span><span id="L-1713"><a href="#L-1713"><span class="linenos">1713</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PAST"</span><span class="p">,</span> <span class="s2">"LAST"</span><span class="p">,</span> <span class="s2">"ROW"</span><span class="p">):</span> +</span><span id="L-1714"><a href="#L-1714"><span class="linenos">1714</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" PAST LAST ROW"</span> +</span><span id="L-1715"><a href="#L-1715"><span class="linenos">1715</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"NEXT"</span><span class="p">,</span> <span class="s2">"ROW"</span><span class="p">):</span> +</span><span id="L-1716"><a href="#L-1716"><span class="linenos">1716</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" TO NEXT ROW"</span> +</span><span id="L-1717"><a href="#L-1717"><span class="linenos">1717</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"FIRST"</span><span class="p">):</span> +</span><span id="L-1718"><a href="#L-1718"><span class="linenos">1718</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" TO FIRST </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">()</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">"</span> <span class="c1"># type: ignore</span> +</span><span id="L-1719"><a href="#L-1719"><span class="linenos">1719</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"LAST"</span><span class="p">):</span> +</span><span id="L-1720"><a href="#L-1720"><span class="linenos">1720</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" TO LAST </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">()</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">"</span> <span class="c1"># type: ignore</span> +</span><span id="L-1721"><a href="#L-1721"><span class="linenos">1721</span></a> <span class="n">after</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-1722"><a href="#L-1722"><span class="linenos">1722</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1723"><a href="#L-1723"><span class="linenos">1723</span></a> <span class="n">after</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1724"><a href="#L-1724"><span class="linenos">1724</span></a> +</span><span id="L-1725"><a href="#L-1725"><span class="linenos">1725</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PATTERN"</span><span class="p">):</span> +</span><span id="L-1726"><a href="#L-1726"><span class="linenos">1726</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="L-1727"><a href="#L-1727"><span class="linenos">1727</span></a> +</span><span id="L-1728"><a href="#L-1728"><span class="linenos">1728</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="L-1729"><a href="#L-1729"><span class="linenos">1729</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting )"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">)</span> +</span><span id="L-1730"><a href="#L-1730"><span class="linenos">1730</span></a> +</span><span id="L-1731"><a href="#L-1731"><span class="linenos">1731</span></a> <span class="n">paren</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-1732"><a href="#L-1732"><span class="linenos">1732</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> +</span><span id="L-1733"><a href="#L-1733"><span class="linenos">1733</span></a> +</span><span id="L-1734"><a href="#L-1734"><span class="linenos">1734</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="n">paren</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-1735"><a href="#L-1735"><span class="linenos">1735</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">:</span> +</span><span id="L-1736"><a href="#L-1736"><span class="linenos">1736</span></a> <span class="n">paren</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-1737"><a href="#L-1737"><span class="linenos">1737</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">:</span> +</span><span id="L-1738"><a href="#L-1738"><span class="linenos">1738</span></a> <span class="n">paren</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="L-1739"><a href="#L-1739"><span class="linenos">1739</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="L-1740"><a href="#L-1740"><span class="linenos">1740</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-1741"><a href="#L-1741"><span class="linenos">1741</span></a> <span class="k">if</span> <span class="n">paren</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-1742"><a href="#L-1742"><span class="linenos">1742</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting )"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">)</span> +</span><span id="L-1743"><a href="#L-1743"><span class="linenos">1743</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_find_sql</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">))</span> +</span><span id="L-1744"><a href="#L-1744"><span class="linenos">1744</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1745"><a href="#L-1745"><span class="linenos">1745</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1746"><a href="#L-1746"><span class="linenos">1746</span></a> +</span><span id="L-1747"><a href="#L-1747"><span class="linenos">1747</span></a> <span class="n">define</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-1748"><a href="#L-1748"><span class="linenos">1748</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFINE"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-1749"><a href="#L-1749"><span class="linenos">1749</span></a> <span class="p">)</span> +</span><span id="L-1750"><a href="#L-1750"><span class="linenos">1750</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-1751"><a href="#L-1751"><span class="linenos">1751</span></a> +</span><span id="L-1752"><a href="#L-1752"><span class="linenos">1752</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1753"><a href="#L-1753"><span class="linenos">1753</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">,</span> +</span><span id="L-1754"><a href="#L-1754"><span class="linenos">1754</span></a> <span class="n">partition_by</span><span class="o">=</span><span class="n">partition</span><span class="p">,</span> +</span><span id="L-1755"><a href="#L-1755"><span class="linenos">1755</span></a> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> +</span><span id="L-1756"><a href="#L-1756"><span class="linenos">1756</span></a> <span class="n">measures</span><span class="o">=</span><span class="n">measures</span><span class="p">,</span> +</span><span id="L-1757"><a href="#L-1757"><span class="linenos">1757</span></a> <span class="n">rows</span><span class="o">=</span><span class="n">rows</span><span class="p">,</span> +</span><span id="L-1758"><a href="#L-1758"><span class="linenos">1758</span></a> <span class="n">after</span><span class="o">=</span><span class="n">after</span><span class="p">,</span> +</span><span id="L-1759"><a href="#L-1759"><span class="linenos">1759</span></a> <span class="n">pattern</span><span class="o">=</span><span class="n">pattern</span><span class="p">,</span> +</span><span id="L-1760"><a href="#L-1760"><span class="linenos">1760</span></a> <span class="n">define</span><span class="o">=</span><span class="n">define</span><span class="p">,</span> +</span><span id="L-1761"><a href="#L-1761"><span class="linenos">1761</span></a> <span class="p">)</span> +</span><span id="L-1762"><a href="#L-1762"><span class="linenos">1762</span></a> +</span><span id="L-1763"><a href="#L-1763"><span class="linenos">1763</span></a> <span class="k">def</span> <span class="nf">_parse_lateral</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1764"><a href="#L-1764"><span class="linenos">1764</span></a> <span class="n">outer_apply</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">)</span> +</span><span id="L-1765"><a href="#L-1765"><span class="linenos">1765</span></a> <span class="n">cross_apply</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CROSS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">)</span> +</span><span id="L-1766"><a href="#L-1766"><span class="linenos">1766</span></a> +</span><span id="L-1767"><a href="#L-1767"><span class="linenos">1767</span></a> <span class="k">if</span> <span class="n">outer_apply</span> <span class="ow">or</span> <span class="n">cross_apply</span><span class="p">:</span> +</span><span id="L-1768"><a href="#L-1768"><span class="linenos">1768</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1769"><a href="#L-1769"><span class="linenos">1769</span></a> <span class="n">view</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1770"><a href="#L-1770"><span class="linenos">1770</span></a> <span class="n">outer</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">cross_apply</span> +</span><span id="L-1771"><a href="#L-1771"><span class="linenos">1771</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LATERAL</span><span class="p">):</span> +</span><span id="L-1772"><a href="#L-1772"><span class="linenos">1772</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1773"><a href="#L-1773"><span class="linenos">1773</span></a> <span class="n">view</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">)</span> +</span><span id="L-1774"><a href="#L-1774"><span class="linenos">1774</span></a> <span class="n">outer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">)</span> +</span><span id="L-1775"><a href="#L-1775"><span class="linenos">1775</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1776"><a href="#L-1776"><span class="linenos">1776</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1777"><a href="#L-1777"><span class="linenos">1777</span></a> +</span><span id="L-1778"><a href="#L-1778"><span class="linenos">1778</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="L-1779"><a href="#L-1779"><span class="linenos">1779</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1780"><a href="#L-1780"><span class="linenos">1780</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="L-1781"><a href="#L-1781"><span class="linenos">1781</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">(</span> +</span><span id="L-1782"><a href="#L-1782"><span class="linenos">1782</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-1783"><a href="#L-1783"><span class="linenos">1783</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="L-1784"><a href="#L-1784"><span class="linenos">1784</span></a> <span class="p">)</span> +</span><span id="L-1785"><a href="#L-1785"><span class="linenos">1785</span></a> +</span><span id="L-1786"><a href="#L-1786"><span class="linenos">1786</span></a> <span class="n">table_alias</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-1787"><a href="#L-1787"><span class="linenos">1787</span></a> +</span><span id="L-1788"><a href="#L-1788"><span class="linenos">1788</span></a> <span class="k">if</span> <span class="n">view</span><span class="p">:</span> +</span><span id="L-1789"><a href="#L-1789"><span class="linenos">1789</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1790"><a href="#L-1790"><span class="linenos">1790</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> <span class="k">else</span> <span class="p">[]</span> +</span><span id="L-1791"><a href="#L-1791"><span class="linenos">1791</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">)</span> +</span><span id="L-1792"><a href="#L-1792"><span class="linenos">1792</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1793"><a href="#L-1793"><span class="linenos">1793</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> +</span><span id="L-1794"><a href="#L-1794"><span class="linenos">1794</span></a> +</span><span id="L-1795"><a href="#L-1795"><span class="linenos">1795</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1796"><a href="#L-1796"><span class="linenos">1796</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">,</span> +</span><span id="L-1797"><a href="#L-1797"><span class="linenos">1797</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-1798"><a href="#L-1798"><span class="linenos">1798</span></a> <span class="n">view</span><span class="o">=</span><span class="n">view</span><span class="p">,</span> +</span><span id="L-1799"><a href="#L-1799"><span class="linenos">1799</span></a> <span class="n">outer</span><span class="o">=</span><span class="n">outer</span><span class="p">,</span> +</span><span id="L-1800"><a href="#L-1800"><span class="linenos">1800</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">table_alias</span><span class="p">,</span> +</span><span id="L-1801"><a href="#L-1801"><span class="linenos">1801</span></a> <span class="p">)</span> +</span><span id="L-1802"><a href="#L-1802"><span class="linenos">1802</span></a> +</span><span id="L-1803"><a href="#L-1803"><span class="linenos">1803</span></a> <span class="k">if</span> <span class="n">outer_apply</span> <span class="ow">or</span> <span class="n">cross_apply</span><span class="p">:</span> +</span><span id="L-1804"><a href="#L-1804"><span class="linenos">1804</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">side</span><span class="o">=</span><span class="kc">None</span> <span class="k">if</span> <span class="n">cross_apply</span> <span class="k">else</span> <span class="s2">"LEFT"</span><span class="p">)</span> +</span><span id="L-1805"><a href="#L-1805"><span class="linenos">1805</span></a> +</span><span id="L-1806"><a href="#L-1806"><span class="linenos">1806</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-1807"><a href="#L-1807"><span class="linenos">1807</span></a> +</span><span id="L-1808"><a href="#L-1808"><span class="linenos">1808</span></a> <span class="k">def</span> <span class="nf">_parse_join_side_and_kind</span><span class="p">(</span> +</span><span id="L-1809"><a href="#L-1809"><span class="linenos">1809</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-1810"><a href="#L-1810"><span class="linenos">1810</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]]:</span> +</span><span id="L-1811"><a href="#L-1811"><span class="linenos">1811</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="L-1812"><a href="#L-1812"><span class="linenos">1812</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">,</span> +</span><span id="L-1813"><a href="#L-1813"><span class="linenos">1813</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">JOIN_SIDES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">,</span> +</span><span id="L-1814"><a href="#L-1814"><span class="linenos">1814</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">JOIN_KINDS</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">,</span> +</span><span id="L-1815"><a href="#L-1815"><span class="linenos">1815</span></a> <span class="p">)</span> +</span><span id="L-1816"><a href="#L-1816"><span class="linenos">1816</span></a> +</span><span id="L-1817"><a href="#L-1817"><span class="linenos">1817</span></a> <span class="k">def</span> <span class="nf">_parse_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_join_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1818"><a href="#L-1818"><span class="linenos">1818</span></a> <span class="n">natural</span><span class="p">,</span> <span class="n">side</span><span class="p">,</span> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_side_and_kind</span><span class="p">()</span> +</span><span id="L-1819"><a href="#L-1819"><span class="linenos">1819</span></a> +</span><span id="L-1820"><a href="#L-1820"><span class="linenos">1820</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_join_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">JOIN</span><span class="p">):</span> +</span><span id="L-1821"><a href="#L-1821"><span class="linenos">1821</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1822"><a href="#L-1822"><span class="linenos">1822</span></a> +</span><span id="L-1823"><a href="#L-1823"><span class="linenos">1823</span></a> <span class="n">kwargs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span> +</span><span id="L-1824"><a href="#L-1824"><span class="linenos">1824</span></a> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">|</span> <span class="nb">bool</span> <span class="o">|</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> +</span><span id="L-1825"><a href="#L-1825"><span class="linenos">1825</span></a> <span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()}</span> +</span><span id="L-1826"><a href="#L-1826"><span class="linenos">1826</span></a> +</span><span id="L-1827"><a href="#L-1827"><span class="linenos">1827</span></a> <span class="k">if</span> <span class="n">natural</span><span class="p">:</span> +</span><span id="L-1828"><a href="#L-1828"><span class="linenos">1828</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"natural"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-1829"><a href="#L-1829"><span class="linenos">1829</span></a> <span class="k">if</span> <span class="n">side</span><span class="p">:</span> +</span><span id="L-1830"><a href="#L-1830"><span class="linenos">1830</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"side"</span><span class="p">]</span> <span class="o">=</span> <span class="n">side</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-1831"><a href="#L-1831"><span class="linenos">1831</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="L-1832"><a href="#L-1832"><span class="linenos">1832</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> <span class="o">=</span> <span class="n">kind</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-1833"><a href="#L-1833"><span class="linenos">1833</span></a> +</span><span id="L-1834"><a href="#L-1834"><span class="linenos">1834</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="L-1835"><a href="#L-1835"><span class="linenos">1835</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"on"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-1836"><a href="#L-1836"><span class="linenos">1836</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="L-1837"><a href="#L-1837"><span class="linenos">1837</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"using"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="L-1838"><a href="#L-1838"><span class="linenos">1838</span></a> +</span><span id="L-1839"><a href="#L-1839"><span class="linenos">1839</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-1840"><a href="#L-1840"><span class="linenos">1840</span></a> +</span><span id="L-1841"><a href="#L-1841"><span class="linenos">1841</span></a> <span class="k">def</span> <span class="nf">_parse_index</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1842"><a href="#L-1842"><span class="linenos">1842</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-1843"><a href="#L-1843"><span class="linenos">1843</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> +</span><span id="L-1844"><a href="#L-1844"><span class="linenos">1844</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> <span class="c1"># hive</span> +</span><span id="L-1845"><a href="#L-1845"><span class="linenos">1845</span></a> +</span><span id="L-1846"><a href="#L-1846"><span class="linenos">1846</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1847"><a href="#L-1847"><span class="linenos">1847</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">,</span> +</span><span id="L-1848"><a href="#L-1848"><span class="linenos">1848</span></a> <span class="n">this</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> +</span><span id="L-1849"><a href="#L-1849"><span class="linenos">1849</span></a> <span class="n">table</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()),</span> +</span><span id="L-1850"><a href="#L-1850"><span class="linenos">1850</span></a> <span class="n">columns</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">(),</span> +</span><span id="L-1851"><a href="#L-1851"><span class="linenos">1851</span></a> <span class="p">)</span> +</span><span id="L-1852"><a href="#L-1852"><span class="linenos">1852</span></a> +</span><span id="L-1853"><a href="#L-1853"><span class="linenos">1853</span></a> <span class="k">def</span> <span class="nf">_parse_create_table_index</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1854"><a href="#L-1854"><span class="linenos">1854</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">)</span> +</span><span id="L-1855"><a href="#L-1855"><span class="linenos">1855</span></a> <span class="n">primary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PRIMARY"</span><span class="p">)</span> +</span><span id="L-1856"><a href="#L-1856"><span class="linenos">1856</span></a> <span class="n">amp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AMP"</span><span class="p">)</span> +</span><span id="L-1857"><a href="#L-1857"><span class="linenos">1857</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">):</span> +</span><span id="L-1858"><a href="#L-1858"><span class="linenos">1858</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1859"><a href="#L-1859"><span class="linenos">1859</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-1860"><a href="#L-1860"><span class="linenos">1860</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1861"><a href="#L-1861"><span class="linenos">1861</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-1862"><a href="#L-1862"><span class="linenos">1862</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-1863"><a href="#L-1863"><span class="linenos">1863</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1864"><a href="#L-1864"><span class="linenos">1864</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">,</span> +</span><span id="L-1865"><a href="#L-1865"><span class="linenos">1865</span></a> <span class="n">this</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> +</span><span id="L-1866"><a href="#L-1866"><span class="linenos">1866</span></a> <span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">,</span> +</span><span id="L-1867"><a href="#L-1867"><span class="linenos">1867</span></a> <span class="n">unique</span><span class="o">=</span><span class="n">unique</span><span class="p">,</span> +</span><span id="L-1868"><a href="#L-1868"><span class="linenos">1868</span></a> <span class="n">primary</span><span class="o">=</span><span class="n">primary</span><span class="p">,</span> +</span><span id="L-1869"><a href="#L-1869"><span class="linenos">1869</span></a> <span class="n">amp</span><span class="o">=</span><span class="n">amp</span><span class="p">,</span> +</span><span id="L-1870"><a href="#L-1870"><span class="linenos">1870</span></a> <span class="p">)</span> +</span><span id="L-1871"><a href="#L-1871"><span class="linenos">1871</span></a> +</span><span id="L-1872"><a href="#L-1872"><span class="linenos">1872</span></a> <span class="k">def</span> <span class="nf">_parse_table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-1873"><a href="#L-1873"><span class="linenos">1873</span></a> <span class="n">catalog</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1874"><a href="#L-1874"><span class="linenos">1874</span></a> <span class="n">db</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1875"><a href="#L-1875"><span class="linenos">1875</span></a> <span class="n">table</span> <span class="o">=</span> <span class="p">(</span><span class="ow">not</span> <span class="n">schema</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">())</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-1876"><a href="#L-1876"><span class="linenos">1876</span></a> +</span><span id="L-1877"><a href="#L-1877"><span class="linenos">1877</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="L-1878"><a href="#L-1878"><span class="linenos">1878</span></a> <span class="k">if</span> <span class="n">catalog</span><span class="p">:</span> +</span><span id="L-1879"><a href="#L-1879"><span class="linenos">1879</span></a> <span class="c1"># This allows nesting the table in arbitrarily many dot expressions if needed</span> +</span><span id="L-1880"><a href="#L-1880"><span class="linenos">1880</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">())</span> +</span><span id="L-1881"><a href="#L-1881"><span class="linenos">1881</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1882"><a href="#L-1882"><span class="linenos">1882</span></a> <span class="n">catalog</span> <span class="o">=</span> <span class="n">db</span> +</span><span id="L-1883"><a href="#L-1883"><span class="linenos">1883</span></a> <span class="n">db</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-1884"><a href="#L-1884"><span class="linenos">1884</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-1885"><a href="#L-1885"><span class="linenos">1885</span></a> +</span><span id="L-1886"><a href="#L-1886"><span class="linenos">1886</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table</span><span class="p">:</span> +</span><span id="L-1887"><a href="#L-1887"><span class="linenos">1887</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected table name but got </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1888"><a href="#L-1888"><span class="linenos">1888</span></a> +</span><span id="L-1889"><a href="#L-1889"><span class="linenos">1889</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1890"><a href="#L-1890"><span class="linenos">1890</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="n">catalog</span><span class="p">,</span> <span class="n">pivots</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_pivots</span><span class="p">()</span> +</span><span id="L-1891"><a href="#L-1891"><span class="linenos">1891</span></a> <span class="p">)</span> +</span><span id="L-1892"><a href="#L-1892"><span class="linenos">1892</span></a> +</span><span id="L-1893"><a href="#L-1893"><span class="linenos">1893</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="L-1894"><a href="#L-1894"><span class="linenos">1894</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1895"><a href="#L-1895"><span class="linenos">1895</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1896"><a href="#L-1896"><span class="linenos">1896</span></a> <span class="n">lateral</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lateral</span><span class="p">()</span> +</span><span id="L-1897"><a href="#L-1897"><span class="linenos">1897</span></a> +</span><span id="L-1898"><a href="#L-1898"><span class="linenos">1898</span></a> <span class="k">if</span> <span class="n">lateral</span><span class="p">:</span> +</span><span id="L-1899"><a href="#L-1899"><span class="linenos">1899</span></a> <span class="k">return</span> <span class="n">lateral</span> +</span><span id="L-1900"><a href="#L-1900"><span class="linenos">1900</span></a> +</span><span id="L-1901"><a href="#L-1901"><span class="linenos">1901</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnest</span><span class="p">()</span> +</span><span id="L-1902"><a href="#L-1902"><span class="linenos">1902</span></a> +</span><span id="L-1903"><a href="#L-1903"><span class="linenos">1903</span></a> <span class="k">if</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="L-1904"><a href="#L-1904"><span class="linenos">1904</span></a> <span class="k">return</span> <span class="n">unnest</span> +</span><span id="L-1905"><a href="#L-1905"><span class="linenos">1905</span></a> +</span><span id="L-1906"><a href="#L-1906"><span class="linenos">1906</span></a> <span class="n">values</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_derived_table_values</span><span class="p">()</span> +</span><span id="L-1907"><a href="#L-1907"><span class="linenos">1907</span></a> +</span><span id="L-1908"><a href="#L-1908"><span class="linenos">1908</span></a> <span class="k">if</span> <span class="n">values</span><span class="p">:</span> +</span><span id="L-1909"><a href="#L-1909"><span class="linenos">1909</span></a> <span class="k">return</span> <span class="n">values</span> +</span><span id="L-1910"><a href="#L-1910"><span class="linenos">1910</span></a> +</span><span id="L-1911"><a href="#L-1911"><span class="linenos">1911</span></a> <span class="n">subquery</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-1912"><a href="#L-1912"><span class="linenos">1912</span></a> +</span><span id="L-1913"><a href="#L-1913"><span class="linenos">1913</span></a> <span class="k">if</span> <span class="n">subquery</span><span class="p">:</span> +</span><span id="L-1914"><a href="#L-1914"><span class="linenos">1914</span></a> <span class="k">return</span> <span class="n">subquery</span> +</span><span id="L-1915"><a href="#L-1915"><span class="linenos">1915</span></a> +</span><span id="L-1916"><a href="#L-1916"><span class="linenos">1916</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-1917"><a href="#L-1917"><span class="linenos">1917</span></a> +</span><span id="L-1918"><a href="#L-1918"><span class="linenos">1918</span></a> <span class="k">if</span> <span class="n">schema</span><span class="p">:</span> +</span><span id="L-1919"><a href="#L-1919"><span class="linenos">1919</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-1920"><a href="#L-1920"><span class="linenos">1920</span></a> +</span><span id="L-1921"><a href="#L-1921"><span class="linenos">1921</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">:</span> +</span><span id="L-1922"><a href="#L-1922"><span class="linenos">1922</span></a> <span class="n">table_sample</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_sample</span><span class="p">()</span> +</span><span id="L-1923"><a href="#L-1923"><span class="linenos">1923</span></a> +</span><span id="L-1924"><a href="#L-1924"><span class="linenos">1924</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span><span class="p">)</span> +</span><span id="L-1925"><a href="#L-1925"><span class="linenos">1925</span></a> +</span><span id="L-1926"><a href="#L-1926"><span class="linenos">1926</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-1927"><a href="#L-1927"><span class="linenos">1927</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="L-1928"><a href="#L-1928"><span class="linenos">1928</span></a> +</span><span id="L-1929"><a href="#L-1929"><span class="linenos">1929</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-1930"><a href="#L-1930"><span class="linenos">1930</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="L-1931"><a href="#L-1931"><span class="linenos">1931</span></a> <span class="s2">"hints"</span><span class="p">,</span> +</span><span id="L-1932"><a href="#L-1932"><span class="linenos">1932</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">)),</span> +</span><span id="L-1933"><a href="#L-1933"><span class="linenos">1933</span></a> <span class="p">)</span> +</span><span id="L-1934"><a href="#L-1934"><span class="linenos">1934</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-1935"><a href="#L-1935"><span class="linenos">1935</span></a> +</span><span id="L-1936"><a href="#L-1936"><span class="linenos">1936</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">:</span> +</span><span id="L-1937"><a href="#L-1937"><span class="linenos">1937</span></a> <span class="n">table_sample</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_sample</span><span class="p">()</span> +</span><span id="L-1938"><a href="#L-1938"><span class="linenos">1938</span></a> +</span><span id="L-1939"><a href="#L-1939"><span class="linenos">1939</span></a> <span class="k">if</span> <span class="n">table_sample</span><span class="p">:</span> +</span><span id="L-1940"><a href="#L-1940"><span class="linenos">1940</span></a> <span class="n">table_sample</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">this</span><span class="p">)</span> +</span><span id="L-1941"><a href="#L-1941"><span class="linenos">1941</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">table_sample</span> +</span><span id="L-1942"><a href="#L-1942"><span class="linenos">1942</span></a> +</span><span id="L-1943"><a href="#L-1943"><span class="linenos">1943</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-1944"><a href="#L-1944"><span class="linenos">1944</span></a> +</span><span id="L-1945"><a href="#L-1945"><span class="linenos">1945</span></a> <span class="k">def</span> <span class="nf">_parse_unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1946"><a href="#L-1946"><span class="linenos">1946</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNNEST</span><span class="p">):</span> +</span><span id="L-1947"><a href="#L-1947"><span class="linenos">1947</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1948"><a href="#L-1948"><span class="linenos">1948</span></a> +</span><span id="L-1949"><a href="#L-1949"><span class="linenos">1949</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-1950"><a href="#L-1950"><span class="linenos">1950</span></a> <span class="n">ordinality</span> <span class="o">=</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ORDINALITY</span><span class="p">))</span> +</span><span id="L-1951"><a href="#L-1951"><span class="linenos">1951</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> +</span><span id="L-1952"><a href="#L-1952"><span class="linenos">1952</span></a> +</span><span id="L-1953"><a href="#L-1953"><span class="linenos">1953</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">:</span> +</span><span id="L-1954"><a href="#L-1954"><span class="linenos">1954</span></a> <span class="k">if</span> <span class="n">alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">):</span> +</span><span id="L-1955"><a href="#L-1955"><span class="linenos">1955</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Unexpected extra column alias in unnest."</span><span class="p">)</span> +</span><span id="L-1956"><a href="#L-1956"><span class="linenos">1956</span></a> <span class="n">alias</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="p">[</span><span class="n">alias</span><span class="o">.</span><span class="n">this</span><span class="p">])</span> +</span><span id="L-1957"><a href="#L-1957"><span class="linenos">1957</span></a> <span class="n">alias</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="L-1958"><a href="#L-1958"><span class="linenos">1958</span></a> +</span><span id="L-1959"><a href="#L-1959"><span class="linenos">1959</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1960"><a href="#L-1960"><span class="linenos">1960</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">):</span> +</span><span id="L-1961"><a href="#L-1961"><span class="linenos">1961</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-1962"><a href="#L-1962"><span class="linenos">1962</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-1963"><a href="#L-1963"><span class="linenos">1963</span></a> +</span><span id="L-1964"><a href="#L-1964"><span class="linenos">1964</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-1965"><a href="#L-1965"><span class="linenos">1965</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">,</span> +</span><span id="L-1966"><a href="#L-1966"><span class="linenos">1966</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-1967"><a href="#L-1967"><span class="linenos">1967</span></a> <span class="n">ordinality</span><span class="o">=</span><span class="n">ordinality</span><span class="p">,</span> +</span><span id="L-1968"><a href="#L-1968"><span class="linenos">1968</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="L-1969"><a href="#L-1969"><span class="linenos">1969</span></a> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> +</span><span id="L-1970"><a href="#L-1970"><span class="linenos">1970</span></a> <span class="p">)</span> +</span><span id="L-1971"><a href="#L-1971"><span class="linenos">1971</span></a> +</span><span id="L-1972"><a href="#L-1972"><span class="linenos">1972</span></a> <span class="k">def</span> <span class="nf">_parse_derived_table_values</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1973"><a href="#L-1973"><span class="linenos">1973</span></a> <span class="n">is_derived</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">)</span> +</span><span id="L-1974"><a href="#L-1974"><span class="linenos">1974</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">is_derived</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">):</span> +</span><span id="L-1975"><a href="#L-1975"><span class="linenos">1975</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1976"><a href="#L-1976"><span class="linenos">1976</span></a> +</span><span id="L-1977"><a href="#L-1977"><span class="linenos">1977</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">)</span> +</span><span id="L-1978"><a href="#L-1978"><span class="linenos">1978</span></a> +</span><span id="L-1979"><a href="#L-1979"><span class="linenos">1979</span></a> <span class="k">if</span> <span class="n">is_derived</span><span class="p">:</span> +</span><span id="L-1980"><a href="#L-1980"><span class="linenos">1980</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-1981"><a href="#L-1981"><span class="linenos">1981</span></a> +</span><span id="L-1982"><a href="#L-1982"><span class="linenos">1982</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">())</span> +</span><span id="L-1983"><a href="#L-1983"><span class="linenos">1983</span></a> +</span><span id="L-1984"><a href="#L-1984"><span class="linenos">1984</span></a> <span class="k">def</span> <span class="nf">_parse_table_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-1985"><a href="#L-1985"><span class="linenos">1985</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">):</span> +</span><span id="L-1986"><a href="#L-1986"><span class="linenos">1986</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-1987"><a href="#L-1987"><span class="linenos">1987</span></a> +</span><span id="L-1988"><a href="#L-1988"><span class="linenos">1988</span></a> <span class="n">method</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> +</span><span id="L-1989"><a href="#L-1989"><span class="linenos">1989</span></a> <span class="n">bucket_numerator</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1990"><a href="#L-1990"><span class="linenos">1990</span></a> <span class="n">bucket_denominator</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1991"><a href="#L-1991"><span class="linenos">1991</span></a> <span class="n">bucket_field</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1992"><a href="#L-1992"><span class="linenos">1992</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1993"><a href="#L-1993"><span class="linenos">1993</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1994"><a href="#L-1994"><span class="linenos">1994</span></a> <span class="n">size</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1995"><a href="#L-1995"><span class="linenos">1995</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1996"><a href="#L-1996"><span class="linenos">1996</span></a> +</span><span id="L-1997"><a href="#L-1997"><span class="linenos">1997</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="L-1998"><a href="#L-1998"><span class="linenos">1998</span></a> +</span><span id="L-1999"><a href="#L-1999"><span class="linenos">1999</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BUCKET</span><span class="p">):</span> +</span><span id="L-2000"><a href="#L-2000"><span class="linenos">2000</span></a> <span class="n">bucket_numerator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-2001"><a href="#L-2001"><span class="linenos">2001</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OUT_OF</span><span class="p">)</span> +</span><span id="L-2002"><a href="#L-2002"><span class="linenos">2002</span></a> <span class="n">bucket_denominator</span> <span class="o">=</span> <span class="n">bucket_denominator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-2003"><a href="#L-2003"><span class="linenos">2003</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> +</span><span id="L-2004"><a href="#L-2004"><span class="linenos">2004</span></a> <span class="n">bucket_field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">()</span> +</span><span id="L-2005"><a href="#L-2005"><span class="linenos">2005</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2006"><a href="#L-2006"><span class="linenos">2006</span></a> <span class="n">num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-2007"><a href="#L-2007"><span class="linenos">2007</span></a> +</span><span id="L-2008"><a href="#L-2008"><span class="linenos">2008</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">):</span> +</span><span id="L-2009"><a href="#L-2009"><span class="linenos">2009</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="n">num</span> +</span><span id="L-2010"><a href="#L-2010"><span class="linenos">2010</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">):</span> +</span><span id="L-2011"><a href="#L-2011"><span class="linenos">2011</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="n">num</span> +</span><span id="L-2012"><a href="#L-2012"><span class="linenos">2012</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2013"><a href="#L-2013"><span class="linenos">2013</span></a> <span class="n">size</span> <span class="o">=</span> <span class="n">num</span> +</span><span id="L-2014"><a href="#L-2014"><span class="linenos">2014</span></a> +</span><span id="L-2015"><a href="#L-2015"><span class="linenos">2015</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2016"><a href="#L-2016"><span class="linenos">2016</span></a> +</span><span id="L-2017"><a href="#L-2017"><span class="linenos">2017</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEED</span><span class="p">):</span> +</span><span id="L-2018"><a href="#L-2018"><span class="linenos">2018</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">)</span> +</span><span id="L-2019"><a href="#L-2019"><span class="linenos">2019</span></a> +</span><span id="L-2020"><a href="#L-2020"><span class="linenos">2020</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2021"><a href="#L-2021"><span class="linenos">2021</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">,</span> +</span><span id="L-2022"><a href="#L-2022"><span class="linenos">2022</span></a> <span class="n">method</span><span class="o">=</span><span class="n">method</span><span class="p">,</span> +</span><span id="L-2023"><a href="#L-2023"><span class="linenos">2023</span></a> <span class="n">bucket_numerator</span><span class="o">=</span><span class="n">bucket_numerator</span><span class="p">,</span> +</span><span id="L-2024"><a href="#L-2024"><span class="linenos">2024</span></a> <span class="n">bucket_denominator</span><span class="o">=</span><span class="n">bucket_denominator</span><span class="p">,</span> +</span><span id="L-2025"><a href="#L-2025"><span class="linenos">2025</span></a> <span class="n">bucket_field</span><span class="o">=</span><span class="n">bucket_field</span><span class="p">,</span> +</span><span id="L-2026"><a href="#L-2026"><span class="linenos">2026</span></a> <span class="n">percent</span><span class="o">=</span><span class="n">percent</span><span class="p">,</span> +</span><span id="L-2027"><a href="#L-2027"><span class="linenos">2027</span></a> <span class="n">rows</span><span class="o">=</span><span class="n">rows</span><span class="p">,</span> +</span><span id="L-2028"><a href="#L-2028"><span class="linenos">2028</span></a> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span> +</span><span id="L-2029"><a href="#L-2029"><span class="linenos">2029</span></a> <span class="n">seed</span><span class="o">=</span><span class="n">seed</span><span class="p">,</span> +</span><span id="L-2030"><a href="#L-2030"><span class="linenos">2030</span></a> <span class="p">)</span> +</span><span id="L-2031"><a href="#L-2031"><span class="linenos">2031</span></a> +</span><span id="L-2032"><a href="#L-2032"><span class="linenos">2032</span></a> <span class="k">def</span> <span class="nf">_parse_pivots</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-2033"><a href="#L-2033"><span class="linenos">2033</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_pivot</span><span class="p">,</span> <span class="kc">None</span><span class="p">))</span> +</span><span id="L-2034"><a href="#L-2034"><span class="linenos">2034</span></a> +</span><span id="L-2035"><a href="#L-2035"><span class="linenos">2035</span></a> <span class="k">def</span> <span class="nf">_parse_pivot</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2036"><a href="#L-2036"><span class="linenos">2036</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-2037"><a href="#L-2037"><span class="linenos">2037</span></a> +</span><span id="L-2038"><a href="#L-2038"><span class="linenos">2038</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PIVOT</span><span class="p">):</span> +</span><span id="L-2039"><a href="#L-2039"><span class="linenos">2039</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-2040"><a href="#L-2040"><span class="linenos">2040</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNPIVOT</span><span class="p">):</span> +</span><span id="L-2041"><a href="#L-2041"><span class="linenos">2041</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-2042"><a href="#L-2042"><span class="linenos">2042</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2043"><a href="#L-2043"><span class="linenos">2043</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2044"><a href="#L-2044"><span class="linenos">2044</span></a> +</span><span id="L-2045"><a href="#L-2045"><span class="linenos">2045</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-2046"><a href="#L-2046"><span class="linenos">2046</span></a> <span class="n">field</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2047"><a href="#L-2047"><span class="linenos">2047</span></a> +</span><span id="L-2048"><a href="#L-2048"><span class="linenos">2048</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2049"><a href="#L-2049"><span class="linenos">2049</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2050"><a href="#L-2050"><span class="linenos">2050</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2051"><a href="#L-2051"><span class="linenos">2051</span></a> +</span><span id="L-2052"><a href="#L-2052"><span class="linenos">2052</span></a> <span class="k">if</span> <span class="n">unpivot</span><span class="p">:</span> +</span><span id="L-2053"><a href="#L-2053"><span class="linenos">2053</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-2054"><a href="#L-2054"><span class="linenos">2054</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2055"><a href="#L-2055"><span class="linenos">2055</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()))</span> +</span><span id="L-2056"><a href="#L-2056"><span class="linenos">2056</span></a> +</span><span id="L-2057"><a href="#L-2057"><span class="linenos">2057</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FOR</span><span class="p">):</span> +</span><span id="L-2058"><a href="#L-2058"><span class="linenos">2058</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting FOR"</span><span class="p">)</span> +</span><span id="L-2059"><a href="#L-2059"><span class="linenos">2059</span></a> +</span><span id="L-2060"><a href="#L-2060"><span class="linenos">2060</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="L-2061"><a href="#L-2061"><span class="linenos">2061</span></a> +</span><span id="L-2062"><a href="#L-2062"><span class="linenos">2062</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">):</span> +</span><span id="L-2063"><a href="#L-2063"><span class="linenos">2063</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting IN"</span><span class="p">)</span> +</span><span id="L-2064"><a href="#L-2064"><span class="linenos">2064</span></a> +</span><span id="L-2065"><a href="#L-2065"><span class="linenos">2065</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-2066"><a href="#L-2066"><span class="linenos">2066</span></a> +</span><span id="L-2067"><a href="#L-2067"><span class="linenos">2067</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2068"><a href="#L-2068"><span class="linenos">2068</span></a> +</span><span id="L-2069"><a href="#L-2069"><span class="linenos">2069</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="n">field</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="n">unpivot</span><span class="p">)</span> +</span><span id="L-2070"><a href="#L-2070"><span class="linenos">2070</span></a> +</span><span id="L-2071"><a href="#L-2071"><span class="linenos">2071</span></a> <span class="k">def</span> <span class="nf">_parse_where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_where_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2072"><a href="#L-2072"><span class="linenos">2072</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_where_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WHERE</span><span class="p">):</span> +</span><span id="L-2073"><a href="#L-2073"><span class="linenos">2073</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2074"><a href="#L-2074"><span class="linenos">2074</span></a> +</span><span id="L-2075"><a href="#L-2075"><span class="linenos">2075</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2076"><a href="#L-2076"><span class="linenos">2076</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2077"><a href="#L-2077"><span class="linenos">2077</span></a> <span class="p">)</span> +</span><span id="L-2078"><a href="#L-2078"><span class="linenos">2078</span></a> +</span><span id="L-2079"><a href="#L-2079"><span class="linenos">2079</span></a> <span class="k">def</span> <span class="nf">_parse_group</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_group_by_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2080"><a href="#L-2080"><span class="linenos">2080</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_group_by_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GROUP_BY</span><span class="p">):</span> +</span><span id="L-2081"><a href="#L-2081"><span class="linenos">2081</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2082"><a href="#L-2082"><span class="linenos">2082</span></a> +</span><span id="L-2083"><a href="#L-2083"><span class="linenos">2083</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-2084"><a href="#L-2084"><span class="linenos">2084</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_grouping_sets</span><span class="p">()</span> +</span><span id="L-2085"><a href="#L-2085"><span class="linenos">2085</span></a> +</span><span id="L-2086"><a href="#L-2086"><span class="linenos">2086</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="L-2087"><a href="#L-2087"><span class="linenos">2087</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> +</span><span id="L-2088"><a href="#L-2088"><span class="linenos">2088</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CUBE</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-2089"><a href="#L-2089"><span class="linenos">2089</span></a> <span class="n">with_</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-2090"><a href="#L-2090"><span class="linenos">2090</span></a> <span class="p">)</span> +</span><span id="L-2091"><a href="#L-2091"><span class="linenos">2091</span></a> +</span><span id="L-2092"><a href="#L-2092"><span class="linenos">2092</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="L-2093"><a href="#L-2093"><span class="linenos">2093</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLUP</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-2094"><a href="#L-2094"><span class="linenos">2094</span></a> <span class="n">with_</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-2095"><a href="#L-2095"><span class="linenos">2095</span></a> <span class="p">)</span> +</span><span id="L-2096"><a href="#L-2096"><span class="linenos">2096</span></a> +</span><span id="L-2097"><a href="#L-2097"><span class="linenos">2097</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2098"><a href="#L-2098"><span class="linenos">2098</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">,</span> +</span><span id="L-2099"><a href="#L-2099"><span class="linenos">2099</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2100"><a href="#L-2100"><span class="linenos">2100</span></a> <span class="n">grouping_sets</span><span class="o">=</span><span class="n">grouping_sets</span><span class="p">,</span> +</span><span id="L-2101"><a href="#L-2101"><span class="linenos">2101</span></a> <span class="n">cube</span><span class="o">=</span><span class="n">cube</span><span class="p">,</span> +</span><span id="L-2102"><a href="#L-2102"><span class="linenos">2102</span></a> <span class="n">rollup</span><span class="o">=</span><span class="n">rollup</span><span class="p">,</span> +</span><span id="L-2103"><a href="#L-2103"><span class="linenos">2103</span></a> <span class="p">)</span> +</span><span id="L-2104"><a href="#L-2104"><span class="linenos">2104</span></a> +</span><span id="L-2105"><a href="#L-2105"><span class="linenos">2105</span></a> <span class="k">def</span> <span class="nf">_parse_grouping_sets</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="L-2106"><a href="#L-2106"><span class="linenos">2106</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GROUPING_SETS</span><span class="p">):</span> +</span><span id="L-2107"><a href="#L-2107"><span class="linenos">2107</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2108"><a href="#L-2108"><span class="linenos">2108</span></a> +</span><span id="L-2109"><a href="#L-2109"><span class="linenos">2109</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_grouping_set</span><span class="p">)</span> +</span><span id="L-2110"><a href="#L-2110"><span class="linenos">2110</span></a> +</span><span id="L-2111"><a href="#L-2111"><span class="linenos">2111</span></a> <span class="k">def</span> <span class="nf">_parse_grouping_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2112"><a href="#L-2112"><span class="linenos">2112</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2113"><a href="#L-2113"><span class="linenos">2113</span></a> <span class="n">grouping_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-2114"><a href="#L-2114"><span class="linenos">2114</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2115"><a href="#L-2115"><span class="linenos">2115</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">grouping_set</span><span class="p">)</span> +</span><span id="L-2116"><a href="#L-2116"><span class="linenos">2116</span></a> +</span><span id="L-2117"><a href="#L-2117"><span class="linenos">2117</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="L-2118"><a href="#L-2118"><span class="linenos">2118</span></a> +</span><span id="L-2119"><a href="#L-2119"><span class="linenos">2119</span></a> <span class="k">def</span> <span class="nf">_parse_having</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_having_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2120"><a href="#L-2120"><span class="linenos">2120</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_having_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">HAVING</span><span class="p">):</span> +</span><span id="L-2121"><a href="#L-2121"><span class="linenos">2121</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2122"><a href="#L-2122"><span class="linenos">2122</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="L-2123"><a href="#L-2123"><span class="linenos">2123</span></a> +</span><span id="L-2124"><a href="#L-2124"><span class="linenos">2124</span></a> <span class="k">def</span> <span class="nf">_parse_qualify</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2125"><a href="#L-2125"><span class="linenos">2125</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">QUALIFY</span><span class="p">):</span> +</span><span id="L-2126"><a href="#L-2126"><span class="linenos">2126</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2127"><a href="#L-2127"><span class="linenos">2127</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="L-2128"><a href="#L-2128"><span class="linenos">2128</span></a> +</span><span id="L-2129"><a href="#L-2129"><span class="linenos">2129</span></a> <span class="k">def</span> <span class="nf">_parse_order</span><span class="p">(</span> +</span><span id="L-2130"><a href="#L-2130"><span class="linenos">2130</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">skip_order_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-2131"><a href="#L-2131"><span class="linenos">2131</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2132"><a href="#L-2132"><span class="linenos">2132</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_order_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">):</span> +</span><span id="L-2133"><a href="#L-2133"><span class="linenos">2133</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2134"><a href="#L-2134"><span class="linenos">2134</span></a> +</span><span id="L-2135"><a href="#L-2135"><span class="linenos">2135</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2136"><a href="#L-2136"><span class="linenos">2136</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_ordered</span><span class="p">)</span> +</span><span id="L-2137"><a href="#L-2137"><span class="linenos">2137</span></a> <span class="p">)</span> +</span><span id="L-2138"><a href="#L-2138"><span class="linenos">2138</span></a> +</span><span id="L-2139"><a href="#L-2139"><span class="linenos">2139</span></a> <span class="k">def</span> <span class="nf">_parse_sort</span><span class="p">(</span> +</span><span id="L-2140"><a href="#L-2140"><span class="linenos">2140</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-2141"><a href="#L-2141"><span class="linenos">2141</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2142"><a href="#L-2142"><span class="linenos">2142</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">token_type</span><span class="p">):</span> +</span><span id="L-2143"><a href="#L-2143"><span class="linenos">2143</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2144"><a href="#L-2144"><span class="linenos">2144</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp_class</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_ordered</span><span class="p">))</span> +</span><span id="L-2145"><a href="#L-2145"><span class="linenos">2145</span></a> +</span><span id="L-2146"><a href="#L-2146"><span class="linenos">2146</span></a> <span class="k">def</span> <span class="nf">_parse_ordered</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2147"><a href="#L-2147"><span class="linenos">2147</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2148"><a href="#L-2148"><span class="linenos">2148</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ASC</span><span class="p">)</span> +</span><span id="L-2149"><a href="#L-2149"><span class="linenos">2149</span></a> <span class="n">is_desc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">)</span> +</span><span id="L-2150"><a href="#L-2150"><span class="linenos">2150</span></a> <span class="n">is_nulls_first</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_FIRST</span><span class="p">)</span> +</span><span id="L-2151"><a href="#L-2151"><span class="linenos">2151</span></a> <span class="n">is_nulls_last</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_LAST</span><span class="p">)</span> +</span><span id="L-2152"><a href="#L-2152"><span class="linenos">2152</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">is_desc</span> <span class="ow">or</span> <span class="kc">False</span> +</span><span id="L-2153"><a href="#L-2153"><span class="linenos">2153</span></a> <span class="n">asc</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">desc</span> +</span><span id="L-2154"><a href="#L-2154"><span class="linenos">2154</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="n">is_nulls_first</span> <span class="ow">or</span> <span class="kc">False</span> +</span><span id="L-2155"><a href="#L-2155"><span class="linenos">2155</span></a> <span class="n">explicitly_null_ordered</span> <span class="o">=</span> <span class="n">is_nulls_first</span> <span class="ow">or</span> <span class="n">is_nulls_last</span> +</span><span id="L-2156"><a href="#L-2156"><span class="linenos">2156</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-2157"><a href="#L-2157"><span class="linenos">2157</span></a> <span class="ow">not</span> <span class="n">explicitly_null_ordered</span> +</span><span id="L-2158"><a href="#L-2158"><span class="linenos">2158</span></a> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-2159"><a href="#L-2159"><span class="linenos">2159</span></a> <span class="p">(</span><span class="n">asc</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_small"</span><span class="p">)</span> +</span><span id="L-2160"><a href="#L-2160"><span class="linenos">2160</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">!=</span> <span class="s2">"nulls_are_small"</span><span class="p">)</span> +</span><span id="L-2161"><a href="#L-2161"><span class="linenos">2161</span></a> <span class="p">)</span> +</span><span id="L-2162"><a href="#L-2162"><span class="linenos">2162</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">!=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="L-2163"><a href="#L-2163"><span class="linenos">2163</span></a> <span class="p">):</span> +</span><span id="L-2164"><a href="#L-2164"><span class="linenos">2164</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-2165"><a href="#L-2165"><span class="linenos">2165</span></a> +</span><span id="L-2166"><a href="#L-2166"><span class="linenos">2166</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="n">desc</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="n">nulls_first</span><span class="p">)</span> +</span><span id="L-2167"><a href="#L-2167"><span class="linenos">2167</span></a> +</span><span id="L-2168"><a href="#L-2168"><span class="linenos">2168</span></a> <span class="k">def</span> <span class="nf">_parse_limit</span><span class="p">(</span> +</span><span id="L-2169"><a href="#L-2169"><span class="linenos">2169</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">top</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-2170"><a href="#L-2170"><span class="linenos">2170</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2171"><a href="#L-2171"><span class="linenos">2171</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span> <span class="k">if</span> <span class="n">top</span> <span class="k">else</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIMIT</span><span class="p">):</span> +</span><span id="L-2172"><a href="#L-2172"><span class="linenos">2172</span></a> <span class="n">limit_paren</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">)</span> +</span><span id="L-2173"><a href="#L-2173"><span class="linenos">2173</span></a> <span class="n">limit_exp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2174"><a href="#L-2174"><span class="linenos">2174</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="n">top</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-2175"><a href="#L-2175"><span class="linenos">2175</span></a> <span class="p">)</span> +</span><span id="L-2176"><a href="#L-2176"><span class="linenos">2176</span></a> +</span><span id="L-2177"><a href="#L-2177"><span class="linenos">2177</span></a> <span class="k">if</span> <span class="n">limit_paren</span><span class="p">:</span> +</span><span id="L-2178"><a href="#L-2178"><span class="linenos">2178</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2179"><a href="#L-2179"><span class="linenos">2179</span></a> +</span><span id="L-2180"><a href="#L-2180"><span class="linenos">2180</span></a> <span class="k">return</span> <span class="n">limit_exp</span> +</span><span id="L-2181"><a href="#L-2181"><span class="linenos">2181</span></a> +</span><span id="L-2182"><a href="#L-2182"><span class="linenos">2182</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FETCH</span><span class="p">):</span> +</span><span id="L-2183"><a href="#L-2183"><span class="linenos">2183</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEXT</span><span class="p">))</span> +</span><span id="L-2184"><a href="#L-2184"><span class="linenos">2184</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> <span class="k">if</span> <span class="n">direction</span> <span class="k">else</span> <span class="s2">"FIRST"</span> +</span><span id="L-2185"><a href="#L-2185"><span class="linenos">2185</span></a> <span class="n">count</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-2186"><a href="#L-2186"><span class="linenos">2186</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">))</span> +</span><span id="L-2187"><a href="#L-2187"><span class="linenos">2187</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ONLY</span><span class="p">)</span> +</span><span id="L-2188"><a href="#L-2188"><span class="linenos">2188</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">,</span> <span class="n">direction</span><span class="o">=</span><span class="n">direction</span><span class="p">,</span> <span class="n">count</span><span class="o">=</span><span class="n">count</span><span class="p">)</span> +</span><span id="L-2189"><a href="#L-2189"><span class="linenos">2189</span></a> +</span><span id="L-2190"><a href="#L-2190"><span class="linenos">2190</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2191"><a href="#L-2191"><span class="linenos">2191</span></a> +</span><span id="L-2192"><a href="#L-2192"><span class="linenos">2192</span></a> <span class="k">def</span> <span class="nf">_parse_offset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2193"><a href="#L-2193"><span class="linenos">2193</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)):</span> +</span><span id="L-2194"><a href="#L-2194"><span class="linenos">2194</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2195"><a href="#L-2195"><span class="linenos">2195</span></a> +</span><span id="L-2196"><a href="#L-2196"><span class="linenos">2196</span></a> <span class="n">count</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="L-2197"><a href="#L-2197"><span class="linenos">2197</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">))</span> +</span><span id="L-2198"><a href="#L-2198"><span class="linenos">2198</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">count</span><span class="p">)</span> +</span><span id="L-2199"><a href="#L-2199"><span class="linenos">2199</span></a> +</span><span id="L-2200"><a href="#L-2200"><span class="linenos">2200</span></a> <span class="k">def</span> <span class="nf">_parse_lock</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2201"><a href="#L-2201"><span class="linenos">2201</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"UPDATE"</span><span class="p">):</span> +</span><span id="L-2202"><a href="#L-2202"><span class="linenos">2202</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-2203"><a href="#L-2203"><span class="linenos">2203</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"SHARE"</span><span class="p">):</span> +</span><span id="L-2204"><a href="#L-2204"><span class="linenos">2204</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-2205"><a href="#L-2205"><span class="linenos">2205</span></a> +</span><span id="L-2206"><a href="#L-2206"><span class="linenos">2206</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2207"><a href="#L-2207"><span class="linenos">2207</span></a> +</span><span id="L-2208"><a href="#L-2208"><span class="linenos">2208</span></a> <span class="k">def</span> <span class="nf">_parse_set_operations</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2209"><a href="#L-2209"><span class="linenos">2209</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SET_OPERATIONS</span><span class="p">):</span> +</span><span id="L-2210"><a href="#L-2210"><span class="linenos">2210</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2211"><a href="#L-2211"><span class="linenos">2211</span></a> +</span><span id="L-2212"><a href="#L-2212"><span class="linenos">2212</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-2213"><a href="#L-2213"><span class="linenos">2213</span></a> +</span><span id="L-2214"><a href="#L-2214"><span class="linenos">2214</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNION</span><span class="p">:</span> +</span><span id="L-2215"><a href="#L-2215"><span class="linenos">2215</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span> +</span><span id="L-2216"><a href="#L-2216"><span class="linenos">2216</span></a> <span class="k">elif</span> <span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">:</span> +</span><span id="L-2217"><a href="#L-2217"><span class="linenos">2217</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span> +</span><span id="L-2218"><a href="#L-2218"><span class="linenos">2218</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2219"><a href="#L-2219"><span class="linenos">2219</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span> +</span><span id="L-2220"><a href="#L-2220"><span class="linenos">2220</span></a> +</span><span id="L-2221"><a href="#L-2221"><span class="linenos">2221</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2222"><a href="#L-2222"><span class="linenos">2222</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="L-2223"><a href="#L-2223"><span class="linenos">2223</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-2224"><a href="#L-2224"><span class="linenos">2224</span></a> <span class="n">distinct</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">),</span> +</span><span id="L-2225"><a href="#L-2225"><span class="linenos">2225</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">)),</span> +</span><span id="L-2226"><a href="#L-2226"><span class="linenos">2226</span></a> <span class="p">)</span> +</span><span id="L-2227"><a href="#L-2227"><span class="linenos">2227</span></a> +</span><span id="L-2228"><a href="#L-2228"><span class="linenos">2228</span></a> <span class="k">def</span> <span class="nf">_parse_expression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2229"><a href="#L-2229"><span class="linenos">2229</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="L-2230"><a href="#L-2230"><span class="linenos">2230</span></a> +</span><span id="L-2231"><a href="#L-2231"><span class="linenos">2231</span></a> <span class="k">def</span> <span class="nf">_parse_conjunction</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2232"><a href="#L-2232"><span class="linenos">2232</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">CONJUNCTION</span><span class="p">)</span> +</span><span id="L-2233"><a href="#L-2233"><span class="linenos">2233</span></a> +</span><span id="L-2234"><a href="#L-2234"><span class="linenos">2234</span></a> <span class="k">def</span> <span class="nf">_parse_equality</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2235"><a href="#L-2235"><span class="linenos">2235</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_comparison</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">EQUALITY</span><span class="p">)</span> +</span><span id="L-2236"><a href="#L-2236"><span class="linenos">2236</span></a> +</span><span id="L-2237"><a href="#L-2237"><span class="linenos">2237</span></a> <span class="k">def</span> <span class="nf">_parse_comparison</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2238"><a href="#L-2238"><span class="linenos">2238</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_range</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">COMPARISON</span><span class="p">)</span> +</span><span id="L-2239"><a href="#L-2239"><span class="linenos">2239</span></a> +</span><span id="L-2240"><a href="#L-2240"><span class="linenos">2240</span></a> <span class="k">def</span> <span class="nf">_parse_range</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2241"><a href="#L-2241"><span class="linenos">2241</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-2242"><a href="#L-2242"><span class="linenos">2242</span></a> <span class="n">negate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">)</span> +</span><span id="L-2243"><a href="#L-2243"><span class="linenos">2243</span></a> +</span><span id="L-2244"><a href="#L-2244"><span class="linenos">2244</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">):</span> +</span><span id="L-2245"><a href="#L-2245"><span class="linenos">2245</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">)</span> +</span><span id="L-2246"><a href="#L-2246"><span class="linenos">2246</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">):</span> +</span><span id="L-2247"><a href="#L-2247"><span class="linenos">2247</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">())</span> +</span><span id="L-2248"><a href="#L-2248"><span class="linenos">2248</span></a> +</span><span id="L-2249"><a href="#L-2249"><span class="linenos">2249</span></a> <span class="c1"># Postgres supports ISNULL and NOTNULL for conditions.</span> +</span><span id="L-2250"><a href="#L-2250"><span class="linenos">2250</span></a> <span class="c1"># https://blog.andreiavram.ro/postgresql-null-composite-type/</span> +</span><span id="L-2251"><a href="#L-2251"><span class="linenos">2251</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOTNULL</span><span class="p">):</span> +</span><span id="L-2252"><a href="#L-2252"><span class="linenos">2252</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">())</span> +</span><span id="L-2253"><a href="#L-2253"><span class="linenos">2253</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2254"><a href="#L-2254"><span class="linenos">2254</span></a> +</span><span id="L-2255"><a href="#L-2255"><span class="linenos">2255</span></a> <span class="k">if</span> <span class="n">negate</span><span class="p">:</span> +</span><span id="L-2256"><a href="#L-2256"><span class="linenos">2256</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2257"><a href="#L-2257"><span class="linenos">2257</span></a> +</span><span id="L-2258"><a href="#L-2258"><span class="linenos">2258</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IS</span><span class="p">):</span> +</span><span id="L-2259"><a href="#L-2259"><span class="linenos">2259</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_is</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2260"><a href="#L-2260"><span class="linenos">2260</span></a> +</span><span id="L-2261"><a href="#L-2261"><span class="linenos">2261</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2262"><a href="#L-2262"><span class="linenos">2262</span></a> +</span><span id="L-2263"><a href="#L-2263"><span class="linenos">2263</span></a> <span class="k">def</span> <span class="nf">_parse_is</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2264"><a href="#L-2264"><span class="linenos">2264</span></a> <span class="n">negate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">)</span> +</span><span id="L-2265"><a href="#L-2265"><span class="linenos">2265</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT_FROM</span><span class="p">):</span> +</span><span id="L-2266"><a href="#L-2266"><span class="linenos">2266</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span> <span class="k">if</span> <span class="n">negate</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span> +</span><span id="L-2267"><a href="#L-2267"><span class="linenos">2267</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">())</span> +</span><span id="L-2268"><a href="#L-2268"><span class="linenos">2268</span></a> +</span><span id="L-2269"><a href="#L-2269"><span class="linenos">2269</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2270"><a href="#L-2270"><span class="linenos">2270</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> +</span><span id="L-2271"><a href="#L-2271"><span class="linenos">2271</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-2272"><a href="#L-2272"><span class="linenos">2272</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_null</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_boolean</span><span class="p">(),</span> +</span><span id="L-2273"><a href="#L-2273"><span class="linenos">2273</span></a> <span class="p">)</span> +</span><span id="L-2274"><a href="#L-2274"><span class="linenos">2274</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> <span class="k">if</span> <span class="n">negate</span> <span class="k">else</span> <span class="n">this</span> +</span><span id="L-2275"><a href="#L-2275"><span class="linenos">2275</span></a> +</span><span id="L-2276"><a href="#L-2276"><span class="linenos">2276</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2277"><a href="#L-2277"><span class="linenos">2277</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnest</span><span class="p">()</span> +</span><span id="L-2278"><a href="#L-2278"><span class="linenos">2278</span></a> <span class="k">if</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="L-2279"><a href="#L-2279"><span class="linenos">2279</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">unnest</span><span class="o">=</span><span class="n">unnest</span><span class="p">)</span> +</span><span id="L-2280"><a href="#L-2280"><span class="linenos">2280</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2281"><a href="#L-2281"><span class="linenos">2281</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select_or_expression</span><span class="p">)</span> +</span><span id="L-2282"><a href="#L-2282"><span class="linenos">2282</span></a> +</span><span id="L-2283"><a href="#L-2283"><span class="linenos">2283</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-2284"><a href="#L-2284"><span class="linenos">2284</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">query</span><span class="o">=</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="L-2285"><a href="#L-2285"><span class="linenos">2285</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2286"><a href="#L-2286"><span class="linenos">2286</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2287"><a href="#L-2287"><span class="linenos">2287</span></a> +</span><span id="L-2288"><a href="#L-2288"><span class="linenos">2288</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2289"><a href="#L-2289"><span class="linenos">2289</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2290"><a href="#L-2290"><span class="linenos">2290</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">())</span> +</span><span id="L-2291"><a href="#L-2291"><span class="linenos">2291</span></a> +</span><span id="L-2292"><a href="#L-2292"><span class="linenos">2292</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2293"><a href="#L-2293"><span class="linenos">2293</span></a> +</span><span id="L-2294"><a href="#L-2294"><span class="linenos">2294</span></a> <span class="k">def</span> <span class="nf">_parse_between</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2295"><a href="#L-2295"><span class="linenos">2295</span></a> <span class="n">low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-2296"><a href="#L-2296"><span class="linenos">2296</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">)</span> +</span><span id="L-2297"><a href="#L-2297"><span class="linenos">2297</span></a> <span class="n">high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-2298"><a href="#L-2298"><span class="linenos">2298</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">low</span><span class="o">=</span><span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="n">high</span><span class="p">)</span> +</span><span id="L-2299"><a href="#L-2299"><span class="linenos">2299</span></a> +</span><span id="L-2300"><a href="#L-2300"><span class="linenos">2300</span></a> <span class="k">def</span> <span class="nf">_parse_escape</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2301"><a href="#L-2301"><span class="linenos">2301</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ESCAPE</span><span class="p">):</span> +</span><span id="L-2302"><a href="#L-2302"><span class="linenos">2302</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2303"><a href="#L-2303"><span class="linenos">2303</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Escape</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="L-2304"><a href="#L-2304"><span class="linenos">2304</span></a> +</span><span id="L-2305"><a href="#L-2305"><span class="linenos">2305</span></a> <span class="k">def</span> <span class="nf">_parse_bitwise</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2306"><a href="#L-2306"><span class="linenos">2306</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-2307"><a href="#L-2307"><span class="linenos">2307</span></a> +</span><span id="L-2308"><a href="#L-2308"><span class="linenos">2308</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-2309"><a href="#L-2309"><span class="linenos">2309</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">):</span> +</span><span id="L-2310"><a href="#L-2310"><span class="linenos">2310</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2311"><a href="#L-2311"><span class="linenos">2311</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">],</span> +</span><span id="L-2312"><a href="#L-2312"><span class="linenos">2312</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-2313"><a href="#L-2313"><span class="linenos">2313</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">(),</span> +</span><span id="L-2314"><a href="#L-2314"><span class="linenos">2314</span></a> <span class="p">)</span> +</span><span id="L-2315"><a href="#L-2315"><span class="linenos">2315</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="L-2316"><a href="#L-2316"><span class="linenos">2316</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2317"><a href="#L-2317"><span class="linenos">2317</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-2318"><a href="#L-2318"><span class="linenos">2318</span></a> <span class="p">)</span> +</span><span id="L-2319"><a href="#L-2319"><span class="linenos">2319</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="L-2320"><a href="#L-2320"><span class="linenos">2320</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2321"><a href="#L-2321"><span class="linenos">2321</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-2322"><a href="#L-2322"><span class="linenos">2322</span></a> <span class="p">)</span> +</span><span id="L-2323"><a href="#L-2323"><span class="linenos">2323</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2324"><a href="#L-2324"><span class="linenos">2324</span></a> <span class="k">break</span> +</span><span id="L-2325"><a href="#L-2325"><span class="linenos">2325</span></a> +</span><span id="L-2326"><a href="#L-2326"><span class="linenos">2326</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2327"><a href="#L-2327"><span class="linenos">2327</span></a> +</span><span id="L-2328"><a href="#L-2328"><span class="linenos">2328</span></a> <span class="k">def</span> <span class="nf">_parse_term</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2329"><a href="#L-2329"><span class="linenos">2329</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_factor</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">TERM</span><span class="p">)</span> +</span><span id="L-2330"><a href="#L-2330"><span class="linenos">2330</span></a> +</span><span id="L-2331"><a href="#L-2331"><span class="linenos">2331</span></a> <span class="k">def</span> <span class="nf">_parse_factor</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2332"><a href="#L-2332"><span class="linenos">2332</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">FACTOR</span><span class="p">)</span> +</span><span id="L-2333"><a href="#L-2333"><span class="linenos">2333</span></a> +</span><span id="L-2334"><a href="#L-2334"><span class="linenos">2334</span></a> <span class="k">def</span> <span class="nf">_parse_unary</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2335"><a href="#L-2335"><span class="linenos">2335</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">UNARY_PARSERS</span><span class="p">):</span> +</span><span id="L-2336"><a href="#L-2336"><span class="linenos">2336</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">UNARY_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-2337"><a href="#L-2337"><span class="linenos">2337</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_at_time_zone</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_type</span><span class="p">())</span> +</span><span id="L-2338"><a href="#L-2338"><span class="linenos">2338</span></a> +</span><span id="L-2339"><a href="#L-2339"><span class="linenos">2339</span></a> <span class="k">def</span> <span class="nf">_parse_type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2340"><a href="#L-2340"><span class="linenos">2340</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">):</span> +</span><span id="L-2341"><a href="#L-2341"><span class="linenos">2341</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">(),</span> <span class="n">unit</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="L-2342"><a href="#L-2342"><span class="linenos">2342</span></a> +</span><span id="L-2343"><a href="#L-2343"><span class="linenos">2343</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-2344"><a href="#L-2344"><span class="linenos">2344</span></a> <span class="n">type_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(</span><span class="n">check_func</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-2345"><a href="#L-2345"><span class="linenos">2345</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="L-2346"><a href="#L-2346"><span class="linenos">2346</span></a> +</span><span id="L-2347"><a href="#L-2347"><span class="linenos">2347</span></a> <span class="k">if</span> <span class="n">type_token</span><span class="p">:</span> +</span><span id="L-2348"><a href="#L-2348"><span class="linenos">2348</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="L-2349"><a href="#L-2349"><span class="linenos">2349</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">type_token</span><span class="p">)</span> +</span><span id="L-2350"><a href="#L-2350"><span class="linenos">2350</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">type_token</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">):</span> +</span><span id="L-2351"><a href="#L-2351"><span class="linenos">2351</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2352"><a href="#L-2352"><span class="linenos">2352</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="L-2353"><a href="#L-2353"><span class="linenos">2353</span></a> <span class="k">return</span> <span class="n">type_token</span> +</span><span id="L-2354"><a href="#L-2354"><span class="linenos">2354</span></a> +</span><span id="L-2355"><a href="#L-2355"><span class="linenos">2355</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2356"><a href="#L-2356"><span class="linenos">2356</span></a> +</span><span id="L-2357"><a href="#L-2357"><span class="linenos">2357</span></a> <span class="k">def</span> <span class="nf">_parse_types</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">check_func</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2358"><a href="#L-2358"><span class="linenos">2358</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-2359"><a href="#L-2359"><span class="linenos">2359</span></a> +</span><span id="L-2360"><a href="#L-2360"><span class="linenos">2360</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">):</span> +</span><span id="L-2361"><a href="#L-2361"><span class="linenos">2361</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2362"><a href="#L-2362"><span class="linenos">2362</span></a> +</span><span id="L-2363"><a href="#L-2363"><span class="linenos">2363</span></a> <span class="n">type_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-2364"><a href="#L-2364"><span class="linenos">2364</span></a> +</span><span id="L-2365"><a href="#L-2365"><span class="linenos">2365</span></a> <span class="k">if</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">:</span> +</span><span id="L-2366"><a href="#L-2366"><span class="linenos">2366</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PseudoType</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-2367"><a href="#L-2367"><span class="linenos">2367</span></a> +</span><span id="L-2368"><a href="#L-2368"><span class="linenos">2368</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="n">type_token</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">NESTED_TYPE_TOKENS</span> +</span><span id="L-2369"><a href="#L-2369"><span class="linenos">2369</span></a> <span class="n">is_struct</span> <span class="o">=</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span> +</span><span id="L-2370"><a href="#L-2370"><span class="linenos">2370</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2371"><a href="#L-2371"><span class="linenos">2371</span></a> <span class="n">maybe_func</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-2372"><a href="#L-2372"><span class="linenos">2372</span></a> +</span><span id="L-2373"><a href="#L-2373"><span class="linenos">2373</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2374"><a href="#L-2374"><span class="linenos">2374</span></a> <span class="k">if</span> <span class="n">is_struct</span><span class="p">:</span> +</span><span id="L-2375"><a href="#L-2375"><span class="linenos">2375</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_struct_kwargs</span><span class="p">)</span> +</span><span id="L-2376"><a href="#L-2376"><span class="linenos">2376</span></a> <span class="k">elif</span> <span class="n">nested</span><span class="p">:</span> +</span><span id="L-2377"><a href="#L-2377"><span class="linenos">2377</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">)</span> +</span><span id="L-2378"><a href="#L-2378"><span class="linenos">2378</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2379"><a href="#L-2379"><span class="linenos">2379</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-2380"><a href="#L-2380"><span class="linenos">2380</span></a> +</span><span id="L-2381"><a href="#L-2381"><span class="linenos">2381</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-2382"><a href="#L-2382"><span class="linenos">2382</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2383"><a href="#L-2383"><span class="linenos">2383</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2384"><a href="#L-2384"><span class="linenos">2384</span></a> +</span><span id="L-2385"><a href="#L-2385"><span class="linenos">2385</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2386"><a href="#L-2386"><span class="linenos">2386</span></a> <span class="n">maybe_func</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-2387"><a href="#L-2387"><span class="linenos">2387</span></a> +</span><span id="L-2388"><a href="#L-2388"><span class="linenos">2388</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">nested</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">):</span> +</span><span id="L-2389"><a href="#L-2389"><span class="linenos">2389</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="L-2390"><a href="#L-2390"><span class="linenos">2390</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="L-2391"><a href="#L-2391"><span class="linenos">2391</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">type_token</span><span class="o">.</span><span class="n">value</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)],</span> +</span><span id="L-2392"><a href="#L-2392"><span class="linenos">2392</span></a> <span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-2393"><a href="#L-2393"><span class="linenos">2393</span></a> <span class="p">)</span> +</span><span id="L-2394"><a href="#L-2394"><span class="linenos">2394</span></a> +</span><span id="L-2395"><a href="#L-2395"><span class="linenos">2395</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">):</span> +</span><span id="L-2396"><a href="#L-2396"><span class="linenos">2396</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="L-2397"><a href="#L-2397"><span class="linenos">2397</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="L-2398"><a href="#L-2398"><span class="linenos">2398</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">this</span><span class="p">],</span> +</span><span id="L-2399"><a href="#L-2399"><span class="linenos">2399</span></a> <span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="L-2400"><a href="#L-2400"><span class="linenos">2400</span></a> <span class="p">)</span> +</span><span id="L-2401"><a href="#L-2401"><span class="linenos">2401</span></a> +</span><span id="L-2402"><a href="#L-2402"><span class="linenos">2402</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2403"><a href="#L-2403"><span class="linenos">2403</span></a> +</span><span id="L-2404"><a href="#L-2404"><span class="linenos">2404</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">):</span> +</span><span id="L-2405"><a href="#L-2405"><span class="linenos">2405</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2406"><a href="#L-2406"><span class="linenos">2406</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2407"><a href="#L-2407"><span class="linenos">2407</span></a> +</span><span id="L-2408"><a href="#L-2408"><span class="linenos">2408</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2409"><a href="#L-2409"><span class="linenos">2409</span></a> <span class="k">if</span> <span class="n">nested</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="L-2410"><a href="#L-2410"><span class="linenos">2410</span></a> <span class="k">if</span> <span class="n">is_struct</span><span class="p">:</span> +</span><span id="L-2411"><a href="#L-2411"><span class="linenos">2411</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_struct_kwargs</span><span class="p">)</span> +</span><span id="L-2412"><a href="#L-2412"><span class="linenos">2412</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2413"><a href="#L-2413"><span class="linenos">2413</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">)</span> +</span><span id="L-2414"><a href="#L-2414"><span class="linenos">2414</span></a> +</span><span id="L-2415"><a href="#L-2415"><span class="linenos">2415</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="L-2416"><a href="#L-2416"><span class="linenos">2416</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting >"</span><span class="p">)</span> +</span><span id="L-2417"><a href="#L-2417"><span class="linenos">2417</span></a> +</span><span id="L-2418"><a href="#L-2418"><span class="linenos">2418</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">)):</span> +</span><span id="L-2419"><a href="#L-2419"><span class="linenos">2419</span></a> <span class="n">values</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-2420"><a href="#L-2420"><span class="linenos">2420</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">))</span> +</span><span id="L-2421"><a href="#L-2421"><span class="linenos">2421</span></a> +</span><span id="L-2422"><a href="#L-2422"><span class="linenos">2422</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2423"><a href="#L-2423"><span class="linenos">2423</span></a> <span class="k">if</span> <span class="n">type_token</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">TIMESTAMPS</span><span class="p">:</span> +</span><span id="L-2424"><a href="#L-2424"><span class="linenos">2424</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_TIME_ZONE</span><span class="p">)</span> <span class="ow">or</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> +</span><span id="L-2425"><a href="#L-2425"><span class="linenos">2425</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2426"><a href="#L-2426"><span class="linenos">2426</span></a> <span class="k">elif</span> <span class="p">(</span> +</span><span id="L-2427"><a href="#L-2427"><span class="linenos">2427</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_LOCAL_TIME_ZONE</span><span class="p">)</span> <span class="ow">or</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span> +</span><span id="L-2428"><a href="#L-2428"><span class="linenos">2428</span></a> <span class="p">):</span> +</span><span id="L-2429"><a href="#L-2429"><span class="linenos">2429</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2430"><a href="#L-2430"><span class="linenos">2430</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITHOUT_TIME_ZONE</span><span class="p">):</span> +</span><span id="L-2431"><a href="#L-2431"><span class="linenos">2431</span></a> <span class="k">if</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">:</span> +</span><span id="L-2432"><a href="#L-2432"><span class="linenos">2432</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2433"><a href="#L-2433"><span class="linenos">2433</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2434"><a href="#L-2434"><span class="linenos">2434</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2435"><a href="#L-2435"><span class="linenos">2435</span></a> +</span><span id="L-2436"><a href="#L-2436"><span class="linenos">2436</span></a> <span class="n">maybe_func</span> <span class="o">=</span> <span class="n">maybe_func</span> <span class="ow">and</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span> +</span><span id="L-2437"><a href="#L-2437"><span class="linenos">2437</span></a> +</span><span id="L-2438"><a href="#L-2438"><span class="linenos">2438</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-2439"><a href="#L-2439"><span class="linenos">2439</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2440"><a href="#L-2440"><span class="linenos">2440</span></a> <span class="k">elif</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">:</span> +</span><span id="L-2441"><a href="#L-2441"><span class="linenos">2441</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="L-2442"><a href="#L-2442"><span class="linenos">2442</span></a> +</span><span id="L-2443"><a href="#L-2443"><span class="linenos">2443</span></a> <span class="k">if</span> <span class="n">maybe_func</span> <span class="ow">and</span> <span class="n">check_func</span><span class="p">:</span> +</span><span id="L-2444"><a href="#L-2444"><span class="linenos">2444</span></a> <span class="n">index2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-2445"><a href="#L-2445"><span class="linenos">2445</span></a> <span class="n">peek</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-2446"><a href="#L-2446"><span class="linenos">2446</span></a> +</span><span id="L-2447"><a href="#L-2447"><span class="linenos">2447</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">peek</span><span class="p">:</span> +</span><span id="L-2448"><a href="#L-2448"><span class="linenos">2448</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2449"><a href="#L-2449"><span class="linenos">2449</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2450"><a href="#L-2450"><span class="linenos">2450</span></a> +</span><span id="L-2451"><a href="#L-2451"><span class="linenos">2451</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index2</span><span class="p">)</span> +</span><span id="L-2452"><a href="#L-2452"><span class="linenos">2452</span></a> +</span><span id="L-2453"><a href="#L-2453"><span class="linenos">2453</span></a> <span class="k">if</span> <span class="n">value</span><span class="p">:</span> +</span><span id="L-2454"><a href="#L-2454"><span class="linenos">2454</span></a> <span class="k">return</span> <span class="n">value</span> +</span><span id="L-2455"><a href="#L-2455"><span class="linenos">2455</span></a> +</span><span id="L-2456"><a href="#L-2456"><span class="linenos">2456</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="L-2457"><a href="#L-2457"><span class="linenos">2457</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">type_token</span><span class="o">.</span><span class="n">value</span><span class="o">.</span><span class="n">upper</span><span class="p">()],</span> +</span><span id="L-2458"><a href="#L-2458"><span class="linenos">2458</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="L-2459"><a href="#L-2459"><span class="linenos">2459</span></a> <span class="n">nested</span><span class="o">=</span><span class="n">nested</span><span class="p">,</span> +</span><span id="L-2460"><a href="#L-2460"><span class="linenos">2460</span></a> <span class="n">values</span><span class="o">=</span><span class="n">values</span><span class="p">,</span> +</span><span id="L-2461"><a href="#L-2461"><span class="linenos">2461</span></a> <span class="p">)</span> +</span><span id="L-2462"><a href="#L-2462"><span class="linenos">2462</span></a> +</span><span id="L-2463"><a href="#L-2463"><span class="linenos">2463</span></a> <span class="k">def</span> <span class="nf">_parse_struct_kwargs</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2464"><a href="#L-2464"><span class="linenos">2464</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">:</span> +</span><span id="L-2465"><a href="#L-2465"><span class="linenos">2465</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-2466"><a href="#L-2466"><span class="linenos">2466</span></a> +</span><span id="L-2467"><a href="#L-2467"><span class="linenos">2467</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2468"><a href="#L-2468"><span class="linenos">2468</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">)</span> +</span><span id="L-2469"><a href="#L-2469"><span class="linenos">2469</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-2470"><a href="#L-2470"><span class="linenos">2470</span></a> +</span><span id="L-2471"><a href="#L-2471"><span class="linenos">2471</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">data_type</span><span class="p">:</span> +</span><span id="L-2472"><a href="#L-2472"><span class="linenos">2472</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2473"><a href="#L-2473"><span class="linenos">2473</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">data_type</span><span class="p">)</span> +</span><span id="L-2474"><a href="#L-2474"><span class="linenos">2474</span></a> +</span><span id="L-2475"><a href="#L-2475"><span class="linenos">2475</span></a> <span class="k">def</span> <span class="nf">_parse_at_time_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2476"><a href="#L-2476"><span class="linenos">2476</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AT_TIME_ZONE</span><span class="p">):</span> +</span><span id="L-2477"><a href="#L-2477"><span class="linenos">2477</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2478"><a href="#L-2478"><span class="linenos">2478</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">zone</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">())</span> +</span><span id="L-2479"><a href="#L-2479"><span class="linenos">2479</span></a> +</span><span id="L-2480"><a href="#L-2480"><span class="linenos">2480</span></a> <span class="k">def</span> <span class="nf">_parse_column</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2481"><a href="#L-2481"><span class="linenos">2481</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">()</span> +</span><span id="L-2482"><a href="#L-2482"><span class="linenos">2482</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">):</span> +</span><span id="L-2483"><a href="#L-2483"><span class="linenos">2483</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2484"><a href="#L-2484"><span class="linenos">2484</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="L-2485"><a href="#L-2485"><span class="linenos">2485</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2486"><a href="#L-2486"><span class="linenos">2486</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2487"><a href="#L-2487"><span class="linenos">2487</span></a> +</span><span id="L-2488"><a href="#L-2488"><span class="linenos">2488</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="p">):</span> +</span><span id="L-2489"><a href="#L-2489"><span class="linenos">2489</span></a> <span class="n">op_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-2490"><a href="#L-2490"><span class="linenos">2490</span></a> <span class="n">op</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">op_token</span><span class="p">)</span> +</span><span id="L-2491"><a href="#L-2491"><span class="linenos">2491</span></a> +</span><span id="L-2492"><a href="#L-2492"><span class="linenos">2492</span></a> <span class="k">if</span> <span class="n">op_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">:</span> +</span><span id="L-2493"><a href="#L-2493"><span class="linenos">2493</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-2494"><a href="#L-2494"><span class="linenos">2494</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">field</span><span class="p">:</span> +</span><span id="L-2495"><a href="#L-2495"><span class="linenos">2495</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected type"</span><span class="p">)</span> +</span><span id="L-2496"><a href="#L-2496"><span class="linenos">2496</span></a> <span class="k">elif</span> <span class="n">op</span><span class="p">:</span> +</span><span id="L-2497"><a href="#L-2497"><span class="linenos">2497</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-2498"><a href="#L-2498"><span class="linenos">2498</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-2499"><a href="#L-2499"><span class="linenos">2499</span></a> <span class="n">field</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-2500"><a href="#L-2500"><span class="linenos">2500</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-2501"><a href="#L-2501"><span class="linenos">2501</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span> +</span><span id="L-2502"><a href="#L-2502"><span class="linenos">2502</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="L-2503"><a href="#L-2503"><span class="linenos">2503</span></a> <span class="p">)</span> +</span><span id="L-2504"><a href="#L-2504"><span class="linenos">2504</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2505"><a href="#L-2505"><span class="linenos">2505</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_star</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2506"><a href="#L-2506"><span class="linenos">2506</span></a> +</span><span id="L-2507"><a href="#L-2507"><span class="linenos">2507</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">):</span> +</span><span id="L-2508"><a href="#L-2508"><span class="linenos">2508</span></a> <span class="c1"># bigquery allows function calls like x.y.count(...)</span> +</span><span id="L-2509"><a href="#L-2509"><span class="linenos">2509</span></a> <span class="c1"># SAFE.SUBSTR(...)</span> +</span><span id="L-2510"><a href="#L-2510"><span class="linenos">2510</span></a> <span class="c1"># https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-reference#function_call_rules</span> +</span><span id="L-2511"><a href="#L-2511"><span class="linenos">2511</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_columns_with_dots</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2512"><a href="#L-2512"><span class="linenos">2512</span></a> +</span><span id="L-2513"><a href="#L-2513"><span class="linenos">2513</span></a> <span class="k">if</span> <span class="n">op</span><span class="p">:</span> +</span><span id="L-2514"><a href="#L-2514"><span class="linenos">2514</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">field</span><span class="p">)</span> +</span><span id="L-2515"><a href="#L-2515"><span class="linenos">2515</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">this</span><span class="o">.</span><span class="n">table</span><span class="p">:</span> +</span><span id="L-2516"><a href="#L-2516"><span class="linenos">2516</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">field</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2517"><a href="#L-2517"><span class="linenos">2517</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2518"><a href="#L-2518"><span class="linenos">2518</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">field</span><span class="p">)</span> +</span><span id="L-2519"><a href="#L-2519"><span class="linenos">2519</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2520"><a href="#L-2520"><span class="linenos">2520</span></a> +</span><span id="L-2521"><a href="#L-2521"><span class="linenos">2521</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2522"><a href="#L-2522"><span class="linenos">2522</span></a> +</span><span id="L-2523"><a href="#L-2523"><span class="linenos">2523</span></a> <span class="k">def</span> <span class="nf">_parse_primary</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2524"><a href="#L-2524"><span class="linenos">2524</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">):</span> +</span><span id="L-2525"><a href="#L-2525"><span class="linenos">2525</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-2526"><a href="#L-2526"><span class="linenos">2526</span></a> <span class="n">primary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-2527"><a href="#L-2527"><span class="linenos">2527</span></a> +</span><span id="L-2528"><a href="#L-2528"><span class="linenos">2528</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">:</span> +</span><span id="L-2529"><a href="#L-2529"><span class="linenos">2529</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">primary</span><span class="p">]</span> +</span><span id="L-2530"><a href="#L-2530"><span class="linenos">2530</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">):</span> +</span><span id="L-2531"><a href="#L-2531"><span class="linenos">2531</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">))</span> +</span><span id="L-2532"><a href="#L-2532"><span class="linenos">2532</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-2533"><a href="#L-2533"><span class="linenos">2533</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2534"><a href="#L-2534"><span class="linenos">2534</span></a> <span class="k">return</span> <span class="n">primary</span> +</span><span id="L-2535"><a href="#L-2535"><span class="linenos">2535</span></a> +</span><span id="L-2536"><a href="#L-2536"><span class="linenos">2536</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">):</span> +</span><span id="L-2537"><a href="#L-2537"><span class="linenos">2537</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="sa">f</span><span class="s2">"0.</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-2538"><a href="#L-2538"><span class="linenos">2538</span></a> +</span><span id="L-2539"><a href="#L-2539"><span class="linenos">2539</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2540"><a href="#L-2540"><span class="linenos">2540</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-2541"><a href="#L-2541"><span class="linenos">2541</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">()</span> +</span><span id="L-2542"><a href="#L-2542"><span class="linenos">2542</span></a> +</span><span id="L-2543"><a href="#L-2543"><span class="linenos">2543</span></a> <span class="k">if</span> <span class="n">query</span><span class="p">:</span> +</span><span id="L-2544"><a href="#L-2544"><span class="linenos">2544</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">query</span><span class="p">]</span> +</span><span id="L-2545"><a href="#L-2545"><span class="linenos">2545</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2546"><a href="#L-2546"><span class="linenos">2546</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="L-2547"><a href="#L-2547"><span class="linenos">2547</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> <span class="n">explicit</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-2548"><a href="#L-2548"><span class="linenos">2548</span></a> <span class="p">)</span> +</span><span id="L-2549"><a href="#L-2549"><span class="linenos">2549</span></a> +</span><span id="L-2550"><a href="#L-2550"><span class="linenos">2550</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-2551"><a href="#L-2551"><span class="linenos">2551</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2552"><a href="#L-2552"><span class="linenos">2552</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2553"><a href="#L-2553"><span class="linenos">2553</span></a> +</span><span id="L-2554"><a href="#L-2554"><span class="linenos">2554</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="L-2555"><a href="#L-2555"><span class="linenos">2555</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span> +</span><span id="L-2556"><a href="#L-2556"><span class="linenos">2556</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_subquery</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">parse_alias</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-2557"><a href="#L-2557"><span class="linenos">2557</span></a> <span class="p">)</span> +</span><span id="L-2558"><a href="#L-2558"><span class="linenos">2558</span></a> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-2559"><a href="#L-2559"><span class="linenos">2559</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2560"><a href="#L-2560"><span class="linenos">2560</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2561"><a href="#L-2561"><span class="linenos">2561</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2562"><a href="#L-2562"><span class="linenos">2562</span></a> +</span><span id="L-2563"><a href="#L-2563"><span class="linenos">2563</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">and</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="L-2564"><a href="#L-2564"><span class="linenos">2564</span></a> <span class="n">this</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="L-2565"><a href="#L-2565"><span class="linenos">2565</span></a> +</span><span id="L-2566"><a href="#L-2566"><span class="linenos">2566</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2567"><a href="#L-2567"><span class="linenos">2567</span></a> +</span><span id="L-2568"><a href="#L-2568"><span class="linenos">2568</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2569"><a href="#L-2569"><span class="linenos">2569</span></a> +</span><span id="L-2570"><a href="#L-2570"><span class="linenos">2570</span></a> <span class="k">def</span> <span class="nf">_parse_field</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">any_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2571"><a href="#L-2571"><span class="linenos">2571</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="p">)</span> +</span><span id="L-2572"><a href="#L-2572"><span class="linenos">2572</span></a> +</span><span id="L-2573"><a href="#L-2573"><span class="linenos">2573</span></a> <span class="k">def</span> <span class="nf">_parse_function</span><span class="p">(</span> +</span><span id="L-2574"><a href="#L-2574"><span class="linenos">2574</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">functions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2575"><a href="#L-2575"><span class="linenos">2575</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2576"><a href="#L-2576"><span class="linenos">2576</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="L-2577"><a href="#L-2577"><span class="linenos">2577</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2578"><a href="#L-2578"><span class="linenos">2578</span></a> +</span><span id="L-2579"><a href="#L-2579"><span class="linenos">2579</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-2580"><a href="#L-2580"><span class="linenos">2580</span></a> +</span><span id="L-2581"><a href="#L-2581"><span class="linenos">2581</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">):</span> +</span><span id="L-2582"><a href="#L-2582"><span class="linenos">2582</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">[</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-2583"><a href="#L-2583"><span class="linenos">2583</span></a> +</span><span id="L-2584"><a href="#L-2584"><span class="linenos">2584</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="o">.</span><span class="n">token_type</span> <span class="o">!=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">:</span> +</span><span id="L-2585"><a href="#L-2585"><span class="linenos">2585</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">:</span> +</span><span id="L-2586"><a href="#L-2586"><span class="linenos">2586</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-2587"><a href="#L-2587"><span class="linenos">2587</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">[</span><span class="n">token_type</span><span class="p">])</span> +</span><span id="L-2588"><a href="#L-2588"><span class="linenos">2588</span></a> +</span><span id="L-2589"><a href="#L-2589"><span class="linenos">2589</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2590"><a href="#L-2590"><span class="linenos">2590</span></a> +</span><span id="L-2591"><a href="#L-2591"><span class="linenos">2591</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">:</span> +</span><span id="L-2592"><a href="#L-2592"><span class="linenos">2592</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2593"><a href="#L-2593"><span class="linenos">2593</span></a> +</span><span id="L-2594"><a href="#L-2594"><span class="linenos">2594</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-2595"><a href="#L-2595"><span class="linenos">2595</span></a> <span class="n">upper</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-2596"><a href="#L-2596"><span class="linenos">2596</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> +</span><span id="L-2597"><a href="#L-2597"><span class="linenos">2597</span></a> +</span><span id="L-2598"><a href="#L-2598"><span class="linenos">2598</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">upper</span><span class="p">)</span> +</span><span id="L-2599"><a href="#L-2599"><span class="linenos">2599</span></a> +</span><span id="L-2600"><a href="#L-2600"><span class="linenos">2600</span></a> <span class="k">if</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="L-2601"><a href="#L-2601"><span class="linenos">2601</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-2602"><a href="#L-2602"><span class="linenos">2602</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2603"><a href="#L-2603"><span class="linenos">2603</span></a> <span class="n">subquery_predicate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">SUBQUERY_PREDICATES</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">token_type</span><span class="p">)</span> +</span><span id="L-2604"><a href="#L-2604"><span class="linenos">2604</span></a> +</span><span id="L-2605"><a href="#L-2605"><span class="linenos">2605</span></a> <span class="k">if</span> <span class="n">subquery_predicate</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">):</span> +</span><span id="L-2606"><a href="#L-2606"><span class="linenos">2606</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">subquery_predicate</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">())</span> +</span><span id="L-2607"><a href="#L-2607"><span class="linenos">2607</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2608"><a href="#L-2608"><span class="linenos">2608</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2609"><a href="#L-2609"><span class="linenos">2609</span></a> +</span><span id="L-2610"><a href="#L-2610"><span class="linenos">2610</span></a> <span class="k">if</span> <span class="n">functions</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-2611"><a href="#L-2611"><span class="linenos">2611</span></a> <span class="n">functions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">FUNCTIONS</span> +</span><span id="L-2612"><a href="#L-2612"><span class="linenos">2612</span></a> +</span><span id="L-2613"><a href="#L-2613"><span class="linenos">2613</span></a> <span class="n">function</span> <span class="o">=</span> <span class="n">functions</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">upper</span><span class="p">)</span> +</span><span id="L-2614"><a href="#L-2614"><span class="linenos">2614</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">)</span> +</span><span id="L-2615"><a href="#L-2615"><span class="linenos">2615</span></a> +</span><span id="L-2616"><a href="#L-2616"><span class="linenos">2616</span></a> <span class="k">if</span> <span class="n">function</span><span class="p">:</span> +</span><span id="L-2617"><a href="#L-2617"><span class="linenos">2617</span></a> <span class="c1"># Clickhouse supports function calls like foo(x, y)(z), so for these we need to also parse the</span> +</span><span id="L-2618"><a href="#L-2618"><span class="linenos">2618</span></a> <span class="c1"># second parameter list (i.e. "(z)") and the corresponding function will receive both arg lists.</span> +</span><span id="L-2619"><a href="#L-2619"><span class="linenos">2619</span></a> <span class="k">if</span> <span class="n">count_params</span><span class="p">(</span><span class="n">function</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-2620"><a href="#L-2620"><span class="linenos">2620</span></a> <span class="n">params</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2621"><a href="#L-2621"><span class="linenos">2621</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2622"><a href="#L-2622"><span class="linenos">2622</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">)</span> +</span><span id="L-2623"><a href="#L-2623"><span class="linenos">2623</span></a> +</span><span id="L-2624"><a href="#L-2624"><span class="linenos">2624</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span> +</span><span id="L-2625"><a href="#L-2625"><span class="linenos">2625</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2626"><a href="#L-2626"><span class="linenos">2626</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-2627"><a href="#L-2627"><span class="linenos">2627</span></a> +</span><span id="L-2628"><a href="#L-2628"><span class="linenos">2628</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-2629"><a href="#L-2629"><span class="linenos">2629</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2630"><a href="#L-2630"><span class="linenos">2630</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-2631"><a href="#L-2631"><span class="linenos">2631</span></a> +</span><span id="L-2632"><a href="#L-2632"><span class="linenos">2632</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2633"><a href="#L-2633"><span class="linenos">2633</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2634"><a href="#L-2634"><span class="linenos">2634</span></a> +</span><span id="L-2635"><a href="#L-2635"><span class="linenos">2635</span></a> <span class="k">def</span> <span class="nf">_parse_user_defined_function</span><span class="p">(</span> +</span><span id="L-2636"><a href="#L-2636"><span class="linenos">2636</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2637"><a href="#L-2637"><span class="linenos">2637</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2638"><a href="#L-2638"><span class="linenos">2638</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2639"><a href="#L-2639"><span class="linenos">2639</span></a> +</span><span id="L-2640"><a href="#L-2640"><span class="linenos">2640</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="L-2641"><a href="#L-2641"><span class="linenos">2641</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">())</span> +</span><span id="L-2642"><a href="#L-2642"><span class="linenos">2642</span></a> +</span><span id="L-2643"><a href="#L-2643"><span class="linenos">2643</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2644"><a href="#L-2644"><span class="linenos">2644</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2645"><a href="#L-2645"><span class="linenos">2645</span></a> +</span><span id="L-2646"><a href="#L-2646"><span class="linenos">2646</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_udf_kwarg</span><span class="p">)</span> +</span><span id="L-2647"><a href="#L-2647"><span class="linenos">2647</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2648"><a href="#L-2648"><span class="linenos">2648</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2649"><a href="#L-2649"><span class="linenos">2649</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">wrapped</span><span class="o">=</span><span class="kc">True</span> +</span><span id="L-2650"><a href="#L-2650"><span class="linenos">2650</span></a> <span class="p">)</span> +</span><span id="L-2651"><a href="#L-2651"><span class="linenos">2651</span></a> +</span><span id="L-2652"><a href="#L-2652"><span class="linenos">2652</span></a> <span class="k">def</span> <span class="nf">_parse_introducer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2653"><a href="#L-2653"><span class="linenos">2653</span></a> <span class="n">literal</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="L-2654"><a href="#L-2654"><span class="linenos">2654</span></a> <span class="k">if</span> <span class="n">literal</span><span class="p">:</span> +</span><span id="L-2655"><a href="#L-2655"><span class="linenos">2655</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Introducer</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">literal</span><span class="p">)</span> +</span><span id="L-2656"><a href="#L-2656"><span class="linenos">2656</span></a> +</span><span id="L-2657"><a href="#L-2657"><span class="linenos">2657</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-2658"><a href="#L-2658"><span class="linenos">2658</span></a> +</span><span id="L-2659"><a href="#L-2659"><span class="linenos">2659</span></a> <span class="k">def</span> <span class="nf">_parse_national</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2660"><a href="#L-2660"><span class="linenos">2660</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">National</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">))</span> +</span><span id="L-2661"><a href="#L-2661"><span class="linenos">2661</span></a> +</span><span id="L-2662"><a href="#L-2662"><span class="linenos">2662</span></a> <span class="k">def</span> <span class="nf">_parse_session_parameter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2663"><a href="#L-2663"><span class="linenos">2663</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2664"><a href="#L-2664"><span class="linenos">2664</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="L-2665"><a href="#L-2665"><span class="linenos">2665</span></a> +</span><span id="L-2666"><a href="#L-2666"><span class="linenos">2666</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="L-2667"><a href="#L-2667"><span class="linenos">2667</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-2668"><a href="#L-2668"><span class="linenos">2668</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="L-2669"><a href="#L-2669"><span class="linenos">2669</span></a> +</span><span id="L-2670"><a href="#L-2670"><span class="linenos">2670</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SessionParameter</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="L-2671"><a href="#L-2671"><span class="linenos">2671</span></a> +</span><span id="L-2672"><a href="#L-2672"><span class="linenos">2672</span></a> <span class="k">def</span> <span class="nf">_parse_udf_kwarg</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2673"><a href="#L-2673"><span class="linenos">2673</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2674"><a href="#L-2674"><span class="linenos">2674</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-2675"><a href="#L-2675"><span class="linenos">2675</span></a> +</span><span id="L-2676"><a href="#L-2676"><span class="linenos">2676</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="L-2677"><a href="#L-2677"><span class="linenos">2677</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2678"><a href="#L-2678"><span class="linenos">2678</span></a> +</span><span id="L-2679"><a href="#L-2679"><span class="linenos">2679</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunctionKwarg</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="L-2680"><a href="#L-2680"><span class="linenos">2680</span></a> +</span><span id="L-2681"><a href="#L-2681"><span class="linenos">2681</span></a> <span class="k">def</span> <span class="nf">_parse_lambda</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2682"><a href="#L-2682"><span class="linenos">2682</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-2683"><a href="#L-2683"><span class="linenos">2683</span></a> +</span><span id="L-2684"><a href="#L-2684"><span class="linenos">2684</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2685"><a href="#L-2685"><span class="linenos">2685</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">)</span> +</span><span id="L-2686"><a href="#L-2686"><span class="linenos">2686</span></a> +</span><span id="L-2687"><a href="#L-2687"><span class="linenos">2687</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">):</span> +</span><span id="L-2688"><a href="#L-2688"><span class="linenos">2688</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2689"><a href="#L-2689"><span class="linenos">2689</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2690"><a href="#L-2690"><span class="linenos">2690</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()]</span> +</span><span id="L-2691"><a href="#L-2691"><span class="linenos">2691</span></a> +</span><span id="L-2692"><a href="#L-2692"><span class="linenos">2692</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">LAMBDAS</span><span class="p">):</span> +</span><span id="L-2693"><a href="#L-2693"><span class="linenos">2693</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">LAMBDAS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2694"><a href="#L-2694"><span class="linenos">2694</span></a> +</span><span id="L-2695"><a href="#L-2695"><span class="linenos">2695</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2696"><a href="#L-2696"><span class="linenos">2696</span></a> +</span><span id="L-2697"><a href="#L-2697"><span class="linenos">2697</span></a> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-2698"><a href="#L-2698"><span class="linenos">2698</span></a> +</span><span id="L-2699"><a href="#L-2699"><span class="linenos">2699</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">):</span> +</span><span id="L-2700"><a href="#L-2700"><span class="linenos">2700</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2701"><a href="#L-2701"><span class="linenos">2701</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-2702"><a href="#L-2702"><span class="linenos">2702</span></a> <span class="p">)</span> +</span><span id="L-2703"><a href="#L-2703"><span class="linenos">2703</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2704"><a href="#L-2704"><span class="linenos">2704</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select_or_expression</span><span class="p">()</span> +</span><span id="L-2705"><a href="#L-2705"><span class="linenos">2705</span></a> +</span><span id="L-2706"><a href="#L-2706"><span class="linenos">2706</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IGNORE_NULLS</span><span class="p">):</span> +</span><span id="L-2707"><a href="#L-2707"><span class="linenos">2707</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2708"><a href="#L-2708"><span class="linenos">2708</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2709"><a href="#L-2709"><span class="linenos">2709</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">RESPECT_NULLS</span><span class="p">)</span> +</span><span id="L-2710"><a href="#L-2710"><span class="linenos">2710</span></a> +</span><span id="L-2711"><a href="#L-2711"><span class="linenos">2711</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(</span><span class="n">this</span><span class="p">))</span> +</span><span id="L-2712"><a href="#L-2712"><span class="linenos">2712</span></a> +</span><span id="L-2713"><a href="#L-2713"><span class="linenos">2713</span></a> <span class="k">def</span> <span class="nf">_parse_schema</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2714"><a href="#L-2714"><span class="linenos">2714</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-2715"><a href="#L-2715"><span class="linenos">2715</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">):</span> +</span><span id="L-2716"><a href="#L-2716"><span class="linenos">2716</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-2717"><a href="#L-2717"><span class="linenos">2717</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2718"><a href="#L-2718"><span class="linenos">2718</span></a> +</span><span id="L-2719"><a href="#L-2719"><span class="linenos">2719</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="L-2720"><a href="#L-2720"><span class="linenos">2720</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_constraint</span><span class="p">()</span> +</span><span id="L-2721"><a href="#L-2721"><span class="linenos">2721</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-2722"><a href="#L-2722"><span class="linenos">2722</span></a> <span class="p">)</span> +</span><span id="L-2723"><a href="#L-2723"><span class="linenos">2723</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2724"><a href="#L-2724"><span class="linenos">2724</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-2725"><a href="#L-2725"><span class="linenos">2725</span></a> +</span><span id="L-2726"><a href="#L-2726"><span class="linenos">2726</span></a> <span class="k">def</span> <span class="nf">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2727"><a href="#L-2727"><span class="linenos">2727</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-2728"><a href="#L-2728"><span class="linenos">2728</span></a> +</span><span id="L-2729"><a href="#L-2729"><span class="linenos">2729</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-2730"><a href="#L-2730"><span class="linenos">2730</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-2731"><a href="#L-2731"><span class="linenos">2731</span></a> <span class="n">constraint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_constraint</span><span class="p">()</span> +</span><span id="L-2732"><a href="#L-2732"><span class="linenos">2732</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">constraint</span><span class="p">:</span> +</span><span id="L-2733"><a href="#L-2733"><span class="linenos">2733</span></a> <span class="k">break</span> +</span><span id="L-2734"><a href="#L-2734"><span class="linenos">2734</span></a> <span class="n">constraints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">constraint</span><span class="p">)</span> +</span><span id="L-2735"><a href="#L-2735"><span class="linenos">2735</span></a> +</span><span id="L-2736"><a href="#L-2736"><span class="linenos">2736</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">kind</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">constraints</span><span class="p">:</span> +</span><span id="L-2737"><a href="#L-2737"><span class="linenos">2737</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2738"><a href="#L-2738"><span class="linenos">2738</span></a> +</span><span id="L-2739"><a href="#L-2739"><span class="linenos">2739</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> <span class="n">constraints</span><span class="o">=</span><span class="n">constraints</span><span class="p">)</span> +</span><span id="L-2740"><a href="#L-2740"><span class="linenos">2740</span></a> +</span><span id="L-2741"><a href="#L-2741"><span class="linenos">2741</span></a> <span class="k">def</span> <span class="nf">_parse_column_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2742"><a href="#L-2742"><span class="linenos">2742</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_references</span><span class="p">()</span> +</span><span id="L-2743"><a href="#L-2743"><span class="linenos">2743</span></a> +</span><span id="L-2744"><a href="#L-2744"><span class="linenos">2744</span></a> <span class="k">if</span> <span class="n">this</span><span class="p">:</span> +</span><span id="L-2745"><a href="#L-2745"><span class="linenos">2745</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2746"><a href="#L-2746"><span class="linenos">2746</span></a> +</span><span id="L-2747"><a href="#L-2747"><span class="linenos">2747</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">):</span> +</span><span id="L-2748"><a href="#L-2748"><span class="linenos">2748</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2749"><a href="#L-2749"><span class="linenos">2749</span></a> +</span><span id="L-2750"><a href="#L-2750"><span class="linenos">2750</span></a> <span class="n">kind</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="L-2751"><a href="#L-2751"><span class="linenos">2751</span></a> +</span><span id="L-2752"><a href="#L-2752"><span class="linenos">2752</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">)):</span> +</span><span id="L-2753"><a href="#L-2753"><span class="linenos">2753</span></a> <span class="n">start</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2754"><a href="#L-2754"><span class="linenos">2754</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2755"><a href="#L-2755"><span class="linenos">2755</span></a> +</span><span id="L-2756"><a href="#L-2756"><span class="linenos">2756</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-2757"><a href="#L-2757"><span class="linenos">2757</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="L-2758"><a href="#L-2758"><span class="linenos">2758</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-2759"><a href="#L-2759"><span class="linenos">2759</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-2760"><a href="#L-2760"><span class="linenos">2760</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"START"</span><span class="p">):</span> +</span><span id="L-2761"><a href="#L-2761"><span class="linenos">2761</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-2762"><a href="#L-2762"><span class="linenos">2762</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INCREMENT"</span><span class="p">)</span> +</span><span id="L-2763"><a href="#L-2763"><span class="linenos">2763</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="L-2764"><a href="#L-2764"><span class="linenos">2764</span></a> +</span><span id="L-2765"><a href="#L-2765"><span class="linenos">2765</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">and</span> <span class="n">increment</span><span class="p">:</span> +</span><span id="L-2766"><a href="#L-2766"><span class="linenos">2766</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">start</span><span class="p">,</span> <span class="n">increment</span><span class="o">=</span><span class="n">increment</span><span class="p">)</span> +</span><span id="L-2767"><a href="#L-2767"><span class="linenos">2767</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2768"><a href="#L-2768"><span class="linenos">2768</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementColumnConstraint</span><span class="p">()</span> +</span><span id="L-2769"><a href="#L-2769"><span class="linenos">2769</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">):</span> +</span><span id="L-2770"><a href="#L-2770"><span class="linenos">2770</span></a> <span class="n">constraint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-2771"><a href="#L-2771"><span class="linenos">2771</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CheckColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">constraint</span><span class="p">)</span> +</span><span id="L-2772"><a href="#L-2772"><span class="linenos">2772</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">):</span> +</span><span id="L-2773"><a href="#L-2773"><span class="linenos">2773</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CollateColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="L-2774"><a href="#L-2774"><span class="linenos">2774</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">):</span> +</span><span id="L-2775"><a href="#L-2775"><span class="linenos">2775</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EncodeColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="L-2776"><a href="#L-2776"><span class="linenos">2776</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="L-2777"><a href="#L-2777"><span class="linenos">2777</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DefaultColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-2778"><a href="#L-2778"><span class="linenos">2778</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="L-2779"><a href="#L-2779"><span class="linenos">2779</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">()</span> +</span><span id="L-2780"><a href="#L-2780"><span class="linenos">2780</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="L-2781"><a href="#L-2781"><span class="linenos">2781</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">(</span><span class="n">allow_null</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-2782"><a href="#L-2782"><span class="linenos">2782</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA_COMMENT</span><span class="p">):</span> +</span><span id="L-2783"><a href="#L-2783"><span class="linenos">2783</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CommentColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="L-2784"><a href="#L-2784"><span class="linenos">2784</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">):</span> +</span><span id="L-2785"><a href="#L-2785"><span class="linenos">2785</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2786"><a href="#L-2786"><span class="linenos">2786</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ASC</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">):</span> +</span><span id="L-2787"><a href="#L-2787"><span class="linenos">2787</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span> +</span><span id="L-2788"><a href="#L-2788"><span class="linenos">2788</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKeyColumnConstraint</span><span class="p">(</span><span class="n">desc</span><span class="o">=</span><span class="n">desc</span><span class="p">)</span> +</span><span id="L-2789"><a href="#L-2789"><span class="linenos">2789</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">):</span> +</span><span id="L-2790"><a href="#L-2790"><span class="linenos">2790</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">UniqueColumnConstraint</span><span class="p">()</span> +</span><span id="L-2791"><a href="#L-2791"><span class="linenos">2791</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GENERATED</span><span class="p">):</span> +</span><span id="L-2792"><a href="#L-2792"><span class="linenos">2792</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BY_DEFAULT</span><span class="p">):</span> +</span><span id="L-2793"><a href="#L-2793"><span class="linenos">2793</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-2794"><a href="#L-2794"><span class="linenos">2794</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2795"><a href="#L-2795"><span class="linenos">2795</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">)</span> +</span><span id="L-2796"><a href="#L-2796"><span class="linenos">2796</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-2797"><a href="#L-2797"><span class="linenos">2797</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">)</span> +</span><span id="L-2798"><a href="#L-2798"><span class="linenos">2798</span></a> +</span><span id="L-2799"><a href="#L-2799"><span class="linenos">2799</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2800"><a href="#L-2800"><span class="linenos">2800</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"START"</span><span class="p">,</span> <span class="s2">"WITH"</span><span class="p">):</span> +</span><span id="L-2801"><a href="#L-2801"><span class="linenos">2801</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"start"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-2802"><a href="#L-2802"><span class="linenos">2802</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INCREMENT"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="L-2803"><a href="#L-2803"><span class="linenos">2803</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-2804"><a href="#L-2804"><span class="linenos">2804</span></a> +</span><span id="L-2805"><a href="#L-2805"><span class="linenos">2805</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2806"><a href="#L-2806"><span class="linenos">2806</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2807"><a href="#L-2807"><span class="linenos">2807</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2808"><a href="#L-2808"><span class="linenos">2808</span></a> +</span><span id="L-2809"><a href="#L-2809"><span class="linenos">2809</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="L-2810"><a href="#L-2810"><span class="linenos">2810</span></a> +</span><span id="L-2811"><a href="#L-2811"><span class="linenos">2811</span></a> <span class="k">def</span> <span class="nf">_parse_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2812"><a href="#L-2812"><span class="linenos">2812</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">):</span> +</span><span id="L-2813"><a href="#L-2813"><span class="linenos">2813</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnamed_constraint</span><span class="p">()</span> +</span><span id="L-2814"><a href="#L-2814"><span class="linenos">2814</span></a> +</span><span id="L-2815"><a href="#L-2815"><span class="linenos">2815</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2816"><a href="#L-2816"><span class="linenos">2816</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-2817"><a href="#L-2817"><span class="linenos">2817</span></a> +</span><span id="L-2818"><a href="#L-2818"><span class="linenos">2818</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-2819"><a href="#L-2819"><span class="linenos">2819</span></a> <span class="n">constraint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnamed_constraint</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> +</span><span id="L-2820"><a href="#L-2820"><span class="linenos">2820</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">constraint</span><span class="p">:</span> +</span><span id="L-2821"><a href="#L-2821"><span class="linenos">2821</span></a> <span class="k">break</span> +</span><span id="L-2822"><a href="#L-2822"><span class="linenos">2822</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">constraint</span><span class="p">)</span> +</span><span id="L-2823"><a href="#L-2823"><span class="linenos">2823</span></a> +</span><span id="L-2824"><a href="#L-2824"><span class="linenos">2824</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Constraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2825"><a href="#L-2825"><span class="linenos">2825</span></a> +</span><span id="L-2826"><a href="#L-2826"><span class="linenos">2826</span></a> <span class="k">def</span> <span class="nf">_parse_unnamed_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2827"><a href="#L-2827"><span class="linenos">2827</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CONSTRAINT_PARSERS</span><span class="p">):</span> +</span><span id="L-2828"><a href="#L-2828"><span class="linenos">2828</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2829"><a href="#L-2829"><span class="linenos">2829</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">CONSTRAINT_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-2830"><a href="#L-2830"><span class="linenos">2830</span></a> +</span><span id="L-2831"><a href="#L-2831"><span class="linenos">2831</span></a> <span class="k">def</span> <span class="nf">_parse_unique</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2832"><a href="#L-2832"><span class="linenos">2832</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Unique</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">())</span> +</span><span id="L-2833"><a href="#L-2833"><span class="linenos">2833</span></a> +</span><span id="L-2834"><a href="#L-2834"><span class="linenos">2834</span></a> <span class="k">def</span> <span class="nf">_parse_key_constraint_options</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-2835"><a href="#L-2835"><span class="linenos">2835</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-2836"><a href="#L-2836"><span class="linenos">2836</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-2837"><a href="#L-2837"><span class="linenos">2837</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="L-2838"><a href="#L-2838"><span class="linenos">2838</span></a> <span class="k">break</span> +</span><span id="L-2839"><a href="#L-2839"><span class="linenos">2839</span></a> +</span><span id="L-2840"><a href="#L-2840"><span class="linenos">2840</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="L-2841"><a href="#L-2841"><span class="linenos">2841</span></a> <span class="n">action</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2842"><a href="#L-2842"><span class="linenos">2842</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-2843"><a href="#L-2843"><span class="linenos">2843</span></a> +</span><span id="L-2844"><a href="#L-2844"><span class="linenos">2844</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NO_ACTION</span><span class="p">):</span> +</span><span id="L-2845"><a href="#L-2845"><span class="linenos">2845</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"NO ACTION"</span> +</span><span id="L-2846"><a href="#L-2846"><span class="linenos">2846</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">):</span> +</span><span id="L-2847"><a href="#L-2847"><span class="linenos">2847</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"CASCADE"</span> +</span><span id="L-2848"><a href="#L-2848"><span class="linenos">2848</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="L-2849"><a href="#L-2849"><span class="linenos">2849</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"SET NULL"</span> +</span><span id="L-2850"><a href="#L-2850"><span class="linenos">2850</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="L-2851"><a href="#L-2851"><span class="linenos">2851</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"SET DEFAULT"</span> +</span><span id="L-2852"><a href="#L-2852"><span class="linenos">2852</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2853"><a href="#L-2853"><span class="linenos">2853</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Invalid key constraint"</span><span class="p">)</span> +</span><span id="L-2854"><a href="#L-2854"><span class="linenos">2854</span></a> +</span><span id="L-2855"><a href="#L-2855"><span class="linenos">2855</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"ON </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">action</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-2856"><a href="#L-2856"><span class="linenos">2856</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NOT"</span><span class="p">,</span> <span class="s2">"ENFORCED"</span><span class="p">):</span> +</span><span id="L-2857"><a href="#L-2857"><span class="linenos">2857</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"NOT ENFORCED"</span><span class="p">)</span> +</span><span id="L-2858"><a href="#L-2858"><span class="linenos">2858</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFERRABLE"</span><span class="p">):</span> +</span><span id="L-2859"><a href="#L-2859"><span class="linenos">2859</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"DEFERRABLE"</span><span class="p">)</span> +</span><span id="L-2860"><a href="#L-2860"><span class="linenos">2860</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INITIALLY"</span><span class="p">,</span> <span class="s2">"DEFERRED"</span><span class="p">):</span> +</span><span id="L-2861"><a href="#L-2861"><span class="linenos">2861</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"INITIALLY DEFERRED"</span><span class="p">)</span> +</span><span id="L-2862"><a href="#L-2862"><span class="linenos">2862</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NORELY"</span><span class="p">):</span> +</span><span id="L-2863"><a href="#L-2863"><span class="linenos">2863</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"NORELY"</span><span class="p">)</span> +</span><span id="L-2864"><a href="#L-2864"><span class="linenos">2864</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MATCH"</span><span class="p">,</span> <span class="s2">"FULL"</span><span class="p">):</span> +</span><span id="L-2865"><a href="#L-2865"><span class="linenos">2865</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"MATCH FULL"</span><span class="p">)</span> +</span><span id="L-2866"><a href="#L-2866"><span class="linenos">2866</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2867"><a href="#L-2867"><span class="linenos">2867</span></a> <span class="k">break</span> +</span><span id="L-2868"><a href="#L-2868"><span class="linenos">2868</span></a> +</span><span id="L-2869"><a href="#L-2869"><span class="linenos">2869</span></a> <span class="k">return</span> <span class="n">options</span> +</span><span id="L-2870"><a href="#L-2870"><span class="linenos">2870</span></a> +</span><span id="L-2871"><a href="#L-2871"><span class="linenos">2871</span></a> <span class="k">def</span> <span class="nf">_parse_references</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2872"><a href="#L-2872"><span class="linenos">2872</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REFERENCES</span><span class="p">):</span> +</span><span id="L-2873"><a href="#L-2873"><span class="linenos">2873</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-2874"><a href="#L-2874"><span class="linenos">2874</span></a> +</span><span id="L-2875"><a href="#L-2875"><span class="linenos">2875</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2876"><a href="#L-2876"><span class="linenos">2876</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-2877"><a href="#L-2877"><span class="linenos">2877</span></a> +</span><span id="L-2878"><a href="#L-2878"><span class="linenos">2878</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-2879"><a href="#L-2879"><span class="linenos">2879</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="L-2880"><a href="#L-2880"><span class="linenos">2880</span></a> +</span><span id="L-2881"><a href="#L-2881"><span class="linenos">2881</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_key_constraint_options</span><span class="p">()</span> +</span><span id="L-2882"><a href="#L-2882"><span class="linenos">2882</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Reference</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">)</span> +</span><span id="L-2883"><a href="#L-2883"><span class="linenos">2883</span></a> +</span><span id="L-2884"><a href="#L-2884"><span class="linenos">2884</span></a> <span class="k">def</span> <span class="nf">_parse_foreign_key</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2885"><a href="#L-2885"><span class="linenos">2885</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="L-2886"><a href="#L-2886"><span class="linenos">2886</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_references</span><span class="p">()</span> +</span><span id="L-2887"><a href="#L-2887"><span class="linenos">2887</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-2888"><a href="#L-2888"><span class="linenos">2888</span></a> +</span><span id="L-2889"><a href="#L-2889"><span class="linenos">2889</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="L-2890"><a href="#L-2890"><span class="linenos">2890</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">)):</span> +</span><span id="L-2891"><a href="#L-2891"><span class="linenos">2891</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected DELETE or UPDATE"</span><span class="p">)</span> +</span><span id="L-2892"><a href="#L-2892"><span class="linenos">2892</span></a> +</span><span id="L-2893"><a href="#L-2893"><span class="linenos">2893</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="L-2894"><a href="#L-2894"><span class="linenos">2894</span></a> +</span><span id="L-2895"><a href="#L-2895"><span class="linenos">2895</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NO_ACTION</span><span class="p">):</span> +</span><span id="L-2896"><a href="#L-2896"><span class="linenos">2896</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"NO ACTION"</span> +</span><span id="L-2897"><a href="#L-2897"><span class="linenos">2897</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">):</span> +</span><span id="L-2898"><a href="#L-2898"><span class="linenos">2898</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">))</span> +</span><span id="L-2899"><a href="#L-2899"><span class="linenos">2899</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"SET "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-2900"><a href="#L-2900"><span class="linenos">2900</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2901"><a href="#L-2901"><span class="linenos">2901</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-2902"><a href="#L-2902"><span class="linenos">2902</span></a> <span class="n">action</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-2903"><a href="#L-2903"><span class="linenos">2903</span></a> +</span><span id="L-2904"><a href="#L-2904"><span class="linenos">2904</span></a> <span class="n">options</span><span class="p">[</span><span class="n">kind</span><span class="p">]</span> <span class="o">=</span> <span class="n">action</span> +</span><span id="L-2905"><a href="#L-2905"><span class="linenos">2905</span></a> +</span><span id="L-2906"><a href="#L-2906"><span class="linenos">2906</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-2907"><a href="#L-2907"><span class="linenos">2907</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">reference</span><span class="o">=</span><span class="n">reference</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span> <span class="c1"># type: ignore</span> +</span><span id="L-2908"><a href="#L-2908"><span class="linenos">2908</span></a> <span class="p">)</span> +</span><span id="L-2909"><a href="#L-2909"><span class="linenos">2909</span></a> +</span><span id="L-2910"><a href="#L-2910"><span class="linenos">2910</span></a> <span class="k">def</span> <span class="nf">_parse_primary_key</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2911"><a href="#L-2911"><span class="linenos">2911</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="L-2912"><a href="#L-2912"><span class="linenos">2912</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_key_constraint_options</span><span class="p">()</span> +</span><span id="L-2913"><a href="#L-2913"><span class="linenos">2913</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKey</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">)</span> +</span><span id="L-2914"><a href="#L-2914"><span class="linenos">2914</span></a> +</span><span id="L-2915"><a href="#L-2915"><span class="linenos">2915</span></a> <span class="k">def</span> <span class="nf">_parse_bracket</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2916"><a href="#L-2916"><span class="linenos">2916</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">)):</span> +</span><span id="L-2917"><a href="#L-2917"><span class="linenos">2917</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2918"><a href="#L-2918"><span class="linenos">2918</span></a> +</span><span id="L-2919"><a href="#L-2919"><span class="linenos">2919</span></a> <span class="n">bracket_kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-2920"><a href="#L-2920"><span class="linenos">2920</span></a> <span class="n">expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> +</span><span id="L-2921"><a href="#L-2921"><span class="linenos">2921</span></a> +</span><span id="L-2922"><a href="#L-2922"><span class="linenos">2922</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">):</span> +</span><span id="L-2923"><a href="#L-2923"><span class="linenos">2923</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())]</span> +</span><span id="L-2924"><a href="#L-2924"><span class="linenos">2924</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2925"><a href="#L-2925"><span class="linenos">2925</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_slice</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()))</span> +</span><span id="L-2926"><a href="#L-2926"><span class="linenos">2926</span></a> +</span><span id="L-2927"><a href="#L-2927"><span class="linenos">2927</span></a> <span class="c1"># https://duckdb.org/docs/sql/data_types/struct.html#creating-structs</span> +</span><span id="L-2928"><a href="#L-2928"><span class="linenos">2928</span></a> <span class="k">if</span> <span class="n">bracket_kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">:</span> +</span><span id="L-2929"><a href="#L-2929"><span class="linenos">2929</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2930"><a href="#L-2930"><span class="linenos">2930</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="n">this</span> <span class="ow">or</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"ARRAY"</span><span class="p">:</span> +</span><span id="L-2931"><a href="#L-2931"><span class="linenos">2931</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2932"><a href="#L-2932"><span class="linenos">2932</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2933"><a href="#L-2933"><span class="linenos">2933</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">apply_index_offset</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">)</span> +</span><span id="L-2934"><a href="#L-2934"><span class="linenos">2934</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-2935"><a href="#L-2935"><span class="linenos">2935</span></a> +</span><span id="L-2936"><a href="#L-2936"><span class="linenos">2936</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">)</span> <span class="ow">and</span> <span class="n">bracket_kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">:</span> +</span><span id="L-2937"><a href="#L-2937"><span class="linenos">2937</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected ]"</span><span class="p">)</span> +</span><span id="L-2938"><a href="#L-2938"><span class="linenos">2938</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACE</span><span class="p">)</span> <span class="ow">and</span> <span class="n">bracket_kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">:</span> +</span><span id="L-2939"><a href="#L-2939"><span class="linenos">2939</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected }"</span><span class="p">)</span> +</span><span id="L-2940"><a href="#L-2940"><span class="linenos">2940</span></a> +</span><span id="L-2941"><a href="#L-2941"><span class="linenos">2941</span></a> <span class="n">this</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-2942"><a href="#L-2942"><span class="linenos">2942</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2943"><a href="#L-2943"><span class="linenos">2943</span></a> +</span><span id="L-2944"><a href="#L-2944"><span class="linenos">2944</span></a> <span class="k">def</span> <span class="nf">_parse_slice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2945"><a href="#L-2945"><span class="linenos">2945</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">):</span> +</span><span id="L-2946"><a href="#L-2946"><span class="linenos">2946</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="L-2947"><a href="#L-2947"><span class="linenos">2947</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-2948"><a href="#L-2948"><span class="linenos">2948</span></a> +</span><span id="L-2949"><a href="#L-2949"><span class="linenos">2949</span></a> <span class="k">def</span> <span class="nf">_parse_case</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2950"><a href="#L-2950"><span class="linenos">2950</span></a> <span class="n">ifs</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-2951"><a href="#L-2951"><span class="linenos">2951</span></a> <span class="n">default</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-2952"><a href="#L-2952"><span class="linenos">2952</span></a> +</span><span id="L-2953"><a href="#L-2953"><span class="linenos">2953</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2954"><a href="#L-2954"><span class="linenos">2954</span></a> +</span><span id="L-2955"><a href="#L-2955"><span class="linenos">2955</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WHEN</span><span class="p">):</span> +</span><span id="L-2956"><a href="#L-2956"><span class="linenos">2956</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2957"><a href="#L-2957"><span class="linenos">2957</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">)</span> +</span><span id="L-2958"><a href="#L-2958"><span class="linenos">2958</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2959"><a href="#L-2959"><span class="linenos">2959</span></a> <span class="n">ifs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">true</span><span class="o">=</span><span class="n">then</span><span class="p">))</span> +</span><span id="L-2960"><a href="#L-2960"><span class="linenos">2960</span></a> +</span><span id="L-2961"><a href="#L-2961"><span class="linenos">2961</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ELSE</span><span class="p">):</span> +</span><span id="L-2962"><a href="#L-2962"><span class="linenos">2962</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2963"><a href="#L-2963"><span class="linenos">2963</span></a> +</span><span id="L-2964"><a href="#L-2964"><span class="linenos">2964</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">):</span> +</span><span id="L-2965"><a href="#L-2965"><span class="linenos">2965</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected END after CASE"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-2966"><a href="#L-2966"><span class="linenos">2966</span></a> +</span><span id="L-2967"><a href="#L-2967"><span class="linenos">2967</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span> +</span><span id="L-2968"><a href="#L-2968"><span class="linenos">2968</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">ifs</span><span class="o">=</span><span class="n">ifs</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">)</span> +</span><span id="L-2969"><a href="#L-2969"><span class="linenos">2969</span></a> <span class="p">)</span> +</span><span id="L-2970"><a href="#L-2970"><span class="linenos">2970</span></a> +</span><span id="L-2971"><a href="#L-2971"><span class="linenos">2971</span></a> <span class="k">def</span> <span class="nf">_parse_if</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-2972"><a href="#L-2972"><span class="linenos">2972</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-2973"><a href="#L-2973"><span class="linenos">2973</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-2974"><a href="#L-2974"><span class="linenos">2974</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-2975"><a href="#L-2975"><span class="linenos">2975</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-2976"><a href="#L-2976"><span class="linenos">2976</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-2977"><a href="#L-2977"><span class="linenos">2977</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-2978"><a href="#L-2978"><span class="linenos">2978</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2979"><a href="#L-2979"><span class="linenos">2979</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">)</span> +</span><span id="L-2980"><a href="#L-2980"><span class="linenos">2980</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-2981"><a href="#L-2981"><span class="linenos">2981</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ELSE</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-2982"><a href="#L-2982"><span class="linenos">2982</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">)</span> +</span><span id="L-2983"><a href="#L-2983"><span class="linenos">2983</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">condition</span><span class="p">,</span> <span class="n">true</span><span class="o">=</span><span class="n">true</span><span class="p">,</span> <span class="n">false</span><span class="o">=</span><span class="n">false</span><span class="p">)</span> +</span><span id="L-2984"><a href="#L-2984"><span class="linenos">2984</span></a> +</span><span id="L-2985"><a href="#L-2985"><span class="linenos">2985</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-2986"><a href="#L-2986"><span class="linenos">2986</span></a> +</span><span id="L-2987"><a href="#L-2987"><span class="linenos">2987</span></a> <span class="k">def</span> <span class="nf">_parse_extract</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2988"><a href="#L-2988"><span class="linenos">2988</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_type</span><span class="p">()</span> +</span><span id="L-2989"><a href="#L-2989"><span class="linenos">2989</span></a> +</span><span id="L-2990"><a href="#L-2990"><span class="linenos">2990</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">):</span> +</span><span id="L-2991"><a href="#L-2991"><span class="linenos">2991</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-2992"><a href="#L-2992"><span class="linenos">2992</span></a> +</span><span id="L-2993"><a href="#L-2993"><span class="linenos">2993</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="L-2994"><a href="#L-2994"><span class="linenos">2994</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected FROM or comma after EXTRACT"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-2995"><a href="#L-2995"><span class="linenos">2995</span></a> +</span><span id="L-2996"><a href="#L-2996"><span class="linenos">2996</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-2997"><a href="#L-2997"><span class="linenos">2997</span></a> +</span><span id="L-2998"><a href="#L-2998"><span class="linenos">2998</span></a> <span class="k">def</span> <span class="nf">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-2999"><a href="#L-2999"><span class="linenos">2999</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-3000"><a href="#L-3000"><span class="linenos">3000</span></a> +</span><span id="L-3001"><a href="#L-3001"><span class="linenos">3001</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">):</span> +</span><span id="L-3002"><a href="#L-3002"><span class="linenos">3002</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected AS after CAST"</span><span class="p">)</span> +</span><span id="L-3003"><a href="#L-3003"><span class="linenos">3003</span></a> +</span><span id="L-3004"><a href="#L-3004"><span class="linenos">3004</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-3005"><a href="#L-3005"><span class="linenos">3005</span></a> +</span><span id="L-3006"><a href="#L-3006"><span class="linenos">3006</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">to</span><span class="p">:</span> +</span><span id="L-3007"><a href="#L-3007"><span class="linenos">3007</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected TYPE after CAST"</span><span class="p">)</span> +</span><span id="L-3008"><a href="#L-3008"><span class="linenos">3008</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> +</span><span id="L-3009"><a href="#L-3009"><span class="linenos">3009</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CHARACTER_SET</span><span class="p">):</span> +</span><span id="L-3010"><a href="#L-3010"><span class="linenos">3010</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">())</span> +</span><span id="L-3011"><a href="#L-3011"><span class="linenos">3011</span></a> +</span><span id="L-3012"><a href="#L-3012"><span class="linenos">3012</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-3013"><a href="#L-3013"><span class="linenos">3013</span></a> +</span><span id="L-3014"><a href="#L-3014"><span class="linenos">3014</span></a> <span class="k">def</span> <span class="nf">_parse_string_agg</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3015"><a href="#L-3015"><span class="linenos">3015</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-3016"><a href="#L-3016"><span class="linenos">3016</span></a> +</span><span id="L-3017"><a href="#L-3017"><span class="linenos">3017</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">):</span> +</span><span id="L-3018"><a href="#L-3018"><span class="linenos">3018</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-3019"><a href="#L-3019"><span class="linenos">3019</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)])</span> +</span><span id="L-3020"><a href="#L-3020"><span class="linenos">3020</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3021"><a href="#L-3021"><span class="linenos">3021</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-3022"><a href="#L-3022"><span class="linenos">3022</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-3023"><a href="#L-3023"><span class="linenos">3023</span></a> +</span><span id="L-3024"><a href="#L-3024"><span class="linenos">3024</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-3025"><a href="#L-3025"><span class="linenos">3025</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">):</span> +</span><span id="L-3026"><a href="#L-3026"><span class="linenos">3026</span></a> <span class="c1"># postgres: STRING_AGG([DISTINCT] expression, separator [ORDER BY expression1 {ASC | DESC} [, ...]])</span> +</span><span id="L-3027"><a href="#L-3027"><span class="linenos">3027</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-3028"><a href="#L-3028"><span class="linenos">3028</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">separator</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="L-3029"><a href="#L-3029"><span class="linenos">3029</span></a> +</span><span id="L-3030"><a href="#L-3030"><span class="linenos">3030</span></a> <span class="c1"># Checks if we can parse an order clause: WITHIN GROUP (ORDER BY <order_by_expression_list> [ASC | DESC]).</span> +</span><span id="L-3031"><a href="#L-3031"><span class="linenos">3031</span></a> <span class="c1"># This is done "manually", instead of letting _parse_window parse it into an exp.WithinGroup node, so that</span> +</span><span id="L-3032"><a href="#L-3032"><span class="linenos">3032</span></a> <span class="c1"># the STRING_AGG call is parsed like in MySQL / SQLite and can thus be transpiled more easily to them.</span> +</span><span id="L-3033"><a href="#L-3033"><span class="linenos">3033</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITHIN_GROUP</span><span class="p">):</span> +</span><span id="L-3034"><a href="#L-3034"><span class="linenos">3034</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-3035"><a href="#L-3035"><span class="linenos">3035</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-3036"><a href="#L-3036"><span class="linenos">3036</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-3037"><a href="#L-3037"><span class="linenos">3037</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3038"><a href="#L-3038"><span class="linenos">3038</span></a> +</span><span id="L-3039"><a href="#L-3039"><span class="linenos">3039</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> <span class="c1"># The corresponding match_r_paren will be called in parse_function (caller)</span> +</span><span id="L-3040"><a href="#L-3040"><span class="linenos">3040</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-3041"><a href="#L-3041"><span class="linenos">3041</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">separator</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="L-3042"><a href="#L-3042"><span class="linenos">3042</span></a> +</span><span id="L-3043"><a href="#L-3043"><span class="linenos">3043</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3044"><a href="#L-3044"><span class="linenos">3044</span></a> <span class="n">to</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="L-3045"><a href="#L-3045"><span class="linenos">3045</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="L-3046"><a href="#L-3046"><span class="linenos">3046</span></a> +</span><span id="L-3047"><a href="#L-3047"><span class="linenos">3047</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="L-3048"><a href="#L-3048"><span class="linenos">3048</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="L-3049"><a href="#L-3049"><span class="linenos">3049</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="L-3050"><a href="#L-3050"><span class="linenos">3050</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-3051"><a href="#L-3051"><span class="linenos">3051</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3052"><a href="#L-3052"><span class="linenos">3052</span></a> <span class="n">to</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3053"><a href="#L-3053"><span class="linenos">3053</span></a> +</span><span id="L-3054"><a href="#L-3054"><span class="linenos">3054</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="L-3055"><a href="#L-3055"><span class="linenos">3055</span></a> +</span><span id="L-3056"><a href="#L-3056"><span class="linenos">3056</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3057"><a href="#L-3057"><span class="linenos">3057</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="L-3058"><a href="#L-3058"><span class="linenos">3058</span></a> +</span><span id="L-3059"><a href="#L-3059"><span class="linenos">3059</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">):</span> +</span><span id="L-3060"><a href="#L-3060"><span class="linenos">3060</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3061"><a href="#L-3061"><span class="linenos">3061</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-3062"><a href="#L-3062"><span class="linenos">3062</span></a> <span class="p">)</span> +</span><span id="L-3063"><a href="#L-3063"><span class="linenos">3063</span></a> +</span><span id="L-3064"><a href="#L-3064"><span class="linenos">3064</span></a> <span class="k">if</span> <span class="n">haystack_first</span><span class="p">:</span> +</span><span id="L-3065"><a href="#L-3065"><span class="linenos">3065</span></a> <span class="n">haystack</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-3066"><a href="#L-3066"><span class="linenos">3066</span></a> <span class="n">needle</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-3067"><a href="#L-3067"><span class="linenos">3067</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3068"><a href="#L-3068"><span class="linenos">3068</span></a> <span class="n">needle</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="L-3069"><a href="#L-3069"><span class="linenos">3069</span></a> <span class="n">haystack</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-3070"><a href="#L-3070"><span class="linenos">3070</span></a> +</span><span id="L-3071"><a href="#L-3071"><span class="linenos">3071</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">haystack</span><span class="p">,</span> <span class="n">substr</span><span class="o">=</span><span class="n">needle</span><span class="p">,</span> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> +</span><span id="L-3072"><a href="#L-3072"><span class="linenos">3072</span></a> +</span><span id="L-3073"><a href="#L-3073"><span class="linenos">3073</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-3074"><a href="#L-3074"><span class="linenos">3074</span></a> +</span><span id="L-3075"><a href="#L-3075"><span class="linenos">3075</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3076"><a href="#L-3076"><span class="linenos">3076</span></a> +</span><span id="L-3077"><a href="#L-3077"><span class="linenos">3077</span></a> <span class="k">def</span> <span class="nf">_parse_join_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3078"><a href="#L-3078"><span class="linenos">3078</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">)</span> +</span><span id="L-3079"><a href="#L-3079"><span class="linenos">3079</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">func_name</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-3080"><a href="#L-3080"><span class="linenos">3080</span></a> +</span><span id="L-3081"><a href="#L-3081"><span class="linenos">3081</span></a> <span class="k">def</span> <span class="nf">_parse_substring</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3082"><a href="#L-3082"><span class="linenos">3082</span></a> <span class="c1"># Postgres supports the form: substring(string [from int] [for int])</span> +</span><span id="L-3083"><a href="#L-3083"><span class="linenos">3083</span></a> <span class="c1"># https://www.postgresql.org/docs/9.1/functions-string.html @ Table 9-6</span> +</span><span id="L-3084"><a href="#L-3084"><span class="linenos">3084</span></a> +</span><span id="L-3085"><a href="#L-3085"><span class="linenos">3085</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="L-3086"><a href="#L-3086"><span class="linenos">3086</span></a> +</span><span id="L-3087"><a href="#L-3087"><span class="linenos">3087</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">):</span> +</span><span id="L-3088"><a href="#L-3088"><span class="linenos">3088</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-3089"><a href="#L-3089"><span class="linenos">3089</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FOR</span><span class="p">):</span> +</span><span id="L-3090"><a href="#L-3090"><span class="linenos">3090</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="L-3091"><a href="#L-3091"><span class="linenos">3091</span></a> +</span><span id="L-3092"><a href="#L-3092"><span class="linenos">3092</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-3093"><a href="#L-3093"><span class="linenos">3093</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="L-3094"><a href="#L-3094"><span class="linenos">3094</span></a> +</span><span id="L-3095"><a href="#L-3095"><span class="linenos">3095</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3096"><a href="#L-3096"><span class="linenos">3096</span></a> +</span><span id="L-3097"><a href="#L-3097"><span class="linenos">3097</span></a> <span class="k">def</span> <span class="nf">_parse_trim</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3098"><a href="#L-3098"><span class="linenos">3098</span></a> <span class="c1"># https://www.w3resource.com/sql/character-functions/trim.php</span> +</span><span id="L-3099"><a href="#L-3099"><span class="linenos">3099</span></a> <span class="c1"># https://docs.oracle.com/javadb/10.8.3.0/ref/rreftrimfunc.html</span> +</span><span id="L-3100"><a href="#L-3100"><span class="linenos">3100</span></a> +</span><span id="L-3101"><a href="#L-3101"><span class="linenos">3101</span></a> <span class="n">position</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3102"><a href="#L-3102"><span class="linenos">3102</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3103"><a href="#L-3103"><span class="linenos">3103</span></a> +</span><span id="L-3104"><a href="#L-3104"><span class="linenos">3104</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRIM_TYPES</span><span class="p">):</span> +</span><span id="L-3105"><a href="#L-3105"><span class="linenos">3105</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-3106"><a href="#L-3106"><span class="linenos">3106</span></a> +</span><span id="L-3107"><a href="#L-3107"><span class="linenos">3107</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-3108"><a href="#L-3108"><span class="linenos">3108</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)):</span> +</span><span id="L-3109"><a href="#L-3109"><span class="linenos">3109</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-3110"><a href="#L-3110"><span class="linenos">3110</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3111"><a href="#L-3111"><span class="linenos">3111</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="L-3112"><a href="#L-3112"><span class="linenos">3112</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3113"><a href="#L-3113"><span class="linenos">3113</span></a> +</span><span id="L-3114"><a href="#L-3114"><span class="linenos">3114</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">):</span> +</span><span id="L-3115"><a href="#L-3115"><span class="linenos">3115</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="L-3116"><a href="#L-3116"><span class="linenos">3116</span></a> +</span><span id="L-3117"><a href="#L-3117"><span class="linenos">3117</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3118"><a href="#L-3118"><span class="linenos">3118</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">,</span> +</span><span id="L-3119"><a href="#L-3119"><span class="linenos">3119</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-3120"><a href="#L-3120"><span class="linenos">3120</span></a> <span class="n">position</span><span class="o">=</span><span class="n">position</span><span class="p">,</span> +</span><span id="L-3121"><a href="#L-3121"><span class="linenos">3121</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="L-3122"><a href="#L-3122"><span class="linenos">3122</span></a> <span class="n">collation</span><span class="o">=</span><span class="n">collation</span><span class="p">,</span> +</span><span id="L-3123"><a href="#L-3123"><span class="linenos">3123</span></a> <span class="p">)</span> +</span><span id="L-3124"><a href="#L-3124"><span class="linenos">3124</span></a> +</span><span id="L-3125"><a href="#L-3125"><span class="linenos">3125</span></a> <span class="k">def</span> <span class="nf">_parse_window_clause</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="L-3126"><a href="#L-3126"><span class="linenos">3126</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_named_window</span><span class="p">)</span> +</span><span id="L-3127"><a href="#L-3127"><span class="linenos">3127</span></a> +</span><span id="L-3128"><a href="#L-3128"><span class="linenos">3128</span></a> <span class="k">def</span> <span class="nf">_parse_named_window</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3129"><a href="#L-3129"><span class="linenos">3129</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(),</span> <span class="n">alias</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-3130"><a href="#L-3130"><span class="linenos">3130</span></a> +</span><span id="L-3131"><a href="#L-3131"><span class="linenos">3131</span></a> <span class="k">def</span> <span class="nf">_parse_window</span><span class="p">(</span> +</span><span id="L-3132"><a href="#L-3132"><span class="linenos">3132</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">alias</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-3133"><a href="#L-3133"><span class="linenos">3133</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3134"><a href="#L-3134"><span class="linenos">3134</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">):</span> +</span><span id="L-3135"><a href="#L-3135"><span class="linenos">3135</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">)</span> +</span><span id="L-3136"><a href="#L-3136"><span class="linenos">3136</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Filter</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">where</span><span class="p">)</span> +</span><span id="L-3137"><a href="#L-3137"><span class="linenos">3137</span></a> +</span><span id="L-3138"><a href="#L-3138"><span class="linenos">3138</span></a> <span class="c1"># T-SQL allows the OVER (...) syntax after WITHIN GROUP.</span> +</span><span id="L-3139"><a href="#L-3139"><span class="linenos">3139</span></a> <span class="c1"># https://learn.microsoft.com/en-us/sql/t-sql/functions/percentile-disc-transact-sql?view=sql-server-ver16</span> +</span><span id="L-3140"><a href="#L-3140"><span class="linenos">3140</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITHIN_GROUP</span><span class="p">):</span> +</span><span id="L-3141"><a href="#L-3141"><span class="linenos">3141</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">)</span> +</span><span id="L-3142"><a href="#L-3142"><span class="linenos">3142</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">order</span><span class="p">)</span> +</span><span id="L-3143"><a href="#L-3143"><span class="linenos">3143</span></a> +</span><span id="L-3144"><a href="#L-3144"><span class="linenos">3144</span></a> <span class="c1"># SQL spec defines an optional [ { IGNORE | RESPECT } NULLS ] OVER</span> +</span><span id="L-3145"><a href="#L-3145"><span class="linenos">3145</span></a> <span class="c1"># Some dialects choose to implement and some do not.</span> +</span><span id="L-3146"><a href="#L-3146"><span class="linenos">3146</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html</span> +</span><span id="L-3147"><a href="#L-3147"><span class="linenos">3147</span></a> +</span><span id="L-3148"><a href="#L-3148"><span class="linenos">3148</span></a> <span class="c1"># There is some code above in _parse_lambda that handles</span> +</span><span id="L-3149"><a href="#L-3149"><span class="linenos">3149</span></a> <span class="c1"># SELECT FIRST_VALUE(TABLE.COLUMN IGNORE|RESPECT NULLS) OVER ...</span> +</span><span id="L-3150"><a href="#L-3150"><span class="linenos">3150</span></a> +</span><span id="L-3151"><a href="#L-3151"><span class="linenos">3151</span></a> <span class="c1"># The below changes handle</span> +</span><span id="L-3152"><a href="#L-3152"><span class="linenos">3152</span></a> <span class="c1"># SELECT FIRST_VALUE(TABLE.COLUMN) IGNORE|RESPECT NULLS OVER ...</span> +</span><span id="L-3153"><a href="#L-3153"><span class="linenos">3153</span></a> +</span><span id="L-3154"><a href="#L-3154"><span class="linenos">3154</span></a> <span class="c1"># Oracle allows both formats</span> +</span><span id="L-3155"><a href="#L-3155"><span class="linenos">3155</span></a> <span class="c1"># (https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/img_text/first_value.html)</span> +</span><span id="L-3156"><a href="#L-3156"><span class="linenos">3156</span></a> <span class="c1"># and Snowflake chose to do the same for familiarity</span> +</span><span id="L-3157"><a href="#L-3157"><span class="linenos">3157</span></a> <span class="c1"># https://docs.snowflake.com/en/sql-reference/functions/first_value.html#usage-notes</span> +</span><span id="L-3158"><a href="#L-3158"><span class="linenos">3158</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IGNORE_NULLS</span><span class="p">):</span> +</span><span id="L-3159"><a href="#L-3159"><span class="linenos">3159</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-3160"><a href="#L-3160"><span class="linenos">3160</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">RESPECT_NULLS</span><span class="p">):</span> +</span><span id="L-3161"><a href="#L-3161"><span class="linenos">3161</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RespectNulls</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-3162"><a href="#L-3162"><span class="linenos">3162</span></a> +</span><span id="L-3163"><a href="#L-3163"><span class="linenos">3163</span></a> <span class="c1"># bigquery select from window x AS (partition by ...)</span> +</span><span id="L-3164"><a href="#L-3164"><span class="linenos">3164</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-3165"><a href="#L-3165"><span class="linenos">3165</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-3166"><a href="#L-3166"><span class="linenos">3166</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OVER</span><span class="p">):</span> +</span><span id="L-3167"><a href="#L-3167"><span class="linenos">3167</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3168"><a href="#L-3168"><span class="linenos">3168</span></a> +</span><span id="L-3169"><a href="#L-3169"><span class="linenos">3169</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-3170"><a href="#L-3170"><span class="linenos">3170</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="kc">False</span><span class="p">))</span> +</span><span id="L-3171"><a href="#L-3171"><span class="linenos">3171</span></a> +</span><span id="L-3172"><a href="#L-3172"><span class="linenos">3172</span></a> <span class="n">window_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">WINDOW_ALIAS_TOKENS</span><span class="p">)</span> +</span><span id="L-3173"><a href="#L-3173"><span class="linenos">3173</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition_by</span><span class="p">()</span> +</span><span id="L-3174"><a href="#L-3174"><span class="linenos">3174</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">()</span> +</span><span id="L-3175"><a href="#L-3175"><span class="linenos">3175</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RANGE</span><span class="p">))</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-3176"><a href="#L-3176"><span class="linenos">3176</span></a> +</span><span id="L-3177"><a href="#L-3177"><span class="linenos">3177</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="L-3178"><a href="#L-3178"><span class="linenos">3178</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span> +</span><span id="L-3179"><a href="#L-3179"><span class="linenos">3179</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window_spec</span><span class="p">()</span> +</span><span id="L-3180"><a href="#L-3180"><span class="linenos">3180</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">)</span> +</span><span id="L-3181"><a href="#L-3181"><span class="linenos">3181</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window_spec</span><span class="p">()</span> +</span><span id="L-3182"><a href="#L-3182"><span class="linenos">3182</span></a> +</span><span id="L-3183"><a href="#L-3183"><span class="linenos">3183</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3184"><a href="#L-3184"><span class="linenos">3184</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">,</span> +</span><span id="L-3185"><a href="#L-3185"><span class="linenos">3185</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="L-3186"><a href="#L-3186"><span class="linenos">3186</span></a> <span class="n">start</span><span class="o">=</span><span class="n">start</span><span class="p">[</span><span class="s2">"value"</span><span class="p">],</span> +</span><span id="L-3187"><a href="#L-3187"><span class="linenos">3187</span></a> <span class="n">start_side</span><span class="o">=</span><span class="n">start</span><span class="p">[</span><span class="s2">"side"</span><span class="p">],</span> +</span><span id="L-3188"><a href="#L-3188"><span class="linenos">3188</span></a> <span class="n">end</span><span class="o">=</span><span class="n">end</span><span class="p">[</span><span class="s2">"value"</span><span class="p">],</span> +</span><span id="L-3189"><a href="#L-3189"><span class="linenos">3189</span></a> <span class="n">end_side</span><span class="o">=</span><span class="n">end</span><span class="p">[</span><span class="s2">"side"</span><span class="p">],</span> +</span><span id="L-3190"><a href="#L-3190"><span class="linenos">3190</span></a> <span class="p">)</span> +</span><span id="L-3191"><a href="#L-3191"><span class="linenos">3191</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3192"><a href="#L-3192"><span class="linenos">3192</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3193"><a href="#L-3193"><span class="linenos">3193</span></a> +</span><span id="L-3194"><a href="#L-3194"><span class="linenos">3194</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-3195"><a href="#L-3195"><span class="linenos">3195</span></a> +</span><span id="L-3196"><a href="#L-3196"><span class="linenos">3196</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3197"><a href="#L-3197"><span class="linenos">3197</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">,</span> +</span><span id="L-3198"><a href="#L-3198"><span class="linenos">3198</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-3199"><a href="#L-3199"><span class="linenos">3199</span></a> <span class="n">partition_by</span><span class="o">=</span><span class="n">partition</span><span class="p">,</span> +</span><span id="L-3200"><a href="#L-3200"><span class="linenos">3200</span></a> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> +</span><span id="L-3201"><a href="#L-3201"><span class="linenos">3201</span></a> <span class="n">spec</span><span class="o">=</span><span class="n">spec</span><span class="p">,</span> +</span><span id="L-3202"><a href="#L-3202"><span class="linenos">3202</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">window_alias</span><span class="p">,</span> +</span><span id="L-3203"><a href="#L-3203"><span class="linenos">3203</span></a> <span class="p">)</span> +</span><span id="L-3204"><a href="#L-3204"><span class="linenos">3204</span></a> +</span><span id="L-3205"><a href="#L-3205"><span class="linenos">3205</span></a> <span class="k">def</span> <span class="nf">_parse_window_spec</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-3206"><a href="#L-3206"><span class="linenos">3206</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span> +</span><span id="L-3207"><a href="#L-3207"><span class="linenos">3207</span></a> +</span><span id="L-3208"><a href="#L-3208"><span class="linenos">3208</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="L-3209"><a href="#L-3209"><span class="linenos">3209</span></a> <span class="s2">"value"</span><span class="p">:</span> <span class="p">(</span> +</span><span id="L-3210"><a href="#L-3210"><span class="linenos">3210</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNBOUNDED</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_ROW</span><span class="p">))</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-3211"><a href="#L-3211"><span class="linenos">3211</span></a> <span class="p">)</span> +</span><span id="L-3212"><a href="#L-3212"><span class="linenos">3212</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> +</span><span id="L-3213"><a href="#L-3213"><span class="linenos">3213</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PRECEDING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOLLOWING</span><span class="p">))</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> +</span><span id="L-3214"><a href="#L-3214"><span class="linenos">3214</span></a> <span class="p">}</span> +</span><span id="L-3215"><a href="#L-3215"><span class="linenos">3215</span></a> +</span><span id="L-3216"><a href="#L-3216"><span class="linenos">3216</span></a> <span class="k">def</span> <span class="nf">_parse_alias</span><span class="p">(</span> +</span><span id="L-3217"><a href="#L-3217"><span class="linenos">3217</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">explicit</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-3218"><a href="#L-3218"><span class="linenos">3218</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3219"><a href="#L-3219"><span class="linenos">3219</span></a> <span class="n">any_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="L-3220"><a href="#L-3220"><span class="linenos">3220</span></a> +</span><span id="L-3221"><a href="#L-3221"><span class="linenos">3221</span></a> <span class="k">if</span> <span class="n">explicit</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">any_token</span><span class="p">:</span> +</span><span id="L-3222"><a href="#L-3222"><span class="linenos">3222</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3223"><a href="#L-3223"><span class="linenos">3223</span></a> +</span><span id="L-3224"><a href="#L-3224"><span class="linenos">3224</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-3225"><a href="#L-3225"><span class="linenos">3225</span></a> <span class="n">aliases</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3226"><a href="#L-3226"><span class="linenos">3226</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Aliases</span><span class="p">,</span> +</span><span id="L-3227"><a href="#L-3227"><span class="linenos">3227</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-3228"><a href="#L-3228"><span class="linenos">3228</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="p">)),</span> +</span><span id="L-3229"><a href="#L-3229"><span class="linenos">3229</span></a> <span class="p">)</span> +</span><span id="L-3230"><a href="#L-3230"><span class="linenos">3230</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">(</span><span class="n">aliases</span><span class="p">)</span> +</span><span id="L-3231"><a href="#L-3231"><span class="linenos">3231</span></a> <span class="k">return</span> <span class="n">aliases</span> +</span><span id="L-3232"><a href="#L-3232"><span class="linenos">3232</span></a> +</span><span id="L-3233"><a href="#L-3233"><span class="linenos">3233</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="p">)</span> +</span><span id="L-3234"><a href="#L-3234"><span class="linenos">3234</span></a> +</span><span id="L-3235"><a href="#L-3235"><span class="linenos">3235</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="L-3236"><a href="#L-3236"><span class="linenos">3236</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span> +</span><span id="L-3237"><a href="#L-3237"><span class="linenos">3237</span></a> +</span><span id="L-3238"><a href="#L-3238"><span class="linenos">3238</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3239"><a href="#L-3239"><span class="linenos">3239</span></a> +</span><span id="L-3240"><a href="#L-3240"><span class="linenos">3240</span></a> <span class="k">def</span> <span class="nf">_parse_id_var</span><span class="p">(</span> +</span><span id="L-3241"><a href="#L-3241"><span class="linenos">3241</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-3242"><a href="#L-3242"><span class="linenos">3242</span></a> <span class="n">any_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-3243"><a href="#L-3243"><span class="linenos">3243</span></a> <span class="n">tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-3244"><a href="#L-3244"><span class="linenos">3244</span></a> <span class="n">prefix_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-3245"><a href="#L-3245"><span class="linenos">3245</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3246"><a href="#L-3246"><span class="linenos">3246</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_identifier</span><span class="p">()</span> +</span><span id="L-3247"><a href="#L-3247"><span class="linenos">3247</span></a> +</span><span id="L-3248"><a href="#L-3248"><span class="linenos">3248</span></a> <span class="k">if</span> <span class="n">identifier</span><span class="p">:</span> +</span><span id="L-3249"><a href="#L-3249"><span class="linenos">3249</span></a> <span class="k">return</span> <span class="n">identifier</span> +</span><span id="L-3250"><a href="#L-3250"><span class="linenos">3250</span></a> +</span><span id="L-3251"><a href="#L-3251"><span class="linenos">3251</span></a> <span class="n">prefix</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-3252"><a href="#L-3252"><span class="linenos">3252</span></a> +</span><span id="L-3253"><a href="#L-3253"><span class="linenos">3253</span></a> <span class="k">if</span> <span class="n">prefix_tokens</span><span class="p">:</span> +</span><span id="L-3254"><a href="#L-3254"><span class="linenos">3254</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">prefix_tokens</span><span class="p">):</span> +</span><span id="L-3255"><a href="#L-3255"><span class="linenos">3255</span></a> <span class="n">prefix</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-3256"><a href="#L-3256"><span class="linenos">3256</span></a> +</span><span id="L-3257"><a href="#L-3257"><span class="linenos">3257</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">any_token</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">())</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">tokens</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span><span class="p">):</span> +</span><span id="L-3258"><a href="#L-3258"><span class="linenos">3258</span></a> <span class="n">quoted</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span> +</span><span id="L-3259"><a href="#L-3259"><span class="linenos">3259</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">prefix</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">)</span> +</span><span id="L-3260"><a href="#L-3260"><span class="linenos">3260</span></a> +</span><span id="L-3261"><a href="#L-3261"><span class="linenos">3261</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3262"><a href="#L-3262"><span class="linenos">3262</span></a> +</span><span id="L-3263"><a href="#L-3263"><span class="linenos">3263</span></a> <span class="k">def</span> <span class="nf">_parse_string</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3264"><a href="#L-3264"><span class="linenos">3264</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">):</span> +</span><span id="L-3265"><a href="#L-3265"><span class="linenos">3265</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3266"><a href="#L-3266"><span class="linenos">3266</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="L-3267"><a href="#L-3267"><span class="linenos">3267</span></a> +</span><span id="L-3268"><a href="#L-3268"><span class="linenos">3268</span></a> <span class="k">def</span> <span class="nf">_parse_number</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3269"><a href="#L-3269"><span class="linenos">3269</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">):</span> +</span><span id="L-3270"><a href="#L-3270"><span class="linenos">3270</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3271"><a href="#L-3271"><span class="linenos">3271</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="L-3272"><a href="#L-3272"><span class="linenos">3272</span></a> +</span><span id="L-3273"><a href="#L-3273"><span class="linenos">3273</span></a> <span class="k">def</span> <span class="nf">_parse_identifier</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3274"><a href="#L-3274"><span class="linenos">3274</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">):</span> +</span><span id="L-3275"><a href="#L-3275"><span class="linenos">3275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-3276"><a href="#L-3276"><span class="linenos">3276</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="L-3277"><a href="#L-3277"><span class="linenos">3277</span></a> +</span><span id="L-3278"><a href="#L-3278"><span class="linenos">3278</span></a> <span class="k">def</span> <span class="nf">_parse_var</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">any_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3279"><a href="#L-3279"><span class="linenos">3279</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">any_token</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">())</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">):</span> +</span><span id="L-3280"><a href="#L-3280"><span class="linenos">3280</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-3281"><a href="#L-3281"><span class="linenos">3281</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="L-3282"><a href="#L-3282"><span class="linenos">3282</span></a> +</span><span id="L-3283"><a href="#L-3283"><span class="linenos">3283</span></a> <span class="k">def</span> <span class="nf">_advance_any</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]:</span> +</span><span id="L-3284"><a href="#L-3284"><span class="linenos">3284</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">RESERVED_KEYWORDS</span><span class="p">:</span> +</span><span id="L-3285"><a href="#L-3285"><span class="linenos">3285</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3286"><a href="#L-3286"><span class="linenos">3286</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="L-3287"><a href="#L-3287"><span class="linenos">3287</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3288"><a href="#L-3288"><span class="linenos">3288</span></a> +</span><span id="L-3289"><a href="#L-3289"><span class="linenos">3289</span></a> <span class="k">def</span> <span class="nf">_parse_var_or_string</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3290"><a href="#L-3290"><span class="linenos">3290</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="L-3291"><a href="#L-3291"><span class="linenos">3291</span></a> +</span><span id="L-3292"><a href="#L-3292"><span class="linenos">3292</span></a> <span class="k">def</span> <span class="nf">_parse_null</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3293"><a href="#L-3293"><span class="linenos">3293</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="L-3294"><a href="#L-3294"><span class="linenos">3294</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3295"><a href="#L-3295"><span class="linenos">3295</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3296"><a href="#L-3296"><span class="linenos">3296</span></a> +</span><span id="L-3297"><a href="#L-3297"><span class="linenos">3297</span></a> <span class="k">def</span> <span class="nf">_parse_boolean</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3298"><a href="#L-3298"><span class="linenos">3298</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">):</span> +</span><span id="L-3299"><a href="#L-3299"><span class="linenos">3299</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3300"><a href="#L-3300"><span class="linenos">3300</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">):</span> +</span><span id="L-3301"><a href="#L-3301"><span class="linenos">3301</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3302"><a href="#L-3302"><span class="linenos">3302</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3303"><a href="#L-3303"><span class="linenos">3303</span></a> +</span><span id="L-3304"><a href="#L-3304"><span class="linenos">3304</span></a> <span class="k">def</span> <span class="nf">_parse_star</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3305"><a href="#L-3305"><span class="linenos">3305</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">):</span> +</span><span id="L-3306"><a href="#L-3306"><span class="linenos">3306</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3307"><a href="#L-3307"><span class="linenos">3307</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3308"><a href="#L-3308"><span class="linenos">3308</span></a> +</span><span id="L-3309"><a href="#L-3309"><span class="linenos">3309</span></a> <span class="k">def</span> <span class="nf">_parse_placeholder</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3310"><a href="#L-3310"><span class="linenos">3310</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PLACEHOLDER_PARSERS</span><span class="p">):</span> +</span><span id="L-3311"><a href="#L-3311"><span class="linenos">3311</span></a> <span class="n">placeholder</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PLACEHOLDER_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-3312"><a href="#L-3312"><span class="linenos">3312</span></a> <span class="k">if</span> <span class="n">placeholder</span><span class="p">:</span> +</span><span id="L-3313"><a href="#L-3313"><span class="linenos">3313</span></a> <span class="k">return</span> <span class="n">placeholder</span> +</span><span id="L-3314"><a href="#L-3314"><span class="linenos">3314</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> +</span><span id="L-3315"><a href="#L-3315"><span class="linenos">3315</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3316"><a href="#L-3316"><span class="linenos">3316</span></a> +</span><span id="L-3317"><a href="#L-3317"><span class="linenos">3317</span></a> <span class="k">def</span> <span class="nf">_parse_except</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="L-3318"><a href="#L-3318"><span class="linenos">3318</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">):</span> +</span><span id="L-3319"><a href="#L-3319"><span class="linenos">3319</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3320"><a href="#L-3320"><span class="linenos">3320</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-3321"><a href="#L-3321"><span class="linenos">3321</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-3322"><a href="#L-3322"><span class="linenos">3322</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="L-3323"><a href="#L-3323"><span class="linenos">3323</span></a> +</span><span id="L-3324"><a href="#L-3324"><span class="linenos">3324</span></a> <span class="k">def</span> <span class="nf">_parse_replace</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="L-3325"><a href="#L-3325"><span class="linenos">3325</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">):</span> +</span><span id="L-3326"><a href="#L-3326"><span class="linenos">3326</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3327"><a href="#L-3327"><span class="linenos">3327</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-3328"><a href="#L-3328"><span class="linenos">3328</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">)</span> +</span><span id="L-3329"><a href="#L-3329"><span class="linenos">3329</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">)</span> +</span><span id="L-3330"><a href="#L-3330"><span class="linenos">3330</span></a> +</span><span id="L-3331"><a href="#L-3331"><span class="linenos">3331</span></a> <span class="k">def</span> <span class="nf">_parse_csv</span><span class="p">(</span> +</span><span id="L-3332"><a href="#L-3332"><span class="linenos">3332</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="n">TokenType</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span> +</span><span id="L-3333"><a href="#L-3333"><span class="linenos">3333</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-3334"><a href="#L-3334"><span class="linenos">3334</span></a> <span class="n">parse_result</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="L-3335"><a href="#L-3335"><span class="linenos">3335</span></a> <span class="n">items</span> <span class="o">=</span> <span class="p">[</span><span class="n">parse_result</span><span class="p">]</span> <span class="k">if</span> <span class="n">parse_result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="p">[]</span> +</span><span id="L-3336"><a href="#L-3336"><span class="linenos">3336</span></a> +</span><span id="L-3337"><a href="#L-3337"><span class="linenos">3337</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">sep</span><span class="p">):</span> +</span><span id="L-3338"><a href="#L-3338"><span class="linenos">3338</span></a> <span class="k">if</span> <span class="n">parse_result</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="L-3339"><a href="#L-3339"><span class="linenos">3339</span></a> <span class="n">parse_result</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-3340"><a href="#L-3340"><span class="linenos">3340</span></a> +</span><span id="L-3341"><a href="#L-3341"><span class="linenos">3341</span></a> <span class="n">parse_result</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="L-3342"><a href="#L-3342"><span class="linenos">3342</span></a> <span class="k">if</span> <span class="n">parse_result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-3343"><a href="#L-3343"><span class="linenos">3343</span></a> <span class="n">items</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">parse_result</span><span class="p">)</span> +</span><span id="L-3344"><a href="#L-3344"><span class="linenos">3344</span></a> +</span><span id="L-3345"><a href="#L-3345"><span class="linenos">3345</span></a> <span class="k">return</span> <span class="n">items</span> +</span><span id="L-3346"><a href="#L-3346"><span class="linenos">3346</span></a> +</span><span id="L-3347"><a href="#L-3347"><span class="linenos">3347</span></a> <span class="k">def</span> <span class="nf">_parse_tokens</span><span class="p">(</span> +</span><span id="L-3348"><a href="#L-3348"><span class="linenos">3348</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> +</span><span id="L-3349"><a href="#L-3349"><span class="linenos">3349</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3350"><a href="#L-3350"><span class="linenos">3350</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="L-3351"><a href="#L-3351"><span class="linenos">3351</span></a> +</span><span id="L-3352"><a href="#L-3352"><span class="linenos">3352</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="L-3353"><a href="#L-3353"><span class="linenos">3353</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3354"><a href="#L-3354"><span class="linenos">3354</span></a> <span class="n">expressions</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">],</span> +</span><span id="L-3355"><a href="#L-3355"><span class="linenos">3355</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="L-3356"><a href="#L-3356"><span class="linenos">3356</span></a> <span class="n">comments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">,</span> +</span><span id="L-3357"><a href="#L-3357"><span class="linenos">3357</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">parse_method</span><span class="p">(),</span> +</span><span id="L-3358"><a href="#L-3358"><span class="linenos">3358</span></a> <span class="p">)</span> +</span><span id="L-3359"><a href="#L-3359"><span class="linenos">3359</span></a> +</span><span id="L-3360"><a href="#L-3360"><span class="linenos">3360</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3361"><a href="#L-3361"><span class="linenos">3361</span></a> +</span><span id="L-3362"><a href="#L-3362"><span class="linenos">3362</span></a> <span class="k">def</span> <span class="nf">_parse_wrapped_id_vars</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-3363"><a href="#L-3363"><span class="linenos">3363</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">)</span> +</span><span id="L-3364"><a href="#L-3364"><span class="linenos">3364</span></a> +</span><span id="L-3365"><a href="#L-3365"><span class="linenos">3365</span></a> <span class="k">def</span> <span class="nf">_parse_wrapped_csv</span><span class="p">(</span> +</span><span id="L-3366"><a href="#L-3366"><span class="linenos">3366</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="n">TokenType</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span> +</span><span id="L-3367"><a href="#L-3367"><span class="linenos">3367</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="L-3368"><a href="#L-3368"><span class="linenos">3368</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="n">parse_method</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="n">sep</span><span class="p">))</span> +</span><span id="L-3369"><a href="#L-3369"><span class="linenos">3369</span></a> +</span><span id="L-3370"><a href="#L-3370"><span class="linenos">3370</span></a> <span class="k">def</span> <span class="nf">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">:</span> +</span><span id="L-3371"><a href="#L-3371"><span class="linenos">3371</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="L-3372"><a href="#L-3372"><span class="linenos">3372</span></a> <span class="n">parse_result</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="L-3373"><a href="#L-3373"><span class="linenos">3373</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="L-3374"><a href="#L-3374"><span class="linenos">3374</span></a> <span class="k">return</span> <span class="n">parse_result</span> +</span><span id="L-3375"><a href="#L-3375"><span class="linenos">3375</span></a> +</span><span id="L-3376"><a href="#L-3376"><span class="linenos">3376</span></a> <span class="k">def</span> <span class="nf">_parse_select_or_expression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3377"><a href="#L-3377"><span class="linenos">3377</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">()</span> +</span><span id="L-3378"><a href="#L-3378"><span class="linenos">3378</span></a> +</span><span id="L-3379"><a href="#L-3379"><span class="linenos">3379</span></a> <span class="k">def</span> <span class="nf">_parse_ddl_select</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3380"><a href="#L-3380"><span class="linenos">3380</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span> +</span><span id="L-3381"><a href="#L-3381"><span class="linenos">3381</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">parse_subquery_alias</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-3382"><a href="#L-3382"><span class="linenos">3382</span></a> <span class="p">)</span> +</span><span id="L-3383"><a href="#L-3383"><span class="linenos">3383</span></a> +</span><span id="L-3384"><a href="#L-3384"><span class="linenos">3384</span></a> <span class="k">def</span> <span class="nf">_parse_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3385"><a href="#L-3385"><span class="linenos">3385</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3386"><a href="#L-3386"><span class="linenos">3386</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRANSACTION_KIND</span><span class="p">):</span> +</span><span id="L-3387"><a href="#L-3387"><span class="linenos">3387</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="L-3388"><a href="#L-3388"><span class="linenos">3388</span></a> +</span><span id="L-3389"><a href="#L-3389"><span class="linenos">3389</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">({</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> <span class="s2">"WORK"</span><span class="p">})</span> +</span><span id="L-3390"><a href="#L-3390"><span class="linenos">3390</span></a> +</span><span id="L-3391"><a href="#L-3391"><span class="linenos">3391</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-3392"><a href="#L-3392"><span class="linenos">3392</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-3393"><a href="#L-3393"><span class="linenos">3393</span></a> <span class="n">mode</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-3394"><a href="#L-3394"><span class="linenos">3394</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">):</span> +</span><span id="L-3395"><a href="#L-3395"><span class="linenos">3395</span></a> <span class="n">mode</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-3396"><a href="#L-3396"><span class="linenos">3396</span></a> +</span><span id="L-3397"><a href="#L-3397"><span class="linenos">3397</span></a> <span class="k">if</span> <span class="n">mode</span><span class="p">:</span> +</span><span id="L-3398"><a href="#L-3398"><span class="linenos">3398</span></a> <span class="n">modes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">mode</span><span class="p">))</span> +</span><span id="L-3399"><a href="#L-3399"><span class="linenos">3399</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="L-3400"><a href="#L-3400"><span class="linenos">3400</span></a> <span class="k">break</span> +</span><span id="L-3401"><a href="#L-3401"><span class="linenos">3401</span></a> +</span><span id="L-3402"><a href="#L-3402"><span class="linenos">3402</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">modes</span><span class="o">=</span><span class="n">modes</span><span class="p">)</span> +</span><span id="L-3403"><a href="#L-3403"><span class="linenos">3403</span></a> +</span><span id="L-3404"><a href="#L-3404"><span class="linenos">3404</span></a> <span class="k">def</span> <span class="nf">_parse_commit_or_rollback</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3405"><a href="#L-3405"><span class="linenos">3405</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3406"><a href="#L-3406"><span class="linenos">3406</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3407"><a href="#L-3407"><span class="linenos">3407</span></a> <span class="n">is_rollback</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLBACK</span> +</span><span id="L-3408"><a href="#L-3408"><span class="linenos">3408</span></a> +</span><span id="L-3409"><a href="#L-3409"><span class="linenos">3409</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">({</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> <span class="s2">"WORK"</span><span class="p">})</span> +</span><span id="L-3410"><a href="#L-3410"><span class="linenos">3410</span></a> +</span><span id="L-3411"><a href="#L-3411"><span class="linenos">3411</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">):</span> +</span><span id="L-3412"><a href="#L-3412"><span class="linenos">3412</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SAVEPOINT"</span><span class="p">)</span> +</span><span id="L-3413"><a href="#L-3413"><span class="linenos">3413</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-3414"><a href="#L-3414"><span class="linenos">3414</span></a> +</span><span id="L-3415"><a href="#L-3415"><span class="linenos">3415</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">):</span> +</span><span id="L-3416"><a href="#L-3416"><span class="linenos">3416</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">)</span> +</span><span id="L-3417"><a href="#L-3417"><span class="linenos">3417</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CHAIN"</span><span class="p">)</span> +</span><span id="L-3418"><a href="#L-3418"><span class="linenos">3418</span></a> +</span><span id="L-3419"><a href="#L-3419"><span class="linenos">3419</span></a> <span class="k">if</span> <span class="n">is_rollback</span><span class="p">:</span> +</span><span id="L-3420"><a href="#L-3420"><span class="linenos">3420</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Rollback</span><span class="p">,</span> <span class="n">savepoint</span><span class="o">=</span><span class="n">savepoint</span><span class="p">)</span> +</span><span id="L-3421"><a href="#L-3421"><span class="linenos">3421</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Commit</span><span class="p">,</span> <span class="n">chain</span><span class="o">=</span><span class="n">chain</span><span class="p">)</span> +</span><span id="L-3422"><a href="#L-3422"><span class="linenos">3422</span></a> +</span><span id="L-3423"><a href="#L-3423"><span class="linenos">3423</span></a> <span class="k">def</span> <span class="nf">_parse_add_column</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3424"><a href="#L-3424"><span class="linenos">3424</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">):</span> +</span><span id="L-3425"><a href="#L-3425"><span class="linenos">3425</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3426"><a href="#L-3426"><span class="linenos">3426</span></a> +</span><span id="L-3427"><a href="#L-3427"><span class="linenos">3427</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">)</span> +</span><span id="L-3428"><a href="#L-3428"><span class="linenos">3428</span></a> <span class="n">exists_column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(</span><span class="n">not_</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-3429"><a href="#L-3429"><span class="linenos">3429</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-3430"><a href="#L-3430"><span class="linenos">3430</span></a> +</span><span id="L-3431"><a href="#L-3431"><span class="linenos">3431</span></a> <span class="k">if</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="L-3432"><a href="#L-3432"><span class="linenos">3432</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">,</span> <span class="n">exists_column</span><span class="p">)</span> +</span><span id="L-3433"><a href="#L-3433"><span class="linenos">3433</span></a> +</span><span id="L-3434"><a href="#L-3434"><span class="linenos">3434</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-3435"><a href="#L-3435"><span class="linenos">3435</span></a> +</span><span id="L-3436"><a href="#L-3436"><span class="linenos">3436</span></a> <span class="k">def</span> <span class="nf">_parse_drop_column</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3437"><a href="#L-3437"><span class="linenos">3437</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop</span><span class="p">(</span><span class="n">default_kind</span><span class="o">=</span><span class="s2">"COLUMN"</span><span class="p">)</span> +</span><span id="L-3438"><a href="#L-3438"><span class="linenos">3438</span></a> +</span><span id="L-3439"><a href="#L-3439"><span class="linenos">3439</span></a> <span class="c1"># https://docs.aws.amazon.com/athena/latest/ug/alter-table-drop-partition.html</span> +</span><span id="L-3440"><a href="#L-3440"><span class="linenos">3440</span></a> <span class="k">def</span> <span class="nf">_parse_drop_partition</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exists</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3441"><a href="#L-3441"><span class="linenos">3441</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3442"><a href="#L-3442"><span class="linenos">3442</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DropPartition</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition</span><span class="p">),</span> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span> +</span><span id="L-3443"><a href="#L-3443"><span class="linenos">3443</span></a> <span class="p">)</span> +</span><span id="L-3444"><a href="#L-3444"><span class="linenos">3444</span></a> +</span><span id="L-3445"><a href="#L-3445"><span class="linenos">3445</span></a> <span class="k">def</span> <span class="nf">_parse_add_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3446"><a href="#L-3446"><span class="linenos">3446</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3447"><a href="#L-3447"><span class="linenos">3447</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="L-3448"><a href="#L-3448"><span class="linenos">3448</span></a> +</span><span id="L-3449"><a href="#L-3449"><span class="linenos">3449</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">:</span> +</span><span id="L-3450"><a href="#L-3450"><span class="linenos">3450</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="L-3451"><a href="#L-3451"><span class="linenos">3451</span></a> +</span><span id="L-3452"><a href="#L-3452"><span class="linenos">3452</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">):</span> +</span><span id="L-3453"><a href="#L-3453"><span class="linenos">3453</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="L-3454"><a href="#L-3454"><span class="linenos">3454</span></a> <span class="n">enforced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ENFORCED"</span><span class="p">)</span> +</span><span id="L-3455"><a href="#L-3455"><span class="linenos">3455</span></a> +</span><span id="L-3456"><a href="#L-3456"><span class="linenos">3456</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3457"><a href="#L-3457"><span class="linenos">3457</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">enforced</span><span class="o">=</span><span class="n">enforced</span> +</span><span id="L-3458"><a href="#L-3458"><span class="linenos">3458</span></a> <span class="p">)</span> +</span><span id="L-3459"><a href="#L-3459"><span class="linenos">3459</span></a> +</span><span id="L-3460"><a href="#L-3460"><span class="linenos">3460</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">):</span> +</span><span id="L-3461"><a href="#L-3461"><span class="linenos">3461</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_foreign_key</span><span class="p">()</span> +</span><span id="L-3462"><a href="#L-3462"><span class="linenos">3462</span></a> <span class="k">elif</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">):</span> +</span><span id="L-3463"><a href="#L-3463"><span class="linenos">3463</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary_key</span><span class="p">()</span> +</span><span id="L-3464"><a href="#L-3464"><span class="linenos">3464</span></a> +</span><span id="L-3465"><a href="#L-3465"><span class="linenos">3465</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-3466"><a href="#L-3466"><span class="linenos">3466</span></a> +</span><span id="L-3467"><a href="#L-3467"><span class="linenos">3467</span></a> <span class="k">def</span> <span class="nf">_parse_alter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3468"><a href="#L-3468"><span class="linenos">3468</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">):</span> +</span><span id="L-3469"><a href="#L-3469"><span class="linenos">3469</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_as_command</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="L-3470"><a href="#L-3470"><span class="linenos">3470</span></a> +</span><span id="L-3471"><a href="#L-3471"><span class="linenos">3471</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">()</span> +</span><span id="L-3472"><a href="#L-3472"><span class="linenos">3472</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-3473"><a href="#L-3473"><span class="linenos">3473</span></a> +</span><span id="L-3474"><a href="#L-3474"><span class="linenos">3474</span></a> <span class="n">actions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-3475"><a href="#L-3475"><span class="linenos">3475</span></a> +</span><span id="L-3476"><a href="#L-3476"><span class="linenos">3476</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-3477"><a href="#L-3477"><span class="linenos">3477</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">):</span> +</span><span id="L-3478"><a href="#L-3478"><span class="linenos">3478</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">())]</span> +</span><span id="L-3479"><a href="#L-3479"><span class="linenos">3479</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">):</span> +</span><span id="L-3480"><a href="#L-3480"><span class="linenos">3480</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ADD_CONSTRAINT_TOKENS</span><span class="p">):</span> +</span><span id="L-3481"><a href="#L-3481"><span class="linenos">3481</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_add_constraint</span><span class="p">)</span> +</span><span id="L-3482"><a href="#L-3482"><span class="linenos">3482</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3483"><a href="#L-3483"><span class="linenos">3483</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-3484"><a href="#L-3484"><span class="linenos">3484</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_add_column</span><span class="p">)</span> +</span><span id="L-3485"><a href="#L-3485"><span class="linenos">3485</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DROP"</span><span class="p">):</span> +</span><span id="L-3486"><a href="#L-3486"><span class="linenos">3486</span></a> <span class="n">partition_exists</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">()</span> +</span><span id="L-3487"><a href="#L-3487"><span class="linenos">3487</span></a> +</span><span id="L-3488"><a href="#L-3488"><span class="linenos">3488</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="L-3489"><a href="#L-3489"><span class="linenos">3489</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="L-3490"><a href="#L-3490"><span class="linenos">3490</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop_partition</span><span class="p">(</span><span class="n">exists</span><span class="o">=</span><span class="n">partition_exists</span><span class="p">)</span> +</span><span id="L-3491"><a href="#L-3491"><span class="linenos">3491</span></a> <span class="p">)</span> +</span><span id="L-3492"><a href="#L-3492"><span class="linenos">3492</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3493"><a href="#L-3493"><span class="linenos">3493</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-3494"><a href="#L-3494"><span class="linenos">3494</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop_column</span><span class="p">)</span> +</span><span id="L-3495"><a href="#L-3495"><span class="linenos">3495</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"RENAME"</span><span class="p">,</span> <span class="s2">"TO"</span><span class="p">):</span> +</span><span id="L-3496"><a href="#L-3496"><span class="linenos">3496</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-3497"><a href="#L-3497"><span class="linenos">3497</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ALTER"</span><span class="p">):</span> +</span><span id="L-3498"><a href="#L-3498"><span class="linenos">3498</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">)</span> +</span><span id="L-3499"><a href="#L-3499"><span class="linenos">3499</span></a> <span class="n">column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-3500"><a href="#L-3500"><span class="linenos">3500</span></a> +</span><span id="L-3501"><a href="#L-3501"><span class="linenos">3501</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="L-3502"><a href="#L-3502"><span class="linenos">3502</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">,</span> <span class="n">drop</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="L-3503"><a href="#L-3503"><span class="linenos">3503</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="L-3504"><a href="#L-3504"><span class="linenos">3504</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3505"><a href="#L-3505"><span class="linenos">3505</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-3506"><a href="#L-3506"><span class="linenos">3506</span></a> <span class="p">)</span> +</span><span id="L-3507"><a href="#L-3507"><span class="linenos">3507</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3508"><a href="#L-3508"><span class="linenos">3508</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SET"</span><span class="p">,</span> <span class="s2">"DATA"</span><span class="p">)</span> +</span><span id="L-3509"><a href="#L-3509"><span class="linenos">3509</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3510"><a href="#L-3510"><span class="linenos">3510</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">,</span> +</span><span id="L-3511"><a href="#L-3511"><span class="linenos">3511</span></a> <span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">,</span> +</span><span id="L-3512"><a href="#L-3512"><span class="linenos">3512</span></a> <span class="n">dtype</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TYPE"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(),</span> +</span><span id="L-3513"><a href="#L-3513"><span class="linenos">3513</span></a> <span class="n">collate</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">(),</span> +</span><span id="L-3514"><a href="#L-3514"><span class="linenos">3514</span></a> <span class="n">using</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> +</span><span id="L-3515"><a href="#L-3515"><span class="linenos">3515</span></a> <span class="p">)</span> +</span><span id="L-3516"><a href="#L-3516"><span class="linenos">3516</span></a> +</span><span id="L-3517"><a href="#L-3517"><span class="linenos">3517</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">actions</span><span class="p">)</span> +</span><span id="L-3518"><a href="#L-3518"><span class="linenos">3518</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AlterTable</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span><span class="p">,</span> <span class="n">actions</span><span class="o">=</span><span class="n">actions</span><span class="p">)</span> +</span><span id="L-3519"><a href="#L-3519"><span class="linenos">3519</span></a> +</span><span id="L-3520"><a href="#L-3520"><span class="linenos">3520</span></a> <span class="k">def</span> <span class="nf">_parse_show</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3521"><a href="#L-3521"><span class="linenos">3521</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_parser</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SHOW_PARSERS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_show_trie</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-3522"><a href="#L-3522"><span class="linenos">3522</span></a> <span class="k">if</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="L-3523"><a href="#L-3523"><span class="linenos">3523</span></a> <span class="k">return</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-3524"><a href="#L-3524"><span class="linenos">3524</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3525"><a href="#L-3525"><span class="linenos">3525</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Show</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="L-3526"><a href="#L-3526"><span class="linenos">3526</span></a> +</span><span id="L-3527"><a href="#L-3527"><span class="linenos">3527</span></a> <span class="k">def</span> <span class="nf">_default_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3528"><a href="#L-3528"><span class="linenos">3528</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3529"><a href="#L-3529"><span class="linenos">3529</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="L-3530"><a href="#L-3530"><span class="linenos">3530</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">(),</span> +</span><span id="L-3531"><a href="#L-3531"><span class="linenos">3531</span></a> <span class="p">)</span> +</span><span id="L-3532"><a href="#L-3532"><span class="linenos">3532</span></a> +</span><span id="L-3533"><a href="#L-3533"><span class="linenos">3533</span></a> <span class="k">def</span> <span class="nf">_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-3534"><a href="#L-3534"><span class="linenos">3534</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_parser</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SET_PARSERS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_trie</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-3535"><a href="#L-3535"><span class="linenos">3535</span></a> <span class="k">return</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="k">if</span> <span class="n">parser</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_default_parse_set_item</span><span class="p">()</span> +</span><span id="L-3536"><a href="#L-3536"><span class="linenos">3536</span></a> +</span><span id="L-3537"><a href="#L-3537"><span class="linenos">3537</span></a> <span class="k">def</span> <span class="nf">_parse_merge</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3538"><a href="#L-3538"><span class="linenos">3538</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">)</span> +</span><span id="L-3539"><a href="#L-3539"><span class="linenos">3539</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> +</span><span id="L-3540"><a href="#L-3540"><span class="linenos">3540</span></a> +</span><span id="L-3541"><a href="#L-3541"><span class="linenos">3541</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">)</span> +</span><span id="L-3542"><a href="#L-3542"><span class="linenos">3542</span></a> <span class="n">using</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> +</span><span id="L-3543"><a href="#L-3543"><span class="linenos">3543</span></a> +</span><span id="L-3544"><a href="#L-3544"><span class="linenos">3544</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> +</span><span id="L-3545"><a href="#L-3545"><span class="linenos">3545</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-3546"><a href="#L-3546"><span class="linenos">3546</span></a> +</span><span id="L-3547"><a href="#L-3547"><span class="linenos">3547</span></a> <span class="n">whens</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-3548"><a href="#L-3548"><span class="linenos">3548</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WHEN</span><span class="p">):</span> +</span><span id="L-3549"><a href="#L-3549"><span class="linenos">3549</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="L-3550"><a href="#L-3550"><span class="linenos">3550</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">)</span> +</span><span id="L-3551"><a href="#L-3551"><span class="linenos">3551</span></a> +</span><span id="L-3552"><a href="#L-3552"><span class="linenos">3552</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">):</span> +</span><span id="L-3553"><a href="#L-3553"><span class="linenos">3553</span></a> <span class="n">_this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_star</span><span class="p">()</span> +</span><span id="L-3554"><a href="#L-3554"><span class="linenos">3554</span></a> <span class="k">if</span> <span class="n">_this</span><span class="p">:</span> +</span><span id="L-3555"><a href="#L-3555"><span class="linenos">3555</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">_this</span><span class="p">)</span> +</span><span id="L-3556"><a href="#L-3556"><span class="linenos">3556</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3557"><a href="#L-3557"><span class="linenos">3557</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3558"><a href="#L-3558"><span class="linenos">3558</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">,</span> +</span><span id="L-3559"><a href="#L-3559"><span class="linenos">3559</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">(),</span> +</span><span id="L-3560"><a href="#L-3560"><span class="linenos">3560</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">(),</span> +</span><span id="L-3561"><a href="#L-3561"><span class="linenos">3561</span></a> <span class="p">)</span> +</span><span id="L-3562"><a href="#L-3562"><span class="linenos">3562</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">):</span> +</span><span id="L-3563"><a href="#L-3563"><span class="linenos">3563</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_star</span><span class="p">()</span> +</span><span id="L-3564"><a href="#L-3564"><span class="linenos">3564</span></a> <span class="k">if</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="L-3565"><a href="#L-3565"><span class="linenos">3565</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="L-3566"><a href="#L-3566"><span class="linenos">3566</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3567"><a href="#L-3567"><span class="linenos">3567</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3568"><a href="#L-3568"><span class="linenos">3568</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="L-3569"><a href="#L-3569"><span class="linenos">3569</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> +</span><span id="L-3570"><a href="#L-3570"><span class="linenos">3570</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="L-3571"><a href="#L-3571"><span class="linenos">3571</span></a> <span class="p">)</span> +</span><span id="L-3572"><a href="#L-3572"><span class="linenos">3572</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">):</span> +</span><span id="L-3573"><a href="#L-3573"><span class="linenos">3573</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="L-3574"><a href="#L-3574"><span class="linenos">3574</span></a> +</span><span id="L-3575"><a href="#L-3575"><span class="linenos">3575</span></a> <span class="n">whens</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">When</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">then</span><span class="o">=</span><span class="n">then</span><span class="p">))</span> +</span><span id="L-3576"><a href="#L-3576"><span class="linenos">3576</span></a> +</span><span id="L-3577"><a href="#L-3577"><span class="linenos">3577</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="L-3578"><a href="#L-3578"><span class="linenos">3578</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Merge</span><span class="p">,</span> +</span><span id="L-3579"><a href="#L-3579"><span class="linenos">3579</span></a> <span class="n">this</span><span class="o">=</span><span class="n">target</span><span class="p">,</span> +</span><span id="L-3580"><a href="#L-3580"><span class="linenos">3580</span></a> <span class="n">using</span><span class="o">=</span><span class="n">using</span><span class="p">,</span> +</span><span id="L-3581"><a href="#L-3581"><span class="linenos">3581</span></a> <span class="n">on</span><span class="o">=</span><span class="n">on</span><span class="p">,</span> +</span><span id="L-3582"><a href="#L-3582"><span class="linenos">3582</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">whens</span><span class="p">,</span> +</span><span id="L-3583"><a href="#L-3583"><span class="linenos">3583</span></a> <span class="p">)</span> +</span><span id="L-3584"><a href="#L-3584"><span class="linenos">3584</span></a> +</span><span id="L-3585"><a href="#L-3585"><span class="linenos">3585</span></a> <span class="k">def</span> <span class="nf">_parse_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-3586"><a href="#L-3586"><span class="linenos">3586</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Set</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item</span><span class="p">))</span> +</span><span id="L-3587"><a href="#L-3587"><span class="linenos">3587</span></a> +</span><span id="L-3588"><a href="#L-3588"><span class="linenos">3588</span></a> <span class="k">def</span> <span class="nf">_parse_as_command</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">:</span> +</span><span id="L-3589"><a href="#L-3589"><span class="linenos">3589</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="L-3590"><a href="#L-3590"><span class="linenos">3590</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3591"><a href="#L-3591"><span class="linenos">3591</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_find_sql</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">))</span> +</span><span id="L-3592"><a href="#L-3592"><span class="linenos">3592</span></a> +</span><span id="L-3593"><a href="#L-3593"><span class="linenos">3593</span></a> <span class="k">def</span> <span class="nf">_find_parser</span><span class="p">(</span> +</span><span id="L-3594"><a href="#L-3594"><span class="linenos">3594</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parsers</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">],</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> +</span><span id="L-3595"><a href="#L-3595"><span class="linenos">3595</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]:</span> +</span><span id="L-3596"><a href="#L-3596"><span class="linenos">3596</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-3597"><a href="#L-3597"><span class="linenos">3597</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-3598"><a href="#L-3598"><span class="linenos">3598</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-3599"><a href="#L-3599"><span class="linenos">3599</span></a> <span class="c1"># The current token might be multiple words</span> +</span><span id="L-3600"><a href="#L-3600"><span class="linenos">3600</span></a> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-3601"><a href="#L-3601"><span class="linenos">3601</span></a> <span class="n">key</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="L-3602"><a href="#L-3602"><span class="linenos">3602</span></a> <span class="n">this</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="p">)</span> +</span><span id="L-3603"><a href="#L-3603"><span class="linenos">3603</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3604"><a href="#L-3604"><span class="linenos">3604</span></a> <span class="n">result</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> +</span><span id="L-3605"><a href="#L-3605"><span class="linenos">3605</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-3606"><a href="#L-3606"><span class="linenos">3606</span></a> <span class="k">break</span> +</span><span id="L-3607"><a href="#L-3607"><span class="linenos">3607</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-3608"><a href="#L-3608"><span class="linenos">3608</span></a> <span class="n">subparser</span> <span class="o">=</span> <span class="n">parsers</span><span class="p">[</span><span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">this</span><span class="p">)]</span> +</span><span id="L-3609"><a href="#L-3609"><span class="linenos">3609</span></a> <span class="k">return</span> <span class="n">subparser</span> +</span><span id="L-3610"><a href="#L-3610"><span class="linenos">3610</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-3611"><a href="#L-3611"><span class="linenos">3611</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3612"><a href="#L-3612"><span class="linenos">3612</span></a> +</span><span id="L-3613"><a href="#L-3613"><span class="linenos">3613</span></a> <span class="k">def</span> <span class="nf">_match</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-3614"><a href="#L-3614"><span class="linenos">3614</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="L-3615"><a href="#L-3615"><span class="linenos">3615</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3616"><a href="#L-3616"><span class="linenos">3616</span></a> +</span><span id="L-3617"><a href="#L-3617"><span class="linenos">3617</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">token_type</span><span class="p">:</span> +</span><span id="L-3618"><a href="#L-3618"><span class="linenos">3618</span></a> <span class="k">if</span> <span class="n">advance</span><span class="p">:</span> +</span><span id="L-3619"><a href="#L-3619"><span class="linenos">3619</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3620"><a href="#L-3620"><span class="linenos">3620</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-3621"><a href="#L-3621"><span class="linenos">3621</span></a> +</span><span id="L-3622"><a href="#L-3622"><span class="linenos">3622</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3623"><a href="#L-3623"><span class="linenos">3623</span></a> +</span><span id="L-3624"><a href="#L-3624"><span class="linenos">3624</span></a> <span class="k">def</span> <span class="nf">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">types</span><span class="p">):</span> +</span><span id="L-3625"><a href="#L-3625"><span class="linenos">3625</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="L-3626"><a href="#L-3626"><span class="linenos">3626</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3627"><a href="#L-3627"><span class="linenos">3627</span></a> +</span><span id="L-3628"><a href="#L-3628"><span class="linenos">3628</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="n">types</span><span class="p">:</span> +</span><span id="L-3629"><a href="#L-3629"><span class="linenos">3629</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3630"><a href="#L-3630"><span class="linenos">3630</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-3631"><a href="#L-3631"><span class="linenos">3631</span></a> +</span><span id="L-3632"><a href="#L-3632"><span class="linenos">3632</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3633"><a href="#L-3633"><span class="linenos">3633</span></a> +</span><span id="L-3634"><a href="#L-3634"><span class="linenos">3634</span></a> <span class="k">def</span> <span class="nf">_match_pair</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type_a</span><span class="p">,</span> <span class="n">token_type_b</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-3635"><a href="#L-3635"><span class="linenos">3635</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="p">:</span> +</span><span id="L-3636"><a href="#L-3636"><span class="linenos">3636</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3637"><a href="#L-3637"><span class="linenos">3637</span></a> +</span><span id="L-3638"><a href="#L-3638"><span class="linenos">3638</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">token_type_a</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">token_type_b</span><span class="p">:</span> +</span><span id="L-3639"><a href="#L-3639"><span class="linenos">3639</span></a> <span class="k">if</span> <span class="n">advance</span><span class="p">:</span> +</span><span id="L-3640"><a href="#L-3640"><span class="linenos">3640</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> +</span><span id="L-3641"><a href="#L-3641"><span class="linenos">3641</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-3642"><a href="#L-3642"><span class="linenos">3642</span></a> +</span><span id="L-3643"><a href="#L-3643"><span class="linenos">3643</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-3644"><a href="#L-3644"><span class="linenos">3644</span></a> +</span><span id="L-3645"><a href="#L-3645"><span class="linenos">3645</span></a> <span class="k">def</span> <span class="nf">_match_l_paren</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-3646"><a href="#L-3646"><span class="linenos">3646</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="L-3647"><a href="#L-3647"><span class="linenos">3647</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting ("</span><span class="p">)</span> +</span><span id="L-3648"><a href="#L-3648"><span class="linenos">3648</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="L-3649"><a href="#L-3649"><span class="linenos">3649</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-3650"><a href="#L-3650"><span class="linenos">3650</span></a> +</span><span id="L-3651"><a href="#L-3651"><span class="linenos">3651</span></a> <span class="k">def</span> <span class="nf">_match_r_paren</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="L-3652"><a href="#L-3652"><span class="linenos">3652</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">):</span> +</span><span id="L-3653"><a href="#L-3653"><span class="linenos">3653</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting )"</span><span class="p">)</span> +</span><span id="L-3654"><a href="#L-3654"><span class="linenos">3654</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="L-3655"><a href="#L-3655"><span class="linenos">3655</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="L-3656"><a href="#L-3656"><span class="linenos">3656</span></a> +</span><span id="L-3657"><a href="#L-3657"><span class="linenos">3657</span></a> <span class="k">def</span> <span class="nf">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">texts</span><span class="p">):</span> +</span><span id="L-3658"><a href="#L-3658"><span class="linenos">3658</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="n">texts</span><span class="p">:</span> +</span><span id="L-3659"><a href="#L-3659"><span class="linenos">3659</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3660"><a href="#L-3660"><span class="linenos">3660</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-3661"><a href="#L-3661"><span class="linenos">3661</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-3662"><a href="#L-3662"><span class="linenos">3662</span></a> +</span><span id="L-3663"><a href="#L-3663"><span class="linenos">3663</span></a> <span class="k">def</span> <span class="nf">_match_text_seq</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">texts</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="L-3664"><a href="#L-3664"><span class="linenos">3664</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="L-3665"><a href="#L-3665"><span class="linenos">3665</span></a> <span class="k">for</span> <span class="n">text</span> <span class="ow">in</span> <span class="n">texts</span><span class="p">:</span> +</span><span id="L-3666"><a href="#L-3666"><span class="linenos">3666</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="n">text</span><span class="p">:</span> +</span><span id="L-3667"><a href="#L-3667"><span class="linenos">3667</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-3668"><a href="#L-3668"><span class="linenos">3668</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-3669"><a href="#L-3669"><span class="linenos">3669</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-3670"><a href="#L-3670"><span class="linenos">3670</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-3671"><a href="#L-3671"><span class="linenos">3671</span></a> +</span><span id="L-3672"><a href="#L-3672"><span class="linenos">3672</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">advance</span><span class="p">:</span> +</span><span id="L-3673"><a href="#L-3673"><span class="linenos">3673</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-3674"><a href="#L-3674"><span class="linenos">3674</span></a> +</span><span id="L-3675"><a href="#L-3675"><span class="linenos">3675</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-3676"><a href="#L-3676"><span class="linenos">3676</span></a> +</span><span id="L-3677"><a href="#L-3677"><span class="linenos">3677</span></a> <span class="k">def</span> <span class="nf">_replace_columns_with_dots</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">):</span> +</span><span id="L-3678"><a href="#L-3678"><span class="linenos">3678</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">):</span> +</span><span id="L-3679"><a href="#L-3679"><span class="linenos">3679</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_columns_with_dots</span><span class="p">)</span> +</span><span id="L-3680"><a href="#L-3680"><span class="linenos">3680</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-3681"><a href="#L-3681"><span class="linenos">3681</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_columns_with_dots</span><span class="p">)</span> +</span><span id="L-3682"><a href="#L-3682"><span class="linenos">3682</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="L-3683"><a href="#L-3683"><span class="linenos">3683</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-3684"><a href="#L-3684"><span class="linenos">3684</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="L-3685"><a href="#L-3685"><span class="linenos">3685</span></a> <span class="k">if</span> <span class="n">table</span> +</span><span id="L-3686"><a href="#L-3686"><span class="linenos">3686</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-3687"><a href="#L-3687"><span class="linenos">3687</span></a> <span class="p">)</span> +</span><span id="L-3688"><a href="#L-3688"><span class="linenos">3688</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">):</span> +</span><span id="L-3689"><a href="#L-3689"><span class="linenos">3689</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-3690"><a href="#L-3690"><span class="linenos">3690</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="L-3691"><a href="#L-3691"><span class="linenos">3691</span></a> +</span><span id="L-3692"><a href="#L-3692"><span class="linenos">3692</span></a> <span class="k">def</span> <span class="nf">_replace_lambda</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="n">lambda_variables</span><span class="p">):</span> +</span><span id="L-3693"><a href="#L-3693"><span class="linenos">3693</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-3694"><a href="#L-3694"><span class="linenos">3694</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">lambda_variables</span><span class="p">:</span> +</span><span id="L-3695"><a href="#L-3695"><span class="linenos">3695</span></a> <span class="k">return</span> <span class="n">node</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-3696"><a href="#L-3696"><span class="linenos">3696</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + </section> + <section id="parse_var_map"> + <input id="parse_var_map-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse_var_map</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">args</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="parse_var_map-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#parse_var_map"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="parse_var_map-22"><a href="#parse_var_map-22"><span class="linenos">22</span></a><span class="k">def</span> <span class="nf">parse_var_map</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="parse_var_map-23"><a href="#parse_var_map-23"><span class="linenos">23</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="parse_var_map-24"><a href="#parse_var_map-24"><span class="linenos">24</span></a> <span class="n">values</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="parse_var_map-25"><a href="#parse_var_map-25"><span class="linenos">25</span></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">),</span> <span class="mi">2</span><span class="p">):</span> +</span><span id="parse_var_map-26"><a href="#parse_var_map-26"><span class="linenos">26</span></a> <span class="n">keys</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> +</span><span id="parse_var_map-27"><a href="#parse_var_map-27"><span class="linenos">27</span></a> <span class="n">values</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">])</span> +</span><span id="parse_var_map-28"><a href="#parse_var_map-28"><span class="linenos">28</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">VarMap</span><span class="p">(</span> +</span><span id="parse_var_map-29"><a href="#parse_var_map-29"><span class="linenos">29</span></a> <span class="n">keys</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">keys</span><span class="p">),</span> +</span><span id="parse_var_map-30"><a href="#parse_var_map-30"><span class="linenos">30</span></a> <span class="n">values</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">values</span><span class="p">),</span> +</span><span id="parse_var_map-31"><a href="#parse_var_map-31"><span class="linenos">31</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="Parser"> + <input id="Parser-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Parser</span>: + + <label class="view-source-button" for="Parser-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser-42"><a href="#Parser-42"><span class="linenos"> 42</span></a><span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Parser</span><span class="p">):</span> +</span><span id="Parser-43"><a href="#Parser-43"><span class="linenos"> 43</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-44"><a href="#Parser-44"><span class="linenos"> 44</span></a><span class="sd"> Parser consumes a list of tokens produced by the `sqlglot.tokens.Tokenizer` and produces</span> +</span><span id="Parser-45"><a href="#Parser-45"><span class="linenos"> 45</span></a><span class="sd"> a parsed syntax tree.</span> +</span><span id="Parser-46"><a href="#Parser-46"><span class="linenos"> 46</span></a> +</span><span id="Parser-47"><a href="#Parser-47"><span class="linenos"> 47</span></a><span class="sd"> Args:</span> +</span><span id="Parser-48"><a href="#Parser-48"><span class="linenos"> 48</span></a><span class="sd"> error_level: the desired error level.</span> +</span><span id="Parser-49"><a href="#Parser-49"><span class="linenos"> 49</span></a><span class="sd"> Default: ErrorLevel.RAISE</span> +</span><span id="Parser-50"><a href="#Parser-50"><span class="linenos"> 50</span></a><span class="sd"> error_message_context: determines the amount of context to capture from a</span> +</span><span id="Parser-51"><a href="#Parser-51"><span class="linenos"> 51</span></a><span class="sd"> query string when displaying the error message (in number of characters).</span> +</span><span id="Parser-52"><a href="#Parser-52"><span class="linenos"> 52</span></a><span class="sd"> Default: 50.</span> +</span><span id="Parser-53"><a href="#Parser-53"><span class="linenos"> 53</span></a><span class="sd"> index_offset: Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list.</span> +</span><span id="Parser-54"><a href="#Parser-54"><span class="linenos"> 54</span></a><span class="sd"> Default: 0</span> +</span><span id="Parser-55"><a href="#Parser-55"><span class="linenos"> 55</span></a><span class="sd"> alias_post_tablesample: If the table alias comes after tablesample.</span> +</span><span id="Parser-56"><a href="#Parser-56"><span class="linenos"> 56</span></a><span class="sd"> Default: False</span> +</span><span id="Parser-57"><a href="#Parser-57"><span class="linenos"> 57</span></a><span class="sd"> max_errors: Maximum number of error messages to include in a raised ParseError.</span> +</span><span id="Parser-58"><a href="#Parser-58"><span class="linenos"> 58</span></a><span class="sd"> This is only relevant if error_level is ErrorLevel.RAISE.</span> +</span><span id="Parser-59"><a href="#Parser-59"><span class="linenos"> 59</span></a><span class="sd"> Default: 3</span> +</span><span id="Parser-60"><a href="#Parser-60"><span class="linenos"> 60</span></a><span class="sd"> null_ordering: Indicates the default null ordering method to use if not explicitly set.</span> +</span><span id="Parser-61"><a href="#Parser-61"><span class="linenos"> 61</span></a><span class="sd"> Options are "nulls_are_small", "nulls_are_large", "nulls_are_last".</span> +</span><span id="Parser-62"><a href="#Parser-62"><span class="linenos"> 62</span></a><span class="sd"> Default: "nulls_are_small"</span> +</span><span id="Parser-63"><a href="#Parser-63"><span class="linenos"> 63</span></a><span class="sd"> """</span> +</span><span id="Parser-64"><a href="#Parser-64"><span class="linenos"> 64</span></a> +</span><span id="Parser-65"><a href="#Parser-65"><span class="linenos"> 65</span></a> <span class="n">FUNCTIONS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-66"><a href="#Parser-66"><span class="linenos"> 66</span></a> <span class="o">**</span><span class="p">{</span><span class="n">name</span><span class="p">:</span> <span class="n">f</span><span class="o">.</span><span class="n">from_arg_list</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">exp</span><span class="o">.</span><span class="n">ALL_FUNCTIONS</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">f</span><span class="o">.</span><span class="n">sql_names</span><span class="p">()},</span> +</span><span id="Parser-67"><a href="#Parser-67"><span class="linenos"> 67</span></a> <span class="s2">"DATE_TO_DATE_STR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="Parser-68"><a href="#Parser-68"><span class="linenos"> 68</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Parser-69"><a href="#Parser-69"><span class="linenos"> 69</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">),</span> +</span><span id="Parser-70"><a href="#Parser-70"><span class="linenos"> 70</span></a> <span class="p">),</span> +</span><span id="Parser-71"><a href="#Parser-71"><span class="linenos"> 71</span></a> <span class="s2">"TIME_TO_TIME_STR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="Parser-72"><a href="#Parser-72"><span class="linenos"> 72</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Parser-73"><a href="#Parser-73"><span class="linenos"> 73</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">),</span> +</span><span id="Parser-74"><a href="#Parser-74"><span class="linenos"> 74</span></a> <span class="p">),</span> +</span><span id="Parser-75"><a href="#Parser-75"><span class="linenos"> 75</span></a> <span class="s2">"TS_OR_DS_TO_DATE_STR"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="p">(</span> +</span><span id="Parser-76"><a href="#Parser-76"><span class="linenos"> 76</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">(</span> +</span><span id="Parser-77"><a href="#Parser-77"><span class="linenos"> 77</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Parser-78"><a href="#Parser-78"><span class="linenos"> 78</span></a> <span class="n">to</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TEXT</span><span class="p">),</span> +</span><span id="Parser-79"><a href="#Parser-79"><span class="linenos"> 79</span></a> <span class="p">),</span> +</span><span id="Parser-80"><a href="#Parser-80"><span class="linenos"> 80</span></a> <span class="n">start</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> +</span><span id="Parser-81"><a href="#Parser-81"><span class="linenos"> 81</span></a> <span class="n">length</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="mi">10</span><span class="p">),</span> +</span><span id="Parser-82"><a href="#Parser-82"><span class="linenos"> 82</span></a> <span class="p">),</span> +</span><span id="Parser-83"><a href="#Parser-83"><span class="linenos"> 83</span></a> <span class="s2">"VAR_MAP"</span><span class="p">:</span> <span class="n">parse_var_map</span><span class="p">,</span> +</span><span id="Parser-84"><a href="#Parser-84"><span class="linenos"> 84</span></a> <span class="s2">"IFNULL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Parser-85"><a href="#Parser-85"><span class="linenos"> 85</span></a> <span class="p">}</span> +</span><span id="Parser-86"><a href="#Parser-86"><span class="linenos"> 86</span></a> +</span><span id="Parser-87"><a href="#Parser-87"><span class="linenos"> 87</span></a> <span class="n">NO_PAREN_FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-88"><a href="#Parser-88"><span class="linenos"> 88</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">,</span> +</span><span id="Parser-89"><a href="#Parser-89"><span class="linenos"> 89</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentDate</span><span class="p">,</span> +</span><span id="Parser-90"><a href="#Parser-90"><span class="linenos"> 90</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIMESTAMP</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> +</span><span id="Parser-91"><a href="#Parser-91"><span class="linenos"> 91</span></a> <span class="p">}</span> +</span><span id="Parser-92"><a href="#Parser-92"><span class="linenos"> 92</span></a> +</span><span id="Parser-93"><a href="#Parser-93"><span class="linenos"> 93</span></a> <span class="n">NESTED_TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-94"><a href="#Parser-94"><span class="linenos"> 94</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="Parser-95"><a href="#Parser-95"><span class="linenos"> 95</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MAP</span><span class="p">,</span> +</span><span id="Parser-96"><a href="#Parser-96"><span class="linenos"> 96</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="Parser-97"><a href="#Parser-97"><span class="linenos"> 97</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">,</span> +</span><span id="Parser-98"><a href="#Parser-98"><span class="linenos"> 98</span></a> <span class="p">}</span> +</span><span id="Parser-99"><a href="#Parser-99"><span class="linenos"> 99</span></a> +</span><span id="Parser-100"><a href="#Parser-100"><span class="linenos"> 100</span></a> <span class="n">TYPE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-101"><a href="#Parser-101"><span class="linenos"> 101</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="Parser-102"><a href="#Parser-102"><span class="linenos"> 102</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="Parser-103"><a href="#Parser-103"><span class="linenos"> 103</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="Parser-104"><a href="#Parser-104"><span class="linenos"> 104</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="Parser-105"><a href="#Parser-105"><span class="linenos"> 105</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="Parser-106"><a href="#Parser-106"><span class="linenos"> 106</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="Parser-107"><a href="#Parser-107"><span class="linenos"> 107</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="Parser-108"><a href="#Parser-108"><span class="linenos"> 108</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="Parser-109"><a href="#Parser-109"><span class="linenos"> 109</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="Parser-110"><a href="#Parser-110"><span class="linenos"> 110</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Parser-111"><a href="#Parser-111"><span class="linenos"> 111</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="Parser-112"><a href="#Parser-112"><span class="linenos"> 112</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="Parser-113"><a href="#Parser-113"><span class="linenos"> 113</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMTEXT</span><span class="p">,</span> +</span><span id="Parser-114"><a href="#Parser-114"><span class="linenos"> 114</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGTEXT</span><span class="p">,</span> +</span><span id="Parser-115"><a href="#Parser-115"><span class="linenos"> 115</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MEDIUMBLOB</span><span class="p">,</span> +</span><span id="Parser-116"><a href="#Parser-116"><span class="linenos"> 116</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LONGBLOB</span><span class="p">,</span> +</span><span id="Parser-117"><a href="#Parser-117"><span class="linenos"> 117</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BINARY</span><span class="p">,</span> +</span><span id="Parser-118"><a href="#Parser-118"><span class="linenos"> 118</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Parser-119"><a href="#Parser-119"><span class="linenos"> 119</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSON</span><span class="p">,</span> +</span><span id="Parser-120"><a href="#Parser-120"><span class="linenos"> 120</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSONB</span><span class="p">,</span> +</span><span id="Parser-121"><a href="#Parser-121"><span class="linenos"> 121</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">,</span> +</span><span id="Parser-122"><a href="#Parser-122"><span class="linenos"> 122</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> +</span><span id="Parser-123"><a href="#Parser-123"><span class="linenos"> 123</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Parser-124"><a href="#Parser-124"><span class="linenos"> 124</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Parser-125"><a href="#Parser-125"><span class="linenos"> 125</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="Parser-126"><a href="#Parser-126"><span class="linenos"> 126</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="Parser-127"><a href="#Parser-127"><span class="linenos"> 127</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="Parser-128"><a href="#Parser-128"><span class="linenos"> 128</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="Parser-129"><a href="#Parser-129"><span class="linenos"> 129</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UUID</span><span class="p">,</span> +</span><span id="Parser-130"><a href="#Parser-130"><span class="linenos"> 130</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOGRAPHY</span><span class="p">,</span> +</span><span id="Parser-131"><a href="#Parser-131"><span class="linenos"> 131</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span> +</span><span id="Parser-132"><a href="#Parser-132"><span class="linenos"> 132</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="Parser-133"><a href="#Parser-133"><span class="linenos"> 133</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HSTORE</span><span class="p">,</span> +</span><span id="Parser-134"><a href="#Parser-134"><span class="linenos"> 134</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">,</span> +</span><span id="Parser-135"><a href="#Parser-135"><span class="linenos"> 135</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="Parser-136"><a href="#Parser-136"><span class="linenos"> 136</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SERIAL</span><span class="p">,</span> +</span><span id="Parser-137"><a href="#Parser-137"><span class="linenos"> 137</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLSERIAL</span><span class="p">,</span> +</span><span id="Parser-138"><a href="#Parser-138"><span class="linenos"> 138</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGSERIAL</span><span class="p">,</span> +</span><span id="Parser-139"><a href="#Parser-139"><span class="linenos"> 139</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">XML</span><span class="p">,</span> +</span><span id="Parser-140"><a href="#Parser-140"><span class="linenos"> 140</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUEIDENTIFIER</span><span class="p">,</span> +</span><span id="Parser-141"><a href="#Parser-141"><span class="linenos"> 141</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MONEY</span><span class="p">,</span> +</span><span id="Parser-142"><a href="#Parser-142"><span class="linenos"> 142</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLMONEY</span><span class="p">,</span> +</span><span id="Parser-143"><a href="#Parser-143"><span class="linenos"> 143</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">,</span> +</span><span id="Parser-144"><a href="#Parser-144"><span class="linenos"> 144</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IMAGE</span><span class="p">,</span> +</span><span id="Parser-145"><a href="#Parser-145"><span class="linenos"> 145</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="Parser-146"><a href="#Parser-146"><span class="linenos"> 146</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OBJECT</span><span class="p">,</span> +</span><span id="Parser-147"><a href="#Parser-147"><span class="linenos"> 147</span></a> <span class="o">*</span><span class="n">NESTED_TYPE_TOKENS</span><span class="p">,</span> +</span><span id="Parser-148"><a href="#Parser-148"><span class="linenos"> 148</span></a> <span class="p">}</span> +</span><span id="Parser-149"><a href="#Parser-149"><span class="linenos"> 149</span></a> +</span><span id="Parser-150"><a href="#Parser-150"><span class="linenos"> 150</span></a> <span class="n">SUBQUERY_PREDICATES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-151"><a href="#Parser-151"><span class="linenos"> 151</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="Parser-152"><a href="#Parser-152"><span class="linenos"> 152</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">All</span><span class="p">,</span> +</span><span id="Parser-153"><a href="#Parser-153"><span class="linenos"> 153</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXISTS</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Exists</span><span class="p">,</span> +</span><span id="Parser-154"><a href="#Parser-154"><span class="linenos"> 154</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SOME</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> +</span><span id="Parser-155"><a href="#Parser-155"><span class="linenos"> 155</span></a> <span class="p">}</span> +</span><span id="Parser-156"><a href="#Parser-156"><span class="linenos"> 156</span></a> +</span><span id="Parser-157"><a href="#Parser-157"><span class="linenos"> 157</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span><span class="o">*</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">values</span><span class="p">(),</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">}</span> +</span><span id="Parser-158"><a href="#Parser-158"><span class="linenos"> 158</span></a> +</span><span id="Parser-159"><a href="#Parser-159"><span class="linenos"> 159</span></a> <span class="n">ID_VAR_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-160"><a href="#Parser-160"><span class="linenos"> 160</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> +</span><span id="Parser-161"><a href="#Parser-161"><span class="linenos"> 161</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">,</span> +</span><span id="Parser-162"><a href="#Parser-162"><span class="linenos"> 162</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANTI</span><span class="p">,</span> +</span><span id="Parser-163"><a href="#Parser-163"><span class="linenos"> 163</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">,</span> +</span><span id="Parser-164"><a href="#Parser-164"><span class="linenos"> 164</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> +</span><span id="Parser-165"><a href="#Parser-165"><span class="linenos"> 165</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Parser-166"><a href="#Parser-166"><span class="linenos"> 166</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOTH</span><span class="p">,</span> +</span><span id="Parser-167"><a href="#Parser-167"><span class="linenos"> 167</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BUCKET</span><span class="p">,</span> +</span><span id="Parser-168"><a href="#Parser-168"><span class="linenos"> 168</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CACHE</span><span class="p">,</span> +</span><span id="Parser-169"><a href="#Parser-169"><span class="linenos"> 169</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">,</span> +</span><span id="Parser-170"><a href="#Parser-170"><span class="linenos"> 170</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">,</span> +</span><span id="Parser-171"><a href="#Parser-171"><span class="linenos"> 171</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">,</span> +</span><span id="Parser-172"><a href="#Parser-172"><span class="linenos"> 172</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Parser-173"><a href="#Parser-173"><span class="linenos"> 173</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMIT</span><span class="p">,</span> +</span><span id="Parser-174"><a href="#Parser-174"><span class="linenos"> 174</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMPOUND</span><span class="p">,</span> +</span><span id="Parser-175"><a href="#Parser-175"><span class="linenos"> 175</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">,</span> +</span><span id="Parser-176"><a href="#Parser-176"><span class="linenos"> 176</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="Parser-177"><a href="#Parser-177"><span class="linenos"> 177</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">,</span> +</span><span id="Parser-178"><a href="#Parser-178"><span class="linenos"> 178</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> +</span><span id="Parser-179"><a href="#Parser-179"><span class="linenos"> 179</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESCRIBE</span><span class="p">,</span> +</span><span id="Parser-180"><a href="#Parser-180"><span class="linenos"> 180</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DIV</span><span class="p">,</span> +</span><span id="Parser-181"><a href="#Parser-181"><span class="linenos"> 181</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">,</span> +</span><span id="Parser-182"><a href="#Parser-182"><span class="linenos"> 182</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXECUTE</span><span class="p">,</span> +</span><span id="Parser-183"><a href="#Parser-183"><span class="linenos"> 183</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ESCAPE</span><span class="p">,</span> +</span><span id="Parser-184"><a href="#Parser-184"><span class="linenos"> 184</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">,</span> +</span><span id="Parser-185"><a href="#Parser-185"><span class="linenos"> 185</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> +</span><span id="Parser-186"><a href="#Parser-186"><span class="linenos"> 186</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">,</span> +</span><span id="Parser-187"><a href="#Parser-187"><span class="linenos"> 187</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOLLOWING</span><span class="p">,</span> +</span><span id="Parser-188"><a href="#Parser-188"><span class="linenos"> 188</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">,</span> +</span><span id="Parser-189"><a href="#Parser-189"><span class="linenos"> 189</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> +</span><span id="Parser-190"><a href="#Parser-190"><span class="linenos"> 190</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GENERATED</span><span class="p">,</span> +</span><span id="Parser-191"><a href="#Parser-191"><span class="linenos"> 191</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">,</span> +</span><span id="Parser-192"><a href="#Parser-192"><span class="linenos"> 192</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">,</span> +</span><span id="Parser-193"><a href="#Parser-193"><span class="linenos"> 193</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="Parser-194"><a href="#Parser-194"><span class="linenos"> 194</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">,</span> +</span><span id="Parser-195"><a href="#Parser-195"><span class="linenos"> 195</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">,</span> +</span><span id="Parser-196"><a href="#Parser-196"><span class="linenos"> 196</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LAZY</span><span class="p">,</span> +</span><span id="Parser-197"><a href="#Parser-197"><span class="linenos"> 197</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEADING</span><span class="p">,</span> +</span><span id="Parser-198"><a href="#Parser-198"><span class="linenos"> 198</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="Parser-199"><a href="#Parser-199"><span class="linenos"> 199</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">,</span> +</span><span id="Parser-200"><a href="#Parser-200"><span class="linenos"> 200</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">,</span> +</span><span id="Parser-201"><a href="#Parser-201"><span class="linenos"> 201</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">,</span> +</span><span id="Parser-202"><a href="#Parser-202"><span class="linenos"> 202</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">,</span> +</span><span id="Parser-203"><a href="#Parser-203"><span class="linenos"> 203</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEXT</span><span class="p">,</span> +</span><span id="Parser-204"><a href="#Parser-204"><span class="linenos"> 204</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="Parser-205"><a href="#Parser-205"><span class="linenos"> 205</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ONLY</span><span class="p">,</span> +</span><span id="Parser-206"><a href="#Parser-206"><span class="linenos"> 206</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OPTIONS</span><span class="p">,</span> +</span><span id="Parser-207"><a href="#Parser-207"><span class="linenos"> 207</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ORDINALITY</span><span class="p">,</span> +</span><span id="Parser-208"><a href="#Parser-208"><span class="linenos"> 208</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">,</span> +</span><span id="Parser-209"><a href="#Parser-209"><span class="linenos"> 209</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIVOT</span><span class="p">,</span> +</span><span id="Parser-210"><a href="#Parser-210"><span class="linenos"> 210</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRECEDING</span><span class="p">,</span> +</span><span id="Parser-211"><a href="#Parser-211"><span class="linenos"> 211</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RANGE</span><span class="p">,</span> +</span><span id="Parser-212"><a href="#Parser-212"><span class="linenos"> 212</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REFERENCES</span><span class="p">,</span> +</span><span id="Parser-213"><a href="#Parser-213"><span class="linenos"> 213</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="Parser-214"><a href="#Parser-214"><span class="linenos"> 214</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> +</span><span id="Parser-215"><a href="#Parser-215"><span class="linenos"> 215</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">,</span> +</span><span id="Parser-216"><a href="#Parser-216"><span class="linenos"> 216</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="Parser-217"><a href="#Parser-217"><span class="linenos"> 217</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA_COMMENT</span><span class="p">,</span> +</span><span id="Parser-218"><a href="#Parser-218"><span class="linenos"> 218</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEED</span><span class="p">,</span> +</span><span id="Parser-219"><a href="#Parser-219"><span class="linenos"> 219</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMI</span><span class="p">,</span> +</span><span id="Parser-220"><a href="#Parser-220"><span class="linenos"> 220</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> +</span><span id="Parser-221"><a href="#Parser-221"><span class="linenos"> 221</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">,</span> +</span><span id="Parser-222"><a href="#Parser-222"><span class="linenos"> 222</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORTKEY</span><span class="p">,</span> +</span><span id="Parser-223"><a href="#Parser-223"><span class="linenos"> 223</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Parser-224"><a href="#Parser-224"><span class="linenos"> 224</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="Parser-225"><a href="#Parser-225"><span class="linenos"> 225</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="Parser-226"><a href="#Parser-226"><span class="linenos"> 226</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRAILING</span><span class="p">,</span> +</span><span id="Parser-227"><a href="#Parser-227"><span class="linenos"> 227</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">,</span> +</span><span id="Parser-228"><a href="#Parser-228"><span class="linenos"> 228</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNBOUNDED</span><span class="p">,</span> +</span><span id="Parser-229"><a href="#Parser-229"><span class="linenos"> 229</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">,</span> +</span><span id="Parser-230"><a href="#Parser-230"><span class="linenos"> 230</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNLOGGED</span><span class="p">,</span> +</span><span id="Parser-231"><a href="#Parser-231"><span class="linenos"> 231</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNPIVOT</span><span class="p">,</span> +</span><span id="Parser-232"><a href="#Parser-232"><span class="linenos"> 232</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="Parser-233"><a href="#Parser-233"><span class="linenos"> 233</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="Parser-234"><a href="#Parser-234"><span class="linenos"> 234</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="Parser-235"><a href="#Parser-235"><span class="linenos"> 235</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="Parser-236"><a href="#Parser-236"><span class="linenos"> 236</span></a> <span class="o">*</span><span class="n">SUBQUERY_PREDICATES</span><span class="p">,</span> +</span><span id="Parser-237"><a href="#Parser-237"><span class="linenos"> 237</span></a> <span class="o">*</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> +</span><span id="Parser-238"><a href="#Parser-238"><span class="linenos"> 238</span></a> <span class="o">*</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">,</span> +</span><span id="Parser-239"><a href="#Parser-239"><span class="linenos"> 239</span></a> <span class="p">}</span> +</span><span id="Parser-240"><a href="#Parser-240"><span class="linenos"> 240</span></a> +</span><span id="Parser-241"><a href="#Parser-241"><span class="linenos"> 241</span></a> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span> +</span><span id="Parser-242"><a href="#Parser-242"><span class="linenos"> 242</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">,</span> +</span><span id="Parser-243"><a href="#Parser-243"><span class="linenos"> 243</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="Parser-244"><a href="#Parser-244"><span class="linenos"> 244</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">,</span> +</span><span id="Parser-245"><a href="#Parser-245"><span class="linenos"> 245</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="Parser-246"><a href="#Parser-246"><span class="linenos"> 246</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="Parser-247"><a href="#Parser-247"><span class="linenos"> 247</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="Parser-248"><a href="#Parser-248"><span class="linenos"> 248</span></a> <span class="p">}</span> +</span><span id="Parser-249"><a href="#Parser-249"><span class="linenos"> 249</span></a> +</span><span id="Parser-250"><a href="#Parser-250"><span class="linenos"> 250</span></a> <span class="n">UPDATE_ALIAS_TOKENS</span> <span class="o">=</span> <span class="n">TABLE_ALIAS_TOKENS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">}</span> +</span><span id="Parser-251"><a href="#Parser-251"><span class="linenos"> 251</span></a> +</span><span id="Parser-252"><a href="#Parser-252"><span class="linenos"> 252</span></a> <span class="n">TRIM_TYPES</span> <span class="o">=</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LEADING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRAILING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOTH</span><span class="p">}</span> +</span><span id="Parser-253"><a href="#Parser-253"><span class="linenos"> 253</span></a> +</span><span id="Parser-254"><a href="#Parser-254"><span class="linenos"> 254</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-255"><a href="#Parser-255"><span class="linenos"> 255</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Parser-256"><a href="#Parser-256"><span class="linenos"> 256</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATE</span><span class="p">,</span> +</span><span id="Parser-257"><a href="#Parser-257"><span class="linenos"> 257</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATETIME</span><span class="p">,</span> +</span><span id="Parser-258"><a href="#Parser-258"><span class="linenos"> 258</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIMESTAMP</span><span class="p">,</span> +</span><span id="Parser-259"><a href="#Parser-259"><span class="linenos"> 259</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIME</span><span class="p">,</span> +</span><span id="Parser-260"><a href="#Parser-260"><span class="linenos"> 260</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">,</span> +</span><span id="Parser-261"><a href="#Parser-261"><span class="linenos"> 261</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> +</span><span id="Parser-262"><a href="#Parser-262"><span class="linenos"> 262</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">,</span> +</span><span id="Parser-263"><a href="#Parser-263"><span class="linenos"> 263</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> +</span><span id="Parser-264"><a href="#Parser-264"><span class="linenos"> 264</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="Parser-265"><a href="#Parser-265"><span class="linenos"> 265</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">,</span> +</span><span id="Parser-266"><a href="#Parser-266"><span class="linenos"> 266</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="Parser-267"><a href="#Parser-267"><span class="linenos"> 267</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="Parser-268"><a href="#Parser-268"><span class="linenos"> 268</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">,</span> +</span><span id="Parser-269"><a href="#Parser-269"><span class="linenos"> 269</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="Parser-270"><a href="#Parser-270"><span class="linenos"> 270</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">,</span> +</span><span id="Parser-271"><a href="#Parser-271"><span class="linenos"> 271</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="Parser-272"><a href="#Parser-272"><span class="linenos"> 272</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> +</span><span id="Parser-273"><a href="#Parser-273"><span class="linenos"> 273</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNNEST</span><span class="p">,</span> +</span><span id="Parser-274"><a href="#Parser-274"><span class="linenos"> 274</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> +</span><span id="Parser-275"><a href="#Parser-275"><span class="linenos"> 275</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="Parser-276"><a href="#Parser-276"><span class="linenos"> 276</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="Parser-277"><a href="#Parser-277"><span class="linenos"> 277</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="Parser-278"><a href="#Parser-278"><span class="linenos"> 278</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="Parser-279"><a href="#Parser-279"><span class="linenos"> 279</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Parser-280"><a href="#Parser-280"><span class="linenos"> 280</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Parser-281"><a href="#Parser-281"><span class="linenos"> 281</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Parser-282"><a href="#Parser-282"><span class="linenos"> 282</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="Parser-283"><a href="#Parser-283"><span class="linenos"> 283</span></a> <span class="o">*</span><span class="n">TYPE_TOKENS</span><span class="p">,</span> +</span><span id="Parser-284"><a href="#Parser-284"><span class="linenos"> 284</span></a> <span class="o">*</span><span class="n">SUBQUERY_PREDICATES</span><span class="p">,</span> +</span><span id="Parser-285"><a href="#Parser-285"><span class="linenos"> 285</span></a> <span class="p">}</span> +</span><span id="Parser-286"><a href="#Parser-286"><span class="linenos"> 286</span></a> +</span><span id="Parser-287"><a href="#Parser-287"><span class="linenos"> 287</span></a> <span class="n">CONJUNCTION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-288"><a href="#Parser-288"><span class="linenos"> 288</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">And</span><span class="p">,</span> +</span><span id="Parser-289"><a href="#Parser-289"><span class="linenos"> 289</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OR</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Or</span><span class="p">,</span> +</span><span id="Parser-290"><a href="#Parser-290"><span class="linenos"> 290</span></a> <span class="p">}</span> +</span><span id="Parser-291"><a href="#Parser-291"><span class="linenos"> 291</span></a> +</span><span id="Parser-292"><a href="#Parser-292"><span class="linenos"> 292</span></a> <span class="n">EQUALITY</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-293"><a href="#Parser-293"><span class="linenos"> 293</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="Parser-294"><a href="#Parser-294"><span class="linenos"> 294</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="Parser-295"><a href="#Parser-295"><span class="linenos"> 295</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLSAFE_EQ</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span><span class="p">,</span> +</span><span id="Parser-296"><a href="#Parser-296"><span class="linenos"> 296</span></a> <span class="p">}</span> +</span><span id="Parser-297"><a href="#Parser-297"><span class="linenos"> 297</span></a> +</span><span id="Parser-298"><a href="#Parser-298"><span class="linenos"> 298</span></a> <span class="n">COMPARISON</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-299"><a href="#Parser-299"><span class="linenos"> 299</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> +</span><span id="Parser-300"><a href="#Parser-300"><span class="linenos"> 300</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span> +</span><span id="Parser-301"><a href="#Parser-301"><span class="linenos"> 301</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> +</span><span id="Parser-302"><a href="#Parser-302"><span class="linenos"> 302</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span> +</span><span id="Parser-303"><a href="#Parser-303"><span class="linenos"> 303</span></a> <span class="p">}</span> +</span><span id="Parser-304"><a href="#Parser-304"><span class="linenos"> 304</span></a> +</span><span id="Parser-305"><a href="#Parser-305"><span class="linenos"> 305</span></a> <span class="n">BITWISE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-306"><a href="#Parser-306"><span class="linenos"> 306</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">AMP</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseAnd</span><span class="p">,</span> +</span><span id="Parser-307"><a href="#Parser-307"><span class="linenos"> 307</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseXor</span><span class="p">,</span> +</span><span id="Parser-308"><a href="#Parser-308"><span class="linenos"> 308</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIPE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseOr</span><span class="p">,</span> +</span><span id="Parser-309"><a href="#Parser-309"><span class="linenos"> 309</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DPIPE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DPipe</span><span class="p">,</span> +</span><span id="Parser-310"><a href="#Parser-310"><span class="linenos"> 310</span></a> <span class="p">}</span> +</span><span id="Parser-311"><a href="#Parser-311"><span class="linenos"> 311</span></a> +</span><span id="Parser-312"><a href="#Parser-312"><span class="linenos"> 312</span></a> <span class="n">TERM</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-313"><a href="#Parser-313"><span class="linenos"> 313</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sub</span><span class="p">,</span> +</span><span id="Parser-314"><a href="#Parser-314"><span class="linenos"> 314</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLUS</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Add</span><span class="p">,</span> +</span><span id="Parser-315"><a href="#Parser-315"><span class="linenos"> 315</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mod</span><span class="p">,</span> +</span><span id="Parser-316"><a href="#Parser-316"><span class="linenos"> 316</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Collate</span><span class="p">,</span> +</span><span id="Parser-317"><a href="#Parser-317"><span class="linenos"> 317</span></a> <span class="p">}</span> +</span><span id="Parser-318"><a href="#Parser-318"><span class="linenos"> 318</span></a> +</span><span id="Parser-319"><a href="#Parser-319"><span class="linenos"> 319</span></a> <span class="n">FACTOR</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-320"><a href="#Parser-320"><span class="linenos"> 320</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DIV</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntDiv</span><span class="p">,</span> +</span><span id="Parser-321"><a href="#Parser-321"><span class="linenos"> 321</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LR_ARROW</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distance</span><span class="p">,</span> +</span><span id="Parser-322"><a href="#Parser-322"><span class="linenos"> 322</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SLASH</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Div</span><span class="p">,</span> +</span><span id="Parser-323"><a href="#Parser-323"><span class="linenos"> 323</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Mul</span><span class="p">,</span> +</span><span id="Parser-324"><a href="#Parser-324"><span class="linenos"> 324</span></a> <span class="p">}</span> +</span><span id="Parser-325"><a href="#Parser-325"><span class="linenos"> 325</span></a> +</span><span id="Parser-326"><a href="#Parser-326"><span class="linenos"> 326</span></a> <span class="n">TIMESTAMPS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-327"><a href="#Parser-327"><span class="linenos"> 327</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> +</span><span id="Parser-328"><a href="#Parser-328"><span class="linenos"> 328</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Parser-329"><a href="#Parser-329"><span class="linenos"> 329</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Parser-330"><a href="#Parser-330"><span class="linenos"> 330</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="Parser-331"><a href="#Parser-331"><span class="linenos"> 331</span></a> <span class="p">}</span> +</span><span id="Parser-332"><a href="#Parser-332"><span class="linenos"> 332</span></a> +</span><span id="Parser-333"><a href="#Parser-333"><span class="linenos"> 333</span></a> <span class="n">SET_OPERATIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-334"><a href="#Parser-334"><span class="linenos"> 334</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNION</span><span class="p">,</span> +</span><span id="Parser-335"><a href="#Parser-335"><span class="linenos"> 335</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERSECT</span><span class="p">,</span> +</span><span id="Parser-336"><a href="#Parser-336"><span class="linenos"> 336</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Parser-337"><a href="#Parser-337"><span class="linenos"> 337</span></a> <span class="p">}</span> +</span><span id="Parser-338"><a href="#Parser-338"><span class="linenos"> 338</span></a> +</span><span id="Parser-339"><a href="#Parser-339"><span class="linenos"> 339</span></a> <span class="n">JOIN_SIDES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-340"><a href="#Parser-340"><span class="linenos"> 340</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="Parser-341"><a href="#Parser-341"><span class="linenos"> 341</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="Parser-342"><a href="#Parser-342"><span class="linenos"> 342</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FULL</span><span class="p">,</span> +</span><span id="Parser-343"><a href="#Parser-343"><span class="linenos"> 343</span></a> <span class="p">}</span> +</span><span id="Parser-344"><a href="#Parser-344"><span class="linenos"> 344</span></a> +</span><span id="Parser-345"><a href="#Parser-345"><span class="linenos"> 345</span></a> <span class="n">JOIN_KINDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-346"><a href="#Parser-346"><span class="linenos"> 346</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INNER</span><span class="p">,</span> +</span><span id="Parser-347"><a href="#Parser-347"><span class="linenos"> 347</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">,</span> +</span><span id="Parser-348"><a href="#Parser-348"><span class="linenos"> 348</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CROSS</span><span class="p">,</span> +</span><span id="Parser-349"><a href="#Parser-349"><span class="linenos"> 349</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMI</span><span class="p">,</span> +</span><span id="Parser-350"><a href="#Parser-350"><span class="linenos"> 350</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANTI</span><span class="p">,</span> +</span><span id="Parser-351"><a href="#Parser-351"><span class="linenos"> 351</span></a> <span class="p">}</span> +</span><span id="Parser-352"><a href="#Parser-352"><span class="linenos"> 352</span></a> +</span><span id="Parser-353"><a href="#Parser-353"><span class="linenos"> 353</span></a> <span class="n">LAMBDAS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-354"><a href="#Parser-354"><span class="linenos"> 354</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-355"><a href="#Parser-355"><span class="linenos"> 355</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">,</span> +</span><span id="Parser-356"><a href="#Parser-356"><span class="linenos"> 356</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="Parser-357"><a href="#Parser-357"><span class="linenos"> 357</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_lambda</span><span class="p">,</span> <span class="p">{</span><span class="n">node</span><span class="o">.</span><span class="n">name</span> <span class="k">for</span> <span class="n">node</span> <span class="ow">in</span> <span class="n">expressions</span><span class="p">}</span> +</span><span id="Parser-358"><a href="#Parser-358"><span class="linenos"> 358</span></a> <span class="p">),</span> +</span><span id="Parser-359"><a href="#Parser-359"><span class="linenos"> 359</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Parser-360"><a href="#Parser-360"><span class="linenos"> 360</span></a> <span class="p">),</span> +</span><span id="Parser-361"><a href="#Parser-361"><span class="linenos"> 361</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-362"><a href="#Parser-362"><span class="linenos"> 362</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Kwarg</span><span class="p">,</span> +</span><span id="Parser-363"><a href="#Parser-363"><span class="linenos"> 363</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span><span class="p">),</span> +</span><span id="Parser-364"><a href="#Parser-364"><span class="linenos"> 364</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> +</span><span id="Parser-365"><a href="#Parser-365"><span class="linenos"> 365</span></a> <span class="p">),</span> +</span><span id="Parser-366"><a href="#Parser-366"><span class="linenos"> 366</span></a> <span class="p">}</span> +</span><span id="Parser-367"><a href="#Parser-367"><span class="linenos"> 367</span></a> +</span><span id="Parser-368"><a href="#Parser-368"><span class="linenos"> 368</span></a> <span class="n">COLUMN_OPERATORS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-369"><a href="#Parser-369"><span class="linenos"> 369</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-370"><a href="#Parser-370"><span class="linenos"> 370</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-371"><a href="#Parser-371"><span class="linenos"> 371</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> +</span><span id="Parser-372"><a href="#Parser-372"><span class="linenos"> 372</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-373"><a href="#Parser-373"><span class="linenos"> 373</span></a> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">,</span> +</span><span id="Parser-374"><a href="#Parser-374"><span class="linenos"> 374</span></a> <span class="p">),</span> +</span><span id="Parser-375"><a href="#Parser-375"><span class="linenos"> 375</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-376"><a href="#Parser-376"><span class="linenos"> 376</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">,</span> +</span><span id="Parser-377"><a href="#Parser-377"><span class="linenos"> 377</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-378"><a href="#Parser-378"><span class="linenos"> 378</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="Parser-379"><a href="#Parser-379"><span class="linenos"> 379</span></a> <span class="p">),</span> +</span><span id="Parser-380"><a href="#Parser-380"><span class="linenos"> 380</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-381"><a href="#Parser-381"><span class="linenos"> 381</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">,</span> +</span><span id="Parser-382"><a href="#Parser-382"><span class="linenos"> 382</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-383"><a href="#Parser-383"><span class="linenos"> 383</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="Parser-384"><a href="#Parser-384"><span class="linenos"> 384</span></a> <span class="p">),</span> +</span><span id="Parser-385"><a href="#Parser-385"><span class="linenos"> 385</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH_ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-386"><a href="#Parser-386"><span class="linenos"> 386</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtract</span><span class="p">,</span> +</span><span id="Parser-387"><a href="#Parser-387"><span class="linenos"> 387</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-388"><a href="#Parser-388"><span class="linenos"> 388</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="Parser-389"><a href="#Parser-389"><span class="linenos"> 389</span></a> <span class="p">),</span> +</span><span id="Parser-390"><a href="#Parser-390"><span class="linenos"> 390</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DHASH_ARROW</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-391"><a href="#Parser-391"><span class="linenos"> 391</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBExtractScalar</span><span class="p">,</span> +</span><span id="Parser-392"><a href="#Parser-392"><span class="linenos"> 392</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-393"><a href="#Parser-393"><span class="linenos"> 393</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">path</span><span class="p">,</span> +</span><span id="Parser-394"><a href="#Parser-394"><span class="linenos"> 394</span></a> <span class="p">),</span> +</span><span id="Parser-395"><a href="#Parser-395"><span class="linenos"> 395</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLACEHOLDER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-396"><a href="#Parser-396"><span class="linenos"> 396</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONBContains</span><span class="p">,</span> +</span><span id="Parser-397"><a href="#Parser-397"><span class="linenos"> 397</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-398"><a href="#Parser-398"><span class="linenos"> 398</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">key</span><span class="p">,</span> +</span><span id="Parser-399"><a href="#Parser-399"><span class="linenos"> 399</span></a> <span class="p">),</span> +</span><span id="Parser-400"><a href="#Parser-400"><span class="linenos"> 400</span></a> <span class="p">}</span> +</span><span id="Parser-401"><a href="#Parser-401"><span class="linenos"> 401</span></a> +</span><span id="Parser-402"><a href="#Parser-402"><span class="linenos"> 402</span></a> <span class="n">EXPRESSION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-403"><a href="#Parser-403"><span class="linenos"> 403</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">(),</span> +</span><span id="Parser-404"><a href="#Parser-404"><span class="linenos"> 404</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(),</span> +</span><span id="Parser-405"><a href="#Parser-405"><span class="linenos"> 405</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="Parser-406"><a href="#Parser-406"><span class="linenos"> 406</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_group</span><span class="p">(),</span> +</span><span id="Parser-407"><a href="#Parser-407"><span class="linenos"> 407</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(),</span> +</span><span id="Parser-408"><a href="#Parser-408"><span class="linenos"> 408</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lateral</span><span class="p">(),</span> +</span><span id="Parser-409"><a href="#Parser-409"><span class="linenos"> 409</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join</span><span class="p">(),</span> +</span><span id="Parser-410"><a href="#Parser-410"><span class="linenos"> 410</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(),</span> +</span><span id="Parser-411"><a href="#Parser-411"><span class="linenos"> 411</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CLUSTER_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">),</span> +</span><span id="Parser-412"><a href="#Parser-412"><span class="linenos"> 412</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SORT_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">),</span> +</span><span id="Parser-413"><a href="#Parser-413"><span class="linenos"> 413</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lambda</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">(),</span> +</span><span id="Parser-414"><a href="#Parser-414"><span class="linenos"> 414</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(),</span> +</span><span id="Parser-415"><a href="#Parser-415"><span class="linenos"> 415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_offset</span><span class="p">(),</span> +</span><span id="Parser-416"><a href="#Parser-416"><span class="linenos"> 416</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">(),</span> +</span><span id="Parser-417"><a href="#Parser-417"><span class="linenos"> 417</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(),</span> +</span><span id="Parser-418"><a href="#Parser-418"><span class="linenos"> 418</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Condition</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> +</span><span id="Parser-419"><a href="#Parser-419"><span class="linenos"> 419</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">(),</span> +</span><span id="Parser-420"><a href="#Parser-420"><span class="linenos"> 420</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">(),</span> +</span><span id="Parser-421"><a href="#Parser-421"><span class="linenos"> 421</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="Parser-422"><a href="#Parser-422"><span class="linenos"> 422</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_ordered</span><span class="p">(),</span> +</span><span id="Parser-423"><a href="#Parser-423"><span class="linenos"> 423</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_having</span><span class="p">(),</span> +</span><span id="Parser-424"><a href="#Parser-424"><span class="linenos"> 424</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_with</span><span class="p">(),</span> +</span><span id="Parser-425"><a href="#Parser-425"><span class="linenos"> 425</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_named_window</span><span class="p">(),</span> +</span><span id="Parser-426"><a href="#Parser-426"><span class="linenos"> 426</span></a> <span class="s2">"JOIN_TYPE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_side_and_kind</span><span class="p">(),</span> +</span><span id="Parser-427"><a href="#Parser-427"><span class="linenos"> 427</span></a> <span class="p">}</span> +</span><span id="Parser-428"><a href="#Parser-428"><span class="linenos"> 428</span></a> +</span><span id="Parser-429"><a href="#Parser-429"><span class="linenos"> 429</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-430"><a href="#Parser-430"><span class="linenos"> 430</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALTER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alter</span><span class="p">(),</span> +</span><span id="Parser-431"><a href="#Parser-431"><span class="linenos"> 431</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_transaction</span><span class="p">(),</span> +</span><span id="Parser-432"><a href="#Parser-432"><span class="linenos"> 432</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CACHE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_cache</span><span class="p">(),</span> +</span><span id="Parser-433"><a href="#Parser-433"><span class="linenos"> 433</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMIT</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_commit_or_rollback</span><span class="p">(),</span> +</span><span id="Parser-434"><a href="#Parser-434"><span class="linenos"> 434</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CREATE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span> +</span><span id="Parser-435"><a href="#Parser-435"><span class="linenos"> 435</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_delete</span><span class="p">(),</span> +</span><span id="Parser-436"><a href="#Parser-436"><span class="linenos"> 436</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_describe</span><span class="p">(),</span> +</span><span id="Parser-437"><a href="#Parser-437"><span class="linenos"> 437</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESCRIBE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_describe</span><span class="p">(),</span> +</span><span id="Parser-438"><a href="#Parser-438"><span class="linenos"> 438</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop</span><span class="p">(),</span> +</span><span id="Parser-439"><a href="#Parser-439"><span class="linenos"> 439</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_commit_or_rollback</span><span class="p">(),</span> +</span><span id="Parser-440"><a href="#Parser-440"><span class="linenos"> 440</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_insert</span><span class="p">(),</span> +</span><span id="Parser-441"><a href="#Parser-441"><span class="linenos"> 441</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOAD_DATA</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_load_data</span><span class="p">(),</span> +</span><span id="Parser-442"><a href="#Parser-442"><span class="linenos"> 442</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_merge</span><span class="p">(),</span> +</span><span id="Parser-443"><a href="#Parser-443"><span class="linenos"> 443</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLBACK</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_commit_or_rollback</span><span class="p">(),</span> +</span><span id="Parser-444"><a href="#Parser-444"><span class="linenos"> 444</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNCACHE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_uncache</span><span class="p">(),</span> +</span><span id="Parser-445"><a href="#Parser-445"><span class="linenos"> 445</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_update</span><span class="p">(),</span> +</span><span id="Parser-446"><a href="#Parser-446"><span class="linenos"> 446</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">USE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-447"><a href="#Parser-447"><span class="linenos"> 447</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Use</span><span class="p">,</span> +</span><span id="Parser-448"><a href="#Parser-448"><span class="linenos"> 448</span></a> <span class="n">kind</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"ROLE"</span><span class="p">,</span> <span class="s2">"WAREHOUSE"</span><span class="p">,</span> <span class="s2">"DATABASE"</span><span class="p">,</span> <span class="s2">"SCHEMA"</span><span class="p">))</span> +</span><span id="Parser-449"><a href="#Parser-449"><span class="linenos"> 449</span></a> <span class="ow">and</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="Parser-450"><a href="#Parser-450"><span class="linenos"> 450</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Parser-451"><a href="#Parser-451"><span class="linenos"> 451</span></a> <span class="p">),</span> +</span><span id="Parser-452"><a href="#Parser-452"><span class="linenos"> 452</span></a> <span class="p">}</span> +</span><span id="Parser-453"><a href="#Parser-453"><span class="linenos"> 453</span></a> +</span><span id="Parser-454"><a href="#Parser-454"><span class="linenos"> 454</span></a> <span class="n">UNARY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-455"><a href="#Parser-455"><span class="linenos"> 455</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLUS</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">(),</span> <span class="c1"># Unary + is handled as a no-op</span> +</span><span id="Parser-456"><a href="#Parser-456"><span class="linenos"> 456</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">()),</span> +</span><span id="Parser-457"><a href="#Parser-457"><span class="linenos"> 457</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TILDA</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitwiseNot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">()),</span> +</span><span id="Parser-458"><a href="#Parser-458"><span class="linenos"> 458</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">DASH</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Neg</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">()),</span> +</span><span id="Parser-459"><a href="#Parser-459"><span class="linenos"> 459</span></a> <span class="p">}</span> +</span><span id="Parser-460"><a href="#Parser-460"><span class="linenos"> 460</span></a> +</span><span id="Parser-461"><a href="#Parser-461"><span class="linenos"> 461</span></a> <span class="n">PRIMARY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-462"><a href="#Parser-462"><span class="linenos"> 462</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-463"><a href="#Parser-463"><span class="linenos"> 463</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">True</span> +</span><span id="Parser-464"><a href="#Parser-464"><span class="linenos"> 464</span></a> <span class="p">),</span> +</span><span id="Parser-465"><a href="#Parser-465"><span class="linenos"> 465</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-466"><a href="#Parser-466"><span class="linenos"> 466</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">is_string</span><span class="o">=</span><span class="kc">False</span> +</span><span id="Parser-467"><a href="#Parser-467"><span class="linenos"> 467</span></a> <span class="p">),</span> +</span><span id="Parser-468"><a href="#Parser-468"><span class="linenos"> 468</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-469"><a href="#Parser-469"><span class="linenos"> 469</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">,</span> +</span><span id="Parser-470"><a href="#Parser-470"><span class="linenos"> 470</span></a> <span class="o">**</span><span class="p">{</span><span class="s2">"except"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_except</span><span class="p">(),</span> <span class="s2">"replace"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_replace</span><span class="p">()},</span> +</span><span id="Parser-471"><a href="#Parser-471"><span class="linenos"> 471</span></a> <span class="p">),</span> +</span><span id="Parser-472"><a href="#Parser-472"><span class="linenos"> 472</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">),</span> +</span><span id="Parser-473"><a href="#Parser-473"><span class="linenos"> 473</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-474"><a href="#Parser-474"><span class="linenos"> 474</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Boolean</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Parser-475"><a href="#Parser-475"><span class="linenos"> 475</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">BitString</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="Parser-476"><a href="#Parser-476"><span class="linenos"> 476</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">HexString</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="Parser-477"><a href="#Parser-477"><span class="linenos"> 477</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BYTE_STRING</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ByteString</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">),</span> +</span><span id="Parser-478"><a href="#Parser-478"><span class="linenos"> 478</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTRODUCER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_introducer</span><span class="p">(</span><span class="n">token</span><span class="p">),</span> +</span><span id="Parser-479"><a href="#Parser-479"><span class="linenos"> 479</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATIONAL</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_national</span><span class="p">(</span><span class="n">token</span><span class="p">),</span> +</span><span id="Parser-480"><a href="#Parser-480"><span class="linenos"> 480</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SESSION_PARAMETER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">_</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_session_parameter</span><span class="p">(),</span> +</span><span id="Parser-481"><a href="#Parser-481"><span class="linenos"> 481</span></a> <span class="p">}</span> +</span><span id="Parser-482"><a href="#Parser-482"><span class="linenos"> 482</span></a> +</span><span id="Parser-483"><a href="#Parser-483"><span class="linenos"> 483</span></a> <span class="n">PLACEHOLDER_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-484"><a href="#Parser-484"><span class="linenos"> 484</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLACEHOLDER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">),</span> +</span><span id="Parser-485"><a href="#Parser-485"><span class="linenos"> 485</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-486"><a href="#Parser-486"><span class="linenos"> 486</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Parameter</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="Parser-487"><a href="#Parser-487"><span class="linenos"> 487</span></a> <span class="p">),</span> +</span><span id="Parser-488"><a href="#Parser-488"><span class="linenos"> 488</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-489"><a href="#Parser-489"><span class="linenos"> 489</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">))</span> +</span><span id="Parser-490"><a href="#Parser-490"><span class="linenos"> 490</span></a> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-491"><a href="#Parser-491"><span class="linenos"> 491</span></a> <span class="p">}</span> +</span><span id="Parser-492"><a href="#Parser-492"><span class="linenos"> 492</span></a> +</span><span id="Parser-493"><a href="#Parser-493"><span class="linenos"> 493</span></a> <span class="n">RANGE_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-494"><a href="#Parser-494"><span class="linenos"> 494</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_between</span><span class="p">(</span><span class="n">this</span><span class="p">),</span> +</span><span id="Parser-495"><a href="#Parser-495"><span class="linenos"> 495</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOB</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_escape</span><span class="p">(</span> +</span><span id="Parser-496"><a href="#Parser-496"><span class="linenos"> 496</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Glob</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-497"><a href="#Parser-497"><span class="linenos"> 497</span></a> <span class="p">),</span> +</span><span id="Parser-498"><a href="#Parser-498"><span class="linenos"> 498</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">this</span><span class="p">),</span> +</span><span id="Parser-499"><a href="#Parser-499"><span class="linenos"> 499</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IS</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_is</span><span class="p">(</span><span class="n">this</span><span class="p">),</span> +</span><span id="Parser-500"><a href="#Parser-500"><span class="linenos"> 500</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_escape</span><span class="p">(</span> +</span><span id="Parser-501"><a href="#Parser-501"><span class="linenos"> 501</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Like</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-502"><a href="#Parser-502"><span class="linenos"> 502</span></a> <span class="p">),</span> +</span><span id="Parser-503"><a href="#Parser-503"><span class="linenos"> 503</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_escape</span><span class="p">(</span> +</span><span id="Parser-504"><a href="#Parser-504"><span class="linenos"> 504</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ILike</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-505"><a href="#Parser-505"><span class="linenos"> 505</span></a> <span class="p">),</span> +</span><span id="Parser-506"><a href="#Parser-506"><span class="linenos"> 506</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IRLIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-507"><a href="#Parser-507"><span class="linenos"> 507</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpILike</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-508"><a href="#Parser-508"><span class="linenos"> 508</span></a> <span class="p">),</span> +</span><span id="Parser-509"><a href="#Parser-509"><span class="linenos"> 509</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-510"><a href="#Parser-510"><span class="linenos"> 510</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">RegexpLike</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-511"><a href="#Parser-511"><span class="linenos"> 511</span></a> <span class="p">),</span> +</span><span id="Parser-512"><a href="#Parser-512"><span class="linenos"> 512</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SIMILAR_TO</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-513"><a href="#Parser-513"><span class="linenos"> 513</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SimilarTo</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-514"><a href="#Parser-514"><span class="linenos"> 514</span></a> <span class="p">),</span> +</span><span id="Parser-515"><a href="#Parser-515"><span class="linenos"> 515</span></a> <span class="p">}</span> +</span><span id="Parser-516"><a href="#Parser-516"><span class="linenos"> 516</span></a> +</span><span id="Parser-517"><a href="#Parser-517"><span class="linenos"> 517</span></a> <span class="n">PROPERTY_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-518"><a href="#Parser-518"><span class="linenos"> 518</span></a> <span class="s2">"AUTO_INCREMENT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementProperty</span><span class="p">),</span> +</span><span id="Parser-519"><a href="#Parser-519"><span class="linenos"> 519</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_character_set</span><span class="p">(),</span> +</span><span id="Parser-520"><a href="#Parser-520"><span class="linenos"> 520</span></a> <span class="s2">"LOCATION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LocationProperty</span><span class="p">),</span> +</span><span id="Parser-521"><a href="#Parser-521"><span class="linenos"> 521</span></a> <span class="s2">"PARTITION BY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partitioned_by</span><span class="p">(),</span> +</span><span id="Parser-522"><a href="#Parser-522"><span class="linenos"> 522</span></a> <span class="s2">"PARTITIONED BY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partitioned_by</span><span class="p">(),</span> +</span><span id="Parser-523"><a href="#Parser-523"><span class="linenos"> 523</span></a> <span class="s2">"PARTITIONED_BY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partitioned_by</span><span class="p">(),</span> +</span><span id="Parser-524"><a href="#Parser-524"><span class="linenos"> 524</span></a> <span class="s2">"COMMENT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SchemaCommentProperty</span><span class="p">),</span> +</span><span id="Parser-525"><a href="#Parser-525"><span class="linenos"> 525</span></a> <span class="s2">"STORED"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">),</span> +</span><span id="Parser-526"><a href="#Parser-526"><span class="linenos"> 526</span></a> <span class="s2">"DISTKEY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_distkey</span><span class="p">(),</span> +</span><span id="Parser-527"><a href="#Parser-527"><span class="linenos"> 527</span></a> <span class="s2">"DISTSTYLE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</span><span class="p">),</span> +</span><span id="Parser-528"><a href="#Parser-528"><span class="linenos"> 528</span></a> <span class="s2">"SORTKEY"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sortkey</span><span class="p">(),</span> +</span><span id="Parser-529"><a href="#Parser-529"><span class="linenos"> 529</span></a> <span class="s2">"LIKE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create_like</span><span class="p">(),</span> +</span><span id="Parser-530"><a href="#Parser-530"><span class="linenos"> 530</span></a> <span class="s2">"RETURNS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_returns</span><span class="p">(),</span> +</span><span id="Parser-531"><a href="#Parser-531"><span class="linenos"> 531</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_row</span><span class="p">(),</span> +</span><span id="Parser-532"><a href="#Parser-532"><span class="linenos"> 532</span></a> <span class="s2">"COLLATE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CollateProperty</span><span class="p">),</span> +</span><span id="Parser-533"><a href="#Parser-533"><span class="linenos"> 533</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">FileFormatProperty</span><span class="p">),</span> +</span><span id="Parser-534"><a href="#Parser-534"><span class="linenos"> 534</span></a> <span class="s2">"TABLE_FORMAT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">),</span> +</span><span id="Parser-535"><a href="#Parser-535"><span class="linenos"> 535</span></a> <span class="s2">"USING"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableFormatProperty</span><span class="p">),</span> +</span><span id="Parser-536"><a href="#Parser-536"><span class="linenos"> 536</span></a> <span class="s2">"LANGUAGE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LanguageProperty</span><span class="p">),</span> +</span><span id="Parser-537"><a href="#Parser-537"><span class="linenos"> 537</span></a> <span class="s2">"EXECUTE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ExecuteAsProperty</span><span class="p">),</span> +</span><span id="Parser-538"><a href="#Parser-538"><span class="linenos"> 538</span></a> <span class="s2">"DETERMINISTIC"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-539"><a href="#Parser-539"><span class="linenos"> 539</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"IMMUTABLE"</span><span class="p">)</span> +</span><span id="Parser-540"><a href="#Parser-540"><span class="linenos"> 540</span></a> <span class="p">),</span> +</span><span id="Parser-541"><a href="#Parser-541"><span class="linenos"> 541</span></a> <span class="s2">"IMMUTABLE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-542"><a href="#Parser-542"><span class="linenos"> 542</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"IMMUTABLE"</span><span class="p">)</span> +</span><span id="Parser-543"><a href="#Parser-543"><span class="linenos"> 543</span></a> <span class="p">),</span> +</span><span id="Parser-544"><a href="#Parser-544"><span class="linenos"> 544</span></a> <span class="s2">"STABLE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-545"><a href="#Parser-545"><span class="linenos"> 545</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"STABLE"</span><span class="p">)</span> +</span><span id="Parser-546"><a href="#Parser-546"><span class="linenos"> 546</span></a> <span class="p">),</span> +</span><span id="Parser-547"><a href="#Parser-547"><span class="linenos"> 547</span></a> <span class="s2">"VOLATILE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-548"><a href="#Parser-548"><span class="linenos"> 548</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatilityProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">"VOLATILE"</span><span class="p">)</span> +</span><span id="Parser-549"><a href="#Parser-549"><span class="linenos"> 549</span></a> <span class="p">),</span> +</span><span id="Parser-550"><a href="#Parser-550"><span class="linenos"> 550</span></a> <span class="s2">"WITH"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_with_property</span><span class="p">(),</span> +</span><span id="Parser-551"><a href="#Parser-551"><span class="linenos"> 551</span></a> <span class="s2">"TBLPROPERTIES"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">),</span> +</span><span id="Parser-552"><a href="#Parser-552"><span class="linenos"> 552</span></a> <span class="s2">"FALLBACK"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_fallback</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">),</span> +</span><span id="Parser-553"><a href="#Parser-553"><span class="linenos"> 553</span></a> <span class="s2">"LOG"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_log</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">),</span> +</span><span id="Parser-554"><a href="#Parser-554"><span class="linenos"> 554</span></a> <span class="s2">"BEFORE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_journal</span><span class="p">(</span> +</span><span id="Parser-555"><a href="#Parser-555"><span class="linenos"> 555</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DUAL"</span> +</span><span id="Parser-556"><a href="#Parser-556"><span class="linenos"> 556</span></a> <span class="p">),</span> +</span><span id="Parser-557"><a href="#Parser-557"><span class="linenos"> 557</span></a> <span class="s2">"JOURNAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_journal</span><span class="p">(</span> +</span><span id="Parser-558"><a href="#Parser-558"><span class="linenos"> 558</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DUAL"</span> +</span><span id="Parser-559"><a href="#Parser-559"><span class="linenos"> 559</span></a> <span class="p">),</span> +</span><span id="Parser-560"><a href="#Parser-560"><span class="linenos"> 560</span></a> <span class="s2">"AFTER"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_afterjournal</span><span class="p">(</span> +</span><span id="Parser-561"><a href="#Parser-561"><span class="linenos"> 561</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DUAL"</span> +</span><span id="Parser-562"><a href="#Parser-562"><span class="linenos"> 562</span></a> <span class="p">),</span> +</span><span id="Parser-563"><a href="#Parser-563"><span class="linenos"> 563</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_afterjournal</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-564"><a href="#Parser-564"><span class="linenos"> 564</span></a> <span class="s2">"NOT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_afterjournal</span><span class="p">(</span><span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Parser-565"><a href="#Parser-565"><span class="linenos"> 565</span></a> <span class="s2">"CHECKSUM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_checksum</span><span class="p">(),</span> +</span><span id="Parser-566"><a href="#Parser-566"><span class="linenos"> 566</span></a> <span class="s2">"FREESPACE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_freespace</span><span class="p">(),</span> +</span><span id="Parser-567"><a href="#Parser-567"><span class="linenos"> 567</span></a> <span class="s2">"MERGEBLOCKRATIO"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_mergeblockratio</span><span class="p">(</span> +</span><span id="Parser-568"><a href="#Parser-568"><span class="linenos"> 568</span></a> <span class="n">no</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DEFAULT"</span> +</span><span id="Parser-569"><a href="#Parser-569"><span class="linenos"> 569</span></a> <span class="p">),</span> +</span><span id="Parser-570"><a href="#Parser-570"><span class="linenos"> 570</span></a> <span class="s2">"MIN"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="Parser-571"><a href="#Parser-571"><span class="linenos"> 571</span></a> <span class="s2">"MINIMUM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="Parser-572"><a href="#Parser-572"><span class="linenos"> 572</span></a> <span class="s2">"MAX"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="Parser-573"><a href="#Parser-573"><span class="linenos"> 573</span></a> <span class="s2">"MAXIMUM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(),</span> +</span><span id="Parser-574"><a href="#Parser-574"><span class="linenos"> 574</span></a> <span class="s2">"DATABLOCKSIZE"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_datablocksize</span><span class="p">(</span> +</span><span id="Parser-575"><a href="#Parser-575"><span class="linenos"> 575</span></a> <span class="n">default</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"DEFAULT"</span> +</span><span id="Parser-576"><a href="#Parser-576"><span class="linenos"> 576</span></a> <span class="p">),</span> +</span><span id="Parser-577"><a href="#Parser-577"><span class="linenos"> 577</span></a> <span class="s2">"BLOCKCOMPRESSION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_blockcompression</span><span class="p">(),</span> +</span><span id="Parser-578"><a href="#Parser-578"><span class="linenos"> 578</span></a> <span class="s2">"ALGORITHM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_assignment</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AlgorithmProperty</span><span class="p">),</span> +</span><span id="Parser-579"><a href="#Parser-579"><span class="linenos"> 579</span></a> <span class="s2">"DEFINER"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_definer</span><span class="p">(),</span> +</span><span id="Parser-580"><a href="#Parser-580"><span class="linenos"> 580</span></a> <span class="p">}</span> +</span><span id="Parser-581"><a href="#Parser-581"><span class="linenos"> 581</span></a> +</span><span id="Parser-582"><a href="#Parser-582"><span class="linenos"> 582</span></a> <span class="n">CONSTRAINT_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-583"><a href="#Parser-583"><span class="linenos"> 583</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-584"><a href="#Parser-584"><span class="linenos"> 584</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Check</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-585"><a href="#Parser-585"><span class="linenos"> 585</span></a> <span class="p">),</span> +</span><span id="Parser-586"><a href="#Parser-586"><span class="linenos"> 586</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_foreign_key</span><span class="p">(),</span> +</span><span id="Parser-587"><a href="#Parser-587"><span class="linenos"> 587</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unique</span><span class="p">(),</span> +</span><span id="Parser-588"><a href="#Parser-588"><span class="linenos"> 588</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create_like</span><span class="p">(),</span> +</span><span id="Parser-589"><a href="#Parser-589"><span class="linenos"> 589</span></a> <span class="p">}</span> +</span><span id="Parser-590"><a href="#Parser-590"><span class="linenos"> 590</span></a> +</span><span id="Parser-591"><a href="#Parser-591"><span class="linenos"> 591</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-592"><a href="#Parser-592"><span class="linenos"> 592</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_case</span><span class="p">(),</span> +</span><span id="Parser-593"><a href="#Parser-593"><span class="linenos"> 593</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_if</span><span class="p">(),</span> +</span><span id="Parser-594"><a href="#Parser-594"><span class="linenos"> 594</span></a> <span class="p">}</span> +</span><span id="Parser-595"><a href="#Parser-595"><span class="linenos"> 595</span></a> +</span><span id="Parser-596"><a href="#Parser-596"><span class="linenos"> 596</span></a> <span class="n">FUNCTION_PARSERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-597"><a href="#Parser-597"><span class="linenos"> 597</span></a> <span class="s2">"CONVERT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="Parser-598"><a href="#Parser-598"><span class="linenos"> 598</span></a> <span class="s2">"TRY_CONVERT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_convert</span><span class="p">(</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Parser-599"><a href="#Parser-599"><span class="linenos"> 599</span></a> <span class="s2">"EXTRACT"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_extract</span><span class="p">(),</span> +</span><span id="Parser-600"><a href="#Parser-600"><span class="linenos"> 600</span></a> <span class="s2">"POSITION"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_position</span><span class="p">(),</span> +</span><span id="Parser-601"><a href="#Parser-601"><span class="linenos"> 601</span></a> <span class="s2">"SUBSTRING"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_substring</span><span class="p">(),</span> +</span><span id="Parser-602"><a href="#Parser-602"><span class="linenos"> 602</span></a> <span class="s2">"TRIM"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_trim</span><span class="p">(),</span> +</span><span id="Parser-603"><a href="#Parser-603"><span class="linenos"> 603</span></a> <span class="s2">"CAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span> +</span><span id="Parser-604"><a href="#Parser-604"><span class="linenos"> 604</span></a> <span class="s2">"TRY_CAST"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Parser-605"><a href="#Parser-605"><span class="linenos"> 605</span></a> <span class="s2">"STRING_AGG"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string_agg</span><span class="p">(),</span> +</span><span id="Parser-606"><a href="#Parser-606"><span class="linenos"> 606</span></a> <span class="p">}</span> +</span><span id="Parser-607"><a href="#Parser-607"><span class="linenos"> 607</span></a> +</span><span id="Parser-608"><a href="#Parser-608"><span class="linenos"> 608</span></a> <span class="n">QUERY_MODIFIER_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-609"><a href="#Parser-609"><span class="linenos"> 609</span></a> <span class="s2">"match"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_match_recognize</span><span class="p">(),</span> +</span><span id="Parser-610"><a href="#Parser-610"><span class="linenos"> 610</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="Parser-611"><a href="#Parser-611"><span class="linenos"> 611</span></a> <span class="s2">"group"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_group</span><span class="p">(),</span> +</span><span id="Parser-612"><a href="#Parser-612"><span class="linenos"> 612</span></a> <span class="s2">"having"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_having</span><span class="p">(),</span> +</span><span id="Parser-613"><a href="#Parser-613"><span class="linenos"> 613</span></a> <span class="s2">"qualify"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_qualify</span><span class="p">(),</span> +</span><span id="Parser-614"><a href="#Parser-614"><span class="linenos"> 614</span></a> <span class="s2">"windows"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window_clause</span><span class="p">(),</span> +</span><span id="Parser-615"><a href="#Parser-615"><span class="linenos"> 615</span></a> <span class="s2">"distribute"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTRIBUTE_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distribute</span><span class="p">),</span> +</span><span id="Parser-616"><a href="#Parser-616"><span class="linenos"> 616</span></a> <span class="s2">"sort"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SORT_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Sort</span><span class="p">),</span> +</span><span id="Parser-617"><a href="#Parser-617"><span class="linenos"> 617</span></a> <span class="s2">"cluster"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sort</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CLUSTER_BY</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Cluster</span><span class="p">),</span> +</span><span id="Parser-618"><a href="#Parser-618"><span class="linenos"> 618</span></a> <span class="s2">"order"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(),</span> +</span><span id="Parser-619"><a href="#Parser-619"><span class="linenos"> 619</span></a> <span class="s2">"limit"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(),</span> +</span><span id="Parser-620"><a href="#Parser-620"><span class="linenos"> 620</span></a> <span class="s2">"offset"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_offset</span><span class="p">(),</span> +</span><span id="Parser-621"><a href="#Parser-621"><span class="linenos"> 621</span></a> <span class="s2">"lock"</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lock</span><span class="p">(),</span> +</span><span id="Parser-622"><a href="#Parser-622"><span class="linenos"> 622</span></a> <span class="p">}</span> +</span><span id="Parser-623"><a href="#Parser-623"><span class="linenos"> 623</span></a> +</span><span id="Parser-624"><a href="#Parser-624"><span class="linenos"> 624</span></a> <span class="n">SHOW_PARSERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Parser-625"><a href="#Parser-625"><span class="linenos"> 625</span></a> <span class="n">SET_PARSERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Parser-626"><a href="#Parser-626"><span class="linenos"> 626</span></a> +</span><span id="Parser-627"><a href="#Parser-627"><span class="linenos"> 627</span></a> <span class="n">MODIFIABLES</span> <span class="o">=</span> <span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="Parser-628"><a href="#Parser-628"><span class="linenos"> 628</span></a> +</span><span id="Parser-629"><a href="#Parser-629"><span class="linenos"> 629</span></a> <span class="n">CREATABLES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Parser-630"><a href="#Parser-630"><span class="linenos"> 630</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">,</span> +</span><span id="Parser-631"><a href="#Parser-631"><span class="linenos"> 631</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> +</span><span id="Parser-632"><a href="#Parser-632"><span class="linenos"> 632</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="Parser-633"><a href="#Parser-633"><span class="linenos"> 633</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="Parser-634"><a href="#Parser-634"><span class="linenos"> 634</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="Parser-635"><a href="#Parser-635"><span class="linenos"> 635</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Parser-636"><a href="#Parser-636"><span class="linenos"> 636</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="Parser-637"><a href="#Parser-637"><span class="linenos"> 637</span></a> <span class="p">}</span> +</span><span id="Parser-638"><a href="#Parser-638"><span class="linenos"> 638</span></a> +</span><span id="Parser-639"><a href="#Parser-639"><span class="linenos"> 639</span></a> <span class="n">TRANSACTION_KIND</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"DEFERRED"</span><span class="p">,</span> <span class="s2">"IMMEDIATE"</span><span class="p">,</span> <span class="s2">"EXCLUSIVE"</span><span class="p">}</span> +</span><span id="Parser-640"><a href="#Parser-640"><span class="linenos"> 640</span></a> +</span><span id="Parser-641"><a href="#Parser-641"><span class="linenos"> 641</span></a> <span class="n">WINDOW_ALIAS_TOKENS</span> <span class="o">=</span> <span class="n">ID_VAR_TOKENS</span> <span class="o">-</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">}</span> +</span><span id="Parser-642"><a href="#Parser-642"><span class="linenos"> 642</span></a> +</span><span id="Parser-643"><a href="#Parser-643"><span class="linenos"> 643</span></a> <span class="n">ADD_CONSTRAINT_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">}</span> +</span><span id="Parser-644"><a href="#Parser-644"><span class="linenos"> 644</span></a> +</span><span id="Parser-645"><a href="#Parser-645"><span class="linenos"> 645</span></a> <span class="n">STRICT_CAST</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-646"><a href="#Parser-646"><span class="linenos"> 646</span></a> +</span><span id="Parser-647"><a href="#Parser-647"><span class="linenos"> 647</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Parser-648"><a href="#Parser-648"><span class="linenos"> 648</span></a> <span class="s2">"error_level"</span><span class="p">,</span> +</span><span id="Parser-649"><a href="#Parser-649"><span class="linenos"> 649</span></a> <span class="s2">"error_message_context"</span><span class="p">,</span> +</span><span id="Parser-650"><a href="#Parser-650"><span class="linenos"> 650</span></a> <span class="s2">"sql"</span><span class="p">,</span> +</span><span id="Parser-651"><a href="#Parser-651"><span class="linenos"> 651</span></a> <span class="s2">"errors"</span><span class="p">,</span> +</span><span id="Parser-652"><a href="#Parser-652"><span class="linenos"> 652</span></a> <span class="s2">"index_offset"</span><span class="p">,</span> +</span><span id="Parser-653"><a href="#Parser-653"><span class="linenos"> 653</span></a> <span class="s2">"unnest_column_only"</span><span class="p">,</span> +</span><span id="Parser-654"><a href="#Parser-654"><span class="linenos"> 654</span></a> <span class="s2">"alias_post_tablesample"</span><span class="p">,</span> +</span><span id="Parser-655"><a href="#Parser-655"><span class="linenos"> 655</span></a> <span class="s2">"max_errors"</span><span class="p">,</span> +</span><span id="Parser-656"><a href="#Parser-656"><span class="linenos"> 656</span></a> <span class="s2">"null_ordering"</span><span class="p">,</span> +</span><span id="Parser-657"><a href="#Parser-657"><span class="linenos"> 657</span></a> <span class="s2">"_tokens"</span><span class="p">,</span> +</span><span id="Parser-658"><a href="#Parser-658"><span class="linenos"> 658</span></a> <span class="s2">"_index"</span><span class="p">,</span> +</span><span id="Parser-659"><a href="#Parser-659"><span class="linenos"> 659</span></a> <span class="s2">"_curr"</span><span class="p">,</span> +</span><span id="Parser-660"><a href="#Parser-660"><span class="linenos"> 660</span></a> <span class="s2">"_next"</span><span class="p">,</span> +</span><span id="Parser-661"><a href="#Parser-661"><span class="linenos"> 661</span></a> <span class="s2">"_prev"</span><span class="p">,</span> +</span><span id="Parser-662"><a href="#Parser-662"><span class="linenos"> 662</span></a> <span class="s2">"_prev_comments"</span><span class="p">,</span> +</span><span id="Parser-663"><a href="#Parser-663"><span class="linenos"> 663</span></a> <span class="s2">"_show_trie"</span><span class="p">,</span> +</span><span id="Parser-664"><a href="#Parser-664"><span class="linenos"> 664</span></a> <span class="s2">"_set_trie"</span><span class="p">,</span> +</span><span id="Parser-665"><a href="#Parser-665"><span class="linenos"> 665</span></a> <span class="p">)</span> +</span><span id="Parser-666"><a href="#Parser-666"><span class="linenos"> 666</span></a> +</span><span id="Parser-667"><a href="#Parser-667"><span class="linenos"> 667</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Parser-668"><a href="#Parser-668"><span class="linenos"> 668</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser-669"><a href="#Parser-669"><span class="linenos"> 669</span></a> <span class="n">error_level</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ErrorLevel</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-670"><a href="#Parser-670"><span class="linenos"> 670</span></a> <span class="n">error_message_context</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> +</span><span id="Parser-671"><a href="#Parser-671"><span class="linenos"> 671</span></a> <span class="n">index_offset</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +</span><span id="Parser-672"><a href="#Parser-672"><span class="linenos"> 672</span></a> <span class="n">unnest_column_only</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Parser-673"><a href="#Parser-673"><span class="linenos"> 673</span></a> <span class="n">alias_post_tablesample</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Parser-674"><a href="#Parser-674"><span class="linenos"> 674</span></a> <span class="n">max_errors</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</span><span class="p">,</span> +</span><span id="Parser-675"><a href="#Parser-675"><span class="linenos"> 675</span></a> <span class="n">null_ordering</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-676"><a href="#Parser-676"><span class="linenos"> 676</span></a> <span class="p">):</span> +</span><span id="Parser-677"><a href="#Parser-677"><span class="linenos"> 677</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">=</span> <span class="n">error_level</span> <span class="ow">or</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span> +</span><span id="Parser-678"><a href="#Parser-678"><span class="linenos"> 678</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span> <span class="o">=</span> <span class="n">error_message_context</span> +</span><span id="Parser-679"><a href="#Parser-679"><span class="linenos"> 679</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span> <span class="o">=</span> <span class="n">index_offset</span> +</span><span id="Parser-680"><a href="#Parser-680"><span class="linenos"> 680</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span> <span class="o">=</span> <span class="n">unnest_column_only</span> +</span><span id="Parser-681"><a href="#Parser-681"><span class="linenos"> 681</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="n">alias_post_tablesample</span> +</span><span id="Parser-682"><a href="#Parser-682"><span class="linenos"> 682</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">max_errors</span> <span class="o">=</span> <span class="n">max_errors</span> +</span><span id="Parser-683"><a href="#Parser-683"><span class="linenos"> 683</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">=</span> <span class="n">null_ordering</span> +</span><span id="Parser-684"><a href="#Parser-684"><span class="linenos"> 684</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="Parser-685"><a href="#Parser-685"><span class="linenos"> 685</span></a> +</span><span id="Parser-686"><a href="#Parser-686"><span class="linenos"> 686</span></a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Parser-687"><a href="#Parser-687"><span class="linenos"> 687</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Parser-688"><a href="#Parser-688"><span class="linenos"> 688</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-689"><a href="#Parser-689"><span class="linenos"> 689</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-690"><a href="#Parser-690"><span class="linenos"> 690</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Parser-691"><a href="#Parser-691"><span class="linenos"> 691</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-692"><a href="#Parser-692"><span class="linenos"> 692</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-693"><a href="#Parser-693"><span class="linenos"> 693</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-694"><a href="#Parser-694"><span class="linenos"> 694</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-695"><a href="#Parser-695"><span class="linenos"> 695</span></a> +</span><span id="Parser-696"><a href="#Parser-696"><span class="linenos"> 696</span></a> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span> +</span><span id="Parser-697"><a href="#Parser-697"><span class="linenos"> 697</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-698"><a href="#Parser-698"><span class="linenos"> 698</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-699"><a href="#Parser-699"><span class="linenos"> 699</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-700"><a href="#Parser-700"><span class="linenos"> 700</span></a><span class="sd"> Parses a list of tokens and returns a list of syntax trees, one tree</span> +</span><span id="Parser-701"><a href="#Parser-701"><span class="linenos"> 701</span></a><span class="sd"> per parsed SQL statement.</span> +</span><span id="Parser-702"><a href="#Parser-702"><span class="linenos"> 702</span></a> +</span><span id="Parser-703"><a href="#Parser-703"><span class="linenos"> 703</span></a><span class="sd"> Args:</span> +</span><span id="Parser-704"><a href="#Parser-704"><span class="linenos"> 704</span></a><span class="sd"> raw_tokens: the list of tokens.</span> +</span><span id="Parser-705"><a href="#Parser-705"><span class="linenos"> 705</span></a><span class="sd"> sql: the original SQL string, used to produce helpful debug messages.</span> +</span><span id="Parser-706"><a href="#Parser-706"><span class="linenos"> 706</span></a> +</span><span id="Parser-707"><a href="#Parser-707"><span class="linenos"> 707</span></a><span class="sd"> Returns:</span> +</span><span id="Parser-708"><a href="#Parser-708"><span class="linenos"> 708</span></a><span class="sd"> The list of syntax trees.</span> +</span><span id="Parser-709"><a href="#Parser-709"><span class="linenos"> 709</span></a><span class="sd"> """</span> +</span><span id="Parser-710"><a href="#Parser-710"><span class="linenos"> 710</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse</span><span class="p">(</span> +</span><span id="Parser-711"><a href="#Parser-711"><span class="linenos"> 711</span></a> <span class="n">parse_method</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="o">=</span><span class="n">raw_tokens</span><span class="p">,</span> <span class="n">sql</span><span class="o">=</span><span class="n">sql</span> +</span><span id="Parser-712"><a href="#Parser-712"><span class="linenos"> 712</span></a> <span class="p">)</span> +</span><span id="Parser-713"><a href="#Parser-713"><span class="linenos"> 713</span></a> +</span><span id="Parser-714"><a href="#Parser-714"><span class="linenos"> 714</span></a> <span class="k">def</span> <span class="nf">parse_into</span><span class="p">(</span> +</span><span id="Parser-715"><a href="#Parser-715"><span class="linenos"> 715</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser-716"><a href="#Parser-716"><span class="linenos"> 716</span></a> <span class="n">expression_types</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">,</span> +</span><span id="Parser-717"><a href="#Parser-717"><span class="linenos"> 717</span></a> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> +</span><span id="Parser-718"><a href="#Parser-718"><span class="linenos"> 718</span></a> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-719"><a href="#Parser-719"><span class="linenos"> 719</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-720"><a href="#Parser-720"><span class="linenos"> 720</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-721"><a href="#Parser-721"><span class="linenos"> 721</span></a><span class="sd"> Parses a list of tokens into a given Expression type. If a collection of Expression</span> +</span><span id="Parser-722"><a href="#Parser-722"><span class="linenos"> 722</span></a><span class="sd"> types is given instead, this method will try to parse the token list into each one</span> +</span><span id="Parser-723"><a href="#Parser-723"><span class="linenos"> 723</span></a><span class="sd"> of them, stopping at the first for which the parsing succeeds.</span> +</span><span id="Parser-724"><a href="#Parser-724"><span class="linenos"> 724</span></a> +</span><span id="Parser-725"><a href="#Parser-725"><span class="linenos"> 725</span></a><span class="sd"> Args:</span> +</span><span id="Parser-726"><a href="#Parser-726"><span class="linenos"> 726</span></a><span class="sd"> expression_types: the expression type(s) to try and parse the token list into.</span> +</span><span id="Parser-727"><a href="#Parser-727"><span class="linenos"> 727</span></a><span class="sd"> raw_tokens: the list of tokens.</span> +</span><span id="Parser-728"><a href="#Parser-728"><span class="linenos"> 728</span></a><span class="sd"> sql: the original SQL string, used to produce helpful debug messages.</span> +</span><span id="Parser-729"><a href="#Parser-729"><span class="linenos"> 729</span></a> +</span><span id="Parser-730"><a href="#Parser-730"><span class="linenos"> 730</span></a><span class="sd"> Returns:</span> +</span><span id="Parser-731"><a href="#Parser-731"><span class="linenos"> 731</span></a><span class="sd"> The target Expression.</span> +</span><span id="Parser-732"><a href="#Parser-732"><span class="linenos"> 732</span></a><span class="sd"> """</span> +</span><span id="Parser-733"><a href="#Parser-733"><span class="linenos"> 733</span></a> <span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-734"><a href="#Parser-734"><span class="linenos"> 734</span></a> <span class="k">for</span> <span class="n">expression_type</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">expression_types</span><span class="p">):</span> +</span><span id="Parser-735"><a href="#Parser-735"><span class="linenos"> 735</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXPRESSION_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression_type</span><span class="p">)</span> +</span><span id="Parser-736"><a href="#Parser-736"><span class="linenos"> 736</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="Parser-737"><a href="#Parser-737"><span class="linenos"> 737</span></a> <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No parser registered for </span><span class="si">{</span><span class="n">expression_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Parser-738"><a href="#Parser-738"><span class="linenos"> 738</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Parser-739"><a href="#Parser-739"><span class="linenos"> 739</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse</span><span class="p">(</span><span class="n">parser</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Parser-740"><a href="#Parser-740"><span class="linenos"> 740</span></a> <span class="k">except</span> <span class="n">ParseError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> +</span><span id="Parser-741"><a href="#Parser-741"><span class="linenos"> 741</span></a> <span class="n">e</span><span class="o">.</span><span class="n">errors</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s2">"into_expression"</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression_type</span> +</span><span id="Parser-742"><a href="#Parser-742"><span class="linenos"> 742</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Parser-743"><a href="#Parser-743"><span class="linenos"> 743</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span> +</span><span id="Parser-744"><a href="#Parser-744"><span class="linenos"> 744</span></a> <span class="sa">f</span><span class="s2">"Failed to parse into </span><span class="si">{</span><span class="n">expression_types</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Parser-745"><a href="#Parser-745"><span class="linenos"> 745</span></a> <span class="n">errors</span><span class="o">=</span><span class="n">merge_errors</span><span class="p">(</span><span class="n">errors</span><span class="p">),</span> +</span><span id="Parser-746"><a href="#Parser-746"><span class="linenos"> 746</span></a> <span class="p">)</span> <span class="kn">from</span> <span class="nn">errors</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span><span id="Parser-747"><a href="#Parser-747"><span class="linenos"> 747</span></a> +</span><span id="Parser-748"><a href="#Parser-748"><span class="linenos"> 748</span></a> <span class="k">def</span> <span class="nf">_parse</span><span class="p">(</span> +</span><span id="Parser-749"><a href="#Parser-749"><span class="linenos"> 749</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser-750"><a href="#Parser-750"><span class="linenos"> 750</span></a> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Parser</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]],</span> +</span><span id="Parser-751"><a href="#Parser-751"><span class="linenos"> 751</span></a> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> +</span><span id="Parser-752"><a href="#Parser-752"><span class="linenos"> 752</span></a> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-753"><a href="#Parser-753"><span class="linenos"> 753</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-754"><a href="#Parser-754"><span class="linenos"> 754</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="Parser-755"><a href="#Parser-755"><span class="linenos"> 755</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span> <span class="ow">or</span> <span class="s2">""</span> +</span><span id="Parser-756"><a href="#Parser-756"><span class="linenos"> 756</span></a> <span class="n">total</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">raw_tokens</span><span class="p">)</span> +</span><span id="Parser-757"><a href="#Parser-757"><span class="linenos"> 757</span></a> <span class="n">chunks</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[[]]</span> +</span><span id="Parser-758"><a href="#Parser-758"><span class="linenos"> 758</span></a> +</span><span id="Parser-759"><a href="#Parser-759"><span class="linenos"> 759</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">token</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">raw_tokens</span><span class="p">):</span> +</span><span id="Parser-760"><a href="#Parser-760"><span class="linenos"> 760</span></a> <span class="k">if</span> <span class="n">token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMICOLON</span><span class="p">:</span> +</span><span id="Parser-761"><a href="#Parser-761"><span class="linenos"> 761</span></a> <span class="k">if</span> <span class="n">i</span> <span class="o"><</span> <span class="n">total</span> <span class="o">-</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Parser-762"><a href="#Parser-762"><span class="linenos"> 762</span></a> <span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">([])</span> +</span><span id="Parser-763"><a href="#Parser-763"><span class="linenos"> 763</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-764"><a href="#Parser-764"><span class="linenos"> 764</span></a> <span class="n">chunks</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">token</span><span class="p">)</span> +</span><span id="Parser-765"><a href="#Parser-765"><span class="linenos"> 765</span></a> +</span><span id="Parser-766"><a href="#Parser-766"><span class="linenos"> 766</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-767"><a href="#Parser-767"><span class="linenos"> 767</span></a> +</span><span id="Parser-768"><a href="#Parser-768"><span class="linenos"> 768</span></a> <span class="k">for</span> <span class="n">tokens</span> <span class="ow">in</span> <span class="n">chunks</span><span class="p">:</span> +</span><span id="Parser-769"><a href="#Parser-769"><span class="linenos"> 769</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="Parser-770"><a href="#Parser-770"><span class="linenos"> 770</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span> <span class="o">=</span> <span class="n">tokens</span> +</span><span id="Parser-771"><a href="#Parser-771"><span class="linenos"> 771</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-772"><a href="#Parser-772"><span class="linenos"> 772</span></a> +</span><span id="Parser-773"><a href="#Parser-773"><span class="linenos"> 773</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">parse_method</span><span class="p">(</span><span class="bp">self</span><span class="p">))</span> +</span><span id="Parser-774"><a href="#Parser-774"><span class="linenos"> 774</span></a> +</span><span id="Parser-775"><a href="#Parser-775"><span class="linenos"> 775</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o"><</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">):</span> +</span><span id="Parser-776"><a href="#Parser-776"><span class="linenos"> 776</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Invalid expression / Unexpected token"</span><span class="p">)</span> +</span><span id="Parser-777"><a href="#Parser-777"><span class="linenos"> 777</span></a> +</span><span id="Parser-778"><a href="#Parser-778"><span class="linenos"> 778</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">check_errors</span><span class="p">()</span> +</span><span id="Parser-779"><a href="#Parser-779"><span class="linenos"> 779</span></a> +</span><span id="Parser-780"><a href="#Parser-780"><span class="linenos"> 780</span></a> <span class="k">return</span> <span class="n">expressions</span> +</span><span id="Parser-781"><a href="#Parser-781"><span class="linenos"> 781</span></a> +</span><span id="Parser-782"><a href="#Parser-782"><span class="linenos"> 782</span></a> <span class="k">def</span> <span class="nf">check_errors</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-783"><a href="#Parser-783"><span class="linenos"> 783</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-784"><a href="#Parser-784"><span class="linenos"> 784</span></a><span class="sd"> Logs or raises any found errors, depending on the chosen error level setting.</span> +</span><span id="Parser-785"><a href="#Parser-785"><span class="linenos"> 785</span></a><span class="sd"> """</span> +</span><span id="Parser-786"><a href="#Parser-786"><span class="linenos"> 786</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> +</span><span id="Parser-787"><a href="#Parser-787"><span class="linenos"> 787</span></a> <span class="k">for</span> <span class="n">error</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">:</span> +</span><span id="Parser-788"><a href="#Parser-788"><span class="linenos"> 788</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">error</span><span class="p">))</span> +</span><span id="Parser-789"><a href="#Parser-789"><span class="linenos"> 789</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">RAISE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">:</span> +</span><span id="Parser-790"><a href="#Parser-790"><span class="linenos"> 790</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span> +</span><span id="Parser-791"><a href="#Parser-791"><span class="linenos"> 791</span></a> <span class="n">concat_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_errors</span><span class="p">),</span> +</span><span id="Parser-792"><a href="#Parser-792"><span class="linenos"> 792</span></a> <span class="n">errors</span><span class="o">=</span><span class="n">merge_errors</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">),</span> +</span><span id="Parser-793"><a href="#Parser-793"><span class="linenos"> 793</span></a> <span class="p">)</span> +</span><span id="Parser-794"><a href="#Parser-794"><span class="linenos"> 794</span></a> +</span><span id="Parser-795"><a href="#Parser-795"><span class="linenos"> 795</span></a> <span class="k">def</span> <span class="nf">raise_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-796"><a href="#Parser-796"><span class="linenos"> 796</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-797"><a href="#Parser-797"><span class="linenos"> 797</span></a><span class="sd"> Appends an error in the list of recorded errors or raises it, depending on the chosen</span> +</span><span id="Parser-798"><a href="#Parser-798"><span class="linenos"> 798</span></a><span class="sd"> error level setting.</span> +</span><span id="Parser-799"><a href="#Parser-799"><span class="linenos"> 799</span></a><span class="sd"> """</span> +</span><span id="Parser-800"><a href="#Parser-800"><span class="linenos"> 800</span></a> <span class="n">token</span> <span class="o">=</span> <span class="n">token</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="ow">or</span> <span class="n">Token</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Parser-801"><a href="#Parser-801"><span class="linenos"> 801</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">token</span><span class="p">)</span> +</span><span id="Parser-802"><a href="#Parser-802"><span class="linenos"> 802</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-803"><a href="#Parser-803"><span class="linenos"> 803</span></a> <span class="n">start_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="nb">max</span><span class="p">(</span><span class="n">start</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="p">:</span> <span class="n">start</span><span class="p">]</span> +</span><span id="Parser-804"><a href="#Parser-804"><span class="linenos"> 804</span></a> <span class="n">highlight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="Parser-805"><a href="#Parser-805"><span class="linenos"> 805</span></a> <span class="n">end_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">end</span> <span class="p">:</span> <span class="n">end</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span><span class="p">]</span> +</span><span id="Parser-806"><a href="#Parser-806"><span class="linenos"> 806</span></a> +</span><span id="Parser-807"><a href="#Parser-807"><span class="linenos"> 807</span></a> <span class="n">error</span> <span class="o">=</span> <span class="n">ParseError</span><span class="o">.</span><span class="n">new</span><span class="p">(</span> +</span><span id="Parser-808"><a href="#Parser-808"><span class="linenos"> 808</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">message</span><span class="si">}</span><span class="s2">. Line </span><span class="si">{</span><span class="n">token</span><span class="o">.</span><span class="n">line</span><span class="si">}</span><span class="s2">, Col: </span><span class="si">{</span><span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="si">}</span><span class="s2">.</span><span class="se">\n</span><span class="s2">"</span> +</span><span id="Parser-809"><a href="#Parser-809"><span class="linenos"> 809</span></a> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">start_context</span><span class="si">}</span><span class="se">\033</span><span class="s2">[4m</span><span class="si">{</span><span class="n">highlight</span><span class="si">}</span><span class="se">\033</span><span class="s2">[0m</span><span class="si">{</span><span class="n">end_context</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Parser-810"><a href="#Parser-810"><span class="linenos"> 810</span></a> <span class="n">description</span><span class="o">=</span><span class="n">message</span><span class="p">,</span> +</span><span id="Parser-811"><a href="#Parser-811"><span class="linenos"> 811</span></a> <span class="n">line</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">line</span><span class="p">,</span> +</span><span id="Parser-812"><a href="#Parser-812"><span class="linenos"> 812</span></a> <span class="n">col</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="p">,</span> +</span><span id="Parser-813"><a href="#Parser-813"><span class="linenos"> 813</span></a> <span class="n">start_context</span><span class="o">=</span><span class="n">start_context</span><span class="p">,</span> +</span><span id="Parser-814"><a href="#Parser-814"><span class="linenos"> 814</span></a> <span class="n">highlight</span><span class="o">=</span><span class="n">highlight</span><span class="p">,</span> +</span><span id="Parser-815"><a href="#Parser-815"><span class="linenos"> 815</span></a> <span class="n">end_context</span><span class="o">=</span><span class="n">end_context</span><span class="p">,</span> +</span><span id="Parser-816"><a href="#Parser-816"><span class="linenos"> 816</span></a> <span class="p">)</span> +</span><span id="Parser-817"><a href="#Parser-817"><span class="linenos"> 817</span></a> +</span><span id="Parser-818"><a href="#Parser-818"><span class="linenos"> 818</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span><span class="p">:</span> +</span><span id="Parser-819"><a href="#Parser-819"><span class="linenos"> 819</span></a> <span class="k">raise</span> <span class="n">error</span> +</span><span id="Parser-820"><a href="#Parser-820"><span class="linenos"> 820</span></a> +</span><span id="Parser-821"><a href="#Parser-821"><span class="linenos"> 821</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">error</span><span class="p">)</span> +</span><span id="Parser-822"><a href="#Parser-822"><span class="linenos"> 822</span></a> +</span><span id="Parser-823"><a href="#Parser-823"><span class="linenos"> 823</span></a> <span class="k">def</span> <span class="nf">expression</span><span class="p">(</span> +</span><span id="Parser-824"><a href="#Parser-824"><span class="linenos"> 824</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="Parser-825"><a href="#Parser-825"><span class="linenos"> 825</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-826"><a href="#Parser-826"><span class="linenos"> 826</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-827"><a href="#Parser-827"><span class="linenos"> 827</span></a><span class="sd"> Creates a new, validated Expression.</span> +</span><span id="Parser-828"><a href="#Parser-828"><span class="linenos"> 828</span></a> +</span><span id="Parser-829"><a href="#Parser-829"><span class="linenos"> 829</span></a><span class="sd"> Args:</span> +</span><span id="Parser-830"><a href="#Parser-830"><span class="linenos"> 830</span></a><span class="sd"> exp_class: the expression class to instantiate.</span> +</span><span id="Parser-831"><a href="#Parser-831"><span class="linenos"> 831</span></a><span class="sd"> comments: an optional list of comments to attach to the expression.</span> +</span><span id="Parser-832"><a href="#Parser-832"><span class="linenos"> 832</span></a><span class="sd"> kwargs: the arguments to set for the expression along with their respective values.</span> +</span><span id="Parser-833"><a href="#Parser-833"><span class="linenos"> 833</span></a> +</span><span id="Parser-834"><a href="#Parser-834"><span class="linenos"> 834</span></a><span class="sd"> Returns:</span> +</span><span id="Parser-835"><a href="#Parser-835"><span class="linenos"> 835</span></a><span class="sd"> The target expression.</span> +</span><span id="Parser-836"><a href="#Parser-836"><span class="linenos"> 836</span></a><span class="sd"> """</span> +</span><span id="Parser-837"><a href="#Parser-837"><span class="linenos"> 837</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">exp_class</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Parser-838"><a href="#Parser-838"><span class="linenos"> 838</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="Parser-839"><a href="#Parser-839"><span class="linenos"> 839</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-840"><a href="#Parser-840"><span class="linenos"> 840</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-841"><a href="#Parser-841"><span class="linenos"> 841</span></a> <span class="k">if</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="Parser-842"><a href="#Parser-842"><span class="linenos"> 842</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="Parser-843"><a href="#Parser-843"><span class="linenos"> 843</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span> +</span><span id="Parser-844"><a href="#Parser-844"><span class="linenos"> 844</span></a> <span class="k">return</span> <span class="n">instance</span> +</span><span id="Parser-845"><a href="#Parser-845"><span class="linenos"> 845</span></a> +</span><span id="Parser-846"><a href="#Parser-846"><span class="linenos"> 846</span></a> <span class="k">def</span> <span class="nf">validate_expression</span><span class="p">(</span> +</span><span id="Parser-847"><a href="#Parser-847"><span class="linenos"> 847</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-848"><a href="#Parser-848"><span class="linenos"> 848</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-849"><a href="#Parser-849"><span class="linenos"> 849</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser-850"><a href="#Parser-850"><span class="linenos"> 850</span></a><span class="sd"> Validates an already instantiated expression, making sure that all its mandatory arguments</span> +</span><span id="Parser-851"><a href="#Parser-851"><span class="linenos"> 851</span></a><span class="sd"> are set.</span> +</span><span id="Parser-852"><a href="#Parser-852"><span class="linenos"> 852</span></a> +</span><span id="Parser-853"><a href="#Parser-853"><span class="linenos"> 853</span></a><span class="sd"> Args:</span> +</span><span id="Parser-854"><a href="#Parser-854"><span class="linenos"> 854</span></a><span class="sd"> expression: the expression to validate.</span> +</span><span id="Parser-855"><a href="#Parser-855"><span class="linenos"> 855</span></a><span class="sd"> args: an optional list of items that was used to instantiate the expression, if it's a Func.</span> +</span><span id="Parser-856"><a href="#Parser-856"><span class="linenos"> 856</span></a><span class="sd"> """</span> +</span><span id="Parser-857"><a href="#Parser-857"><span class="linenos"> 857</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IGNORE</span><span class="p">:</span> +</span><span id="Parser-858"><a href="#Parser-858"><span class="linenos"> 858</span></a> <span class="k">return</span> +</span><span id="Parser-859"><a href="#Parser-859"><span class="linenos"> 859</span></a> +</span><span id="Parser-860"><a href="#Parser-860"><span class="linenos"> 860</span></a> <span class="k">for</span> <span class="n">error_message</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">error_messages</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="Parser-861"><a href="#Parser-861"><span class="linenos"> 861</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="n">error_message</span><span class="p">)</span> +</span><span id="Parser-862"><a href="#Parser-862"><span class="linenos"> 862</span></a> +</span><span id="Parser-863"><a href="#Parser-863"><span class="linenos"> 863</span></a> <span class="k">def</span> <span class="nf">_find_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="n">Token</span><span class="p">,</span> <span class="n">end</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Parser-864"><a href="#Parser-864"><span class="linenos"> 864</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">start</span><span class="p">)</span> <span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">end</span><span class="p">)</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">end</span><span class="o">.</span><span class="n">text</span><span class="p">)]</span> +</span><span id="Parser-865"><a href="#Parser-865"><span class="linenos"> 865</span></a> +</span><span id="Parser-866"><a href="#Parser-866"><span class="linenos"> 866</span></a> <span class="k">def</span> <span class="nf">_find_token</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="Parser-867"><a href="#Parser-867"><span class="linenos"> 867</span></a> <span class="n">line</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Parser-868"><a href="#Parser-868"><span class="linenos"> 868</span></a> <span class="n">col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Parser-869"><a href="#Parser-869"><span class="linenos"> 869</span></a> <span class="n">index</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Parser-870"><a href="#Parser-870"><span class="linenos"> 870</span></a> +</span><span id="Parser-871"><a href="#Parser-871"><span class="linenos"> 871</span></a> <span class="k">while</span> <span class="n">line</span> <span class="o"><</span> <span class="n">token</span><span class="o">.</span><span class="n">line</span> <span class="ow">or</span> <span class="n">col</span> <span class="o"><</span> <span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="p">:</span> +</span><span id="Parser-872"><a href="#Parser-872"><span class="linenos"> 872</span></a> <span class="k">if</span> <span class="n">Tokenizer</span><span class="o">.</span><span class="n">WHITE_SPACE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">index</span><span class="p">])</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">:</span> +</span><span id="Parser-873"><a href="#Parser-873"><span class="linenos"> 873</span></a> <span class="n">line</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Parser-874"><a href="#Parser-874"><span class="linenos"> 874</span></a> <span class="n">col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Parser-875"><a href="#Parser-875"><span class="linenos"> 875</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-876"><a href="#Parser-876"><span class="linenos"> 876</span></a> <span class="n">col</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Parser-877"><a href="#Parser-877"><span class="linenos"> 877</span></a> <span class="n">index</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Parser-878"><a href="#Parser-878"><span class="linenos"> 878</span></a> +</span><span id="Parser-879"><a href="#Parser-879"><span class="linenos"> 879</span></a> <span class="k">return</span> <span class="n">index</span> +</span><span id="Parser-880"><a href="#Parser-880"><span class="linenos"> 880</span></a> +</span><span id="Parser-881"><a href="#Parser-881"><span class="linenos"> 881</span></a> <span class="k">def</span> <span class="nf">_advance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">times</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-882"><a href="#Parser-882"><span class="linenos"> 882</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">+=</span> <span class="n">times</span> +</span><span id="Parser-883"><a href="#Parser-883"><span class="linenos"> 883</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span><span class="p">)</span> +</span><span id="Parser-884"><a href="#Parser-884"><span class="linenos"> 884</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Parser-885"><a href="#Parser-885"><span class="linenos"> 885</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="Parser-886"><a href="#Parser-886"><span class="linenos"> 886</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> +</span><span id="Parser-887"><a href="#Parser-887"><span class="linenos"> 887</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">comments</span> +</span><span id="Parser-888"><a href="#Parser-888"><span class="linenos"> 888</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-889"><a href="#Parser-889"><span class="linenos"> 889</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-890"><a href="#Parser-890"><span class="linenos"> 890</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-891"><a href="#Parser-891"><span class="linenos"> 891</span></a> +</span><span id="Parser-892"><a href="#Parser-892"><span class="linenos"> 892</span></a> <span class="k">def</span> <span class="nf">_retreat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-893"><a href="#Parser-893"><span class="linenos"> 893</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">index</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span><span class="p">)</span> +</span><span id="Parser-894"><a href="#Parser-894"><span class="linenos"> 894</span></a> +</span><span id="Parser-895"><a href="#Parser-895"><span class="linenos"> 895</span></a> <span class="k">def</span> <span class="nf">_parse_command</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-896"><a href="#Parser-896"><span class="linenos"> 896</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="Parser-897"><a href="#Parser-897"><span class="linenos"> 897</span></a> +</span><span id="Parser-898"><a href="#Parser-898"><span class="linenos"> 898</span></a> <span class="k">def</span> <span class="nf">_parse_statement</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-899"><a href="#Parser-899"><span class="linenos"> 899</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-900"><a href="#Parser-900"><span class="linenos"> 900</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-901"><a href="#Parser-901"><span class="linenos"> 901</span></a> +</span><span id="Parser-902"><a href="#Parser-902"><span class="linenos"> 902</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">):</span> +</span><span id="Parser-903"><a href="#Parser-903"><span class="linenos"> 903</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">STATEMENT_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-904"><a href="#Parser-904"><span class="linenos"> 904</span></a> +</span><span id="Parser-905"><a href="#Parser-905"><span class="linenos"> 905</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">COMMANDS</span><span class="p">):</span> +</span><span id="Parser-906"><a href="#Parser-906"><span class="linenos"> 906</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_command</span><span class="p">()</span> +</span><span id="Parser-907"><a href="#Parser-907"><span class="linenos"> 907</span></a> +</span><span id="Parser-908"><a href="#Parser-908"><span class="linenos"> 908</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">()</span> +</span><span id="Parser-909"><a href="#Parser-909"><span class="linenos"> 909</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> <span class="k">if</span> <span class="n">expression</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">()</span> +</span><span id="Parser-910"><a href="#Parser-910"><span class="linenos"> 910</span></a> +</span><span id="Parser-911"><a href="#Parser-911"><span class="linenos"> 911</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Parser-912"><a href="#Parser-912"><span class="linenos"> 912</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Parser-913"><a href="#Parser-913"><span class="linenos"> 913</span></a> +</span><span id="Parser-914"><a href="#Parser-914"><span class="linenos"> 914</span></a> <span class="k">def</span> <span class="nf">_parse_drop</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default_kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-915"><a href="#Parser-915"><span class="linenos"> 915</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="Parser-916"><a href="#Parser-916"><span class="linenos"> 916</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">)</span> +</span><span id="Parser-917"><a href="#Parser-917"><span class="linenos"> 917</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">)</span> +</span><span id="Parser-918"><a href="#Parser-918"><span class="linenos"> 918</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-919"><a href="#Parser-919"><span class="linenos"> 919</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Parser-920"><a href="#Parser-920"><span class="linenos"> 920</span></a> <span class="k">if</span> <span class="n">default_kind</span><span class="p">:</span> +</span><span id="Parser-921"><a href="#Parser-921"><span class="linenos"> 921</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">default_kind</span> +</span><span id="Parser-922"><a href="#Parser-922"><span class="linenos"> 922</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-923"><a href="#Parser-923"><span class="linenos"> 923</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_as_command</span><span class="p">(</span><span class="n">start</span><span class="p">)</span> +</span><span id="Parser-924"><a href="#Parser-924"><span class="linenos"> 924</span></a> +</span><span id="Parser-925"><a href="#Parser-925"><span class="linenos"> 925</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-926"><a href="#Parser-926"><span class="linenos"> 926</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Drop</span><span class="p">,</span> +</span><span id="Parser-927"><a href="#Parser-927"><span class="linenos"> 927</span></a> <span class="n">exists</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(),</span> +</span><span id="Parser-928"><a href="#Parser-928"><span class="linenos"> 928</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-929"><a href="#Parser-929"><span class="linenos"> 929</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="Parser-930"><a href="#Parser-930"><span class="linenos"> 930</span></a> <span class="n">temporary</span><span class="o">=</span><span class="n">temporary</span><span class="p">,</span> +</span><span id="Parser-931"><a href="#Parser-931"><span class="linenos"> 931</span></a> <span class="n">materialized</span><span class="o">=</span><span class="n">materialized</span><span class="p">,</span> +</span><span id="Parser-932"><a href="#Parser-932"><span class="linenos"> 932</span></a> <span class="n">cascade</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">),</span> +</span><span id="Parser-933"><a href="#Parser-933"><span class="linenos"> 933</span></a> <span class="p">)</span> +</span><span id="Parser-934"><a href="#Parser-934"><span class="linenos"> 934</span></a> +</span><span id="Parser-935"><a href="#Parser-935"><span class="linenos"> 935</span></a> <span class="k">def</span> <span class="nf">_parse_exists</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">not_</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]:</span> +</span><span id="Parser-936"><a href="#Parser-936"><span class="linenos"> 936</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="Parser-937"><a href="#Parser-937"><span class="linenos"> 937</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">)</span> +</span><span id="Parser-938"><a href="#Parser-938"><span class="linenos"> 938</span></a> <span class="ow">and</span> <span class="p">(</span><span class="ow">not</span> <span class="n">not_</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">))</span> +</span><span id="Parser-939"><a href="#Parser-939"><span class="linenos"> 939</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EXISTS</span><span class="p">)</span> +</span><span id="Parser-940"><a href="#Parser-940"><span class="linenos"> 940</span></a> <span class="p">)</span> +</span><span id="Parser-941"><a href="#Parser-941"><span class="linenos"> 941</span></a> +</span><span id="Parser-942"><a href="#Parser-942"><span class="linenos"> 942</span></a> <span class="k">def</span> <span class="nf">_parse_create</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-943"><a href="#Parser-943"><span class="linenos"> 943</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="Parser-944"><a href="#Parser-944"><span class="linenos"> 944</span></a> <span class="n">replace</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OR</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span> +</span><span id="Parser-945"><a href="#Parser-945"><span class="linenos"> 945</span></a> <span class="n">set_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="Parser-946"><a href="#Parser-946"><span class="linenos"> 946</span></a> <span class="n">multiset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MULTISET"</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="Parser-947"><a href="#Parser-947"><span class="linenos"> 947</span></a> <span class="n">global_temporary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"GLOBAL"</span><span class="p">,</span> <span class="s2">"TEMPORARY"</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="Parser-948"><a href="#Parser-948"><span class="linenos"> 948</span></a> <span class="n">volatile</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">)</span> <span class="c1"># Teradata</span> +</span><span id="Parser-949"><a href="#Parser-949"><span class="linenos"> 949</span></a> <span class="n">temporary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">)</span> +</span><span id="Parser-950"><a href="#Parser-950"><span class="linenos"> 950</span></a> <span class="n">transient</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TRANSIENT"</span><span class="p">)</span> +</span><span id="Parser-951"><a href="#Parser-951"><span class="linenos"> 951</span></a> <span class="n">external</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"EXTERNAL"</span><span class="p">)</span> +</span><span id="Parser-952"><a href="#Parser-952"><span class="linenos"> 952</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">)</span> +</span><span id="Parser-953"><a href="#Parser-953"><span class="linenos"> 953</span></a> <span class="n">materialized</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">)</span> +</span><span id="Parser-954"><a href="#Parser-954"><span class="linenos"> 954</span></a> +</span><span id="Parser-955"><a href="#Parser-955"><span class="linenos"> 955</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-956"><a href="#Parser-956"><span class="linenos"> 956</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="Parser-957"><a href="#Parser-957"><span class="linenos"> 957</span></a> +</span><span id="Parser-958"><a href="#Parser-958"><span class="linenos"> 958</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-959"><a href="#Parser-959"><span class="linenos"> 959</span></a> <span class="n">create_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="Parser-960"><a href="#Parser-960"><span class="linenos"> 960</span></a> +</span><span id="Parser-961"><a href="#Parser-961"><span class="linenos"> 961</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">create_token</span><span class="p">:</span> +</span><span id="Parser-962"><a href="#Parser-962"><span class="linenos"> 962</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="Parser-963"><a href="#Parser-963"><span class="linenos"> 963</span></a> <span class="n">create_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="Parser-964"><a href="#Parser-964"><span class="linenos"> 964</span></a> +</span><span id="Parser-965"><a href="#Parser-965"><span class="linenos"> 965</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">properties</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">create_token</span><span class="p">:</span> +</span><span id="Parser-966"><a href="#Parser-966"><span class="linenos"> 966</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_as_command</span><span class="p">(</span><span class="n">start</span><span class="p">)</span> +</span><span id="Parser-967"><a href="#Parser-967"><span class="linenos"> 967</span></a> +</span><span id="Parser-968"><a href="#Parser-968"><span class="linenos"> 968</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(</span><span class="n">not_</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-969"><a href="#Parser-969"><span class="linenos"> 969</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-970"><a href="#Parser-970"><span class="linenos"> 970</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-971"><a href="#Parser-971"><span class="linenos"> 971</span></a> <span class="n">data</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-972"><a href="#Parser-972"><span class="linenos"> 972</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-973"><a href="#Parser-973"><span class="linenos"> 973</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-974"><a href="#Parser-974"><span class="linenos"> 974</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-975"><a href="#Parser-975"><span class="linenos"> 975</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-976"><a href="#Parser-976"><span class="linenos"> 976</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-977"><a href="#Parser-977"><span class="linenos"> 977</span></a> +</span><span id="Parser-978"><a href="#Parser-978"><span class="linenos"> 978</span></a> <span class="k">if</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">):</span> +</span><span id="Parser-979"><a href="#Parser-979"><span class="linenos"> 979</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_user_defined_function</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span><span class="p">)</span> +</span><span id="Parser-980"><a href="#Parser-980"><span class="linenos"> 980</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="Parser-981"><a href="#Parser-981"><span class="linenos"> 981</span></a> +</span><span id="Parser-982"><a href="#Parser-982"><span class="linenos"> 982</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-983"><a href="#Parser-983"><span class="linenos"> 983</span></a> <span class="n">begin</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">)</span> +</span><span id="Parser-984"><a href="#Parser-984"><span class="linenos"> 984</span></a> <span class="n">return_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"RETURN"</span><span class="p">)</span> +</span><span id="Parser-985"><a href="#Parser-985"><span class="linenos"> 985</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="Parser-986"><a href="#Parser-986"><span class="linenos"> 986</span></a> +</span><span id="Parser-987"><a href="#Parser-987"><span class="linenos"> 987</span></a> <span class="k">if</span> <span class="n">return_</span><span class="p">:</span> +</span><span id="Parser-988"><a href="#Parser-988"><span class="linenos"> 988</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Return</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Parser-989"><a href="#Parser-989"><span class="linenos"> 989</span></a> <span class="k">elif</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">:</span> +</span><span id="Parser-990"><a href="#Parser-990"><span class="linenos"> 990</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_index</span><span class="p">()</span> +</span><span id="Parser-991"><a href="#Parser-991"><span class="linenos"> 991</span></a> <span class="k">elif</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="p">(</span> +</span><span id="Parser-992"><a href="#Parser-992"><span class="linenos"> 992</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Parser-993"><a href="#Parser-993"><span class="linenos"> 993</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="Parser-994"><a href="#Parser-994"><span class="linenos"> 994</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="Parser-995"><a href="#Parser-995"><span class="linenos"> 995</span></a> <span class="p">):</span> +</span><span id="Parser-996"><a href="#Parser-996"><span class="linenos"> 996</span></a> <span class="n">table_parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-997"><a href="#Parser-997"><span class="linenos"> 997</span></a> +</span><span id="Parser-998"><a href="#Parser-998"><span class="linenos"> 998</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> <span class="c1"># comma-separated properties before schema definition</span> +</span><span id="Parser-999"><a href="#Parser-999"><span class="linenos"> 999</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">(</span><span class="n">before</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1000"><a href="#Parser-1000"><span class="linenos">1000</span></a> +</span><span id="Parser-1001"><a href="#Parser-1001"><span class="linenos">1001</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">table_parts</span><span class="p">)</span> +</span><span id="Parser-1002"><a href="#Parser-1002"><span class="linenos">1002</span></a> +</span><span id="Parser-1003"><a href="#Parser-1003"><span class="linenos">1003</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">properties</span><span class="p">:</span> <span class="c1"># properties after schema definition</span> +</span><span id="Parser-1004"><a href="#Parser-1004"><span class="linenos">1004</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="Parser-1005"><a href="#Parser-1005"><span class="linenos">1005</span></a> +</span><span id="Parser-1006"><a href="#Parser-1006"><span class="linenos">1006</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-1007"><a href="#Parser-1007"><span class="linenos">1007</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_ddl_select</span><span class="p">()</span> +</span><span id="Parser-1008"><a href="#Parser-1008"><span class="linenos">1008</span></a> +</span><span id="Parser-1009"><a href="#Parser-1009"><span class="linenos">1009</span></a> <span class="k">if</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">:</span> +</span><span id="Parser-1010"><a href="#Parser-1010"><span class="linenos">1010</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"DATA"</span><span class="p">):</span> +</span><span id="Parser-1011"><a href="#Parser-1011"><span class="linenos">1011</span></a> <span class="n">data</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1012"><a href="#Parser-1012"><span class="linenos">1012</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"DATA"</span><span class="p">):</span> +</span><span id="Parser-1013"><a href="#Parser-1013"><span class="linenos">1013</span></a> <span class="n">data</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-1014"><a href="#Parser-1014"><span class="linenos">1014</span></a> +</span><span id="Parser-1015"><a href="#Parser-1015"><span class="linenos">1015</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AND"</span><span class="p">,</span> <span class="s2">"STATISTICS"</span><span class="p">):</span> +</span><span id="Parser-1016"><a href="#Parser-1016"><span class="linenos">1016</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1017"><a href="#Parser-1017"><span class="linenos">1017</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AND"</span><span class="p">,</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"STATISTICS"</span><span class="p">):</span> +</span><span id="Parser-1018"><a href="#Parser-1018"><span class="linenos">1018</span></a> <span class="n">statistics</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-1019"><a href="#Parser-1019"><span class="linenos">1019</span></a> +</span><span id="Parser-1020"><a href="#Parser-1020"><span class="linenos">1020</span></a> <span class="n">no_primary_index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"PRIMARY"</span><span class="p">,</span> <span class="s2">"INDEX"</span><span class="p">)</span> +</span><span id="Parser-1021"><a href="#Parser-1021"><span class="linenos">1021</span></a> +</span><span id="Parser-1022"><a href="#Parser-1022"><span class="linenos">1022</span></a> <span class="n">indexes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-1023"><a href="#Parser-1023"><span class="linenos">1023</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-1024"><a href="#Parser-1024"><span class="linenos">1024</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create_table_index</span><span class="p">()</span> +</span><span id="Parser-1025"><a href="#Parser-1025"><span class="linenos">1025</span></a> +</span><span id="Parser-1026"><a href="#Parser-1026"><span class="linenos">1026</span></a> <span class="c1"># post index PARTITION BY property</span> +</span><span id="Parser-1027"><a href="#Parser-1027"><span class="linenos">1027</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-1028"><a href="#Parser-1028"><span class="linenos">1028</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="Parser-1029"><a href="#Parser-1029"><span class="linenos">1029</span></a> <span class="n">properties</span><span class="o">.</span><span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">())</span> +</span><span id="Parser-1030"><a href="#Parser-1030"><span class="linenos">1030</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1031"><a href="#Parser-1031"><span class="linenos">1031</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_properties</span><span class="p">()</span> +</span><span id="Parser-1032"><a href="#Parser-1032"><span class="linenos">1032</span></a> +</span><span id="Parser-1033"><a href="#Parser-1033"><span class="linenos">1033</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">index</span><span class="p">:</span> +</span><span id="Parser-1034"><a href="#Parser-1034"><span class="linenos">1034</span></a> <span class="k">break</span> +</span><span id="Parser-1035"><a href="#Parser-1035"><span class="linenos">1035</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1036"><a href="#Parser-1036"><span class="linenos">1036</span></a> <span class="n">indexes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-1037"><a href="#Parser-1037"><span class="linenos">1037</span></a> <span class="k">elif</span> <span class="n">create_token</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">:</span> +</span><span id="Parser-1038"><a href="#Parser-1038"><span class="linenos">1038</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"NO"</span><span class="p">,</span> <span class="s2">"SCHEMA"</span><span class="p">,</span> <span class="s2">"BINDING"</span><span class="p">):</span> +</span><span id="Parser-1039"><a href="#Parser-1039"><span class="linenos">1039</span></a> <span class="n">no_schema_binding</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1040"><a href="#Parser-1040"><span class="linenos">1040</span></a> +</span><span id="Parser-1041"><a href="#Parser-1041"><span class="linenos">1041</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1042"><a href="#Parser-1042"><span class="linenos">1042</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span> +</span><span id="Parser-1043"><a href="#Parser-1043"><span class="linenos">1043</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-1044"><a href="#Parser-1044"><span class="linenos">1044</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">create_token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> +</span><span id="Parser-1045"><a href="#Parser-1045"><span class="linenos">1045</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Parser-1046"><a href="#Parser-1046"><span class="linenos">1046</span></a> <span class="nb">set</span><span class="o">=</span><span class="n">set_</span><span class="p">,</span> +</span><span id="Parser-1047"><a href="#Parser-1047"><span class="linenos">1047</span></a> <span class="n">multiset</span><span class="o">=</span><span class="n">multiset</span><span class="p">,</span> +</span><span id="Parser-1048"><a href="#Parser-1048"><span class="linenos">1048</span></a> <span class="n">global_temporary</span><span class="o">=</span><span class="n">global_temporary</span><span class="p">,</span> +</span><span id="Parser-1049"><a href="#Parser-1049"><span class="linenos">1049</span></a> <span class="n">volatile</span><span class="o">=</span><span class="n">volatile</span><span class="p">,</span> +</span><span id="Parser-1050"><a href="#Parser-1050"><span class="linenos">1050</span></a> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span><span class="p">,</span> +</span><span id="Parser-1051"><a href="#Parser-1051"><span class="linenos">1051</span></a> <span class="n">properties</span><span class="o">=</span><span class="n">properties</span><span class="p">,</span> +</span><span id="Parser-1052"><a href="#Parser-1052"><span class="linenos">1052</span></a> <span class="n">temporary</span><span class="o">=</span><span class="n">temporary</span><span class="p">,</span> +</span><span id="Parser-1053"><a href="#Parser-1053"><span class="linenos">1053</span></a> <span class="n">transient</span><span class="o">=</span><span class="n">transient</span><span class="p">,</span> +</span><span id="Parser-1054"><a href="#Parser-1054"><span class="linenos">1054</span></a> <span class="n">external</span><span class="o">=</span><span class="n">external</span><span class="p">,</span> +</span><span id="Parser-1055"><a href="#Parser-1055"><span class="linenos">1055</span></a> <span class="n">replace</span><span class="o">=</span><span class="n">replace</span><span class="p">,</span> +</span><span id="Parser-1056"><a href="#Parser-1056"><span class="linenos">1056</span></a> <span class="n">unique</span><span class="o">=</span><span class="n">unique</span><span class="p">,</span> +</span><span id="Parser-1057"><a href="#Parser-1057"><span class="linenos">1057</span></a> <span class="n">materialized</span><span class="o">=</span><span class="n">materialized</span><span class="p">,</span> +</span><span id="Parser-1058"><a href="#Parser-1058"><span class="linenos">1058</span></a> <span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> +</span><span id="Parser-1059"><a href="#Parser-1059"><span class="linenos">1059</span></a> <span class="n">statistics</span><span class="o">=</span><span class="n">statistics</span><span class="p">,</span> +</span><span id="Parser-1060"><a href="#Parser-1060"><span class="linenos">1060</span></a> <span class="n">no_primary_index</span><span class="o">=</span><span class="n">no_primary_index</span><span class="p">,</span> +</span><span id="Parser-1061"><a href="#Parser-1061"><span class="linenos">1061</span></a> <span class="n">indexes</span><span class="o">=</span><span class="n">indexes</span><span class="p">,</span> +</span><span id="Parser-1062"><a href="#Parser-1062"><span class="linenos">1062</span></a> <span class="n">no_schema_binding</span><span class="o">=</span><span class="n">no_schema_binding</span><span class="p">,</span> +</span><span id="Parser-1063"><a href="#Parser-1063"><span class="linenos">1063</span></a> <span class="n">begin</span><span class="o">=</span><span class="n">begin</span><span class="p">,</span> +</span><span id="Parser-1064"><a href="#Parser-1064"><span class="linenos">1064</span></a> <span class="p">)</span> +</span><span id="Parser-1065"><a href="#Parser-1065"><span class="linenos">1065</span></a> +</span><span id="Parser-1066"><a href="#Parser-1066"><span class="linenos">1066</span></a> <span class="k">def</span> <span class="nf">_parse_property_before</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1067"><a href="#Parser-1067"><span class="linenos">1067</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="Parser-1068"><a href="#Parser-1068"><span class="linenos">1068</span></a> +</span><span id="Parser-1069"><a href="#Parser-1069"><span class="linenos">1069</span></a> <span class="c1"># parsers look to _prev for no/dual/default, so need to consume first</span> +</span><span id="Parser-1070"><a href="#Parser-1070"><span class="linenos">1070</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">)</span> +</span><span id="Parser-1071"><a href="#Parser-1071"><span class="linenos">1071</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DUAL"</span><span class="p">)</span> +</span><span id="Parser-1072"><a href="#Parser-1072"><span class="linenos">1072</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFAULT"</span><span class="p">)</span> +</span><span id="Parser-1073"><a href="#Parser-1073"><span class="linenos">1073</span></a> +</span><span id="Parser-1074"><a href="#Parser-1074"><span class="linenos">1074</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()):</span> +</span><span id="Parser-1075"><a href="#Parser-1075"><span class="linenos">1075</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-1076"><a href="#Parser-1076"><span class="linenos">1076</span></a> +</span><span id="Parser-1077"><a href="#Parser-1077"><span class="linenos">1077</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1078"><a href="#Parser-1078"><span class="linenos">1078</span></a> +</span><span id="Parser-1079"><a href="#Parser-1079"><span class="linenos">1079</span></a> <span class="k">def</span> <span class="nf">_parse_property</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1080"><a href="#Parser-1080"><span class="linenos">1080</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">):</span> +</span><span id="Parser-1081"><a href="#Parser-1081"><span class="linenos">1081</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PROPERTY_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-1082"><a href="#Parser-1082"><span class="linenos">1082</span></a> +</span><span id="Parser-1083"><a href="#Parser-1083"><span class="linenos">1083</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHARACTER_SET</span><span class="p">):</span> +</span><span id="Parser-1084"><a href="#Parser-1084"><span class="linenos">1084</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_character_set</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1085"><a href="#Parser-1085"><span class="linenos">1085</span></a> +</span><span id="Parser-1086"><a href="#Parser-1086"><span class="linenos">1086</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMPOUND</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORTKEY</span><span class="p">):</span> +</span><span id="Parser-1087"><a href="#Parser-1087"><span class="linenos">1087</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_sortkey</span><span class="p">(</span><span class="n">compound</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1088"><a href="#Parser-1088"><span class="linenos">1088</span></a> +</span><span id="Parser-1089"><a href="#Parser-1089"><span class="linenos">1089</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SQL"</span><span class="p">,</span> <span class="s2">"SECURITY"</span><span class="p">):</span> +</span><span id="Parser-1090"><a href="#Parser-1090"><span class="linenos">1090</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SqlSecurityProperty</span><span class="p">,</span> <span class="n">definer</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFINER"</span><span class="p">))</span> +</span><span id="Parser-1091"><a href="#Parser-1091"><span class="linenos">1091</span></a> +</span><span id="Parser-1092"><a href="#Parser-1092"><span class="linenos">1092</span></a> <span class="n">assignment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span> +</span><span id="Parser-1093"><a href="#Parser-1093"><span class="linenos">1093</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span> +</span><span id="Parser-1094"><a href="#Parser-1094"><span class="linenos">1094</span></a> <span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-1095"><a href="#Parser-1095"><span class="linenos">1095</span></a> +</span><span id="Parser-1096"><a href="#Parser-1096"><span class="linenos">1096</span></a> <span class="k">if</span> <span class="n">assignment</span><span class="p">:</span> +</span><span id="Parser-1097"><a href="#Parser-1097"><span class="linenos">1097</span></a> <span class="n">key</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">()</span> +</span><span id="Parser-1098"><a href="#Parser-1098"><span class="linenos">1098</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1099"><a href="#Parser-1099"><span class="linenos">1099</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">key</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">())</span> +</span><span id="Parser-1100"><a href="#Parser-1100"><span class="linenos">1100</span></a> +</span><span id="Parser-1101"><a href="#Parser-1101"><span class="linenos">1101</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1102"><a href="#Parser-1102"><span class="linenos">1102</span></a> +</span><span id="Parser-1103"><a href="#Parser-1103"><span class="linenos">1103</span></a> <span class="k">def</span> <span class="nf">_parse_property_assignment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1104"><a href="#Parser-1104"><span class="linenos">1104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1105"><a href="#Parser-1105"><span class="linenos">1105</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-1106"><a href="#Parser-1106"><span class="linenos">1106</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1107"><a href="#Parser-1107"><span class="linenos">1107</span></a> <span class="n">exp_class</span><span class="p">,</span> +</span><span id="Parser-1108"><a href="#Parser-1108"><span class="linenos">1108</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(),</span> +</span><span id="Parser-1109"><a href="#Parser-1109"><span class="linenos">1109</span></a> <span class="p">)</span> +</span><span id="Parser-1110"><a href="#Parser-1110"><span class="linenos">1110</span></a> +</span><span id="Parser-1111"><a href="#Parser-1111"><span class="linenos">1111</span></a> <span class="k">def</span> <span class="nf">_parse_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">before</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1112"><a href="#Parser-1112"><span class="linenos">1112</span></a> <span class="n">properties</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-1113"><a href="#Parser-1113"><span class="linenos">1113</span></a> +</span><span id="Parser-1114"><a href="#Parser-1114"><span class="linenos">1114</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-1115"><a href="#Parser-1115"><span class="linenos">1115</span></a> <span class="k">if</span> <span class="n">before</span><span class="p">:</span> +</span><span id="Parser-1116"><a href="#Parser-1116"><span class="linenos">1116</span></a> <span class="n">identified_property</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property_before</span><span class="p">()</span> +</span><span id="Parser-1117"><a href="#Parser-1117"><span class="linenos">1117</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1118"><a href="#Parser-1118"><span class="linenos">1118</span></a> <span class="n">identified_property</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">()</span> +</span><span id="Parser-1119"><a href="#Parser-1119"><span class="linenos">1119</span></a> +</span><span id="Parser-1120"><a href="#Parser-1120"><span class="linenos">1120</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">identified_property</span><span class="p">:</span> +</span><span id="Parser-1121"><a href="#Parser-1121"><span class="linenos">1121</span></a> <span class="k">break</span> +</span><span id="Parser-1122"><a href="#Parser-1122"><span class="linenos">1122</span></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">identified_property</span><span class="p">):</span> +</span><span id="Parser-1123"><a href="#Parser-1123"><span class="linenos">1123</span></a> <span class="n">properties</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">p</span><span class="p">)</span> +</span><span id="Parser-1124"><a href="#Parser-1124"><span class="linenos">1124</span></a> +</span><span id="Parser-1125"><a href="#Parser-1125"><span class="linenos">1125</span></a> <span class="k">if</span> <span class="n">properties</span><span class="p">:</span> +</span><span id="Parser-1126"><a href="#Parser-1126"><span class="linenos">1126</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">properties</span><span class="p">)</span> +</span><span id="Parser-1127"><a href="#Parser-1127"><span class="linenos">1127</span></a> +</span><span id="Parser-1128"><a href="#Parser-1128"><span class="linenos">1128</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1129"><a href="#Parser-1129"><span class="linenos">1129</span></a> +</span><span id="Parser-1130"><a href="#Parser-1130"><span class="linenos">1130</span></a> <span class="k">def</span> <span class="nf">_parse_fallback</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1131"><a href="#Parser-1131"><span class="linenos">1131</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FALLBACK"</span><span class="p">)</span> +</span><span id="Parser-1132"><a href="#Parser-1132"><span class="linenos">1132</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1133"><a href="#Parser-1133"><span class="linenos">1133</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FallbackProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> <span class="n">protection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PROTECTION"</span><span class="p">)</span> +</span><span id="Parser-1134"><a href="#Parser-1134"><span class="linenos">1134</span></a> <span class="p">)</span> +</span><span id="Parser-1135"><a href="#Parser-1135"><span class="linenos">1135</span></a> +</span><span id="Parser-1136"><a href="#Parser-1136"><span class="linenos">1136</span></a> <span class="k">def</span> <span class="nf">_parse_with_property</span><span class="p">(</span> +</span><span id="Parser-1137"><a href="#Parser-1137"><span class="linenos">1137</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser-1138"><a href="#Parser-1138"><span class="linenos">1138</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="Parser-1139"><a href="#Parser-1139"><span class="linenos">1139</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-1140"><a href="#Parser-1140"><span class="linenos">1140</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_property</span><span class="p">)</span> +</span><span id="Parser-1141"><a href="#Parser-1141"><span class="linenos">1141</span></a> +</span><span id="Parser-1142"><a href="#Parser-1142"><span class="linenos">1142</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="p">:</span> +</span><span id="Parser-1143"><a href="#Parser-1143"><span class="linenos">1143</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1144"><a href="#Parser-1144"><span class="linenos">1144</span></a> +</span><span id="Parser-1145"><a href="#Parser-1145"><span class="linenos">1145</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"JOURNAL"</span><span class="p">:</span> +</span><span id="Parser-1146"><a href="#Parser-1146"><span class="linenos">1146</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_withjournaltable</span><span class="p">()</span> +</span><span id="Parser-1147"><a href="#Parser-1147"><span class="linenos">1147</span></a> +</span><span id="Parser-1148"><a href="#Parser-1148"><span class="linenos">1148</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_withisolatedloading</span><span class="p">()</span> +</span><span id="Parser-1149"><a href="#Parser-1149"><span class="linenos">1149</span></a> +</span><span id="Parser-1150"><a href="#Parser-1150"><span class="linenos">1150</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/create-view.html</span> +</span><span id="Parser-1151"><a href="#Parser-1151"><span class="linenos">1151</span></a> <span class="k">def</span> <span class="nf">_parse_definer</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1152"><a href="#Parser-1152"><span class="linenos">1152</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1153"><a href="#Parser-1153"><span class="linenos">1153</span></a> +</span><span id="Parser-1154"><a href="#Parser-1154"><span class="linenos">1154</span></a> <span class="n">user</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-1155"><a href="#Parser-1155"><span class="linenos">1155</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">)</span> +</span><span id="Parser-1156"><a href="#Parser-1156"><span class="linenos">1156</span></a> <span class="n">host</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="ow">or</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-1157"><a href="#Parser-1157"><span class="linenos">1157</span></a> +</span><span id="Parser-1158"><a href="#Parser-1158"><span class="linenos">1158</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">user</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">host</span><span class="p">:</span> +</span><span id="Parser-1159"><a href="#Parser-1159"><span class="linenos">1159</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1160"><a href="#Parser-1160"><span class="linenos">1160</span></a> +</span><span id="Parser-1161"><a href="#Parser-1161"><span class="linenos">1161</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DefinerProperty</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">user</span><span class="si">}</span><span class="s2">@</span><span class="si">{</span><span class="n">host</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Parser-1162"><a href="#Parser-1162"><span class="linenos">1162</span></a> +</span><span id="Parser-1163"><a href="#Parser-1163"><span class="linenos">1163</span></a> <span class="k">def</span> <span class="nf">_parse_withjournaltable</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1164"><a href="#Parser-1164"><span class="linenos">1164</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"JOURNAL"</span><span class="p">,</span> <span class="s2">"TABLE"</span><span class="p">)</span> +</span><span id="Parser-1165"><a href="#Parser-1165"><span class="linenos">1165</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1166"><a href="#Parser-1166"><span class="linenos">1166</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">WithJournalTableProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">())</span> +</span><span id="Parser-1167"><a href="#Parser-1167"><span class="linenos">1167</span></a> +</span><span id="Parser-1168"><a href="#Parser-1168"><span class="linenos">1168</span></a> <span class="k">def</span> <span class="nf">_parse_log</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1169"><a href="#Parser-1169"><span class="linenos">1169</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LOG"</span><span class="p">)</span> +</span><span id="Parser-1170"><a href="#Parser-1170"><span class="linenos">1170</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LogProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">)</span> +</span><span id="Parser-1171"><a href="#Parser-1171"><span class="linenos">1171</span></a> +</span><span id="Parser-1172"><a href="#Parser-1172"><span class="linenos">1172</span></a> <span class="k">def</span> <span class="nf">_parse_journal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1173"><a href="#Parser-1173"><span class="linenos">1173</span></a> <span class="n">before</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"BEFORE"</span><span class="p">)</span> +</span><span id="Parser-1174"><a href="#Parser-1174"><span class="linenos">1174</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"JOURNAL"</span><span class="p">)</span> +</span><span id="Parser-1175"><a href="#Parser-1175"><span class="linenos">1175</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">JournalProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="n">dual</span><span class="p">,</span> <span class="n">before</span><span class="o">=</span><span class="n">before</span><span class="p">)</span> +</span><span id="Parser-1176"><a href="#Parser-1176"><span class="linenos">1176</span></a> +</span><span id="Parser-1177"><a href="#Parser-1177"><span class="linenos">1177</span></a> <span class="k">def</span> <span class="nf">_parse_afterjournal</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1178"><a href="#Parser-1178"><span class="linenos">1178</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NOT"</span><span class="p">)</span> +</span><span id="Parser-1179"><a href="#Parser-1179"><span class="linenos">1179</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LOCAL"</span><span class="p">)</span> +</span><span id="Parser-1180"><a href="#Parser-1180"><span class="linenos">1180</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AFTER"</span><span class="p">,</span> <span class="s2">"JOURNAL"</span><span class="p">)</span> +</span><span id="Parser-1181"><a href="#Parser-1181"><span class="linenos">1181</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AfterJournalProperty</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> <span class="n">dual</span><span class="o">=</span><span class="n">dual</span><span class="p">,</span> <span class="n">local</span><span class="o">=</span><span class="n">local</span><span class="p">)</span> +</span><span id="Parser-1182"><a href="#Parser-1182"><span class="linenos">1182</span></a> +</span><span id="Parser-1183"><a href="#Parser-1183"><span class="linenos">1183</span></a> <span class="k">def</span> <span class="nf">_parse_checksum</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1184"><a href="#Parser-1184"><span class="linenos">1184</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CHECKSUM"</span><span class="p">)</span> +</span><span id="Parser-1185"><a href="#Parser-1185"><span class="linenos">1185</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1186"><a href="#Parser-1186"><span class="linenos">1186</span></a> +</span><span id="Parser-1187"><a href="#Parser-1187"><span class="linenos">1187</span></a> <span class="n">on</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1188"><a href="#Parser-1188"><span class="linenos">1188</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="Parser-1189"><a href="#Parser-1189"><span class="linenos">1189</span></a> <span class="n">on</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1190"><a href="#Parser-1190"><span class="linenos">1190</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OFF"</span><span class="p">):</span> +</span><span id="Parser-1191"><a href="#Parser-1191"><span class="linenos">1191</span></a> <span class="n">on</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-1192"><a href="#Parser-1192"><span class="linenos">1192</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">)</span> +</span><span id="Parser-1193"><a href="#Parser-1193"><span class="linenos">1193</span></a> +</span><span id="Parser-1194"><a href="#Parser-1194"><span class="linenos">1194</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1195"><a href="#Parser-1195"><span class="linenos">1195</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ChecksumProperty</span><span class="p">,</span> +</span><span id="Parser-1196"><a href="#Parser-1196"><span class="linenos">1196</span></a> <span class="n">on</span><span class="o">=</span><span class="n">on</span><span class="p">,</span> +</span><span id="Parser-1197"><a href="#Parser-1197"><span class="linenos">1197</span></a> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> +</span><span id="Parser-1198"><a href="#Parser-1198"><span class="linenos">1198</span></a> <span class="p">)</span> +</span><span id="Parser-1199"><a href="#Parser-1199"><span class="linenos">1199</span></a> +</span><span id="Parser-1200"><a href="#Parser-1200"><span class="linenos">1200</span></a> <span class="k">def</span> <span class="nf">_parse_freespace</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1201"><a href="#Parser-1201"><span class="linenos">1201</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FREESPACE"</span><span class="p">)</span> +</span><span id="Parser-1202"><a href="#Parser-1202"><span class="linenos">1202</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1203"><a href="#Parser-1203"><span class="linenos">1203</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1204"><a href="#Parser-1204"><span class="linenos">1204</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FreespaceProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">(),</span> <span class="n">percent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">)</span> +</span><span id="Parser-1205"><a href="#Parser-1205"><span class="linenos">1205</span></a> <span class="p">)</span> +</span><span id="Parser-1206"><a href="#Parser-1206"><span class="linenos">1206</span></a> +</span><span id="Parser-1207"><a href="#Parser-1207"><span class="linenos">1207</span></a> <span class="k">def</span> <span class="nf">_parse_mergeblockratio</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">no</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1208"><a href="#Parser-1208"><span class="linenos">1208</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MERGEBLOCKRATIO"</span><span class="p">)</span> +</span><span id="Parser-1209"><a href="#Parser-1209"><span class="linenos">1209</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">):</span> +</span><span id="Parser-1210"><a href="#Parser-1210"><span class="linenos">1210</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1211"><a href="#Parser-1211"><span class="linenos">1211</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">,</span> +</span><span id="Parser-1212"><a href="#Parser-1212"><span class="linenos">1212</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">(),</span> +</span><span id="Parser-1213"><a href="#Parser-1213"><span class="linenos">1213</span></a> <span class="n">percent</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">),</span> +</span><span id="Parser-1214"><a href="#Parser-1214"><span class="linenos">1214</span></a> <span class="p">)</span> +</span><span id="Parser-1215"><a href="#Parser-1215"><span class="linenos">1215</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1216"><a href="#Parser-1216"><span class="linenos">1216</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1217"><a href="#Parser-1217"><span class="linenos">1217</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MergeBlockRatioProperty</span><span class="p">,</span> +</span><span id="Parser-1218"><a href="#Parser-1218"><span class="linenos">1218</span></a> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> +</span><span id="Parser-1219"><a href="#Parser-1219"><span class="linenos">1219</span></a> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> +</span><span id="Parser-1220"><a href="#Parser-1220"><span class="linenos">1220</span></a> <span class="p">)</span> +</span><span id="Parser-1221"><a href="#Parser-1221"><span class="linenos">1221</span></a> +</span><span id="Parser-1222"><a href="#Parser-1222"><span class="linenos">1222</span></a> <span class="k">def</span> <span class="nf">_parse_datablocksize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1223"><a href="#Parser-1223"><span class="linenos">1223</span></a> <span class="k">if</span> <span class="n">default</span><span class="p">:</span> +</span><span id="Parser-1224"><a href="#Parser-1224"><span class="linenos">1224</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="Parser-1225"><a href="#Parser-1225"><span class="linenos">1225</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1226"><a href="#Parser-1226"><span class="linenos">1226</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"MIN"</span><span class="p">,</span> <span class="s2">"MINIMUM"</span><span class="p">)):</span> +</span><span id="Parser-1227"><a href="#Parser-1227"><span class="linenos">1227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="Parser-1228"><a href="#Parser-1228"><span class="linenos">1228</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="nb">min</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1229"><a href="#Parser-1229"><span class="linenos">1229</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"MAX"</span><span class="p">,</span> <span class="s2">"MAXIMUM"</span><span class="p">)):</span> +</span><span id="Parser-1230"><a href="#Parser-1230"><span class="linenos">1230</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="Parser-1231"><a href="#Parser-1231"><span class="linenos">1231</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="nb">min</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-1232"><a href="#Parser-1232"><span class="linenos">1232</span></a> +</span><span id="Parser-1233"><a href="#Parser-1233"><span class="linenos">1233</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DATABLOCKSIZE"</span><span class="p">)</span> +</span><span id="Parser-1234"><a href="#Parser-1234"><span class="linenos">1234</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1235"><a href="#Parser-1235"><span class="linenos">1235</span></a> <span class="n">size</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="Parser-1236"><a href="#Parser-1236"><span class="linenos">1236</span></a> <span class="n">units</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1237"><a href="#Parser-1237"><span class="linenos">1237</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"BYTES"</span><span class="p">,</span> <span class="s2">"KBYTES"</span><span class="p">,</span> <span class="s2">"KILOBYTES"</span><span class="p">)):</span> +</span><span id="Parser-1238"><a href="#Parser-1238"><span class="linenos">1238</span></a> <span class="n">units</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-1239"><a href="#Parser-1239"><span class="linenos">1239</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DataBlocksizeProperty</span><span class="p">,</span> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span> <span class="n">units</span><span class="o">=</span><span class="n">units</span><span class="p">)</span> +</span><span id="Parser-1240"><a href="#Parser-1240"><span class="linenos">1240</span></a> +</span><span id="Parser-1241"><a href="#Parser-1241"><span class="linenos">1241</span></a> <span class="k">def</span> <span class="nf">_parse_blockcompression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1242"><a href="#Parser-1242"><span class="linenos">1242</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"BLOCKCOMPRESSION"</span><span class="p">)</span> +</span><span id="Parser-1243"><a href="#Parser-1243"><span class="linenos">1243</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1244"><a href="#Parser-1244"><span class="linenos">1244</span></a> <span class="n">always</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">)</span> +</span><span id="Parser-1245"><a href="#Parser-1245"><span class="linenos">1245</span></a> <span class="n">manual</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MANUAL"</span><span class="p">)</span> +</span><span id="Parser-1246"><a href="#Parser-1246"><span class="linenos">1246</span></a> <span class="n">never</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NEVER"</span><span class="p">)</span> +</span><span id="Parser-1247"><a href="#Parser-1247"><span class="linenos">1247</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFAULT"</span><span class="p">)</span> +</span><span id="Parser-1248"><a href="#Parser-1248"><span class="linenos">1248</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1249"><a href="#Parser-1249"><span class="linenos">1249</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AUTOTEMP"</span><span class="p">):</span> +</span><span id="Parser-1250"><a href="#Parser-1250"><span class="linenos">1250</span></a> <span class="n">autotemp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> +</span><span id="Parser-1251"><a href="#Parser-1251"><span class="linenos">1251</span></a> +</span><span id="Parser-1252"><a href="#Parser-1252"><span class="linenos">1252</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1253"><a href="#Parser-1253"><span class="linenos">1253</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BlockCompressionProperty</span><span class="p">,</span> +</span><span id="Parser-1254"><a href="#Parser-1254"><span class="linenos">1254</span></a> <span class="n">always</span><span class="o">=</span><span class="n">always</span><span class="p">,</span> +</span><span id="Parser-1255"><a href="#Parser-1255"><span class="linenos">1255</span></a> <span class="n">manual</span><span class="o">=</span><span class="n">manual</span><span class="p">,</span> +</span><span id="Parser-1256"><a href="#Parser-1256"><span class="linenos">1256</span></a> <span class="n">never</span><span class="o">=</span><span class="n">never</span><span class="p">,</span> +</span><span id="Parser-1257"><a href="#Parser-1257"><span class="linenos">1257</span></a> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> +</span><span id="Parser-1258"><a href="#Parser-1258"><span class="linenos">1258</span></a> <span class="n">autotemp</span><span class="o">=</span><span class="n">autotemp</span><span class="p">,</span> +</span><span id="Parser-1259"><a href="#Parser-1259"><span class="linenos">1259</span></a> <span class="p">)</span> +</span><span id="Parser-1260"><a href="#Parser-1260"><span class="linenos">1260</span></a> +</span><span id="Parser-1261"><a href="#Parser-1261"><span class="linenos">1261</span></a> <span class="k">def</span> <span class="nf">_parse_withisolatedloading</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1262"><a href="#Parser-1262"><span class="linenos">1262</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> +</span><span id="Parser-1263"><a href="#Parser-1263"><span class="linenos">1263</span></a> <span class="n">no</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">)</span> +</span><span id="Parser-1264"><a href="#Parser-1264"><span class="linenos">1264</span></a> <span class="n">concurrent</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CONCURRENT"</span><span class="p">)</span> +</span><span id="Parser-1265"><a href="#Parser-1265"><span class="linenos">1265</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ISOLATED"</span><span class="p">,</span> <span class="s2">"LOADING"</span><span class="p">)</span> +</span><span id="Parser-1266"><a href="#Parser-1266"><span class="linenos">1266</span></a> <span class="n">for_all</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"ALL"</span><span class="p">)</span> +</span><span id="Parser-1267"><a href="#Parser-1267"><span class="linenos">1267</span></a> <span class="n">for_insert</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"INSERT"</span><span class="p">)</span> +</span><span id="Parser-1268"><a href="#Parser-1268"><span class="linenos">1268</span></a> <span class="n">for_none</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"NONE"</span><span class="p">)</span> +</span><span id="Parser-1269"><a href="#Parser-1269"><span class="linenos">1269</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1270"><a href="#Parser-1270"><span class="linenos">1270</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">IsolatedLoadingProperty</span><span class="p">,</span> +</span><span id="Parser-1271"><a href="#Parser-1271"><span class="linenos">1271</span></a> <span class="n">no</span><span class="o">=</span><span class="n">no</span><span class="p">,</span> +</span><span id="Parser-1272"><a href="#Parser-1272"><span class="linenos">1272</span></a> <span class="n">concurrent</span><span class="o">=</span><span class="n">concurrent</span><span class="p">,</span> +</span><span id="Parser-1273"><a href="#Parser-1273"><span class="linenos">1273</span></a> <span class="n">for_all</span><span class="o">=</span><span class="n">for_all</span><span class="p">,</span> +</span><span id="Parser-1274"><a href="#Parser-1274"><span class="linenos">1274</span></a> <span class="n">for_insert</span><span class="o">=</span><span class="n">for_insert</span><span class="p">,</span> +</span><span id="Parser-1275"><a href="#Parser-1275"><span class="linenos">1275</span></a> <span class="n">for_none</span><span class="o">=</span><span class="n">for_none</span><span class="p">,</span> +</span><span id="Parser-1276"><a href="#Parser-1276"><span class="linenos">1276</span></a> <span class="p">)</span> +</span><span id="Parser-1277"><a href="#Parser-1277"><span class="linenos">1277</span></a> +</span><span id="Parser-1278"><a href="#Parser-1278"><span class="linenos">1278</span></a> <span class="k">def</span> <span class="nf">_parse_partition_by</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-1279"><a href="#Parser-1279"><span class="linenos">1279</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">):</span> +</span><span id="Parser-1280"><a href="#Parser-1280"><span class="linenos">1280</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-1281"><a href="#Parser-1281"><span class="linenos">1281</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="Parser-1282"><a href="#Parser-1282"><span class="linenos">1282</span></a> +</span><span id="Parser-1283"><a href="#Parser-1283"><span class="linenos">1283</span></a> <span class="k">def</span> <span class="nf">_parse_partitioned_by</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1284"><a href="#Parser-1284"><span class="linenos">1284</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1285"><a href="#Parser-1285"><span class="linenos">1285</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1286"><a href="#Parser-1286"><span class="linenos">1286</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</span><span class="p">,</span> +</span><span id="Parser-1287"><a href="#Parser-1287"><span class="linenos">1287</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">()),</span> +</span><span id="Parser-1288"><a href="#Parser-1288"><span class="linenos">1288</span></a> <span class="p">)</span> +</span><span id="Parser-1289"><a href="#Parser-1289"><span class="linenos">1289</span></a> +</span><span id="Parser-1290"><a href="#Parser-1290"><span class="linenos">1290</span></a> <span class="k">def</span> <span class="nf">_parse_distkey</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1291"><a href="#Parser-1291"><span class="linenos">1291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">))</span> +</span><span id="Parser-1292"><a href="#Parser-1292"><span class="linenos">1292</span></a> +</span><span id="Parser-1293"><a href="#Parser-1293"><span class="linenos">1293</span></a> <span class="k">def</span> <span class="nf">_parse_create_like</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1294"><a href="#Parser-1294"><span class="linenos">1294</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1295"><a href="#Parser-1295"><span class="linenos">1295</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-1296"><a href="#Parser-1296"><span class="linenos">1296</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">((</span><span class="s2">"INCLUDING"</span><span class="p">,</span> <span class="s2">"EXCLUDING"</span><span class="p">)):</span> +</span><span id="Parser-1297"><a href="#Parser-1297"><span class="linenos">1297</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Parser-1298"><a href="#Parser-1298"><span class="linenos">1298</span></a> <span class="n">id_var</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-1299"><a href="#Parser-1299"><span class="linenos">1299</span></a> +</span><span id="Parser-1300"><a href="#Parser-1300"><span class="linenos">1300</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">id_var</span><span class="p">:</span> +</span><span id="Parser-1301"><a href="#Parser-1301"><span class="linenos">1301</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1302"><a href="#Parser-1302"><span class="linenos">1302</span></a> +</span><span id="Parser-1303"><a href="#Parser-1303"><span class="linenos">1303</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Parser-1304"><a href="#Parser-1304"><span class="linenos">1304</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1305"><a href="#Parser-1305"><span class="linenos">1305</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">,</span> +</span><span id="Parser-1306"><a href="#Parser-1306"><span class="linenos">1306</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-1307"><a href="#Parser-1307"><span class="linenos">1307</span></a> <span class="n">value</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">id_var</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">upper</span><span class="p">()),</span> +</span><span id="Parser-1308"><a href="#Parser-1308"><span class="linenos">1308</span></a> <span class="p">)</span> +</span><span id="Parser-1309"><a href="#Parser-1309"><span class="linenos">1309</span></a> <span class="p">)</span> +</span><span id="Parser-1310"><a href="#Parser-1310"><span class="linenos">1310</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LikeProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">options</span><span class="p">)</span> +</span><span id="Parser-1311"><a href="#Parser-1311"><span class="linenos">1311</span></a> +</span><span id="Parser-1312"><a href="#Parser-1312"><span class="linenos">1312</span></a> <span class="k">def</span> <span class="nf">_parse_sortkey</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">compound</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1313"><a href="#Parser-1313"><span class="linenos">1313</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1314"><a href="#Parser-1314"><span class="linenos">1314</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">),</span> <span class="n">compound</span><span class="o">=</span><span class="n">compound</span> +</span><span id="Parser-1315"><a href="#Parser-1315"><span class="linenos">1315</span></a> <span class="p">)</span> +</span><span id="Parser-1316"><a href="#Parser-1316"><span class="linenos">1316</span></a> +</span><span id="Parser-1317"><a href="#Parser-1317"><span class="linenos">1317</span></a> <span class="k">def</span> <span class="nf">_parse_character_set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">default</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1318"><a href="#Parser-1318"><span class="linenos">1318</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1319"><a href="#Parser-1319"><span class="linenos">1319</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1320"><a href="#Parser-1320"><span class="linenos">1320</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CharacterSetProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">(),</span> <span class="n">default</span><span class="o">=</span><span class="n">default</span> +</span><span id="Parser-1321"><a href="#Parser-1321"><span class="linenos">1321</span></a> <span class="p">)</span> +</span><span id="Parser-1322"><a href="#Parser-1322"><span class="linenos">1322</span></a> +</span><span id="Parser-1323"><a href="#Parser-1323"><span class="linenos">1323</span></a> <span class="k">def</span> <span class="nf">_parse_returns</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1324"><a href="#Parser-1324"><span class="linenos">1324</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-1325"><a href="#Parser-1325"><span class="linenos">1325</span></a> <span class="n">is_table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="Parser-1326"><a href="#Parser-1326"><span class="linenos">1326</span></a> +</span><span id="Parser-1327"><a href="#Parser-1327"><span class="linenos">1327</span></a> <span class="k">if</span> <span class="n">is_table</span><span class="p">:</span> +</span><span id="Parser-1328"><a href="#Parser-1328"><span class="linenos">1328</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="Parser-1329"><a href="#Parser-1329"><span class="linenos">1329</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1330"><a href="#Parser-1330"><span class="linenos">1330</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">,</span> +</span><span id="Parser-1331"><a href="#Parser-1331"><span class="linenos">1331</span></a> <span class="n">this</span><span class="o">=</span><span class="s2">"TABLE"</span><span class="p">,</span> +</span><span id="Parser-1332"><a href="#Parser-1332"><span class="linenos">1332</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_struct_kwargs</span><span class="p">),</span> +</span><span id="Parser-1333"><a href="#Parser-1333"><span class="linenos">1333</span></a> <span class="p">)</span> +</span><span id="Parser-1334"><a href="#Parser-1334"><span class="linenos">1334</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="Parser-1335"><a href="#Parser-1335"><span class="linenos">1335</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting >"</span><span class="p">)</span> +</span><span id="Parser-1336"><a href="#Parser-1336"><span class="linenos">1336</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1337"><a href="#Parser-1337"><span class="linenos">1337</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"TABLE"</span><span class="p">))</span> +</span><span id="Parser-1338"><a href="#Parser-1338"><span class="linenos">1338</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1339"><a href="#Parser-1339"><span class="linenos">1339</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-1340"><a href="#Parser-1340"><span class="linenos">1340</span></a> +</span><span id="Parser-1341"><a href="#Parser-1341"><span class="linenos">1341</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ReturnsProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">value</span><span class="p">,</span> <span class="n">is_table</span><span class="o">=</span><span class="n">is_table</span><span class="p">)</span> +</span><span id="Parser-1342"><a href="#Parser-1342"><span class="linenos">1342</span></a> +</span><span id="Parser-1343"><a href="#Parser-1343"><span class="linenos">1343</span></a> <span class="k">def</span> <span class="nf">_parse_describe</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1344"><a href="#Parser-1344"><span class="linenos">1344</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CREATABLES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-1345"><a href="#Parser-1345"><span class="linenos">1345</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> +</span><span id="Parser-1346"><a href="#Parser-1346"><span class="linenos">1346</span></a> +</span><span id="Parser-1347"><a href="#Parser-1347"><span class="linenos">1347</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Describe</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="Parser-1348"><a href="#Parser-1348"><span class="linenos">1348</span></a> +</span><span id="Parser-1349"><a href="#Parser-1349"><span class="linenos">1349</span></a> <span class="k">def</span> <span class="nf">_parse_insert</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1350"><a href="#Parser-1350"><span class="linenos">1350</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OVERWRITE</span><span class="p">)</span> +</span><span id="Parser-1351"><a href="#Parser-1351"><span class="linenos">1351</span></a> <span class="n">local</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">)</span> +</span><span id="Parser-1352"><a href="#Parser-1352"><span class="linenos">1352</span></a> +</span><span id="Parser-1353"><a href="#Parser-1353"><span class="linenos">1353</span></a> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-1354"><a href="#Parser-1354"><span class="linenos">1354</span></a> +</span><span id="Parser-1355"><a href="#Parser-1355"><span class="linenos">1355</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DIRECTORY"</span><span class="p">):</span> +</span><span id="Parser-1356"><a href="#Parser-1356"><span class="linenos">1356</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1357"><a href="#Parser-1357"><span class="linenos">1357</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Directory</span><span class="p">,</span> +</span><span id="Parser-1358"><a href="#Parser-1358"><span class="linenos">1358</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">(),</span> +</span><span id="Parser-1359"><a href="#Parser-1359"><span class="linenos">1359</span></a> <span class="n">local</span><span class="o">=</span><span class="n">local</span><span class="p">,</span> +</span><span id="Parser-1360"><a href="#Parser-1360"><span class="linenos">1360</span></a> <span class="n">row_format</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_row_format</span><span class="p">(</span><span class="n">match_row</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-1361"><a href="#Parser-1361"><span class="linenos">1361</span></a> <span class="p">)</span> +</span><span id="Parser-1362"><a href="#Parser-1362"><span class="linenos">1362</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1363"><a href="#Parser-1363"><span class="linenos">1363</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">)</span> +</span><span id="Parser-1364"><a href="#Parser-1364"><span class="linenos">1364</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="Parser-1365"><a href="#Parser-1365"><span class="linenos">1365</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1366"><a href="#Parser-1366"><span class="linenos">1366</span></a> +</span><span id="Parser-1367"><a href="#Parser-1367"><span class="linenos">1367</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1368"><a href="#Parser-1368"><span class="linenos">1368</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">,</span> +</span><span id="Parser-1369"><a href="#Parser-1369"><span class="linenos">1369</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-1370"><a href="#Parser-1370"><span class="linenos">1370</span></a> <span class="n">exists</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(),</span> +</span><span id="Parser-1371"><a href="#Parser-1371"><span class="linenos">1371</span></a> <span class="n">partition</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition</span><span class="p">(),</span> +</span><span id="Parser-1372"><a href="#Parser-1372"><span class="linenos">1372</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_ddl_select</span><span class="p">(),</span> +</span><span id="Parser-1373"><a href="#Parser-1373"><span class="linenos">1373</span></a> <span class="n">overwrite</span><span class="o">=</span><span class="n">overwrite</span><span class="p">,</span> +</span><span id="Parser-1374"><a href="#Parser-1374"><span class="linenos">1374</span></a> <span class="p">)</span> +</span><span id="Parser-1375"><a href="#Parser-1375"><span class="linenos">1375</span></a> +</span><span id="Parser-1376"><a href="#Parser-1376"><span class="linenos">1376</span></a> <span class="k">def</span> <span class="nf">_parse_row</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1377"><a href="#Parser-1377"><span class="linenos">1377</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span> +</span><span id="Parser-1378"><a href="#Parser-1378"><span class="linenos">1378</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1379"><a href="#Parser-1379"><span class="linenos">1379</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_row_format</span><span class="p">()</span> +</span><span id="Parser-1380"><a href="#Parser-1380"><span class="linenos">1380</span></a> +</span><span id="Parser-1381"><a href="#Parser-1381"><span class="linenos">1381</span></a> <span class="k">def</span> <span class="nf">_parse_row_format</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">match_row</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1382"><a href="#Parser-1382"><span class="linenos">1382</span></a> <span class="k">if</span> <span class="n">match_row</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span> +</span><span id="Parser-1383"><a href="#Parser-1383"><span class="linenos">1383</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1384"><a href="#Parser-1384"><span class="linenos">1384</span></a> +</span><span id="Parser-1385"><a href="#Parser-1385"><span class="linenos">1385</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SERDE"</span><span class="p">):</span> +</span><span id="Parser-1386"><a href="#Parser-1386"><span class="linenos">1386</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RowFormatSerdeProperty</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="Parser-1387"><a href="#Parser-1387"><span class="linenos">1387</span></a> +</span><span id="Parser-1388"><a href="#Parser-1388"><span class="linenos">1388</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DELIMITED"</span><span class="p">)</span> +</span><span id="Parser-1389"><a href="#Parser-1389"><span class="linenos">1389</span></a> +</span><span id="Parser-1390"><a href="#Parser-1390"><span class="linenos">1390</span></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Parser-1391"><a href="#Parser-1391"><span class="linenos">1391</span></a> +</span><span id="Parser-1392"><a href="#Parser-1392"><span class="linenos">1392</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FIELDS"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="Parser-1393"><a href="#Parser-1393"><span class="linenos">1393</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"fields"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1394"><a href="#Parser-1394"><span class="linenos">1394</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ESCAPED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="Parser-1395"><a href="#Parser-1395"><span class="linenos">1395</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"escaped"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1396"><a href="#Parser-1396"><span class="linenos">1396</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"COLLECTION"</span><span class="p">,</span> <span class="s2">"ITEMS"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="Parser-1397"><a href="#Parser-1397"><span class="linenos">1397</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"collection_items"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1398"><a href="#Parser-1398"><span class="linenos">1398</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MAP"</span><span class="p">,</span> <span class="s2">"KEYS"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="Parser-1399"><a href="#Parser-1399"><span class="linenos">1399</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"map_keys"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1400"><a href="#Parser-1400"><span class="linenos">1400</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"LINES"</span><span class="p">,</span> <span class="s2">"TERMINATED"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="Parser-1401"><a href="#Parser-1401"><span class="linenos">1401</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"lines"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1402"><a href="#Parser-1402"><span class="linenos">1402</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NULL"</span><span class="p">,</span> <span class="s2">"DEFINED"</span><span class="p">,</span> <span class="s2">"AS"</span><span class="p">):</span> +</span><span id="Parser-1403"><a href="#Parser-1403"><span class="linenos">1403</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"null"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1404"><a href="#Parser-1404"><span class="linenos">1404</span></a> +</span><span id="Parser-1405"><a href="#Parser-1405"><span class="linenos">1405</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RowFormatDelimitedProperty</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-1406"><a href="#Parser-1406"><span class="linenos">1406</span></a> +</span><span id="Parser-1407"><a href="#Parser-1407"><span class="linenos">1407</span></a> <span class="k">def</span> <span class="nf">_parse_load_data</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1408"><a href="#Parser-1408"><span class="linenos">1408</span></a> <span class="n">local</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">)</span> +</span><span id="Parser-1409"><a href="#Parser-1409"><span class="linenos">1409</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INPATH"</span><span class="p">)</span> +</span><span id="Parser-1410"><a href="#Parser-1410"><span class="linenos">1410</span></a> <span class="n">inpath</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1411"><a href="#Parser-1411"><span class="linenos">1411</span></a> <span class="n">overwrite</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OVERWRITE</span><span class="p">)</span> +</span><span id="Parser-1412"><a href="#Parser-1412"><span class="linenos">1412</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="Parser-1413"><a href="#Parser-1413"><span class="linenos">1413</span></a> +</span><span id="Parser-1414"><a href="#Parser-1414"><span class="linenos">1414</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1415"><a href="#Parser-1415"><span class="linenos">1415</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">LoadData</span><span class="p">,</span> +</span><span id="Parser-1416"><a href="#Parser-1416"><span class="linenos">1416</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-1417"><a href="#Parser-1417"><span class="linenos">1417</span></a> <span class="n">local</span><span class="o">=</span><span class="n">local</span><span class="p">,</span> +</span><span id="Parser-1418"><a href="#Parser-1418"><span class="linenos">1418</span></a> <span class="n">overwrite</span><span class="o">=</span><span class="n">overwrite</span><span class="p">,</span> +</span><span id="Parser-1419"><a href="#Parser-1419"><span class="linenos">1419</span></a> <span class="n">inpath</span><span class="o">=</span><span class="n">inpath</span><span class="p">,</span> +</span><span id="Parser-1420"><a href="#Parser-1420"><span class="linenos">1420</span></a> <span class="n">partition</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition</span><span class="p">(),</span> +</span><span id="Parser-1421"><a href="#Parser-1421"><span class="linenos">1421</span></a> <span class="n">input_format</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INPUTFORMAT"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">(),</span> +</span><span id="Parser-1422"><a href="#Parser-1422"><span class="linenos">1422</span></a> <span class="n">serde</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SERDE"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">(),</span> +</span><span id="Parser-1423"><a href="#Parser-1423"><span class="linenos">1423</span></a> <span class="p">)</span> +</span><span id="Parser-1424"><a href="#Parser-1424"><span class="linenos">1424</span></a> +</span><span id="Parser-1425"><a href="#Parser-1425"><span class="linenos">1425</span></a> <span class="k">def</span> <span class="nf">_parse_delete</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1426"><a href="#Parser-1426"><span class="linenos">1426</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">)</span> +</span><span id="Parser-1427"><a href="#Parser-1427"><span class="linenos">1427</span></a> +</span><span id="Parser-1428"><a href="#Parser-1428"><span class="linenos">1428</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1429"><a href="#Parser-1429"><span class="linenos">1429</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">,</span> +</span><span id="Parser-1430"><a href="#Parser-1430"><span class="linenos">1430</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-1431"><a href="#Parser-1431"><span class="linenos">1431</span></a> <span class="n">using</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()),</span> +</span><span id="Parser-1432"><a href="#Parser-1432"><span class="linenos">1432</span></a> <span class="n">where</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="Parser-1433"><a href="#Parser-1433"><span class="linenos">1433</span></a> <span class="p">)</span> +</span><span id="Parser-1434"><a href="#Parser-1434"><span class="linenos">1434</span></a> +</span><span id="Parser-1435"><a href="#Parser-1435"><span class="linenos">1435</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1436"><a href="#Parser-1436"><span class="linenos">1436</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1437"><a href="#Parser-1437"><span class="linenos">1437</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="Parser-1438"><a href="#Parser-1438"><span class="linenos">1438</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-1439"><a href="#Parser-1439"><span class="linenos">1439</span></a> <span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span> +</span><span id="Parser-1440"><a href="#Parser-1440"><span class="linenos">1440</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="Parser-1441"><a href="#Parser-1441"><span class="linenos">1441</span></a> <span class="s2">"from"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(),</span> +</span><span id="Parser-1442"><a href="#Parser-1442"><span class="linenos">1442</span></a> <span class="s2">"where"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span> +</span><span id="Parser-1443"><a href="#Parser-1443"><span class="linenos">1443</span></a> <span class="p">},</span> +</span><span id="Parser-1444"><a href="#Parser-1444"><span class="linenos">1444</span></a> <span class="p">)</span> +</span><span id="Parser-1445"><a href="#Parser-1445"><span class="linenos">1445</span></a> +</span><span id="Parser-1446"><a href="#Parser-1446"><span class="linenos">1446</span></a> <span class="k">def</span> <span class="nf">_parse_uncache</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1447"><a href="#Parser-1447"><span class="linenos">1447</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">):</span> +</span><span id="Parser-1448"><a href="#Parser-1448"><span class="linenos">1448</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting TABLE after UNCACHE"</span><span class="p">)</span> +</span><span id="Parser-1449"><a href="#Parser-1449"><span class="linenos">1449</span></a> +</span><span id="Parser-1450"><a href="#Parser-1450"><span class="linenos">1450</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1451"><a href="#Parser-1451"><span class="linenos">1451</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Uncache</span><span class="p">,</span> +</span><span id="Parser-1452"><a href="#Parser-1452"><span class="linenos">1452</span></a> <span class="n">exists</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(),</span> +</span><span id="Parser-1453"><a href="#Parser-1453"><span class="linenos">1453</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-1454"><a href="#Parser-1454"><span class="linenos">1454</span></a> <span class="p">)</span> +</span><span id="Parser-1455"><a href="#Parser-1455"><span class="linenos">1455</span></a> +</span><span id="Parser-1456"><a href="#Parser-1456"><span class="linenos">1456</span></a> <span class="k">def</span> <span class="nf">_parse_cache</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1457"><a href="#Parser-1457"><span class="linenos">1457</span></a> <span class="n">lazy</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LAZY</span><span class="p">)</span> +</span><span id="Parser-1458"><a href="#Parser-1458"><span class="linenos">1458</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="Parser-1459"><a href="#Parser-1459"><span class="linenos">1459</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1460"><a href="#Parser-1460"><span class="linenos">1460</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-1461"><a href="#Parser-1461"><span class="linenos">1461</span></a> +</span><span id="Parser-1462"><a href="#Parser-1462"><span class="linenos">1462</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OPTIONS</span><span class="p">):</span> +</span><span id="Parser-1463"><a href="#Parser-1463"><span class="linenos">1463</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="Parser-1464"><a href="#Parser-1464"><span class="linenos">1464</span></a> <span class="n">k</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1465"><a href="#Parser-1465"><span class="linenos">1465</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">)</span> +</span><span id="Parser-1466"><a href="#Parser-1466"><span class="linenos">1466</span></a> <span class="n">v</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-1467"><a href="#Parser-1467"><span class="linenos">1467</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">]</span> +</span><span id="Parser-1468"><a href="#Parser-1468"><span class="linenos">1468</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-1469"><a href="#Parser-1469"><span class="linenos">1469</span></a> +</span><span id="Parser-1470"><a href="#Parser-1470"><span class="linenos">1470</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-1471"><a href="#Parser-1471"><span class="linenos">1471</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1472"><a href="#Parser-1472"><span class="linenos">1472</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cache</span><span class="p">,</span> +</span><span id="Parser-1473"><a href="#Parser-1473"><span class="linenos">1473</span></a> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> +</span><span id="Parser-1474"><a href="#Parser-1474"><span class="linenos">1474</span></a> <span class="n">lazy</span><span class="o">=</span><span class="n">lazy</span><span class="p">,</span> +</span><span id="Parser-1475"><a href="#Parser-1475"><span class="linenos">1475</span></a> <span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">,</span> +</span><span id="Parser-1476"><a href="#Parser-1476"><span class="linenos">1476</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Parser-1477"><a href="#Parser-1477"><span class="linenos">1477</span></a> <span class="p">)</span> +</span><span id="Parser-1478"><a href="#Parser-1478"><span class="linenos">1478</span></a> +</span><span id="Parser-1479"><a href="#Parser-1479"><span class="linenos">1479</span></a> <span class="k">def</span> <span class="nf">_parse_partition</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1480"><a href="#Parser-1480"><span class="linenos">1480</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION</span><span class="p">):</span> +</span><span id="Parser-1481"><a href="#Parser-1481"><span class="linenos">1481</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1482"><a href="#Parser-1482"><span class="linenos">1482</span></a> +</span><span id="Parser-1483"><a href="#Parser-1483"><span class="linenos">1483</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1484"><a href="#Parser-1484"><span class="linenos">1484</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Partition</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-1485"><a href="#Parser-1485"><span class="linenos">1485</span></a> <span class="p">)</span> +</span><span id="Parser-1486"><a href="#Parser-1486"><span class="linenos">1486</span></a> +</span><span id="Parser-1487"><a href="#Parser-1487"><span class="linenos">1487</span></a> <span class="k">def</span> <span class="nf">_parse_value</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1488"><a href="#Parser-1488"><span class="linenos">1488</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-1489"><a href="#Parser-1489"><span class="linenos">1489</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-1490"><a href="#Parser-1490"><span class="linenos">1490</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-1491"><a href="#Parser-1491"><span class="linenos">1491</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-1492"><a href="#Parser-1492"><span class="linenos">1492</span></a> +</span><span id="Parser-1493"><a href="#Parser-1493"><span class="linenos">1493</span></a> <span class="c1"># In presto we can have VALUES 1, 2 which results in 1 column & 2 rows.</span> +</span><span id="Parser-1494"><a href="#Parser-1494"><span class="linenos">1494</span></a> <span class="c1"># Source: https://prestodb.io/docs/current/sql/values.html</span> +</span><span id="Parser-1495"><a href="#Parser-1495"><span class="linenos">1495</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()])</span> +</span><span id="Parser-1496"><a href="#Parser-1496"><span class="linenos">1496</span></a> +</span><span id="Parser-1497"><a href="#Parser-1497"><span class="linenos">1497</span></a> <span class="k">def</span> <span class="nf">_parse_select</span><span class="p">(</span> +</span><span id="Parser-1498"><a href="#Parser-1498"><span class="linenos">1498</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nested</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">parse_subquery_alias</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1499"><a href="#Parser-1499"><span class="linenos">1499</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1500"><a href="#Parser-1500"><span class="linenos">1500</span></a> <span class="n">cte</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_with</span><span class="p">()</span> +</span><span id="Parser-1501"><a href="#Parser-1501"><span class="linenos">1501</span></a> <span class="k">if</span> <span class="n">cte</span><span class="p">:</span> +</span><span id="Parser-1502"><a href="#Parser-1502"><span class="linenos">1502</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">()</span> +</span><span id="Parser-1503"><a href="#Parser-1503"><span class="linenos">1503</span></a> +</span><span id="Parser-1504"><a href="#Parser-1504"><span class="linenos">1504</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="Parser-1505"><a href="#Parser-1505"><span class="linenos">1505</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Failed to parse any statement following CTE"</span><span class="p">)</span> +</span><span id="Parser-1506"><a href="#Parser-1506"><span class="linenos">1506</span></a> <span class="k">return</span> <span class="n">cte</span> +</span><span id="Parser-1507"><a href="#Parser-1507"><span class="linenos">1507</span></a> +</span><span id="Parser-1508"><a href="#Parser-1508"><span class="linenos">1508</span></a> <span class="k">if</span> <span class="s2">"with"</span> <span class="ow">in</span> <span class="n">this</span><span class="o">.</span><span class="n">arg_types</span><span class="p">:</span> +</span><span id="Parser-1509"><a href="#Parser-1509"><span class="linenos">1509</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"with"</span><span class="p">,</span> <span class="n">cte</span><span class="p">)</span> +</span><span id="Parser-1510"><a href="#Parser-1510"><span class="linenos">1510</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1511"><a href="#Parser-1511"><span class="linenos">1511</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">this</span><span class="o">.</span><span class="n">key</span><span class="si">}</span><span class="s2"> does not support CTE"</span><span class="p">)</span> +</span><span id="Parser-1512"><a href="#Parser-1512"><span class="linenos">1512</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">cte</span> +</span><span id="Parser-1513"><a href="#Parser-1513"><span class="linenos">1513</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">):</span> +</span><span id="Parser-1514"><a href="#Parser-1514"><span class="linenos">1514</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-1515"><a href="#Parser-1515"><span class="linenos">1515</span></a> +</span><span id="Parser-1516"><a href="#Parser-1516"><span class="linenos">1516</span></a> <span class="n">hint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_hint</span><span class="p">()</span> +</span><span id="Parser-1517"><a href="#Parser-1517"><span class="linenos">1517</span></a> <span class="n">all_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">)</span> +</span><span id="Parser-1518"><a href="#Parser-1518"><span class="linenos">1518</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">)</span> +</span><span id="Parser-1519"><a href="#Parser-1519"><span class="linenos">1519</span></a> +</span><span id="Parser-1520"><a href="#Parser-1520"><span class="linenos">1520</span></a> <span class="k">if</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="Parser-1521"><a href="#Parser-1521"><span class="linenos">1521</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1522"><a href="#Parser-1522"><span class="linenos">1522</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">,</span> +</span><span id="Parser-1523"><a href="#Parser-1523"><span class="linenos">1523</span></a> <span class="n">on</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-1524"><a href="#Parser-1524"><span class="linenos">1524</span></a> <span class="p">)</span> +</span><span id="Parser-1525"><a href="#Parser-1525"><span class="linenos">1525</span></a> +</span><span id="Parser-1526"><a href="#Parser-1526"><span class="linenos">1526</span></a> <span class="k">if</span> <span class="n">all_</span> <span class="ow">and</span> <span class="n">distinct</span><span class="p">:</span> +</span><span id="Parser-1527"><a href="#Parser-1527"><span class="linenos">1527</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Cannot specify both ALL and DISTINCT after SELECT"</span><span class="p">)</span> +</span><span id="Parser-1528"><a href="#Parser-1528"><span class="linenos">1528</span></a> +</span><span id="Parser-1529"><a href="#Parser-1529"><span class="linenos">1529</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(</span><span class="n">top</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1530"><a href="#Parser-1530"><span class="linenos">1530</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">)</span> +</span><span id="Parser-1531"><a href="#Parser-1531"><span class="linenos">1531</span></a> +</span><span id="Parser-1532"><a href="#Parser-1532"><span class="linenos">1532</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1533"><a href="#Parser-1533"><span class="linenos">1533</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">,</span> +</span><span id="Parser-1534"><a href="#Parser-1534"><span class="linenos">1534</span></a> <span class="n">hint</span><span class="o">=</span><span class="n">hint</span><span class="p">,</span> +</span><span id="Parser-1535"><a href="#Parser-1535"><span class="linenos">1535</span></a> <span class="n">distinct</span><span class="o">=</span><span class="n">distinct</span><span class="p">,</span> +</span><span id="Parser-1536"><a href="#Parser-1536"><span class="linenos">1536</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Parser-1537"><a href="#Parser-1537"><span class="linenos">1537</span></a> <span class="n">limit</span><span class="o">=</span><span class="n">limit</span><span class="p">,</span> +</span><span id="Parser-1538"><a href="#Parser-1538"><span class="linenos">1538</span></a> <span class="p">)</span> +</span><span id="Parser-1539"><a href="#Parser-1539"><span class="linenos">1539</span></a> <span class="n">this</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="Parser-1540"><a href="#Parser-1540"><span class="linenos">1540</span></a> +</span><span id="Parser-1541"><a href="#Parser-1541"><span class="linenos">1541</span></a> <span class="n">into</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_into</span><span class="p">()</span> +</span><span id="Parser-1542"><a href="#Parser-1542"><span class="linenos">1542</span></a> <span class="k">if</span> <span class="n">into</span><span class="p">:</span> +</span><span id="Parser-1543"><a href="#Parser-1543"><span class="linenos">1543</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"into"</span><span class="p">,</span> <span class="n">into</span><span class="p">)</span> +</span><span id="Parser-1544"><a href="#Parser-1544"><span class="linenos">1544</span></a> +</span><span id="Parser-1545"><a href="#Parser-1545"><span class="linenos">1545</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">()</span> +</span><span id="Parser-1546"><a href="#Parser-1546"><span class="linenos">1546</span></a> <span class="k">if</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="Parser-1547"><a href="#Parser-1547"><span class="linenos">1547</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"from"</span><span class="p">,</span> <span class="n">from_</span><span class="p">)</span> +</span><span id="Parser-1548"><a href="#Parser-1548"><span class="linenos">1548</span></a> +</span><span id="Parser-1549"><a href="#Parser-1549"><span class="linenos">1549</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-1550"><a href="#Parser-1550"><span class="linenos">1550</span></a> <span class="k">elif</span> <span class="p">(</span><span class="n">table</span> <span class="ow">or</span> <span class="n">nested</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-1551"><a href="#Parser-1551"><span class="linenos">1551</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1552"><a href="#Parser-1552"><span class="linenos">1552</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-1553"><a href="#Parser-1553"><span class="linenos">1553</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-1554"><a href="#Parser-1554"><span class="linenos">1554</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-1555"><a href="#Parser-1555"><span class="linenos">1555</span></a> +</span><span id="Parser-1556"><a href="#Parser-1556"><span class="linenos">1556</span></a> <span class="c1"># early return so that subquery unions aren't parsed again</span> +</span><span id="Parser-1557"><a href="#Parser-1557"><span class="linenos">1557</span></a> <span class="c1"># SELECT * FROM (SELECT 1) UNION ALL SELECT 1</span> +</span><span id="Parser-1558"><a href="#Parser-1558"><span class="linenos">1558</span></a> <span class="c1"># Union ALL should be a property of the top select node, not the subquery</span> +</span><span id="Parser-1559"><a href="#Parser-1559"><span class="linenos">1559</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_subquery</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">parse_alias</span><span class="o">=</span><span class="n">parse_subquery_alias</span><span class="p">)</span> +</span><span id="Parser-1560"><a href="#Parser-1560"><span class="linenos">1560</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">):</span> +</span><span id="Parser-1561"><a href="#Parser-1561"><span class="linenos">1561</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1562"><a href="#Parser-1562"><span class="linenos">1562</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">,</span> +</span><span id="Parser-1563"><a href="#Parser-1563"><span class="linenos">1563</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">),</span> +</span><span id="Parser-1564"><a href="#Parser-1564"><span class="linenos">1564</span></a> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">(),</span> +</span><span id="Parser-1565"><a href="#Parser-1565"><span class="linenos">1565</span></a> <span class="p">)</span> +</span><span id="Parser-1566"><a href="#Parser-1566"><span class="linenos">1566</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1567"><a href="#Parser-1567"><span class="linenos">1567</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1568"><a href="#Parser-1568"><span class="linenos">1568</span></a> +</span><span id="Parser-1569"><a href="#Parser-1569"><span class="linenos">1569</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-1570"><a href="#Parser-1570"><span class="linenos">1570</span></a> +</span><span id="Parser-1571"><a href="#Parser-1571"><span class="linenos">1571</span></a> <span class="k">def</span> <span class="nf">_parse_with</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_with_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1572"><a href="#Parser-1572"><span class="linenos">1572</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_with_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">):</span> +</span><span id="Parser-1573"><a href="#Parser-1573"><span class="linenos">1573</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1574"><a href="#Parser-1574"><span class="linenos">1574</span></a> +</span><span id="Parser-1575"><a href="#Parser-1575"><span class="linenos">1575</span></a> <span class="n">recursive</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">RECURSIVE</span><span class="p">)</span> +</span><span id="Parser-1576"><a href="#Parser-1576"><span class="linenos">1576</span></a> +</span><span id="Parser-1577"><a href="#Parser-1577"><span class="linenos">1577</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-1578"><a href="#Parser-1578"><span class="linenos">1578</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-1579"><a href="#Parser-1579"><span class="linenos">1579</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_cte</span><span class="p">())</span> +</span><span id="Parser-1580"><a href="#Parser-1580"><span class="linenos">1580</span></a> +</span><span id="Parser-1581"><a href="#Parser-1581"><span class="linenos">1581</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">):</span> +</span><span id="Parser-1582"><a href="#Parser-1582"><span class="linenos">1582</span></a> <span class="k">break</span> +</span><span id="Parser-1583"><a href="#Parser-1583"><span class="linenos">1583</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1584"><a href="#Parser-1584"><span class="linenos">1584</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> +</span><span id="Parser-1585"><a href="#Parser-1585"><span class="linenos">1585</span></a> +</span><span id="Parser-1586"><a href="#Parser-1586"><span class="linenos">1586</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">With</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">recursive</span><span class="o">=</span><span class="n">recursive</span><span class="p">)</span> +</span><span id="Parser-1587"><a href="#Parser-1587"><span class="linenos">1587</span></a> +</span><span id="Parser-1588"><a href="#Parser-1588"><span class="linenos">1588</span></a> <span class="k">def</span> <span class="nf">_parse_cte</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1589"><a href="#Parser-1589"><span class="linenos">1589</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> +</span><span id="Parser-1590"><a href="#Parser-1590"><span class="linenos">1590</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">alias</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">alias</span><span class="o">.</span><span class="n">this</span><span class="p">:</span> +</span><span id="Parser-1591"><a href="#Parser-1591"><span class="linenos">1591</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected CTE to have alias"</span><span class="p">)</span> +</span><span id="Parser-1592"><a href="#Parser-1592"><span class="linenos">1592</span></a> +</span><span id="Parser-1593"><a href="#Parser-1593"><span class="linenos">1593</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-1594"><a href="#Parser-1594"><span class="linenos">1594</span></a> +</span><span id="Parser-1595"><a href="#Parser-1595"><span class="linenos">1595</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1596"><a href="#Parser-1596"><span class="linenos">1596</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CTE</span><span class="p">,</span> +</span><span id="Parser-1597"><a href="#Parser-1597"><span class="linenos">1597</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">),</span> +</span><span id="Parser-1598"><a href="#Parser-1598"><span class="linenos">1598</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="Parser-1599"><a href="#Parser-1599"><span class="linenos">1599</span></a> <span class="p">)</span> +</span><span id="Parser-1600"><a href="#Parser-1600"><span class="linenos">1600</span></a> +</span><span id="Parser-1601"><a href="#Parser-1601"><span class="linenos">1601</span></a> <span class="k">def</span> <span class="nf">_parse_table_alias</span><span class="p">(</span> +</span><span id="Parser-1602"><a href="#Parser-1602"><span class="linenos">1602</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1603"><a href="#Parser-1603"><span class="linenos">1603</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1604"><a href="#Parser-1604"><span class="linenos">1604</span></a> <span class="n">any_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-1605"><a href="#Parser-1605"><span class="linenos">1605</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span> +</span><span id="Parser-1606"><a href="#Parser-1606"><span class="linenos">1606</span></a> <span class="n">any_token</span><span class="o">=</span><span class="n">any_token</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="n">alias_tokens</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span> +</span><span id="Parser-1607"><a href="#Parser-1607"><span class="linenos">1607</span></a> <span class="p">)</span> +</span><span id="Parser-1608"><a href="#Parser-1608"><span class="linenos">1608</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-1609"><a href="#Parser-1609"><span class="linenos">1609</span></a> +</span><span id="Parser-1610"><a href="#Parser-1610"><span class="linenos">1610</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-1611"><a href="#Parser-1611"><span class="linenos">1611</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()))</span> +</span><span id="Parser-1612"><a href="#Parser-1612"><span class="linenos">1612</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> <span class="k">if</span> <span class="n">columns</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-1613"><a href="#Parser-1613"><span class="linenos">1613</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1614"><a href="#Parser-1614"><span class="linenos">1614</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1615"><a href="#Parser-1615"><span class="linenos">1615</span></a> +</span><span id="Parser-1616"><a href="#Parser-1616"><span class="linenos">1616</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">alias</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">columns</span><span class="p">:</span> +</span><span id="Parser-1617"><a href="#Parser-1617"><span class="linenos">1617</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1618"><a href="#Parser-1618"><span class="linenos">1618</span></a> +</span><span id="Parser-1619"><a href="#Parser-1619"><span class="linenos">1619</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Parser-1620"><a href="#Parser-1620"><span class="linenos">1620</span></a> +</span><span id="Parser-1621"><a href="#Parser-1621"><span class="linenos">1621</span></a> <span class="k">def</span> <span class="nf">_parse_subquery</span><span class="p">(</span> +</span><span id="Parser-1622"><a href="#Parser-1622"><span class="linenos">1622</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">parse_alias</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1623"><a href="#Parser-1623"><span class="linenos">1623</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1624"><a href="#Parser-1624"><span class="linenos">1624</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1625"><a href="#Parser-1625"><span class="linenos">1625</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">,</span> +</span><span id="Parser-1626"><a href="#Parser-1626"><span class="linenos">1626</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-1627"><a href="#Parser-1627"><span class="linenos">1627</span></a> <span class="n">pivots</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_pivots</span><span class="p">(),</span> +</span><span id="Parser-1628"><a href="#Parser-1628"><span class="linenos">1628</span></a> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> <span class="k">if</span> <span class="n">parse_alias</span> <span class="k">else</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-1629"><a href="#Parser-1629"><span class="linenos">1629</span></a> <span class="p">)</span> +</span><span id="Parser-1630"><a href="#Parser-1630"><span class="linenos">1630</span></a> +</span><span id="Parser-1631"><a href="#Parser-1631"><span class="linenos">1631</span></a> <span class="k">def</span> <span class="nf">_parse_query_modifiers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-1632"><a href="#Parser-1632"><span class="linenos">1632</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">MODIFIABLES</span><span class="p">):</span> +</span><span id="Parser-1633"><a href="#Parser-1633"><span class="linenos">1633</span></a> <span class="k">return</span> +</span><span id="Parser-1634"><a href="#Parser-1634"><span class="linenos">1634</span></a> +</span><span id="Parser-1635"><a href="#Parser-1635"><span class="linenos">1635</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> +</span><span id="Parser-1636"><a href="#Parser-1636"><span class="linenos">1636</span></a> +</span><span id="Parser-1637"><a href="#Parser-1637"><span class="linenos">1637</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-1638"><a href="#Parser-1638"><span class="linenos">1638</span></a> <span class="n">lateral</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lateral</span><span class="p">()</span> +</span><span id="Parser-1639"><a href="#Parser-1639"><span class="linenos">1639</span></a> <span class="n">join</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join</span><span class="p">()</span> +</span><span id="Parser-1640"><a href="#Parser-1640"><span class="linenos">1640</span></a> <span class="n">comma</span> <span class="o">=</span> <span class="kc">None</span> <span class="k">if</span> <span class="n">table</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="Parser-1641"><a href="#Parser-1641"><span class="linenos">1641</span></a> <span class="k">if</span> <span class="n">lateral</span><span class="p">:</span> +</span><span id="Parser-1642"><a href="#Parser-1642"><span class="linenos">1642</span></a> <span class="n">this</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"laterals"</span><span class="p">,</span> <span class="n">lateral</span><span class="p">)</span> +</span><span id="Parser-1643"><a href="#Parser-1643"><span class="linenos">1643</span></a> <span class="k">if</span> <span class="n">join</span><span class="p">:</span> +</span><span id="Parser-1644"><a href="#Parser-1644"><span class="linenos">1644</span></a> <span class="n">this</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">,</span> <span class="n">join</span><span class="p">)</span> +</span><span id="Parser-1645"><a href="#Parser-1645"><span class="linenos">1645</span></a> <span class="k">if</span> <span class="n">comma</span><span class="p">:</span> +</span><span id="Parser-1646"><a href="#Parser-1646"><span class="linenos">1646</span></a> <span class="n">this</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"from"</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">())</span> +</span><span id="Parser-1647"><a href="#Parser-1647"><span class="linenos">1647</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">lateral</span> <span class="ow">or</span> <span class="n">join</span> <span class="ow">or</span> <span class="n">comma</span><span class="p">):</span> +</span><span id="Parser-1648"><a href="#Parser-1648"><span class="linenos">1648</span></a> <span class="k">break</span> +</span><span id="Parser-1649"><a href="#Parser-1649"><span class="linenos">1649</span></a> +</span><span id="Parser-1650"><a href="#Parser-1650"><span class="linenos">1650</span></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">parser</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">QUERY_MODIFIER_PARSERS</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Parser-1651"><a href="#Parser-1651"><span class="linenos">1651</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-1652"><a href="#Parser-1652"><span class="linenos">1652</span></a> +</span><span id="Parser-1653"><a href="#Parser-1653"><span class="linenos">1653</span></a> <span class="k">if</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="Parser-1654"><a href="#Parser-1654"><span class="linenos">1654</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="Parser-1655"><a href="#Parser-1655"><span class="linenos">1655</span></a> +</span><span id="Parser-1656"><a href="#Parser-1656"><span class="linenos">1656</span></a> <span class="k">def</span> <span class="nf">_parse_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1657"><a href="#Parser-1657"><span class="linenos">1657</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">HINT</span><span class="p">):</span> +</span><span id="Parser-1658"><a href="#Parser-1658"><span class="linenos">1658</span></a> <span class="n">hints</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">)</span> +</span><span id="Parser-1659"><a href="#Parser-1659"><span class="linenos">1659</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SLASH</span><span class="p">):</span> +</span><span id="Parser-1660"><a href="#Parser-1660"><span class="linenos">1660</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected */ after HINT"</span><span class="p">)</span> +</span><span id="Parser-1661"><a href="#Parser-1661"><span class="linenos">1661</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Hint</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">hints</span><span class="p">)</span> +</span><span id="Parser-1662"><a href="#Parser-1662"><span class="linenos">1662</span></a> +</span><span id="Parser-1663"><a href="#Parser-1663"><span class="linenos">1663</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1664"><a href="#Parser-1664"><span class="linenos">1664</span></a> +</span><span id="Parser-1665"><a href="#Parser-1665"><span class="linenos">1665</span></a> <span class="k">def</span> <span class="nf">_parse_into</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1666"><a href="#Parser-1666"><span class="linenos">1666</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">):</span> +</span><span id="Parser-1667"><a href="#Parser-1667"><span class="linenos">1667</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1668"><a href="#Parser-1668"><span class="linenos">1668</span></a> +</span><span id="Parser-1669"><a href="#Parser-1669"><span class="linenos">1669</span></a> <span class="n">temp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">)</span> +</span><span id="Parser-1670"><a href="#Parser-1670"><span class="linenos">1670</span></a> <span class="n">unlogged</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNLOGGED</span><span class="p">)</span> +</span><span id="Parser-1671"><a href="#Parser-1671"><span class="linenos">1671</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> +</span><span id="Parser-1672"><a href="#Parser-1672"><span class="linenos">1672</span></a> +</span><span id="Parser-1673"><a href="#Parser-1673"><span class="linenos">1673</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1674"><a href="#Parser-1674"><span class="linenos">1674</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Into</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> <span class="n">temporary</span><span class="o">=</span><span class="n">temp</span><span class="p">,</span> <span class="n">unlogged</span><span class="o">=</span><span class="n">unlogged</span> +</span><span id="Parser-1675"><a href="#Parser-1675"><span class="linenos">1675</span></a> <span class="p">)</span> +</span><span id="Parser-1676"><a href="#Parser-1676"><span class="linenos">1676</span></a> +</span><span id="Parser-1677"><a href="#Parser-1677"><span class="linenos">1677</span></a> <span class="k">def</span> <span class="nf">_parse_from</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1678"><a href="#Parser-1678"><span class="linenos">1678</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">):</span> +</span><span id="Parser-1679"><a href="#Parser-1679"><span class="linenos">1679</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1680"><a href="#Parser-1680"><span class="linenos">1680</span></a> +</span><span id="Parser-1681"><a href="#Parser-1681"><span class="linenos">1681</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1682"><a href="#Parser-1682"><span class="linenos">1682</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">From</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">)</span> +</span><span id="Parser-1683"><a href="#Parser-1683"><span class="linenos">1683</span></a> <span class="p">)</span> +</span><span id="Parser-1684"><a href="#Parser-1684"><span class="linenos">1684</span></a> +</span><span id="Parser-1685"><a href="#Parser-1685"><span class="linenos">1685</span></a> <span class="k">def</span> <span class="nf">_parse_match_recognize</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1686"><a href="#Parser-1686"><span class="linenos">1686</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">MATCH_RECOGNIZE</span><span class="p">):</span> +</span><span id="Parser-1687"><a href="#Parser-1687"><span class="linenos">1687</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1688"><a href="#Parser-1688"><span class="linenos">1688</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="Parser-1689"><a href="#Parser-1689"><span class="linenos">1689</span></a> +</span><span id="Parser-1690"><a href="#Parser-1690"><span class="linenos">1690</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition_by</span><span class="p">()</span> +</span><span id="Parser-1691"><a href="#Parser-1691"><span class="linenos">1691</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">()</span> +</span><span id="Parser-1692"><a href="#Parser-1692"><span class="linenos">1692</span></a> <span class="n">measures</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Parser-1693"><a href="#Parser-1693"><span class="linenos">1693</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="Parser-1694"><a href="#Parser-1694"><span class="linenos">1694</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MEASURES"</span><span class="p">)</span> +</span><span id="Parser-1695"><a href="#Parser-1695"><span class="linenos">1695</span></a> <span class="k">else</span> <span class="kc">None</span> +</span><span id="Parser-1696"><a href="#Parser-1696"><span class="linenos">1696</span></a> <span class="p">)</span> +</span><span id="Parser-1697"><a href="#Parser-1697"><span class="linenos">1697</span></a> +</span><span id="Parser-1698"><a href="#Parser-1698"><span class="linenos">1698</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ONE"</span><span class="p">,</span> <span class="s2">"ROW"</span><span class="p">,</span> <span class="s2">"PER"</span><span class="p">,</span> <span class="s2">"MATCH"</span><span class="p">):</span> +</span><span id="Parser-1699"><a href="#Parser-1699"><span class="linenos">1699</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="s2">"ONE ROW PER MATCH"</span><span class="p">)</span> +</span><span id="Parser-1700"><a href="#Parser-1700"><span class="linenos">1700</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ALL"</span><span class="p">,</span> <span class="s2">"ROWS"</span><span class="p">,</span> <span class="s2">"PER"</span><span class="p">,</span> <span class="s2">"MATCH"</span><span class="p">):</span> +</span><span id="Parser-1701"><a href="#Parser-1701"><span class="linenos">1701</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">"ALL ROWS PER MATCH"</span> +</span><span id="Parser-1702"><a href="#Parser-1702"><span class="linenos">1702</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SHOW"</span><span class="p">,</span> <span class="s2">"EMPTY"</span><span class="p">,</span> <span class="s2">"MATCHES"</span><span class="p">):</span> +</span><span id="Parser-1703"><a href="#Parser-1703"><span class="linenos">1703</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" SHOW EMPTY MATCHES"</span> +</span><span id="Parser-1704"><a href="#Parser-1704"><span class="linenos">1704</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"OMIT"</span><span class="p">,</span> <span class="s2">"EMPTY"</span><span class="p">,</span> <span class="s2">"MATCHES"</span><span class="p">):</span> +</span><span id="Parser-1705"><a href="#Parser-1705"><span class="linenos">1705</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" OMIT EMPTY MATCHES"</span> +</span><span id="Parser-1706"><a href="#Parser-1706"><span class="linenos">1706</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"WITH"</span><span class="p">,</span> <span class="s2">"UNMATCHED"</span><span class="p">,</span> <span class="s2">"ROWS"</span><span class="p">):</span> +</span><span id="Parser-1707"><a href="#Parser-1707"><span class="linenos">1707</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" WITH UNMATCHED ROWS"</span> +</span><span id="Parser-1708"><a href="#Parser-1708"><span class="linenos">1708</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-1709"><a href="#Parser-1709"><span class="linenos">1709</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1710"><a href="#Parser-1710"><span class="linenos">1710</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1711"><a href="#Parser-1711"><span class="linenos">1711</span></a> +</span><span id="Parser-1712"><a href="#Parser-1712"><span class="linenos">1712</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AFTER"</span><span class="p">,</span> <span class="s2">"MATCH"</span><span class="p">,</span> <span class="s2">"SKIP"</span><span class="p">):</span> +</span><span id="Parser-1713"><a href="#Parser-1713"><span class="linenos">1713</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">"AFTER MATCH SKIP"</span> +</span><span id="Parser-1714"><a href="#Parser-1714"><span class="linenos">1714</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PAST"</span><span class="p">,</span> <span class="s2">"LAST"</span><span class="p">,</span> <span class="s2">"ROW"</span><span class="p">):</span> +</span><span id="Parser-1715"><a href="#Parser-1715"><span class="linenos">1715</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" PAST LAST ROW"</span> +</span><span id="Parser-1716"><a href="#Parser-1716"><span class="linenos">1716</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"NEXT"</span><span class="p">,</span> <span class="s2">"ROW"</span><span class="p">):</span> +</span><span id="Parser-1717"><a href="#Parser-1717"><span class="linenos">1717</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" TO NEXT ROW"</span> +</span><span id="Parser-1718"><a href="#Parser-1718"><span class="linenos">1718</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"FIRST"</span><span class="p">):</span> +</span><span id="Parser-1719"><a href="#Parser-1719"><span class="linenos">1719</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" TO FIRST </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">()</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">"</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-1720"><a href="#Parser-1720"><span class="linenos">1720</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">,</span> <span class="s2">"LAST"</span><span class="p">):</span> +</span><span id="Parser-1721"><a href="#Parser-1721"><span class="linenos">1721</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="sa">f</span><span class="s2">" TO LAST </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">()</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">"</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-1722"><a href="#Parser-1722"><span class="linenos">1722</span></a> <span class="n">after</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-1723"><a href="#Parser-1723"><span class="linenos">1723</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1724"><a href="#Parser-1724"><span class="linenos">1724</span></a> <span class="n">after</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1725"><a href="#Parser-1725"><span class="linenos">1725</span></a> +</span><span id="Parser-1726"><a href="#Parser-1726"><span class="linenos">1726</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PATTERN"</span><span class="p">):</span> +</span><span id="Parser-1727"><a href="#Parser-1727"><span class="linenos">1727</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="Parser-1728"><a href="#Parser-1728"><span class="linenos">1728</span></a> +</span><span id="Parser-1729"><a href="#Parser-1729"><span class="linenos">1729</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="Parser-1730"><a href="#Parser-1730"><span class="linenos">1730</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting )"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">)</span> +</span><span id="Parser-1731"><a href="#Parser-1731"><span class="linenos">1731</span></a> +</span><span id="Parser-1732"><a href="#Parser-1732"><span class="linenos">1732</span></a> <span class="n">paren</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Parser-1733"><a href="#Parser-1733"><span class="linenos">1733</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> +</span><span id="Parser-1734"><a href="#Parser-1734"><span class="linenos">1734</span></a> +</span><span id="Parser-1735"><a href="#Parser-1735"><span class="linenos">1735</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="n">paren</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="Parser-1736"><a href="#Parser-1736"><span class="linenos">1736</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">:</span> +</span><span id="Parser-1737"><a href="#Parser-1737"><span class="linenos">1737</span></a> <span class="n">paren</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Parser-1738"><a href="#Parser-1738"><span class="linenos">1738</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">:</span> +</span><span id="Parser-1739"><a href="#Parser-1739"><span class="linenos">1739</span></a> <span class="n">paren</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="Parser-1740"><a href="#Parser-1740"><span class="linenos">1740</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="Parser-1741"><a href="#Parser-1741"><span class="linenos">1741</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-1742"><a href="#Parser-1742"><span class="linenos">1742</span></a> <span class="k">if</span> <span class="n">paren</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> +</span><span id="Parser-1743"><a href="#Parser-1743"><span class="linenos">1743</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting )"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">)</span> +</span><span id="Parser-1744"><a href="#Parser-1744"><span class="linenos">1744</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_find_sql</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="n">end</span><span class="p">))</span> +</span><span id="Parser-1745"><a href="#Parser-1745"><span class="linenos">1745</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1746"><a href="#Parser-1746"><span class="linenos">1746</span></a> <span class="n">pattern</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1747"><a href="#Parser-1747"><span class="linenos">1747</span></a> +</span><span id="Parser-1748"><a href="#Parser-1748"><span class="linenos">1748</span></a> <span class="n">define</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Parser-1749"><a href="#Parser-1749"><span class="linenos">1749</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFINE"</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="Parser-1750"><a href="#Parser-1750"><span class="linenos">1750</span></a> <span class="p">)</span> +</span><span id="Parser-1751"><a href="#Parser-1751"><span class="linenos">1751</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-1752"><a href="#Parser-1752"><span class="linenos">1752</span></a> +</span><span id="Parser-1753"><a href="#Parser-1753"><span class="linenos">1753</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1754"><a href="#Parser-1754"><span class="linenos">1754</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">MatchRecognize</span><span class="p">,</span> +</span><span id="Parser-1755"><a href="#Parser-1755"><span class="linenos">1755</span></a> <span class="n">partition_by</span><span class="o">=</span><span class="n">partition</span><span class="p">,</span> +</span><span id="Parser-1756"><a href="#Parser-1756"><span class="linenos">1756</span></a> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> +</span><span id="Parser-1757"><a href="#Parser-1757"><span class="linenos">1757</span></a> <span class="n">measures</span><span class="o">=</span><span class="n">measures</span><span class="p">,</span> +</span><span id="Parser-1758"><a href="#Parser-1758"><span class="linenos">1758</span></a> <span class="n">rows</span><span class="o">=</span><span class="n">rows</span><span class="p">,</span> +</span><span id="Parser-1759"><a href="#Parser-1759"><span class="linenos">1759</span></a> <span class="n">after</span><span class="o">=</span><span class="n">after</span><span class="p">,</span> +</span><span id="Parser-1760"><a href="#Parser-1760"><span class="linenos">1760</span></a> <span class="n">pattern</span><span class="o">=</span><span class="n">pattern</span><span class="p">,</span> +</span><span id="Parser-1761"><a href="#Parser-1761"><span class="linenos">1761</span></a> <span class="n">define</span><span class="o">=</span><span class="n">define</span><span class="p">,</span> +</span><span id="Parser-1762"><a href="#Parser-1762"><span class="linenos">1762</span></a> <span class="p">)</span> +</span><span id="Parser-1763"><a href="#Parser-1763"><span class="linenos">1763</span></a> +</span><span id="Parser-1764"><a href="#Parser-1764"><span class="linenos">1764</span></a> <span class="k">def</span> <span class="nf">_parse_lateral</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1765"><a href="#Parser-1765"><span class="linenos">1765</span></a> <span class="n">outer_apply</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">)</span> +</span><span id="Parser-1766"><a href="#Parser-1766"><span class="linenos">1766</span></a> <span class="n">cross_apply</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CROSS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">)</span> +</span><span id="Parser-1767"><a href="#Parser-1767"><span class="linenos">1767</span></a> +</span><span id="Parser-1768"><a href="#Parser-1768"><span class="linenos">1768</span></a> <span class="k">if</span> <span class="n">outer_apply</span> <span class="ow">or</span> <span class="n">cross_apply</span><span class="p">:</span> +</span><span id="Parser-1769"><a href="#Parser-1769"><span class="linenos">1769</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1770"><a href="#Parser-1770"><span class="linenos">1770</span></a> <span class="n">view</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1771"><a href="#Parser-1771"><span class="linenos">1771</span></a> <span class="n">outer</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">cross_apply</span> +</span><span id="Parser-1772"><a href="#Parser-1772"><span class="linenos">1772</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LATERAL</span><span class="p">):</span> +</span><span id="Parser-1773"><a href="#Parser-1773"><span class="linenos">1773</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1774"><a href="#Parser-1774"><span class="linenos">1774</span></a> <span class="n">view</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">)</span> +</span><span id="Parser-1775"><a href="#Parser-1775"><span class="linenos">1775</span></a> <span class="n">outer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">)</span> +</span><span id="Parser-1776"><a href="#Parser-1776"><span class="linenos">1776</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1777"><a href="#Parser-1777"><span class="linenos">1777</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1778"><a href="#Parser-1778"><span class="linenos">1778</span></a> +</span><span id="Parser-1779"><a href="#Parser-1779"><span class="linenos">1779</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="Parser-1780"><a href="#Parser-1780"><span class="linenos">1780</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-1781"><a href="#Parser-1781"><span class="linenos">1781</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="Parser-1782"><a href="#Parser-1782"><span class="linenos">1782</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">(</span> +</span><span id="Parser-1783"><a href="#Parser-1783"><span class="linenos">1783</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-1784"><a href="#Parser-1784"><span class="linenos">1784</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> +</span><span id="Parser-1785"><a href="#Parser-1785"><span class="linenos">1785</span></a> <span class="p">)</span> +</span><span id="Parser-1786"><a href="#Parser-1786"><span class="linenos">1786</span></a> +</span><span id="Parser-1787"><a href="#Parser-1787"><span class="linenos">1787</span></a> <span class="n">table_alias</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-1788"><a href="#Parser-1788"><span class="linenos">1788</span></a> +</span><span id="Parser-1789"><a href="#Parser-1789"><span class="linenos">1789</span></a> <span class="k">if</span> <span class="n">view</span><span class="p">:</span> +</span><span id="Parser-1790"><a href="#Parser-1790"><span class="linenos">1790</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-1791"><a href="#Parser-1791"><span class="linenos">1791</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> <span class="k">else</span> <span class="p">[]</span> +</span><span id="Parser-1792"><a href="#Parser-1792"><span class="linenos">1792</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TableAlias</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">)</span> +</span><span id="Parser-1793"><a href="#Parser-1793"><span class="linenos">1793</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1794"><a href="#Parser-1794"><span class="linenos">1794</span></a> <span class="n">table_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> +</span><span id="Parser-1795"><a href="#Parser-1795"><span class="linenos">1795</span></a> +</span><span id="Parser-1796"><a href="#Parser-1796"><span class="linenos">1796</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1797"><a href="#Parser-1797"><span class="linenos">1797</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Lateral</span><span class="p">,</span> +</span><span id="Parser-1798"><a href="#Parser-1798"><span class="linenos">1798</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-1799"><a href="#Parser-1799"><span class="linenos">1799</span></a> <span class="n">view</span><span class="o">=</span><span class="n">view</span><span class="p">,</span> +</span><span id="Parser-1800"><a href="#Parser-1800"><span class="linenos">1800</span></a> <span class="n">outer</span><span class="o">=</span><span class="n">outer</span><span class="p">,</span> +</span><span id="Parser-1801"><a href="#Parser-1801"><span class="linenos">1801</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">table_alias</span><span class="p">,</span> +</span><span id="Parser-1802"><a href="#Parser-1802"><span class="linenos">1802</span></a> <span class="p">)</span> +</span><span id="Parser-1803"><a href="#Parser-1803"><span class="linenos">1803</span></a> +</span><span id="Parser-1804"><a href="#Parser-1804"><span class="linenos">1804</span></a> <span class="k">if</span> <span class="n">outer_apply</span> <span class="ow">or</span> <span class="n">cross_apply</span><span class="p">:</span> +</span><span id="Parser-1805"><a href="#Parser-1805"><span class="linenos">1805</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">side</span><span class="o">=</span><span class="kc">None</span> <span class="k">if</span> <span class="n">cross_apply</span> <span class="k">else</span> <span class="s2">"LEFT"</span><span class="p">)</span> +</span><span id="Parser-1806"><a href="#Parser-1806"><span class="linenos">1806</span></a> +</span><span id="Parser-1807"><a href="#Parser-1807"><span class="linenos">1807</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Parser-1808"><a href="#Parser-1808"><span class="linenos">1808</span></a> +</span><span id="Parser-1809"><a href="#Parser-1809"><span class="linenos">1809</span></a> <span class="k">def</span> <span class="nf">_parse_join_side_and_kind</span><span class="p">(</span> +</span><span id="Parser-1810"><a href="#Parser-1810"><span class="linenos">1810</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser-1811"><a href="#Parser-1811"><span class="linenos">1811</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]]:</span> +</span><span id="Parser-1812"><a href="#Parser-1812"><span class="linenos">1812</span></a> <span class="k">return</span> <span class="p">(</span> +</span><span id="Parser-1813"><a href="#Parser-1813"><span class="linenos">1813</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">,</span> +</span><span id="Parser-1814"><a href="#Parser-1814"><span class="linenos">1814</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">JOIN_SIDES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">,</span> +</span><span id="Parser-1815"><a href="#Parser-1815"><span class="linenos">1815</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">JOIN_KINDS</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">,</span> +</span><span id="Parser-1816"><a href="#Parser-1816"><span class="linenos">1816</span></a> <span class="p">)</span> +</span><span id="Parser-1817"><a href="#Parser-1817"><span class="linenos">1817</span></a> +</span><span id="Parser-1818"><a href="#Parser-1818"><span class="linenos">1818</span></a> <span class="k">def</span> <span class="nf">_parse_join</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_join_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1819"><a href="#Parser-1819"><span class="linenos">1819</span></a> <span class="n">natural</span><span class="p">,</span> <span class="n">side</span><span class="p">,</span> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_join_side_and_kind</span><span class="p">()</span> +</span><span id="Parser-1820"><a href="#Parser-1820"><span class="linenos">1820</span></a> +</span><span id="Parser-1821"><a href="#Parser-1821"><span class="linenos">1821</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_join_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">JOIN</span><span class="p">):</span> +</span><span id="Parser-1822"><a href="#Parser-1822"><span class="linenos">1822</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1823"><a href="#Parser-1823"><span class="linenos">1823</span></a> +</span><span id="Parser-1824"><a href="#Parser-1824"><span class="linenos">1824</span></a> <span class="n">kwargs</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span> +</span><span id="Parser-1825"><a href="#Parser-1825"><span class="linenos">1825</span></a> <span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">|</span> <span class="nb">bool</span> <span class="o">|</span> <span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> +</span><span id="Parser-1826"><a href="#Parser-1826"><span class="linenos">1826</span></a> <span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"this"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()}</span> +</span><span id="Parser-1827"><a href="#Parser-1827"><span class="linenos">1827</span></a> +</span><span id="Parser-1828"><a href="#Parser-1828"><span class="linenos">1828</span></a> <span class="k">if</span> <span class="n">natural</span><span class="p">:</span> +</span><span id="Parser-1829"><a href="#Parser-1829"><span class="linenos">1829</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"natural"</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-1830"><a href="#Parser-1830"><span class="linenos">1830</span></a> <span class="k">if</span> <span class="n">side</span><span class="p">:</span> +</span><span id="Parser-1831"><a href="#Parser-1831"><span class="linenos">1831</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"side"</span><span class="p">]</span> <span class="o">=</span> <span class="n">side</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-1832"><a href="#Parser-1832"><span class="linenos">1832</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Parser-1833"><a href="#Parser-1833"><span class="linenos">1833</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"kind"</span><span class="p">]</span> <span class="o">=</span> <span class="n">kind</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-1834"><a href="#Parser-1834"><span class="linenos">1834</span></a> +</span><span id="Parser-1835"><a href="#Parser-1835"><span class="linenos">1835</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="Parser-1836"><a href="#Parser-1836"><span class="linenos">1836</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"on"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-1837"><a href="#Parser-1837"><span class="linenos">1837</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="Parser-1838"><a href="#Parser-1838"><span class="linenos">1838</span></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">"using"</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="Parser-1839"><a href="#Parser-1839"><span class="linenos">1839</span></a> +</span><span id="Parser-1840"><a href="#Parser-1840"><span class="linenos">1840</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-1841"><a href="#Parser-1841"><span class="linenos">1841</span></a> +</span><span id="Parser-1842"><a href="#Parser-1842"><span class="linenos">1842</span></a> <span class="k">def</span> <span class="nf">_parse_index</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1843"><a href="#Parser-1843"><span class="linenos">1843</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-1844"><a href="#Parser-1844"><span class="linenos">1844</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> +</span><span id="Parser-1845"><a href="#Parser-1845"><span class="linenos">1845</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">)</span> <span class="c1"># hive</span> +</span><span id="Parser-1846"><a href="#Parser-1846"><span class="linenos">1846</span></a> +</span><span id="Parser-1847"><a href="#Parser-1847"><span class="linenos">1847</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1848"><a href="#Parser-1848"><span class="linenos">1848</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">,</span> +</span><span id="Parser-1849"><a href="#Parser-1849"><span class="linenos">1849</span></a> <span class="n">this</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> +</span><span id="Parser-1850"><a href="#Parser-1850"><span class="linenos">1850</span></a> <span class="n">table</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()),</span> +</span><span id="Parser-1851"><a href="#Parser-1851"><span class="linenos">1851</span></a> <span class="n">columns</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">(),</span> +</span><span id="Parser-1852"><a href="#Parser-1852"><span class="linenos">1852</span></a> <span class="p">)</span> +</span><span id="Parser-1853"><a href="#Parser-1853"><span class="linenos">1853</span></a> +</span><span id="Parser-1854"><a href="#Parser-1854"><span class="linenos">1854</span></a> <span class="k">def</span> <span class="nf">_parse_create_table_index</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1855"><a href="#Parser-1855"><span class="linenos">1855</span></a> <span class="n">unique</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">)</span> +</span><span id="Parser-1856"><a href="#Parser-1856"><span class="linenos">1856</span></a> <span class="n">primary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"PRIMARY"</span><span class="p">)</span> +</span><span id="Parser-1857"><a href="#Parser-1857"><span class="linenos">1857</span></a> <span class="n">amp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"AMP"</span><span class="p">)</span> +</span><span id="Parser-1858"><a href="#Parser-1858"><span class="linenos">1858</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">):</span> +</span><span id="Parser-1859"><a href="#Parser-1859"><span class="linenos">1859</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1860"><a href="#Parser-1860"><span class="linenos">1860</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-1861"><a href="#Parser-1861"><span class="linenos">1861</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1862"><a href="#Parser-1862"><span class="linenos">1862</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-1863"><a href="#Parser-1863"><span class="linenos">1863</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-1864"><a href="#Parser-1864"><span class="linenos">1864</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1865"><a href="#Parser-1865"><span class="linenos">1865</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Index</span><span class="p">,</span> +</span><span id="Parser-1866"><a href="#Parser-1866"><span class="linenos">1866</span></a> <span class="n">this</span><span class="o">=</span><span class="n">index</span><span class="p">,</span> +</span><span id="Parser-1867"><a href="#Parser-1867"><span class="linenos">1867</span></a> <span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">,</span> +</span><span id="Parser-1868"><a href="#Parser-1868"><span class="linenos">1868</span></a> <span class="n">unique</span><span class="o">=</span><span class="n">unique</span><span class="p">,</span> +</span><span id="Parser-1869"><a href="#Parser-1869"><span class="linenos">1869</span></a> <span class="n">primary</span><span class="o">=</span><span class="n">primary</span><span class="p">,</span> +</span><span id="Parser-1870"><a href="#Parser-1870"><span class="linenos">1870</span></a> <span class="n">amp</span><span class="o">=</span><span class="n">amp</span><span class="p">,</span> +</span><span id="Parser-1871"><a href="#Parser-1871"><span class="linenos">1871</span></a> <span class="p">)</span> +</span><span id="Parser-1872"><a href="#Parser-1872"><span class="linenos">1872</span></a> +</span><span id="Parser-1873"><a href="#Parser-1873"><span class="linenos">1873</span></a> <span class="k">def</span> <span class="nf">_parse_table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-1874"><a href="#Parser-1874"><span class="linenos">1874</span></a> <span class="n">catalog</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1875"><a href="#Parser-1875"><span class="linenos">1875</span></a> <span class="n">db</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1876"><a href="#Parser-1876"><span class="linenos">1876</span></a> <span class="n">table</span> <span class="o">=</span> <span class="p">(</span><span class="ow">not</span> <span class="n">schema</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">())</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-1877"><a href="#Parser-1877"><span class="linenos">1877</span></a> +</span><span id="Parser-1878"><a href="#Parser-1878"><span class="linenos">1878</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="Parser-1879"><a href="#Parser-1879"><span class="linenos">1879</span></a> <span class="k">if</span> <span class="n">catalog</span><span class="p">:</span> +</span><span id="Parser-1880"><a href="#Parser-1880"><span class="linenos">1880</span></a> <span class="c1"># This allows nesting the table in arbitrarily many dot expressions if needed</span> +</span><span id="Parser-1881"><a href="#Parser-1881"><span class="linenos">1881</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">())</span> +</span><span id="Parser-1882"><a href="#Parser-1882"><span class="linenos">1882</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-1883"><a href="#Parser-1883"><span class="linenos">1883</span></a> <span class="n">catalog</span> <span class="o">=</span> <span class="n">db</span> +</span><span id="Parser-1884"><a href="#Parser-1884"><span class="linenos">1884</span></a> <span class="n">db</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="Parser-1885"><a href="#Parser-1885"><span class="linenos">1885</span></a> <span class="n">table</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-1886"><a href="#Parser-1886"><span class="linenos">1886</span></a> +</span><span id="Parser-1887"><a href="#Parser-1887"><span class="linenos">1887</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table</span><span class="p">:</span> +</span><span id="Parser-1888"><a href="#Parser-1888"><span class="linenos">1888</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Expected table name but got </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Parser-1889"><a href="#Parser-1889"><span class="linenos">1889</span></a> +</span><span id="Parser-1890"><a href="#Parser-1890"><span class="linenos">1890</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1891"><a href="#Parser-1891"><span class="linenos">1891</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">db</span><span class="o">=</span><span class="n">db</span><span class="p">,</span> <span class="n">catalog</span><span class="o">=</span><span class="n">catalog</span><span class="p">,</span> <span class="n">pivots</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_pivots</span><span class="p">()</span> +</span><span id="Parser-1892"><a href="#Parser-1892"><span class="linenos">1892</span></a> <span class="p">)</span> +</span><span id="Parser-1893"><a href="#Parser-1893"><span class="linenos">1893</span></a> +</span><span id="Parser-1894"><a href="#Parser-1894"><span class="linenos">1894</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="Parser-1895"><a href="#Parser-1895"><span class="linenos">1895</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1896"><a href="#Parser-1896"><span class="linenos">1896</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1897"><a href="#Parser-1897"><span class="linenos">1897</span></a> <span class="n">lateral</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_lateral</span><span class="p">()</span> +</span><span id="Parser-1898"><a href="#Parser-1898"><span class="linenos">1898</span></a> +</span><span id="Parser-1899"><a href="#Parser-1899"><span class="linenos">1899</span></a> <span class="k">if</span> <span class="n">lateral</span><span class="p">:</span> +</span><span id="Parser-1900"><a href="#Parser-1900"><span class="linenos">1900</span></a> <span class="k">return</span> <span class="n">lateral</span> +</span><span id="Parser-1901"><a href="#Parser-1901"><span class="linenos">1901</span></a> +</span><span id="Parser-1902"><a href="#Parser-1902"><span class="linenos">1902</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnest</span><span class="p">()</span> +</span><span id="Parser-1903"><a href="#Parser-1903"><span class="linenos">1903</span></a> +</span><span id="Parser-1904"><a href="#Parser-1904"><span class="linenos">1904</span></a> <span class="k">if</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="Parser-1905"><a href="#Parser-1905"><span class="linenos">1905</span></a> <span class="k">return</span> <span class="n">unnest</span> +</span><span id="Parser-1906"><a href="#Parser-1906"><span class="linenos">1906</span></a> +</span><span id="Parser-1907"><a href="#Parser-1907"><span class="linenos">1907</span></a> <span class="n">values</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_derived_table_values</span><span class="p">()</span> +</span><span id="Parser-1908"><a href="#Parser-1908"><span class="linenos">1908</span></a> +</span><span id="Parser-1909"><a href="#Parser-1909"><span class="linenos">1909</span></a> <span class="k">if</span> <span class="n">values</span><span class="p">:</span> +</span><span id="Parser-1910"><a href="#Parser-1910"><span class="linenos">1910</span></a> <span class="k">return</span> <span class="n">values</span> +</span><span id="Parser-1911"><a href="#Parser-1911"><span class="linenos">1911</span></a> +</span><span id="Parser-1912"><a href="#Parser-1912"><span class="linenos">1912</span></a> <span class="n">subquery</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">table</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-1913"><a href="#Parser-1913"><span class="linenos">1913</span></a> +</span><span id="Parser-1914"><a href="#Parser-1914"><span class="linenos">1914</span></a> <span class="k">if</span> <span class="n">subquery</span><span class="p">:</span> +</span><span id="Parser-1915"><a href="#Parser-1915"><span class="linenos">1915</span></a> <span class="k">return</span> <span class="n">subquery</span> +</span><span id="Parser-1916"><a href="#Parser-1916"><span class="linenos">1916</span></a> +</span><span id="Parser-1917"><a href="#Parser-1917"><span class="linenos">1917</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_parts</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">)</span> +</span><span id="Parser-1918"><a href="#Parser-1918"><span class="linenos">1918</span></a> +</span><span id="Parser-1919"><a href="#Parser-1919"><span class="linenos">1919</span></a> <span class="k">if</span> <span class="n">schema</span><span class="p">:</span> +</span><span id="Parser-1920"><a href="#Parser-1920"><span class="linenos">1920</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_schema</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-1921"><a href="#Parser-1921"><span class="linenos">1921</span></a> +</span><span id="Parser-1922"><a href="#Parser-1922"><span class="linenos">1922</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">:</span> +</span><span id="Parser-1923"><a href="#Parser-1923"><span class="linenos">1923</span></a> <span class="n">table_sample</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_sample</span><span class="p">()</span> +</span><span id="Parser-1924"><a href="#Parser-1924"><span class="linenos">1924</span></a> +</span><span id="Parser-1925"><a href="#Parser-1925"><span class="linenos">1925</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">TABLE_ALIAS_TOKENS</span><span class="p">)</span> +</span><span id="Parser-1926"><a href="#Parser-1926"><span class="linenos">1926</span></a> +</span><span id="Parser-1927"><a href="#Parser-1927"><span class="linenos">1927</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="Parser-1928"><a href="#Parser-1928"><span class="linenos">1928</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">,</span> <span class="n">alias</span><span class="p">)</span> +</span><span id="Parser-1929"><a href="#Parser-1929"><span class="linenos">1929</span></a> +</span><span id="Parser-1930"><a href="#Parser-1930"><span class="linenos">1930</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-1931"><a href="#Parser-1931"><span class="linenos">1931</span></a> <span class="n">this</span><span class="o">.</span><span class="n">set</span><span class="p">(</span> +</span><span id="Parser-1932"><a href="#Parser-1932"><span class="linenos">1932</span></a> <span class="s2">"hints"</span><span class="p">,</span> +</span><span id="Parser-1933"><a href="#Parser-1933"><span class="linenos">1933</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">)),</span> +</span><span id="Parser-1934"><a href="#Parser-1934"><span class="linenos">1934</span></a> <span class="p">)</span> +</span><span id="Parser-1935"><a href="#Parser-1935"><span class="linenos">1935</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-1936"><a href="#Parser-1936"><span class="linenos">1936</span></a> +</span><span id="Parser-1937"><a href="#Parser-1937"><span class="linenos">1937</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span><span class="p">:</span> +</span><span id="Parser-1938"><a href="#Parser-1938"><span class="linenos">1938</span></a> <span class="n">table_sample</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_sample</span><span class="p">()</span> +</span><span id="Parser-1939"><a href="#Parser-1939"><span class="linenos">1939</span></a> +</span><span id="Parser-1940"><a href="#Parser-1940"><span class="linenos">1940</span></a> <span class="k">if</span> <span class="n">table_sample</span><span class="p">:</span> +</span><span id="Parser-1941"><a href="#Parser-1941"><span class="linenos">1941</span></a> <span class="n">table_sample</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="n">this</span><span class="p">)</span> +</span><span id="Parser-1942"><a href="#Parser-1942"><span class="linenos">1942</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">table_sample</span> +</span><span id="Parser-1943"><a href="#Parser-1943"><span class="linenos">1943</span></a> +</span><span id="Parser-1944"><a href="#Parser-1944"><span class="linenos">1944</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-1945"><a href="#Parser-1945"><span class="linenos">1945</span></a> +</span><span id="Parser-1946"><a href="#Parser-1946"><span class="linenos">1946</span></a> <span class="k">def</span> <span class="nf">_parse_unnest</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1947"><a href="#Parser-1947"><span class="linenos">1947</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNNEST</span><span class="p">):</span> +</span><span id="Parser-1948"><a href="#Parser-1948"><span class="linenos">1948</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1949"><a href="#Parser-1949"><span class="linenos">1949</span></a> +</span><span id="Parser-1950"><a href="#Parser-1950"><span class="linenos">1950</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-1951"><a href="#Parser-1951"><span class="linenos">1951</span></a> <span class="n">ordinality</span> <span class="o">=</span> <span class="nb">bool</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ORDINALITY</span><span class="p">))</span> +</span><span id="Parser-1952"><a href="#Parser-1952"><span class="linenos">1952</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">()</span> +</span><span id="Parser-1953"><a href="#Parser-1953"><span class="linenos">1953</span></a> +</span><span id="Parser-1954"><a href="#Parser-1954"><span class="linenos">1954</span></a> <span class="k">if</span> <span class="n">alias</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span><span class="p">:</span> +</span><span id="Parser-1955"><a href="#Parser-1955"><span class="linenos">1955</span></a> <span class="k">if</span> <span class="n">alias</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">):</span> +</span><span id="Parser-1956"><a href="#Parser-1956"><span class="linenos">1956</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Unexpected extra column alias in unnest."</span><span class="p">)</span> +</span><span id="Parser-1957"><a href="#Parser-1957"><span class="linenos">1957</span></a> <span class="n">alias</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"columns"</span><span class="p">,</span> <span class="p">[</span><span class="n">alias</span><span class="o">.</span><span class="n">this</span><span class="p">])</span> +</span><span id="Parser-1958"><a href="#Parser-1958"><span class="linenos">1958</span></a> <span class="n">alias</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> +</span><span id="Parser-1959"><a href="#Parser-1959"><span class="linenos">1959</span></a> +</span><span id="Parser-1960"><a href="#Parser-1960"><span class="linenos">1960</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1961"><a href="#Parser-1961"><span class="linenos">1961</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">):</span> +</span><span id="Parser-1962"><a href="#Parser-1962"><span class="linenos">1962</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-1963"><a href="#Parser-1963"><span class="linenos">1963</span></a> <span class="n">offset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-1964"><a href="#Parser-1964"><span class="linenos">1964</span></a> +</span><span id="Parser-1965"><a href="#Parser-1965"><span class="linenos">1965</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-1966"><a href="#Parser-1966"><span class="linenos">1966</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Unnest</span><span class="p">,</span> +</span><span id="Parser-1967"><a href="#Parser-1967"><span class="linenos">1967</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Parser-1968"><a href="#Parser-1968"><span class="linenos">1968</span></a> <span class="n">ordinality</span><span class="o">=</span><span class="n">ordinality</span><span class="p">,</span> +</span><span id="Parser-1969"><a href="#Parser-1969"><span class="linenos">1969</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">,</span> +</span><span id="Parser-1970"><a href="#Parser-1970"><span class="linenos">1970</span></a> <span class="n">offset</span><span class="o">=</span><span class="n">offset</span><span class="p">,</span> +</span><span id="Parser-1971"><a href="#Parser-1971"><span class="linenos">1971</span></a> <span class="p">)</span> +</span><span id="Parser-1972"><a href="#Parser-1972"><span class="linenos">1972</span></a> +</span><span id="Parser-1973"><a href="#Parser-1973"><span class="linenos">1973</span></a> <span class="k">def</span> <span class="nf">_parse_derived_table_values</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1974"><a href="#Parser-1974"><span class="linenos">1974</span></a> <span class="n">is_derived</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">)</span> +</span><span id="Parser-1975"><a href="#Parser-1975"><span class="linenos">1975</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">is_derived</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">):</span> +</span><span id="Parser-1976"><a href="#Parser-1976"><span class="linenos">1976</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1977"><a href="#Parser-1977"><span class="linenos">1977</span></a> +</span><span id="Parser-1978"><a href="#Parser-1978"><span class="linenos">1978</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">)</span> +</span><span id="Parser-1979"><a href="#Parser-1979"><span class="linenos">1979</span></a> +</span><span id="Parser-1980"><a href="#Parser-1980"><span class="linenos">1980</span></a> <span class="k">if</span> <span class="n">is_derived</span><span class="p">:</span> +</span><span id="Parser-1981"><a href="#Parser-1981"><span class="linenos">1981</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-1982"><a href="#Parser-1982"><span class="linenos">1982</span></a> +</span><span id="Parser-1983"><a href="#Parser-1983"><span class="linenos">1983</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Values</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table_alias</span><span class="p">())</span> +</span><span id="Parser-1984"><a href="#Parser-1984"><span class="linenos">1984</span></a> +</span><span id="Parser-1985"><a href="#Parser-1985"><span class="linenos">1985</span></a> <span class="k">def</span> <span class="nf">_parse_table_sample</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-1986"><a href="#Parser-1986"><span class="linenos">1986</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">):</span> +</span><span id="Parser-1987"><a href="#Parser-1987"><span class="linenos">1987</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-1988"><a href="#Parser-1988"><span class="linenos">1988</span></a> +</span><span id="Parser-1989"><a href="#Parser-1989"><span class="linenos">1989</span></a> <span class="n">method</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> +</span><span id="Parser-1990"><a href="#Parser-1990"><span class="linenos">1990</span></a> <span class="n">bucket_numerator</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1991"><a href="#Parser-1991"><span class="linenos">1991</span></a> <span class="n">bucket_denominator</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1992"><a href="#Parser-1992"><span class="linenos">1992</span></a> <span class="n">bucket_field</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1993"><a href="#Parser-1993"><span class="linenos">1993</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1994"><a href="#Parser-1994"><span class="linenos">1994</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1995"><a href="#Parser-1995"><span class="linenos">1995</span></a> <span class="n">size</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1996"><a href="#Parser-1996"><span class="linenos">1996</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-1997"><a href="#Parser-1997"><span class="linenos">1997</span></a> +</span><span id="Parser-1998"><a href="#Parser-1998"><span class="linenos">1998</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="Parser-1999"><a href="#Parser-1999"><span class="linenos">1999</span></a> +</span><span id="Parser-2000"><a href="#Parser-2000"><span class="linenos">2000</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BUCKET</span><span class="p">):</span> +</span><span id="Parser-2001"><a href="#Parser-2001"><span class="linenos">2001</span></a> <span class="n">bucket_numerator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="Parser-2002"><a href="#Parser-2002"><span class="linenos">2002</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OUT_OF</span><span class="p">)</span> +</span><span id="Parser-2003"><a href="#Parser-2003"><span class="linenos">2003</span></a> <span class="n">bucket_denominator</span> <span class="o">=</span> <span class="n">bucket_denominator</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="Parser-2004"><a href="#Parser-2004"><span class="linenos">2004</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> +</span><span id="Parser-2005"><a href="#Parser-2005"><span class="linenos">2005</span></a> <span class="n">bucket_field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">()</span> +</span><span id="Parser-2006"><a href="#Parser-2006"><span class="linenos">2006</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2007"><a href="#Parser-2007"><span class="linenos">2007</span></a> <span class="n">num</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="Parser-2008"><a href="#Parser-2008"><span class="linenos">2008</span></a> +</span><span id="Parser-2009"><a href="#Parser-2009"><span class="linenos">2009</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">):</span> +</span><span id="Parser-2010"><a href="#Parser-2010"><span class="linenos">2010</span></a> <span class="n">percent</span> <span class="o">=</span> <span class="n">num</span> +</span><span id="Parser-2011"><a href="#Parser-2011"><span class="linenos">2011</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">):</span> +</span><span id="Parser-2012"><a href="#Parser-2012"><span class="linenos">2012</span></a> <span class="n">rows</span> <span class="o">=</span> <span class="n">num</span> +</span><span id="Parser-2013"><a href="#Parser-2013"><span class="linenos">2013</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2014"><a href="#Parser-2014"><span class="linenos">2014</span></a> <span class="n">size</span> <span class="o">=</span> <span class="n">num</span> +</span><span id="Parser-2015"><a href="#Parser-2015"><span class="linenos">2015</span></a> +</span><span id="Parser-2016"><a href="#Parser-2016"><span class="linenos">2016</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2017"><a href="#Parser-2017"><span class="linenos">2017</span></a> +</span><span id="Parser-2018"><a href="#Parser-2018"><span class="linenos">2018</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEED</span><span class="p">):</span> +</span><span id="Parser-2019"><a href="#Parser-2019"><span class="linenos">2019</span></a> <span class="n">seed</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">)</span> +</span><span id="Parser-2020"><a href="#Parser-2020"><span class="linenos">2020</span></a> +</span><span id="Parser-2021"><a href="#Parser-2021"><span class="linenos">2021</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2022"><a href="#Parser-2022"><span class="linenos">2022</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">,</span> +</span><span id="Parser-2023"><a href="#Parser-2023"><span class="linenos">2023</span></a> <span class="n">method</span><span class="o">=</span><span class="n">method</span><span class="p">,</span> +</span><span id="Parser-2024"><a href="#Parser-2024"><span class="linenos">2024</span></a> <span class="n">bucket_numerator</span><span class="o">=</span><span class="n">bucket_numerator</span><span class="p">,</span> +</span><span id="Parser-2025"><a href="#Parser-2025"><span class="linenos">2025</span></a> <span class="n">bucket_denominator</span><span class="o">=</span><span class="n">bucket_denominator</span><span class="p">,</span> +</span><span id="Parser-2026"><a href="#Parser-2026"><span class="linenos">2026</span></a> <span class="n">bucket_field</span><span class="o">=</span><span class="n">bucket_field</span><span class="p">,</span> +</span><span id="Parser-2027"><a href="#Parser-2027"><span class="linenos">2027</span></a> <span class="n">percent</span><span class="o">=</span><span class="n">percent</span><span class="p">,</span> +</span><span id="Parser-2028"><a href="#Parser-2028"><span class="linenos">2028</span></a> <span class="n">rows</span><span class="o">=</span><span class="n">rows</span><span class="p">,</span> +</span><span id="Parser-2029"><a href="#Parser-2029"><span class="linenos">2029</span></a> <span class="n">size</span><span class="o">=</span><span class="n">size</span><span class="p">,</span> +</span><span id="Parser-2030"><a href="#Parser-2030"><span class="linenos">2030</span></a> <span class="n">seed</span><span class="o">=</span><span class="n">seed</span><span class="p">,</span> +</span><span id="Parser-2031"><a href="#Parser-2031"><span class="linenos">2031</span></a> <span class="p">)</span> +</span><span id="Parser-2032"><a href="#Parser-2032"><span class="linenos">2032</span></a> +</span><span id="Parser-2033"><a href="#Parser-2033"><span class="linenos">2033</span></a> <span class="k">def</span> <span class="nf">_parse_pivots</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-2034"><a href="#Parser-2034"><span class="linenos">2034</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_pivot</span><span class="p">,</span> <span class="kc">None</span><span class="p">))</span> +</span><span id="Parser-2035"><a href="#Parser-2035"><span class="linenos">2035</span></a> +</span><span id="Parser-2036"><a href="#Parser-2036"><span class="linenos">2036</span></a> <span class="k">def</span> <span class="nf">_parse_pivot</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2037"><a href="#Parser-2037"><span class="linenos">2037</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-2038"><a href="#Parser-2038"><span class="linenos">2038</span></a> +</span><span id="Parser-2039"><a href="#Parser-2039"><span class="linenos">2039</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PIVOT</span><span class="p">):</span> +</span><span id="Parser-2040"><a href="#Parser-2040"><span class="linenos">2040</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-2041"><a href="#Parser-2041"><span class="linenos">2041</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNPIVOT</span><span class="p">):</span> +</span><span id="Parser-2042"><a href="#Parser-2042"><span class="linenos">2042</span></a> <span class="n">unpivot</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-2043"><a href="#Parser-2043"><span class="linenos">2043</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2044"><a href="#Parser-2044"><span class="linenos">2044</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2045"><a href="#Parser-2045"><span class="linenos">2045</span></a> +</span><span id="Parser-2046"><a href="#Parser-2046"><span class="linenos">2046</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-2047"><a href="#Parser-2047"><span class="linenos">2047</span></a> <span class="n">field</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2048"><a href="#Parser-2048"><span class="linenos">2048</span></a> +</span><span id="Parser-2049"><a href="#Parser-2049"><span class="linenos">2049</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2050"><a href="#Parser-2050"><span class="linenos">2050</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2051"><a href="#Parser-2051"><span class="linenos">2051</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2052"><a href="#Parser-2052"><span class="linenos">2052</span></a> +</span><span id="Parser-2053"><a href="#Parser-2053"><span class="linenos">2053</span></a> <span class="k">if</span> <span class="n">unpivot</span><span class="p">:</span> +</span><span id="Parser-2054"><a href="#Parser-2054"><span class="linenos">2054</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-2055"><a href="#Parser-2055"><span class="linenos">2055</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2056"><a href="#Parser-2056"><span class="linenos">2056</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()))</span> +</span><span id="Parser-2057"><a href="#Parser-2057"><span class="linenos">2057</span></a> +</span><span id="Parser-2058"><a href="#Parser-2058"><span class="linenos">2058</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FOR</span><span class="p">):</span> +</span><span id="Parser-2059"><a href="#Parser-2059"><span class="linenos">2059</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting FOR"</span><span class="p">)</span> +</span><span id="Parser-2060"><a href="#Parser-2060"><span class="linenos">2060</span></a> +</span><span id="Parser-2061"><a href="#Parser-2061"><span class="linenos">2061</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="Parser-2062"><a href="#Parser-2062"><span class="linenos">2062</span></a> +</span><span id="Parser-2063"><a href="#Parser-2063"><span class="linenos">2063</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">):</span> +</span><span id="Parser-2064"><a href="#Parser-2064"><span class="linenos">2064</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting IN"</span><span class="p">)</span> +</span><span id="Parser-2065"><a href="#Parser-2065"><span class="linenos">2065</span></a> +</span><span id="Parser-2066"><a href="#Parser-2066"><span class="linenos">2066</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_in</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Parser-2067"><a href="#Parser-2067"><span class="linenos">2067</span></a> +</span><span id="Parser-2068"><a href="#Parser-2068"><span class="linenos">2068</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2069"><a href="#Parser-2069"><span class="linenos">2069</span></a> +</span><span id="Parser-2070"><a href="#Parser-2070"><span class="linenos">2070</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="n">field</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="n">unpivot</span><span class="p">)</span> +</span><span id="Parser-2071"><a href="#Parser-2071"><span class="linenos">2071</span></a> +</span><span id="Parser-2072"><a href="#Parser-2072"><span class="linenos">2072</span></a> <span class="k">def</span> <span class="nf">_parse_where</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_where_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2073"><a href="#Parser-2073"><span class="linenos">2073</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_where_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WHERE</span><span class="p">):</span> +</span><span id="Parser-2074"><a href="#Parser-2074"><span class="linenos">2074</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2075"><a href="#Parser-2075"><span class="linenos">2075</span></a> +</span><span id="Parser-2076"><a href="#Parser-2076"><span class="linenos">2076</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2077"><a href="#Parser-2077"><span class="linenos">2077</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Where</span><span class="p">,</span> <span class="n">comments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2078"><a href="#Parser-2078"><span class="linenos">2078</span></a> <span class="p">)</span> +</span><span id="Parser-2079"><a href="#Parser-2079"><span class="linenos">2079</span></a> +</span><span id="Parser-2080"><a href="#Parser-2080"><span class="linenos">2080</span></a> <span class="k">def</span> <span class="nf">_parse_group</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_group_by_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2081"><a href="#Parser-2081"><span class="linenos">2081</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_group_by_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GROUP_BY</span><span class="p">):</span> +</span><span id="Parser-2082"><a href="#Parser-2082"><span class="linenos">2082</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2083"><a href="#Parser-2083"><span class="linenos">2083</span></a> +</span><span id="Parser-2084"><a href="#Parser-2084"><span class="linenos">2084</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-2085"><a href="#Parser-2085"><span class="linenos">2085</span></a> <span class="n">grouping_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_grouping_sets</span><span class="p">()</span> +</span><span id="Parser-2086"><a href="#Parser-2086"><span class="linenos">2086</span></a> +</span><span id="Parser-2087"><a href="#Parser-2087"><span class="linenos">2087</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="Parser-2088"><a href="#Parser-2088"><span class="linenos">2088</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">)</span> +</span><span id="Parser-2089"><a href="#Parser-2089"><span class="linenos">2089</span></a> <span class="n">cube</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CUBE</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="Parser-2090"><a href="#Parser-2090"><span class="linenos">2090</span></a> <span class="n">with_</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-2091"><a href="#Parser-2091"><span class="linenos">2091</span></a> <span class="p">)</span> +</span><span id="Parser-2092"><a href="#Parser-2092"><span class="linenos">2092</span></a> +</span><span id="Parser-2093"><a href="#Parser-2093"><span class="linenos">2093</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)</span> +</span><span id="Parser-2094"><a href="#Parser-2094"><span class="linenos">2094</span></a> <span class="n">rollup</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLUP</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="Parser-2095"><a href="#Parser-2095"><span class="linenos">2095</span></a> <span class="n">with_</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-2096"><a href="#Parser-2096"><span class="linenos">2096</span></a> <span class="p">)</span> +</span><span id="Parser-2097"><a href="#Parser-2097"><span class="linenos">2097</span></a> +</span><span id="Parser-2098"><a href="#Parser-2098"><span class="linenos">2098</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2099"><a href="#Parser-2099"><span class="linenos">2099</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">,</span> +</span><span id="Parser-2100"><a href="#Parser-2100"><span class="linenos">2100</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Parser-2101"><a href="#Parser-2101"><span class="linenos">2101</span></a> <span class="n">grouping_sets</span><span class="o">=</span><span class="n">grouping_sets</span><span class="p">,</span> +</span><span id="Parser-2102"><a href="#Parser-2102"><span class="linenos">2102</span></a> <span class="n">cube</span><span class="o">=</span><span class="n">cube</span><span class="p">,</span> +</span><span id="Parser-2103"><a href="#Parser-2103"><span class="linenos">2103</span></a> <span class="n">rollup</span><span class="o">=</span><span class="n">rollup</span><span class="p">,</span> +</span><span id="Parser-2104"><a href="#Parser-2104"><span class="linenos">2104</span></a> <span class="p">)</span> +</span><span id="Parser-2105"><a href="#Parser-2105"><span class="linenos">2105</span></a> +</span><span id="Parser-2106"><a href="#Parser-2106"><span class="linenos">2106</span></a> <span class="k">def</span> <span class="nf">_parse_grouping_sets</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="Parser-2107"><a href="#Parser-2107"><span class="linenos">2107</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GROUPING_SETS</span><span class="p">):</span> +</span><span id="Parser-2108"><a href="#Parser-2108"><span class="linenos">2108</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2109"><a href="#Parser-2109"><span class="linenos">2109</span></a> +</span><span id="Parser-2110"><a href="#Parser-2110"><span class="linenos">2110</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_grouping_set</span><span class="p">)</span> +</span><span id="Parser-2111"><a href="#Parser-2111"><span class="linenos">2111</span></a> +</span><span id="Parser-2112"><a href="#Parser-2112"><span class="linenos">2112</span></a> <span class="k">def</span> <span class="nf">_parse_grouping_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2113"><a href="#Parser-2113"><span class="linenos">2113</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2114"><a href="#Parser-2114"><span class="linenos">2114</span></a> <span class="n">grouping_set</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-2115"><a href="#Parser-2115"><span class="linenos">2115</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2116"><a href="#Parser-2116"><span class="linenos">2116</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">grouping_set</span><span class="p">)</span> +</span><span id="Parser-2117"><a href="#Parser-2117"><span class="linenos">2117</span></a> +</span><span id="Parser-2118"><a href="#Parser-2118"><span class="linenos">2118</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="Parser-2119"><a href="#Parser-2119"><span class="linenos">2119</span></a> +</span><span id="Parser-2120"><a href="#Parser-2120"><span class="linenos">2120</span></a> <span class="k">def</span> <span class="nf">_parse_having</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">skip_having_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2121"><a href="#Parser-2121"><span class="linenos">2121</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_having_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">HAVING</span><span class="p">):</span> +</span><span id="Parser-2122"><a href="#Parser-2122"><span class="linenos">2122</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2123"><a href="#Parser-2123"><span class="linenos">2123</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Having</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="Parser-2124"><a href="#Parser-2124"><span class="linenos">2124</span></a> +</span><span id="Parser-2125"><a href="#Parser-2125"><span class="linenos">2125</span></a> <span class="k">def</span> <span class="nf">_parse_qualify</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2126"><a href="#Parser-2126"><span class="linenos">2126</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">QUALIFY</span><span class="p">):</span> +</span><span id="Parser-2127"><a href="#Parser-2127"><span class="linenos">2127</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2128"><a href="#Parser-2128"><span class="linenos">2128</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Qualify</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="Parser-2129"><a href="#Parser-2129"><span class="linenos">2129</span></a> +</span><span id="Parser-2130"><a href="#Parser-2130"><span class="linenos">2130</span></a> <span class="k">def</span> <span class="nf">_parse_order</span><span class="p">(</span> +</span><span id="Parser-2131"><a href="#Parser-2131"><span class="linenos">2131</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">skip_order_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-2132"><a href="#Parser-2132"><span class="linenos">2132</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2133"><a href="#Parser-2133"><span class="linenos">2133</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">skip_order_token</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">):</span> +</span><span id="Parser-2134"><a href="#Parser-2134"><span class="linenos">2134</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2135"><a href="#Parser-2135"><span class="linenos">2135</span></a> +</span><span id="Parser-2136"><a href="#Parser-2136"><span class="linenos">2136</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2137"><a href="#Parser-2137"><span class="linenos">2137</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Order</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_ordered</span><span class="p">)</span> +</span><span id="Parser-2138"><a href="#Parser-2138"><span class="linenos">2138</span></a> <span class="p">)</span> +</span><span id="Parser-2139"><a href="#Parser-2139"><span class="linenos">2139</span></a> +</span><span id="Parser-2140"><a href="#Parser-2140"><span class="linenos">2140</span></a> <span class="k">def</span> <span class="nf">_parse_sort</span><span class="p">(</span> +</span><span id="Parser-2141"><a href="#Parser-2141"><span class="linenos">2141</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-2142"><a href="#Parser-2142"><span class="linenos">2142</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2143"><a href="#Parser-2143"><span class="linenos">2143</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">token_type</span><span class="p">):</span> +</span><span id="Parser-2144"><a href="#Parser-2144"><span class="linenos">2144</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2145"><a href="#Parser-2145"><span class="linenos">2145</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp_class</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_ordered</span><span class="p">))</span> +</span><span id="Parser-2146"><a href="#Parser-2146"><span class="linenos">2146</span></a> +</span><span id="Parser-2147"><a href="#Parser-2147"><span class="linenos">2147</span></a> <span class="k">def</span> <span class="nf">_parse_ordered</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2148"><a href="#Parser-2148"><span class="linenos">2148</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2149"><a href="#Parser-2149"><span class="linenos">2149</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ASC</span><span class="p">)</span> +</span><span id="Parser-2150"><a href="#Parser-2150"><span class="linenos">2150</span></a> <span class="n">is_desc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">)</span> +</span><span id="Parser-2151"><a href="#Parser-2151"><span class="linenos">2151</span></a> <span class="n">is_nulls_first</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_FIRST</span><span class="p">)</span> +</span><span id="Parser-2152"><a href="#Parser-2152"><span class="linenos">2152</span></a> <span class="n">is_nulls_last</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_LAST</span><span class="p">)</span> +</span><span id="Parser-2153"><a href="#Parser-2153"><span class="linenos">2153</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="n">is_desc</span> <span class="ow">or</span> <span class="kc">False</span> +</span><span id="Parser-2154"><a href="#Parser-2154"><span class="linenos">2154</span></a> <span class="n">asc</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">desc</span> +</span><span id="Parser-2155"><a href="#Parser-2155"><span class="linenos">2155</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="n">is_nulls_first</span> <span class="ow">or</span> <span class="kc">False</span> +</span><span id="Parser-2156"><a href="#Parser-2156"><span class="linenos">2156</span></a> <span class="n">explicitly_null_ordered</span> <span class="o">=</span> <span class="n">is_nulls_first</span> <span class="ow">or</span> <span class="n">is_nulls_last</span> +</span><span id="Parser-2157"><a href="#Parser-2157"><span class="linenos">2157</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Parser-2158"><a href="#Parser-2158"><span class="linenos">2158</span></a> <span class="ow">not</span> <span class="n">explicitly_null_ordered</span> +</span><span id="Parser-2159"><a href="#Parser-2159"><span class="linenos">2159</span></a> <span class="ow">and</span> <span class="p">(</span> +</span><span id="Parser-2160"><a href="#Parser-2160"><span class="linenos">2160</span></a> <span class="p">(</span><span class="n">asc</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">==</span> <span class="s2">"nulls_are_small"</span><span class="p">)</span> +</span><span id="Parser-2161"><a href="#Parser-2161"><span class="linenos">2161</span></a> <span class="ow">or</span> <span class="p">(</span><span class="n">desc</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">!=</span> <span class="s2">"nulls_are_small"</span><span class="p">)</span> +</span><span id="Parser-2162"><a href="#Parser-2162"><span class="linenos">2162</span></a> <span class="p">)</span> +</span><span id="Parser-2163"><a href="#Parser-2163"><span class="linenos">2163</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">!=</span> <span class="s2">"nulls_are_last"</span> +</span><span id="Parser-2164"><a href="#Parser-2164"><span class="linenos">2164</span></a> <span class="p">):</span> +</span><span id="Parser-2165"><a href="#Parser-2165"><span class="linenos">2165</span></a> <span class="n">nulls_first</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-2166"><a href="#Parser-2166"><span class="linenos">2166</span></a> +</span><span id="Parser-2167"><a href="#Parser-2167"><span class="linenos">2167</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Ordered</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">desc</span><span class="o">=</span><span class="n">desc</span><span class="p">,</span> <span class="n">nulls_first</span><span class="o">=</span><span class="n">nulls_first</span><span class="p">)</span> +</span><span id="Parser-2168"><a href="#Parser-2168"><span class="linenos">2168</span></a> +</span><span id="Parser-2169"><a href="#Parser-2169"><span class="linenos">2169</span></a> <span class="k">def</span> <span class="nf">_parse_limit</span><span class="p">(</span> +</span><span id="Parser-2170"><a href="#Parser-2170"><span class="linenos">2170</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">top</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-2171"><a href="#Parser-2171"><span class="linenos">2171</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2172"><a href="#Parser-2172"><span class="linenos">2172</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span> <span class="k">if</span> <span class="n">top</span> <span class="k">else</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIMIT</span><span class="p">):</span> +</span><span id="Parser-2173"><a href="#Parser-2173"><span class="linenos">2173</span></a> <span class="n">limit_paren</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">)</span> +</span><span id="Parser-2174"><a href="#Parser-2174"><span class="linenos">2174</span></a> <span class="n">limit_exp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2175"><a href="#Parser-2175"><span class="linenos">2175</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Limit</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> <span class="k">if</span> <span class="n">top</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-2176"><a href="#Parser-2176"><span class="linenos">2176</span></a> <span class="p">)</span> +</span><span id="Parser-2177"><a href="#Parser-2177"><span class="linenos">2177</span></a> +</span><span id="Parser-2178"><a href="#Parser-2178"><span class="linenos">2178</span></a> <span class="k">if</span> <span class="n">limit_paren</span><span class="p">:</span> +</span><span id="Parser-2179"><a href="#Parser-2179"><span class="linenos">2179</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2180"><a href="#Parser-2180"><span class="linenos">2180</span></a> +</span><span id="Parser-2181"><a href="#Parser-2181"><span class="linenos">2181</span></a> <span class="k">return</span> <span class="n">limit_exp</span> +</span><span id="Parser-2182"><a href="#Parser-2182"><span class="linenos">2182</span></a> +</span><span id="Parser-2183"><a href="#Parser-2183"><span class="linenos">2183</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FETCH</span><span class="p">):</span> +</span><span id="Parser-2184"><a href="#Parser-2184"><span class="linenos">2184</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEXT</span><span class="p">))</span> +</span><span id="Parser-2185"><a href="#Parser-2185"><span class="linenos">2185</span></a> <span class="n">direction</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> <span class="k">if</span> <span class="n">direction</span> <span class="k">else</span> <span class="s2">"FIRST"</span> +</span><span id="Parser-2186"><a href="#Parser-2186"><span class="linenos">2186</span></a> <span class="n">count</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="Parser-2187"><a href="#Parser-2187"><span class="linenos">2187</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">))</span> +</span><span id="Parser-2188"><a href="#Parser-2188"><span class="linenos">2188</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ONLY</span><span class="p">)</span> +</span><span id="Parser-2189"><a href="#Parser-2189"><span class="linenos">2189</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Fetch</span><span class="p">,</span> <span class="n">direction</span><span class="o">=</span><span class="n">direction</span><span class="p">,</span> <span class="n">count</span><span class="o">=</span><span class="n">count</span><span class="p">)</span> +</span><span id="Parser-2190"><a href="#Parser-2190"><span class="linenos">2190</span></a> +</span><span id="Parser-2191"><a href="#Parser-2191"><span class="linenos">2191</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2192"><a href="#Parser-2192"><span class="linenos">2192</span></a> +</span><span id="Parser-2193"><a href="#Parser-2193"><span class="linenos">2193</span></a> <span class="k">def</span> <span class="nf">_parse_offset</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2194"><a href="#Parser-2194"><span class="linenos">2194</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)):</span> +</span><span id="Parser-2195"><a href="#Parser-2195"><span class="linenos">2195</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2196"><a href="#Parser-2196"><span class="linenos">2196</span></a> +</span><span id="Parser-2197"><a href="#Parser-2197"><span class="linenos">2197</span></a> <span class="n">count</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_number</span><span class="p">()</span> +</span><span id="Parser-2198"><a href="#Parser-2198"><span class="linenos">2198</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">))</span> +</span><span id="Parser-2199"><a href="#Parser-2199"><span class="linenos">2199</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Offset</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">count</span><span class="p">)</span> +</span><span id="Parser-2200"><a href="#Parser-2200"><span class="linenos">2200</span></a> +</span><span id="Parser-2201"><a href="#Parser-2201"><span class="linenos">2201</span></a> <span class="k">def</span> <span class="nf">_parse_lock</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2202"><a href="#Parser-2202"><span class="linenos">2202</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"UPDATE"</span><span class="p">):</span> +</span><span id="Parser-2203"><a href="#Parser-2203"><span class="linenos">2203</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-2204"><a href="#Parser-2204"><span class="linenos">2204</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"FOR"</span><span class="p">,</span> <span class="s2">"SHARE"</span><span class="p">):</span> +</span><span id="Parser-2205"><a href="#Parser-2205"><span class="linenos">2205</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Lock</span><span class="p">,</span> <span class="n">update</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-2206"><a href="#Parser-2206"><span class="linenos">2206</span></a> +</span><span id="Parser-2207"><a href="#Parser-2207"><span class="linenos">2207</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2208"><a href="#Parser-2208"><span class="linenos">2208</span></a> +</span><span id="Parser-2209"><a href="#Parser-2209"><span class="linenos">2209</span></a> <span class="k">def</span> <span class="nf">_parse_set_operations</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2210"><a href="#Parser-2210"><span class="linenos">2210</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SET_OPERATIONS</span><span class="p">):</span> +</span><span id="Parser-2211"><a href="#Parser-2211"><span class="linenos">2211</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2212"><a href="#Parser-2212"><span class="linenos">2212</span></a> +</span><span id="Parser-2213"><a href="#Parser-2213"><span class="linenos">2213</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-2214"><a href="#Parser-2214"><span class="linenos">2214</span></a> +</span><span id="Parser-2215"><a href="#Parser-2215"><span class="linenos">2215</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNION</span><span class="p">:</span> +</span><span id="Parser-2216"><a href="#Parser-2216"><span class="linenos">2216</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span> +</span><span id="Parser-2217"><a href="#Parser-2217"><span class="linenos">2217</span></a> <span class="k">elif</span> <span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">:</span> +</span><span id="Parser-2218"><a href="#Parser-2218"><span class="linenos">2218</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Except</span> +</span><span id="Parser-2219"><a href="#Parser-2219"><span class="linenos">2219</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2220"><a href="#Parser-2220"><span class="linenos">2220</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Intersect</span> +</span><span id="Parser-2221"><a href="#Parser-2221"><span class="linenos">2221</span></a> +</span><span id="Parser-2222"><a href="#Parser-2222"><span class="linenos">2222</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2223"><a href="#Parser-2223"><span class="linenos">2223</span></a> <span class="n">expression</span><span class="p">,</span> +</span><span id="Parser-2224"><a href="#Parser-2224"><span class="linenos">2224</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-2225"><a href="#Parser-2225"><span class="linenos">2225</span></a> <span class="n">distinct</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">)</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">),</span> +</span><span id="Parser-2226"><a href="#Parser-2226"><span class="linenos">2226</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">)),</span> +</span><span id="Parser-2227"><a href="#Parser-2227"><span class="linenos">2227</span></a> <span class="p">)</span> +</span><span id="Parser-2228"><a href="#Parser-2228"><span class="linenos">2228</span></a> +</span><span id="Parser-2229"><a href="#Parser-2229"><span class="linenos">2229</span></a> <span class="k">def</span> <span class="nf">_parse_expression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2230"><a href="#Parser-2230"><span class="linenos">2230</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="Parser-2231"><a href="#Parser-2231"><span class="linenos">2231</span></a> +</span><span id="Parser-2232"><a href="#Parser-2232"><span class="linenos">2232</span></a> <span class="k">def</span> <span class="nf">_parse_conjunction</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2233"><a href="#Parser-2233"><span class="linenos">2233</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">CONJUNCTION</span><span class="p">)</span> +</span><span id="Parser-2234"><a href="#Parser-2234"><span class="linenos">2234</span></a> +</span><span id="Parser-2235"><a href="#Parser-2235"><span class="linenos">2235</span></a> <span class="k">def</span> <span class="nf">_parse_equality</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2236"><a href="#Parser-2236"><span class="linenos">2236</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_comparison</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">EQUALITY</span><span class="p">)</span> +</span><span id="Parser-2237"><a href="#Parser-2237"><span class="linenos">2237</span></a> +</span><span id="Parser-2238"><a href="#Parser-2238"><span class="linenos">2238</span></a> <span class="k">def</span> <span class="nf">_parse_comparison</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2239"><a href="#Parser-2239"><span class="linenos">2239</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_range</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">COMPARISON</span><span class="p">)</span> +</span><span id="Parser-2240"><a href="#Parser-2240"><span class="linenos">2240</span></a> +</span><span id="Parser-2241"><a href="#Parser-2241"><span class="linenos">2241</span></a> <span class="k">def</span> <span class="nf">_parse_range</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2242"><a href="#Parser-2242"><span class="linenos">2242</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-2243"><a href="#Parser-2243"><span class="linenos">2243</span></a> <span class="n">negate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">)</span> +</span><span id="Parser-2244"><a href="#Parser-2244"><span class="linenos">2244</span></a> +</span><span id="Parser-2245"><a href="#Parser-2245"><span class="linenos">2245</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">):</span> +</span><span id="Parser-2246"><a href="#Parser-2246"><span class="linenos">2246</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">RANGE_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2247"><a href="#Parser-2247"><span class="linenos">2247</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">):</span> +</span><span id="Parser-2248"><a href="#Parser-2248"><span class="linenos">2248</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">())</span> +</span><span id="Parser-2249"><a href="#Parser-2249"><span class="linenos">2249</span></a> +</span><span id="Parser-2250"><a href="#Parser-2250"><span class="linenos">2250</span></a> <span class="c1"># Postgres supports ISNULL and NOTNULL for conditions.</span> +</span><span id="Parser-2251"><a href="#Parser-2251"><span class="linenos">2251</span></a> <span class="c1"># https://blog.andreiavram.ro/postgresql-null-composite-type/</span> +</span><span id="Parser-2252"><a href="#Parser-2252"><span class="linenos">2252</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOTNULL</span><span class="p">):</span> +</span><span id="Parser-2253"><a href="#Parser-2253"><span class="linenos">2253</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Null</span><span class="p">())</span> +</span><span id="Parser-2254"><a href="#Parser-2254"><span class="linenos">2254</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2255"><a href="#Parser-2255"><span class="linenos">2255</span></a> +</span><span id="Parser-2256"><a href="#Parser-2256"><span class="linenos">2256</span></a> <span class="k">if</span> <span class="n">negate</span><span class="p">:</span> +</span><span id="Parser-2257"><a href="#Parser-2257"><span class="linenos">2257</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2258"><a href="#Parser-2258"><span class="linenos">2258</span></a> +</span><span id="Parser-2259"><a href="#Parser-2259"><span class="linenos">2259</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IS</span><span class="p">):</span> +</span><span id="Parser-2260"><a href="#Parser-2260"><span class="linenos">2260</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_is</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2261"><a href="#Parser-2261"><span class="linenos">2261</span></a> +</span><span id="Parser-2262"><a href="#Parser-2262"><span class="linenos">2262</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2263"><a href="#Parser-2263"><span class="linenos">2263</span></a> +</span><span id="Parser-2264"><a href="#Parser-2264"><span class="linenos">2264</span></a> <span class="k">def</span> <span class="nf">_parse_is</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2265"><a href="#Parser-2265"><span class="linenos">2265</span></a> <span class="n">negate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">)</span> +</span><span id="Parser-2266"><a href="#Parser-2266"><span class="linenos">2266</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT_FROM</span><span class="p">):</span> +</span><span id="Parser-2267"><a href="#Parser-2267"><span class="linenos">2267</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeEQ</span> <span class="k">if</span> <span class="n">negate</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">NullSafeNEQ</span> +</span><span id="Parser-2268"><a href="#Parser-2268"><span class="linenos">2268</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">())</span> +</span><span id="Parser-2269"><a href="#Parser-2269"><span class="linenos">2269</span></a> +</span><span id="Parser-2270"><a href="#Parser-2270"><span class="linenos">2270</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2271"><a href="#Parser-2271"><span class="linenos">2271</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Is</span><span class="p">,</span> +</span><span id="Parser-2272"><a href="#Parser-2272"><span class="linenos">2272</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-2273"><a href="#Parser-2273"><span class="linenos">2273</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_null</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_boolean</span><span class="p">(),</span> +</span><span id="Parser-2274"><a href="#Parser-2274"><span class="linenos">2274</span></a> <span class="p">)</span> +</span><span id="Parser-2275"><a href="#Parser-2275"><span class="linenos">2275</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Not</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> <span class="k">if</span> <span class="n">negate</span> <span class="k">else</span> <span class="n">this</span> +</span><span id="Parser-2276"><a href="#Parser-2276"><span class="linenos">2276</span></a> +</span><span id="Parser-2277"><a href="#Parser-2277"><span class="linenos">2277</span></a> <span class="k">def</span> <span class="nf">_parse_in</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2278"><a href="#Parser-2278"><span class="linenos">2278</span></a> <span class="n">unnest</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnest</span><span class="p">()</span> +</span><span id="Parser-2279"><a href="#Parser-2279"><span class="linenos">2279</span></a> <span class="k">if</span> <span class="n">unnest</span><span class="p">:</span> +</span><span id="Parser-2280"><a href="#Parser-2280"><span class="linenos">2280</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">unnest</span><span class="o">=</span><span class="n">unnest</span><span class="p">)</span> +</span><span id="Parser-2281"><a href="#Parser-2281"><span class="linenos">2281</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2282"><a href="#Parser-2282"><span class="linenos">2282</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select_or_expression</span><span class="p">)</span> +</span><span id="Parser-2283"><a href="#Parser-2283"><span class="linenos">2283</span></a> +</span><span id="Parser-2284"><a href="#Parser-2284"><span class="linenos">2284</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="Parser-2285"><a href="#Parser-2285"><span class="linenos">2285</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">query</span><span class="o">=</span><span class="n">expressions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="Parser-2286"><a href="#Parser-2286"><span class="linenos">2286</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2287"><a href="#Parser-2287"><span class="linenos">2287</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2288"><a href="#Parser-2288"><span class="linenos">2288</span></a> +</span><span id="Parser-2289"><a href="#Parser-2289"><span class="linenos">2289</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2290"><a href="#Parser-2290"><span class="linenos">2290</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2291"><a href="#Parser-2291"><span class="linenos">2291</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">In</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">field</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">())</span> +</span><span id="Parser-2292"><a href="#Parser-2292"><span class="linenos">2292</span></a> +</span><span id="Parser-2293"><a href="#Parser-2293"><span class="linenos">2293</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2294"><a href="#Parser-2294"><span class="linenos">2294</span></a> +</span><span id="Parser-2295"><a href="#Parser-2295"><span class="linenos">2295</span></a> <span class="k">def</span> <span class="nf">_parse_between</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2296"><a href="#Parser-2296"><span class="linenos">2296</span></a> <span class="n">low</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-2297"><a href="#Parser-2297"><span class="linenos">2297</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">)</span> +</span><span id="Parser-2298"><a href="#Parser-2298"><span class="linenos">2298</span></a> <span class="n">high</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-2299"><a href="#Parser-2299"><span class="linenos">2299</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Between</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">low</span><span class="o">=</span><span class="n">low</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="n">high</span><span class="p">)</span> +</span><span id="Parser-2300"><a href="#Parser-2300"><span class="linenos">2300</span></a> +</span><span id="Parser-2301"><a href="#Parser-2301"><span class="linenos">2301</span></a> <span class="k">def</span> <span class="nf">_parse_escape</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2302"><a href="#Parser-2302"><span class="linenos">2302</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ESCAPE</span><span class="p">):</span> +</span><span id="Parser-2303"><a href="#Parser-2303"><span class="linenos">2303</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2304"><a href="#Parser-2304"><span class="linenos">2304</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Escape</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="Parser-2305"><a href="#Parser-2305"><span class="linenos">2305</span></a> +</span><span id="Parser-2306"><a href="#Parser-2306"><span class="linenos">2306</span></a> <span class="k">def</span> <span class="nf">_parse_bitwise</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2307"><a href="#Parser-2307"><span class="linenos">2307</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-2308"><a href="#Parser-2308"><span class="linenos">2308</span></a> +</span><span id="Parser-2309"><a href="#Parser-2309"><span class="linenos">2309</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-2310"><a href="#Parser-2310"><span class="linenos">2310</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">):</span> +</span><span id="Parser-2311"><a href="#Parser-2311"><span class="linenos">2311</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2312"><a href="#Parser-2312"><span class="linenos">2312</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">BITWISE</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">],</span> +</span><span id="Parser-2313"><a href="#Parser-2313"><span class="linenos">2313</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-2314"><a href="#Parser-2314"><span class="linenos">2314</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">(),</span> +</span><span id="Parser-2315"><a href="#Parser-2315"><span class="linenos">2315</span></a> <span class="p">)</span> +</span><span id="Parser-2316"><a href="#Parser-2316"><span class="linenos">2316</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="Parser-2317"><a href="#Parser-2317"><span class="linenos">2317</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2318"><a href="#Parser-2318"><span class="linenos">2318</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseLeftShift</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-2319"><a href="#Parser-2319"><span class="linenos">2319</span></a> <span class="p">)</span> +</span><span id="Parser-2320"><a href="#Parser-2320"><span class="linenos">2320</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="Parser-2321"><a href="#Parser-2321"><span class="linenos">2321</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2322"><a href="#Parser-2322"><span class="linenos">2322</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">BitwiseRightShift</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-2323"><a href="#Parser-2323"><span class="linenos">2323</span></a> <span class="p">)</span> +</span><span id="Parser-2324"><a href="#Parser-2324"><span class="linenos">2324</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2325"><a href="#Parser-2325"><span class="linenos">2325</span></a> <span class="k">break</span> +</span><span id="Parser-2326"><a href="#Parser-2326"><span class="linenos">2326</span></a> +</span><span id="Parser-2327"><a href="#Parser-2327"><span class="linenos">2327</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2328"><a href="#Parser-2328"><span class="linenos">2328</span></a> +</span><span id="Parser-2329"><a href="#Parser-2329"><span class="linenos">2329</span></a> <span class="k">def</span> <span class="nf">_parse_term</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2330"><a href="#Parser-2330"><span class="linenos">2330</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_factor</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">TERM</span><span class="p">)</span> +</span><span id="Parser-2331"><a href="#Parser-2331"><span class="linenos">2331</span></a> +</span><span id="Parser-2332"><a href="#Parser-2332"><span class="linenos">2332</span></a> <span class="k">def</span> <span class="nf">_parse_factor</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2333"><a href="#Parser-2333"><span class="linenos">2333</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_tokens</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">FACTOR</span><span class="p">)</span> +</span><span id="Parser-2334"><a href="#Parser-2334"><span class="linenos">2334</span></a> +</span><span id="Parser-2335"><a href="#Parser-2335"><span class="linenos">2335</span></a> <span class="k">def</span> <span class="nf">_parse_unary</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2336"><a href="#Parser-2336"><span class="linenos">2336</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">UNARY_PARSERS</span><span class="p">):</span> +</span><span id="Parser-2337"><a href="#Parser-2337"><span class="linenos">2337</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">UNARY_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-2338"><a href="#Parser-2338"><span class="linenos">2338</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_at_time_zone</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_type</span><span class="p">())</span> +</span><span id="Parser-2339"><a href="#Parser-2339"><span class="linenos">2339</span></a> +</span><span id="Parser-2340"><a href="#Parser-2340"><span class="linenos">2340</span></a> <span class="k">def</span> <span class="nf">_parse_type</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2341"><a href="#Parser-2341"><span class="linenos">2341</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">):</span> +</span><span id="Parser-2342"><a href="#Parser-2342"><span class="linenos">2342</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">(),</span> <span class="n">unit</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="Parser-2343"><a href="#Parser-2343"><span class="linenos">2343</span></a> +</span><span id="Parser-2344"><a href="#Parser-2344"><span class="linenos">2344</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-2345"><a href="#Parser-2345"><span class="linenos">2345</span></a> <span class="n">type_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(</span><span class="n">check_func</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-2346"><a href="#Parser-2346"><span class="linenos">2346</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="Parser-2347"><a href="#Parser-2347"><span class="linenos">2347</span></a> +</span><span id="Parser-2348"><a href="#Parser-2348"><span class="linenos">2348</span></a> <span class="k">if</span> <span class="n">type_token</span><span class="p">:</span> +</span><span id="Parser-2349"><a href="#Parser-2349"><span class="linenos">2349</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">and</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Star</span><span class="p">):</span> +</span><span id="Parser-2350"><a href="#Parser-2350"><span class="linenos">2350</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">type_token</span><span class="p">)</span> +</span><span id="Parser-2351"><a href="#Parser-2351"><span class="linenos">2351</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">type_token</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">):</span> +</span><span id="Parser-2352"><a href="#Parser-2352"><span class="linenos">2352</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2353"><a href="#Parser-2353"><span class="linenos">2353</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="Parser-2354"><a href="#Parser-2354"><span class="linenos">2354</span></a> <span class="k">return</span> <span class="n">type_token</span> +</span><span id="Parser-2355"><a href="#Parser-2355"><span class="linenos">2355</span></a> +</span><span id="Parser-2356"><a href="#Parser-2356"><span class="linenos">2356</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2357"><a href="#Parser-2357"><span class="linenos">2357</span></a> +</span><span id="Parser-2358"><a href="#Parser-2358"><span class="linenos">2358</span></a> <span class="k">def</span> <span class="nf">_parse_types</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">check_func</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2359"><a href="#Parser-2359"><span class="linenos">2359</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-2360"><a href="#Parser-2360"><span class="linenos">2360</span></a> +</span><span id="Parser-2361"><a href="#Parser-2361"><span class="linenos">2361</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">):</span> +</span><span id="Parser-2362"><a href="#Parser-2362"><span class="linenos">2362</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2363"><a href="#Parser-2363"><span class="linenos">2363</span></a> +</span><span id="Parser-2364"><a href="#Parser-2364"><span class="linenos">2364</span></a> <span class="n">type_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-2365"><a href="#Parser-2365"><span class="linenos">2365</span></a> +</span><span id="Parser-2366"><a href="#Parser-2366"><span class="linenos">2366</span></a> <span class="k">if</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PSEUDO_TYPE</span><span class="p">:</span> +</span><span id="Parser-2367"><a href="#Parser-2367"><span class="linenos">2367</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PseudoType</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-2368"><a href="#Parser-2368"><span class="linenos">2368</span></a> +</span><span id="Parser-2369"><a href="#Parser-2369"><span class="linenos">2369</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="n">type_token</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">NESTED_TYPE_TOKENS</span> +</span><span id="Parser-2370"><a href="#Parser-2370"><span class="linenos">2370</span></a> <span class="n">is_struct</span> <span class="o">=</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span> +</span><span id="Parser-2371"><a href="#Parser-2371"><span class="linenos">2371</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2372"><a href="#Parser-2372"><span class="linenos">2372</span></a> <span class="n">maybe_func</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-2373"><a href="#Parser-2373"><span class="linenos">2373</span></a> +</span><span id="Parser-2374"><a href="#Parser-2374"><span class="linenos">2374</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2375"><a href="#Parser-2375"><span class="linenos">2375</span></a> <span class="k">if</span> <span class="n">is_struct</span><span class="p">:</span> +</span><span id="Parser-2376"><a href="#Parser-2376"><span class="linenos">2376</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_struct_kwargs</span><span class="p">)</span> +</span><span id="Parser-2377"><a href="#Parser-2377"><span class="linenos">2377</span></a> <span class="k">elif</span> <span class="n">nested</span><span class="p">:</span> +</span><span id="Parser-2378"><a href="#Parser-2378"><span class="linenos">2378</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">)</span> +</span><span id="Parser-2379"><a href="#Parser-2379"><span class="linenos">2379</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2380"><a href="#Parser-2380"><span class="linenos">2380</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-2381"><a href="#Parser-2381"><span class="linenos">2381</span></a> +</span><span id="Parser-2382"><a href="#Parser-2382"><span class="linenos">2382</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="Parser-2383"><a href="#Parser-2383"><span class="linenos">2383</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2384"><a href="#Parser-2384"><span class="linenos">2384</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2385"><a href="#Parser-2385"><span class="linenos">2385</span></a> +</span><span id="Parser-2386"><a href="#Parser-2386"><span class="linenos">2386</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2387"><a href="#Parser-2387"><span class="linenos">2387</span></a> <span class="n">maybe_func</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Parser-2388"><a href="#Parser-2388"><span class="linenos">2388</span></a> +</span><span id="Parser-2389"><a href="#Parser-2389"><span class="linenos">2389</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">nested</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">):</span> +</span><span id="Parser-2390"><a href="#Parser-2390"><span class="linenos">2390</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="Parser-2391"><a href="#Parser-2391"><span class="linenos">2391</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="Parser-2392"><a href="#Parser-2392"><span class="linenos">2392</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">type_token</span><span class="o">.</span><span class="n">value</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)],</span> +</span><span id="Parser-2393"><a href="#Parser-2393"><span class="linenos">2393</span></a> <span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Parser-2394"><a href="#Parser-2394"><span class="linenos">2394</span></a> <span class="p">)</span> +</span><span id="Parser-2395"><a href="#Parser-2395"><span class="linenos">2395</span></a> +</span><span id="Parser-2396"><a href="#Parser-2396"><span class="linenos">2396</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">):</span> +</span><span id="Parser-2397"><a href="#Parser-2397"><span class="linenos">2397</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="Parser-2398"><a href="#Parser-2398"><span class="linenos">2398</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="Parser-2399"><a href="#Parser-2399"><span class="linenos">2399</span></a> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">this</span><span class="p">],</span> +</span><span id="Parser-2400"><a href="#Parser-2400"><span class="linenos">2400</span></a> <span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> +</span><span id="Parser-2401"><a href="#Parser-2401"><span class="linenos">2401</span></a> <span class="p">)</span> +</span><span id="Parser-2402"><a href="#Parser-2402"><span class="linenos">2402</span></a> +</span><span id="Parser-2403"><a href="#Parser-2403"><span class="linenos">2403</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2404"><a href="#Parser-2404"><span class="linenos">2404</span></a> +</span><span id="Parser-2405"><a href="#Parser-2405"><span class="linenos">2405</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">):</span> +</span><span id="Parser-2406"><a href="#Parser-2406"><span class="linenos">2406</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2407"><a href="#Parser-2407"><span class="linenos">2407</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2408"><a href="#Parser-2408"><span class="linenos">2408</span></a> +</span><span id="Parser-2409"><a href="#Parser-2409"><span class="linenos">2409</span></a> <span class="n">values</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2410"><a href="#Parser-2410"><span class="linenos">2410</span></a> <span class="k">if</span> <span class="n">nested</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">):</span> +</span><span id="Parser-2411"><a href="#Parser-2411"><span class="linenos">2411</span></a> <span class="k">if</span> <span class="n">is_struct</span><span class="p">:</span> +</span><span id="Parser-2412"><a href="#Parser-2412"><span class="linenos">2412</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_struct_kwargs</span><span class="p">)</span> +</span><span id="Parser-2413"><a href="#Parser-2413"><span class="linenos">2413</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2414"><a href="#Parser-2414"><span class="linenos">2414</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">)</span> +</span><span id="Parser-2415"><a href="#Parser-2415"><span class="linenos">2415</span></a> +</span><span id="Parser-2416"><a href="#Parser-2416"><span class="linenos">2416</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">):</span> +</span><span id="Parser-2417"><a href="#Parser-2417"><span class="linenos">2417</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting >"</span><span class="p">)</span> +</span><span id="Parser-2418"><a href="#Parser-2418"><span class="linenos">2418</span></a> +</span><span id="Parser-2419"><a href="#Parser-2419"><span class="linenos">2419</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">)):</span> +</span><span id="Parser-2420"><a href="#Parser-2420"><span class="linenos">2420</span></a> <span class="n">values</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-2421"><a href="#Parser-2421"><span class="linenos">2421</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">))</span> +</span><span id="Parser-2422"><a href="#Parser-2422"><span class="linenos">2422</span></a> +</span><span id="Parser-2423"><a href="#Parser-2423"><span class="linenos">2423</span></a> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2424"><a href="#Parser-2424"><span class="linenos">2424</span></a> <span class="k">if</span> <span class="n">type_token</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">TIMESTAMPS</span><span class="p">:</span> +</span><span id="Parser-2425"><a href="#Parser-2425"><span class="linenos">2425</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_TIME_ZONE</span><span class="p">)</span> <span class="ow">or</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> +</span><span id="Parser-2426"><a href="#Parser-2426"><span class="linenos">2426</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2427"><a href="#Parser-2427"><span class="linenos">2427</span></a> <span class="k">elif</span> <span class="p">(</span> +</span><span id="Parser-2428"><a href="#Parser-2428"><span class="linenos">2428</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_LOCAL_TIME_ZONE</span><span class="p">)</span> <span class="ow">or</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span> +</span><span id="Parser-2429"><a href="#Parser-2429"><span class="linenos">2429</span></a> <span class="p">):</span> +</span><span id="Parser-2430"><a href="#Parser-2430"><span class="linenos">2430</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2431"><a href="#Parser-2431"><span class="linenos">2431</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITHOUT_TIME_ZONE</span><span class="p">):</span> +</span><span id="Parser-2432"><a href="#Parser-2432"><span class="linenos">2432</span></a> <span class="k">if</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">:</span> +</span><span id="Parser-2433"><a href="#Parser-2433"><span class="linenos">2433</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2434"><a href="#Parser-2434"><span class="linenos">2434</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2435"><a href="#Parser-2435"><span class="linenos">2435</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2436"><a href="#Parser-2436"><span class="linenos">2436</span></a> +</span><span id="Parser-2437"><a href="#Parser-2437"><span class="linenos">2437</span></a> <span class="n">maybe_func</span> <span class="o">=</span> <span class="n">maybe_func</span> <span class="ow">and</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span> +</span><span id="Parser-2438"><a href="#Parser-2438"><span class="linenos">2438</span></a> +</span><span id="Parser-2439"><a href="#Parser-2439"><span class="linenos">2439</span></a> <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-2440"><a href="#Parser-2440"><span class="linenos">2440</span></a> <span class="n">value</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2441"><a href="#Parser-2441"><span class="linenos">2441</span></a> <span class="k">elif</span> <span class="n">type_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">:</span> +</span><span id="Parser-2442"><a href="#Parser-2442"><span class="linenos">2442</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Interval</span><span class="p">,</span> <span class="n">unit</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="Parser-2443"><a href="#Parser-2443"><span class="linenos">2443</span></a> +</span><span id="Parser-2444"><a href="#Parser-2444"><span class="linenos">2444</span></a> <span class="k">if</span> <span class="n">maybe_func</span> <span class="ow">and</span> <span class="n">check_func</span><span class="p">:</span> +</span><span id="Parser-2445"><a href="#Parser-2445"><span class="linenos">2445</span></a> <span class="n">index2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-2446"><a href="#Parser-2446"><span class="linenos">2446</span></a> <span class="n">peek</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-2447"><a href="#Parser-2447"><span class="linenos">2447</span></a> +</span><span id="Parser-2448"><a href="#Parser-2448"><span class="linenos">2448</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">peek</span><span class="p">:</span> +</span><span id="Parser-2449"><a href="#Parser-2449"><span class="linenos">2449</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2450"><a href="#Parser-2450"><span class="linenos">2450</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2451"><a href="#Parser-2451"><span class="linenos">2451</span></a> +</span><span id="Parser-2452"><a href="#Parser-2452"><span class="linenos">2452</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index2</span><span class="p">)</span> +</span><span id="Parser-2453"><a href="#Parser-2453"><span class="linenos">2453</span></a> +</span><span id="Parser-2454"><a href="#Parser-2454"><span class="linenos">2454</span></a> <span class="k">if</span> <span class="n">value</span><span class="p">:</span> +</span><span id="Parser-2455"><a href="#Parser-2455"><span class="linenos">2455</span></a> <span class="k">return</span> <span class="n">value</span> +</span><span id="Parser-2456"><a href="#Parser-2456"><span class="linenos">2456</span></a> +</span><span id="Parser-2457"><a href="#Parser-2457"><span class="linenos">2457</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="Parser-2458"><a href="#Parser-2458"><span class="linenos">2458</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">type_token</span><span class="o">.</span><span class="n">value</span><span class="o">.</span><span class="n">upper</span><span class="p">()],</span> +</span><span id="Parser-2459"><a href="#Parser-2459"><span class="linenos">2459</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> +</span><span id="Parser-2460"><a href="#Parser-2460"><span class="linenos">2460</span></a> <span class="n">nested</span><span class="o">=</span><span class="n">nested</span><span class="p">,</span> +</span><span id="Parser-2461"><a href="#Parser-2461"><span class="linenos">2461</span></a> <span class="n">values</span><span class="o">=</span><span class="n">values</span><span class="p">,</span> +</span><span id="Parser-2462"><a href="#Parser-2462"><span class="linenos">2462</span></a> <span class="p">)</span> +</span><span id="Parser-2463"><a href="#Parser-2463"><span class="linenos">2463</span></a> +</span><span id="Parser-2464"><a href="#Parser-2464"><span class="linenos">2464</span></a> <span class="k">def</span> <span class="nf">_parse_struct_kwargs</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2465"><a href="#Parser-2465"><span class="linenos">2465</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">TYPE_TOKENS</span><span class="p">:</span> +</span><span id="Parser-2466"><a href="#Parser-2466"><span class="linenos">2466</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-2467"><a href="#Parser-2467"><span class="linenos">2467</span></a> +</span><span id="Parser-2468"><a href="#Parser-2468"><span class="linenos">2468</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2469"><a href="#Parser-2469"><span class="linenos">2469</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">)</span> +</span><span id="Parser-2470"><a href="#Parser-2470"><span class="linenos">2470</span></a> <span class="n">data_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-2471"><a href="#Parser-2471"><span class="linenos">2471</span></a> +</span><span id="Parser-2472"><a href="#Parser-2472"><span class="linenos">2472</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">data_type</span><span class="p">:</span> +</span><span id="Parser-2473"><a href="#Parser-2473"><span class="linenos">2473</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2474"><a href="#Parser-2474"><span class="linenos">2474</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">StructKwarg</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">data_type</span><span class="p">)</span> +</span><span id="Parser-2475"><a href="#Parser-2475"><span class="linenos">2475</span></a> +</span><span id="Parser-2476"><a href="#Parser-2476"><span class="linenos">2476</span></a> <span class="k">def</span> <span class="nf">_parse_at_time_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2477"><a href="#Parser-2477"><span class="linenos">2477</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AT_TIME_ZONE</span><span class="p">):</span> +</span><span id="Parser-2478"><a href="#Parser-2478"><span class="linenos">2478</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2479"><a href="#Parser-2479"><span class="linenos">2479</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AtTimeZone</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">zone</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_unary</span><span class="p">())</span> +</span><span id="Parser-2480"><a href="#Parser-2480"><span class="linenos">2480</span></a> +</span><span id="Parser-2481"><a href="#Parser-2481"><span class="linenos">2481</span></a> <span class="k">def</span> <span class="nf">_parse_column</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2482"><a href="#Parser-2482"><span class="linenos">2482</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">()</span> +</span><span id="Parser-2483"><a href="#Parser-2483"><span class="linenos">2483</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">):</span> +</span><span id="Parser-2484"><a href="#Parser-2484"><span class="linenos">2484</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2485"><a href="#Parser-2485"><span class="linenos">2485</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="n">this</span><span class="p">:</span> +</span><span id="Parser-2486"><a href="#Parser-2486"><span class="linenos">2486</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2487"><a href="#Parser-2487"><span class="linenos">2487</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2488"><a href="#Parser-2488"><span class="linenos">2488</span></a> +</span><span id="Parser-2489"><a href="#Parser-2489"><span class="linenos">2489</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="p">):</span> +</span><span id="Parser-2490"><a href="#Parser-2490"><span class="linenos">2490</span></a> <span class="n">op_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-2491"><a href="#Parser-2491"><span class="linenos">2491</span></a> <span class="n">op</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">COLUMN_OPERATORS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">op_token</span><span class="p">)</span> +</span><span id="Parser-2492"><a href="#Parser-2492"><span class="linenos">2492</span></a> +</span><span id="Parser-2493"><a href="#Parser-2493"><span class="linenos">2493</span></a> <span class="k">if</span> <span class="n">op_token</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">:</span> +</span><span id="Parser-2494"><a href="#Parser-2494"><span class="linenos">2494</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-2495"><a href="#Parser-2495"><span class="linenos">2495</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">field</span><span class="p">:</span> +</span><span id="Parser-2496"><a href="#Parser-2496"><span class="linenos">2496</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected type"</span><span class="p">)</span> +</span><span id="Parser-2497"><a href="#Parser-2497"><span class="linenos">2497</span></a> <span class="k">elif</span> <span class="n">op</span><span class="p">:</span> +</span><span id="Parser-2498"><a href="#Parser-2498"><span class="linenos">2498</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-2499"><a href="#Parser-2499"><span class="linenos">2499</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-2500"><a href="#Parser-2500"><span class="linenos">2500</span></a> <span class="n">field</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Parser-2501"><a href="#Parser-2501"><span class="linenos">2501</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Parser-2502"><a href="#Parser-2502"><span class="linenos">2502</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span> +</span><span id="Parser-2503"><a href="#Parser-2503"><span class="linenos">2503</span></a> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">value</span><span class="p">)</span> +</span><span id="Parser-2504"><a href="#Parser-2504"><span class="linenos">2504</span></a> <span class="p">)</span> +</span><span id="Parser-2505"><a href="#Parser-2505"><span class="linenos">2505</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2506"><a href="#Parser-2506"><span class="linenos">2506</span></a> <span class="n">field</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_star</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2507"><a href="#Parser-2507"><span class="linenos">2507</span></a> +</span><span id="Parser-2508"><a href="#Parser-2508"><span class="linenos">2508</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">field</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Func</span><span class="p">):</span> +</span><span id="Parser-2509"><a href="#Parser-2509"><span class="linenos">2509</span></a> <span class="c1"># bigquery allows function calls like x.y.count(...)</span> +</span><span id="Parser-2510"><a href="#Parser-2510"><span class="linenos">2510</span></a> <span class="c1"># SAFE.SUBSTR(...)</span> +</span><span id="Parser-2511"><a href="#Parser-2511"><span class="linenos">2511</span></a> <span class="c1"># https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-reference#function_call_rules</span> +</span><span id="Parser-2512"><a href="#Parser-2512"><span class="linenos">2512</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_columns_with_dots</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2513"><a href="#Parser-2513"><span class="linenos">2513</span></a> +</span><span id="Parser-2514"><a href="#Parser-2514"><span class="linenos">2514</span></a> <span class="k">if</span> <span class="n">op</span><span class="p">:</span> +</span><span id="Parser-2515"><a href="#Parser-2515"><span class="linenos">2515</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">op</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">,</span> <span class="n">field</span><span class="p">)</span> +</span><span id="Parser-2516"><a href="#Parser-2516"><span class="linenos">2516</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">this</span><span class="o">.</span><span class="n">table</span><span class="p">:</span> +</span><span id="Parser-2517"><a href="#Parser-2517"><span class="linenos">2517</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">field</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2518"><a href="#Parser-2518"><span class="linenos">2518</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2519"><a href="#Parser-2519"><span class="linenos">2519</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">field</span><span class="p">)</span> +</span><span id="Parser-2520"><a href="#Parser-2520"><span class="linenos">2520</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2521"><a href="#Parser-2521"><span class="linenos">2521</span></a> +</span><span id="Parser-2522"><a href="#Parser-2522"><span class="linenos">2522</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2523"><a href="#Parser-2523"><span class="linenos">2523</span></a> +</span><span id="Parser-2524"><a href="#Parser-2524"><span class="linenos">2524</span></a> <span class="k">def</span> <span class="nf">_parse_primary</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2525"><a href="#Parser-2525"><span class="linenos">2525</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">):</span> +</span><span id="Parser-2526"><a href="#Parser-2526"><span class="linenos">2526</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-2527"><a href="#Parser-2527"><span class="linenos">2527</span></a> <span class="n">primary</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-2528"><a href="#Parser-2528"><span class="linenos">2528</span></a> +</span><span id="Parser-2529"><a href="#Parser-2529"><span class="linenos">2529</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">:</span> +</span><span id="Parser-2530"><a href="#Parser-2530"><span class="linenos">2530</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">primary</span><span class="p">]</span> +</span><span id="Parser-2531"><a href="#Parser-2531"><span class="linenos">2531</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">):</span> +</span><span id="Parser-2532"><a href="#Parser-2532"><span class="linenos">2532</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">))</span> +</span><span id="Parser-2533"><a href="#Parser-2533"><span class="linenos">2533</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Parser-2534"><a href="#Parser-2534"><span class="linenos">2534</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2535"><a href="#Parser-2535"><span class="linenos">2535</span></a> <span class="k">return</span> <span class="n">primary</span> +</span><span id="Parser-2536"><a href="#Parser-2536"><span class="linenos">2536</span></a> +</span><span id="Parser-2537"><a href="#Parser-2537"><span class="linenos">2537</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">):</span> +</span><span id="Parser-2538"><a href="#Parser-2538"><span class="linenos">2538</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="sa">f</span><span class="s2">"0.</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Parser-2539"><a href="#Parser-2539"><span class="linenos">2539</span></a> +</span><span id="Parser-2540"><a href="#Parser-2540"><span class="linenos">2540</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2541"><a href="#Parser-2541"><span class="linenos">2541</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-2542"><a href="#Parser-2542"><span class="linenos">2542</span></a> <span class="n">query</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">()</span> +</span><span id="Parser-2543"><a href="#Parser-2543"><span class="linenos">2543</span></a> +</span><span id="Parser-2544"><a href="#Parser-2544"><span class="linenos">2544</span></a> <span class="k">if</span> <span class="n">query</span><span class="p">:</span> +</span><span id="Parser-2545"><a href="#Parser-2545"><span class="linenos">2545</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="n">query</span><span class="p">]</span> +</span><span id="Parser-2546"><a href="#Parser-2546"><span class="linenos">2546</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2547"><a href="#Parser-2547"><span class="linenos">2547</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="Parser-2548"><a href="#Parser-2548"><span class="linenos">2548</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_alias</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> <span class="n">explicit</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-2549"><a href="#Parser-2549"><span class="linenos">2549</span></a> <span class="p">)</span> +</span><span id="Parser-2550"><a href="#Parser-2550"><span class="linenos">2550</span></a> +</span><span id="Parser-2551"><a href="#Parser-2551"><span class="linenos">2551</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Parser-2552"><a href="#Parser-2552"><span class="linenos">2552</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_query_modifiers</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2553"><a href="#Parser-2553"><span class="linenos">2553</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2554"><a href="#Parser-2554"><span class="linenos">2554</span></a> +</span><span id="Parser-2555"><a href="#Parser-2555"><span class="linenos">2555</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subqueryable</span><span class="p">):</span> +</span><span id="Parser-2556"><a href="#Parser-2556"><span class="linenos">2556</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span> +</span><span id="Parser-2557"><a href="#Parser-2557"><span class="linenos">2557</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_subquery</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">parse_alias</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-2558"><a href="#Parser-2558"><span class="linenos">2558</span></a> <span class="p">)</span> +</span><span id="Parser-2559"><a href="#Parser-2559"><span class="linenos">2559</span></a> <span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">expressions</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Parser-2560"><a href="#Parser-2560"><span class="linenos">2560</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2561"><a href="#Parser-2561"><span class="linenos">2561</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2562"><a href="#Parser-2562"><span class="linenos">2562</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Paren</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2563"><a href="#Parser-2563"><span class="linenos">2563</span></a> +</span><span id="Parser-2564"><a href="#Parser-2564"><span class="linenos">2564</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">and</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="Parser-2565"><a href="#Parser-2565"><span class="linenos">2565</span></a> <span class="n">this</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="Parser-2566"><a href="#Parser-2566"><span class="linenos">2566</span></a> +</span><span id="Parser-2567"><a href="#Parser-2567"><span class="linenos">2567</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2568"><a href="#Parser-2568"><span class="linenos">2568</span></a> +</span><span id="Parser-2569"><a href="#Parser-2569"><span class="linenos">2569</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2570"><a href="#Parser-2570"><span class="linenos">2570</span></a> +</span><span id="Parser-2571"><a href="#Parser-2571"><span class="linenos">2571</span></a> <span class="k">def</span> <span class="nf">_parse_field</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">any_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2572"><a href="#Parser-2572"><span class="linenos">2572</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="p">)</span> +</span><span id="Parser-2573"><a href="#Parser-2573"><span class="linenos">2573</span></a> +</span><span id="Parser-2574"><a href="#Parser-2574"><span class="linenos">2574</span></a> <span class="k">def</span> <span class="nf">_parse_function</span><span class="p">(</span> +</span><span id="Parser-2575"><a href="#Parser-2575"><span class="linenos">2575</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">functions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2576"><a href="#Parser-2576"><span class="linenos">2576</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2577"><a href="#Parser-2577"><span class="linenos">2577</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="Parser-2578"><a href="#Parser-2578"><span class="linenos">2578</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2579"><a href="#Parser-2579"><span class="linenos">2579</span></a> +</span><span id="Parser-2580"><a href="#Parser-2580"><span class="linenos">2580</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-2581"><a href="#Parser-2581"><span class="linenos">2581</span></a> +</span><span id="Parser-2582"><a href="#Parser-2582"><span class="linenos">2582</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">):</span> +</span><span id="Parser-2583"><a href="#Parser-2583"><span class="linenos">2583</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">[</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-2584"><a href="#Parser-2584"><span class="linenos">2584</span></a> +</span><span id="Parser-2585"><a href="#Parser-2585"><span class="linenos">2585</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="o">.</span><span class="n">token_type</span> <span class="o">!=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">:</span> +</span><span id="Parser-2586"><a href="#Parser-2586"><span class="linenos">2586</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">:</span> +</span><span id="Parser-2587"><a href="#Parser-2587"><span class="linenos">2587</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-2588"><a href="#Parser-2588"><span class="linenos">2588</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTIONS</span><span class="p">[</span><span class="n">token_type</span><span class="p">])</span> +</span><span id="Parser-2589"><a href="#Parser-2589"><span class="linenos">2589</span></a> +</span><span id="Parser-2590"><a href="#Parser-2590"><span class="linenos">2590</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2591"><a href="#Parser-2591"><span class="linenos">2591</span></a> +</span><span id="Parser-2592"><a href="#Parser-2592"><span class="linenos">2592</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">FUNC_TOKENS</span><span class="p">:</span> +</span><span id="Parser-2593"><a href="#Parser-2593"><span class="linenos">2593</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2594"><a href="#Parser-2594"><span class="linenos">2594</span></a> +</span><span id="Parser-2595"><a href="#Parser-2595"><span class="linenos">2595</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-2596"><a href="#Parser-2596"><span class="linenos">2596</span></a> <span class="n">upper</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Parser-2597"><a href="#Parser-2597"><span class="linenos">2597</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> +</span><span id="Parser-2598"><a href="#Parser-2598"><span class="linenos">2598</span></a> +</span><span id="Parser-2599"><a href="#Parser-2599"><span class="linenos">2599</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">FUNCTION_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">upper</span><span class="p">)</span> +</span><span id="Parser-2600"><a href="#Parser-2600"><span class="linenos">2600</span></a> +</span><span id="Parser-2601"><a href="#Parser-2601"><span class="linenos">2601</span></a> <span class="k">if</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="Parser-2602"><a href="#Parser-2602"><span class="linenos">2602</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-2603"><a href="#Parser-2603"><span class="linenos">2603</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2604"><a href="#Parser-2604"><span class="linenos">2604</span></a> <span class="n">subquery_predicate</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">SUBQUERY_PREDICATES</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">token_type</span><span class="p">)</span> +</span><span id="Parser-2605"><a href="#Parser-2605"><span class="linenos">2605</span></a> +</span><span id="Parser-2606"><a href="#Parser-2606"><span class="linenos">2606</span></a> <span class="k">if</span> <span class="n">subquery_predicate</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">):</span> +</span><span id="Parser-2607"><a href="#Parser-2607"><span class="linenos">2607</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">subquery_predicate</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">())</span> +</span><span id="Parser-2608"><a href="#Parser-2608"><span class="linenos">2608</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2609"><a href="#Parser-2609"><span class="linenos">2609</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2610"><a href="#Parser-2610"><span class="linenos">2610</span></a> +</span><span id="Parser-2611"><a href="#Parser-2611"><span class="linenos">2611</span></a> <span class="k">if</span> <span class="n">functions</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-2612"><a href="#Parser-2612"><span class="linenos">2612</span></a> <span class="n">functions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">FUNCTIONS</span> +</span><span id="Parser-2613"><a href="#Parser-2613"><span class="linenos">2613</span></a> +</span><span id="Parser-2614"><a href="#Parser-2614"><span class="linenos">2614</span></a> <span class="n">function</span> <span class="o">=</span> <span class="n">functions</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">upper</span><span class="p">)</span> +</span><span id="Parser-2615"><a href="#Parser-2615"><span class="linenos">2615</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">)</span> +</span><span id="Parser-2616"><a href="#Parser-2616"><span class="linenos">2616</span></a> +</span><span id="Parser-2617"><a href="#Parser-2617"><span class="linenos">2617</span></a> <span class="k">if</span> <span class="n">function</span><span class="p">:</span> +</span><span id="Parser-2618"><a href="#Parser-2618"><span class="linenos">2618</span></a> <span class="c1"># Clickhouse supports function calls like foo(x, y)(z), so for these we need to also parse the</span> +</span><span id="Parser-2619"><a href="#Parser-2619"><span class="linenos">2619</span></a> <span class="c1"># second parameter list (i.e. "(z)") and the corresponding function will receive both arg lists.</span> +</span><span id="Parser-2620"><a href="#Parser-2620"><span class="linenos">2620</span></a> <span class="k">if</span> <span class="n">count_params</span><span class="p">(</span><span class="n">function</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="Parser-2621"><a href="#Parser-2621"><span class="linenos">2621</span></a> <span class="n">params</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2622"><a href="#Parser-2622"><span class="linenos">2622</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2623"><a href="#Parser-2623"><span class="linenos">2623</span></a> <span class="n">params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_lambda</span><span class="p">)</span> +</span><span id="Parser-2624"><a href="#Parser-2624"><span class="linenos">2624</span></a> +</span><span id="Parser-2625"><a href="#Parser-2625"><span class="linenos">2625</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">params</span><span class="p">)</span> +</span><span id="Parser-2626"><a href="#Parser-2626"><span class="linenos">2626</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2627"><a href="#Parser-2627"><span class="linenos">2627</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">function</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-2628"><a href="#Parser-2628"><span class="linenos">2628</span></a> +</span><span id="Parser-2629"><a href="#Parser-2629"><span class="linenos">2629</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="Parser-2630"><a href="#Parser-2630"><span class="linenos">2630</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2631"><a href="#Parser-2631"><span class="linenos">2631</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Anonymous</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-2632"><a href="#Parser-2632"><span class="linenos">2632</span></a> +</span><span id="Parser-2633"><a href="#Parser-2633"><span class="linenos">2633</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2634"><a href="#Parser-2634"><span class="linenos">2634</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2635"><a href="#Parser-2635"><span class="linenos">2635</span></a> +</span><span id="Parser-2636"><a href="#Parser-2636"><span class="linenos">2636</span></a> <span class="k">def</span> <span class="nf">_parse_user_defined_function</span><span class="p">(</span> +</span><span id="Parser-2637"><a href="#Parser-2637"><span class="linenos">2637</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">kind</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2638"><a href="#Parser-2638"><span class="linenos">2638</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2639"><a href="#Parser-2639"><span class="linenos">2639</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2640"><a href="#Parser-2640"><span class="linenos">2640</span></a> +</span><span id="Parser-2641"><a href="#Parser-2641"><span class="linenos">2641</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="Parser-2642"><a href="#Parser-2642"><span class="linenos">2642</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">())</span> +</span><span id="Parser-2643"><a href="#Parser-2643"><span class="linenos">2643</span></a> +</span><span id="Parser-2644"><a href="#Parser-2644"><span class="linenos">2644</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2645"><a href="#Parser-2645"><span class="linenos">2645</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2646"><a href="#Parser-2646"><span class="linenos">2646</span></a> +</span><span id="Parser-2647"><a href="#Parser-2647"><span class="linenos">2647</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_udf_kwarg</span><span class="p">)</span> +</span><span id="Parser-2648"><a href="#Parser-2648"><span class="linenos">2648</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2649"><a href="#Parser-2649"><span class="linenos">2649</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2650"><a href="#Parser-2650"><span class="linenos">2650</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">wrapped</span><span class="o">=</span><span class="kc">True</span> +</span><span id="Parser-2651"><a href="#Parser-2651"><span class="linenos">2651</span></a> <span class="p">)</span> +</span><span id="Parser-2652"><a href="#Parser-2652"><span class="linenos">2652</span></a> +</span><span id="Parser-2653"><a href="#Parser-2653"><span class="linenos">2653</span></a> <span class="k">def</span> <span class="nf">_parse_introducer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2654"><a href="#Parser-2654"><span class="linenos">2654</span></a> <span class="n">literal</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="Parser-2655"><a href="#Parser-2655"><span class="linenos">2655</span></a> <span class="k">if</span> <span class="n">literal</span><span class="p">:</span> +</span><span id="Parser-2656"><a href="#Parser-2656"><span class="linenos">2656</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Introducer</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">literal</span><span class="p">)</span> +</span><span id="Parser-2657"><a href="#Parser-2657"><span class="linenos">2657</span></a> +</span><span id="Parser-2658"><a href="#Parser-2658"><span class="linenos">2658</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-2659"><a href="#Parser-2659"><span class="linenos">2659</span></a> +</span><span id="Parser-2660"><a href="#Parser-2660"><span class="linenos">2660</span></a> <span class="k">def</span> <span class="nf">_parse_national</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2661"><a href="#Parser-2661"><span class="linenos">2661</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">National</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">))</span> +</span><span id="Parser-2662"><a href="#Parser-2662"><span class="linenos">2662</span></a> +</span><span id="Parser-2663"><a href="#Parser-2663"><span class="linenos">2663</span></a> <span class="k">def</span> <span class="nf">_parse_session_parameter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2664"><a href="#Parser-2664"><span class="linenos">2664</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2665"><a href="#Parser-2665"><span class="linenos">2665</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="Parser-2666"><a href="#Parser-2666"><span class="linenos">2666</span></a> +</span><span id="Parser-2667"><a href="#Parser-2667"><span class="linenos">2667</span></a> <span class="k">if</span> <span class="n">this</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">):</span> +</span><span id="Parser-2668"><a href="#Parser-2668"><span class="linenos">2668</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span> +</span><span id="Parser-2669"><a href="#Parser-2669"><span class="linenos">2669</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary</span><span class="p">()</span> +</span><span id="Parser-2670"><a href="#Parser-2670"><span class="linenos">2670</span></a> +</span><span id="Parser-2671"><a href="#Parser-2671"><span class="linenos">2671</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">SessionParameter</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="Parser-2672"><a href="#Parser-2672"><span class="linenos">2672</span></a> +</span><span id="Parser-2673"><a href="#Parser-2673"><span class="linenos">2673</span></a> <span class="k">def</span> <span class="nf">_parse_udf_kwarg</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2674"><a href="#Parser-2674"><span class="linenos">2674</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2675"><a href="#Parser-2675"><span class="linenos">2675</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-2676"><a href="#Parser-2676"><span class="linenos">2676</span></a> +</span><span id="Parser-2677"><a href="#Parser-2677"><span class="linenos">2677</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Parser-2678"><a href="#Parser-2678"><span class="linenos">2678</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2679"><a href="#Parser-2679"><span class="linenos">2679</span></a> +</span><span id="Parser-2680"><a href="#Parser-2680"><span class="linenos">2680</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">UserDefinedFunctionKwarg</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="Parser-2681"><a href="#Parser-2681"><span class="linenos">2681</span></a> +</span><span id="Parser-2682"><a href="#Parser-2682"><span class="linenos">2682</span></a> <span class="k">def</span> <span class="nf">_parse_lambda</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2683"><a href="#Parser-2683"><span class="linenos">2683</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-2684"><a href="#Parser-2684"><span class="linenos">2684</span></a> +</span><span id="Parser-2685"><a href="#Parser-2685"><span class="linenos">2685</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2686"><a href="#Parser-2686"><span class="linenos">2686</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">)</span> +</span><span id="Parser-2687"><a href="#Parser-2687"><span class="linenos">2687</span></a> +</span><span id="Parser-2688"><a href="#Parser-2688"><span class="linenos">2688</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">):</span> +</span><span id="Parser-2689"><a href="#Parser-2689"><span class="linenos">2689</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2690"><a href="#Parser-2690"><span class="linenos">2690</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2691"><a href="#Parser-2691"><span class="linenos">2691</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()]</span> +</span><span id="Parser-2692"><a href="#Parser-2692"><span class="linenos">2692</span></a> +</span><span id="Parser-2693"><a href="#Parser-2693"><span class="linenos">2693</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">LAMBDAS</span><span class="p">):</span> +</span><span id="Parser-2694"><a href="#Parser-2694"><span class="linenos">2694</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">LAMBDAS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2695"><a href="#Parser-2695"><span class="linenos">2695</span></a> +</span><span id="Parser-2696"><a href="#Parser-2696"><span class="linenos">2696</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2697"><a href="#Parser-2697"><span class="linenos">2697</span></a> +</span><span id="Parser-2698"><a href="#Parser-2698"><span class="linenos">2698</span></a> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-2699"><a href="#Parser-2699"><span class="linenos">2699</span></a> +</span><span id="Parser-2700"><a href="#Parser-2700"><span class="linenos">2700</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">):</span> +</span><span id="Parser-2701"><a href="#Parser-2701"><span class="linenos">2701</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2702"><a href="#Parser-2702"><span class="linenos">2702</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-2703"><a href="#Parser-2703"><span class="linenos">2703</span></a> <span class="p">)</span> +</span><span id="Parser-2704"><a href="#Parser-2704"><span class="linenos">2704</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2705"><a href="#Parser-2705"><span class="linenos">2705</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select_or_expression</span><span class="p">()</span> +</span><span id="Parser-2706"><a href="#Parser-2706"><span class="linenos">2706</span></a> +</span><span id="Parser-2707"><a href="#Parser-2707"><span class="linenos">2707</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IGNORE_NULLS</span><span class="p">):</span> +</span><span id="Parser-2708"><a href="#Parser-2708"><span class="linenos">2708</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2709"><a href="#Parser-2709"><span class="linenos">2709</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2710"><a href="#Parser-2710"><span class="linenos">2710</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">RESPECT_NULLS</span><span class="p">)</span> +</span><span id="Parser-2711"><a href="#Parser-2711"><span class="linenos">2711</span></a> +</span><span id="Parser-2712"><a href="#Parser-2712"><span class="linenos">2712</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_limit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(</span><span class="n">this</span><span class="p">))</span> +</span><span id="Parser-2713"><a href="#Parser-2713"><span class="linenos">2713</span></a> +</span><span id="Parser-2714"><a href="#Parser-2714"><span class="linenos">2714</span></a> <span class="k">def</span> <span class="nf">_parse_schema</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2715"><a href="#Parser-2715"><span class="linenos">2715</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-2716"><a href="#Parser-2716"><span class="linenos">2716</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">):</span> +</span><span id="Parser-2717"><a href="#Parser-2717"><span class="linenos">2717</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-2718"><a href="#Parser-2718"><span class="linenos">2718</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2719"><a href="#Parser-2719"><span class="linenos">2719</span></a> +</span><span id="Parser-2720"><a href="#Parser-2720"><span class="linenos">2720</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="Parser-2721"><a href="#Parser-2721"><span class="linenos">2721</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_constraint</span><span class="p">()</span> +</span><span id="Parser-2722"><a href="#Parser-2722"><span class="linenos">2722</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Parser-2723"><a href="#Parser-2723"><span class="linenos">2723</span></a> <span class="p">)</span> +</span><span id="Parser-2724"><a href="#Parser-2724"><span class="linenos">2724</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2725"><a href="#Parser-2725"><span class="linenos">2725</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Schema</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-2726"><a href="#Parser-2726"><span class="linenos">2726</span></a> +</span><span id="Parser-2727"><a href="#Parser-2727"><span class="linenos">2727</span></a> <span class="k">def</span> <span class="nf">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2728"><a href="#Parser-2728"><span class="linenos">2728</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-2729"><a href="#Parser-2729"><span class="linenos">2729</span></a> +</span><span id="Parser-2730"><a href="#Parser-2730"><span class="linenos">2730</span></a> <span class="n">constraints</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-2731"><a href="#Parser-2731"><span class="linenos">2731</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-2732"><a href="#Parser-2732"><span class="linenos">2732</span></a> <span class="n">constraint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_constraint</span><span class="p">()</span> +</span><span id="Parser-2733"><a href="#Parser-2733"><span class="linenos">2733</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">constraint</span><span class="p">:</span> +</span><span id="Parser-2734"><a href="#Parser-2734"><span class="linenos">2734</span></a> <span class="k">break</span> +</span><span id="Parser-2735"><a href="#Parser-2735"><span class="linenos">2735</span></a> <span class="n">constraints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">constraint</span><span class="p">)</span> +</span><span id="Parser-2736"><a href="#Parser-2736"><span class="linenos">2736</span></a> +</span><span id="Parser-2737"><a href="#Parser-2737"><span class="linenos">2737</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">kind</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">constraints</span><span class="p">:</span> +</span><span id="Parser-2738"><a href="#Parser-2738"><span class="linenos">2738</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2739"><a href="#Parser-2739"><span class="linenos">2739</span></a> +</span><span id="Parser-2740"><a href="#Parser-2740"><span class="linenos">2740</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ColumnDef</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> <span class="n">constraints</span><span class="o">=</span><span class="n">constraints</span><span class="p">)</span> +</span><span id="Parser-2741"><a href="#Parser-2741"><span class="linenos">2741</span></a> +</span><span id="Parser-2742"><a href="#Parser-2742"><span class="linenos">2742</span></a> <span class="k">def</span> <span class="nf">_parse_column_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2743"><a href="#Parser-2743"><span class="linenos">2743</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_references</span><span class="p">()</span> +</span><span id="Parser-2744"><a href="#Parser-2744"><span class="linenos">2744</span></a> +</span><span id="Parser-2745"><a href="#Parser-2745"><span class="linenos">2745</span></a> <span class="k">if</span> <span class="n">this</span><span class="p">:</span> +</span><span id="Parser-2746"><a href="#Parser-2746"><span class="linenos">2746</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2747"><a href="#Parser-2747"><span class="linenos">2747</span></a> +</span><span id="Parser-2748"><a href="#Parser-2748"><span class="linenos">2748</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">):</span> +</span><span id="Parser-2749"><a href="#Parser-2749"><span class="linenos">2749</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2750"><a href="#Parser-2750"><span class="linenos">2750</span></a> +</span><span id="Parser-2751"><a href="#Parser-2751"><span class="linenos">2751</span></a> <span class="n">kind</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> +</span><span id="Parser-2752"><a href="#Parser-2752"><span class="linenos">2752</span></a> +</span><span id="Parser-2753"><a href="#Parser-2753"><span class="linenos">2753</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">)):</span> +</span><span id="Parser-2754"><a href="#Parser-2754"><span class="linenos">2754</span></a> <span class="n">start</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2755"><a href="#Parser-2755"><span class="linenos">2755</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2756"><a href="#Parser-2756"><span class="linenos">2756</span></a> +</span><span id="Parser-2757"><a href="#Parser-2757"><span class="linenos">2757</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-2758"><a href="#Parser-2758"><span class="linenos">2758</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="Parser-2759"><a href="#Parser-2759"><span class="linenos">2759</span></a> <span class="n">start</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Parser-2760"><a href="#Parser-2760"><span class="linenos">2760</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Parser-2761"><a href="#Parser-2761"><span class="linenos">2761</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"START"</span><span class="p">):</span> +</span><span id="Parser-2762"><a href="#Parser-2762"><span class="linenos">2762</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-2763"><a href="#Parser-2763"><span class="linenos">2763</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INCREMENT"</span><span class="p">)</span> +</span><span id="Parser-2764"><a href="#Parser-2764"><span class="linenos">2764</span></a> <span class="n">increment</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> +</span><span id="Parser-2765"><a href="#Parser-2765"><span class="linenos">2765</span></a> +</span><span id="Parser-2766"><a href="#Parser-2766"><span class="linenos">2766</span></a> <span class="k">if</span> <span class="n">start</span> <span class="ow">and</span> <span class="n">increment</span><span class="p">:</span> +</span><span id="Parser-2767"><a href="#Parser-2767"><span class="linenos">2767</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">(</span><span class="n">start</span><span class="o">=</span><span class="n">start</span><span class="p">,</span> <span class="n">increment</span><span class="o">=</span><span class="n">increment</span><span class="p">)</span> +</span><span id="Parser-2768"><a href="#Parser-2768"><span class="linenos">2768</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2769"><a href="#Parser-2769"><span class="linenos">2769</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">AutoIncrementColumnConstraint</span><span class="p">()</span> +</span><span id="Parser-2770"><a href="#Parser-2770"><span class="linenos">2770</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">):</span> +</span><span id="Parser-2771"><a href="#Parser-2771"><span class="linenos">2771</span></a> <span class="n">constraint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-2772"><a href="#Parser-2772"><span class="linenos">2772</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CheckColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">constraint</span><span class="p">)</span> +</span><span id="Parser-2773"><a href="#Parser-2773"><span class="linenos">2773</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">):</span> +</span><span id="Parser-2774"><a href="#Parser-2774"><span class="linenos">2774</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CollateColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="Parser-2775"><a href="#Parser-2775"><span class="linenos">2775</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">):</span> +</span><span id="Parser-2776"><a href="#Parser-2776"><span class="linenos">2776</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">EncodeColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="Parser-2777"><a href="#Parser-2777"><span class="linenos">2777</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="Parser-2778"><a href="#Parser-2778"><span class="linenos">2778</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">DefaultColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-2779"><a href="#Parser-2779"><span class="linenos">2779</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="Parser-2780"><a href="#Parser-2780"><span class="linenos">2780</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">()</span> +</span><span id="Parser-2781"><a href="#Parser-2781"><span class="linenos">2781</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="Parser-2782"><a href="#Parser-2782"><span class="linenos">2782</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">NotNullColumnConstraint</span><span class="p">(</span><span class="n">allow_null</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-2783"><a href="#Parser-2783"><span class="linenos">2783</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA_COMMENT</span><span class="p">):</span> +</span><span id="Parser-2784"><a href="#Parser-2784"><span class="linenos">2784</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CommentColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">())</span> +</span><span id="Parser-2785"><a href="#Parser-2785"><span class="linenos">2785</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">):</span> +</span><span id="Parser-2786"><a href="#Parser-2786"><span class="linenos">2786</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2787"><a href="#Parser-2787"><span class="linenos">2787</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ASC</span><span class="p">)</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">):</span> +</span><span id="Parser-2788"><a href="#Parser-2788"><span class="linenos">2788</span></a> <span class="n">desc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span> +</span><span id="Parser-2789"><a href="#Parser-2789"><span class="linenos">2789</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKeyColumnConstraint</span><span class="p">(</span><span class="n">desc</span><span class="o">=</span><span class="n">desc</span><span class="p">)</span> +</span><span id="Parser-2790"><a href="#Parser-2790"><span class="linenos">2790</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">):</span> +</span><span id="Parser-2791"><a href="#Parser-2791"><span class="linenos">2791</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">UniqueColumnConstraint</span><span class="p">()</span> +</span><span id="Parser-2792"><a href="#Parser-2792"><span class="linenos">2792</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">GENERATED</span><span class="p">):</span> +</span><span id="Parser-2793"><a href="#Parser-2793"><span class="linenos">2793</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BY_DEFAULT</span><span class="p">):</span> +</span><span id="Parser-2794"><a href="#Parser-2794"><span class="linenos">2794</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-2795"><a href="#Parser-2795"><span class="linenos">2795</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2796"><a href="#Parser-2796"><span class="linenos">2796</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">)</span> +</span><span id="Parser-2797"><a href="#Parser-2797"><span class="linenos">2797</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-2798"><a href="#Parser-2798"><span class="linenos">2798</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">)</span> +</span><span id="Parser-2799"><a href="#Parser-2799"><span class="linenos">2799</span></a> +</span><span id="Parser-2800"><a href="#Parser-2800"><span class="linenos">2800</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2801"><a href="#Parser-2801"><span class="linenos">2801</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"START"</span><span class="p">,</span> <span class="s2">"WITH"</span><span class="p">):</span> +</span><span id="Parser-2802"><a href="#Parser-2802"><span class="linenos">2802</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"start"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-2803"><a href="#Parser-2803"><span class="linenos">2803</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INCREMENT"</span><span class="p">,</span> <span class="s2">"BY"</span><span class="p">):</span> +</span><span id="Parser-2804"><a href="#Parser-2804"><span class="linenos">2804</span></a> <span class="n">kind</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"increment"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-2805"><a href="#Parser-2805"><span class="linenos">2805</span></a> +</span><span id="Parser-2806"><a href="#Parser-2806"><span class="linenos">2806</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2807"><a href="#Parser-2807"><span class="linenos">2807</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2808"><a href="#Parser-2808"><span class="linenos">2808</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2809"><a href="#Parser-2809"><span class="linenos">2809</span></a> +</span><span id="Parser-2810"><a href="#Parser-2810"><span class="linenos">2810</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">ColumnConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">)</span> +</span><span id="Parser-2811"><a href="#Parser-2811"><span class="linenos">2811</span></a> +</span><span id="Parser-2812"><a href="#Parser-2812"><span class="linenos">2812</span></a> <span class="k">def</span> <span class="nf">_parse_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2813"><a href="#Parser-2813"><span class="linenos">2813</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">):</span> +</span><span id="Parser-2814"><a href="#Parser-2814"><span class="linenos">2814</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnamed_constraint</span><span class="p">()</span> +</span><span id="Parser-2815"><a href="#Parser-2815"><span class="linenos">2815</span></a> +</span><span id="Parser-2816"><a href="#Parser-2816"><span class="linenos">2816</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2817"><a href="#Parser-2817"><span class="linenos">2817</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-2818"><a href="#Parser-2818"><span class="linenos">2818</span></a> +</span><span id="Parser-2819"><a href="#Parser-2819"><span class="linenos">2819</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-2820"><a href="#Parser-2820"><span class="linenos">2820</span></a> <span class="n">constraint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_unnamed_constraint</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> +</span><span id="Parser-2821"><a href="#Parser-2821"><span class="linenos">2821</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">constraint</span><span class="p">:</span> +</span><span id="Parser-2822"><a href="#Parser-2822"><span class="linenos">2822</span></a> <span class="k">break</span> +</span><span id="Parser-2823"><a href="#Parser-2823"><span class="linenos">2823</span></a> <span class="n">expressions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">constraint</span><span class="p">)</span> +</span><span id="Parser-2824"><a href="#Parser-2824"><span class="linenos">2824</span></a> +</span><span id="Parser-2825"><a href="#Parser-2825"><span class="linenos">2825</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Constraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2826"><a href="#Parser-2826"><span class="linenos">2826</span></a> +</span><span id="Parser-2827"><a href="#Parser-2827"><span class="linenos">2827</span></a> <span class="k">def</span> <span class="nf">_parse_unnamed_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2828"><a href="#Parser-2828"><span class="linenos">2828</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CONSTRAINT_PARSERS</span><span class="p">):</span> +</span><span id="Parser-2829"><a href="#Parser-2829"><span class="linenos">2829</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2830"><a href="#Parser-2830"><span class="linenos">2830</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">CONSTRAINT_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-2831"><a href="#Parser-2831"><span class="linenos">2831</span></a> +</span><span id="Parser-2832"><a href="#Parser-2832"><span class="linenos">2832</span></a> <span class="k">def</span> <span class="nf">_parse_unique</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2833"><a href="#Parser-2833"><span class="linenos">2833</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Unique</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">())</span> +</span><span id="Parser-2834"><a href="#Parser-2834"><span class="linenos">2834</span></a> +</span><span id="Parser-2835"><a href="#Parser-2835"><span class="linenos">2835</span></a> <span class="k">def</span> <span class="nf">_parse_key_constraint_options</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Parser-2836"><a href="#Parser-2836"><span class="linenos">2836</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-2837"><a href="#Parser-2837"><span class="linenos">2837</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-2838"><a href="#Parser-2838"><span class="linenos">2838</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="Parser-2839"><a href="#Parser-2839"><span class="linenos">2839</span></a> <span class="k">break</span> +</span><span id="Parser-2840"><a href="#Parser-2840"><span class="linenos">2840</span></a> +</span><span id="Parser-2841"><a href="#Parser-2841"><span class="linenos">2841</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="Parser-2842"><a href="#Parser-2842"><span class="linenos">2842</span></a> <span class="n">action</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2843"><a href="#Parser-2843"><span class="linenos">2843</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-2844"><a href="#Parser-2844"><span class="linenos">2844</span></a> +</span><span id="Parser-2845"><a href="#Parser-2845"><span class="linenos">2845</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NO_ACTION</span><span class="p">):</span> +</span><span id="Parser-2846"><a href="#Parser-2846"><span class="linenos">2846</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"NO ACTION"</span> +</span><span id="Parser-2847"><a href="#Parser-2847"><span class="linenos">2847</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">):</span> +</span><span id="Parser-2848"><a href="#Parser-2848"><span class="linenos">2848</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"CASCADE"</span> +</span><span id="Parser-2849"><a href="#Parser-2849"><span class="linenos">2849</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="Parser-2850"><a href="#Parser-2850"><span class="linenos">2850</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"SET NULL"</span> +</span><span id="Parser-2851"><a href="#Parser-2851"><span class="linenos">2851</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="Parser-2852"><a href="#Parser-2852"><span class="linenos">2852</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"SET DEFAULT"</span> +</span><span id="Parser-2853"><a href="#Parser-2853"><span class="linenos">2853</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2854"><a href="#Parser-2854"><span class="linenos">2854</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Invalid key constraint"</span><span class="p">)</span> +</span><span id="Parser-2855"><a href="#Parser-2855"><span class="linenos">2855</span></a> +</span><span id="Parser-2856"><a href="#Parser-2856"><span class="linenos">2856</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"ON </span><span class="si">{</span><span class="n">on</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">action</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Parser-2857"><a href="#Parser-2857"><span class="linenos">2857</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NOT"</span><span class="p">,</span> <span class="s2">"ENFORCED"</span><span class="p">):</span> +</span><span id="Parser-2858"><a href="#Parser-2858"><span class="linenos">2858</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"NOT ENFORCED"</span><span class="p">)</span> +</span><span id="Parser-2859"><a href="#Parser-2859"><span class="linenos">2859</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DEFERRABLE"</span><span class="p">):</span> +</span><span id="Parser-2860"><a href="#Parser-2860"><span class="linenos">2860</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"DEFERRABLE"</span><span class="p">)</span> +</span><span id="Parser-2861"><a href="#Parser-2861"><span class="linenos">2861</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"INITIALLY"</span><span class="p">,</span> <span class="s2">"DEFERRED"</span><span class="p">):</span> +</span><span id="Parser-2862"><a href="#Parser-2862"><span class="linenos">2862</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"INITIALLY DEFERRED"</span><span class="p">)</span> +</span><span id="Parser-2863"><a href="#Parser-2863"><span class="linenos">2863</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NORELY"</span><span class="p">):</span> +</span><span id="Parser-2864"><a href="#Parser-2864"><span class="linenos">2864</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"NORELY"</span><span class="p">)</span> +</span><span id="Parser-2865"><a href="#Parser-2865"><span class="linenos">2865</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"MATCH"</span><span class="p">,</span> <span class="s2">"FULL"</span><span class="p">):</span> +</span><span id="Parser-2866"><a href="#Parser-2866"><span class="linenos">2866</span></a> <span class="n">options</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"MATCH FULL"</span><span class="p">)</span> +</span><span id="Parser-2867"><a href="#Parser-2867"><span class="linenos">2867</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2868"><a href="#Parser-2868"><span class="linenos">2868</span></a> <span class="k">break</span> +</span><span id="Parser-2869"><a href="#Parser-2869"><span class="linenos">2869</span></a> +</span><span id="Parser-2870"><a href="#Parser-2870"><span class="linenos">2870</span></a> <span class="k">return</span> <span class="n">options</span> +</span><span id="Parser-2871"><a href="#Parser-2871"><span class="linenos">2871</span></a> +</span><span id="Parser-2872"><a href="#Parser-2872"><span class="linenos">2872</span></a> <span class="k">def</span> <span class="nf">_parse_references</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2873"><a href="#Parser-2873"><span class="linenos">2873</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REFERENCES</span><span class="p">):</span> +</span><span id="Parser-2874"><a href="#Parser-2874"><span class="linenos">2874</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-2875"><a href="#Parser-2875"><span class="linenos">2875</span></a> +</span><span id="Parser-2876"><a href="#Parser-2876"><span class="linenos">2876</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2877"><a href="#Parser-2877"><span class="linenos">2877</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-2878"><a href="#Parser-2878"><span class="linenos">2878</span></a> +</span><span id="Parser-2879"><a href="#Parser-2879"><span class="linenos">2879</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-2880"><a href="#Parser-2880"><span class="linenos">2880</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="Parser-2881"><a href="#Parser-2881"><span class="linenos">2881</span></a> +</span><span id="Parser-2882"><a href="#Parser-2882"><span class="linenos">2882</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_key_constraint_options</span><span class="p">()</span> +</span><span id="Parser-2883"><a href="#Parser-2883"><span class="linenos">2883</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Reference</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">)</span> +</span><span id="Parser-2884"><a href="#Parser-2884"><span class="linenos">2884</span></a> +</span><span id="Parser-2885"><a href="#Parser-2885"><span class="linenos">2885</span></a> <span class="k">def</span> <span class="nf">_parse_foreign_key</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2886"><a href="#Parser-2886"><span class="linenos">2886</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="Parser-2887"><a href="#Parser-2887"><span class="linenos">2887</span></a> <span class="n">reference</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_references</span><span class="p">()</span> +</span><span id="Parser-2888"><a href="#Parser-2888"><span class="linenos">2888</span></a> <span class="n">options</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Parser-2889"><a href="#Parser-2889"><span class="linenos">2889</span></a> +</span><span id="Parser-2890"><a href="#Parser-2890"><span class="linenos">2890</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">):</span> +</span><span id="Parser-2891"><a href="#Parser-2891"><span class="linenos">2891</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">)):</span> +</span><span id="Parser-2892"><a href="#Parser-2892"><span class="linenos">2892</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected DELETE or UPDATE"</span><span class="p">)</span> +</span><span id="Parser-2893"><a href="#Parser-2893"><span class="linenos">2893</span></a> +</span><span id="Parser-2894"><a href="#Parser-2894"><span class="linenos">2894</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="Parser-2895"><a href="#Parser-2895"><span class="linenos">2895</span></a> +</span><span id="Parser-2896"><a href="#Parser-2896"><span class="linenos">2896</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NO_ACTION</span><span class="p">):</span> +</span><span id="Parser-2897"><a href="#Parser-2897"><span class="linenos">2897</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"NO ACTION"</span> +</span><span id="Parser-2898"><a href="#Parser-2898"><span class="linenos">2898</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">):</span> +</span><span id="Parser-2899"><a href="#Parser-2899"><span class="linenos">2899</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">))</span> +</span><span id="Parser-2900"><a href="#Parser-2900"><span class="linenos">2900</span></a> <span class="n">action</span> <span class="o">=</span> <span class="s2">"SET "</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Parser-2901"><a href="#Parser-2901"><span class="linenos">2901</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2902"><a href="#Parser-2902"><span class="linenos">2902</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-2903"><a href="#Parser-2903"><span class="linenos">2903</span></a> <span class="n">action</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Parser-2904"><a href="#Parser-2904"><span class="linenos">2904</span></a> +</span><span id="Parser-2905"><a href="#Parser-2905"><span class="linenos">2905</span></a> <span class="n">options</span><span class="p">[</span><span class="n">kind</span><span class="p">]</span> <span class="o">=</span> <span class="n">action</span> +</span><span id="Parser-2906"><a href="#Parser-2906"><span class="linenos">2906</span></a> +</span><span id="Parser-2907"><a href="#Parser-2907"><span class="linenos">2907</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-2908"><a href="#Parser-2908"><span class="linenos">2908</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ForeignKey</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">reference</span><span class="o">=</span><span class="n">reference</span><span class="p">,</span> <span class="o">**</span><span class="n">options</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-2909"><a href="#Parser-2909"><span class="linenos">2909</span></a> <span class="p">)</span> +</span><span id="Parser-2910"><a href="#Parser-2910"><span class="linenos">2910</span></a> +</span><span id="Parser-2911"><a href="#Parser-2911"><span class="linenos">2911</span></a> <span class="k">def</span> <span class="nf">_parse_primary_key</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2912"><a href="#Parser-2912"><span class="linenos">2912</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_id_vars</span><span class="p">()</span> +</span><span id="Parser-2913"><a href="#Parser-2913"><span class="linenos">2913</span></a> <span class="n">options</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_key_constraint_options</span><span class="p">()</span> +</span><span id="Parser-2914"><a href="#Parser-2914"><span class="linenos">2914</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">PrimaryKey</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">options</span><span class="o">=</span><span class="n">options</span><span class="p">)</span> +</span><span id="Parser-2915"><a href="#Parser-2915"><span class="linenos">2915</span></a> +</span><span id="Parser-2916"><a href="#Parser-2916"><span class="linenos">2916</span></a> <span class="k">def</span> <span class="nf">_parse_bracket</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2917"><a href="#Parser-2917"><span class="linenos">2917</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">)):</span> +</span><span id="Parser-2918"><a href="#Parser-2918"><span class="linenos">2918</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2919"><a href="#Parser-2919"><span class="linenos">2919</span></a> +</span><span id="Parser-2920"><a href="#Parser-2920"><span class="linenos">2920</span></a> <span class="n">bracket_kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-2921"><a href="#Parser-2921"><span class="linenos">2921</span></a> <span class="n">expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> +</span><span id="Parser-2922"><a href="#Parser-2922"><span class="linenos">2922</span></a> +</span><span id="Parser-2923"><a href="#Parser-2923"><span class="linenos">2923</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">):</span> +</span><span id="Parser-2924"><a href="#Parser-2924"><span class="linenos">2924</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())]</span> +</span><span id="Parser-2925"><a href="#Parser-2925"><span class="linenos">2925</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2926"><a href="#Parser-2926"><span class="linenos">2926</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_slice</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()))</span> +</span><span id="Parser-2927"><a href="#Parser-2927"><span class="linenos">2927</span></a> +</span><span id="Parser-2928"><a href="#Parser-2928"><span class="linenos">2928</span></a> <span class="c1"># https://duckdb.org/docs/sql/data_types/struct.html#creating-structs</span> +</span><span id="Parser-2929"><a href="#Parser-2929"><span class="linenos">2929</span></a> <span class="k">if</span> <span class="n">bracket_kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">:</span> +</span><span id="Parser-2930"><a href="#Parser-2930"><span class="linenos">2930</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Struct</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2931"><a href="#Parser-2931"><span class="linenos">2931</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="n">this</span> <span class="ow">or</span> <span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"ARRAY"</span><span class="p">:</span> +</span><span id="Parser-2932"><a href="#Parser-2932"><span class="linenos">2932</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Array</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2933"><a href="#Parser-2933"><span class="linenos">2933</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2934"><a href="#Parser-2934"><span class="linenos">2934</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="n">apply_index_offset</span><span class="p">(</span><span class="n">expressions</span><span class="p">,</span> <span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span><span class="p">)</span> +</span><span id="Parser-2935"><a href="#Parser-2935"><span class="linenos">2935</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Bracket</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-2936"><a href="#Parser-2936"><span class="linenos">2936</span></a> +</span><span id="Parser-2937"><a href="#Parser-2937"><span class="linenos">2937</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">)</span> <span class="ow">and</span> <span class="n">bracket_kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">:</span> +</span><span id="Parser-2938"><a href="#Parser-2938"><span class="linenos">2938</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected ]"</span><span class="p">)</span> +</span><span id="Parser-2939"><a href="#Parser-2939"><span class="linenos">2939</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACE</span><span class="p">)</span> <span class="ow">and</span> <span class="n">bracket_kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">:</span> +</span><span id="Parser-2940"><a href="#Parser-2940"><span class="linenos">2940</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected }"</span><span class="p">)</span> +</span><span id="Parser-2941"><a href="#Parser-2941"><span class="linenos">2941</span></a> +</span><span id="Parser-2942"><a href="#Parser-2942"><span class="linenos">2942</span></a> <span class="n">this</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-2943"><a href="#Parser-2943"><span class="linenos">2943</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bracket</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2944"><a href="#Parser-2944"><span class="linenos">2944</span></a> +</span><span id="Parser-2945"><a href="#Parser-2945"><span class="linenos">2945</span></a> <span class="k">def</span> <span class="nf">_parse_slice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2946"><a href="#Parser-2946"><span class="linenos">2946</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">):</span> +</span><span id="Parser-2947"><a href="#Parser-2947"><span class="linenos">2947</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Slice</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">())</span> +</span><span id="Parser-2948"><a href="#Parser-2948"><span class="linenos">2948</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-2949"><a href="#Parser-2949"><span class="linenos">2949</span></a> +</span><span id="Parser-2950"><a href="#Parser-2950"><span class="linenos">2950</span></a> <span class="k">def</span> <span class="nf">_parse_case</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2951"><a href="#Parser-2951"><span class="linenos">2951</span></a> <span class="n">ifs</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-2952"><a href="#Parser-2952"><span class="linenos">2952</span></a> <span class="n">default</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-2953"><a href="#Parser-2953"><span class="linenos">2953</span></a> +</span><span id="Parser-2954"><a href="#Parser-2954"><span class="linenos">2954</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2955"><a href="#Parser-2955"><span class="linenos">2955</span></a> +</span><span id="Parser-2956"><a href="#Parser-2956"><span class="linenos">2956</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WHEN</span><span class="p">):</span> +</span><span id="Parser-2957"><a href="#Parser-2957"><span class="linenos">2957</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2958"><a href="#Parser-2958"><span class="linenos">2958</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">)</span> +</span><span id="Parser-2959"><a href="#Parser-2959"><span class="linenos">2959</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2960"><a href="#Parser-2960"><span class="linenos">2960</span></a> <span class="n">ifs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">true</span><span class="o">=</span><span class="n">then</span><span class="p">))</span> +</span><span id="Parser-2961"><a href="#Parser-2961"><span class="linenos">2961</span></a> +</span><span id="Parser-2962"><a href="#Parser-2962"><span class="linenos">2962</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ELSE</span><span class="p">):</span> +</span><span id="Parser-2963"><a href="#Parser-2963"><span class="linenos">2963</span></a> <span class="n">default</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2964"><a href="#Parser-2964"><span class="linenos">2964</span></a> +</span><span id="Parser-2965"><a href="#Parser-2965"><span class="linenos">2965</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">):</span> +</span><span id="Parser-2966"><a href="#Parser-2966"><span class="linenos">2966</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected END after CASE"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-2967"><a href="#Parser-2967"><span class="linenos">2967</span></a> +</span><span id="Parser-2968"><a href="#Parser-2968"><span class="linenos">2968</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span> +</span><span id="Parser-2969"><a href="#Parser-2969"><span class="linenos">2969</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Case</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">ifs</span><span class="o">=</span><span class="n">ifs</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">)</span> +</span><span id="Parser-2970"><a href="#Parser-2970"><span class="linenos">2970</span></a> <span class="p">)</span> +</span><span id="Parser-2971"><a href="#Parser-2971"><span class="linenos">2971</span></a> +</span><span id="Parser-2972"><a href="#Parser-2972"><span class="linenos">2972</span></a> <span class="k">def</span> <span class="nf">_parse_if</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-2973"><a href="#Parser-2973"><span class="linenos">2973</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-2974"><a href="#Parser-2974"><span class="linenos">2974</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-2975"><a href="#Parser-2975"><span class="linenos">2975</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-2976"><a href="#Parser-2976"><span class="linenos">2976</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="Parser-2977"><a href="#Parser-2977"><span class="linenos">2977</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-2978"><a href="#Parser-2978"><span class="linenos">2978</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-2979"><a href="#Parser-2979"><span class="linenos">2979</span></a> <span class="n">condition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2980"><a href="#Parser-2980"><span class="linenos">2980</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">)</span> +</span><span id="Parser-2981"><a href="#Parser-2981"><span class="linenos">2981</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-2982"><a href="#Parser-2982"><span class="linenos">2982</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ELSE</span><span class="p">)</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="Parser-2983"><a href="#Parser-2983"><span class="linenos">2983</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">)</span> +</span><span id="Parser-2984"><a href="#Parser-2984"><span class="linenos">2984</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">condition</span><span class="p">,</span> <span class="n">true</span><span class="o">=</span><span class="n">true</span><span class="p">,</span> <span class="n">false</span><span class="o">=</span><span class="n">false</span><span class="p">)</span> +</span><span id="Parser-2985"><a href="#Parser-2985"><span class="linenos">2985</span></a> +</span><span id="Parser-2986"><a href="#Parser-2986"><span class="linenos">2986</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-2987"><a href="#Parser-2987"><span class="linenos">2987</span></a> +</span><span id="Parser-2988"><a href="#Parser-2988"><span class="linenos">2988</span></a> <span class="k">def</span> <span class="nf">_parse_extract</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-2989"><a href="#Parser-2989"><span class="linenos">2989</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_type</span><span class="p">()</span> +</span><span id="Parser-2990"><a href="#Parser-2990"><span class="linenos">2990</span></a> +</span><span id="Parser-2991"><a href="#Parser-2991"><span class="linenos">2991</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">):</span> +</span><span id="Parser-2992"><a href="#Parser-2992"><span class="linenos">2992</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-2993"><a href="#Parser-2993"><span class="linenos">2993</span></a> +</span><span id="Parser-2994"><a href="#Parser-2994"><span class="linenos">2994</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="Parser-2995"><a href="#Parser-2995"><span class="linenos">2995</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected FROM or comma after EXTRACT"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-2996"><a href="#Parser-2996"><span class="linenos">2996</span></a> +</span><span id="Parser-2997"><a href="#Parser-2997"><span class="linenos">2997</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Extract</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-2998"><a href="#Parser-2998"><span class="linenos">2998</span></a> +</span><span id="Parser-2999"><a href="#Parser-2999"><span class="linenos">2999</span></a> <span class="k">def</span> <span class="nf">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3000"><a href="#Parser-3000"><span class="linenos">3000</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-3001"><a href="#Parser-3001"><span class="linenos">3001</span></a> +</span><span id="Parser-3002"><a href="#Parser-3002"><span class="linenos">3002</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">):</span> +</span><span id="Parser-3003"><a href="#Parser-3003"><span class="linenos">3003</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected AS after CAST"</span><span class="p">)</span> +</span><span id="Parser-3004"><a href="#Parser-3004"><span class="linenos">3004</span></a> +</span><span id="Parser-3005"><a href="#Parser-3005"><span class="linenos">3005</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-3006"><a href="#Parser-3006"><span class="linenos">3006</span></a> +</span><span id="Parser-3007"><a href="#Parser-3007"><span class="linenos">3007</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">to</span><span class="p">:</span> +</span><span id="Parser-3008"><a href="#Parser-3008"><span class="linenos">3008</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expected TYPE after CAST"</span><span class="p">)</span> +</span><span id="Parser-3009"><a href="#Parser-3009"><span class="linenos">3009</span></a> <span class="k">elif</span> <span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">CHAR</span><span class="p">:</span> +</span><span id="Parser-3010"><a href="#Parser-3010"><span class="linenos">3010</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CHARACTER_SET</span><span class="p">):</span> +</span><span id="Parser-3011"><a href="#Parser-3011"><span class="linenos">3011</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var_or_string</span><span class="p">())</span> +</span><span id="Parser-3012"><a href="#Parser-3012"><span class="linenos">3012</span></a> +</span><span id="Parser-3013"><a href="#Parser-3013"><span class="linenos">3013</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="Parser-3014"><a href="#Parser-3014"><span class="linenos">3014</span></a> +</span><span id="Parser-3015"><a href="#Parser-3015"><span class="linenos">3015</span></a> <span class="k">def</span> <span class="nf">_parse_string_agg</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3016"><a href="#Parser-3016"><span class="linenos">3016</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-3017"><a href="#Parser-3017"><span class="linenos">3017</span></a> +</span><span id="Parser-3018"><a href="#Parser-3018"><span class="linenos">3018</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">):</span> +</span><span id="Parser-3019"><a href="#Parser-3019"><span class="linenos">3019</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-3020"><a href="#Parser-3020"><span class="linenos">3020</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="p">[</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)])</span> +</span><span id="Parser-3021"><a href="#Parser-3021"><span class="linenos">3021</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3022"><a href="#Parser-3022"><span class="linenos">3022</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-3023"><a href="#Parser-3023"><span class="linenos">3023</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Parser-3024"><a href="#Parser-3024"><span class="linenos">3024</span></a> +</span><span id="Parser-3025"><a href="#Parser-3025"><span class="linenos">3025</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-3026"><a href="#Parser-3026"><span class="linenos">3026</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">):</span> +</span><span id="Parser-3027"><a href="#Parser-3027"><span class="linenos">3027</span></a> <span class="c1"># postgres: STRING_AGG([DISTINCT] expression, separator [ORDER BY expression1 {ASC | DESC} [, ...]])</span> +</span><span id="Parser-3028"><a href="#Parser-3028"><span class="linenos">3028</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Parser-3029"><a href="#Parser-3029"><span class="linenos">3029</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">separator</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="Parser-3030"><a href="#Parser-3030"><span class="linenos">3030</span></a> +</span><span id="Parser-3031"><a href="#Parser-3031"><span class="linenos">3031</span></a> <span class="c1"># Checks if we can parse an order clause: WITHIN GROUP (ORDER BY <order_by_expression_list> [ASC | DESC]).</span> +</span><span id="Parser-3032"><a href="#Parser-3032"><span class="linenos">3032</span></a> <span class="c1"># This is done "manually", instead of letting _parse_window parse it into an exp.WithinGroup node, so that</span> +</span><span id="Parser-3033"><a href="#Parser-3033"><span class="linenos">3033</span></a> <span class="c1"># the STRING_AGG call is parsed like in MySQL / SQLite and can thus be transpiled more easily to them.</span> +</span><span id="Parser-3034"><a href="#Parser-3034"><span class="linenos">3034</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITHIN_GROUP</span><span class="p">):</span> +</span><span id="Parser-3035"><a href="#Parser-3035"><span class="linenos">3035</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-3036"><a href="#Parser-3036"><span class="linenos">3036</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-3037"><a href="#Parser-3037"><span class="linenos">3037</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="Parser-3038"><a href="#Parser-3038"><span class="linenos">3038</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3039"><a href="#Parser-3039"><span class="linenos">3039</span></a> +</span><span id="Parser-3040"><a href="#Parser-3040"><span class="linenos">3040</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> <span class="c1"># The corresponding match_r_paren will be called in parse_function (caller)</span> +</span><span id="Parser-3041"><a href="#Parser-3041"><span class="linenos">3041</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Parser-3042"><a href="#Parser-3042"><span class="linenos">3042</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> <span class="n">separator</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="Parser-3043"><a href="#Parser-3043"><span class="linenos">3043</span></a> +</span><span id="Parser-3044"><a href="#Parser-3044"><span class="linenos">3044</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3045"><a href="#Parser-3045"><span class="linenos">3045</span></a> <span class="n">to</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> +</span><span id="Parser-3046"><a href="#Parser-3046"><span class="linenos">3046</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">()</span> +</span><span id="Parser-3047"><a href="#Parser-3047"><span class="linenos">3047</span></a> +</span><span id="Parser-3048"><a href="#Parser-3048"><span class="linenos">3048</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span> +</span><span id="Parser-3049"><a href="#Parser-3049"><span class="linenos">3049</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">())</span> +</span><span id="Parser-3050"><a href="#Parser-3050"><span class="linenos">3050</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="Parser-3051"><a href="#Parser-3051"><span class="linenos">3051</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Parser-3052"><a href="#Parser-3052"><span class="linenos">3052</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3053"><a href="#Parser-3053"><span class="linenos">3053</span></a> <span class="n">to</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3054"><a href="#Parser-3054"><span class="linenos">3054</span></a> +</span><span id="Parser-3055"><a href="#Parser-3055"><span class="linenos">3055</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span> +</span><span id="Parser-3056"><a href="#Parser-3056"><span class="linenos">3056</span></a> +</span><span id="Parser-3057"><a href="#Parser-3057"><span class="linenos">3057</span></a> <span class="k">def</span> <span class="nf">_parse_position</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">haystack_first</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3058"><a href="#Parser-3058"><span class="linenos">3058</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="Parser-3059"><a href="#Parser-3059"><span class="linenos">3059</span></a> +</span><span id="Parser-3060"><a href="#Parser-3060"><span class="linenos">3060</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">):</span> +</span><span id="Parser-3061"><a href="#Parser-3061"><span class="linenos">3061</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3062"><a href="#Parser-3062"><span class="linenos">3062</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> <span class="n">substr</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Parser-3063"><a href="#Parser-3063"><span class="linenos">3063</span></a> <span class="p">)</span> +</span><span id="Parser-3064"><a href="#Parser-3064"><span class="linenos">3064</span></a> +</span><span id="Parser-3065"><a href="#Parser-3065"><span class="linenos">3065</span></a> <span class="k">if</span> <span class="n">haystack_first</span><span class="p">:</span> +</span><span id="Parser-3066"><a href="#Parser-3066"><span class="linenos">3066</span></a> <span class="n">haystack</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Parser-3067"><a href="#Parser-3067"><span class="linenos">3067</span></a> <span class="n">needle</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Parser-3068"><a href="#Parser-3068"><span class="linenos">3068</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3069"><a href="#Parser-3069"><span class="linenos">3069</span></a> <span class="n">needle</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> +</span><span id="Parser-3070"><a href="#Parser-3070"><span class="linenos">3070</span></a> <span class="n">haystack</span> <span class="o">=</span> <span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Parser-3071"><a href="#Parser-3071"><span class="linenos">3071</span></a> +</span><span id="Parser-3072"><a href="#Parser-3072"><span class="linenos">3072</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">StrPosition</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">haystack</span><span class="p">,</span> <span class="n">substr</span><span class="o">=</span><span class="n">needle</span><span class="p">,</span> <span class="n">position</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span> +</span><span id="Parser-3073"><a href="#Parser-3073"><span class="linenos">3073</span></a> +</span><span id="Parser-3074"><a href="#Parser-3074"><span class="linenos">3074</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="Parser-3075"><a href="#Parser-3075"><span class="linenos">3075</span></a> +</span><span id="Parser-3076"><a href="#Parser-3076"><span class="linenos">3076</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3077"><a href="#Parser-3077"><span class="linenos">3077</span></a> +</span><span id="Parser-3078"><a href="#Parser-3078"><span class="linenos">3078</span></a> <span class="k">def</span> <span class="nf">_parse_join_hint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">func_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3079"><a href="#Parser-3079"><span class="linenos">3079</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">)</span> +</span><span id="Parser-3080"><a href="#Parser-3080"><span class="linenos">3080</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">JoinHint</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">func_name</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-3081"><a href="#Parser-3081"><span class="linenos">3081</span></a> +</span><span id="Parser-3082"><a href="#Parser-3082"><span class="linenos">3082</span></a> <span class="k">def</span> <span class="nf">_parse_substring</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3083"><a href="#Parser-3083"><span class="linenos">3083</span></a> <span class="c1"># Postgres supports the form: substring(string [from int] [for int])</span> +</span><span id="Parser-3084"><a href="#Parser-3084"><span class="linenos">3084</span></a> <span class="c1"># https://www.postgresql.org/docs/9.1/functions-string.html @ Table 9-6</span> +</span><span id="Parser-3085"><a href="#Parser-3085"><span class="linenos">3085</span></a> +</span><span id="Parser-3086"><a href="#Parser-3086"><span class="linenos">3086</span></a> <span class="n">args</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">)</span> +</span><span id="Parser-3087"><a href="#Parser-3087"><span class="linenos">3087</span></a> +</span><span id="Parser-3088"><a href="#Parser-3088"><span class="linenos">3088</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">):</span> +</span><span id="Parser-3089"><a href="#Parser-3089"><span class="linenos">3089</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-3090"><a href="#Parser-3090"><span class="linenos">3090</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FOR</span><span class="p">):</span> +</span><span id="Parser-3091"><a href="#Parser-3091"><span class="linenos">3091</span></a> <span class="n">args</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">())</span> +</span><span id="Parser-3092"><a href="#Parser-3092"><span class="linenos">3092</span></a> +</span><span id="Parser-3093"><a href="#Parser-3093"><span class="linenos">3093</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Substring</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Parser-3094"><a href="#Parser-3094"><span class="linenos">3094</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> +</span><span id="Parser-3095"><a href="#Parser-3095"><span class="linenos">3095</span></a> +</span><span id="Parser-3096"><a href="#Parser-3096"><span class="linenos">3096</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3097"><a href="#Parser-3097"><span class="linenos">3097</span></a> +</span><span id="Parser-3098"><a href="#Parser-3098"><span class="linenos">3098</span></a> <span class="k">def</span> <span class="nf">_parse_trim</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3099"><a href="#Parser-3099"><span class="linenos">3099</span></a> <span class="c1"># https://www.w3resource.com/sql/character-functions/trim.php</span> +</span><span id="Parser-3100"><a href="#Parser-3100"><span class="linenos">3100</span></a> <span class="c1"># https://docs.oracle.com/javadb/10.8.3.0/ref/rreftrimfunc.html</span> +</span><span id="Parser-3101"><a href="#Parser-3101"><span class="linenos">3101</span></a> +</span><span id="Parser-3102"><a href="#Parser-3102"><span class="linenos">3102</span></a> <span class="n">position</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3103"><a href="#Parser-3103"><span class="linenos">3103</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3104"><a href="#Parser-3104"><span class="linenos">3104</span></a> +</span><span id="Parser-3105"><a href="#Parser-3105"><span class="linenos">3105</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRIM_TYPES</span><span class="p">):</span> +</span><span id="Parser-3106"><a href="#Parser-3106"><span class="linenos">3106</span></a> <span class="n">position</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Parser-3107"><a href="#Parser-3107"><span class="linenos">3107</span></a> +</span><span id="Parser-3108"><a href="#Parser-3108"><span class="linenos">3108</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-3109"><a href="#Parser-3109"><span class="linenos">3109</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">)):</span> +</span><span id="Parser-3110"><a href="#Parser-3110"><span class="linenos">3110</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-3111"><a href="#Parser-3111"><span class="linenos">3111</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3112"><a href="#Parser-3112"><span class="linenos">3112</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Parser-3113"><a href="#Parser-3113"><span class="linenos">3113</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3114"><a href="#Parser-3114"><span class="linenos">3114</span></a> +</span><span id="Parser-3115"><a href="#Parser-3115"><span class="linenos">3115</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">):</span> +</span><span id="Parser-3116"><a href="#Parser-3116"><span class="linenos">3116</span></a> <span class="n">collation</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">()</span> +</span><span id="Parser-3117"><a href="#Parser-3117"><span class="linenos">3117</span></a> +</span><span id="Parser-3118"><a href="#Parser-3118"><span class="linenos">3118</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3119"><a href="#Parser-3119"><span class="linenos">3119</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Trim</span><span class="p">,</span> +</span><span id="Parser-3120"><a href="#Parser-3120"><span class="linenos">3120</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-3121"><a href="#Parser-3121"><span class="linenos">3121</span></a> <span class="n">position</span><span class="o">=</span><span class="n">position</span><span class="p">,</span> +</span><span id="Parser-3122"><a href="#Parser-3122"><span class="linenos">3122</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> +</span><span id="Parser-3123"><a href="#Parser-3123"><span class="linenos">3123</span></a> <span class="n">collation</span><span class="o">=</span><span class="n">collation</span><span class="p">,</span> +</span><span id="Parser-3124"><a href="#Parser-3124"><span class="linenos">3124</span></a> <span class="p">)</span> +</span><span id="Parser-3125"><a href="#Parser-3125"><span class="linenos">3125</span></a> +</span><span id="Parser-3126"><a href="#Parser-3126"><span class="linenos">3126</span></a> <span class="k">def</span> <span class="nf">_parse_window_clause</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="Parser-3127"><a href="#Parser-3127"><span class="linenos">3127</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_named_window</span><span class="p">)</span> +</span><span id="Parser-3128"><a href="#Parser-3128"><span class="linenos">3128</span></a> +</span><span id="Parser-3129"><a href="#Parser-3129"><span class="linenos">3129</span></a> <span class="k">def</span> <span class="nf">_parse_named_window</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3130"><a href="#Parser-3130"><span class="linenos">3130</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(),</span> <span class="n">alias</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-3131"><a href="#Parser-3131"><span class="linenos">3131</span></a> +</span><span id="Parser-3132"><a href="#Parser-3132"><span class="linenos">3132</span></a> <span class="k">def</span> <span class="nf">_parse_window</span><span class="p">(</span> +</span><span id="Parser-3133"><a href="#Parser-3133"><span class="linenos">3133</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">alias</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-3134"><a href="#Parser-3134"><span class="linenos">3134</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3135"><a href="#Parser-3135"><span class="linenos">3135</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">):</span> +</span><span id="Parser-3136"><a href="#Parser-3136"><span class="linenos">3136</span></a> <span class="n">where</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">)</span> +</span><span id="Parser-3137"><a href="#Parser-3137"><span class="linenos">3137</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Filter</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">where</span><span class="p">)</span> +</span><span id="Parser-3138"><a href="#Parser-3138"><span class="linenos">3138</span></a> +</span><span id="Parser-3139"><a href="#Parser-3139"><span class="linenos">3139</span></a> <span class="c1"># T-SQL allows the OVER (...) syntax after WITHIN GROUP.</span> +</span><span id="Parser-3140"><a href="#Parser-3140"><span class="linenos">3140</span></a> <span class="c1"># https://learn.microsoft.com/en-us/sql/t-sql/functions/percentile-disc-transact-sql?view=sql-server-ver16</span> +</span><span id="Parser-3141"><a href="#Parser-3141"><span class="linenos">3141</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WITHIN_GROUP</span><span class="p">):</span> +</span><span id="Parser-3142"><a href="#Parser-3142"><span class="linenos">3142</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">)</span> +</span><span id="Parser-3143"><a href="#Parser-3143"><span class="linenos">3143</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">WithinGroup</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">order</span><span class="p">)</span> +</span><span id="Parser-3144"><a href="#Parser-3144"><span class="linenos">3144</span></a> +</span><span id="Parser-3145"><a href="#Parser-3145"><span class="linenos">3145</span></a> <span class="c1"># SQL spec defines an optional [ { IGNORE | RESPECT } NULLS ] OVER</span> +</span><span id="Parser-3146"><a href="#Parser-3146"><span class="linenos">3146</span></a> <span class="c1"># Some dialects choose to implement and some do not.</span> +</span><span id="Parser-3147"><a href="#Parser-3147"><span class="linenos">3147</span></a> <span class="c1"># https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html</span> +</span><span id="Parser-3148"><a href="#Parser-3148"><span class="linenos">3148</span></a> +</span><span id="Parser-3149"><a href="#Parser-3149"><span class="linenos">3149</span></a> <span class="c1"># There is some code above in _parse_lambda that handles</span> +</span><span id="Parser-3150"><a href="#Parser-3150"><span class="linenos">3150</span></a> <span class="c1"># SELECT FIRST_VALUE(TABLE.COLUMN IGNORE|RESPECT NULLS) OVER ...</span> +</span><span id="Parser-3151"><a href="#Parser-3151"><span class="linenos">3151</span></a> +</span><span id="Parser-3152"><a href="#Parser-3152"><span class="linenos">3152</span></a> <span class="c1"># The below changes handle</span> +</span><span id="Parser-3153"><a href="#Parser-3153"><span class="linenos">3153</span></a> <span class="c1"># SELECT FIRST_VALUE(TABLE.COLUMN) IGNORE|RESPECT NULLS OVER ...</span> +</span><span id="Parser-3154"><a href="#Parser-3154"><span class="linenos">3154</span></a> +</span><span id="Parser-3155"><a href="#Parser-3155"><span class="linenos">3155</span></a> <span class="c1"># Oracle allows both formats</span> +</span><span id="Parser-3156"><a href="#Parser-3156"><span class="linenos">3156</span></a> <span class="c1"># (https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/img_text/first_value.html)</span> +</span><span id="Parser-3157"><a href="#Parser-3157"><span class="linenos">3157</span></a> <span class="c1"># and Snowflake chose to do the same for familiarity</span> +</span><span id="Parser-3158"><a href="#Parser-3158"><span class="linenos">3158</span></a> <span class="c1"># https://docs.snowflake.com/en/sql-reference/functions/first_value.html#usage-notes</span> +</span><span id="Parser-3159"><a href="#Parser-3159"><span class="linenos">3159</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IGNORE_NULLS</span><span class="p">):</span> +</span><span id="Parser-3160"><a href="#Parser-3160"><span class="linenos">3160</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">IgnoreNulls</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-3161"><a href="#Parser-3161"><span class="linenos">3161</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">RESPECT_NULLS</span><span class="p">):</span> +</span><span id="Parser-3162"><a href="#Parser-3162"><span class="linenos">3162</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RespectNulls</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-3163"><a href="#Parser-3163"><span class="linenos">3163</span></a> +</span><span id="Parser-3164"><a href="#Parser-3164"><span class="linenos">3164</span></a> <span class="c1"># bigquery select from window x AS (partition by ...)</span> +</span><span id="Parser-3165"><a href="#Parser-3165"><span class="linenos">3165</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="Parser-3166"><a href="#Parser-3166"><span class="linenos">3166</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-3167"><a href="#Parser-3167"><span class="linenos">3167</span></a> <span class="k">elif</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">OVER</span><span class="p">):</span> +</span><span id="Parser-3168"><a href="#Parser-3168"><span class="linenos">3168</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3169"><a href="#Parser-3169"><span class="linenos">3169</span></a> +</span><span id="Parser-3170"><a href="#Parser-3170"><span class="linenos">3170</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-3171"><a href="#Parser-3171"><span class="linenos">3171</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="kc">False</span><span class="p">))</span> +</span><span id="Parser-3172"><a href="#Parser-3172"><span class="linenos">3172</span></a> +</span><span id="Parser-3173"><a href="#Parser-3173"><span class="linenos">3173</span></a> <span class="n">window_alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">WINDOW_ALIAS_TOKENS</span><span class="p">)</span> +</span><span id="Parser-3174"><a href="#Parser-3174"><span class="linenos">3174</span></a> <span class="n">partition</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition_by</span><span class="p">()</span> +</span><span id="Parser-3175"><a href="#Parser-3175"><span class="linenos">3175</span></a> <span class="n">order</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_order</span><span class="p">()</span> +</span><span id="Parser-3176"><a href="#Parser-3176"><span class="linenos">3176</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RANGE</span><span class="p">))</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-3177"><a href="#Parser-3177"><span class="linenos">3177</span></a> +</span><span id="Parser-3178"><a href="#Parser-3178"><span class="linenos">3178</span></a> <span class="k">if</span> <span class="n">kind</span><span class="p">:</span> +</span><span id="Parser-3179"><a href="#Parser-3179"><span class="linenos">3179</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span> +</span><span id="Parser-3180"><a href="#Parser-3180"><span class="linenos">3180</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window_spec</span><span class="p">()</span> +</span><span id="Parser-3181"><a href="#Parser-3181"><span class="linenos">3181</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">)</span> +</span><span id="Parser-3182"><a href="#Parser-3182"><span class="linenos">3182</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_window_spec</span><span class="p">()</span> +</span><span id="Parser-3183"><a href="#Parser-3183"><span class="linenos">3183</span></a> +</span><span id="Parser-3184"><a href="#Parser-3184"><span class="linenos">3184</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3185"><a href="#Parser-3185"><span class="linenos">3185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">WindowSpec</span><span class="p">,</span> +</span><span id="Parser-3186"><a href="#Parser-3186"><span class="linenos">3186</span></a> <span class="n">kind</span><span class="o">=</span><span class="n">kind</span><span class="p">,</span> +</span><span id="Parser-3187"><a href="#Parser-3187"><span class="linenos">3187</span></a> <span class="n">start</span><span class="o">=</span><span class="n">start</span><span class="p">[</span><span class="s2">"value"</span><span class="p">],</span> +</span><span id="Parser-3188"><a href="#Parser-3188"><span class="linenos">3188</span></a> <span class="n">start_side</span><span class="o">=</span><span class="n">start</span><span class="p">[</span><span class="s2">"side"</span><span class="p">],</span> +</span><span id="Parser-3189"><a href="#Parser-3189"><span class="linenos">3189</span></a> <span class="n">end</span><span class="o">=</span><span class="n">end</span><span class="p">[</span><span class="s2">"value"</span><span class="p">],</span> +</span><span id="Parser-3190"><a href="#Parser-3190"><span class="linenos">3190</span></a> <span class="n">end_side</span><span class="o">=</span><span class="n">end</span><span class="p">[</span><span class="s2">"side"</span><span class="p">],</span> +</span><span id="Parser-3191"><a href="#Parser-3191"><span class="linenos">3191</span></a> <span class="p">)</span> +</span><span id="Parser-3192"><a href="#Parser-3192"><span class="linenos">3192</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3193"><a href="#Parser-3193"><span class="linenos">3193</span></a> <span class="n">spec</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3194"><a href="#Parser-3194"><span class="linenos">3194</span></a> +</span><span id="Parser-3195"><a href="#Parser-3195"><span class="linenos">3195</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-3196"><a href="#Parser-3196"><span class="linenos">3196</span></a> +</span><span id="Parser-3197"><a href="#Parser-3197"><span class="linenos">3197</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3198"><a href="#Parser-3198"><span class="linenos">3198</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">,</span> +</span><span id="Parser-3199"><a href="#Parser-3199"><span class="linenos">3199</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-3200"><a href="#Parser-3200"><span class="linenos">3200</span></a> <span class="n">partition_by</span><span class="o">=</span><span class="n">partition</span><span class="p">,</span> +</span><span id="Parser-3201"><a href="#Parser-3201"><span class="linenos">3201</span></a> <span class="n">order</span><span class="o">=</span><span class="n">order</span><span class="p">,</span> +</span><span id="Parser-3202"><a href="#Parser-3202"><span class="linenos">3202</span></a> <span class="n">spec</span><span class="o">=</span><span class="n">spec</span><span class="p">,</span> +</span><span id="Parser-3203"><a href="#Parser-3203"><span class="linenos">3203</span></a> <span class="n">alias</span><span class="o">=</span><span class="n">window_alias</span><span class="p">,</span> +</span><span id="Parser-3204"><a href="#Parser-3204"><span class="linenos">3204</span></a> <span class="p">)</span> +</span><span id="Parser-3205"><a href="#Parser-3205"><span class="linenos">3205</span></a> +</span><span id="Parser-3206"><a href="#Parser-3206"><span class="linenos">3206</span></a> <span class="k">def</span> <span class="nf">_parse_window_spec</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-3207"><a href="#Parser-3207"><span class="linenos">3207</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span> +</span><span id="Parser-3208"><a href="#Parser-3208"><span class="linenos">3208</span></a> +</span><span id="Parser-3209"><a href="#Parser-3209"><span class="linenos">3209</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="Parser-3210"><a href="#Parser-3210"><span class="linenos">3210</span></a> <span class="s2">"value"</span><span class="p">:</span> <span class="p">(</span> +</span><span id="Parser-3211"><a href="#Parser-3211"><span class="linenos">3211</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UNBOUNDED</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_ROW</span><span class="p">))</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-3212"><a href="#Parser-3212"><span class="linenos">3212</span></a> <span class="p">)</span> +</span><span id="Parser-3213"><a href="#Parser-3213"><span class="linenos">3213</span></a> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">(),</span> +</span><span id="Parser-3214"><a href="#Parser-3214"><span class="linenos">3214</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">((</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PRECEDING</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOLLOWING</span><span class="p">))</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> +</span><span id="Parser-3215"><a href="#Parser-3215"><span class="linenos">3215</span></a> <span class="p">}</span> +</span><span id="Parser-3216"><a href="#Parser-3216"><span class="linenos">3216</span></a> +</span><span id="Parser-3217"><a href="#Parser-3217"><span class="linenos">3217</span></a> <span class="k">def</span> <span class="nf">_parse_alias</span><span class="p">(</span> +</span><span id="Parser-3218"><a href="#Parser-3218"><span class="linenos">3218</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">explicit</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Parser-3219"><a href="#Parser-3219"><span class="linenos">3219</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3220"><a href="#Parser-3220"><span class="linenos">3220</span></a> <span class="n">any_token</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">)</span> +</span><span id="Parser-3221"><a href="#Parser-3221"><span class="linenos">3221</span></a> +</span><span id="Parser-3222"><a href="#Parser-3222"><span class="linenos">3222</span></a> <span class="k">if</span> <span class="n">explicit</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">any_token</span><span class="p">:</span> +</span><span id="Parser-3223"><a href="#Parser-3223"><span class="linenos">3223</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3224"><a href="#Parser-3224"><span class="linenos">3224</span></a> +</span><span id="Parser-3225"><a href="#Parser-3225"><span class="linenos">3225</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-3226"><a href="#Parser-3226"><span class="linenos">3226</span></a> <span class="n">aliases</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3227"><a href="#Parser-3227"><span class="linenos">3227</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Aliases</span><span class="p">,</span> +</span><span id="Parser-3228"><a href="#Parser-3228"><span class="linenos">3228</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-3229"><a href="#Parser-3229"><span class="linenos">3229</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="p">)),</span> +</span><span id="Parser-3230"><a href="#Parser-3230"><span class="linenos">3230</span></a> <span class="p">)</span> +</span><span id="Parser-3231"><a href="#Parser-3231"><span class="linenos">3231</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">(</span><span class="n">aliases</span><span class="p">)</span> +</span><span id="Parser-3232"><a href="#Parser-3232"><span class="linenos">3232</span></a> <span class="k">return</span> <span class="n">aliases</span> +</span><span id="Parser-3233"><a href="#Parser-3233"><span class="linenos">3233</span></a> +</span><span id="Parser-3234"><a href="#Parser-3234"><span class="linenos">3234</span></a> <span class="n">alias</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">(</span><span class="n">any_token</span><span class="p">)</span> +</span><span id="Parser-3235"><a href="#Parser-3235"><span class="linenos">3235</span></a> +</span><span id="Parser-3236"><a href="#Parser-3236"><span class="linenos">3236</span></a> <span class="k">if</span> <span class="n">alias</span><span class="p">:</span> +</span><span id="Parser-3237"><a href="#Parser-3237"><span class="linenos">3237</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">alias</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span> +</span><span id="Parser-3238"><a href="#Parser-3238"><span class="linenos">3238</span></a> +</span><span id="Parser-3239"><a href="#Parser-3239"><span class="linenos">3239</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3240"><a href="#Parser-3240"><span class="linenos">3240</span></a> +</span><span id="Parser-3241"><a href="#Parser-3241"><span class="linenos">3241</span></a> <span class="k">def</span> <span class="nf">_parse_id_var</span><span class="p">(</span> +</span><span id="Parser-3242"><a href="#Parser-3242"><span class="linenos">3242</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser-3243"><a href="#Parser-3243"><span class="linenos">3243</span></a> <span class="n">any_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="Parser-3244"><a href="#Parser-3244"><span class="linenos">3244</span></a> <span class="n">tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-3245"><a href="#Parser-3245"><span class="linenos">3245</span></a> <span class="n">prefix_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser-3246"><a href="#Parser-3246"><span class="linenos">3246</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3247"><a href="#Parser-3247"><span class="linenos">3247</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_identifier</span><span class="p">()</span> +</span><span id="Parser-3248"><a href="#Parser-3248"><span class="linenos">3248</span></a> +</span><span id="Parser-3249"><a href="#Parser-3249"><span class="linenos">3249</span></a> <span class="k">if</span> <span class="n">identifier</span><span class="p">:</span> +</span><span id="Parser-3250"><a href="#Parser-3250"><span class="linenos">3250</span></a> <span class="k">return</span> <span class="n">identifier</span> +</span><span id="Parser-3251"><a href="#Parser-3251"><span class="linenos">3251</span></a> +</span><span id="Parser-3252"><a href="#Parser-3252"><span class="linenos">3252</span></a> <span class="n">prefix</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Parser-3253"><a href="#Parser-3253"><span class="linenos">3253</span></a> +</span><span id="Parser-3254"><a href="#Parser-3254"><span class="linenos">3254</span></a> <span class="k">if</span> <span class="n">prefix_tokens</span><span class="p">:</span> +</span><span id="Parser-3255"><a href="#Parser-3255"><span class="linenos">3255</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">prefix_tokens</span><span class="p">):</span> +</span><span id="Parser-3256"><a href="#Parser-3256"><span class="linenos">3256</span></a> <span class="n">prefix</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-3257"><a href="#Parser-3257"><span class="linenos">3257</span></a> +</span><span id="Parser-3258"><a href="#Parser-3258"><span class="linenos">3258</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">any_token</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">())</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">tokens</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">ID_VAR_TOKENS</span><span class="p">):</span> +</span><span id="Parser-3259"><a href="#Parser-3259"><span class="linenos">3259</span></a> <span class="n">quoted</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span> +</span><span id="Parser-3260"><a href="#Parser-3260"><span class="linenos">3260</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">prefix</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="n">quoted</span><span class="p">)</span> +</span><span id="Parser-3261"><a href="#Parser-3261"><span class="linenos">3261</span></a> +</span><span id="Parser-3262"><a href="#Parser-3262"><span class="linenos">3262</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3263"><a href="#Parser-3263"><span class="linenos">3263</span></a> +</span><span id="Parser-3264"><a href="#Parser-3264"><span class="linenos">3264</span></a> <span class="k">def</span> <span class="nf">_parse_string</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3265"><a href="#Parser-3265"><span class="linenos">3265</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">):</span> +</span><span id="Parser-3266"><a href="#Parser-3266"><span class="linenos">3266</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3267"><a href="#Parser-3267"><span class="linenos">3267</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="Parser-3268"><a href="#Parser-3268"><span class="linenos">3268</span></a> +</span><span id="Parser-3269"><a href="#Parser-3269"><span class="linenos">3269</span></a> <span class="k">def</span> <span class="nf">_parse_number</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3270"><a href="#Parser-3270"><span class="linenos">3270</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">):</span> +</span><span id="Parser-3271"><a href="#Parser-3271"><span class="linenos">3271</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3272"><a href="#Parser-3272"><span class="linenos">3272</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="Parser-3273"><a href="#Parser-3273"><span class="linenos">3273</span></a> +</span><span id="Parser-3274"><a href="#Parser-3274"><span class="linenos">3274</span></a> <span class="k">def</span> <span class="nf">_parse_identifier</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3275"><a href="#Parser-3275"><span class="linenos">3275</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">):</span> +</span><span id="Parser-3276"><a href="#Parser-3276"><span class="linenos">3276</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-3277"><a href="#Parser-3277"><span class="linenos">3277</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="Parser-3278"><a href="#Parser-3278"><span class="linenos">3278</span></a> +</span><span id="Parser-3279"><a href="#Parser-3279"><span class="linenos">3279</span></a> <span class="k">def</span> <span class="nf">_parse_var</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">any_token</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3280"><a href="#Parser-3280"><span class="linenos">3280</span></a> <span class="k">if</span> <span class="p">(</span><span class="n">any_token</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance_any</span><span class="p">())</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">):</span> +</span><span id="Parser-3281"><a href="#Parser-3281"><span class="linenos">3281</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-3282"><a href="#Parser-3282"><span class="linenos">3282</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_placeholder</span><span class="p">()</span> +</span><span id="Parser-3283"><a href="#Parser-3283"><span class="linenos">3283</span></a> +</span><span id="Parser-3284"><a href="#Parser-3284"><span class="linenos">3284</span></a> <span class="k">def</span> <span class="nf">_advance_any</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]:</span> +</span><span id="Parser-3285"><a href="#Parser-3285"><span class="linenos">3285</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">RESERVED_KEYWORDS</span><span class="p">:</span> +</span><span id="Parser-3286"><a href="#Parser-3286"><span class="linenos">3286</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3287"><a href="#Parser-3287"><span class="linenos">3287</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> +</span><span id="Parser-3288"><a href="#Parser-3288"><span class="linenos">3288</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3289"><a href="#Parser-3289"><span class="linenos">3289</span></a> +</span><span id="Parser-3290"><a href="#Parser-3290"><span class="linenos">3290</span></a> <span class="k">def</span> <span class="nf">_parse_var_or_string</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3291"><a href="#Parser-3291"><span class="linenos">3291</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_var</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()</span> +</span><span id="Parser-3292"><a href="#Parser-3292"><span class="linenos">3292</span></a> +</span><span id="Parser-3293"><a href="#Parser-3293"><span class="linenos">3293</span></a> <span class="k">def</span> <span class="nf">_parse_null</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3294"><a href="#Parser-3294"><span class="linenos">3294</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">):</span> +</span><span id="Parser-3295"><a href="#Parser-3295"><span class="linenos">3295</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3296"><a href="#Parser-3296"><span class="linenos">3296</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3297"><a href="#Parser-3297"><span class="linenos">3297</span></a> +</span><span id="Parser-3298"><a href="#Parser-3298"><span class="linenos">3298</span></a> <span class="k">def</span> <span class="nf">_parse_boolean</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3299"><a href="#Parser-3299"><span class="linenos">3299</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">):</span> +</span><span id="Parser-3300"><a href="#Parser-3300"><span class="linenos">3300</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3301"><a href="#Parser-3301"><span class="linenos">3301</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">):</span> +</span><span id="Parser-3302"><a href="#Parser-3302"><span class="linenos">3302</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3303"><a href="#Parser-3303"><span class="linenos">3303</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3304"><a href="#Parser-3304"><span class="linenos">3304</span></a> +</span><span id="Parser-3305"><a href="#Parser-3305"><span class="linenos">3305</span></a> <span class="k">def</span> <span class="nf">_parse_star</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3306"><a href="#Parser-3306"><span class="linenos">3306</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">):</span> +</span><span id="Parser-3307"><a href="#Parser-3307"><span class="linenos">3307</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">PRIMARY_PARSERS</span><span class="p">[</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">](</span><span class="bp">self</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3308"><a href="#Parser-3308"><span class="linenos">3308</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3309"><a href="#Parser-3309"><span class="linenos">3309</span></a> +</span><span id="Parser-3310"><a href="#Parser-3310"><span class="linenos">3310</span></a> <span class="k">def</span> <span class="nf">_parse_placeholder</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3311"><a href="#Parser-3311"><span class="linenos">3311</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">PLACEHOLDER_PARSERS</span><span class="p">):</span> +</span><span id="Parser-3312"><a href="#Parser-3312"><span class="linenos">3312</span></a> <span class="n">placeholder</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">PLACEHOLDER_PARSERS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">](</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-3313"><a href="#Parser-3313"><span class="linenos">3313</span></a> <span class="k">if</span> <span class="n">placeholder</span><span class="p">:</span> +</span><span id="Parser-3314"><a href="#Parser-3314"><span class="linenos">3314</span></a> <span class="k">return</span> <span class="n">placeholder</span> +</span><span id="Parser-3315"><a href="#Parser-3315"><span class="linenos">3315</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> +</span><span id="Parser-3316"><a href="#Parser-3316"><span class="linenos">3316</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3317"><a href="#Parser-3317"><span class="linenos">3317</span></a> +</span><span id="Parser-3318"><a href="#Parser-3318"><span class="linenos">3318</span></a> <span class="k">def</span> <span class="nf">_parse_except</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="Parser-3319"><a href="#Parser-3319"><span class="linenos">3319</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">):</span> +</span><span id="Parser-3320"><a href="#Parser-3320"><span class="linenos">3320</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3321"><a href="#Parser-3321"><span class="linenos">3321</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-3322"><a href="#Parser-3322"><span class="linenos">3322</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-3323"><a href="#Parser-3323"><span class="linenos">3323</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_column</span><span class="p">)</span> +</span><span id="Parser-3324"><a href="#Parser-3324"><span class="linenos">3324</span></a> +</span><span id="Parser-3325"><a href="#Parser-3325"><span class="linenos">3325</span></a> <span class="k">def</span> <span class="nf">_parse_replace</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]:</span> +</span><span id="Parser-3326"><a href="#Parser-3326"><span class="linenos">3326</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">):</span> +</span><span id="Parser-3327"><a href="#Parser-3327"><span class="linenos">3327</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3328"><a href="#Parser-3328"><span class="linenos">3328</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-3329"><a href="#Parser-3329"><span class="linenos">3329</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">)</span> +</span><span id="Parser-3330"><a href="#Parser-3330"><span class="linenos">3330</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">)</span> +</span><span id="Parser-3331"><a href="#Parser-3331"><span class="linenos">3331</span></a> +</span><span id="Parser-3332"><a href="#Parser-3332"><span class="linenos">3332</span></a> <span class="k">def</span> <span class="nf">_parse_csv</span><span class="p">(</span> +</span><span id="Parser-3333"><a href="#Parser-3333"><span class="linenos">3333</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="n">TokenType</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span> +</span><span id="Parser-3334"><a href="#Parser-3334"><span class="linenos">3334</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-3335"><a href="#Parser-3335"><span class="linenos">3335</span></a> <span class="n">parse_result</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="Parser-3336"><a href="#Parser-3336"><span class="linenos">3336</span></a> <span class="n">items</span> <span class="o">=</span> <span class="p">[</span><span class="n">parse_result</span><span class="p">]</span> <span class="k">if</span> <span class="n">parse_result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="p">[]</span> +</span><span id="Parser-3337"><a href="#Parser-3337"><span class="linenos">3337</span></a> +</span><span id="Parser-3338"><a href="#Parser-3338"><span class="linenos">3338</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">sep</span><span class="p">):</span> +</span><span id="Parser-3339"><a href="#Parser-3339"><span class="linenos">3339</span></a> <span class="k">if</span> <span class="n">parse_result</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="Parser-3340"><a href="#Parser-3340"><span class="linenos">3340</span></a> <span class="n">parse_result</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-3341"><a href="#Parser-3341"><span class="linenos">3341</span></a> +</span><span id="Parser-3342"><a href="#Parser-3342"><span class="linenos">3342</span></a> <span class="n">parse_result</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="Parser-3343"><a href="#Parser-3343"><span class="linenos">3343</span></a> <span class="k">if</span> <span class="n">parse_result</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser-3344"><a href="#Parser-3344"><span class="linenos">3344</span></a> <span class="n">items</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">parse_result</span><span class="p">)</span> +</span><span id="Parser-3345"><a href="#Parser-3345"><span class="linenos">3345</span></a> +</span><span id="Parser-3346"><a href="#Parser-3346"><span class="linenos">3346</span></a> <span class="k">return</span> <span class="n">items</span> +</span><span id="Parser-3347"><a href="#Parser-3347"><span class="linenos">3347</span></a> +</span><span id="Parser-3348"><a href="#Parser-3348"><span class="linenos">3348</span></a> <span class="k">def</span> <span class="nf">_parse_tokens</span><span class="p">(</span> +</span><span id="Parser-3349"><a href="#Parser-3349"><span class="linenos">3349</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">expressions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> +</span><span id="Parser-3350"><a href="#Parser-3350"><span class="linenos">3350</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3351"><a href="#Parser-3351"><span class="linenos">3351</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="Parser-3352"><a href="#Parser-3352"><span class="linenos">3352</span></a> +</span><span id="Parser-3353"><a href="#Parser-3353"><span class="linenos">3353</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="n">expressions</span><span class="p">):</span> +</span><span id="Parser-3354"><a href="#Parser-3354"><span class="linenos">3354</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3355"><a href="#Parser-3355"><span class="linenos">3355</span></a> <span class="n">expressions</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span><span class="p">],</span> +</span><span id="Parser-3356"><a href="#Parser-3356"><span class="linenos">3356</span></a> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> +</span><span id="Parser-3357"><a href="#Parser-3357"><span class="linenos">3357</span></a> <span class="n">comments</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">,</span> +</span><span id="Parser-3358"><a href="#Parser-3358"><span class="linenos">3358</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">parse_method</span><span class="p">(),</span> +</span><span id="Parser-3359"><a href="#Parser-3359"><span class="linenos">3359</span></a> <span class="p">)</span> +</span><span id="Parser-3360"><a href="#Parser-3360"><span class="linenos">3360</span></a> +</span><span id="Parser-3361"><a href="#Parser-3361"><span class="linenos">3361</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3362"><a href="#Parser-3362"><span class="linenos">3362</span></a> +</span><span id="Parser-3363"><a href="#Parser-3363"><span class="linenos">3363</span></a> <span class="k">def</span> <span class="nf">_parse_wrapped_id_vars</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-3364"><a href="#Parser-3364"><span class="linenos">3364</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">)</span> +</span><span id="Parser-3365"><a href="#Parser-3365"><span class="linenos">3365</span></a> +</span><span id="Parser-3366"><a href="#Parser-3366"><span class="linenos">3366</span></a> <span class="k">def</span> <span class="nf">_parse_wrapped_csv</span><span class="p">(</span> +</span><span id="Parser-3367"><a href="#Parser-3367"><span class="linenos">3367</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">,</span> <span class="n">sep</span><span class="p">:</span> <span class="n">TokenType</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span> +</span><span id="Parser-3368"><a href="#Parser-3368"><span class="linenos">3368</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser-3369"><a href="#Parser-3369"><span class="linenos">3369</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="n">parse_method</span><span class="p">,</span> <span class="n">sep</span><span class="o">=</span><span class="n">sep</span><span class="p">))</span> +</span><span id="Parser-3370"><a href="#Parser-3370"><span class="linenos">3370</span></a> +</span><span id="Parser-3371"><a href="#Parser-3371"><span class="linenos">3371</span></a> <span class="k">def</span> <span class="nf">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parse_method</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">:</span> +</span><span id="Parser-3372"><a href="#Parser-3372"><span class="linenos">3372</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_l_paren</span><span class="p">()</span> +</span><span id="Parser-3373"><a href="#Parser-3373"><span class="linenos">3373</span></a> <span class="n">parse_result</span> <span class="o">=</span> <span class="n">parse_method</span><span class="p">()</span> +</span><span id="Parser-3374"><a href="#Parser-3374"><span class="linenos">3374</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_r_paren</span><span class="p">()</span> +</span><span id="Parser-3375"><a href="#Parser-3375"><span class="linenos">3375</span></a> <span class="k">return</span> <span class="n">parse_result</span> +</span><span id="Parser-3376"><a href="#Parser-3376"><span class="linenos">3376</span></a> +</span><span id="Parser-3377"><a href="#Parser-3377"><span class="linenos">3377</span></a> <span class="k">def</span> <span class="nf">_parse_select_or_expression</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3378"><a href="#Parser-3378"><span class="linenos">3378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">()</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_expression</span><span class="p">()</span> +</span><span id="Parser-3379"><a href="#Parser-3379"><span class="linenos">3379</span></a> +</span><span id="Parser-3380"><a href="#Parser-3380"><span class="linenos">3380</span></a> <span class="k">def</span> <span class="nf">_parse_ddl_select</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3381"><a href="#Parser-3381"><span class="linenos">3381</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_operations</span><span class="p">(</span> +</span><span id="Parser-3382"><a href="#Parser-3382"><span class="linenos">3382</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_select</span><span class="p">(</span><span class="n">nested</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">parse_subquery_alias</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="Parser-3383"><a href="#Parser-3383"><span class="linenos">3383</span></a> <span class="p">)</span> +</span><span id="Parser-3384"><a href="#Parser-3384"><span class="linenos">3384</span></a> +</span><span id="Parser-3385"><a href="#Parser-3385"><span class="linenos">3385</span></a> <span class="k">def</span> <span class="nf">_parse_transaction</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3386"><a href="#Parser-3386"><span class="linenos">3386</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3387"><a href="#Parser-3387"><span class="linenos">3387</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">TRANSACTION_KIND</span><span class="p">):</span> +</span><span id="Parser-3388"><a href="#Parser-3388"><span class="linenos">3388</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span> +</span><span id="Parser-3389"><a href="#Parser-3389"><span class="linenos">3389</span></a> +</span><span id="Parser-3390"><a href="#Parser-3390"><span class="linenos">3390</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">({</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> <span class="s2">"WORK"</span><span class="p">})</span> +</span><span id="Parser-3391"><a href="#Parser-3391"><span class="linenos">3391</span></a> +</span><span id="Parser-3392"><a href="#Parser-3392"><span class="linenos">3392</span></a> <span class="n">modes</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-3393"><a href="#Parser-3393"><span class="linenos">3393</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-3394"><a href="#Parser-3394"><span class="linenos">3394</span></a> <span class="n">mode</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-3395"><a href="#Parser-3395"><span class="linenos">3395</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">):</span> +</span><span id="Parser-3396"><a href="#Parser-3396"><span class="linenos">3396</span></a> <span class="n">mode</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-3397"><a href="#Parser-3397"><span class="linenos">3397</span></a> +</span><span id="Parser-3398"><a href="#Parser-3398"><span class="linenos">3398</span></a> <span class="k">if</span> <span class="n">mode</span><span class="p">:</span> +</span><span id="Parser-3399"><a href="#Parser-3399"><span class="linenos">3399</span></a> <span class="n">modes</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">mode</span><span class="p">))</span> +</span><span id="Parser-3400"><a href="#Parser-3400"><span class="linenos">3400</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">):</span> +</span><span id="Parser-3401"><a href="#Parser-3401"><span class="linenos">3401</span></a> <span class="k">break</span> +</span><span id="Parser-3402"><a href="#Parser-3402"><span class="linenos">3402</span></a> +</span><span id="Parser-3403"><a href="#Parser-3403"><span class="linenos">3403</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Transaction</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">modes</span><span class="o">=</span><span class="n">modes</span><span class="p">)</span> +</span><span id="Parser-3404"><a href="#Parser-3404"><span class="linenos">3404</span></a> +</span><span id="Parser-3405"><a href="#Parser-3405"><span class="linenos">3405</span></a> <span class="k">def</span> <span class="nf">_parse_commit_or_rollback</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3406"><a href="#Parser-3406"><span class="linenos">3406</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3407"><a href="#Parser-3407"><span class="linenos">3407</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3408"><a href="#Parser-3408"><span class="linenos">3408</span></a> <span class="n">is_rollback</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLBACK</span> +</span><span id="Parser-3409"><a href="#Parser-3409"><span class="linenos">3409</span></a> +</span><span id="Parser-3410"><a href="#Parser-3410"><span class="linenos">3410</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">({</span><span class="s2">"TRANSACTION"</span><span class="p">,</span> <span class="s2">"WORK"</span><span class="p">})</span> +</span><span id="Parser-3411"><a href="#Parser-3411"><span class="linenos">3411</span></a> +</span><span id="Parser-3412"><a href="#Parser-3412"><span class="linenos">3412</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TO"</span><span class="p">):</span> +</span><span id="Parser-3413"><a href="#Parser-3413"><span class="linenos">3413</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SAVEPOINT"</span><span class="p">)</span> +</span><span id="Parser-3414"><a href="#Parser-3414"><span class="linenos">3414</span></a> <span class="n">savepoint</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-3415"><a href="#Parser-3415"><span class="linenos">3415</span></a> +</span><span id="Parser-3416"><a href="#Parser-3416"><span class="linenos">3416</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">):</span> +</span><span id="Parser-3417"><a href="#Parser-3417"><span class="linenos">3417</span></a> <span class="n">chain</span> <span class="o">=</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"NO"</span><span class="p">)</span> +</span><span id="Parser-3418"><a href="#Parser-3418"><span class="linenos">3418</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"CHAIN"</span><span class="p">)</span> +</span><span id="Parser-3419"><a href="#Parser-3419"><span class="linenos">3419</span></a> +</span><span id="Parser-3420"><a href="#Parser-3420"><span class="linenos">3420</span></a> <span class="k">if</span> <span class="n">is_rollback</span><span class="p">:</span> +</span><span id="Parser-3421"><a href="#Parser-3421"><span class="linenos">3421</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Rollback</span><span class="p">,</span> <span class="n">savepoint</span><span class="o">=</span><span class="n">savepoint</span><span class="p">)</span> +</span><span id="Parser-3422"><a href="#Parser-3422"><span class="linenos">3422</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Commit</span><span class="p">,</span> <span class="n">chain</span><span class="o">=</span><span class="n">chain</span><span class="p">)</span> +</span><span id="Parser-3423"><a href="#Parser-3423"><span class="linenos">3423</span></a> +</span><span id="Parser-3424"><a href="#Parser-3424"><span class="linenos">3424</span></a> <span class="k">def</span> <span class="nf">_parse_add_column</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3425"><a href="#Parser-3425"><span class="linenos">3425</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">):</span> +</span><span id="Parser-3426"><a href="#Parser-3426"><span class="linenos">3426</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3427"><a href="#Parser-3427"><span class="linenos">3427</span></a> +</span><span id="Parser-3428"><a href="#Parser-3428"><span class="linenos">3428</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">)</span> +</span><span id="Parser-3429"><a href="#Parser-3429"><span class="linenos">3429</span></a> <span class="n">exists_column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">(</span><span class="n">not_</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-3430"><a href="#Parser-3430"><span class="linenos">3430</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_column_def</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Parser-3431"><a href="#Parser-3431"><span class="linenos">3431</span></a> +</span><span id="Parser-3432"><a href="#Parser-3432"><span class="linenos">3432</span></a> <span class="k">if</span> <span class="n">expression</span><span class="p">:</span> +</span><span id="Parser-3433"><a href="#Parser-3433"><span class="linenos">3433</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"exists"</span><span class="p">,</span> <span class="n">exists_column</span><span class="p">)</span> +</span><span id="Parser-3434"><a href="#Parser-3434"><span class="linenos">3434</span></a> +</span><span id="Parser-3435"><a href="#Parser-3435"><span class="linenos">3435</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="Parser-3436"><a href="#Parser-3436"><span class="linenos">3436</span></a> +</span><span id="Parser-3437"><a href="#Parser-3437"><span class="linenos">3437</span></a> <span class="k">def</span> <span class="nf">_parse_drop_column</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3438"><a href="#Parser-3438"><span class="linenos">3438</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop</span><span class="p">(</span><span class="n">default_kind</span><span class="o">=</span><span class="s2">"COLUMN"</span><span class="p">)</span> +</span><span id="Parser-3439"><a href="#Parser-3439"><span class="linenos">3439</span></a> +</span><span id="Parser-3440"><a href="#Parser-3440"><span class="linenos">3440</span></a> <span class="c1"># https://docs.aws.amazon.com/athena/latest/ug/alter-table-drop-partition.html</span> +</span><span id="Parser-3441"><a href="#Parser-3441"><span class="linenos">3441</span></a> <span class="k">def</span> <span class="nf">_parse_drop_partition</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exists</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3442"><a href="#Parser-3442"><span class="linenos">3442</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3443"><a href="#Parser-3443"><span class="linenos">3443</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DropPartition</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_partition</span><span class="p">),</span> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span> +</span><span id="Parser-3444"><a href="#Parser-3444"><span class="linenos">3444</span></a> <span class="p">)</span> +</span><span id="Parser-3445"><a href="#Parser-3445"><span class="linenos">3445</span></a> +</span><span id="Parser-3446"><a href="#Parser-3446"><span class="linenos">3446</span></a> <span class="k">def</span> <span class="nf">_parse_add_constraint</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3447"><a href="#Parser-3447"><span class="linenos">3447</span></a> <span class="n">this</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3448"><a href="#Parser-3448"><span class="linenos">3448</span></a> <span class="n">kind</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">token_type</span> +</span><span id="Parser-3449"><a href="#Parser-3449"><span class="linenos">3449</span></a> +</span><span id="Parser-3450"><a href="#Parser-3450"><span class="linenos">3450</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">:</span> +</span><span id="Parser-3451"><a href="#Parser-3451"><span class="linenos">3451</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span> +</span><span id="Parser-3452"><a href="#Parser-3452"><span class="linenos">3452</span></a> +</span><span id="Parser-3453"><a href="#Parser-3453"><span class="linenos">3453</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">):</span> +</span><span id="Parser-3454"><a href="#Parser-3454"><span class="linenos">3454</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_wrapped</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span> +</span><span id="Parser-3455"><a href="#Parser-3455"><span class="linenos">3455</span></a> <span class="n">enforced</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ENFORCED"</span><span class="p">)</span> +</span><span id="Parser-3456"><a href="#Parser-3456"><span class="linenos">3456</span></a> +</span><span id="Parser-3457"><a href="#Parser-3457"><span class="linenos">3457</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3458"><a href="#Parser-3458"><span class="linenos">3458</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">,</span> <span class="n">enforced</span><span class="o">=</span><span class="n">enforced</span> +</span><span id="Parser-3459"><a href="#Parser-3459"><span class="linenos">3459</span></a> <span class="p">)</span> +</span><span id="Parser-3460"><a href="#Parser-3460"><span class="linenos">3460</span></a> +</span><span id="Parser-3461"><a href="#Parser-3461"><span class="linenos">3461</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">):</span> +</span><span id="Parser-3462"><a href="#Parser-3462"><span class="linenos">3462</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_foreign_key</span><span class="p">()</span> +</span><span id="Parser-3463"><a href="#Parser-3463"><span class="linenos">3463</span></a> <span class="k">elif</span> <span class="n">kind</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">):</span> +</span><span id="Parser-3464"><a href="#Parser-3464"><span class="linenos">3464</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_primary_key</span><span class="p">()</span> +</span><span id="Parser-3465"><a href="#Parser-3465"><span class="linenos">3465</span></a> +</span><span id="Parser-3466"><a href="#Parser-3466"><span class="linenos">3466</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AddConstraint</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Parser-3467"><a href="#Parser-3467"><span class="linenos">3467</span></a> +</span><span id="Parser-3468"><a href="#Parser-3468"><span class="linenos">3468</span></a> <span class="k">def</span> <span class="nf">_parse_alter</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3469"><a href="#Parser-3469"><span class="linenos">3469</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">):</span> +</span><span id="Parser-3470"><a href="#Parser-3470"><span class="linenos">3470</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_as_command</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">)</span> +</span><span id="Parser-3471"><a href="#Parser-3471"><span class="linenos">3471</span></a> +</span><span id="Parser-3472"><a href="#Parser-3472"><span class="linenos">3472</span></a> <span class="n">exists</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">()</span> +</span><span id="Parser-3473"><a href="#Parser-3473"><span class="linenos">3473</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-3474"><a href="#Parser-3474"><span class="linenos">3474</span></a> +</span><span id="Parser-3475"><a href="#Parser-3475"><span class="linenos">3475</span></a> <span class="n">actions</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser-3476"><a href="#Parser-3476"><span class="linenos">3476</span></a> +</span><span id="Parser-3477"><a href="#Parser-3477"><span class="linenos">3477</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-3478"><a href="#Parser-3478"><span class="linenos">3478</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">):</span> +</span><span id="Parser-3479"><a href="#Parser-3479"><span class="linenos">3479</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Delete</span><span class="p">,</span> <span class="n">where</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">())]</span> +</span><span id="Parser-3480"><a href="#Parser-3480"><span class="linenos">3480</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ADD"</span><span class="p">):</span> +</span><span id="Parser-3481"><a href="#Parser-3481"><span class="linenos">3481</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ADD_CONSTRAINT_TOKENS</span><span class="p">):</span> +</span><span id="Parser-3482"><a href="#Parser-3482"><span class="linenos">3482</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_add_constraint</span><span class="p">)</span> +</span><span id="Parser-3483"><a href="#Parser-3483"><span class="linenos">3483</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3484"><a href="#Parser-3484"><span class="linenos">3484</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-3485"><a href="#Parser-3485"><span class="linenos">3485</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_add_column</span><span class="p">)</span> +</span><span id="Parser-3486"><a href="#Parser-3486"><span class="linenos">3486</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"DROP"</span><span class="p">):</span> +</span><span id="Parser-3487"><a href="#Parser-3487"><span class="linenos">3487</span></a> <span class="n">partition_exists</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_exists</span><span class="p">()</span> +</span><span id="Parser-3488"><a href="#Parser-3488"><span class="linenos">3488</span></a> +</span><span id="Parser-3489"><a href="#Parser-3489"><span class="linenos">3489</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> +</span><span id="Parser-3490"><a href="#Parser-3490"><span class="linenos">3490</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span> +</span><span id="Parser-3491"><a href="#Parser-3491"><span class="linenos">3491</span></a> <span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop_partition</span><span class="p">(</span><span class="n">exists</span><span class="o">=</span><span class="n">partition_exists</span><span class="p">)</span> +</span><span id="Parser-3492"><a href="#Parser-3492"><span class="linenos">3492</span></a> <span class="p">)</span> +</span><span id="Parser-3493"><a href="#Parser-3493"><span class="linenos">3493</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3494"><a href="#Parser-3494"><span class="linenos">3494</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-3495"><a href="#Parser-3495"><span class="linenos">3495</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_drop_column</span><span class="p">)</span> +</span><span id="Parser-3496"><a href="#Parser-3496"><span class="linenos">3496</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"RENAME"</span><span class="p">,</span> <span class="s2">"TO"</span><span class="p">):</span> +</span><span id="Parser-3497"><a href="#Parser-3497"><span class="linenos">3497</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RenameTable</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">schema</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Parser-3498"><a href="#Parser-3498"><span class="linenos">3498</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"ALTER"</span><span class="p">):</span> +</span><span id="Parser-3499"><a href="#Parser-3499"><span class="linenos">3499</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">)</span> +</span><span id="Parser-3500"><a href="#Parser-3500"><span class="linenos">3500</span></a> <span class="n">column</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_field</span><span class="p">(</span><span class="n">any_token</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-3501"><a href="#Parser-3501"><span class="linenos">3501</span></a> +</span><span id="Parser-3502"><a href="#Parser-3502"><span class="linenos">3502</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="Parser-3503"><a href="#Parser-3503"><span class="linenos">3503</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">,</span> <span class="n">drop</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> +</span><span id="Parser-3504"><a href="#Parser-3504"><span class="linenos">3504</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_pair</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">):</span> +</span><span id="Parser-3505"><a href="#Parser-3505"><span class="linenos">3505</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3506"><a href="#Parser-3506"><span class="linenos">3506</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-3507"><a href="#Parser-3507"><span class="linenos">3507</span></a> <span class="p">)</span> +</span><span id="Parser-3508"><a href="#Parser-3508"><span class="linenos">3508</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3509"><a href="#Parser-3509"><span class="linenos">3509</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"SET"</span><span class="p">,</span> <span class="s2">"DATA"</span><span class="p">)</span> +</span><span id="Parser-3510"><a href="#Parser-3510"><span class="linenos">3510</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3511"><a href="#Parser-3511"><span class="linenos">3511</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">AlterColumn</span><span class="p">,</span> +</span><span id="Parser-3512"><a href="#Parser-3512"><span class="linenos">3512</span></a> <span class="n">this</span><span class="o">=</span><span class="n">column</span><span class="p">,</span> +</span><span id="Parser-3513"><a href="#Parser-3513"><span class="linenos">3513</span></a> <span class="n">dtype</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">"TYPE"</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">(),</span> +</span><span id="Parser-3514"><a href="#Parser-3514"><span class="linenos">3514</span></a> <span class="n">collate</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_term</span><span class="p">(),</span> +</span><span id="Parser-3515"><a href="#Parser-3515"><span class="linenos">3515</span></a> <span class="n">using</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">(),</span> +</span><span id="Parser-3516"><a href="#Parser-3516"><span class="linenos">3516</span></a> <span class="p">)</span> +</span><span id="Parser-3517"><a href="#Parser-3517"><span class="linenos">3517</span></a> +</span><span id="Parser-3518"><a href="#Parser-3518"><span class="linenos">3518</span></a> <span class="n">actions</span> <span class="o">=</span> <span class="n">ensure_list</span><span class="p">(</span><span class="n">actions</span><span class="p">)</span> +</span><span id="Parser-3519"><a href="#Parser-3519"><span class="linenos">3519</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AlterTable</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">exists</span><span class="o">=</span><span class="n">exists</span><span class="p">,</span> <span class="n">actions</span><span class="o">=</span><span class="n">actions</span><span class="p">)</span> +</span><span id="Parser-3520"><a href="#Parser-3520"><span class="linenos">3520</span></a> +</span><span id="Parser-3521"><a href="#Parser-3521"><span class="linenos">3521</span></a> <span class="k">def</span> <span class="nf">_parse_show</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3522"><a href="#Parser-3522"><span class="linenos">3522</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_parser</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SHOW_PARSERS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_show_trie</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-3523"><a href="#Parser-3523"><span class="linenos">3523</span></a> <span class="k">if</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="Parser-3524"><a href="#Parser-3524"><span class="linenos">3524</span></a> <span class="k">return</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Parser-3525"><a href="#Parser-3525"><span class="linenos">3525</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3526"><a href="#Parser-3526"><span class="linenos">3526</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Show</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="Parser-3527"><a href="#Parser-3527"><span class="linenos">3527</span></a> +</span><span id="Parser-3528"><a href="#Parser-3528"><span class="linenos">3528</span></a> <span class="k">def</span> <span class="nf">_default_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3529"><a href="#Parser-3529"><span class="linenos">3529</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3530"><a href="#Parser-3530"><span class="linenos">3530</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SetItem</span><span class="p">,</span> +</span><span id="Parser-3531"><a href="#Parser-3531"><span class="linenos">3531</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">(),</span> +</span><span id="Parser-3532"><a href="#Parser-3532"><span class="linenos">3532</span></a> <span class="p">)</span> +</span><span id="Parser-3533"><a href="#Parser-3533"><span class="linenos">3533</span></a> +</span><span id="Parser-3534"><a href="#Parser-3534"><span class="linenos">3534</span></a> <span class="k">def</span> <span class="nf">_parse_set_item</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Parser-3535"><a href="#Parser-3535"><span class="linenos">3535</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_parser</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SET_PARSERS</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_set_trie</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Parser-3536"><a href="#Parser-3536"><span class="linenos">3536</span></a> <span class="k">return</span> <span class="n">parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="k">if</span> <span class="n">parser</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">_default_parse_set_item</span><span class="p">()</span> +</span><span id="Parser-3537"><a href="#Parser-3537"><span class="linenos">3537</span></a> +</span><span id="Parser-3538"><a href="#Parser-3538"><span class="linenos">3538</span></a> <span class="k">def</span> <span class="nf">_parse_merge</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3539"><a href="#Parser-3539"><span class="linenos">3539</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">)</span> +</span><span id="Parser-3540"><a href="#Parser-3540"><span class="linenos">3540</span></a> <span class="n">target</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> +</span><span id="Parser-3541"><a href="#Parser-3541"><span class="linenos">3541</span></a> +</span><span id="Parser-3542"><a href="#Parser-3542"><span class="linenos">3542</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">)</span> +</span><span id="Parser-3543"><a href="#Parser-3543"><span class="linenos">3543</span></a> <span class="n">using</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">()</span> +</span><span id="Parser-3544"><a href="#Parser-3544"><span class="linenos">3544</span></a> +</span><span id="Parser-3545"><a href="#Parser-3545"><span class="linenos">3545</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">)</span> +</span><span id="Parser-3546"><a href="#Parser-3546"><span class="linenos">3546</span></a> <span class="n">on</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-3547"><a href="#Parser-3547"><span class="linenos">3547</span></a> +</span><span id="Parser-3548"><a href="#Parser-3548"><span class="linenos">3548</span></a> <span class="n">whens</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-3549"><a href="#Parser-3549"><span class="linenos">3549</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">WHEN</span><span class="p">):</span> +</span><span id="Parser-3550"><a href="#Parser-3550"><span class="linenos">3550</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span> +</span><span id="Parser-3551"><a href="#Parser-3551"><span class="linenos">3551</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">)</span> +</span><span id="Parser-3552"><a href="#Parser-3552"><span class="linenos">3552</span></a> +</span><span id="Parser-3553"><a href="#Parser-3553"><span class="linenos">3553</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">):</span> +</span><span id="Parser-3554"><a href="#Parser-3554"><span class="linenos">3554</span></a> <span class="n">_this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_star</span><span class="p">()</span> +</span><span id="Parser-3555"><a href="#Parser-3555"><span class="linenos">3555</span></a> <span class="k">if</span> <span class="n">_this</span><span class="p">:</span> +</span><span id="Parser-3556"><a href="#Parser-3556"><span class="linenos">3556</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">_this</span><span class="p">)</span> +</span><span id="Parser-3557"><a href="#Parser-3557"><span class="linenos">3557</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3558"><a href="#Parser-3558"><span class="linenos">3558</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3559"><a href="#Parser-3559"><span class="linenos">3559</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Insert</span><span class="p">,</span> +</span><span id="Parser-3560"><a href="#Parser-3560"><span class="linenos">3560</span></a> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">(),</span> +</span><span id="Parser-3561"><a href="#Parser-3561"><span class="linenos">3561</span></a> <span class="n">expression</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_value</span><span class="p">(),</span> +</span><span id="Parser-3562"><a href="#Parser-3562"><span class="linenos">3562</span></a> <span class="p">)</span> +</span><span id="Parser-3563"><a href="#Parser-3563"><span class="linenos">3563</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">):</span> +</span><span id="Parser-3564"><a href="#Parser-3564"><span class="linenos">3564</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_star</span><span class="p">()</span> +</span><span id="Parser-3565"><a href="#Parser-3565"><span class="linenos">3565</span></a> <span class="k">if</span> <span class="n">expressions</span><span class="p">:</span> +</span><span id="Parser-3566"><a href="#Parser-3566"><span class="linenos">3566</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">)</span> +</span><span id="Parser-3567"><a href="#Parser-3567"><span class="linenos">3567</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3568"><a href="#Parser-3568"><span class="linenos">3568</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3569"><a href="#Parser-3569"><span class="linenos">3569</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span> +</span><span id="Parser-3570"><a href="#Parser-3570"><span class="linenos">3570</span></a> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span> +</span><span id="Parser-3571"><a href="#Parser-3571"><span class="linenos">3571</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span> +</span><span id="Parser-3572"><a href="#Parser-3572"><span class="linenos">3572</span></a> <span class="p">)</span> +</span><span id="Parser-3573"><a href="#Parser-3573"><span class="linenos">3573</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">):</span> +</span><span id="Parser-3574"><a href="#Parser-3574"><span class="linenos">3574</span></a> <span class="n">then</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser-3575"><a href="#Parser-3575"><span class="linenos">3575</span></a> +</span><span id="Parser-3576"><a href="#Parser-3576"><span class="linenos">3576</span></a> <span class="n">whens</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">When</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">then</span><span class="o">=</span><span class="n">then</span><span class="p">))</span> +</span><span id="Parser-3577"><a href="#Parser-3577"><span class="linenos">3577</span></a> +</span><span id="Parser-3578"><a href="#Parser-3578"><span class="linenos">3578</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span> +</span><span id="Parser-3579"><a href="#Parser-3579"><span class="linenos">3579</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Merge</span><span class="p">,</span> +</span><span id="Parser-3580"><a href="#Parser-3580"><span class="linenos">3580</span></a> <span class="n">this</span><span class="o">=</span><span class="n">target</span><span class="p">,</span> +</span><span id="Parser-3581"><a href="#Parser-3581"><span class="linenos">3581</span></a> <span class="n">using</span><span class="o">=</span><span class="n">using</span><span class="p">,</span> +</span><span id="Parser-3582"><a href="#Parser-3582"><span class="linenos">3582</span></a> <span class="n">on</span><span class="o">=</span><span class="n">on</span><span class="p">,</span> +</span><span id="Parser-3583"><a href="#Parser-3583"><span class="linenos">3583</span></a> <span class="n">expressions</span><span class="o">=</span><span class="n">whens</span><span class="p">,</span> +</span><span id="Parser-3584"><a href="#Parser-3584"><span class="linenos">3584</span></a> <span class="p">)</span> +</span><span id="Parser-3585"><a href="#Parser-3585"><span class="linenos">3585</span></a> +</span><span id="Parser-3586"><a href="#Parser-3586"><span class="linenos">3586</span></a> <span class="k">def</span> <span class="nf">_parse_set</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser-3587"><a href="#Parser-3587"><span class="linenos">3587</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Set</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_set_item</span><span class="p">))</span> +</span><span id="Parser-3588"><a href="#Parser-3588"><span class="linenos">3588</span></a> +</span><span id="Parser-3589"><a href="#Parser-3589"><span class="linenos">3589</span></a> <span class="k">def</span> <span class="nf">_parse_as_command</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">start</span><span class="p">:</span> <span class="n">Token</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">:</span> +</span><span id="Parser-3590"><a href="#Parser-3590"><span class="linenos">3590</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="Parser-3591"><a href="#Parser-3591"><span class="linenos">3591</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3592"><a href="#Parser-3592"><span class="linenos">3592</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">Command</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_find_sql</span><span class="p">(</span><span class="n">start</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="p">))</span> +</span><span id="Parser-3593"><a href="#Parser-3593"><span class="linenos">3593</span></a> +</span><span id="Parser-3594"><a href="#Parser-3594"><span class="linenos">3594</span></a> <span class="k">def</span> <span class="nf">_find_parser</span><span class="p">(</span> +</span><span id="Parser-3595"><a href="#Parser-3595"><span class="linenos">3595</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parsers</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">],</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> +</span><span id="Parser-3596"><a href="#Parser-3596"><span class="linenos">3596</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]:</span> +</span><span id="Parser-3597"><a href="#Parser-3597"><span class="linenos">3597</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-3598"><a href="#Parser-3598"><span class="linenos">3598</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser-3599"><a href="#Parser-3599"><span class="linenos">3599</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Parser-3600"><a href="#Parser-3600"><span class="linenos">3600</span></a> <span class="c1"># The current token might be multiple words</span> +</span><span id="Parser-3601"><a href="#Parser-3601"><span class="linenos">3601</span></a> <span class="n">curr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="Parser-3602"><a href="#Parser-3602"><span class="linenos">3602</span></a> <span class="n">key</span> <span class="o">=</span> <span class="n">curr</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">" "</span><span class="p">)</span> +</span><span id="Parser-3603"><a href="#Parser-3603"><span class="linenos">3603</span></a> <span class="n">this</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">curr</span><span class="p">)</span> +</span><span id="Parser-3604"><a href="#Parser-3604"><span class="linenos">3604</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3605"><a href="#Parser-3605"><span class="linenos">3605</span></a> <span class="n">result</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span> +</span><span id="Parser-3606"><a href="#Parser-3606"><span class="linenos">3606</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="Parser-3607"><a href="#Parser-3607"><span class="linenos">3607</span></a> <span class="k">break</span> +</span><span id="Parser-3608"><a href="#Parser-3608"><span class="linenos">3608</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="Parser-3609"><a href="#Parser-3609"><span class="linenos">3609</span></a> <span class="n">subparser</span> <span class="o">=</span> <span class="n">parsers</span><span class="p">[</span><span class="s2">" "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">this</span><span class="p">)]</span> +</span><span id="Parser-3610"><a href="#Parser-3610"><span class="linenos">3610</span></a> <span class="k">return</span> <span class="n">subparser</span> +</span><span id="Parser-3611"><a href="#Parser-3611"><span class="linenos">3611</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-3612"><a href="#Parser-3612"><span class="linenos">3612</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3613"><a href="#Parser-3613"><span class="linenos">3613</span></a> +</span><span id="Parser-3614"><a href="#Parser-3614"><span class="linenos">3614</span></a> <span class="k">def</span> <span class="nf">_match</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Parser-3615"><a href="#Parser-3615"><span class="linenos">3615</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="Parser-3616"><a href="#Parser-3616"><span class="linenos">3616</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3617"><a href="#Parser-3617"><span class="linenos">3617</span></a> +</span><span id="Parser-3618"><a href="#Parser-3618"><span class="linenos">3618</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">token_type</span><span class="p">:</span> +</span><span id="Parser-3619"><a href="#Parser-3619"><span class="linenos">3619</span></a> <span class="k">if</span> <span class="n">advance</span><span class="p">:</span> +</span><span id="Parser-3620"><a href="#Parser-3620"><span class="linenos">3620</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3621"><a href="#Parser-3621"><span class="linenos">3621</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Parser-3622"><a href="#Parser-3622"><span class="linenos">3622</span></a> +</span><span id="Parser-3623"><a href="#Parser-3623"><span class="linenos">3623</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3624"><a href="#Parser-3624"><span class="linenos">3624</span></a> +</span><span id="Parser-3625"><a href="#Parser-3625"><span class="linenos">3625</span></a> <span class="k">def</span> <span class="nf">_match_set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">types</span><span class="p">):</span> +</span><span id="Parser-3626"><a href="#Parser-3626"><span class="linenos">3626</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="p">:</span> +</span><span id="Parser-3627"><a href="#Parser-3627"><span class="linenos">3627</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3628"><a href="#Parser-3628"><span class="linenos">3628</span></a> +</span><span id="Parser-3629"><a href="#Parser-3629"><span class="linenos">3629</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="n">types</span><span class="p">:</span> +</span><span id="Parser-3630"><a href="#Parser-3630"><span class="linenos">3630</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3631"><a href="#Parser-3631"><span class="linenos">3631</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Parser-3632"><a href="#Parser-3632"><span class="linenos">3632</span></a> +</span><span id="Parser-3633"><a href="#Parser-3633"><span class="linenos">3633</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3634"><a href="#Parser-3634"><span class="linenos">3634</span></a> +</span><span id="Parser-3635"><a href="#Parser-3635"><span class="linenos">3635</span></a> <span class="k">def</span> <span class="nf">_match_pair</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type_a</span><span class="p">,</span> <span class="n">token_type_b</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Parser-3636"><a href="#Parser-3636"><span class="linenos">3636</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="p">:</span> +</span><span id="Parser-3637"><a href="#Parser-3637"><span class="linenos">3637</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3638"><a href="#Parser-3638"><span class="linenos">3638</span></a> +</span><span id="Parser-3639"><a href="#Parser-3639"><span class="linenos">3639</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">token_type_a</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span><span class="o">.</span><span class="n">token_type</span> <span class="o">==</span> <span class="n">token_type_b</span><span class="p">:</span> +</span><span id="Parser-3640"><a href="#Parser-3640"><span class="linenos">3640</span></a> <span class="k">if</span> <span class="n">advance</span><span class="p">:</span> +</span><span id="Parser-3641"><a href="#Parser-3641"><span class="linenos">3641</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> +</span><span id="Parser-3642"><a href="#Parser-3642"><span class="linenos">3642</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Parser-3643"><a href="#Parser-3643"><span class="linenos">3643</span></a> +</span><span id="Parser-3644"><a href="#Parser-3644"><span class="linenos">3644</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Parser-3645"><a href="#Parser-3645"><span class="linenos">3645</span></a> +</span><span id="Parser-3646"><a href="#Parser-3646"><span class="linenos">3646</span></a> <span class="k">def</span> <span class="nf">_match_l_paren</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Parser-3647"><a href="#Parser-3647"><span class="linenos">3647</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">):</span> +</span><span id="Parser-3648"><a href="#Parser-3648"><span class="linenos">3648</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting ("</span><span class="p">)</span> +</span><span id="Parser-3649"><a href="#Parser-3649"><span class="linenos">3649</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="Parser-3650"><a href="#Parser-3650"><span class="linenos">3650</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-3651"><a href="#Parser-3651"><span class="linenos">3651</span></a> +</span><span id="Parser-3652"><a href="#Parser-3652"><span class="linenos">3652</span></a> <span class="k">def</span> <span class="nf">_match_r_paren</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> +</span><span id="Parser-3653"><a href="#Parser-3653"><span class="linenos">3653</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">):</span> +</span><span id="Parser-3654"><a href="#Parser-3654"><span class="linenos">3654</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">"Expecting )"</span><span class="p">)</span> +</span><span id="Parser-3655"><a href="#Parser-3655"><span class="linenos">3655</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="Parser-3656"><a href="#Parser-3656"><span class="linenos">3656</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser-3657"><a href="#Parser-3657"><span class="linenos">3657</span></a> +</span><span id="Parser-3658"><a href="#Parser-3658"><span class="linenos">3658</span></a> <span class="k">def</span> <span class="nf">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">texts</span><span class="p">):</span> +</span><span id="Parser-3659"><a href="#Parser-3659"><span class="linenos">3659</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="ow">in</span> <span class="n">texts</span><span class="p">:</span> +</span><span id="Parser-3660"><a href="#Parser-3660"><span class="linenos">3660</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3661"><a href="#Parser-3661"><span class="linenos">3661</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Parser-3662"><a href="#Parser-3662"><span class="linenos">3662</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="Parser-3663"><a href="#Parser-3663"><span class="linenos">3663</span></a> +</span><span id="Parser-3664"><a href="#Parser-3664"><span class="linenos">3664</span></a> <span class="k">def</span> <span class="nf">_match_text_seq</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">texts</span><span class="p">,</span> <span class="n">advance</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span> +</span><span id="Parser-3665"><a href="#Parser-3665"><span class="linenos">3665</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> +</span><span id="Parser-3666"><a href="#Parser-3666"><span class="linenos">3666</span></a> <span class="k">for</span> <span class="n">text</span> <span class="ow">in</span> <span class="n">texts</span><span class="p">:</span> +</span><span id="Parser-3667"><a href="#Parser-3667"><span class="linenos">3667</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="n">text</span><span class="p">:</span> +</span><span id="Parser-3668"><a href="#Parser-3668"><span class="linenos">3668</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Parser-3669"><a href="#Parser-3669"><span class="linenos">3669</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Parser-3670"><a href="#Parser-3670"><span class="linenos">3670</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-3671"><a href="#Parser-3671"><span class="linenos">3671</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="Parser-3672"><a href="#Parser-3672"><span class="linenos">3672</span></a> +</span><span id="Parser-3673"><a href="#Parser-3673"><span class="linenos">3673</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">advance</span><span class="p">:</span> +</span><span id="Parser-3674"><a href="#Parser-3674"><span class="linenos">3674</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Parser-3675"><a href="#Parser-3675"><span class="linenos">3675</span></a> +</span><span id="Parser-3676"><a href="#Parser-3676"><span class="linenos">3676</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Parser-3677"><a href="#Parser-3677"><span class="linenos">3677</span></a> +</span><span id="Parser-3678"><a href="#Parser-3678"><span class="linenos">3678</span></a> <span class="k">def</span> <span class="nf">_replace_columns_with_dots</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">this</span><span class="p">):</span> +</span><span id="Parser-3679"><a href="#Parser-3679"><span class="linenos">3679</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">):</span> +</span><span id="Parser-3680"><a href="#Parser-3680"><span class="linenos">3680</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_columns_with_dots</span><span class="p">)</span> +</span><span id="Parser-3681"><a href="#Parser-3681"><span class="linenos">3681</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="Parser-3682"><a href="#Parser-3682"><span class="linenos">3682</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">replace_children</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_columns_with_dots</span><span class="p">)</span> +</span><span id="Parser-3683"><a href="#Parser-3683"><span class="linenos">3683</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">this</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"table"</span><span class="p">)</span> +</span><span id="Parser-3684"><a href="#Parser-3684"><span class="linenos">3684</span></a> <span class="n">this</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Parser-3685"><a href="#Parser-3685"><span class="linenos">3685</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Dot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">this</span><span class="p">)</span> +</span><span id="Parser-3686"><a href="#Parser-3686"><span class="linenos">3686</span></a> <span class="k">if</span> <span class="n">table</span> +</span><span id="Parser-3687"><a href="#Parser-3687"><span class="linenos">3687</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="Parser-3688"><a href="#Parser-3688"><span class="linenos">3688</span></a> <span class="p">)</span> +</span><span id="Parser-3689"><a href="#Parser-3689"><span class="linenos">3689</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">):</span> +</span><span id="Parser-3690"><a href="#Parser-3690"><span class="linenos">3690</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Var</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="Parser-3691"><a href="#Parser-3691"><span class="linenos">3691</span></a> <span class="k">return</span> <span class="n">this</span> +</span><span id="Parser-3692"><a href="#Parser-3692"><span class="linenos">3692</span></a> +</span><span id="Parser-3693"><a href="#Parser-3693"><span class="linenos">3693</span></a> <span class="k">def</span> <span class="nf">_replace_lambda</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">node</span><span class="p">,</span> <span class="n">lambda_variables</span><span class="p">):</span> +</span><span id="Parser-3694"><a href="#Parser-3694"><span class="linenos">3694</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="Parser-3695"><a href="#Parser-3695"><span class="linenos">3695</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">lambda_variables</span><span class="p">:</span> +</span><span id="Parser-3696"><a href="#Parser-3696"><span class="linenos">3696</span></a> <span class="k">return</span> <span class="n">node</span><span class="o">.</span><span class="n">this</span> +</span><span id="Parser-3697"><a href="#Parser-3697"><span class="linenos">3697</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces +a parsed syntax tree.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>error_level:</strong> the desired error level. +Default: ErrorLevel.RAISE</li> +<li><strong>error_message_context:</strong> determines the amount of context to capture from a +query string when displaying the error message (in number of characters). +Default: 50.</li> +<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. +Default: 0</li> +<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. +Default: False</li> +<li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. +This is only relevant if error_level is ErrorLevel.RAISE. +Default: 3</li> +<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. +Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". +Default: "nulls_are_small"</li> +</ul> +</div> + + + <div id="Parser.__init__" class="classattr"> + <input id="Parser.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Parser</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">error_level</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="errors.html#ErrorLevel">sqlglot.errors.ErrorLevel</a></span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">error_message_context</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">100</span>,</span><span class="param"> <span class="n">index_offset</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span>,</span><span class="param"> <span class="n">unnest_column_only</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span>,</span><span class="param"> <span class="n">alias_post_tablesample</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span>,</span><span class="param"> <span class="n">max_errors</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</span>,</span><span class="param"> <span class="n">null_ordering</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="Parser.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.__init__-667"><a href="#Parser.__init__-667"><span class="linenos">667</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Parser.__init__-668"><a href="#Parser.__init__-668"><span class="linenos">668</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser.__init__-669"><a href="#Parser.__init__-669"><span class="linenos">669</span></a> <span class="n">error_level</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ErrorLevel</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser.__init__-670"><a href="#Parser.__init__-670"><span class="linenos">670</span></a> <span class="n">error_message_context</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">100</span><span class="p">,</span> +</span><span id="Parser.__init__-671"><a href="#Parser.__init__-671"><span class="linenos">671</span></a> <span class="n">index_offset</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> +</span><span id="Parser.__init__-672"><a href="#Parser.__init__-672"><span class="linenos">672</span></a> <span class="n">unnest_column_only</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Parser.__init__-673"><a href="#Parser.__init__-673"><span class="linenos">673</span></a> <span class="n">alias_post_tablesample</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Parser.__init__-674"><a href="#Parser.__init__-674"><span class="linenos">674</span></a> <span class="n">max_errors</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">3</span><span class="p">,</span> +</span><span id="Parser.__init__-675"><a href="#Parser.__init__-675"><span class="linenos">675</span></a> <span class="n">null_ordering</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser.__init__-676"><a href="#Parser.__init__-676"><span class="linenos">676</span></a> <span class="p">):</span> +</span><span id="Parser.__init__-677"><a href="#Parser.__init__-677"><span class="linenos">677</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">=</span> <span class="n">error_level</span> <span class="ow">or</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span> +</span><span id="Parser.__init__-678"><a href="#Parser.__init__-678"><span class="linenos">678</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span> <span class="o">=</span> <span class="n">error_message_context</span> +</span><span id="Parser.__init__-679"><a href="#Parser.__init__-679"><span class="linenos">679</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">index_offset</span> <span class="o">=</span> <span class="n">index_offset</span> +</span><span id="Parser.__init__-680"><a href="#Parser.__init__-680"><span class="linenos">680</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unnest_column_only</span> <span class="o">=</span> <span class="n">unnest_column_only</span> +</span><span id="Parser.__init__-681"><a href="#Parser.__init__-681"><span class="linenos">681</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">alias_post_tablesample</span> <span class="o">=</span> <span class="n">alias_post_tablesample</span> +</span><span id="Parser.__init__-682"><a href="#Parser.__init__-682"><span class="linenos">682</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">max_errors</span> <span class="o">=</span> <span class="n">max_errors</span> +</span><span id="Parser.__init__-683"><a href="#Parser.__init__-683"><span class="linenos">683</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">null_ordering</span> <span class="o">=</span> <span class="n">null_ordering</span> +</span><span id="Parser.__init__-684"><a href="#Parser.__init__-684"><span class="linenos">684</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="Parser.reset" class="classattr"> + <input id="Parser.reset-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">reset</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="Parser.reset-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.reset"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.reset-686"><a href="#Parser.reset-686"><span class="linenos">686</span></a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="Parser.reset-687"><a href="#Parser.reset-687"><span class="linenos">687</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Parser.reset-688"><a href="#Parser.reset-688"><span class="linenos">688</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser.reset-689"><a href="#Parser.reset-689"><span class="linenos">689</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_tokens</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser.reset-690"><a href="#Parser.reset-690"><span class="linenos">690</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Parser.reset-691"><a href="#Parser.reset-691"><span class="linenos">691</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser.reset-692"><a href="#Parser.reset-692"><span class="linenos">692</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_next</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser.reset-693"><a href="#Parser.reset-693"><span class="linenos">693</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser.reset-694"><a href="#Parser.reset-694"><span class="linenos">694</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div id="Parser.parse" class="classattr"> + <input id="Parser.parse-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n"><a href="tokens.html#Token">sqlglot.tokens.Token</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="Parser.parse-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.parse"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.parse-696"><a href="#Parser.parse-696"><span class="linenos">696</span></a> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span> +</span><span id="Parser.parse-697"><a href="#Parser.parse-697"><span class="linenos">697</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser.parse-698"><a href="#Parser.parse-698"><span class="linenos">698</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser.parse-699"><a href="#Parser.parse-699"><span class="linenos">699</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser.parse-700"><a href="#Parser.parse-700"><span class="linenos">700</span></a><span class="sd"> Parses a list of tokens and returns a list of syntax trees, one tree</span> +</span><span id="Parser.parse-701"><a href="#Parser.parse-701"><span class="linenos">701</span></a><span class="sd"> per parsed SQL statement.</span> +</span><span id="Parser.parse-702"><a href="#Parser.parse-702"><span class="linenos">702</span></a> +</span><span id="Parser.parse-703"><a href="#Parser.parse-703"><span class="linenos">703</span></a><span class="sd"> Args:</span> +</span><span id="Parser.parse-704"><a href="#Parser.parse-704"><span class="linenos">704</span></a><span class="sd"> raw_tokens: the list of tokens.</span> +</span><span id="Parser.parse-705"><a href="#Parser.parse-705"><span class="linenos">705</span></a><span class="sd"> sql: the original SQL string, used to produce helpful debug messages.</span> +</span><span id="Parser.parse-706"><a href="#Parser.parse-706"><span class="linenos">706</span></a> +</span><span id="Parser.parse-707"><a href="#Parser.parse-707"><span class="linenos">707</span></a><span class="sd"> Returns:</span> +</span><span id="Parser.parse-708"><a href="#Parser.parse-708"><span class="linenos">708</span></a><span class="sd"> The list of syntax trees.</span> +</span><span id="Parser.parse-709"><a href="#Parser.parse-709"><span class="linenos">709</span></a><span class="sd"> """</span> +</span><span id="Parser.parse-710"><a href="#Parser.parse-710"><span class="linenos">710</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse</span><span class="p">(</span> +</span><span id="Parser.parse-711"><a href="#Parser.parse-711"><span class="linenos">711</span></a> <span class="n">parse_method</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="n">_parse_statement</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="o">=</span><span class="n">raw_tokens</span><span class="p">,</span> <span class="n">sql</span><span class="o">=</span><span class="n">sql</span> +</span><span id="Parser.parse-712"><a href="#Parser.parse-712"><span class="linenos">712</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Parses a list of tokens and returns a list of syntax trees, one tree +per parsed SQL statement.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>raw_tokens:</strong> the list of tokens.</li> +<li><strong>sql:</strong> the original SQL string, used to produce helpful debug messages.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The list of syntax trees.</p> +</blockquote> +</div> + + + </div> + <div id="Parser.parse_into" class="classattr"> + <input id="Parser.parse_into-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">parse_into</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression_types</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="n">Collection</span><span class="p">[</span><span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]]]</span>,</span><span class="param"> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n"><a href="tokens.html#Token">sqlglot.tokens.Token</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">sql</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">Optional</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="Parser.parse_into-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.parse_into"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.parse_into-714"><a href="#Parser.parse_into-714"><span class="linenos">714</span></a> <span class="k">def</span> <span class="nf">parse_into</span><span class="p">(</span> +</span><span id="Parser.parse_into-715"><a href="#Parser.parse_into-715"><span class="linenos">715</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Parser.parse_into-716"><a href="#Parser.parse_into-716"><span class="linenos">716</span></a> <span class="n">expression_types</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">IntoType</span><span class="p">,</span> +</span><span id="Parser.parse_into-717"><a href="#Parser.parse_into-717"><span class="linenos">717</span></a> <span class="n">raw_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">],</span> +</span><span id="Parser.parse_into-718"><a href="#Parser.parse_into-718"><span class="linenos">718</span></a> <span class="n">sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Parser.parse_into-719"><a href="#Parser.parse_into-719"><span class="linenos">719</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]:</span> +</span><span id="Parser.parse_into-720"><a href="#Parser.parse_into-720"><span class="linenos">720</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser.parse_into-721"><a href="#Parser.parse_into-721"><span class="linenos">721</span></a><span class="sd"> Parses a list of tokens into a given Expression type. If a collection of Expression</span> +</span><span id="Parser.parse_into-722"><a href="#Parser.parse_into-722"><span class="linenos">722</span></a><span class="sd"> types is given instead, this method will try to parse the token list into each one</span> +</span><span id="Parser.parse_into-723"><a href="#Parser.parse_into-723"><span class="linenos">723</span></a><span class="sd"> of them, stopping at the first for which the parsing succeeds.</span> +</span><span id="Parser.parse_into-724"><a href="#Parser.parse_into-724"><span class="linenos">724</span></a> +</span><span id="Parser.parse_into-725"><a href="#Parser.parse_into-725"><span class="linenos">725</span></a><span class="sd"> Args:</span> +</span><span id="Parser.parse_into-726"><a href="#Parser.parse_into-726"><span class="linenos">726</span></a><span class="sd"> expression_types: the expression type(s) to try and parse the token list into.</span> +</span><span id="Parser.parse_into-727"><a href="#Parser.parse_into-727"><span class="linenos">727</span></a><span class="sd"> raw_tokens: the list of tokens.</span> +</span><span id="Parser.parse_into-728"><a href="#Parser.parse_into-728"><span class="linenos">728</span></a><span class="sd"> sql: the original SQL string, used to produce helpful debug messages.</span> +</span><span id="Parser.parse_into-729"><a href="#Parser.parse_into-729"><span class="linenos">729</span></a> +</span><span id="Parser.parse_into-730"><a href="#Parser.parse_into-730"><span class="linenos">730</span></a><span class="sd"> Returns:</span> +</span><span id="Parser.parse_into-731"><a href="#Parser.parse_into-731"><span class="linenos">731</span></a><span class="sd"> The target Expression.</span> +</span><span id="Parser.parse_into-732"><a href="#Parser.parse_into-732"><span class="linenos">732</span></a><span class="sd"> """</span> +</span><span id="Parser.parse_into-733"><a href="#Parser.parse_into-733"><span class="linenos">733</span></a> <span class="n">errors</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Parser.parse_into-734"><a href="#Parser.parse_into-734"><span class="linenos">734</span></a> <span class="k">for</span> <span class="n">expression_type</span> <span class="ow">in</span> <span class="n">ensure_collection</span><span class="p">(</span><span class="n">expression_types</span><span class="p">):</span> +</span><span id="Parser.parse_into-735"><a href="#Parser.parse_into-735"><span class="linenos">735</span></a> <span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">EXPRESSION_PARSERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">expression_type</span><span class="p">)</span> +</span><span id="Parser.parse_into-736"><a href="#Parser.parse_into-736"><span class="linenos">736</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">parser</span><span class="p">:</span> +</span><span id="Parser.parse_into-737"><a href="#Parser.parse_into-737"><span class="linenos">737</span></a> <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"No parser registered for </span><span class="si">{</span><span class="n">expression_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Parser.parse_into-738"><a href="#Parser.parse_into-738"><span class="linenos">738</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Parser.parse_into-739"><a href="#Parser.parse_into-739"><span class="linenos">739</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse</span><span class="p">(</span><span class="n">parser</span><span class="p">,</span> <span class="n">raw_tokens</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span> +</span><span id="Parser.parse_into-740"><a href="#Parser.parse_into-740"><span class="linenos">740</span></a> <span class="k">except</span> <span class="n">ParseError</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span> +</span><span id="Parser.parse_into-741"><a href="#Parser.parse_into-741"><span class="linenos">741</span></a> <span class="n">e</span><span class="o">.</span><span class="n">errors</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s2">"into_expression"</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression_type</span> +</span><span id="Parser.parse_into-742"><a href="#Parser.parse_into-742"><span class="linenos">742</span></a> <span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Parser.parse_into-743"><a href="#Parser.parse_into-743"><span class="linenos">743</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span> +</span><span id="Parser.parse_into-744"><a href="#Parser.parse_into-744"><span class="linenos">744</span></a> <span class="sa">f</span><span class="s2">"Failed to parse into </span><span class="si">{</span><span class="n">expression_types</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Parser.parse_into-745"><a href="#Parser.parse_into-745"><span class="linenos">745</span></a> <span class="n">errors</span><span class="o">=</span><span class="n">merge_errors</span><span class="p">(</span><span class="n">errors</span><span class="p">),</span> +</span><span id="Parser.parse_into-746"><a href="#Parser.parse_into-746"><span class="linenos">746</span></a> <span class="p">)</span> <span class="kn">from</span> <span class="nn">errors</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Parses a list of tokens into a given Expression type. If a collection of Expression +types is given instead, this method will try to parse the token list into each one +of them, stopping at the first for which the parsing succeeds.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression_types:</strong> the expression type(s) to try and parse the token list into.</li> +<li><strong>raw_tokens:</strong> the list of tokens.</li> +<li><strong>sql:</strong> the original SQL string, used to produce helpful debug messages.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The target Expression.</p> +</blockquote> +</div> + + + </div> + <div id="Parser.check_errors" class="classattr"> + <input id="Parser.check_errors-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">check_errors</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Parser.check_errors-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.check_errors"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.check_errors-782"><a href="#Parser.check_errors-782"><span class="linenos">782</span></a> <span class="k">def</span> <span class="nf">check_errors</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser.check_errors-783"><a href="#Parser.check_errors-783"><span class="linenos">783</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser.check_errors-784"><a href="#Parser.check_errors-784"><span class="linenos">784</span></a><span class="sd"> Logs or raises any found errors, depending on the chosen error level setting.</span> +</span><span id="Parser.check_errors-785"><a href="#Parser.check_errors-785"><span class="linenos">785</span></a><span class="sd"> """</span> +</span><span id="Parser.check_errors-786"><a href="#Parser.check_errors-786"><span class="linenos">786</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">WARN</span><span class="p">:</span> +</span><span id="Parser.check_errors-787"><a href="#Parser.check_errors-787"><span class="linenos">787</span></a> <span class="k">for</span> <span class="n">error</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">:</span> +</span><span id="Parser.check_errors-788"><a href="#Parser.check_errors-788"><span class="linenos">788</span></a> <span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">error</span><span class="p">))</span> +</span><span id="Parser.check_errors-789"><a href="#Parser.check_errors-789"><span class="linenos">789</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">RAISE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">:</span> +</span><span id="Parser.check_errors-790"><a href="#Parser.check_errors-790"><span class="linenos">790</span></a> <span class="k">raise</span> <span class="n">ParseError</span><span class="p">(</span> +</span><span id="Parser.check_errors-791"><a href="#Parser.check_errors-791"><span class="linenos">791</span></a> <span class="n">concat_messages</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_errors</span><span class="p">),</span> +</span><span id="Parser.check_errors-792"><a href="#Parser.check_errors-792"><span class="linenos">792</span></a> <span class="n">errors</span><span class="o">=</span><span class="n">merge_errors</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="p">),</span> +</span><span id="Parser.check_errors-793"><a href="#Parser.check_errors-793"><span class="linenos">793</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Logs or raises any found errors, depending on the chosen error level setting.</p> +</div> + + + </div> + <div id="Parser.raise_error" class="classattr"> + <input id="Parser.raise_error-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">raise_error</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">message</span><span class="p">:</span> <span class="nb">str</span>, </span><span class="param"><span class="n">token</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n"><a href="tokens.html#Token">sqlglot.tokens.Token</a></span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Parser.raise_error-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.raise_error"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.raise_error-795"><a href="#Parser.raise_error-795"><span class="linenos">795</span></a> <span class="k">def</span> <span class="nf">raise_error</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">token</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser.raise_error-796"><a href="#Parser.raise_error-796"><span class="linenos">796</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser.raise_error-797"><a href="#Parser.raise_error-797"><span class="linenos">797</span></a><span class="sd"> Appends an error in the list of recorded errors or raises it, depending on the chosen</span> +</span><span id="Parser.raise_error-798"><a href="#Parser.raise_error-798"><span class="linenos">798</span></a><span class="sd"> error level setting.</span> +</span><span id="Parser.raise_error-799"><a href="#Parser.raise_error-799"><span class="linenos">799</span></a><span class="sd"> """</span> +</span><span id="Parser.raise_error-800"><a href="#Parser.raise_error-800"><span class="linenos">800</span></a> <span class="n">token</span> <span class="o">=</span> <span class="n">token</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_curr</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span> <span class="ow">or</span> <span class="n">Token</span><span class="o">.</span><span class="n">string</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Parser.raise_error-801"><a href="#Parser.raise_error-801"><span class="linenos">801</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_find_token</span><span class="p">(</span><span class="n">token</span><span class="p">)</span> +</span><span id="Parser.raise_error-802"><a href="#Parser.raise_error-802"><span class="linenos">802</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="nb">len</span><span class="p">(</span><span class="n">token</span><span class="o">.</span><span class="n">text</span><span class="p">)</span> +</span><span id="Parser.raise_error-803"><a href="#Parser.raise_error-803"><span class="linenos">803</span></a> <span class="n">start_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="nb">max</span><span class="p">(</span><span class="n">start</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="p">:</span> <span class="n">start</span><span class="p">]</span> +</span><span id="Parser.raise_error-804"><a href="#Parser.raise_error-804"><span class="linenos">804</span></a> <span class="n">highlight</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="Parser.raise_error-805"><a href="#Parser.raise_error-805"><span class="linenos">805</span></a> <span class="n">end_context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">end</span> <span class="p">:</span> <span class="n">end</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_message_context</span><span class="p">]</span> +</span><span id="Parser.raise_error-806"><a href="#Parser.raise_error-806"><span class="linenos">806</span></a> +</span><span id="Parser.raise_error-807"><a href="#Parser.raise_error-807"><span class="linenos">807</span></a> <span class="n">error</span> <span class="o">=</span> <span class="n">ParseError</span><span class="o">.</span><span class="n">new</span><span class="p">(</span> +</span><span id="Parser.raise_error-808"><a href="#Parser.raise_error-808"><span class="linenos">808</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">message</span><span class="si">}</span><span class="s2">. Line </span><span class="si">{</span><span class="n">token</span><span class="o">.</span><span class="n">line</span><span class="si">}</span><span class="s2">, Col: </span><span class="si">{</span><span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="si">}</span><span class="s2">.</span><span class="se">\n</span><span class="s2">"</span> +</span><span id="Parser.raise_error-809"><a href="#Parser.raise_error-809"><span class="linenos">809</span></a> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">start_context</span><span class="si">}</span><span class="se">\033</span><span class="s2">[4m</span><span class="si">{</span><span class="n">highlight</span><span class="si">}</span><span class="se">\033</span><span class="s2">[0m</span><span class="si">{</span><span class="n">end_context</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Parser.raise_error-810"><a href="#Parser.raise_error-810"><span class="linenos">810</span></a> <span class="n">description</span><span class="o">=</span><span class="n">message</span><span class="p">,</span> +</span><span id="Parser.raise_error-811"><a href="#Parser.raise_error-811"><span class="linenos">811</span></a> <span class="n">line</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">line</span><span class="p">,</span> +</span><span id="Parser.raise_error-812"><a href="#Parser.raise_error-812"><span class="linenos">812</span></a> <span class="n">col</span><span class="o">=</span><span class="n">token</span><span class="o">.</span><span class="n">col</span><span class="p">,</span> +</span><span id="Parser.raise_error-813"><a href="#Parser.raise_error-813"><span class="linenos">813</span></a> <span class="n">start_context</span><span class="o">=</span><span class="n">start_context</span><span class="p">,</span> +</span><span id="Parser.raise_error-814"><a href="#Parser.raise_error-814"><span class="linenos">814</span></a> <span class="n">highlight</span><span class="o">=</span><span class="n">highlight</span><span class="p">,</span> +</span><span id="Parser.raise_error-815"><a href="#Parser.raise_error-815"><span class="linenos">815</span></a> <span class="n">end_context</span><span class="o">=</span><span class="n">end_context</span><span class="p">,</span> +</span><span id="Parser.raise_error-816"><a href="#Parser.raise_error-816"><span class="linenos">816</span></a> <span class="p">)</span> +</span><span id="Parser.raise_error-817"><a href="#Parser.raise_error-817"><span class="linenos">817</span></a> +</span><span id="Parser.raise_error-818"><a href="#Parser.raise_error-818"><span class="linenos">818</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IMMEDIATE</span><span class="p">:</span> +</span><span id="Parser.raise_error-819"><a href="#Parser.raise_error-819"><span class="linenos">819</span></a> <span class="k">raise</span> <span class="n">error</span> +</span><span id="Parser.raise_error-820"><a href="#Parser.raise_error-820"><span class="linenos">820</span></a> +</span><span id="Parser.raise_error-821"><a href="#Parser.raise_error-821"><span class="linenos">821</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">errors</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">error</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Appends an error in the list of recorded errors or raises it, depending on the chosen +error level setting.</p> +</div> + + + </div> + <div id="Parser.expression" class="classattr"> + <input id="Parser.expression-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">expression</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">exp_class</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">comments</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="Parser.expression-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.expression"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.expression-823"><a href="#Parser.expression-823"><span class="linenos">823</span></a> <span class="k">def</span> <span class="nf">expression</span><span class="p">(</span> +</span><span id="Parser.expression-824"><a href="#Parser.expression-824"><span class="linenos">824</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">exp_class</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> +</span><span id="Parser.expression-825"><a href="#Parser.expression-825"><span class="linenos">825</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="Parser.expression-826"><a href="#Parser.expression-826"><span class="linenos">826</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser.expression-827"><a href="#Parser.expression-827"><span class="linenos">827</span></a><span class="sd"> Creates a new, validated Expression.</span> +</span><span id="Parser.expression-828"><a href="#Parser.expression-828"><span class="linenos">828</span></a> +</span><span id="Parser.expression-829"><a href="#Parser.expression-829"><span class="linenos">829</span></a><span class="sd"> Args:</span> +</span><span id="Parser.expression-830"><a href="#Parser.expression-830"><span class="linenos">830</span></a><span class="sd"> exp_class: the expression class to instantiate.</span> +</span><span id="Parser.expression-831"><a href="#Parser.expression-831"><span class="linenos">831</span></a><span class="sd"> comments: an optional list of comments to attach to the expression.</span> +</span><span id="Parser.expression-832"><a href="#Parser.expression-832"><span class="linenos">832</span></a><span class="sd"> kwargs: the arguments to set for the expression along with their respective values.</span> +</span><span id="Parser.expression-833"><a href="#Parser.expression-833"><span class="linenos">833</span></a> +</span><span id="Parser.expression-834"><a href="#Parser.expression-834"><span class="linenos">834</span></a><span class="sd"> Returns:</span> +</span><span id="Parser.expression-835"><a href="#Parser.expression-835"><span class="linenos">835</span></a><span class="sd"> The target expression.</span> +</span><span id="Parser.expression-836"><a href="#Parser.expression-836"><span class="linenos">836</span></a><span class="sd"> """</span> +</span><span id="Parser.expression-837"><a href="#Parser.expression-837"><span class="linenos">837</span></a> <span class="n">instance</span> <span class="o">=</span> <span class="n">exp_class</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="Parser.expression-838"><a href="#Parser.expression-838"><span class="linenos">838</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span><span class="p">:</span> +</span><span id="Parser.expression-839"><a href="#Parser.expression-839"><span class="linenos">839</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> +</span><span id="Parser.expression-840"><a href="#Parser.expression-840"><span class="linenos">840</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_comments</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser.expression-841"><a href="#Parser.expression-841"><span class="linenos">841</span></a> <span class="k">if</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="Parser.expression-842"><a href="#Parser.expression-842"><span class="linenos">842</span></a> <span class="n">instance</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="Parser.expression-843"><a href="#Parser.expression-843"><span class="linenos">843</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">validate_expression</span><span class="p">(</span><span class="n">instance</span><span class="p">)</span> +</span><span id="Parser.expression-844"><a href="#Parser.expression-844"><span class="linenos">844</span></a> <span class="k">return</span> <span class="n">instance</span> +</span></pre></div> + + + <div class="docstring"><p>Creates a new, validated Expression.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>exp_class:</strong> the expression class to instantiate.</li> +<li><strong>comments:</strong> an optional list of comments to attach to the expression.</li> +<li><strong>kwargs:</strong> the arguments to set for the expression along with their respective values.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The target expression.</p> +</blockquote> +</div> + + + </div> + <div id="Parser.validate_expression" class="classattr"> + <input id="Parser.validate_expression-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">validate_expression</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">args</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Parser.validate_expression-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Parser.validate_expression"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Parser.validate_expression-846"><a href="#Parser.validate_expression-846"><span class="linenos">846</span></a> <span class="k">def</span> <span class="nf">validate_expression</span><span class="p">(</span> +</span><span id="Parser.validate_expression-847"><a href="#Parser.validate_expression-847"><span class="linenos">847</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Parser.validate_expression-848"><a href="#Parser.validate_expression-848"><span class="linenos">848</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Parser.validate_expression-849"><a href="#Parser.validate_expression-849"><span class="linenos">849</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Parser.validate_expression-850"><a href="#Parser.validate_expression-850"><span class="linenos">850</span></a><span class="sd"> Validates an already instantiated expression, making sure that all its mandatory arguments</span> +</span><span id="Parser.validate_expression-851"><a href="#Parser.validate_expression-851"><span class="linenos">851</span></a><span class="sd"> are set.</span> +</span><span id="Parser.validate_expression-852"><a href="#Parser.validate_expression-852"><span class="linenos">852</span></a> +</span><span id="Parser.validate_expression-853"><a href="#Parser.validate_expression-853"><span class="linenos">853</span></a><span class="sd"> Args:</span> +</span><span id="Parser.validate_expression-854"><a href="#Parser.validate_expression-854"><span class="linenos">854</span></a><span class="sd"> expression: the expression to validate.</span> +</span><span id="Parser.validate_expression-855"><a href="#Parser.validate_expression-855"><span class="linenos">855</span></a><span class="sd"> args: an optional list of items that was used to instantiate the expression, if it's a Func.</span> +</span><span id="Parser.validate_expression-856"><a href="#Parser.validate_expression-856"><span class="linenos">856</span></a><span class="sd"> """</span> +</span><span id="Parser.validate_expression-857"><a href="#Parser.validate_expression-857"><span class="linenos">857</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">error_level</span> <span class="o">==</span> <span class="n">ErrorLevel</span><span class="o">.</span><span class="n">IGNORE</span><span class="p">:</span> +</span><span id="Parser.validate_expression-858"><a href="#Parser.validate_expression-858"><span class="linenos">858</span></a> <span class="k">return</span> +</span><span id="Parser.validate_expression-859"><a href="#Parser.validate_expression-859"><span class="linenos">859</span></a> +</span><span id="Parser.validate_expression-860"><a href="#Parser.validate_expression-860"><span class="linenos">860</span></a> <span class="k">for</span> <span class="n">error_message</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">error_messages</span><span class="p">(</span><span class="n">args</span><span class="p">):</span> +</span><span id="Parser.validate_expression-861"><a href="#Parser.validate_expression-861"><span class="linenos">861</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="n">error_message</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Validates an already instantiated expression, making sure that all its mandatory arguments +are set.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression to validate.</li> +<li><strong>args:</strong> an optional list of items that was used to instantiate the expression, if it's a Func.</li> +</ul> +</div> + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/planner.html b/docs/sqlglot/planner.html new file mode 100644 index 0000000..7df7e4e --- /dev/null +++ b/docs/sqlglot/planner.html @@ -0,0 +1,1995 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.planner API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Plan">Plan</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Plan.__init__">Plan</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Step">Step</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Step.__init__">Step</a> + </li> + <li> + <a class="function" href="#Step.from_expression">from_expression</a> + </li> + <li> + <a class="function" href="#Step.add_dependency">add_dependency</a> + </li> + <li> + <a class="function" href="#Step.to_s">to_s</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Scan">Scan</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Scan.__init__">Scan</a> + </li> + <li> + <a class="function" href="#Scan.from_expression">from_expression</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Join">Join</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Join.__init__">Join</a> + </li> + <li> + <a class="function" href="#Join.from_joins">from_joins</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Aggregate">Aggregate</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Aggregate.__init__">Aggregate</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Sort">Sort</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Sort.__init__">Sort</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#SetOperation">SetOperation</a> + <ul class="memberlist"> + <li> + <a class="function" href="#SetOperation.__init__">SetOperation</a> + </li> + <li> + <a class="function" href="#SetOperation.from_expression">from_expression</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/planner.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.planner </h1> + + + <input id="mod-planner-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-planner-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">itertools</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">math</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">alias</span><span class="p">,</span> <span class="n">exp</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">UnsupportedError</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.optimizer.eliminate_joins</span> <span class="kn">import</span> <span class="n">join_condition</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="k">class</span> <span class="nc">Plan</span><span class="p">:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="nd">@property</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="k">def</span> <span class="nf">dag</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]:</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span><span class="p">:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="n">dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span><span class="p">}</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="k">while</span> <span class="n">nodes</span><span class="p">:</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">nodes</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">dag</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">dag</span><span class="p">[</span><span class="n">node</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">nodes</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span> <span class="o">=</span> <span class="n">dag</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="nd">@property</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">def</span> <span class="nf">leaves</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">Step</span><span class="p">]:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">return</span> <span class="p">(</span><span class="n">node</span> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">deps</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dag</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">deps</span><span class="p">)</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"Plan</span><span class="se">\n</span><span class="s2">----</span><span class="se">\n</span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a><span class="k">class</span> <span class="nc">Step</span><span class="p">:</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="nd">@classmethod</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd"> Note: the expression's tables and subqueries must be aliased for this method to work. For</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> example, given the following expression:</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> SELECT</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="sd"> x.a,</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="sd"> SUM(x.b)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> FROM x AS x</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> JOIN y AS y</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> ON x.a = y.a</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="sd"> GROUP BY x.a</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a><span class="sd"> the following DAG is produced (the expression IDs might differ per execution):</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> - Aggregate: x (4347984624)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a><span class="sd"> Context:</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a><span class="sd"> Aggregations:</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a><span class="sd"> - SUM(x.b)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a><span class="sd"> Group:</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="sd"> - x.a</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="sd"> Projections:</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a><span class="sd"> - x.a</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a><span class="sd"> - "x".""</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a><span class="sd"> Dependencies:</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="sd"> - Join: x (4347985296)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a><span class="sd"> Context:</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a><span class="sd"> y:</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a><span class="sd"> On: x.a = y.a</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a><span class="sd"> Projections:</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a><span class="sd"> Dependencies:</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a><span class="sd"> - Scan: x (4347983136)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a><span class="sd"> Context:</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a><span class="sd"> Source: x AS x</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a><span class="sd"> Projections:</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="sd"> - Scan: y (4343416624)</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a><span class="sd"> Context:</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="sd"> Source: y AS y</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="sd"> Projections:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a><span class="sd"> Args:</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a><span class="sd"> expression: the expression to build the DAG from.</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a><span class="sd"> ctes: a dictionary that maps CTEs to their corresponding Step DAG by name.</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a><span class="sd"> Returns:</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a><span class="sd"> A Step DAG corresponding to `expression`.</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a><span class="sd"> """</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">ctes</span> <span class="o">=</span> <span class="n">ctes</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="c1"># CTEs break the mold of scope and introduce themselves to all in the context.</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">ctes</span> <span class="o">=</span> <span class="n">ctes</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">ctes</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">step</span> <span class="c1"># type: ignore</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">from_</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="s2">"Multi-from statements are unsupported. Run it through the optimizer"</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">from_</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">SetOperation</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="p">()</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">if</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">Join</span><span class="o">.</span><span class="n">from_joins</span><span class="p">(</span><span class="n">joins</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="n">join</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="n">join</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">join</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># final selects in this chain of steps representing a select</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="p">{}</span> <span class="c1"># intermediate computations of agg funcs eg x + 1 in SUM(x + 1)</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">aggregations</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="k">def</span> <span class="nf">extract_agg_operands</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="k">for</span> <span class="n">agg</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">for</span> <span class="n">operand</span> <span class="ow">in</span> <span class="n">agg</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">():</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">operand</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">continue</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="k">if</span> <span class="n">operand</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">operands</span><span class="p">:</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">operands</span><span class="p">[</span><span class="n">operand</span><span class="p">]</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"_a_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">operand</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">operands</span><span class="p">[</span><span class="n">operand</span><span class="p">],</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">projections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">aggregations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">extract_agg_operands</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">projections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="n">step</span><span class="o">.</span><span class="n">condition</span> <span class="o">=</span> <span class="n">where</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="k">if</span> <span class="n">group</span> <span class="ow">or</span> <span class="n">aggregations</span><span class="p">:</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">aggregate</span> <span class="o">=</span> <span class="n">Aggregate</span><span class="p">()</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="n">having</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"having"</span><span class="p">)</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="k">if</span> <span class="n">having</span><span class="p">:</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">extract_agg_operands</span><span class="p">(</span><span class="n">having</span><span class="p">)</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">condition</span> <span class="o">=</span> <span class="n">having</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">operands</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">alias</span><span class="p">(</span><span class="n">operand</span><span class="p">,</span> <span class="n">alias_</span><span class="p">)</span> <span class="k">for</span> <span class="n">operand</span><span class="p">,</span> <span class="n">alias_</span> <span class="ow">in</span> <span class="n">operands</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="p">)</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">aggregations</span> <span class="o">=</span> <span class="n">aggregations</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="c1"># give aggregates names and replace projections with references to them</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">group</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="sa">f</span><span class="s2">"_g</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">e</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">group</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">group</span> <span class="k">else</span> <span class="p">[])</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="p">}</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="k">for</span> <span class="n">projection</span> <span class="ow">in</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">aggregate</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">for</span> <span class="n">child</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">projection</span><span class="o">.</span><span class="n">walk</span><span class="p">():</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="k">if</span> <span class="n">child</span> <span class="o">==</span> <span class="n">e</span><span class="p">:</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">child</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">aggregate</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="k">if</span> <span class="n">order</span><span class="p">:</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">sort</span> <span class="o">=</span> <span class="n">Sort</span><span class="p">()</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">order</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">sort</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="n">step</span><span class="o">.</span><span class="n">projections</span> <span class="o">=</span> <span class="n">projections</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">):</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="n">Aggregate</span><span class="p">()</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">group</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">col</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">projections</span> <span class="ow">or</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="p">}</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">distinct</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"limit"</span><span class="p">)</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">if</span> <span class="n">limit</span><span class="p">:</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="n">step</span><span class="o">.</span><span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">limit</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">))</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependents</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">inf</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="k">def</span> <span class="nf">add_dependency</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dependency</span><span class="p">:</span> <span class="n">Step</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dependency</span><span class="p">)</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="n">dependency</span><span class="o">.</span><span class="n">dependents</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">to_s</span><span class="p">()</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="k">def</span> <span class="nf">to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">indent</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">*</span> <span class="n">level</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> "</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_s</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2"> "</span><span class="p">)</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="k">if</span> <span class="n">context</span><span class="p">:</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="n">context</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Context:"</span><span class="p">]</span> <span class="o">+</span> <span class="n">context</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">- </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="o">*</span><span class="n">context</span><span class="p">,</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Projections:"</span><span class="p">,</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="p">]</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Condition: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">limit</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">math</span><span class="o">.</span><span class="n">inf</span><span class="p">:</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Limit: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Dependencies:"</span><span class="p">)</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">dependency</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">" "</span> <span class="o">+</span> <span class="n">dependency</span><span class="o">.</span><span class="n">to_s</span><span class="p">(</span><span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="nd">@property</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="k">def</span> <span class="nf">type_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="nd">@property</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="k">def</span> <span class="nf">id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">type_name</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="nb">id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a><span class="k">class</span> <span class="nc">Scan</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="nd">@classmethod</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="p">()</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="n">step</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="k">if</span> <span class="n">ctes</span> <span class="ow">and</span> <span class="n">table</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">ctes</span><span class="p">:</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">ctes</span><span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">name</span><span class="p">])</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="k">return</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Source: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'-static-'</span><span class="si">}</span><span class="s2">"</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a><span class="k">class</span> <span class="nc">Join</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="nd">@classmethod</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="k">def</span> <span class="nf">from_joins</span><span class="p">(</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">joins</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">],</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Join</span><span class="p">()</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="n">source_key</span><span class="p">,</span> <span class="n">join_key</span><span class="p">,</span> <span class="n">condition</span> <span class="o">=</span> <span class="n">join_condition</span><span class="p">(</span><span class="n">join</span><span class="p">)</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="n">step</span><span class="o">.</span><span class="n">joins</span><span class="p">[</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="n">join</span><span class="o">.</span><span class="n">side</span><span class="p">,</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="s2">"join_key"</span><span class="p">:</span> <span class="n">join_key</span><span class="p">,</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="s2">"source_key"</span><span class="p">:</span> <span class="n">source_key</span><span class="p">,</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="s2">"condition"</span><span class="p">:</span> <span class="n">condition</span><span class="p">,</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="p">}</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">Scan</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">ctes</span><span class="p">))</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">joins</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}{</span><span class="n">name</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">join</span><span class="p">[</span><span class="s1">'side'</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"condition"</span><span class="p">):</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">On: </span><span class="si">{</span><span class="n">join</span><span class="p">[</span><span class="s1">'condition'</span><span class="p">]</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="k">return</span> <span class="n">lines</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a><span class="k">class</span> <span class="nc">Aggregate</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">aggregations</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">()</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Aggregations:"</span><span class="p">]</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">aggregations</span><span class="p">:</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="p">:</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Group:"</span><span class="p">)</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Having:"</span><span class="p">)</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Operands:"</span><span class="p">)</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="k">return</span> <span class="n">lines</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a><span class="k">class</span> <span class="nc">Sort</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Key:"</span><span class="p">]</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="k">return</span> <span class="n">lines</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a><span class="k">class</span> <span class="nc">SetOperation</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="n">op</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="n">left</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="n">distinct</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">op</span> <span class="o">=</span> <span class="n">op</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">left</span> <span class="o">=</span> <span class="n">left</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">right</span> <span class="o">=</span> <span class="n">right</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span> <span class="o">=</span> <span class="n">distinct</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="nd">@classmethod</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="n">step</span> <span class="o">=</span> <span class="bp">cls</span><span class="p">(</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="n">op</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="n">left</span><span class="o">=</span><span class="n">left</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="n">right</span><span class="o">=</span><span class="n">right</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="n">distinct</span><span class="o">=</span><span class="nb">bool</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)),</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="p">)</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos">409</span></a> +</span><span id="L-410"><a href="#L-410"><span class="linenos">410</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos">411</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos">412</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span><span class="p">:</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos">413</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Distinct: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">distinct</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos">414</span></a> <span class="k">return</span> <span class="n">lines</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos">415</span></a> +</span><span id="L-416"><a href="#L-416"><span class="linenos">416</span></a> <span class="nd">@property</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos">417</span></a> <span class="k">def</span> <span class="nf">type_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos">418</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op</span><span class="o">.</span><span class="vm">__name__</span> +</span></pre></div> + + + </section> + <section id="Plan"> + <input id="Plan-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Plan</span>: + + <label class="view-source-button" for="Plan-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Plan"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Plan-13"><a href="#Plan-13"><span class="linenos">13</span></a><span class="k">class</span> <span class="nc">Plan</span><span class="p">:</span> +</span><span id="Plan-14"><a href="#Plan-14"><span class="linenos">14</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Plan-15"><a href="#Plan-15"><span class="linenos">15</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Plan-16"><a href="#Plan-16"><span class="linenos">16</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Plan-17"><a href="#Plan-17"><span class="linenos">17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Plan-18"><a href="#Plan-18"><span class="linenos">18</span></a> +</span><span id="Plan-19"><a href="#Plan-19"><span class="linenos">19</span></a> <span class="nd">@property</span> +</span><span id="Plan-20"><a href="#Plan-20"><span class="linenos">20</span></a> <span class="k">def</span> <span class="nf">dag</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]:</span> +</span><span id="Plan-21"><a href="#Plan-21"><span class="linenos">21</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span><span class="p">:</span> +</span><span id="Plan-22"><a href="#Plan-22"><span class="linenos">22</span></a> <span class="n">dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Plan-23"><a href="#Plan-23"><span class="linenos">23</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="p">{</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span><span class="p">}</span> +</span><span id="Plan-24"><a href="#Plan-24"><span class="linenos">24</span></a> +</span><span id="Plan-25"><a href="#Plan-25"><span class="linenos">25</span></a> <span class="k">while</span> <span class="n">nodes</span><span class="p">:</span> +</span><span id="Plan-26"><a href="#Plan-26"><span class="linenos">26</span></a> <span class="n">node</span> <span class="o">=</span> <span class="n">nodes</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="Plan-27"><a href="#Plan-27"><span class="linenos">27</span></a> <span class="n">dag</span><span class="p">[</span><span class="n">node</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Plan-28"><a href="#Plan-28"><span class="linenos">28</span></a> <span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="Plan-29"><a href="#Plan-29"><span class="linenos">29</span></a> <span class="n">dag</span><span class="p">[</span><span class="n">node</span><span class="p">]</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="Plan-30"><a href="#Plan-30"><span class="linenos">30</span></a> <span class="n">nodes</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dep</span><span class="p">)</span> +</span><span id="Plan-31"><a href="#Plan-31"><span class="linenos">31</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span> <span class="o">=</span> <span class="n">dag</span> +</span><span id="Plan-32"><a href="#Plan-32"><span class="linenos">32</span></a> +</span><span id="Plan-33"><a href="#Plan-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span> +</span><span id="Plan-34"><a href="#Plan-34"><span class="linenos">34</span></a> +</span><span id="Plan-35"><a href="#Plan-35"><span class="linenos">35</span></a> <span class="nd">@property</span> +</span><span id="Plan-36"><a href="#Plan-36"><span class="linenos">36</span></a> <span class="k">def</span> <span class="nf">leaves</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Iterator</span><span class="p">[</span><span class="n">Step</span><span class="p">]:</span> +</span><span id="Plan-37"><a href="#Plan-37"><span class="linenos">37</span></a> <span class="k">return</span> <span class="p">(</span><span class="n">node</span> <span class="k">for</span> <span class="n">node</span><span class="p">,</span> <span class="n">deps</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dag</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">deps</span><span class="p">)</span> +</span><span id="Plan-38"><a href="#Plan-38"><span class="linenos">38</span></a> +</span><span id="Plan-39"><a href="#Plan-39"><span class="linenos">39</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Plan-40"><a href="#Plan-40"><span class="linenos">40</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"Plan</span><span class="se">\n</span><span class="s2">----</span><span class="se">\n</span><span class="si">{</span><span class="nb">repr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">root</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span></pre></div> + + + + + <div id="Plan.__init__" class="classattr"> + <input id="Plan.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Plan</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span>)</span> + + <label class="view-source-button" for="Plan.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Plan.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Plan.__init__-14"><a href="#Plan.__init__-14"><span class="linenos">14</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Plan.__init__-15"><a href="#Plan.__init__-15"><span class="linenos">15</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Plan.__init__-16"><a href="#Plan.__init__-16"><span class="linenos">16</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">root</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">)</span> +</span><span id="Plan.__init__-17"><a href="#Plan.__init__-17"><span class="linenos">17</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_dag</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="n">Step</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span></pre></div> + + + + + </div> + </section> + <section id="Step"> + <input id="Step-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Step</span>: + + <label class="view-source-button" for="Step-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Step"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Step-43"><a href="#Step-43"><span class="linenos"> 43</span></a><span class="k">class</span> <span class="nc">Step</span><span class="p">:</span> +</span><span id="Step-44"><a href="#Step-44"><span class="linenos"> 44</span></a> <span class="nd">@classmethod</span> +</span><span id="Step-45"><a href="#Step-45"><span class="linenos"> 45</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="Step-46"><a href="#Step-46"><span class="linenos"> 46</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Step-47"><a href="#Step-47"><span class="linenos"> 47</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="Step-48"><a href="#Step-48"><span class="linenos"> 48</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Step-49"><a href="#Step-49"><span class="linenos"> 49</span></a><span class="sd"> Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.</span> +</span><span id="Step-50"><a href="#Step-50"><span class="linenos"> 50</span></a><span class="sd"> Note: the expression's tables and subqueries must be aliased for this method to work. For</span> +</span><span id="Step-51"><a href="#Step-51"><span class="linenos"> 51</span></a><span class="sd"> example, given the following expression:</span> +</span><span id="Step-52"><a href="#Step-52"><span class="linenos"> 52</span></a> +</span><span id="Step-53"><a href="#Step-53"><span class="linenos"> 53</span></a><span class="sd"> SELECT</span> +</span><span id="Step-54"><a href="#Step-54"><span class="linenos"> 54</span></a><span class="sd"> x.a,</span> +</span><span id="Step-55"><a href="#Step-55"><span class="linenos"> 55</span></a><span class="sd"> SUM(x.b)</span> +</span><span id="Step-56"><a href="#Step-56"><span class="linenos"> 56</span></a><span class="sd"> FROM x AS x</span> +</span><span id="Step-57"><a href="#Step-57"><span class="linenos"> 57</span></a><span class="sd"> JOIN y AS y</span> +</span><span id="Step-58"><a href="#Step-58"><span class="linenos"> 58</span></a><span class="sd"> ON x.a = y.a</span> +</span><span id="Step-59"><a href="#Step-59"><span class="linenos"> 59</span></a><span class="sd"> GROUP BY x.a</span> +</span><span id="Step-60"><a href="#Step-60"><span class="linenos"> 60</span></a> +</span><span id="Step-61"><a href="#Step-61"><span class="linenos"> 61</span></a><span class="sd"> the following DAG is produced (the expression IDs might differ per execution):</span> +</span><span id="Step-62"><a href="#Step-62"><span class="linenos"> 62</span></a> +</span><span id="Step-63"><a href="#Step-63"><span class="linenos"> 63</span></a><span class="sd"> - Aggregate: x (4347984624)</span> +</span><span id="Step-64"><a href="#Step-64"><span class="linenos"> 64</span></a><span class="sd"> Context:</span> +</span><span id="Step-65"><a href="#Step-65"><span class="linenos"> 65</span></a><span class="sd"> Aggregations:</span> +</span><span id="Step-66"><a href="#Step-66"><span class="linenos"> 66</span></a><span class="sd"> - SUM(x.b)</span> +</span><span id="Step-67"><a href="#Step-67"><span class="linenos"> 67</span></a><span class="sd"> Group:</span> +</span><span id="Step-68"><a href="#Step-68"><span class="linenos"> 68</span></a><span class="sd"> - x.a</span> +</span><span id="Step-69"><a href="#Step-69"><span class="linenos"> 69</span></a><span class="sd"> Projections:</span> +</span><span id="Step-70"><a href="#Step-70"><span class="linenos"> 70</span></a><span class="sd"> - x.a</span> +</span><span id="Step-71"><a href="#Step-71"><span class="linenos"> 71</span></a><span class="sd"> - "x".""</span> +</span><span id="Step-72"><a href="#Step-72"><span class="linenos"> 72</span></a><span class="sd"> Dependencies:</span> +</span><span id="Step-73"><a href="#Step-73"><span class="linenos"> 73</span></a><span class="sd"> - Join: x (4347985296)</span> +</span><span id="Step-74"><a href="#Step-74"><span class="linenos"> 74</span></a><span class="sd"> Context:</span> +</span><span id="Step-75"><a href="#Step-75"><span class="linenos"> 75</span></a><span class="sd"> y:</span> +</span><span id="Step-76"><a href="#Step-76"><span class="linenos"> 76</span></a><span class="sd"> On: x.a = y.a</span> +</span><span id="Step-77"><a href="#Step-77"><span class="linenos"> 77</span></a><span class="sd"> Projections:</span> +</span><span id="Step-78"><a href="#Step-78"><span class="linenos"> 78</span></a><span class="sd"> Dependencies:</span> +</span><span id="Step-79"><a href="#Step-79"><span class="linenos"> 79</span></a><span class="sd"> - Scan: x (4347983136)</span> +</span><span id="Step-80"><a href="#Step-80"><span class="linenos"> 80</span></a><span class="sd"> Context:</span> +</span><span id="Step-81"><a href="#Step-81"><span class="linenos"> 81</span></a><span class="sd"> Source: x AS x</span> +</span><span id="Step-82"><a href="#Step-82"><span class="linenos"> 82</span></a><span class="sd"> Projections:</span> +</span><span id="Step-83"><a href="#Step-83"><span class="linenos"> 83</span></a><span class="sd"> - Scan: y (4343416624)</span> +</span><span id="Step-84"><a href="#Step-84"><span class="linenos"> 84</span></a><span class="sd"> Context:</span> +</span><span id="Step-85"><a href="#Step-85"><span class="linenos"> 85</span></a><span class="sd"> Source: y AS y</span> +</span><span id="Step-86"><a href="#Step-86"><span class="linenos"> 86</span></a><span class="sd"> Projections:</span> +</span><span id="Step-87"><a href="#Step-87"><span class="linenos"> 87</span></a> +</span><span id="Step-88"><a href="#Step-88"><span class="linenos"> 88</span></a><span class="sd"> Args:</span> +</span><span id="Step-89"><a href="#Step-89"><span class="linenos"> 89</span></a><span class="sd"> expression: the expression to build the DAG from.</span> +</span><span id="Step-90"><a href="#Step-90"><span class="linenos"> 90</span></a><span class="sd"> ctes: a dictionary that maps CTEs to their corresponding Step DAG by name.</span> +</span><span id="Step-91"><a href="#Step-91"><span class="linenos"> 91</span></a> +</span><span id="Step-92"><a href="#Step-92"><span class="linenos"> 92</span></a><span class="sd"> Returns:</span> +</span><span id="Step-93"><a href="#Step-93"><span class="linenos"> 93</span></a><span class="sd"> A Step DAG corresponding to `expression`.</span> +</span><span id="Step-94"><a href="#Step-94"><span class="linenos"> 94</span></a><span class="sd"> """</span> +</span><span id="Step-95"><a href="#Step-95"><span class="linenos"> 95</span></a> <span class="n">ctes</span> <span class="o">=</span> <span class="n">ctes</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="Step-96"><a href="#Step-96"><span class="linenos"> 96</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="Step-97"><a href="#Step-97"><span class="linenos"> 97</span></a> +</span><span id="Step-98"><a href="#Step-98"><span class="linenos"> 98</span></a> <span class="c1"># CTEs break the mold of scope and introduce themselves to all in the context.</span> +</span><span id="Step-99"><a href="#Step-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="Step-100"><a href="#Step-100"><span class="linenos">100</span></a> <span class="n">ctes</span> <span class="o">=</span> <span class="n">ctes</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Step-101"><a href="#Step-101"><span class="linenos">101</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Step-102"><a href="#Step-102"><span class="linenos">102</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step-103"><a href="#Step-103"><span class="linenos">103</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias</span> +</span><span id="Step-104"><a href="#Step-104"><span class="linenos">104</span></a> <span class="n">ctes</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">step</span> <span class="c1"># type: ignore</span> +</span><span id="Step-105"><a href="#Step-105"><span class="linenos">105</span></a> +</span><span id="Step-106"><a href="#Step-106"><span class="linenos">106</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="Step-107"><a href="#Step-107"><span class="linenos">107</span></a> +</span><span id="Step-108"><a href="#Step-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="Step-109"><a href="#Step-109"><span class="linenos">109</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Step-110"><a href="#Step-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">from_</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Step-111"><a href="#Step-111"><span class="linenos">111</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span> +</span><span id="Step-112"><a href="#Step-112"><span class="linenos">112</span></a> <span class="s2">"Multi-from statements are unsupported. Run it through the optimizer"</span> +</span><span id="Step-113"><a href="#Step-113"><span class="linenos">113</span></a> <span class="p">)</span> +</span><span id="Step-114"><a href="#Step-114"><span class="linenos">114</span></a> +</span><span id="Step-115"><a href="#Step-115"><span class="linenos">115</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">from_</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step-116"><a href="#Step-116"><span class="linenos">116</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="Step-117"><a href="#Step-117"><span class="linenos">117</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">SetOperation</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step-118"><a href="#Step-118"><span class="linenos">118</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Step-119"><a href="#Step-119"><span class="linenos">119</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="p">()</span> +</span><span id="Step-120"><a href="#Step-120"><span class="linenos">120</span></a> +</span><span id="Step-121"><a href="#Step-121"><span class="linenos">121</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> +</span><span id="Step-122"><a href="#Step-122"><span class="linenos">122</span></a> +</span><span id="Step-123"><a href="#Step-123"><span class="linenos">123</span></a> <span class="k">if</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="Step-124"><a href="#Step-124"><span class="linenos">124</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">Join</span><span class="o">.</span><span class="n">from_joins</span><span class="p">(</span><span class="n">joins</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step-125"><a href="#Step-125"><span class="linenos">125</span></a> <span class="n">join</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-126"><a href="#Step-126"><span class="linenos">126</span></a> <span class="n">join</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step-127"><a href="#Step-127"><span class="linenos">127</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">join</span> +</span><span id="Step-128"><a href="#Step-128"><span class="linenos">128</span></a> +</span><span id="Step-129"><a href="#Step-129"><span class="linenos">129</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># final selects in this chain of steps representing a select</span> +</span><span id="Step-130"><a href="#Step-130"><span class="linenos">130</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="p">{}</span> <span class="c1"># intermediate computations of agg funcs eg x + 1 in SUM(x + 1)</span> +</span><span id="Step-131"><a href="#Step-131"><span class="linenos">131</span></a> <span class="n">aggregations</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Step-132"><a href="#Step-132"><span class="linenos">132</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="Step-133"><a href="#Step-133"><span class="linenos">133</span></a> +</span><span id="Step-134"><a href="#Step-134"><span class="linenos">134</span></a> <span class="k">def</span> <span class="nf">extract_agg_operands</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="Step-135"><a href="#Step-135"><span class="linenos">135</span></a> <span class="k">for</span> <span class="n">agg</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Step-136"><a href="#Step-136"><span class="linenos">136</span></a> <span class="k">for</span> <span class="n">operand</span> <span class="ow">in</span> <span class="n">agg</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">():</span> +</span><span id="Step-137"><a href="#Step-137"><span class="linenos">137</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">operand</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="Step-138"><a href="#Step-138"><span class="linenos">138</span></a> <span class="k">continue</span> +</span><span id="Step-139"><a href="#Step-139"><span class="linenos">139</span></a> <span class="k">if</span> <span class="n">operand</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">operands</span><span class="p">:</span> +</span><span id="Step-140"><a href="#Step-140"><span class="linenos">140</span></a> <span class="n">operands</span><span class="p">[</span><span class="n">operand</span><span class="p">]</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"_a_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Step-141"><a href="#Step-141"><span class="linenos">141</span></a> <span class="n">operand</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">operands</span><span class="p">[</span><span class="n">operand</span><span class="p">],</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Step-142"><a href="#Step-142"><span class="linenos">142</span></a> +</span><span id="Step-143"><a href="#Step-143"><span class="linenos">143</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Step-144"><a href="#Step-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Step-145"><a href="#Step-145"><span class="linenos">145</span></a> <span class="n">projections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Step-146"><a href="#Step-146"><span class="linenos">146</span></a> <span class="n">aggregations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Step-147"><a href="#Step-147"><span class="linenos">147</span></a> <span class="n">extract_agg_operands</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Step-148"><a href="#Step-148"><span class="linenos">148</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Step-149"><a href="#Step-149"><span class="linenos">149</span></a> <span class="n">projections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Step-150"><a href="#Step-150"><span class="linenos">150</span></a> +</span><span id="Step-151"><a href="#Step-151"><span class="linenos">151</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="Step-152"><a href="#Step-152"><span class="linenos">152</span></a> +</span><span id="Step-153"><a href="#Step-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="Step-154"><a href="#Step-154"><span class="linenos">154</span></a> <span class="n">step</span><span class="o">.</span><span class="n">condition</span> <span class="o">=</span> <span class="n">where</span><span class="o">.</span><span class="n">this</span> +</span><span id="Step-155"><a href="#Step-155"><span class="linenos">155</span></a> +</span><span id="Step-156"><a href="#Step-156"><span class="linenos">156</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="Step-157"><a href="#Step-157"><span class="linenos">157</span></a> +</span><span id="Step-158"><a href="#Step-158"><span class="linenos">158</span></a> <span class="k">if</span> <span class="n">group</span> <span class="ow">or</span> <span class="n">aggregations</span><span class="p">:</span> +</span><span id="Step-159"><a href="#Step-159"><span class="linenos">159</span></a> <span class="n">aggregate</span> <span class="o">=</span> <span class="n">Aggregate</span><span class="p">()</span> +</span><span id="Step-160"><a href="#Step-160"><span class="linenos">160</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-161"><a href="#Step-161"><span class="linenos">161</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-162"><a href="#Step-162"><span class="linenos">162</span></a> +</span><span id="Step-163"><a href="#Step-163"><span class="linenos">163</span></a> <span class="n">having</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"having"</span><span class="p">)</span> +</span><span id="Step-164"><a href="#Step-164"><span class="linenos">164</span></a> +</span><span id="Step-165"><a href="#Step-165"><span class="linenos">165</span></a> <span class="k">if</span> <span class="n">having</span><span class="p">:</span> +</span><span id="Step-166"><a href="#Step-166"><span class="linenos">166</span></a> <span class="n">extract_agg_operands</span><span class="p">(</span><span class="n">having</span><span class="p">)</span> +</span><span id="Step-167"><a href="#Step-167"><span class="linenos">167</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">condition</span> <span class="o">=</span> <span class="n">having</span><span class="o">.</span><span class="n">this</span> +</span><span id="Step-168"><a href="#Step-168"><span class="linenos">168</span></a> +</span><span id="Step-169"><a href="#Step-169"><span class="linenos">169</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">operands</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="Step-170"><a href="#Step-170"><span class="linenos">170</span></a> <span class="n">alias</span><span class="p">(</span><span class="n">operand</span><span class="p">,</span> <span class="n">alias_</span><span class="p">)</span> <span class="k">for</span> <span class="n">operand</span><span class="p">,</span> <span class="n">alias_</span> <span class="ow">in</span> <span class="n">operands</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Step-171"><a href="#Step-171"><span class="linenos">171</span></a> <span class="p">)</span> +</span><span id="Step-172"><a href="#Step-172"><span class="linenos">172</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">aggregations</span> <span class="o">=</span> <span class="n">aggregations</span> +</span><span id="Step-173"><a href="#Step-173"><span class="linenos">173</span></a> <span class="c1"># give aggregates names and replace projections with references to them</span> +</span><span id="Step-174"><a href="#Step-174"><span class="linenos">174</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">group</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Step-175"><a href="#Step-175"><span class="linenos">175</span></a> <span class="sa">f</span><span class="s2">"_g</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">e</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">group</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">group</span> <span class="k">else</span> <span class="p">[])</span> +</span><span id="Step-176"><a href="#Step-176"><span class="linenos">176</span></a> <span class="p">}</span> +</span><span id="Step-177"><a href="#Step-177"><span class="linenos">177</span></a> <span class="k">for</span> <span class="n">projection</span> <span class="ow">in</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="Step-178"><a href="#Step-178"><span class="linenos">178</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">aggregate</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Step-179"><a href="#Step-179"><span class="linenos">179</span></a> <span class="k">for</span> <span class="n">child</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">projection</span><span class="o">.</span><span class="n">walk</span><span class="p">():</span> +</span><span id="Step-180"><a href="#Step-180"><span class="linenos">180</span></a> <span class="k">if</span> <span class="n">child</span> <span class="o">==</span> <span class="n">e</span><span class="p">:</span> +</span><span id="Step-181"><a href="#Step-181"><span class="linenos">181</span></a> <span class="n">child</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> +</span><span id="Step-182"><a href="#Step-182"><span class="linenos">182</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step-183"><a href="#Step-183"><span class="linenos">183</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">aggregate</span> +</span><span id="Step-184"><a href="#Step-184"><span class="linenos">184</span></a> +</span><span id="Step-185"><a href="#Step-185"><span class="linenos">185</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="Step-186"><a href="#Step-186"><span class="linenos">186</span></a> +</span><span id="Step-187"><a href="#Step-187"><span class="linenos">187</span></a> <span class="k">if</span> <span class="n">order</span><span class="p">:</span> +</span><span id="Step-188"><a href="#Step-188"><span class="linenos">188</span></a> <span class="n">sort</span> <span class="o">=</span> <span class="n">Sort</span><span class="p">()</span> +</span><span id="Step-189"><a href="#Step-189"><span class="linenos">189</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-190"><a href="#Step-190"><span class="linenos">190</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">order</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Step-191"><a href="#Step-191"><span class="linenos">191</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step-192"><a href="#Step-192"><span class="linenos">192</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">sort</span> +</span><span id="Step-193"><a href="#Step-193"><span class="linenos">193</span></a> +</span><span id="Step-194"><a href="#Step-194"><span class="linenos">194</span></a> <span class="n">step</span><span class="o">.</span><span class="n">projections</span> <span class="o">=</span> <span class="n">projections</span> +</span><span id="Step-195"><a href="#Step-195"><span class="linenos">195</span></a> +</span><span id="Step-196"><a href="#Step-196"><span class="linenos">196</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">):</span> +</span><span id="Step-197"><a href="#Step-197"><span class="linenos">197</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="n">Aggregate</span><span class="p">()</span> +</span><span id="Step-198"><a href="#Step-198"><span class="linenos">198</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-199"><a href="#Step-199"><span class="linenos">199</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-200"><a href="#Step-200"><span class="linenos">200</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">group</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Step-201"><a href="#Step-201"><span class="linenos">201</span></a> <span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">col</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="Step-202"><a href="#Step-202"><span class="linenos">202</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">projections</span> <span class="ow">or</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Step-203"><a href="#Step-203"><span class="linenos">203</span></a> <span class="p">}</span> +</span><span id="Step-204"><a href="#Step-204"><span class="linenos">204</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step-205"><a href="#Step-205"><span class="linenos">205</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">distinct</span> +</span><span id="Step-206"><a href="#Step-206"><span class="linenos">206</span></a> +</span><span id="Step-207"><a href="#Step-207"><span class="linenos">207</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"limit"</span><span class="p">)</span> +</span><span id="Step-208"><a href="#Step-208"><span class="linenos">208</span></a> +</span><span id="Step-209"><a href="#Step-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="n">limit</span><span class="p">:</span> +</span><span id="Step-210"><a href="#Step-210"><span class="linenos">210</span></a> <span class="n">step</span><span class="o">.</span><span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">limit</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">))</span> +</span><span id="Step-211"><a href="#Step-211"><span class="linenos">211</span></a> +</span><span id="Step-212"><a href="#Step-212"><span class="linenos">212</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="Step-213"><a href="#Step-213"><span class="linenos">213</span></a> +</span><span id="Step-214"><a href="#Step-214"><span class="linenos">214</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Step-215"><a href="#Step-215"><span class="linenos">215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Step-216"><a href="#Step-216"><span class="linenos">216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Step-217"><a href="#Step-217"><span class="linenos">217</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependents</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Step-218"><a href="#Step-218"><span class="linenos">218</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Step-219"><a href="#Step-219"><span class="linenos">219</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">inf</span> +</span><span id="Step-220"><a href="#Step-220"><span class="linenos">220</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Step-221"><a href="#Step-221"><span class="linenos">221</span></a> +</span><span id="Step-222"><a href="#Step-222"><span class="linenos">222</span></a> <span class="k">def</span> <span class="nf">add_dependency</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dependency</span><span class="p">:</span> <span class="n">Step</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Step-223"><a href="#Step-223"><span class="linenos">223</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dependency</span><span class="p">)</span> +</span><span id="Step-224"><a href="#Step-224"><span class="linenos">224</span></a> <span class="n">dependency</span><span class="o">.</span><span class="n">dependents</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span><span id="Step-225"><a href="#Step-225"><span class="linenos">225</span></a> +</span><span id="Step-226"><a href="#Step-226"><span class="linenos">226</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Step-227"><a href="#Step-227"><span class="linenos">227</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">to_s</span><span class="p">()</span> +</span><span id="Step-228"><a href="#Step-228"><span class="linenos">228</span></a> +</span><span id="Step-229"><a href="#Step-229"><span class="linenos">229</span></a> <span class="k">def</span> <span class="nf">to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Step-230"><a href="#Step-230"><span class="linenos">230</span></a> <span class="n">indent</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">*</span> <span class="n">level</span> +</span><span id="Step-231"><a href="#Step-231"><span class="linenos">231</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> "</span> +</span><span id="Step-232"><a href="#Step-232"><span class="linenos">232</span></a> +</span><span id="Step-233"><a href="#Step-233"><span class="linenos">233</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_s</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2"> "</span><span class="p">)</span> +</span><span id="Step-234"><a href="#Step-234"><span class="linenos">234</span></a> +</span><span id="Step-235"><a href="#Step-235"><span class="linenos">235</span></a> <span class="k">if</span> <span class="n">context</span><span class="p">:</span> +</span><span id="Step-236"><a href="#Step-236"><span class="linenos">236</span></a> <span class="n">context</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Context:"</span><span class="p">]</span> <span class="o">+</span> <span class="n">context</span> +</span><span id="Step-237"><a href="#Step-237"><span class="linenos">237</span></a> +</span><span id="Step-238"><a href="#Step-238"><span class="linenos">238</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Step-239"><a href="#Step-239"><span class="linenos">239</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">- </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Step-240"><a href="#Step-240"><span class="linenos">240</span></a> <span class="o">*</span><span class="n">context</span><span class="p">,</span> +</span><span id="Step-241"><a href="#Step-241"><span class="linenos">241</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Projections:"</span><span class="p">,</span> +</span><span id="Step-242"><a href="#Step-242"><span class="linenos">242</span></a> <span class="p">]</span> +</span><span id="Step-243"><a href="#Step-243"><span class="linenos">243</span></a> +</span><span id="Step-244"><a href="#Step-244"><span class="linenos">244</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> +</span><span id="Step-245"><a href="#Step-245"><span class="linenos">245</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Step-246"><a href="#Step-246"><span class="linenos">246</span></a> +</span><span id="Step-247"><a href="#Step-247"><span class="linenos">247</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> +</span><span id="Step-248"><a href="#Step-248"><span class="linenos">248</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Condition: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Step-249"><a href="#Step-249"><span class="linenos">249</span></a> +</span><span id="Step-250"><a href="#Step-250"><span class="linenos">250</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">limit</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">math</span><span class="o">.</span><span class="n">inf</span><span class="p">:</span> +</span><span id="Step-251"><a href="#Step-251"><span class="linenos">251</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Limit: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Step-252"><a href="#Step-252"><span class="linenos">252</span></a> +</span><span id="Step-253"><a href="#Step-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="Step-254"><a href="#Step-254"><span class="linenos">254</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Dependencies:"</span><span class="p">)</span> +</span><span id="Step-255"><a href="#Step-255"><span class="linenos">255</span></a> <span class="k">for</span> <span class="n">dependency</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="Step-256"><a href="#Step-256"><span class="linenos">256</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">" "</span> <span class="o">+</span> <span class="n">dependency</span><span class="o">.</span><span class="n">to_s</span><span class="p">(</span><span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="Step-257"><a href="#Step-257"><span class="linenos">257</span></a> +</span><span id="Step-258"><a href="#Step-258"><span class="linenos">258</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span><span id="Step-259"><a href="#Step-259"><span class="linenos">259</span></a> +</span><span id="Step-260"><a href="#Step-260"><span class="linenos">260</span></a> <span class="nd">@property</span> +</span><span id="Step-261"><a href="#Step-261"><span class="linenos">261</span></a> <span class="k">def</span> <span class="nf">type_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Step-262"><a href="#Step-262"><span class="linenos">262</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__name__</span> +</span><span id="Step-263"><a href="#Step-263"><span class="linenos">263</span></a> +</span><span id="Step-264"><a href="#Step-264"><span class="linenos">264</span></a> <span class="nd">@property</span> +</span><span id="Step-265"><a href="#Step-265"><span class="linenos">265</span></a> <span class="k">def</span> <span class="nf">id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Step-266"><a href="#Step-266"><span class="linenos">266</span></a> <span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step-267"><a href="#Step-267"><span class="linenos">267</span></a> <span class="n">name</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" </span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">name</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Step-268"><a href="#Step-268"><span class="linenos">268</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">type_name</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="nb">id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Step-269"><a href="#Step-269"><span class="linenos">269</span></a> +</span><span id="Step-270"><a href="#Step-270"><span class="linenos">270</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">_indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Step-271"><a href="#Step-271"><span class="linenos">271</span></a> <span class="k">return</span> <span class="p">[]</span> +</span></pre></div> + + + + + <div id="Step.__init__" class="classattr"> + <input id="Step.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Step</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="Step.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Step.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Step.__init__-214"><a href="#Step.__init__-214"><span class="linenos">214</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Step.__init__-215"><a href="#Step.__init__-215"><span class="linenos">215</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Step.__init__-216"><a href="#Step.__init__-216"><span class="linenos">216</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Step.__init__-217"><a href="#Step.__init__-217"><span class="linenos">217</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependents</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="n">Step</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Step.__init__-218"><a href="#Step.__init__-218"><span class="linenos">218</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Step.__init__-219"><a href="#Step.__init__-219"><span class="linenos">219</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">limit</span><span class="p">:</span> <span class="nb">float</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">inf</span> +</span><span id="Step.__init__-220"><a href="#Step.__init__-220"><span class="linenos">220</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div id="Step.from_expression" class="classattr"> + <input id="Step.from_expression-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_expression</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">ctes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span>:</span></span> + + <label class="view-source-button" for="Step.from_expression-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Step.from_expression"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Step.from_expression-44"><a href="#Step.from_expression-44"><span class="linenos"> 44</span></a> <span class="nd">@classmethod</span> +</span><span id="Step.from_expression-45"><a href="#Step.from_expression-45"><span class="linenos"> 45</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="Step.from_expression-46"><a href="#Step.from_expression-46"><span class="linenos"> 46</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Step.from_expression-47"><a href="#Step.from_expression-47"><span class="linenos"> 47</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="Step.from_expression-48"><a href="#Step.from_expression-48"><span class="linenos"> 48</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Step.from_expression-49"><a href="#Step.from_expression-49"><span class="linenos"> 49</span></a><span class="sd"> Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.</span> +</span><span id="Step.from_expression-50"><a href="#Step.from_expression-50"><span class="linenos"> 50</span></a><span class="sd"> Note: the expression's tables and subqueries must be aliased for this method to work. For</span> +</span><span id="Step.from_expression-51"><a href="#Step.from_expression-51"><span class="linenos"> 51</span></a><span class="sd"> example, given the following expression:</span> +</span><span id="Step.from_expression-52"><a href="#Step.from_expression-52"><span class="linenos"> 52</span></a> +</span><span id="Step.from_expression-53"><a href="#Step.from_expression-53"><span class="linenos"> 53</span></a><span class="sd"> SELECT</span> +</span><span id="Step.from_expression-54"><a href="#Step.from_expression-54"><span class="linenos"> 54</span></a><span class="sd"> x.a,</span> +</span><span id="Step.from_expression-55"><a href="#Step.from_expression-55"><span class="linenos"> 55</span></a><span class="sd"> SUM(x.b)</span> +</span><span id="Step.from_expression-56"><a href="#Step.from_expression-56"><span class="linenos"> 56</span></a><span class="sd"> FROM x AS x</span> +</span><span id="Step.from_expression-57"><a href="#Step.from_expression-57"><span class="linenos"> 57</span></a><span class="sd"> JOIN y AS y</span> +</span><span id="Step.from_expression-58"><a href="#Step.from_expression-58"><span class="linenos"> 58</span></a><span class="sd"> ON x.a = y.a</span> +</span><span id="Step.from_expression-59"><a href="#Step.from_expression-59"><span class="linenos"> 59</span></a><span class="sd"> GROUP BY x.a</span> +</span><span id="Step.from_expression-60"><a href="#Step.from_expression-60"><span class="linenos"> 60</span></a> +</span><span id="Step.from_expression-61"><a href="#Step.from_expression-61"><span class="linenos"> 61</span></a><span class="sd"> the following DAG is produced (the expression IDs might differ per execution):</span> +</span><span id="Step.from_expression-62"><a href="#Step.from_expression-62"><span class="linenos"> 62</span></a> +</span><span id="Step.from_expression-63"><a href="#Step.from_expression-63"><span class="linenos"> 63</span></a><span class="sd"> - Aggregate: x (4347984624)</span> +</span><span id="Step.from_expression-64"><a href="#Step.from_expression-64"><span class="linenos"> 64</span></a><span class="sd"> Context:</span> +</span><span id="Step.from_expression-65"><a href="#Step.from_expression-65"><span class="linenos"> 65</span></a><span class="sd"> Aggregations:</span> +</span><span id="Step.from_expression-66"><a href="#Step.from_expression-66"><span class="linenos"> 66</span></a><span class="sd"> - SUM(x.b)</span> +</span><span id="Step.from_expression-67"><a href="#Step.from_expression-67"><span class="linenos"> 67</span></a><span class="sd"> Group:</span> +</span><span id="Step.from_expression-68"><a href="#Step.from_expression-68"><span class="linenos"> 68</span></a><span class="sd"> - x.a</span> +</span><span id="Step.from_expression-69"><a href="#Step.from_expression-69"><span class="linenos"> 69</span></a><span class="sd"> Projections:</span> +</span><span id="Step.from_expression-70"><a href="#Step.from_expression-70"><span class="linenos"> 70</span></a><span class="sd"> - x.a</span> +</span><span id="Step.from_expression-71"><a href="#Step.from_expression-71"><span class="linenos"> 71</span></a><span class="sd"> - "x".""</span> +</span><span id="Step.from_expression-72"><a href="#Step.from_expression-72"><span class="linenos"> 72</span></a><span class="sd"> Dependencies:</span> +</span><span id="Step.from_expression-73"><a href="#Step.from_expression-73"><span class="linenos"> 73</span></a><span class="sd"> - Join: x (4347985296)</span> +</span><span id="Step.from_expression-74"><a href="#Step.from_expression-74"><span class="linenos"> 74</span></a><span class="sd"> Context:</span> +</span><span id="Step.from_expression-75"><a href="#Step.from_expression-75"><span class="linenos"> 75</span></a><span class="sd"> y:</span> +</span><span id="Step.from_expression-76"><a href="#Step.from_expression-76"><span class="linenos"> 76</span></a><span class="sd"> On: x.a = y.a</span> +</span><span id="Step.from_expression-77"><a href="#Step.from_expression-77"><span class="linenos"> 77</span></a><span class="sd"> Projections:</span> +</span><span id="Step.from_expression-78"><a href="#Step.from_expression-78"><span class="linenos"> 78</span></a><span class="sd"> Dependencies:</span> +</span><span id="Step.from_expression-79"><a href="#Step.from_expression-79"><span class="linenos"> 79</span></a><span class="sd"> - Scan: x (4347983136)</span> +</span><span id="Step.from_expression-80"><a href="#Step.from_expression-80"><span class="linenos"> 80</span></a><span class="sd"> Context:</span> +</span><span id="Step.from_expression-81"><a href="#Step.from_expression-81"><span class="linenos"> 81</span></a><span class="sd"> Source: x AS x</span> +</span><span id="Step.from_expression-82"><a href="#Step.from_expression-82"><span class="linenos"> 82</span></a><span class="sd"> Projections:</span> +</span><span id="Step.from_expression-83"><a href="#Step.from_expression-83"><span class="linenos"> 83</span></a><span class="sd"> - Scan: y (4343416624)</span> +</span><span id="Step.from_expression-84"><a href="#Step.from_expression-84"><span class="linenos"> 84</span></a><span class="sd"> Context:</span> +</span><span id="Step.from_expression-85"><a href="#Step.from_expression-85"><span class="linenos"> 85</span></a><span class="sd"> Source: y AS y</span> +</span><span id="Step.from_expression-86"><a href="#Step.from_expression-86"><span class="linenos"> 86</span></a><span class="sd"> Projections:</span> +</span><span id="Step.from_expression-87"><a href="#Step.from_expression-87"><span class="linenos"> 87</span></a> +</span><span id="Step.from_expression-88"><a href="#Step.from_expression-88"><span class="linenos"> 88</span></a><span class="sd"> Args:</span> +</span><span id="Step.from_expression-89"><a href="#Step.from_expression-89"><span class="linenos"> 89</span></a><span class="sd"> expression: the expression to build the DAG from.</span> +</span><span id="Step.from_expression-90"><a href="#Step.from_expression-90"><span class="linenos"> 90</span></a><span class="sd"> ctes: a dictionary that maps CTEs to their corresponding Step DAG by name.</span> +</span><span id="Step.from_expression-91"><a href="#Step.from_expression-91"><span class="linenos"> 91</span></a> +</span><span id="Step.from_expression-92"><a href="#Step.from_expression-92"><span class="linenos"> 92</span></a><span class="sd"> Returns:</span> +</span><span id="Step.from_expression-93"><a href="#Step.from_expression-93"><span class="linenos"> 93</span></a><span class="sd"> A Step DAG corresponding to `expression`.</span> +</span><span id="Step.from_expression-94"><a href="#Step.from_expression-94"><span class="linenos"> 94</span></a><span class="sd"> """</span> +</span><span id="Step.from_expression-95"><a href="#Step.from_expression-95"><span class="linenos"> 95</span></a> <span class="n">ctes</span> <span class="o">=</span> <span class="n">ctes</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="Step.from_expression-96"><a href="#Step.from_expression-96"><span class="linenos"> 96</span></a> <span class="n">with_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with"</span><span class="p">)</span> +</span><span id="Step.from_expression-97"><a href="#Step.from_expression-97"><span class="linenos"> 97</span></a> +</span><span id="Step.from_expression-98"><a href="#Step.from_expression-98"><span class="linenos"> 98</span></a> <span class="c1"># CTEs break the mold of scope and introduce themselves to all in the context.</span> +</span><span id="Step.from_expression-99"><a href="#Step.from_expression-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="n">with_</span><span class="p">:</span> +</span><span id="Step.from_expression-100"><a href="#Step.from_expression-100"><span class="linenos">100</span></a> <span class="n">ctes</span> <span class="o">=</span> <span class="n">ctes</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Step.from_expression-101"><a href="#Step.from_expression-101"><span class="linenos">101</span></a> <span class="k">for</span> <span class="n">cte</span> <span class="ow">in</span> <span class="n">with_</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Step.from_expression-102"><a href="#Step.from_expression-102"><span class="linenos">102</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">cte</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step.from_expression-103"><a href="#Step.from_expression-103"><span class="linenos">103</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">cte</span><span class="o">.</span><span class="n">alias</span> +</span><span id="Step.from_expression-104"><a href="#Step.from_expression-104"><span class="linenos">104</span></a> <span class="n">ctes</span><span class="p">[</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">step</span> <span class="c1"># type: ignore</span> +</span><span id="Step.from_expression-105"><a href="#Step.from_expression-105"><span class="linenos">105</span></a> +</span><span id="Step.from_expression-106"><a href="#Step.from_expression-106"><span class="linenos">106</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"from"</span><span class="p">)</span> +</span><span id="Step.from_expression-107"><a href="#Step.from_expression-107"><span class="linenos">107</span></a> +</span><span id="Step.from_expression-108"><a href="#Step.from_expression-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">from_</span><span class="p">:</span> +</span><span id="Step.from_expression-109"><a href="#Step.from_expression-109"><span class="linenos">109</span></a> <span class="n">from_</span> <span class="o">=</span> <span class="n">from_</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Step.from_expression-110"><a href="#Step.from_expression-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">from_</span><span class="p">)</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Step.from_expression-111"><a href="#Step.from_expression-111"><span class="linenos">111</span></a> <span class="k">raise</span> <span class="n">UnsupportedError</span><span class="p">(</span> +</span><span id="Step.from_expression-112"><a href="#Step.from_expression-112"><span class="linenos">112</span></a> <span class="s2">"Multi-from statements are unsupported. Run it through the optimizer"</span> +</span><span id="Step.from_expression-113"><a href="#Step.from_expression-113"><span class="linenos">113</span></a> <span class="p">)</span> +</span><span id="Step.from_expression-114"><a href="#Step.from_expression-114"><span class="linenos">114</span></a> +</span><span id="Step.from_expression-115"><a href="#Step.from_expression-115"><span class="linenos">115</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">from_</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step.from_expression-116"><a href="#Step.from_expression-116"><span class="linenos">116</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">):</span> +</span><span id="Step.from_expression-117"><a href="#Step.from_expression-117"><span class="linenos">117</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">SetOperation</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step.from_expression-118"><a href="#Step.from_expression-118"><span class="linenos">118</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Step.from_expression-119"><a href="#Step.from_expression-119"><span class="linenos">119</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="p">()</span> +</span><span id="Step.from_expression-120"><a href="#Step.from_expression-120"><span class="linenos">120</span></a> +</span><span id="Step.from_expression-121"><a href="#Step.from_expression-121"><span class="linenos">121</span></a> <span class="n">joins</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"joins"</span><span class="p">)</span> +</span><span id="Step.from_expression-122"><a href="#Step.from_expression-122"><span class="linenos">122</span></a> +</span><span id="Step.from_expression-123"><a href="#Step.from_expression-123"><span class="linenos">123</span></a> <span class="k">if</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="Step.from_expression-124"><a href="#Step.from_expression-124"><span class="linenos">124</span></a> <span class="n">join</span> <span class="o">=</span> <span class="n">Join</span><span class="o">.</span><span class="n">from_joins</span><span class="p">(</span><span class="n">joins</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Step.from_expression-125"><a href="#Step.from_expression-125"><span class="linenos">125</span></a> <span class="n">join</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step.from_expression-126"><a href="#Step.from_expression-126"><span class="linenos">126</span></a> <span class="n">join</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step.from_expression-127"><a href="#Step.from_expression-127"><span class="linenos">127</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">join</span> +</span><span id="Step.from_expression-128"><a href="#Step.from_expression-128"><span class="linenos">128</span></a> +</span><span id="Step.from_expression-129"><a href="#Step.from_expression-129"><span class="linenos">129</span></a> <span class="n">projections</span> <span class="o">=</span> <span class="p">[]</span> <span class="c1"># final selects in this chain of steps representing a select</span> +</span><span id="Step.from_expression-130"><a href="#Step.from_expression-130"><span class="linenos">130</span></a> <span class="n">operands</span> <span class="o">=</span> <span class="p">{}</span> <span class="c1"># intermediate computations of agg funcs eg x + 1 in SUM(x + 1)</span> +</span><span id="Step.from_expression-131"><a href="#Step.from_expression-131"><span class="linenos">131</span></a> <span class="n">aggregations</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Step.from_expression-132"><a href="#Step.from_expression-132"><span class="linenos">132</span></a> <span class="n">sequence</span> <span class="o">=</span> <span class="n">itertools</span><span class="o">.</span><span class="n">count</span><span class="p">()</span> +</span><span id="Step.from_expression-133"><a href="#Step.from_expression-133"><span class="linenos">133</span></a> +</span><span id="Step.from_expression-134"><a href="#Step.from_expression-134"><span class="linenos">134</span></a> <span class="k">def</span> <span class="nf">extract_agg_operands</span><span class="p">(</span><span class="n">expression</span><span class="p">):</span> +</span><span id="Step.from_expression-135"><a href="#Step.from_expression-135"><span class="linenos">135</span></a> <span class="k">for</span> <span class="n">agg</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Step.from_expression-136"><a href="#Step.from_expression-136"><span class="linenos">136</span></a> <span class="k">for</span> <span class="n">operand</span> <span class="ow">in</span> <span class="n">agg</span><span class="o">.</span><span class="n">unnest_operands</span><span class="p">():</span> +</span><span id="Step.from_expression-137"><a href="#Step.from_expression-137"><span class="linenos">137</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">operand</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">):</span> +</span><span id="Step.from_expression-138"><a href="#Step.from_expression-138"><span class="linenos">138</span></a> <span class="k">continue</span> +</span><span id="Step.from_expression-139"><a href="#Step.from_expression-139"><span class="linenos">139</span></a> <span class="k">if</span> <span class="n">operand</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">operands</span><span class="p">:</span> +</span><span id="Step.from_expression-140"><a href="#Step.from_expression-140"><span class="linenos">140</span></a> <span class="n">operands</span><span class="p">[</span><span class="n">operand</span><span class="p">]</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"_a_</span><span class="si">{</span><span class="nb">next</span><span class="p">(</span><span class="n">sequence</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Step.from_expression-141"><a href="#Step.from_expression-141"><span class="linenos">141</span></a> <span class="n">operand</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">operands</span><span class="p">[</span><span class="n">operand</span><span class="p">],</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Step.from_expression-142"><a href="#Step.from_expression-142"><span class="linenos">142</span></a> +</span><span id="Step.from_expression-143"><a href="#Step.from_expression-143"><span class="linenos">143</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="Step.from_expression-144"><a href="#Step.from_expression-144"><span class="linenos">144</span></a> <span class="k">if</span> <span class="n">e</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AggFunc</span><span class="p">):</span> +</span><span id="Step.from_expression-145"><a href="#Step.from_expression-145"><span class="linenos">145</span></a> <span class="n">projections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">quoted</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span> +</span><span id="Step.from_expression-146"><a href="#Step.from_expression-146"><span class="linenos">146</span></a> <span class="n">aggregations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Step.from_expression-147"><a href="#Step.from_expression-147"><span class="linenos">147</span></a> <span class="n">extract_agg_operands</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Step.from_expression-148"><a href="#Step.from_expression-148"><span class="linenos">148</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Step.from_expression-149"><a href="#Step.from_expression-149"><span class="linenos">149</span></a> <span class="n">projections</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> +</span><span id="Step.from_expression-150"><a href="#Step.from_expression-150"><span class="linenos">150</span></a> +</span><span id="Step.from_expression-151"><a href="#Step.from_expression-151"><span class="linenos">151</span></a> <span class="n">where</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"where"</span><span class="p">)</span> +</span><span id="Step.from_expression-152"><a href="#Step.from_expression-152"><span class="linenos">152</span></a> +</span><span id="Step.from_expression-153"><a href="#Step.from_expression-153"><span class="linenos">153</span></a> <span class="k">if</span> <span class="n">where</span><span class="p">:</span> +</span><span id="Step.from_expression-154"><a href="#Step.from_expression-154"><span class="linenos">154</span></a> <span class="n">step</span><span class="o">.</span><span class="n">condition</span> <span class="o">=</span> <span class="n">where</span><span class="o">.</span><span class="n">this</span> +</span><span id="Step.from_expression-155"><a href="#Step.from_expression-155"><span class="linenos">155</span></a> +</span><span id="Step.from_expression-156"><a href="#Step.from_expression-156"><span class="linenos">156</span></a> <span class="n">group</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"group"</span><span class="p">)</span> +</span><span id="Step.from_expression-157"><a href="#Step.from_expression-157"><span class="linenos">157</span></a> +</span><span id="Step.from_expression-158"><a href="#Step.from_expression-158"><span class="linenos">158</span></a> <span class="k">if</span> <span class="n">group</span> <span class="ow">or</span> <span class="n">aggregations</span><span class="p">:</span> +</span><span id="Step.from_expression-159"><a href="#Step.from_expression-159"><span class="linenos">159</span></a> <span class="n">aggregate</span> <span class="o">=</span> <span class="n">Aggregate</span><span class="p">()</span> +</span><span id="Step.from_expression-160"><a href="#Step.from_expression-160"><span class="linenos">160</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step.from_expression-161"><a href="#Step.from_expression-161"><span class="linenos">161</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step.from_expression-162"><a href="#Step.from_expression-162"><span class="linenos">162</span></a> +</span><span id="Step.from_expression-163"><a href="#Step.from_expression-163"><span class="linenos">163</span></a> <span class="n">having</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"having"</span><span class="p">)</span> +</span><span id="Step.from_expression-164"><a href="#Step.from_expression-164"><span class="linenos">164</span></a> +</span><span id="Step.from_expression-165"><a href="#Step.from_expression-165"><span class="linenos">165</span></a> <span class="k">if</span> <span class="n">having</span><span class="p">:</span> +</span><span id="Step.from_expression-166"><a href="#Step.from_expression-166"><span class="linenos">166</span></a> <span class="n">extract_agg_operands</span><span class="p">(</span><span class="n">having</span><span class="p">)</span> +</span><span id="Step.from_expression-167"><a href="#Step.from_expression-167"><span class="linenos">167</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">condition</span> <span class="o">=</span> <span class="n">having</span><span class="o">.</span><span class="n">this</span> +</span><span id="Step.from_expression-168"><a href="#Step.from_expression-168"><span class="linenos">168</span></a> +</span><span id="Step.from_expression-169"><a href="#Step.from_expression-169"><span class="linenos">169</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">operands</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span> +</span><span id="Step.from_expression-170"><a href="#Step.from_expression-170"><span class="linenos">170</span></a> <span class="n">alias</span><span class="p">(</span><span class="n">operand</span><span class="p">,</span> <span class="n">alias_</span><span class="p">)</span> <span class="k">for</span> <span class="n">operand</span><span class="p">,</span> <span class="n">alias_</span> <span class="ow">in</span> <span class="n">operands</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="Step.from_expression-171"><a href="#Step.from_expression-171"><span class="linenos">171</span></a> <span class="p">)</span> +</span><span id="Step.from_expression-172"><a href="#Step.from_expression-172"><span class="linenos">172</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">aggregations</span> <span class="o">=</span> <span class="n">aggregations</span> +</span><span id="Step.from_expression-173"><a href="#Step.from_expression-173"><span class="linenos">173</span></a> <span class="c1"># give aggregates names and replace projections with references to them</span> +</span><span id="Step.from_expression-174"><a href="#Step.from_expression-174"><span class="linenos">174</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">group</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Step.from_expression-175"><a href="#Step.from_expression-175"><span class="linenos">175</span></a> <span class="sa">f</span><span class="s2">"_g</span><span class="si">{</span><span class="n">i</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">e</span> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">group</span><span class="o">.</span><span class="n">expressions</span> <span class="k">if</span> <span class="n">group</span> <span class="k">else</span> <span class="p">[])</span> +</span><span id="Step.from_expression-176"><a href="#Step.from_expression-176"><span class="linenos">176</span></a> <span class="p">}</span> +</span><span id="Step.from_expression-177"><a href="#Step.from_expression-177"><span class="linenos">177</span></a> <span class="k">for</span> <span class="n">projection</span> <span class="ow">in</span> <span class="n">projections</span><span class="p">:</span> +</span><span id="Step.from_expression-178"><a href="#Step.from_expression-178"><span class="linenos">178</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">aggregate</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Step.from_expression-179"><a href="#Step.from_expression-179"><span class="linenos">179</span></a> <span class="k">for</span> <span class="n">child</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">_</span> <span class="ow">in</span> <span class="n">projection</span><span class="o">.</span><span class="n">walk</span><span class="p">():</span> +</span><span id="Step.from_expression-180"><a href="#Step.from_expression-180"><span class="linenos">180</span></a> <span class="k">if</span> <span class="n">child</span> <span class="o">==</span> <span class="n">e</span><span class="p">:</span> +</span><span id="Step.from_expression-181"><a href="#Step.from_expression-181"><span class="linenos">181</span></a> <span class="n">child</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">))</span> +</span><span id="Step.from_expression-182"><a href="#Step.from_expression-182"><span class="linenos">182</span></a> <span class="n">aggregate</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step.from_expression-183"><a href="#Step.from_expression-183"><span class="linenos">183</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">aggregate</span> +</span><span id="Step.from_expression-184"><a href="#Step.from_expression-184"><span class="linenos">184</span></a> +</span><span id="Step.from_expression-185"><a href="#Step.from_expression-185"><span class="linenos">185</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="Step.from_expression-186"><a href="#Step.from_expression-186"><span class="linenos">186</span></a> +</span><span id="Step.from_expression-187"><a href="#Step.from_expression-187"><span class="linenos">187</span></a> <span class="k">if</span> <span class="n">order</span><span class="p">:</span> +</span><span id="Step.from_expression-188"><a href="#Step.from_expression-188"><span class="linenos">188</span></a> <span class="n">sort</span> <span class="o">=</span> <span class="n">Sort</span><span class="p">()</span> +</span><span id="Step.from_expression-189"><a href="#Step.from_expression-189"><span class="linenos">189</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step.from_expression-190"><a href="#Step.from_expression-190"><span class="linenos">190</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="n">order</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Step.from_expression-191"><a href="#Step.from_expression-191"><span class="linenos">191</span></a> <span class="n">sort</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step.from_expression-192"><a href="#Step.from_expression-192"><span class="linenos">192</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">sort</span> +</span><span id="Step.from_expression-193"><a href="#Step.from_expression-193"><span class="linenos">193</span></a> +</span><span id="Step.from_expression-194"><a href="#Step.from_expression-194"><span class="linenos">194</span></a> <span class="n">step</span><span class="o">.</span><span class="n">projections</span> <span class="o">=</span> <span class="n">projections</span> +</span><span id="Step.from_expression-195"><a href="#Step.from_expression-195"><span class="linenos">195</span></a> +</span><span id="Step.from_expression-196"><a href="#Step.from_expression-196"><span class="linenos">196</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">):</span> +</span><span id="Step.from_expression-197"><a href="#Step.from_expression-197"><span class="linenos">197</span></a> <span class="n">distinct</span> <span class="o">=</span> <span class="n">Aggregate</span><span class="p">()</span> +</span><span id="Step.from_expression-198"><a href="#Step.from_expression-198"><span class="linenos">198</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step.from_expression-199"><a href="#Step.from_expression-199"><span class="linenos">199</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">step</span><span class="o">.</span><span class="n">name</span> +</span><span id="Step.from_expression-200"><a href="#Step.from_expression-200"><span class="linenos">200</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">group</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Step.from_expression-201"><a href="#Step.from_expression-201"><span class="linenos">201</span></a> <span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">column</span><span class="p">(</span><span class="n">col</span><span class="o">=</span><span class="n">e</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">,</span> <span class="n">table</span><span class="o">=</span><span class="n">step</span><span class="o">.</span><span class="n">name</span><span class="p">)</span> +</span><span id="Step.from_expression-202"><a href="#Step.from_expression-202"><span class="linenos">202</span></a> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">projections</span> <span class="ow">or</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Step.from_expression-203"><a href="#Step.from_expression-203"><span class="linenos">203</span></a> <span class="p">}</span> +</span><span id="Step.from_expression-204"><a href="#Step.from_expression-204"><span class="linenos">204</span></a> <span class="n">distinct</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">step</span><span class="p">)</span> +</span><span id="Step.from_expression-205"><a href="#Step.from_expression-205"><span class="linenos">205</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">distinct</span> +</span><span id="Step.from_expression-206"><a href="#Step.from_expression-206"><span class="linenos">206</span></a> +</span><span id="Step.from_expression-207"><a href="#Step.from_expression-207"><span class="linenos">207</span></a> <span class="n">limit</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"limit"</span><span class="p">)</span> +</span><span id="Step.from_expression-208"><a href="#Step.from_expression-208"><span class="linenos">208</span></a> +</span><span id="Step.from_expression-209"><a href="#Step.from_expression-209"><span class="linenos">209</span></a> <span class="k">if</span> <span class="n">limit</span><span class="p">:</span> +</span><span id="Step.from_expression-210"><a href="#Step.from_expression-210"><span class="linenos">210</span></a> <span class="n">step</span><span class="o">.</span><span class="n">limit</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">limit</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="s2">"expression"</span><span class="p">))</span> +</span><span id="Step.from_expression-211"><a href="#Step.from_expression-211"><span class="linenos">211</span></a> +</span><span id="Step.from_expression-212"><a href="#Step.from_expression-212"><span class="linenos">212</span></a> <span class="k">return</span> <span class="n">step</span> +</span></pre></div> + + + <div class="docstring"><p>Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine. +Note: the expression's tables and subqueries must be aliased for this method to work. For +example, given the following expression:</p> + +<p>SELECT + x.a, + SUM(x.b) +FROM x AS x +JOIN y AS y + ON x.a = y.a +GROUP BY x.a</p> + +<p>the following DAG is produced (the expression IDs might differ per execution):</p> + +<ul> +<li>Aggregate: x (4347984624) +Context: + Aggregations: + - SUM(x.b) + Group: + - x.a +Projections: +<ul> +<li>x.a</li> +<li>"x"."" +Dependencies: +<ul> +<li>Join: x (4347985296) +Context: +y: +On: x.a = y.a +Projections: +Dependencies:</li> +</ul></li> +<li>Scan: x (4347983136) +Context: + Source: x AS x +Projections:</li> +<li>Scan: y (4343416624) +Context: + Source: y AS y +Projections:</li> +</ul></li> +</ul> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression to build the DAG from.</li> +<li><strong>ctes:</strong> a dictionary that maps CTEs to their corresponding Step DAG by name.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A Step DAG corresponding to <code>expression</code>.</p> +</blockquote> +</div> + + + </div> + <div id="Step.add_dependency" class="classattr"> + <input id="Step.add_dependency-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_dependency</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">dependency</span><span class="p">:</span> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Step.add_dependency-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Step.add_dependency"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Step.add_dependency-222"><a href="#Step.add_dependency-222"><span class="linenos">222</span></a> <span class="k">def</span> <span class="nf">add_dependency</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">dependency</span><span class="p">:</span> <span class="n">Step</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Step.add_dependency-223"><a href="#Step.add_dependency-223"><span class="linenos">223</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">dependency</span><span class="p">)</span> +</span><span id="Step.add_dependency-224"><a href="#Step.add_dependency-224"><span class="linenos">224</span></a> <span class="n">dependency</span><span class="o">.</span><span class="n">dependents</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="Step.to_s" class="classattr"> + <input id="Step.to_s-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">to_s</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Step.to_s-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Step.to_s"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Step.to_s-229"><a href="#Step.to_s-229"><span class="linenos">229</span></a> <span class="k">def</span> <span class="nf">to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">level</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Step.to_s-230"><a href="#Step.to_s-230"><span class="linenos">230</span></a> <span class="n">indent</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">*</span> <span class="n">level</span> +</span><span id="Step.to_s-231"><a href="#Step.to_s-231"><span class="linenos">231</span></a> <span class="n">nested</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> "</span> +</span><span id="Step.to_s-232"><a href="#Step.to_s-232"><span class="linenos">232</span></a> +</span><span id="Step.to_s-233"><a href="#Step.to_s-233"><span class="linenos">233</span></a> <span class="n">context</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_s</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2"> "</span><span class="p">)</span> +</span><span id="Step.to_s-234"><a href="#Step.to_s-234"><span class="linenos">234</span></a> +</span><span id="Step.to_s-235"><a href="#Step.to_s-235"><span class="linenos">235</span></a> <span class="k">if</span> <span class="n">context</span><span class="p">:</span> +</span><span id="Step.to_s-236"><a href="#Step.to_s-236"><span class="linenos">236</span></a> <span class="n">context</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Context:"</span><span class="p">]</span> <span class="o">+</span> <span class="n">context</span> +</span><span id="Step.to_s-237"><a href="#Step.to_s-237"><span class="linenos">237</span></a> +</span><span id="Step.to_s-238"><a href="#Step.to_s-238"><span class="linenos">238</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="Step.to_s-239"><a href="#Step.to_s-239"><span class="linenos">239</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">- </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">"</span><span class="p">,</span> +</span><span id="Step.to_s-240"><a href="#Step.to_s-240"><span class="linenos">240</span></a> <span class="o">*</span><span class="n">context</span><span class="p">,</span> +</span><span id="Step.to_s-241"><a href="#Step.to_s-241"><span class="linenos">241</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Projections:"</span><span class="p">,</span> +</span><span id="Step.to_s-242"><a href="#Step.to_s-242"><span class="linenos">242</span></a> <span class="p">]</span> +</span><span id="Step.to_s-243"><a href="#Step.to_s-243"><span class="linenos">243</span></a> +</span><span id="Step.to_s-244"><a href="#Step.to_s-244"><span class="linenos">244</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">projections</span><span class="p">:</span> +</span><span id="Step.to_s-245"><a href="#Step.to_s-245"><span class="linenos">245</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Step.to_s-246"><a href="#Step.to_s-246"><span class="linenos">246</span></a> +</span><span id="Step.to_s-247"><a href="#Step.to_s-247"><span class="linenos">247</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> +</span><span id="Step.to_s-248"><a href="#Step.to_s-248"><span class="linenos">248</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Condition: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Step.to_s-249"><a href="#Step.to_s-249"><span class="linenos">249</span></a> +</span><span id="Step.to_s-250"><a href="#Step.to_s-250"><span class="linenos">250</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">limit</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">math</span><span class="o">.</span><span class="n">inf</span><span class="p">:</span> +</span><span id="Step.to_s-251"><a href="#Step.to_s-251"><span class="linenos">251</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Limit: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">limit</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Step.to_s-252"><a href="#Step.to_s-252"><span class="linenos">252</span></a> +</span><span id="Step.to_s-253"><a href="#Step.to_s-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="Step.to_s-254"><a href="#Step.to_s-254"><span class="linenos">254</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">nested</span><span class="si">}</span><span class="s2">Dependencies:"</span><span class="p">)</span> +</span><span id="Step.to_s-255"><a href="#Step.to_s-255"><span class="linenos">255</span></a> <span class="k">for</span> <span class="n">dependency</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">dependencies</span><span class="p">:</span> +</span><span id="Step.to_s-256"><a href="#Step.to_s-256"><span class="linenos">256</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">" "</span> <span class="o">+</span> <span class="n">dependency</span><span class="o">.</span><span class="n">to_s</span><span class="p">(</span><span class="n">level</span> <span class="o">+</span> <span class="mi">1</span><span class="p">))</span> +</span><span id="Step.to_s-257"><a href="#Step.to_s-257"><span class="linenos">257</span></a> +</span><span id="Step.to_s-258"><a href="#Step.to_s-258"><span class="linenos">258</span></a> <span class="k">return</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="Scan"> + <input id="Scan-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Scan</span><wbr>(<span class="base"><a href="#Step">Step</a></span>): + + <label class="view-source-button" for="Scan-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scan"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scan-274"><a href="#Scan-274"><span class="linenos">274</span></a><span class="k">class</span> <span class="nc">Scan</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="Scan-275"><a href="#Scan-275"><span class="linenos">275</span></a> <span class="nd">@classmethod</span> +</span><span id="Scan-276"><a href="#Scan-276"><span class="linenos">276</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="Scan-277"><a href="#Scan-277"><span class="linenos">277</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scan-278"><a href="#Scan-278"><span class="linenos">278</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="Scan-279"><a href="#Scan-279"><span class="linenos">279</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Scan-280"><a href="#Scan-280"><span class="linenos">280</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="Scan-281"><a href="#Scan-281"><span class="linenos">281</span></a> +</span><span id="Scan-282"><a href="#Scan-282"><span class="linenos">282</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="Scan-283"><a href="#Scan-283"><span class="linenos">283</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Scan-284"><a href="#Scan-284"><span class="linenos">284</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Scan-285"><a href="#Scan-285"><span class="linenos">285</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="Scan-286"><a href="#Scan-286"><span class="linenos">286</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="Scan-287"><a href="#Scan-287"><span class="linenos">287</span></a> +</span><span id="Scan-288"><a href="#Scan-288"><span class="linenos">288</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="p">()</span> +</span><span id="Scan-289"><a href="#Scan-289"><span class="linenos">289</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="Scan-290"><a href="#Scan-290"><span class="linenos">290</span></a> <span class="n">step</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Scan-291"><a href="#Scan-291"><span class="linenos">291</span></a> <span class="k">if</span> <span class="n">ctes</span> <span class="ow">and</span> <span class="n">table</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">ctes</span><span class="p">:</span> +</span><span id="Scan-292"><a href="#Scan-292"><span class="linenos">292</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">ctes</span><span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">name</span><span class="p">])</span> +</span><span id="Scan-293"><a href="#Scan-293"><span class="linenos">293</span></a> +</span><span id="Scan-294"><a href="#Scan-294"><span class="linenos">294</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="Scan-295"><a href="#Scan-295"><span class="linenos">295</span></a> +</span><span id="Scan-296"><a href="#Scan-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Scan-297"><a href="#Scan-297"><span class="linenos">297</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Scan-298"><a href="#Scan-298"><span class="linenos">298</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scan-299"><a href="#Scan-299"><span class="linenos">299</span></a> +</span><span id="Scan-300"><a href="#Scan-300"><span class="linenos">300</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Scan-301"><a href="#Scan-301"><span class="linenos">301</span></a> <span class="k">return</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Source: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">'-static-'</span><span class="si">}</span><span class="s2">"</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span></pre></div> + + + + + <div id="Scan.__init__" class="classattr"> + <input id="Scan.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Scan</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="Scan.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scan.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scan.__init__-296"><a href="#Scan.__init__-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Scan.__init__-297"><a href="#Scan.__init__-297"><span class="linenos">297</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Scan.__init__-298"><a href="#Scan.__init__-298"><span class="linenos">298</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div id="Scan.from_expression" class="classattr"> + <input id="Scan.from_expression-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_expression</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">ctes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span>:</span></span> + + <label class="view-source-button" for="Scan.from_expression-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Scan.from_expression"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Scan.from_expression-275"><a href="#Scan.from_expression-275"><span class="linenos">275</span></a> <span class="nd">@classmethod</span> +</span><span id="Scan.from_expression-276"><a href="#Scan.from_expression-276"><span class="linenos">276</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="Scan.from_expression-277"><a href="#Scan.from_expression-277"><span class="linenos">277</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Scan.from_expression-278"><a href="#Scan.from_expression-278"><span class="linenos">278</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="Scan.from_expression-279"><a href="#Scan.from_expression-279"><span class="linenos">279</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Scan.from_expression-280"><a href="#Scan.from_expression-280"><span class="linenos">280</span></a> <span class="n">alias_</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">alias_or_name</span> +</span><span id="Scan.from_expression-281"><a href="#Scan.from_expression-281"><span class="linenos">281</span></a> +</span><span id="Scan.from_expression-282"><a href="#Scan.from_expression-282"><span class="linenos">282</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Subquery</span><span class="p">):</span> +</span><span id="Scan.from_expression-283"><a href="#Scan.from_expression-283"><span class="linenos">283</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Scan.from_expression-284"><a href="#Scan.from_expression-284"><span class="linenos">284</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="Scan.from_expression-285"><a href="#Scan.from_expression-285"><span class="linenos">285</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="Scan.from_expression-286"><a href="#Scan.from_expression-286"><span class="linenos">286</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="Scan.from_expression-287"><a href="#Scan.from_expression-287"><span class="linenos">287</span></a> +</span><span id="Scan.from_expression-288"><a href="#Scan.from_expression-288"><span class="linenos">288</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Scan</span><span class="p">()</span> +</span><span id="Scan.from_expression-289"><a href="#Scan.from_expression-289"><span class="linenos">289</span></a> <span class="n">step</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">alias_</span> +</span><span id="Scan.from_expression-290"><a href="#Scan.from_expression-290"><span class="linenos">290</span></a> <span class="n">step</span><span class="o">.</span><span class="n">source</span> <span class="o">=</span> <span class="n">expression</span> +</span><span id="Scan.from_expression-291"><a href="#Scan.from_expression-291"><span class="linenos">291</span></a> <span class="k">if</span> <span class="n">ctes</span> <span class="ow">and</span> <span class="n">table</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">ctes</span><span class="p">:</span> +</span><span id="Scan.from_expression-292"><a href="#Scan.from_expression-292"><span class="linenos">292</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">ctes</span><span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">name</span><span class="p">])</span> +</span><span id="Scan.from_expression-293"><a href="#Scan.from_expression-293"><span class="linenos">293</span></a> +</span><span id="Scan.from_expression-294"><a href="#Scan.from_expression-294"><span class="linenos">294</span></a> <span class="k">return</span> <span class="n">step</span> +</span></pre></div> + + + <div class="docstring"><p>Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine. +Note: the expression's tables and subqueries must be aliased for this method to work. For +example, given the following expression:</p> + +<p>SELECT + x.a, + SUM(x.b) +FROM x AS x +JOIN y AS y + ON x.a = y.a +GROUP BY x.a</p> + +<p>the following DAG is produced (the expression IDs might differ per execution):</p> + +<ul> +<li>Aggregate: x (4347984624) +Context: + Aggregations: + - SUM(x.b) + Group: + - x.a +Projections: +<ul> +<li>x.a</li> +<li>"x"."" +Dependencies: +<ul> +<li>Join: x (4347985296) +Context: +y: +On: x.a = y.a +Projections: +Dependencies:</li> +</ul></li> +<li>Scan: x (4347983136) +Context: + Source: x AS x +Projections:</li> +<li>Scan: y (4343416624) +Context: + Source: y AS y +Projections:</li> +</ul></li> +</ul> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression to build the DAG from.</li> +<li><strong>ctes:</strong> a dictionary that maps CTEs to their corresponding Step DAG by name.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A Step DAG corresponding to <code>expression</code>.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Step">Step</a></dt> + <dd id="Scan.add_dependency" class="function"><a href="#Step.add_dependency">add_dependency</a></dd> + <dd id="Scan.to_s" class="function"><a href="#Step.to_s">to_s</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Join"> + <input id="Join-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Join</span><wbr>(<span class="base"><a href="#Step">Step</a></span>): + + <label class="view-source-button" for="Join-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Join"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Join-304"><a href="#Join-304"><span class="linenos">304</span></a><span class="k">class</span> <span class="nc">Join</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="Join-305"><a href="#Join-305"><span class="linenos">305</span></a> <span class="nd">@classmethod</span> +</span><span id="Join-306"><a href="#Join-306"><span class="linenos">306</span></a> <span class="k">def</span> <span class="nf">from_joins</span><span class="p">(</span> +</span><span id="Join-307"><a href="#Join-307"><span class="linenos">307</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">joins</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">],</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Join-308"><a href="#Join-308"><span class="linenos">308</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="Join-309"><a href="#Join-309"><span class="linenos">309</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Join</span><span class="p">()</span> +</span><span id="Join-310"><a href="#Join-310"><span class="linenos">310</span></a> +</span><span id="Join-311"><a href="#Join-311"><span class="linenos">311</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="Join-312"><a href="#Join-312"><span class="linenos">312</span></a> <span class="n">source_key</span><span class="p">,</span> <span class="n">join_key</span><span class="p">,</span> <span class="n">condition</span> <span class="o">=</span> <span class="n">join_condition</span><span class="p">(</span><span class="n">join</span><span class="p">)</span> +</span><span id="Join-313"><a href="#Join-313"><span class="linenos">313</span></a> <span class="n">step</span><span class="o">.</span><span class="n">joins</span><span class="p">[</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Join-314"><a href="#Join-314"><span class="linenos">314</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="n">join</span><span class="o">.</span><span class="n">side</span><span class="p">,</span> +</span><span id="Join-315"><a href="#Join-315"><span class="linenos">315</span></a> <span class="s2">"join_key"</span><span class="p">:</span> <span class="n">join_key</span><span class="p">,</span> +</span><span id="Join-316"><a href="#Join-316"><span class="linenos">316</span></a> <span class="s2">"source_key"</span><span class="p">:</span> <span class="n">source_key</span><span class="p">,</span> +</span><span id="Join-317"><a href="#Join-317"><span class="linenos">317</span></a> <span class="s2">"condition"</span><span class="p">:</span> <span class="n">condition</span><span class="p">,</span> +</span><span id="Join-318"><a href="#Join-318"><span class="linenos">318</span></a> <span class="p">}</span> +</span><span id="Join-319"><a href="#Join-319"><span class="linenos">319</span></a> +</span><span id="Join-320"><a href="#Join-320"><span class="linenos">320</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">Scan</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">ctes</span><span class="p">))</span> +</span><span id="Join-321"><a href="#Join-321"><span class="linenos">321</span></a> +</span><span id="Join-322"><a href="#Join-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="Join-323"><a href="#Join-323"><span class="linenos">323</span></a> +</span><span id="Join-324"><a href="#Join-324"><span class="linenos">324</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Join-325"><a href="#Join-325"><span class="linenos">325</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Join-326"><a href="#Join-326"><span class="linenos">326</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">joins</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Join-327"><a href="#Join-327"><span class="linenos">327</span></a> +</span><span id="Join-328"><a href="#Join-328"><span class="linenos">328</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Join-329"><a href="#Join-329"><span class="linenos">329</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Join-330"><a href="#Join-330"><span class="linenos">330</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">join</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">joins</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="Join-331"><a href="#Join-331"><span class="linenos">331</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}{</span><span class="n">name</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">join</span><span class="p">[</span><span class="s1">'side'</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Join-332"><a href="#Join-332"><span class="linenos">332</span></a> <span class="k">if</span> <span class="n">join</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"condition"</span><span class="p">):</span> +</span><span id="Join-333"><a href="#Join-333"><span class="linenos">333</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">On: </span><span class="si">{</span><span class="n">join</span><span class="p">[</span><span class="s1">'condition'</span><span class="p">]</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Join-334"><a href="#Join-334"><span class="linenos">334</span></a> <span class="k">return</span> <span class="n">lines</span> +</span></pre></div> + + + + + <div id="Join.__init__" class="classattr"> + <input id="Join.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Join</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="Join.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Join.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Join.__init__-324"><a href="#Join.__init__-324"><span class="linenos">324</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Join.__init__-325"><a href="#Join.__init__-325"><span class="linenos">325</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Join.__init__-326"><a href="#Join.__init__-326"><span class="linenos">326</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">joins</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]]</span> <span class="o">=</span> <span class="p">{}</span> +</span></pre></div> + + + + + </div> + <div id="Join.from_joins" class="classattr"> + <input id="Join.from_joins-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_joins</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">joins</span><span class="p">:</span> <span class="n">Iterable</span><span class="p">[</span><span class="n"><a href="expressions.html#Join">sqlglot.expressions.Join</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">ctes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span>:</span></span> + + <label class="view-source-button" for="Join.from_joins-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Join.from_joins"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Join.from_joins-305"><a href="#Join.from_joins-305"><span class="linenos">305</span></a> <span class="nd">@classmethod</span> +</span><span id="Join.from_joins-306"><a href="#Join.from_joins-306"><span class="linenos">306</span></a> <span class="k">def</span> <span class="nf">from_joins</span><span class="p">(</span> +</span><span id="Join.from_joins-307"><a href="#Join.from_joins-307"><span class="linenos">307</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">joins</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Join</span><span class="p">],</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Join.from_joins-308"><a href="#Join.from_joins-308"><span class="linenos">308</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="Join.from_joins-309"><a href="#Join.from_joins-309"><span class="linenos">309</span></a> <span class="n">step</span> <span class="o">=</span> <span class="n">Join</span><span class="p">()</span> +</span><span id="Join.from_joins-310"><a href="#Join.from_joins-310"><span class="linenos">310</span></a> +</span><span id="Join.from_joins-311"><a href="#Join.from_joins-311"><span class="linenos">311</span></a> <span class="k">for</span> <span class="n">join</span> <span class="ow">in</span> <span class="n">joins</span><span class="p">:</span> +</span><span id="Join.from_joins-312"><a href="#Join.from_joins-312"><span class="linenos">312</span></a> <span class="n">source_key</span><span class="p">,</span> <span class="n">join_key</span><span class="p">,</span> <span class="n">condition</span> <span class="o">=</span> <span class="n">join_condition</span><span class="p">(</span><span class="n">join</span><span class="p">)</span> +</span><span id="Join.from_joins-313"><a href="#Join.from_joins-313"><span class="linenos">313</span></a> <span class="n">step</span><span class="o">.</span><span class="n">joins</span><span class="p">[</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">alias_or_name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Join.from_joins-314"><a href="#Join.from_joins-314"><span class="linenos">314</span></a> <span class="s2">"side"</span><span class="p">:</span> <span class="n">join</span><span class="o">.</span><span class="n">side</span><span class="p">,</span> +</span><span id="Join.from_joins-315"><a href="#Join.from_joins-315"><span class="linenos">315</span></a> <span class="s2">"join_key"</span><span class="p">:</span> <span class="n">join_key</span><span class="p">,</span> +</span><span id="Join.from_joins-316"><a href="#Join.from_joins-316"><span class="linenos">316</span></a> <span class="s2">"source_key"</span><span class="p">:</span> <span class="n">source_key</span><span class="p">,</span> +</span><span id="Join.from_joins-317"><a href="#Join.from_joins-317"><span class="linenos">317</span></a> <span class="s2">"condition"</span><span class="p">:</span> <span class="n">condition</span><span class="p">,</span> +</span><span id="Join.from_joins-318"><a href="#Join.from_joins-318"><span class="linenos">318</span></a> <span class="p">}</span> +</span><span id="Join.from_joins-319"><a href="#Join.from_joins-319"><span class="linenos">319</span></a> +</span><span id="Join.from_joins-320"><a href="#Join.from_joins-320"><span class="linenos">320</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">Scan</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">join</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">ctes</span><span class="p">))</span> +</span><span id="Join.from_joins-321"><a href="#Join.from_joins-321"><span class="linenos">321</span></a> +</span><span id="Join.from_joins-322"><a href="#Join.from_joins-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="n">step</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Step">Step</a></dt> + <dd id="Join.from_expression" class="function"><a href="#Step.from_expression">from_expression</a></dd> + <dd id="Join.add_dependency" class="function"><a href="#Step.add_dependency">add_dependency</a></dd> + <dd id="Join.to_s" class="function"><a href="#Step.to_s">to_s</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Aggregate"> + <input id="Aggregate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Aggregate</span><wbr>(<span class="base"><a href="#Step">Step</a></span>): + + <label class="view-source-button" for="Aggregate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Aggregate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Aggregate-337"><a href="#Aggregate-337"><span class="linenos">337</span></a><span class="k">class</span> <span class="nc">Aggregate</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="Aggregate-338"><a href="#Aggregate-338"><span class="linenos">338</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Aggregate-339"><a href="#Aggregate-339"><span class="linenos">339</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Aggregate-340"><a href="#Aggregate-340"><span class="linenos">340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">aggregations</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Aggregate-341"><a href="#Aggregate-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">()</span> +</span><span id="Aggregate-342"><a href="#Aggregate-342"><span class="linenos">342</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Aggregate-343"><a href="#Aggregate-343"><span class="linenos">343</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Aggregate-344"><a href="#Aggregate-344"><span class="linenos">344</span></a> +</span><span id="Aggregate-345"><a href="#Aggregate-345"><span class="linenos">345</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Aggregate-346"><a href="#Aggregate-346"><span class="linenos">346</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Aggregations:"</span><span class="p">]</span> +</span><span id="Aggregate-347"><a href="#Aggregate-347"><span class="linenos">347</span></a> +</span><span id="Aggregate-348"><a href="#Aggregate-348"><span class="linenos">348</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">aggregations</span><span class="p">:</span> +</span><span id="Aggregate-349"><a href="#Aggregate-349"><span class="linenos">349</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Aggregate-350"><a href="#Aggregate-350"><span class="linenos">350</span></a> +</span><span id="Aggregate-351"><a href="#Aggregate-351"><span class="linenos">351</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="p">:</span> +</span><span id="Aggregate-352"><a href="#Aggregate-352"><span class="linenos">352</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Group:"</span><span class="p">)</span> +</span><span id="Aggregate-353"><a href="#Aggregate-353"><span class="linenos">353</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> +</span><span id="Aggregate-354"><a href="#Aggregate-354"><span class="linenos">354</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Aggregate-355"><a href="#Aggregate-355"><span class="linenos">355</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="p">:</span> +</span><span id="Aggregate-356"><a href="#Aggregate-356"><span class="linenos">356</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Having:"</span><span class="p">)</span> +</span><span id="Aggregate-357"><a href="#Aggregate-357"><span class="linenos">357</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">condition</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Aggregate-358"><a href="#Aggregate-358"><span class="linenos">358</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> +</span><span id="Aggregate-359"><a href="#Aggregate-359"><span class="linenos">359</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Operands:"</span><span class="p">)</span> +</span><span id="Aggregate-360"><a href="#Aggregate-360"><span class="linenos">360</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> +</span><span id="Aggregate-361"><a href="#Aggregate-361"><span class="linenos">361</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Aggregate-362"><a href="#Aggregate-362"><span class="linenos">362</span></a> +</span><span id="Aggregate-363"><a href="#Aggregate-363"><span class="linenos">363</span></a> <span class="k">return</span> <span class="n">lines</span> +</span></pre></div> + + + + + <div id="Aggregate.__init__" class="classattr"> + <input id="Aggregate.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Aggregate</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="Aggregate.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Aggregate.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Aggregate.__init__-338"><a href="#Aggregate.__init__-338"><span class="linenos">338</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Aggregate.__init__-339"><a href="#Aggregate.__init__-339"><span class="linenos">339</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Aggregate.__init__-340"><a href="#Aggregate.__init__-340"><span class="linenos">340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">aggregations</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Aggregate.__init__-341"><a href="#Aggregate.__init__-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">operands</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">()</span> +</span><span id="Aggregate.__init__-342"><a href="#Aggregate.__init__-342"><span class="linenos">342</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">group</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Aggregate.__init__-343"><a href="#Aggregate.__init__-343"><span class="linenos">343</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">source</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Step">Step</a></dt> + <dd id="Aggregate.from_expression" class="function"><a href="#Step.from_expression">from_expression</a></dd> + <dd id="Aggregate.add_dependency" class="function"><a href="#Step.add_dependency">add_dependency</a></dd> + <dd id="Aggregate.to_s" class="function"><a href="#Step.to_s">to_s</a></dd> + + </div> + </dl> + </div> + </section> + <section id="Sort"> + <input id="Sort-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Sort</span><wbr>(<span class="base"><a href="#Step">Step</a></span>): + + <label class="view-source-button" for="Sort-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Sort"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Sort-366"><a href="#Sort-366"><span class="linenos">366</span></a><span class="k">class</span> <span class="nc">Sort</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="Sort-367"><a href="#Sort-367"><span class="linenos">367</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Sort-368"><a href="#Sort-368"><span class="linenos">368</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Sort-369"><a href="#Sort-369"><span class="linenos">369</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Sort-370"><a href="#Sort-370"><span class="linenos">370</span></a> +</span><span id="Sort-371"><a href="#Sort-371"><span class="linenos">371</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Sort-372"><a href="#Sort-372"><span class="linenos">372</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Key:"</span><span class="p">]</span> +</span><span id="Sort-373"><a href="#Sort-373"><span class="linenos">373</span></a> +</span><span id="Sort-374"><a href="#Sort-374"><span class="linenos">374</span></a> <span class="k">for</span> <span class="n">expression</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">key</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Sort-375"><a href="#Sort-375"><span class="linenos">375</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2"> - </span><span class="si">{</span><span class="n">expression</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Sort-376"><a href="#Sort-376"><span class="linenos">376</span></a> +</span><span id="Sort-377"><a href="#Sort-377"><span class="linenos">377</span></a> <span class="k">return</span> <span class="n">lines</span> +</span></pre></div> + + + + + <div id="Sort.__init__" class="classattr"> + <input id="Sort.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Sort</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="Sort.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Sort.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Sort.__init__-367"><a href="#Sort.__init__-367"><span class="linenos">367</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Sort.__init__-368"><a href="#Sort.__init__-368"><span class="linenos">368</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="Sort.__init__-369"><a href="#Sort.__init__-369"><span class="linenos">369</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">key</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Step">Step</a></dt> + <dd id="Sort.from_expression" class="function"><a href="#Step.from_expression">from_expression</a></dd> + <dd id="Sort.add_dependency" class="function"><a href="#Step.add_dependency">add_dependency</a></dd> + <dd id="Sort.to_s" class="function"><a href="#Step.to_s">to_s</a></dd> + + </div> + </dl> + </div> + </section> + <section id="SetOperation"> + <input id="SetOperation-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">SetOperation</span><wbr>(<span class="base"><a href="#Step">Step</a></span>): + + <label class="view-source-button" for="SetOperation-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SetOperation"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SetOperation-380"><a href="#SetOperation-380"><span class="linenos">380</span></a><span class="k">class</span> <span class="nc">SetOperation</span><span class="p">(</span><span class="n">Step</span><span class="p">):</span> +</span><span id="SetOperation-381"><a href="#SetOperation-381"><span class="linenos">381</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="SetOperation-382"><a href="#SetOperation-382"><span class="linenos">382</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="SetOperation-383"><a href="#SetOperation-383"><span class="linenos">383</span></a> <span class="n">op</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="SetOperation-384"><a href="#SetOperation-384"><span class="linenos">384</span></a> <span class="n">left</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SetOperation-385"><a href="#SetOperation-385"><span class="linenos">385</span></a> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SetOperation-386"><a href="#SetOperation-386"><span class="linenos">386</span></a> <span class="n">distinct</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SetOperation-387"><a href="#SetOperation-387"><span class="linenos">387</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="SetOperation-388"><a href="#SetOperation-388"><span class="linenos">388</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="SetOperation-389"><a href="#SetOperation-389"><span class="linenos">389</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">op</span> <span class="o">=</span> <span class="n">op</span> +</span><span id="SetOperation-390"><a href="#SetOperation-390"><span class="linenos">390</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">left</span> <span class="o">=</span> <span class="n">left</span> +</span><span id="SetOperation-391"><a href="#SetOperation-391"><span class="linenos">391</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">right</span> <span class="o">=</span> <span class="n">right</span> +</span><span id="SetOperation-392"><a href="#SetOperation-392"><span class="linenos">392</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span> <span class="o">=</span> <span class="n">distinct</span> +</span><span id="SetOperation-393"><a href="#SetOperation-393"><span class="linenos">393</span></a> +</span><span id="SetOperation-394"><a href="#SetOperation-394"><span class="linenos">394</span></a> <span class="nd">@classmethod</span> +</span><span id="SetOperation-395"><a href="#SetOperation-395"><span class="linenos">395</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="SetOperation-396"><a href="#SetOperation-396"><span class="linenos">396</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="SetOperation-397"><a href="#SetOperation-397"><span class="linenos">397</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="SetOperation-398"><a href="#SetOperation-398"><span class="linenos">398</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> +</span><span id="SetOperation-399"><a href="#SetOperation-399"><span class="linenos">399</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="SetOperation-400"><a href="#SetOperation-400"><span class="linenos">400</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="SetOperation-401"><a href="#SetOperation-401"><span class="linenos">401</span></a> <span class="n">step</span> <span class="o">=</span> <span class="bp">cls</span><span class="p">(</span> +</span><span id="SetOperation-402"><a href="#SetOperation-402"><span class="linenos">402</span></a> <span class="n">op</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> +</span><span id="SetOperation-403"><a href="#SetOperation-403"><span class="linenos">403</span></a> <span class="n">left</span><span class="o">=</span><span class="n">left</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="SetOperation-404"><a href="#SetOperation-404"><span class="linenos">404</span></a> <span class="n">right</span><span class="o">=</span><span class="n">right</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="SetOperation-405"><a href="#SetOperation-405"><span class="linenos">405</span></a> <span class="n">distinct</span><span class="o">=</span><span class="nb">bool</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)),</span> +</span><span id="SetOperation-406"><a href="#SetOperation-406"><span class="linenos">406</span></a> <span class="p">)</span> +</span><span id="SetOperation-407"><a href="#SetOperation-407"><span class="linenos">407</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="SetOperation-408"><a href="#SetOperation-408"><span class="linenos">408</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="SetOperation-409"><a href="#SetOperation-409"><span class="linenos">409</span></a> <span class="k">return</span> <span class="n">step</span> +</span><span id="SetOperation-410"><a href="#SetOperation-410"><span class="linenos">410</span></a> +</span><span id="SetOperation-411"><a href="#SetOperation-411"><span class="linenos">411</span></a> <span class="k">def</span> <span class="nf">_to_s</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">indent</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="SetOperation-412"><a href="#SetOperation-412"><span class="linenos">412</span></a> <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="SetOperation-413"><a href="#SetOperation-413"><span class="linenos">413</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span><span class="p">:</span> +</span><span id="SetOperation-414"><a href="#SetOperation-414"><span class="linenos">414</span></a> <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">indent</span><span class="si">}</span><span class="s2">Distinct: </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">distinct</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="SetOperation-415"><a href="#SetOperation-415"><span class="linenos">415</span></a> <span class="k">return</span> <span class="n">lines</span> +</span><span id="SetOperation-416"><a href="#SetOperation-416"><span class="linenos">416</span></a> +</span><span id="SetOperation-417"><a href="#SetOperation-417"><span class="linenos">417</span></a> <span class="nd">@property</span> +</span><span id="SetOperation-418"><a href="#SetOperation-418"><span class="linenos">418</span></a> <span class="k">def</span> <span class="nf">type_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="SetOperation-419"><a href="#SetOperation-419"><span class="linenos">419</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">op</span><span class="o">.</span><span class="vm">__name__</span> +</span></pre></div> + + + + + <div id="SetOperation.__init__" class="classattr"> + <input id="SetOperation.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">SetOperation</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">op</span><span class="p">:</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]</span>,</span><span class="param"> <span class="n">left</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">distinct</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span>)</span> + + <label class="view-source-button" for="SetOperation.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SetOperation.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SetOperation.__init__-381"><a href="#SetOperation.__init__-381"><span class="linenos">381</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="SetOperation.__init__-382"><a href="#SetOperation.__init__-382"><span class="linenos">382</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="SetOperation.__init__-383"><a href="#SetOperation.__init__-383"><span class="linenos">383</span></a> <span class="n">op</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Type</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> +</span><span id="SetOperation.__init__-384"><a href="#SetOperation.__init__-384"><span class="linenos">384</span></a> <span class="n">left</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SetOperation.__init__-385"><a href="#SetOperation.__init__-385"><span class="linenos">385</span></a> <span class="n">right</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="SetOperation.__init__-386"><a href="#SetOperation.__init__-386"><span class="linenos">386</span></a> <span class="n">distinct</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="SetOperation.__init__-387"><a href="#SetOperation.__init__-387"><span class="linenos">387</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="SetOperation.__init__-388"><a href="#SetOperation.__init__-388"><span class="linenos">388</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span> +</span><span id="SetOperation.__init__-389"><a href="#SetOperation.__init__-389"><span class="linenos">389</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">op</span> <span class="o">=</span> <span class="n">op</span> +</span><span id="SetOperation.__init__-390"><a href="#SetOperation.__init__-390"><span class="linenos">390</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">left</span> <span class="o">=</span> <span class="n">left</span> +</span><span id="SetOperation.__init__-391"><a href="#SetOperation.__init__-391"><span class="linenos">391</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">right</span> <span class="o">=</span> <span class="n">right</span> +</span><span id="SetOperation.__init__-392"><a href="#SetOperation.__init__-392"><span class="linenos">392</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">distinct</span> <span class="o">=</span> <span class="n">distinct</span> +</span></pre></div> + + + + + </div> + <div id="SetOperation.from_expression" class="classattr"> + <input id="SetOperation.from_expression-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_expression</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>,</span><span class="param"> <span class="n">ctes</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n"><a href="#Step">sqlglot.planner.Step</a></span>:</span></span> + + <label class="view-source-button" for="SetOperation.from_expression-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#SetOperation.from_expression"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="SetOperation.from_expression-394"><a href="#SetOperation.from_expression-394"><span class="linenos">394</span></a> <span class="nd">@classmethod</span> +</span><span id="SetOperation.from_expression-395"><a href="#SetOperation.from_expression-395"><span class="linenos">395</span></a> <span class="k">def</span> <span class="nf">from_expression</span><span class="p">(</span> +</span><span id="SetOperation.from_expression-396"><a href="#SetOperation.from_expression-396"><span class="linenos">396</span></a> <span class="bp">cls</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">ctes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">Step</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="SetOperation.from_expression-397"><a href="#SetOperation.from_expression-397"><span class="linenos">397</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">Step</span><span class="p">:</span> +</span><span id="SetOperation.from_expression-398"><a href="#SetOperation.from_expression-398"><span class="linenos">398</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Union</span><span class="p">)</span> +</span><span id="SetOperation.from_expression-399"><a href="#SetOperation.from_expression-399"><span class="linenos">399</span></a> <span class="n">left</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">left</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="SetOperation.from_expression-400"><a href="#SetOperation.from_expression-400"><span class="linenos">400</span></a> <span class="n">right</span> <span class="o">=</span> <span class="n">Step</span><span class="o">.</span><span class="n">from_expression</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">right</span><span class="p">,</span> <span class="n">ctes</span><span class="p">)</span> +</span><span id="SetOperation.from_expression-401"><a href="#SetOperation.from_expression-401"><span class="linenos">401</span></a> <span class="n">step</span> <span class="o">=</span> <span class="bp">cls</span><span class="p">(</span> +</span><span id="SetOperation.from_expression-402"><a href="#SetOperation.from_expression-402"><span class="linenos">402</span></a> <span class="n">op</span><span class="o">=</span><span class="n">expression</span><span class="o">.</span><span class="vm">__class__</span><span class="p">,</span> +</span><span id="SetOperation.from_expression-403"><a href="#SetOperation.from_expression-403"><span class="linenos">403</span></a> <span class="n">left</span><span class="o">=</span><span class="n">left</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="SetOperation.from_expression-404"><a href="#SetOperation.from_expression-404"><span class="linenos">404</span></a> <span class="n">right</span><span class="o">=</span><span class="n">right</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="SetOperation.from_expression-405"><a href="#SetOperation.from_expression-405"><span class="linenos">405</span></a> <span class="n">distinct</span><span class="o">=</span><span class="nb">bool</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)),</span> +</span><span id="SetOperation.from_expression-406"><a href="#SetOperation.from_expression-406"><span class="linenos">406</span></a> <span class="p">)</span> +</span><span id="SetOperation.from_expression-407"><a href="#SetOperation.from_expression-407"><span class="linenos">407</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">left</span><span class="p">)</span> +</span><span id="SetOperation.from_expression-408"><a href="#SetOperation.from_expression-408"><span class="linenos">408</span></a> <span class="n">step</span><span class="o">.</span><span class="n">add_dependency</span><span class="p">(</span><span class="n">right</span><span class="p">)</span> +</span><span id="SetOperation.from_expression-409"><a href="#SetOperation.from_expression-409"><span class="linenos">409</span></a> <span class="k">return</span> <span class="n">step</span> +</span></pre></div> + + + <div class="docstring"><p>Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine. +Note: the expression's tables and subqueries must be aliased for this method to work. For +example, given the following expression:</p> + +<p>SELECT + x.a, + SUM(x.b) +FROM x AS x +JOIN y AS y + ON x.a = y.a +GROUP BY x.a</p> + +<p>the following DAG is produced (the expression IDs might differ per execution):</p> + +<ul> +<li>Aggregate: x (4347984624) +Context: + Aggregations: + - SUM(x.b) + Group: + - x.a +Projections: +<ul> +<li>x.a</li> +<li>"x"."" +Dependencies: +<ul> +<li>Join: x (4347985296) +Context: +y: +On: x.a = y.a +Projections: +Dependencies:</li> +</ul></li> +<li>Scan: x (4347983136) +Context: + Source: x AS x +Projections:</li> +<li>Scan: y (4343416624) +Context: + Source: y AS y +Projections:</li> +</ul></li> +</ul> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression to build the DAG from.</li> +<li><strong>ctes:</strong> a dictionary that maps CTEs to their corresponding Step DAG by name.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A Step DAG corresponding to <code>expression</code>.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#Step">Step</a></dt> + <dd id="SetOperation.add_dependency" class="function"><a href="#Step.add_dependency">add_dependency</a></dd> + <dd id="SetOperation.to_s" class="function"><a href="#Step.to_s">to_s</a></dd> + + </div> + </dl> + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/schema.html b/docs/sqlglot/schema.html new file mode 100644 index 0000000..9edba6c --- /dev/null +++ b/docs/sqlglot/schema.html @@ -0,0 +1,1624 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.schema API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#Schema">Schema</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Schema.add_table">add_table</a> + </li> + <li> + <a class="function" href="#Schema.column_names">column_names</a> + </li> + <li> + <a class="function" href="#Schema.get_column_type">get_column_type</a> + </li> + <li> + <a class="variable" href="#Schema.supported_table_args">supported_table_args</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#AbstractMappingSchema">AbstractMappingSchema</a> + <ul class="memberlist"> + <li> + <a class="function" href="#AbstractMappingSchema.__init__">AbstractMappingSchema</a> + </li> + <li> + <a class="function" href="#AbstractMappingSchema.table_parts">table_parts</a> + </li> + <li> + <a class="function" href="#AbstractMappingSchema.find">find</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#MappingSchema">MappingSchema</a> + <ul class="memberlist"> + <li> + <a class="function" href="#MappingSchema.__init__">MappingSchema</a> + </li> + <li> + <a class="function" href="#MappingSchema.from_mapping_schema">from_mapping_schema</a> + </li> + <li> + <a class="function" href="#MappingSchema.copy">copy</a> + </li> + <li> + <a class="function" href="#MappingSchema.add_table">add_table</a> + </li> + <li> + <a class="function" href="#MappingSchema.column_names">column_names</a> + </li> + <li> + <a class="function" href="#MappingSchema.get_column_type">get_column_type</a> + </li> + </ul> + + </li> + <li> + <a class="function" href="#ensure_schema">ensure_schema</a> + </li> + <li> + <a class="function" href="#ensure_column_mapping">ensure_column_mapping</a> + </li> + <li> + <a class="function" href="#flatten_schema">flatten_schema</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/schema.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.schema </h1> + + + <input id="mod-schema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-schema-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">abc</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">import</span> <span class="nn">sqlglot</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="kn">from</span> <span class="nn">sqlglot.errors</span> <span class="kn">import</span> <span class="n">SchemaError</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">dict_depth</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot.trie</span> <span class="kn">import</span> <span class="n">in_trie</span><span class="p">,</span> <span class="n">new_trie</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.types</span> <span class="kn">import</span> <span class="n">StructType</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">DialectType</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="n">ColumnMapping</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">StructType</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">]</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="n">TABLE_ARGS</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"this"</span><span class="p">,</span> <span class="s2">"db"</span><span class="p">,</span> <span class="s2">"catalog"</span><span class="p">)</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="n">T</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">TypeVar</span><span class="p">(</span><span class="s2">"T"</span><span class="p">)</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="k">class</span> <span class="nc">Schema</span><span class="p">(</span><span class="n">abc</span><span class="o">.</span><span class="n">ABC</span><span class="p">):</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a><span class="w"> </span><span class="sd">"""Abstract base class for database schemas"""</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="k">def</span> <span class="nf">add_table</span><span class="p">(</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a><span class="sd"> Register or update a table. Some implementing classes may require column information to also be provided.</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a><span class="sd"> Args:</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a><span class="sd"> table: table expression instance or string representing the table.</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a><span class="sd"> column_mapping: a column mapping that describes the structure of the table.</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a><span class="sd"> """</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="k">def</span> <span class="nf">column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a><span class="sd"> Get the column names for a table.</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a><span class="sd"> Args:</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a><span class="sd"> table: the `Table` expression instance.</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a><span class="sd"> only_visible: whether to include invisible columns.</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="sd"> Returns:</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> The list of column names.</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a><span class="sd"> """</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="k">def</span> <span class="nf">get_column_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a><span class="sd"> Get the :class:`sqlglot.exp.DataType` type of a column in the schema.</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> Args:</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> table: the source table.</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a><span class="sd"> column: the target column.</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a><span class="sd"> Returns:</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a><span class="sd"> The resulting column type.</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a><span class="sd"> """</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="nd">@property</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="k">def</span> <span class="nf">supported_table_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]:</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a><span class="sd"> Table arguments this schema support, e.g. `("this", "db", "catalog")`</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a><span class="sd"> """</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a><span class="k">class</span> <span class="nc">AbstractMappingSchema</span><span class="p">(</span><span class="n">t</span><span class="o">.</span><span class="n">Generic</span><span class="p">[</span><span class="n">T</span><span class="p">]):</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">mapping</span><span class="p">:</span> <span class="nb">dict</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span> <span class="o">=</span> <span class="n">mapping</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="k">def</span> <span class="nf">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="k">return</span> <span class="n">new_trie</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="n">t</span><span class="p">))</span> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_depth</span><span class="p">()))</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="k">def</span> <span class="nf">_depth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="k">return</span> <span class="n">dict_depth</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="nd">@property</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">def</span> <span class="nf">supported_table_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]:</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">:</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">depth</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_depth</span><span class="p">()</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">depth</span><span class="p">:</span> <span class="c1"># None</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">elif</span> <span class="mi">1</span> <span class="o"><=</span> <span class="n">depth</span> <span class="o"><=</span> <span class="mi">3</span><span class="p">:</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> <span class="o">=</span> <span class="n">TABLE_ARGS</span><span class="p">[:</span><span class="n">depth</span><span class="p">]</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid mapping shape. Depth: </span><span class="si">{</span><span class="n">depth</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="k">def</span> <span class="nf">table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">part</span><span class="p">)</span> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="n">TABLE_ARGS</span> <span class="k">if</span> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">part</span><span class="p">)]</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table</span><span class="p">)[</span><span class="mi">0</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">)]</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">value</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="k">if</span> <span class="n">trie</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">trie</span><span class="p">,</span> <span class="n">parts</span><span class="p">)</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">elif</span> <span class="n">value</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">possibilities</span> <span class="o">=</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="n">dict_depth</span><span class="p">(</span><span class="n">trie</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">possibilities</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">parts</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">possibilities</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">message</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="k">for</span> <span class="n">parts</span> <span class="ow">in</span> <span class="n">possibilities</span><span class="p">)</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="k">if</span> <span class="n">raise_on_missing</span><span class="p">:</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Ambiguous mapping for </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">message</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nested_get</span><span class="p">(</span><span class="n">parts</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="n">raise_on_missing</span><span class="p">)</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">def</span> <span class="nf">_nested_get</span><span class="p">(</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parts</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">True</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]:</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">return</span> <span class="n">_nested_get</span><span class="p">(</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">d</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="o">*</span><span class="nb">zip</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">,</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">parts</span><span class="p">)),</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">raise_on_missing</span><span class="o">=</span><span class="n">raise_on_missing</span><span class="p">,</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="p">)</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a><span class="k">class</span> <span class="nc">MappingSchema</span><span class="p">(</span><span class="n">AbstractMappingSchema</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]],</span> <span class="n">Schema</span><span class="p">):</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a><span class="sd"> Schema based on a nested mapping.</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a><span class="sd"> Args:</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a><span class="sd"> schema (dict): Mapping in one of the following forms:</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a><span class="sd"> 1. {table: {col: type}}</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="sd"> 2. {db: {table: {col: type}}}</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a><span class="sd"> 3. {catalog: {db: {table: {col: type}}}}</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a><span class="sd"> 4. None - Tables will be added later</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a><span class="sd"> visible (dict): Optional mapping of which columns in the schema are visible. If not provided, all columns</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a><span class="sd"> are assumed to be visible. The nesting should mirror that of the schema:</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a><span class="sd"> 1. {table: set(*cols)}}</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a><span class="sd"> 2. {db: {table: set(*cols)}}}</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a><span class="sd"> 3. {catalog: {db: {table: set(*cols)}}}}</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a><span class="sd"> dialect (str): The dialect to be used for custom type mappings.</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a><span class="sd"> """</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> +</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">visible</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dialect</span> <span class="o">=</span> <span class="n">dialect</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span> <span class="o">=</span> <span class="n">visible</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize</span><span class="p">(</span><span class="n">schema</span> <span class="ow">or</span> <span class="p">{}))</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="nd">@classmethod</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">from_mapping_schema</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">mapping_schema</span><span class="p">:</span> <span class="n">MappingSchema</span><span class="p">)</span> <span class="o">-></span> <span class="n">MappingSchema</span><span class="p">:</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">visible</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">visible</span><span class="p">,</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="p">)</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">MappingSchema</span><span class="p">:</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="s2">"schema"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="s2">"visible"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="s2">"dialect"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="p">}</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="p">)</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="k">def</span> <span class="nf">_normalize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a><span class="sd"> Converts all identifiers in the schema into lowercase, unless they're quoted.</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a><span class="sd"> Args:</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a><span class="sd"> schema: the schema to normalize.</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a><span class="sd"> Returns:</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a><span class="sd"> The normalized schema mapping.</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a><span class="sd"> """</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">flattened_schema</span> <span class="o">=</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="n">dict_depth</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="n">normalized_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="k">for</span> <span class="n">keys</span> <span class="ow">in</span> <span class="n">flattened_schema</span><span class="p">:</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">_nested_get</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="o">*</span><span class="nb">zip</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="n">keys</span><span class="p">))</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="k">assert</span> <span class="n">columns</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> +</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="n">normalized_keys</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize_name</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">]</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="k">for</span> <span class="n">column_name</span><span class="p">,</span> <span class="n">column_type</span> <span class="ow">in</span> <span class="n">columns</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">_nested_set</span><span class="p">(</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">normalized_mapping</span><span class="p">,</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">normalized_keys</span> <span class="o">+</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize_name</span><span class="p">(</span><span class="n">column_name</span><span class="p">)],</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">column_type</span><span class="p">,</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="p">)</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="k">return</span> <span class="n">normalized_mapping</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="k">def</span> <span class="nf">add_table</span><span class="p">(</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a><span class="sd"> Register or update a table. Updates are only performed if a new column mapping is provided.</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a><span class="sd"> Args:</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a><span class="sd"> table: the `Table` expression instance or string representing the table.</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a><span class="sd"> column_mapping: a column mapping that describes the structure of the table.</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a><span class="sd"> """</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="n">ensure_column_mapping</span><span class="p">(</span><span class="n">column_mapping</span><span class="p">)</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">column_mapping</span><span class="p">:</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="k">return</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="n">_nested_set</span><span class="p">(</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="nb">list</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table_</span><span class="p">))),</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="n">column_mapping</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="p">)</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="k">def</span> <span class="nf">_normalize_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="n">identifier</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">parse_one</span><span class="p">(</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="n">name</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="p">)</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="k">except</span><span class="p">:</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">identifier</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="k">if</span> <span class="n">identifier</span><span class="o">.</span><span class="n">quoted</span><span class="p">:</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="k">return</span> <span class="n">identifier</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="k">return</span> <span class="n">identifier</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="k">def</span> <span class="nf">_depth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="c1"># The columns themselves are a mapping, but we don't want to include those</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_depth</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="k">def</span> <span class="nf">_ensure_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_</span><span class="p">:</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Not a valid table '</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="k">return</span> <span class="n">table_</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="k">def</span> <span class="nf">column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">)</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">only_visible</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="p">:</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="n">visible</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nested_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table_</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="p">)</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">schema</span> <span class="k">if</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">visible</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="k">def</span> <span class="nf">get_column_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">column_name</span> <span class="o">=</span> <span class="n">column</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="k">if</span> <span class="n">table_</span><span class="p">:</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">table_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="k">if</span> <span class="n">table_schema</span><span class="p">:</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="n">column_type</span> <span class="o">=</span> <span class="n">table_schema</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">column_name</span><span class="p">)</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column_type</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="k">return</span> <span class="n">column_type</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column_type</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_data_type</span><span class="p">(</span><span class="n">column_type</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown column type '</span><span class="si">{</span><span class="n">column_type</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">)</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not convert table '</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="k">def</span> <span class="nf">_to_data_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema_type</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a><span class="sd"> Convert a type represented as a string to the corresponding :class:`sqlglot.exp.DataType` object.</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a><span class="sd"> Args:</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a><span class="sd"> schema_type: the type we want to convert.</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a><span class="sd"> Returns:</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a><span class="sd"> The resulting expression type.</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a><span class="sd"> """</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="k">if</span> <span class="n">schema_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">:</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">schema_type</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not parse </span><span class="si">{</span><span class="n">schema_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">[</span><span class="n">schema_type</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression</span> <span class="c1"># type: ignore</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Failed to convert type </span><span class="si">{</span><span class="n">schema_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">[</span><span class="n">schema_type</span><span class="p">]</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a><span class="k">def</span> <span class="nf">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Schema</span><span class="p">:</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">Schema</span><span class="p">):</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="k">return</span> <span class="n">schema</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a><span class="k">def</span> <span class="nf">ensure_column_mapping</span><span class="p">(</span><span class="n">mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]):</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="k">return</span> <span class="n">mapping</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="n">col_name_type_strs</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">mapping</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">)]</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="n">name_type_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">":"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">():</span> <span class="n">name_type_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">":"</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="k">for</span> <span class="n">name_type_str</span> <span class="ow">in</span> <span class="n">col_name_type_strs</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="p">}</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="c1"># Check if mapping looks like a DataFrame StructType</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="s2">"simpleString"</span><span class="p">):</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">struct_field</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">struct_field</span><span class="o">.</span><span class="n">dataType</span><span class="o">.</span><span class="n">simpleString</span><span class="p">()</span> <span class="k">for</span> <span class="n">struct_field</span> <span class="ow">in</span> <span class="n">mapping</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">x</span><span class="o">.</span><span class="n">strip</span><span class="p">():</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">mapping</span><span class="p">}</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="k">elif</span> <span class="n">mapping</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid mapping provided: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">mapping</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a><span class="k">def</span> <span class="nf">flatten_schema</span><span class="p">(</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">depth</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">keys</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]:</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">keys</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">schema</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="k">if</span> <span class="n">depth</span> <span class="o">>=</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="n">tables</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">flatten_schema</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">depth</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">keys</span> <span class="o">+</span> <span class="p">[</span><span class="n">k</span><span class="p">]))</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="k">elif</span> <span class="n">depth</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="n">tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">keys</span> <span class="o">+</span> <span class="p">[</span><span class="n">k</span><span class="p">])</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="k">return</span> <span class="n">tables</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a><span class="k">def</span> <span class="nf">_nested_get</span><span class="p">(</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="o">*</span><span class="n">path</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="n">raise_on_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]:</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a><span class="sd"> Get a value for a nested dictionary.</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a><span class="sd"> Args:</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a><span class="sd"> d: the dictionary to search.</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a><span class="sd"> *path: tuples of (name, key), where:</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a><span class="sd"> `key` is the key in the dictionary to get.</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a><span class="sd"> `name` is a string to use in the error if `key` isn't found.</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a><span class="sd"> Returns:</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a><span class="sd"> The value or None if it doesn't exist.</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a><span class="sd"> """</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">path</span><span class="p">:</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="n">d</span> <span class="o">=</span> <span class="n">d</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="k">if</span> <span class="n">d</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">if</span> <span class="n">raise_on_missing</span><span class="p">:</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">name</span> <span class="o">=</span> <span class="s2">"table"</span> <span class="k">if</span> <span class="n">name</span> <span class="o">==</span> <span class="s2">"this"</span> <span class="k">else</span> <span class="n">name</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown </span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="k">return</span> <span class="n">d</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a><span class="k">def</span> <span class="nf">_nested_set</span><span class="p">(</span><span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">keys</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a><span class="sd"> In-place set a value for a nested dictionary</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a><span class="sd"> Example:</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a><span class="sd"> >>> _nested_set({}, ["top_key", "second_key"], "value")</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a><span class="sd"> {'top_key': {'second_key': 'value'}}</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a><span class="sd"> >>> _nested_set({"top_key": {"third_key": "third_value"}}, ["top_key", "second_key"], "value")</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a><span class="sd"> {'top_key': {'third_key': 'third_value', 'second_key': 'value'}}</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a><span class="sd"> Args:</span> +</span><span id="L-386"><a href="#L-386"><span class="linenos">386</span></a><span class="sd"> d: dictionary to update.</span> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a><span class="sd"> keys: the keys that makeup the path to `value`.</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a><span class="sd"> value: the value to set in the dictionary for the given key path.</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a> +</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a><span class="sd"> Returns:</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a><span class="sd"> The (possibly) updated dictionary.</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a><span class="sd"> """</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">keys</span><span class="p">:</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="k">return</span> <span class="n">d</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">keys</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="n">d</span><span class="p">[</span><span class="n">keys</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="k">return</span> <span class="n">d</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> +</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="n">subd</span> <span class="o">=</span> <span class="n">d</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]:</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> <span class="k">if</span> <span class="n">key</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">subd</span><span class="p">:</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="n">subd</span> <span class="o">=</span> <span class="n">subd</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="p">{})</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos">404</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos">405</span></a> <span class="n">subd</span> <span class="o">=</span> <span class="n">subd</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos">406</span></a> +</span><span id="L-407"><a href="#L-407"><span class="linenos">407</span></a> <span class="n">subd</span><span class="p">[</span><span class="n">keys</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span> <span class="o">=</span> <span class="n">value</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos">408</span></a> <span class="k">return</span> <span class="n">d</span> +</span></pre></div> + + + </section> + <section id="Schema"> + <input id="Schema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Schema</span><wbr>(<span class="base">abc.ABC</span>): + + <label class="view-source-button" for="Schema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Schema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Schema-24"><a href="#Schema-24"><span class="linenos">24</span></a><span class="k">class</span> <span class="nc">Schema</span><span class="p">(</span><span class="n">abc</span><span class="o">.</span><span class="n">ABC</span><span class="p">):</span> +</span><span id="Schema-25"><a href="#Schema-25"><span class="linenos">25</span></a><span class="w"> </span><span class="sd">"""Abstract base class for database schemas"""</span> +</span><span id="Schema-26"><a href="#Schema-26"><span class="linenos">26</span></a> +</span><span id="Schema-27"><a href="#Schema-27"><span class="linenos">27</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="Schema-28"><a href="#Schema-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">add_table</span><span class="p">(</span> +</span><span id="Schema-29"><a href="#Schema-29"><span class="linenos">29</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Schema-30"><a href="#Schema-30"><span class="linenos">30</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Schema-31"><a href="#Schema-31"><span class="linenos">31</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema-32"><a href="#Schema-32"><span class="linenos">32</span></a><span class="sd"> Register or update a table. Some implementing classes may require column information to also be provided.</span> +</span><span id="Schema-33"><a href="#Schema-33"><span class="linenos">33</span></a> +</span><span id="Schema-34"><a href="#Schema-34"><span class="linenos">34</span></a><span class="sd"> Args:</span> +</span><span id="Schema-35"><a href="#Schema-35"><span class="linenos">35</span></a><span class="sd"> table: table expression instance or string representing the table.</span> +</span><span id="Schema-36"><a href="#Schema-36"><span class="linenos">36</span></a><span class="sd"> column_mapping: a column mapping that describes the structure of the table.</span> +</span><span id="Schema-37"><a href="#Schema-37"><span class="linenos">37</span></a><span class="sd"> """</span> +</span><span id="Schema-38"><a href="#Schema-38"><span class="linenos">38</span></a> +</span><span id="Schema-39"><a href="#Schema-39"><span class="linenos">39</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="Schema-40"><a href="#Schema-40"><span class="linenos">40</span></a> <span class="k">def</span> <span class="nf">column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Schema-41"><a href="#Schema-41"><span class="linenos">41</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema-42"><a href="#Schema-42"><span class="linenos">42</span></a><span class="sd"> Get the column names for a table.</span> +</span><span id="Schema-43"><a href="#Schema-43"><span class="linenos">43</span></a> +</span><span id="Schema-44"><a href="#Schema-44"><span class="linenos">44</span></a><span class="sd"> Args:</span> +</span><span id="Schema-45"><a href="#Schema-45"><span class="linenos">45</span></a><span class="sd"> table: the `Table` expression instance.</span> +</span><span id="Schema-46"><a href="#Schema-46"><span class="linenos">46</span></a><span class="sd"> only_visible: whether to include invisible columns.</span> +</span><span id="Schema-47"><a href="#Schema-47"><span class="linenos">47</span></a> +</span><span id="Schema-48"><a href="#Schema-48"><span class="linenos">48</span></a><span class="sd"> Returns:</span> +</span><span id="Schema-49"><a href="#Schema-49"><span class="linenos">49</span></a><span class="sd"> The list of column names.</span> +</span><span id="Schema-50"><a href="#Schema-50"><span class="linenos">50</span></a><span class="sd"> """</span> +</span><span id="Schema-51"><a href="#Schema-51"><span class="linenos">51</span></a> +</span><span id="Schema-52"><a href="#Schema-52"><span class="linenos">52</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="Schema-53"><a href="#Schema-53"><span class="linenos">53</span></a> <span class="k">def</span> <span class="nf">get_column_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="Schema-54"><a href="#Schema-54"><span class="linenos">54</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema-55"><a href="#Schema-55"><span class="linenos">55</span></a><span class="sd"> Get the :class:`sqlglot.exp.DataType` type of a column in the schema.</span> +</span><span id="Schema-56"><a href="#Schema-56"><span class="linenos">56</span></a> +</span><span id="Schema-57"><a href="#Schema-57"><span class="linenos">57</span></a><span class="sd"> Args:</span> +</span><span id="Schema-58"><a href="#Schema-58"><span class="linenos">58</span></a><span class="sd"> table: the source table.</span> +</span><span id="Schema-59"><a href="#Schema-59"><span class="linenos">59</span></a><span class="sd"> column: the target column.</span> +</span><span id="Schema-60"><a href="#Schema-60"><span class="linenos">60</span></a> +</span><span id="Schema-61"><a href="#Schema-61"><span class="linenos">61</span></a><span class="sd"> Returns:</span> +</span><span id="Schema-62"><a href="#Schema-62"><span class="linenos">62</span></a><span class="sd"> The resulting column type.</span> +</span><span id="Schema-63"><a href="#Schema-63"><span class="linenos">63</span></a><span class="sd"> """</span> +</span><span id="Schema-64"><a href="#Schema-64"><span class="linenos">64</span></a> +</span><span id="Schema-65"><a href="#Schema-65"><span class="linenos">65</span></a> <span class="nd">@property</span> +</span><span id="Schema-66"><a href="#Schema-66"><span class="linenos">66</span></a> <span class="k">def</span> <span class="nf">supported_table_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]:</span> +</span><span id="Schema-67"><a href="#Schema-67"><span class="linenos">67</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema-68"><a href="#Schema-68"><span class="linenos">68</span></a><span class="sd"> Table arguments this schema support, e.g. `("this", "db", "catalog")`</span> +</span><span id="Schema-69"><a href="#Schema-69"><span class="linenos">69</span></a><span class="sd"> """</span> +</span><span id="Schema-70"><a href="#Schema-70"><span class="linenos">70</span></a> <span class="k">raise</span> <span class="ne">NotImplementedError</span> +</span></pre></div> + + + <div class="docstring"><p>Abstract base class for database schemas</p> +</div> + + + <div id="Schema.add_table" class="classattr"> + <input id="Schema.add_table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@abc.abstractmethod</div> + + <span class="def">def</span> + <span class="name">add_table</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span> <span class="o">|</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Dict</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">dataframe</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">types</span><span class="o">.</span><span class="n">StructType</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Schema.add_table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Schema.add_table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Schema.add_table-27"><a href="#Schema.add_table-27"><span class="linenos">27</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="Schema.add_table-28"><a href="#Schema.add_table-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">add_table</span><span class="p">(</span> +</span><span id="Schema.add_table-29"><a href="#Schema.add_table-29"><span class="linenos">29</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Schema.add_table-30"><a href="#Schema.add_table-30"><span class="linenos">30</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Schema.add_table-31"><a href="#Schema.add_table-31"><span class="linenos">31</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema.add_table-32"><a href="#Schema.add_table-32"><span class="linenos">32</span></a><span class="sd"> Register or update a table. Some implementing classes may require column information to also be provided.</span> +</span><span id="Schema.add_table-33"><a href="#Schema.add_table-33"><span class="linenos">33</span></a> +</span><span id="Schema.add_table-34"><a href="#Schema.add_table-34"><span class="linenos">34</span></a><span class="sd"> Args:</span> +</span><span id="Schema.add_table-35"><a href="#Schema.add_table-35"><span class="linenos">35</span></a><span class="sd"> table: table expression instance or string representing the table.</span> +</span><span id="Schema.add_table-36"><a href="#Schema.add_table-36"><span class="linenos">36</span></a><span class="sd"> column_mapping: a column mapping that describes the structure of the table.</span> +</span><span id="Schema.add_table-37"><a href="#Schema.add_table-37"><span class="linenos">37</span></a><span class="sd"> """</span> +</span></pre></div> + + + <div class="docstring"><p>Register or update a table. Some implementing classes may require column information to also be provided.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table:</strong> table expression instance or string representing the table.</li> +<li><strong>column_mapping:</strong> a column mapping that describes the structure of the table.</li> +</ul> +</div> + + + </div> + <div id="Schema.column_names" class="classattr"> + <input id="Schema.column_names-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@abc.abstractmethod</div> + + <span class="def">def</span> + <span class="name">column_names</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span> <span class="o">|</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Schema.column_names-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Schema.column_names"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Schema.column_names-39"><a href="#Schema.column_names-39"><span class="linenos">39</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="Schema.column_names-40"><a href="#Schema.column_names-40"><span class="linenos">40</span></a> <span class="k">def</span> <span class="nf">column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="Schema.column_names-41"><a href="#Schema.column_names-41"><span class="linenos">41</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema.column_names-42"><a href="#Schema.column_names-42"><span class="linenos">42</span></a><span class="sd"> Get the column names for a table.</span> +</span><span id="Schema.column_names-43"><a href="#Schema.column_names-43"><span class="linenos">43</span></a> +</span><span id="Schema.column_names-44"><a href="#Schema.column_names-44"><span class="linenos">44</span></a><span class="sd"> Args:</span> +</span><span id="Schema.column_names-45"><a href="#Schema.column_names-45"><span class="linenos">45</span></a><span class="sd"> table: the `Table` expression instance.</span> +</span><span id="Schema.column_names-46"><a href="#Schema.column_names-46"><span class="linenos">46</span></a><span class="sd"> only_visible: whether to include invisible columns.</span> +</span><span id="Schema.column_names-47"><a href="#Schema.column_names-47"><span class="linenos">47</span></a> +</span><span id="Schema.column_names-48"><a href="#Schema.column_names-48"><span class="linenos">48</span></a><span class="sd"> Returns:</span> +</span><span id="Schema.column_names-49"><a href="#Schema.column_names-49"><span class="linenos">49</span></a><span class="sd"> The list of column names.</span> +</span><span id="Schema.column_names-50"><a href="#Schema.column_names-50"><span class="linenos">50</span></a><span class="sd"> """</span> +</span></pre></div> + + + <div class="docstring"><p>Get the column names for a table.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table:</strong> the <code>Table</code> expression instance.</li> +<li><strong>only_visible:</strong> whether to include invisible columns.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The list of column names.</p> +</blockquote> +</div> + + + </div> + <div id="Schema.get_column_type" class="classattr"> + <input id="Schema.get_column_type-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@abc.abstractmethod</div> + + <span class="def">def</span> + <span class="name">get_column_type</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span> <span class="o">|</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">column</span><span class="p">:</span> <span class="n"><a href="expressions.html#Column">sqlglot.expressions.Column</a></span></span><span class="return-annotation">) -> <span class="n"><a href="expressions.html#DataType">sqlglot.expressions.DataType</a></span>:</span></span> + + <label class="view-source-button" for="Schema.get_column_type-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Schema.get_column_type"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Schema.get_column_type-52"><a href="#Schema.get_column_type-52"><span class="linenos">52</span></a> <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span> +</span><span id="Schema.get_column_type-53"><a href="#Schema.get_column_type-53"><span class="linenos">53</span></a> <span class="k">def</span> <span class="nf">get_column_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="Schema.get_column_type-54"><a href="#Schema.get_column_type-54"><span class="linenos">54</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Schema.get_column_type-55"><a href="#Schema.get_column_type-55"><span class="linenos">55</span></a><span class="sd"> Get the :class:`sqlglot.exp.DataType` type of a column in the schema.</span> +</span><span id="Schema.get_column_type-56"><a href="#Schema.get_column_type-56"><span class="linenos">56</span></a> +</span><span id="Schema.get_column_type-57"><a href="#Schema.get_column_type-57"><span class="linenos">57</span></a><span class="sd"> Args:</span> +</span><span id="Schema.get_column_type-58"><a href="#Schema.get_column_type-58"><span class="linenos">58</span></a><span class="sd"> table: the source table.</span> +</span><span id="Schema.get_column_type-59"><a href="#Schema.get_column_type-59"><span class="linenos">59</span></a><span class="sd"> column: the target column.</span> +</span><span id="Schema.get_column_type-60"><a href="#Schema.get_column_type-60"><span class="linenos">60</span></a> +</span><span id="Schema.get_column_type-61"><a href="#Schema.get_column_type-61"><span class="linenos">61</span></a><span class="sd"> Returns:</span> +</span><span id="Schema.get_column_type-62"><a href="#Schema.get_column_type-62"><span class="linenos">62</span></a><span class="sd"> The resulting column type.</span> +</span><span id="Schema.get_column_type-63"><a href="#Schema.get_column_type-63"><span class="linenos">63</span></a><span class="sd"> """</span> +</span></pre></div> + + + <div class="docstring"><p>Get the <code>sqlglot.exp.DataType</code> type of a column in the schema.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table:</strong> the source table.</li> +<li><strong>column:</strong> the target column.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The resulting column type.</p> +</blockquote> +</div> + + + </div> + <div id="Schema.supported_table_args" class="classattr"> + <div class="attr variable"> + <span class="name">supported_table_args</span><span class="annotation">: Tuple[str, ...]</span> + + + </div> + <a class="headerlink" href="#Schema.supported_table_args"></a> + + <div class="docstring"><p>Table arguments this schema support, e.g. <code>("this", "db", "catalog")</code></p> +</div> + + + </div> + </section> + <section id="AbstractMappingSchema"> + <input id="AbstractMappingSchema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">AbstractMappingSchema</span><wbr>(<span class="base">typing.Generic[~T]</span>): + + <label class="view-source-button" for="AbstractMappingSchema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AbstractMappingSchema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AbstractMappingSchema-73"><a href="#AbstractMappingSchema-73"><span class="linenos"> 73</span></a><span class="k">class</span> <span class="nc">AbstractMappingSchema</span><span class="p">(</span><span class="n">t</span><span class="o">.</span><span class="n">Generic</span><span class="p">[</span><span class="n">T</span><span class="p">]):</span> +</span><span id="AbstractMappingSchema-74"><a href="#AbstractMappingSchema-74"><span class="linenos"> 74</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="AbstractMappingSchema-75"><a href="#AbstractMappingSchema-75"><span class="linenos"> 75</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="AbstractMappingSchema-76"><a href="#AbstractMappingSchema-76"><span class="linenos"> 76</span></a> <span class="n">mapping</span><span class="p">:</span> <span class="nb">dict</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="AbstractMappingSchema-77"><a href="#AbstractMappingSchema-77"><span class="linenos"> 77</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-78"><a href="#AbstractMappingSchema-78"><span class="linenos"> 78</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span> <span class="o">=</span> <span class="n">mapping</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="AbstractMappingSchema-79"><a href="#AbstractMappingSchema-79"><span class="linenos"> 79</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-80"><a href="#AbstractMappingSchema-80"><span class="linenos"> 80</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="AbstractMappingSchema-81"><a href="#AbstractMappingSchema-81"><span class="linenos"> 81</span></a> +</span><span id="AbstractMappingSchema-82"><a href="#AbstractMappingSchema-82"><span class="linenos"> 82</span></a> <span class="k">def</span> <span class="nf">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-83"><a href="#AbstractMappingSchema-83"><span class="linenos"> 83</span></a> <span class="k">return</span> <span class="n">new_trie</span><span class="p">(</span><span class="nb">tuple</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="n">t</span><span class="p">))</span> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_depth</span><span class="p">()))</span> +</span><span id="AbstractMappingSchema-84"><a href="#AbstractMappingSchema-84"><span class="linenos"> 84</span></a> +</span><span id="AbstractMappingSchema-85"><a href="#AbstractMappingSchema-85"><span class="linenos"> 85</span></a> <span class="k">def</span> <span class="nf">_depth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-86"><a href="#AbstractMappingSchema-86"><span class="linenos"> 86</span></a> <span class="k">return</span> <span class="n">dict_depth</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-87"><a href="#AbstractMappingSchema-87"><span class="linenos"> 87</span></a> +</span><span id="AbstractMappingSchema-88"><a href="#AbstractMappingSchema-88"><span class="linenos"> 88</span></a> <span class="nd">@property</span> +</span><span id="AbstractMappingSchema-89"><a href="#AbstractMappingSchema-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="nf">supported_table_args</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]:</span> +</span><span id="AbstractMappingSchema-90"><a href="#AbstractMappingSchema-90"><span class="linenos"> 90</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-91"><a href="#AbstractMappingSchema-91"><span class="linenos"> 91</span></a> <span class="n">depth</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_depth</span><span class="p">()</span> +</span><span id="AbstractMappingSchema-92"><a href="#AbstractMappingSchema-92"><span class="linenos"> 92</span></a> +</span><span id="AbstractMappingSchema-93"><a href="#AbstractMappingSchema-93"><span class="linenos"> 93</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">depth</span><span class="p">:</span> <span class="c1"># None</span> +</span><span id="AbstractMappingSchema-94"><a href="#AbstractMappingSchema-94"><span class="linenos"> 94</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span> +</span><span id="AbstractMappingSchema-95"><a href="#AbstractMappingSchema-95"><span class="linenos"> 95</span></a> <span class="k">elif</span> <span class="mi">1</span> <span class="o"><=</span> <span class="n">depth</span> <span class="o"><=</span> <span class="mi">3</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-96"><a href="#AbstractMappingSchema-96"><span class="linenos"> 96</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> <span class="o">=</span> <span class="n">TABLE_ARGS</span><span class="p">[:</span><span class="n">depth</span><span class="p">]</span> +</span><span id="AbstractMappingSchema-97"><a href="#AbstractMappingSchema-97"><span class="linenos"> 97</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-98"><a href="#AbstractMappingSchema-98"><span class="linenos"> 98</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid mapping shape. Depth: </span><span class="si">{</span><span class="n">depth</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-99"><a href="#AbstractMappingSchema-99"><span class="linenos"> 99</span></a> +</span><span id="AbstractMappingSchema-100"><a href="#AbstractMappingSchema-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span> +</span><span id="AbstractMappingSchema-101"><a href="#AbstractMappingSchema-101"><span class="linenos">101</span></a> +</span><span id="AbstractMappingSchema-102"><a href="#AbstractMappingSchema-102"><span class="linenos">102</span></a> <span class="k">def</span> <span class="nf">table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="AbstractMappingSchema-103"><a href="#AbstractMappingSchema-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="AbstractMappingSchema-104"><a href="#AbstractMappingSchema-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span><span id="AbstractMappingSchema-105"><a href="#AbstractMappingSchema-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">part</span><span class="p">)</span> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="n">TABLE_ARGS</span> <span class="k">if</span> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">part</span><span class="p">)]</span> +</span><span id="AbstractMappingSchema-106"><a href="#AbstractMappingSchema-106"><span class="linenos">106</span></a> +</span><span id="AbstractMappingSchema-107"><a href="#AbstractMappingSchema-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span> +</span><span id="AbstractMappingSchema-108"><a href="#AbstractMappingSchema-108"><span class="linenos">108</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="AbstractMappingSchema-109"><a href="#AbstractMappingSchema-109"><span class="linenos">109</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="AbstractMappingSchema-110"><a href="#AbstractMappingSchema-110"><span class="linenos">110</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table</span><span class="p">)[</span><span class="mi">0</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">)]</span> +</span><span id="AbstractMappingSchema-111"><a href="#AbstractMappingSchema-111"><span class="linenos">111</span></a> <span class="n">value</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="k">if</span> <span class="n">trie</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">trie</span><span class="p">,</span> <span class="n">parts</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-112"><a href="#AbstractMappingSchema-112"><span class="linenos">112</span></a> +</span><span id="AbstractMappingSchema-113"><a href="#AbstractMappingSchema-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-114"><a href="#AbstractMappingSchema-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="AbstractMappingSchema-115"><a href="#AbstractMappingSchema-115"><span class="linenos">115</span></a> <span class="k">elif</span> <span class="n">value</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-116"><a href="#AbstractMappingSchema-116"><span class="linenos">116</span></a> <span class="n">possibilities</span> <span class="o">=</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="n">dict_depth</span><span class="p">(</span><span class="n">trie</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-117"><a href="#AbstractMappingSchema-117"><span class="linenos">117</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">possibilities</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-118"><a href="#AbstractMappingSchema-118"><span class="linenos">118</span></a> <span class="n">parts</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">possibilities</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="AbstractMappingSchema-119"><a href="#AbstractMappingSchema-119"><span class="linenos">119</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-120"><a href="#AbstractMappingSchema-120"><span class="linenos">120</span></a> <span class="n">message</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="k">for</span> <span class="n">parts</span> <span class="ow">in</span> <span class="n">possibilities</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-121"><a href="#AbstractMappingSchema-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">raise_on_missing</span><span class="p">:</span> +</span><span id="AbstractMappingSchema-122"><a href="#AbstractMappingSchema-122"><span class="linenos">122</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Ambiguous mapping for </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">message</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-123"><a href="#AbstractMappingSchema-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="AbstractMappingSchema-124"><a href="#AbstractMappingSchema-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nested_get</span><span class="p">(</span><span class="n">parts</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="n">raise_on_missing</span><span class="p">)</span> +</span><span id="AbstractMappingSchema-125"><a href="#AbstractMappingSchema-125"><span class="linenos">125</span></a> +</span><span id="AbstractMappingSchema-126"><a href="#AbstractMappingSchema-126"><span class="linenos">126</span></a> <span class="k">def</span> <span class="nf">_nested_get</span><span class="p">(</span> +</span><span id="AbstractMappingSchema-127"><a href="#AbstractMappingSchema-127"><span class="linenos">127</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">parts</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="nb">str</span><span class="p">],</span> <span class="n">d</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">True</span> +</span><span id="AbstractMappingSchema-128"><a href="#AbstractMappingSchema-128"><span class="linenos">128</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">]:</span> +</span><span id="AbstractMappingSchema-129"><a href="#AbstractMappingSchema-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="n">_nested_get</span><span class="p">(</span> +</span><span id="AbstractMappingSchema-130"><a href="#AbstractMappingSchema-130"><span class="linenos">130</span></a> <span class="n">d</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="AbstractMappingSchema-131"><a href="#AbstractMappingSchema-131"><span class="linenos">131</span></a> <span class="o">*</span><span class="nb">zip</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">,</span> <span class="nb">reversed</span><span class="p">(</span><span class="n">parts</span><span class="p">)),</span> +</span><span id="AbstractMappingSchema-132"><a href="#AbstractMappingSchema-132"><span class="linenos">132</span></a> <span class="n">raise_on_missing</span><span class="o">=</span><span class="n">raise_on_missing</span><span class="p">,</span> +</span><span id="AbstractMappingSchema-133"><a href="#AbstractMappingSchema-133"><span class="linenos">133</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Abstract base class for generic types.</p> + +<p>A generic type is typically declared by inheriting from +this class parameterized with one or more type variables. +For example, a generic mapping type might be defined as::</p> + +<p>class Mapping(Generic[KT, VT]): + def __getitem__(self, key: KT) -> VT: + ... + # Etc.</p> + +<p>This class can then be used as follows::</p> + +<p>def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: + try: + return mapping[key] + except KeyError: + return default</p> +</div> + + + <div id="AbstractMappingSchema.__init__" class="classattr"> + <input id="AbstractMappingSchema.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">AbstractMappingSchema</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">mapping</span><span class="p">:</span> <span class="nb">dict</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="AbstractMappingSchema.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AbstractMappingSchema.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AbstractMappingSchema.__init__-74"><a href="#AbstractMappingSchema.__init__-74"><span class="linenos">74</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="AbstractMappingSchema.__init__-75"><a href="#AbstractMappingSchema.__init__-75"><span class="linenos">75</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="AbstractMappingSchema.__init__-76"><a href="#AbstractMappingSchema.__init__-76"><span class="linenos">76</span></a> <span class="n">mapping</span><span class="p">:</span> <span class="nb">dict</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="AbstractMappingSchema.__init__-77"><a href="#AbstractMappingSchema.__init__-77"><span class="linenos">77</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="AbstractMappingSchema.__init__-78"><a href="#AbstractMappingSchema.__init__-78"><span class="linenos">78</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span> <span class="o">=</span> <span class="n">mapping</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="AbstractMappingSchema.__init__-79"><a href="#AbstractMappingSchema.__init__-79"><span class="linenos">79</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="AbstractMappingSchema.__init__-80"><a href="#AbstractMappingSchema.__init__-80"><span class="linenos">80</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_supported_table_args</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="AbstractMappingSchema.table_parts" class="classattr"> + <input id="AbstractMappingSchema.table_parts-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">table_parts</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="AbstractMappingSchema.table_parts-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AbstractMappingSchema.table_parts"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AbstractMappingSchema.table_parts-102"><a href="#AbstractMappingSchema.table_parts-102"><span class="linenos">102</span></a> <span class="k">def</span> <span class="nf">table_parts</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="AbstractMappingSchema.table_parts-103"><a href="#AbstractMappingSchema.table_parts-103"><span class="linenos">103</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">table</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">ReadCSV</span><span class="p">):</span> +</span><span id="AbstractMappingSchema.table_parts-104"><a href="#AbstractMappingSchema.table_parts-104"><span class="linenos">104</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> +</span><span id="AbstractMappingSchema.table_parts-105"><a href="#AbstractMappingSchema.table_parts-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">part</span><span class="p">)</span> <span class="k">for</span> <span class="n">part</span> <span class="ow">in</span> <span class="n">TABLE_ARGS</span> <span class="k">if</span> <span class="n">table</span><span class="o">.</span><span class="n">text</span><span class="p">(</span><span class="n">part</span><span class="p">)]</span> +</span></pre></div> + + + + + </div> + <div id="AbstractMappingSchema.find" class="classattr"> + <input id="AbstractMappingSchema.find-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">find</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span>,</span><span class="param"> <span class="n">trie</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">raise_on_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span></span><span class="return-annotation">) -> <span class="n">Optional</span><span class="p">[</span><span class="o">~</span><span class="n">T</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="AbstractMappingSchema.find-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#AbstractMappingSchema.find"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="AbstractMappingSchema.find-107"><a href="#AbstractMappingSchema.find-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">find</span><span class="p">(</span> +</span><span id="AbstractMappingSchema.find-108"><a href="#AbstractMappingSchema.find-108"><span class="linenos">108</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">,</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="AbstractMappingSchema.find-109"><a href="#AbstractMappingSchema.find-109"><span class="linenos">109</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span> +</span><span id="AbstractMappingSchema.find-110"><a href="#AbstractMappingSchema.find-110"><span class="linenos">110</span></a> <span class="n">parts</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table</span><span class="p">)[</span><span class="mi">0</span> <span class="p">:</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">supported_table_args</span><span class="p">)]</span> +</span><span id="AbstractMappingSchema.find-111"><a href="#AbstractMappingSchema.find-111"><span class="linenos">111</span></a> <span class="n">value</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="k">if</span> <span class="n">trie</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">trie</span><span class="p">,</span> <span class="n">parts</span><span class="p">)</span> +</span><span id="AbstractMappingSchema.find-112"><a href="#AbstractMappingSchema.find-112"><span class="linenos">112</span></a> +</span><span id="AbstractMappingSchema.find-113"><a href="#AbstractMappingSchema.find-113"><span class="linenos">113</span></a> <span class="k">if</span> <span class="n">value</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="AbstractMappingSchema.find-114"><a href="#AbstractMappingSchema.find-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="AbstractMappingSchema.find-115"><a href="#AbstractMappingSchema.find-115"><span class="linenos">115</span></a> <span class="k">elif</span> <span class="n">value</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="AbstractMappingSchema.find-116"><a href="#AbstractMappingSchema.find-116"><span class="linenos">116</span></a> <span class="n">possibilities</span> <span class="o">=</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="n">dict_depth</span><span class="p">(</span><span class="n">trie</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="AbstractMappingSchema.find-117"><a href="#AbstractMappingSchema.find-117"><span class="linenos">117</span></a> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">possibilities</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="AbstractMappingSchema.find-118"><a href="#AbstractMappingSchema.find-118"><span class="linenos">118</span></a> <span class="n">parts</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">possibilities</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> +</span><span id="AbstractMappingSchema.find-119"><a href="#AbstractMappingSchema.find-119"><span class="linenos">119</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="AbstractMappingSchema.find-120"><a href="#AbstractMappingSchema.find-120"><span class="linenos">120</span></a> <span class="n">message</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s2">"."</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">parts</span><span class="p">)</span> <span class="k">for</span> <span class="n">parts</span> <span class="ow">in</span> <span class="n">possibilities</span><span class="p">)</span> +</span><span id="AbstractMappingSchema.find-121"><a href="#AbstractMappingSchema.find-121"><span class="linenos">121</span></a> <span class="k">if</span> <span class="n">raise_on_missing</span><span class="p">:</span> +</span><span id="AbstractMappingSchema.find-122"><a href="#AbstractMappingSchema.find-122"><span class="linenos">122</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Ambiguous mapping for </span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="n">message</span><span class="si">}</span><span class="s2">."</span><span class="p">)</span> +</span><span id="AbstractMappingSchema.find-123"><a href="#AbstractMappingSchema.find-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="AbstractMappingSchema.find-124"><a href="#AbstractMappingSchema.find-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nested_get</span><span class="p">(</span><span class="n">parts</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="n">raise_on_missing</span><span class="p">)</span> +</span></pre></div> + + + + + </div> + </section> + <section id="MappingSchema"> + <input id="MappingSchema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">MappingSchema</span><wbr>(<span class="base"><a href="#AbstractMappingSchema">sqlglot.schema.AbstractMappingSchema[typing.Dict[str, str]]</a></span>, <span class="base"><a href="#Schema">Schema</a></span>): + + <label class="view-source-button" for="MappingSchema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema-136"><a href="#MappingSchema-136"><span class="linenos">136</span></a><span class="k">class</span> <span class="nc">MappingSchema</span><span class="p">(</span><span class="n">AbstractMappingSchema</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]],</span> <span class="n">Schema</span><span class="p">):</span> +</span><span id="MappingSchema-137"><a href="#MappingSchema-137"><span class="linenos">137</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="MappingSchema-138"><a href="#MappingSchema-138"><span class="linenos">138</span></a><span class="sd"> Schema based on a nested mapping.</span> +</span><span id="MappingSchema-139"><a href="#MappingSchema-139"><span class="linenos">139</span></a> +</span><span id="MappingSchema-140"><a href="#MappingSchema-140"><span class="linenos">140</span></a><span class="sd"> Args:</span> +</span><span id="MappingSchema-141"><a href="#MappingSchema-141"><span class="linenos">141</span></a><span class="sd"> schema (dict): Mapping in one of the following forms:</span> +</span><span id="MappingSchema-142"><a href="#MappingSchema-142"><span class="linenos">142</span></a><span class="sd"> 1. {table: {col: type}}</span> +</span><span id="MappingSchema-143"><a href="#MappingSchema-143"><span class="linenos">143</span></a><span class="sd"> 2. {db: {table: {col: type}}}</span> +</span><span id="MappingSchema-144"><a href="#MappingSchema-144"><span class="linenos">144</span></a><span class="sd"> 3. {catalog: {db: {table: {col: type}}}}</span> +</span><span id="MappingSchema-145"><a href="#MappingSchema-145"><span class="linenos">145</span></a><span class="sd"> 4. None - Tables will be added later</span> +</span><span id="MappingSchema-146"><a href="#MappingSchema-146"><span class="linenos">146</span></a><span class="sd"> visible (dict): Optional mapping of which columns in the schema are visible. If not provided, all columns</span> +</span><span id="MappingSchema-147"><a href="#MappingSchema-147"><span class="linenos">147</span></a><span class="sd"> are assumed to be visible. The nesting should mirror that of the schema:</span> +</span><span id="MappingSchema-148"><a href="#MappingSchema-148"><span class="linenos">148</span></a><span class="sd"> 1. {table: set(*cols)}}</span> +</span><span id="MappingSchema-149"><a href="#MappingSchema-149"><span class="linenos">149</span></a><span class="sd"> 2. {db: {table: set(*cols)}}}</span> +</span><span id="MappingSchema-150"><a href="#MappingSchema-150"><span class="linenos">150</span></a><span class="sd"> 3. {catalog: {db: {table: set(*cols)}}}}</span> +</span><span id="MappingSchema-151"><a href="#MappingSchema-151"><span class="linenos">151</span></a><span class="sd"> dialect (str): The dialect to be used for custom type mappings.</span> +</span><span id="MappingSchema-152"><a href="#MappingSchema-152"><span class="linenos">152</span></a><span class="sd"> """</span> +</span><span id="MappingSchema-153"><a href="#MappingSchema-153"><span class="linenos">153</span></a> +</span><span id="MappingSchema-154"><a href="#MappingSchema-154"><span class="linenos">154</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="MappingSchema-155"><a href="#MappingSchema-155"><span class="linenos">155</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="MappingSchema-156"><a href="#MappingSchema-156"><span class="linenos">156</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="MappingSchema-157"><a href="#MappingSchema-157"><span class="linenos">157</span></a> <span class="n">visible</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="MappingSchema-158"><a href="#MappingSchema-158"><span class="linenos">158</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="MappingSchema-159"><a href="#MappingSchema-159"><span class="linenos">159</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema-160"><a href="#MappingSchema-160"><span class="linenos">160</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dialect</span> <span class="o">=</span> <span class="n">dialect</span> +</span><span id="MappingSchema-161"><a href="#MappingSchema-161"><span class="linenos">161</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span> <span class="o">=</span> <span class="n">visible</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="MappingSchema-162"><a href="#MappingSchema-162"><span class="linenos">162</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="MappingSchema-163"><a href="#MappingSchema-163"><span class="linenos">163</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize</span><span class="p">(</span><span class="n">schema</span> <span class="ow">or</span> <span class="p">{}))</span> +</span><span id="MappingSchema-164"><a href="#MappingSchema-164"><span class="linenos">164</span></a> +</span><span id="MappingSchema-165"><a href="#MappingSchema-165"><span class="linenos">165</span></a> <span class="nd">@classmethod</span> +</span><span id="MappingSchema-166"><a href="#MappingSchema-166"><span class="linenos">166</span></a> <span class="k">def</span> <span class="nf">from_mapping_schema</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">mapping_schema</span><span class="p">:</span> <span class="n">MappingSchema</span><span class="p">)</span> <span class="o">-></span> <span class="n">MappingSchema</span><span class="p">:</span> +</span><span id="MappingSchema-167"><a href="#MappingSchema-167"><span class="linenos">167</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span> +</span><span id="MappingSchema-168"><a href="#MappingSchema-168"><span class="linenos">168</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="MappingSchema-169"><a href="#MappingSchema-169"><span class="linenos">169</span></a> <span class="n">visible</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">visible</span><span class="p">,</span> +</span><span id="MappingSchema-170"><a href="#MappingSchema-170"><span class="linenos">170</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="MappingSchema-171"><a href="#MappingSchema-171"><span class="linenos">171</span></a> <span class="p">)</span> +</span><span id="MappingSchema-172"><a href="#MappingSchema-172"><span class="linenos">172</span></a> +</span><span id="MappingSchema-173"><a href="#MappingSchema-173"><span class="linenos">173</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">MappingSchema</span><span class="p">:</span> +</span><span id="MappingSchema-174"><a href="#MappingSchema-174"><span class="linenos">174</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span> +</span><span id="MappingSchema-175"><a href="#MappingSchema-175"><span class="linenos">175</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="MappingSchema-176"><a href="#MappingSchema-176"><span class="linenos">176</span></a> <span class="s2">"schema"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="MappingSchema-177"><a href="#MappingSchema-177"><span class="linenos">177</span></a> <span class="s2">"visible"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="MappingSchema-178"><a href="#MappingSchema-178"><span class="linenos">178</span></a> <span class="s2">"dialect"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="MappingSchema-179"><a href="#MappingSchema-179"><span class="linenos">179</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="MappingSchema-180"><a href="#MappingSchema-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span><span id="MappingSchema-181"><a href="#MappingSchema-181"><span class="linenos">181</span></a> <span class="p">)</span> +</span><span id="MappingSchema-182"><a href="#MappingSchema-182"><span class="linenos">182</span></a> +</span><span id="MappingSchema-183"><a href="#MappingSchema-183"><span class="linenos">183</span></a> <span class="k">def</span> <span class="nf">_normalize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="MappingSchema-184"><a href="#MappingSchema-184"><span class="linenos">184</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="MappingSchema-185"><a href="#MappingSchema-185"><span class="linenos">185</span></a><span class="sd"> Converts all identifiers in the schema into lowercase, unless they're quoted.</span> +</span><span id="MappingSchema-186"><a href="#MappingSchema-186"><span class="linenos">186</span></a> +</span><span id="MappingSchema-187"><a href="#MappingSchema-187"><span class="linenos">187</span></a><span class="sd"> Args:</span> +</span><span id="MappingSchema-188"><a href="#MappingSchema-188"><span class="linenos">188</span></a><span class="sd"> schema: the schema to normalize.</span> +</span><span id="MappingSchema-189"><a href="#MappingSchema-189"><span class="linenos">189</span></a> +</span><span id="MappingSchema-190"><a href="#MappingSchema-190"><span class="linenos">190</span></a><span class="sd"> Returns:</span> +</span><span id="MappingSchema-191"><a href="#MappingSchema-191"><span class="linenos">191</span></a><span class="sd"> The normalized schema mapping.</span> +</span><span id="MappingSchema-192"><a href="#MappingSchema-192"><span class="linenos">192</span></a><span class="sd"> """</span> +</span><span id="MappingSchema-193"><a href="#MappingSchema-193"><span class="linenos">193</span></a> <span class="n">flattened_schema</span> <span class="o">=</span> <span class="n">flatten_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">depth</span><span class="o">=</span><span class="n">dict_depth</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="MappingSchema-194"><a href="#MappingSchema-194"><span class="linenos">194</span></a> +</span><span id="MappingSchema-195"><a href="#MappingSchema-195"><span class="linenos">195</span></a> <span class="n">normalized_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="MappingSchema-196"><a href="#MappingSchema-196"><span class="linenos">196</span></a> <span class="k">for</span> <span class="n">keys</span> <span class="ow">in</span> <span class="n">flattened_schema</span><span class="p">:</span> +</span><span id="MappingSchema-197"><a href="#MappingSchema-197"><span class="linenos">197</span></a> <span class="n">columns</span> <span class="o">=</span> <span class="n">_nested_get</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="o">*</span><span class="nb">zip</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="n">keys</span><span class="p">))</span> +</span><span id="MappingSchema-198"><a href="#MappingSchema-198"><span class="linenos">198</span></a> <span class="k">assert</span> <span class="n">columns</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> +</span><span id="MappingSchema-199"><a href="#MappingSchema-199"><span class="linenos">199</span></a> +</span><span id="MappingSchema-200"><a href="#MappingSchema-200"><span class="linenos">200</span></a> <span class="n">normalized_keys</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize_name</span><span class="p">(</span><span class="n">key</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">]</span> +</span><span id="MappingSchema-201"><a href="#MappingSchema-201"><span class="linenos">201</span></a> <span class="k">for</span> <span class="n">column_name</span><span class="p">,</span> <span class="n">column_type</span> <span class="ow">in</span> <span class="n">columns</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="MappingSchema-202"><a href="#MappingSchema-202"><span class="linenos">202</span></a> <span class="n">_nested_set</span><span class="p">(</span> +</span><span id="MappingSchema-203"><a href="#MappingSchema-203"><span class="linenos">203</span></a> <span class="n">normalized_mapping</span><span class="p">,</span> +</span><span id="MappingSchema-204"><a href="#MappingSchema-204"><span class="linenos">204</span></a> <span class="n">normalized_keys</span> <span class="o">+</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize_name</span><span class="p">(</span><span class="n">column_name</span><span class="p">)],</span> +</span><span id="MappingSchema-205"><a href="#MappingSchema-205"><span class="linenos">205</span></a> <span class="n">column_type</span><span class="p">,</span> +</span><span id="MappingSchema-206"><a href="#MappingSchema-206"><span class="linenos">206</span></a> <span class="p">)</span> +</span><span id="MappingSchema-207"><a href="#MappingSchema-207"><span class="linenos">207</span></a> +</span><span id="MappingSchema-208"><a href="#MappingSchema-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="n">normalized_mapping</span> +</span><span id="MappingSchema-209"><a href="#MappingSchema-209"><span class="linenos">209</span></a> +</span><span id="MappingSchema-210"><a href="#MappingSchema-210"><span class="linenos">210</span></a> <span class="k">def</span> <span class="nf">add_table</span><span class="p">(</span> +</span><span id="MappingSchema-211"><a href="#MappingSchema-211"><span class="linenos">211</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MappingSchema-212"><a href="#MappingSchema-212"><span class="linenos">212</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema-213"><a href="#MappingSchema-213"><span class="linenos">213</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="MappingSchema-214"><a href="#MappingSchema-214"><span class="linenos">214</span></a><span class="sd"> Register or update a table. Updates are only performed if a new column mapping is provided.</span> +</span><span id="MappingSchema-215"><a href="#MappingSchema-215"><span class="linenos">215</span></a> +</span><span id="MappingSchema-216"><a href="#MappingSchema-216"><span class="linenos">216</span></a><span class="sd"> Args:</span> +</span><span id="MappingSchema-217"><a href="#MappingSchema-217"><span class="linenos">217</span></a><span class="sd"> table: the `Table` expression instance or string representing the table.</span> +</span><span id="MappingSchema-218"><a href="#MappingSchema-218"><span class="linenos">218</span></a><span class="sd"> column_mapping: a column mapping that describes the structure of the table.</span> +</span><span id="MappingSchema-219"><a href="#MappingSchema-219"><span class="linenos">219</span></a><span class="sd"> """</span> +</span><span id="MappingSchema-220"><a href="#MappingSchema-220"><span class="linenos">220</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema-221"><a href="#MappingSchema-221"><span class="linenos">221</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="n">ensure_column_mapping</span><span class="p">(</span><span class="n">column_mapping</span><span class="p">)</span> +</span><span id="MappingSchema-222"><a href="#MappingSchema-222"><span class="linenos">222</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="MappingSchema-223"><a href="#MappingSchema-223"><span class="linenos">223</span></a> +</span><span id="MappingSchema-224"><a href="#MappingSchema-224"><span class="linenos">224</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">column_mapping</span><span class="p">:</span> +</span><span id="MappingSchema-225"><a href="#MappingSchema-225"><span class="linenos">225</span></a> <span class="k">return</span> +</span><span id="MappingSchema-226"><a href="#MappingSchema-226"><span class="linenos">226</span></a> +</span><span id="MappingSchema-227"><a href="#MappingSchema-227"><span class="linenos">227</span></a> <span class="n">_nested_set</span><span class="p">(</span> +</span><span id="MappingSchema-228"><a href="#MappingSchema-228"><span class="linenos">228</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="MappingSchema-229"><a href="#MappingSchema-229"><span class="linenos">229</span></a> <span class="nb">list</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table_</span><span class="p">))),</span> +</span><span id="MappingSchema-230"><a href="#MappingSchema-230"><span class="linenos">230</span></a> <span class="n">column_mapping</span><span class="p">,</span> +</span><span id="MappingSchema-231"><a href="#MappingSchema-231"><span class="linenos">231</span></a> <span class="p">)</span> +</span><span id="MappingSchema-232"><a href="#MappingSchema-232"><span class="linenos">232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="MappingSchema-233"><a href="#MappingSchema-233"><span class="linenos">233</span></a> +</span><span id="MappingSchema-234"><a href="#MappingSchema-234"><span class="linenos">234</span></a> <span class="k">def</span> <span class="nf">_normalize_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="MappingSchema-235"><a href="#MappingSchema-235"><span class="linenos">235</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="MappingSchema-236"><a href="#MappingSchema-236"><span class="linenos">236</span></a> <span class="n">identifier</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]</span> <span class="o">=</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">parse_one</span><span class="p">(</span> +</span><span id="MappingSchema-237"><a href="#MappingSchema-237"><span class="linenos">237</span></a> <span class="n">name</span><span class="p">,</span> <span class="n">read</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span> +</span><span id="MappingSchema-238"><a href="#MappingSchema-238"><span class="linenos">238</span></a> <span class="p">)</span> +</span><span id="MappingSchema-239"><a href="#MappingSchema-239"><span class="linenos">239</span></a> <span class="k">except</span><span class="p">:</span> +</span><span id="MappingSchema-240"><a href="#MappingSchema-240"><span class="linenos">240</span></a> <span class="n">identifier</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_identifier</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> +</span><span id="MappingSchema-241"><a href="#MappingSchema-241"><span class="linenos">241</span></a> <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">identifier</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Identifier</span><span class="p">)</span> +</span><span id="MappingSchema-242"><a href="#MappingSchema-242"><span class="linenos">242</span></a> +</span><span id="MappingSchema-243"><a href="#MappingSchema-243"><span class="linenos">243</span></a> <span class="k">if</span> <span class="n">identifier</span><span class="o">.</span><span class="n">quoted</span><span class="p">:</span> +</span><span id="MappingSchema-244"><a href="#MappingSchema-244"><span class="linenos">244</span></a> <span class="k">return</span> <span class="n">identifier</span><span class="o">.</span><span class="n">name</span> +</span><span id="MappingSchema-245"><a href="#MappingSchema-245"><span class="linenos">245</span></a> <span class="k">return</span> <span class="n">identifier</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> +</span><span id="MappingSchema-246"><a href="#MappingSchema-246"><span class="linenos">246</span></a> +</span><span id="MappingSchema-247"><a href="#MappingSchema-247"><span class="linenos">247</span></a> <span class="k">def</span> <span class="nf">_depth</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">int</span><span class="p">:</span> +</span><span id="MappingSchema-248"><a href="#MappingSchema-248"><span class="linenos">248</span></a> <span class="c1"># The columns themselves are a mapping, but we don't want to include those</span> +</span><span id="MappingSchema-249"><a href="#MappingSchema-249"><span class="linenos">249</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_depth</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="MappingSchema-250"><a href="#MappingSchema-250"><span class="linenos">250</span></a> +</span><span id="MappingSchema-251"><a href="#MappingSchema-251"><span class="linenos">251</span></a> <span class="k">def</span> <span class="nf">_ensure_table</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span><span class="p">:</span> +</span><span id="MappingSchema-252"><a href="#MappingSchema-252"><span class="linenos">252</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema-253"><a href="#MappingSchema-253"><span class="linenos">253</span></a> +</span><span id="MappingSchema-254"><a href="#MappingSchema-254"><span class="linenos">254</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">table_</span><span class="p">:</span> +</span><span id="MappingSchema-255"><a href="#MappingSchema-255"><span class="linenos">255</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Not a valid table '</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="MappingSchema-256"><a href="#MappingSchema-256"><span class="linenos">256</span></a> +</span><span id="MappingSchema-257"><a href="#MappingSchema-257"><span class="linenos">257</span></a> <span class="k">return</span> <span class="n">table_</span> +</span><span id="MappingSchema-258"><a href="#MappingSchema-258"><span class="linenos">258</span></a> +</span><span id="MappingSchema-259"><a href="#MappingSchema-259"><span class="linenos">259</span></a> <span class="k">def</span> <span class="nf">column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="MappingSchema-260"><a href="#MappingSchema-260"><span class="linenos">260</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema-261"><a href="#MappingSchema-261"><span class="linenos">261</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">)</span> +</span><span id="MappingSchema-262"><a href="#MappingSchema-262"><span class="linenos">262</span></a> +</span><span id="MappingSchema-263"><a href="#MappingSchema-263"><span class="linenos">263</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema-264"><a href="#MappingSchema-264"><span class="linenos">264</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="MappingSchema-265"><a href="#MappingSchema-265"><span class="linenos">265</span></a> +</span><span id="MappingSchema-266"><a href="#MappingSchema-266"><span class="linenos">266</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">only_visible</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="p">:</span> +</span><span id="MappingSchema-267"><a href="#MappingSchema-267"><span class="linenos">267</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="MappingSchema-268"><a href="#MappingSchema-268"><span class="linenos">268</span></a> +</span><span id="MappingSchema-269"><a href="#MappingSchema-269"><span class="linenos">269</span></a> <span class="n">visible</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nested_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table_</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="p">)</span> +</span><span id="MappingSchema-270"><a href="#MappingSchema-270"><span class="linenos">270</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">schema</span> <span class="k">if</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">visible</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="MappingSchema-271"><a href="#MappingSchema-271"><span class="linenos">271</span></a> +</span><span id="MappingSchema-272"><a href="#MappingSchema-272"><span class="linenos">272</span></a> <span class="k">def</span> <span class="nf">get_column_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="MappingSchema-273"><a href="#MappingSchema-273"><span class="linenos">273</span></a> <span class="n">column_name</span> <span class="o">=</span> <span class="n">column</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> +</span><span id="MappingSchema-274"><a href="#MappingSchema-274"><span class="linenos">274</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema-275"><a href="#MappingSchema-275"><span class="linenos">275</span></a> <span class="k">if</span> <span class="n">table_</span><span class="p">:</span> +</span><span id="MappingSchema-276"><a href="#MappingSchema-276"><span class="linenos">276</span></a> <span class="n">table_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="MappingSchema-277"><a href="#MappingSchema-277"><span class="linenos">277</span></a> <span class="k">if</span> <span class="n">table_schema</span><span class="p">:</span> +</span><span id="MappingSchema-278"><a href="#MappingSchema-278"><span class="linenos">278</span></a> <span class="n">column_type</span> <span class="o">=</span> <span class="n">table_schema</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">column_name</span><span class="p">)</span> +</span><span id="MappingSchema-279"><a href="#MappingSchema-279"><span class="linenos">279</span></a> +</span><span id="MappingSchema-280"><a href="#MappingSchema-280"><span class="linenos">280</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column_type</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="MappingSchema-281"><a href="#MappingSchema-281"><span class="linenos">281</span></a> <span class="k">return</span> <span class="n">column_type</span> +</span><span id="MappingSchema-282"><a href="#MappingSchema-282"><span class="linenos">282</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column_type</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="MappingSchema-283"><a href="#MappingSchema-283"><span class="linenos">283</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_data_type</span><span class="p">(</span><span class="n">column_type</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="MappingSchema-284"><a href="#MappingSchema-284"><span class="linenos">284</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown column type '</span><span class="si">{</span><span class="n">column_type</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="MappingSchema-285"><a href="#MappingSchema-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">)</span> +</span><span id="MappingSchema-286"><a href="#MappingSchema-286"><span class="linenos">286</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not convert table '</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="MappingSchema-287"><a href="#MappingSchema-287"><span class="linenos">287</span></a> +</span><span id="MappingSchema-288"><a href="#MappingSchema-288"><span class="linenos">288</span></a> <span class="k">def</span> <span class="nf">_to_data_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">schema_type</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="MappingSchema-289"><a href="#MappingSchema-289"><span class="linenos">289</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="MappingSchema-290"><a href="#MappingSchema-290"><span class="linenos">290</span></a><span class="sd"> Convert a type represented as a string to the corresponding :class:`sqlglot.exp.DataType` object.</span> +</span><span id="MappingSchema-291"><a href="#MappingSchema-291"><span class="linenos">291</span></a> +</span><span id="MappingSchema-292"><a href="#MappingSchema-292"><span class="linenos">292</span></a><span class="sd"> Args:</span> +</span><span id="MappingSchema-293"><a href="#MappingSchema-293"><span class="linenos">293</span></a><span class="sd"> schema_type: the type we want to convert.</span> +</span><span id="MappingSchema-294"><a href="#MappingSchema-294"><span class="linenos">294</span></a> +</span><span id="MappingSchema-295"><a href="#MappingSchema-295"><span class="linenos">295</span></a><span class="sd"> Returns:</span> +</span><span id="MappingSchema-296"><a href="#MappingSchema-296"><span class="linenos">296</span></a><span class="sd"> The resulting expression type.</span> +</span><span id="MappingSchema-297"><a href="#MappingSchema-297"><span class="linenos">297</span></a><span class="sd"> """</span> +</span><span id="MappingSchema-298"><a href="#MappingSchema-298"><span class="linenos">298</span></a> <span class="k">if</span> <span class="n">schema_type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">:</span> +</span><span id="MappingSchema-299"><a href="#MappingSchema-299"><span class="linenos">299</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="MappingSchema-300"><a href="#MappingSchema-300"><span class="linenos">300</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">maybe_parse</span><span class="p">(</span><span class="n">schema_type</span><span class="p">,</span> <span class="n">into</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">,</span> <span class="n">dialect</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">)</span> +</span><span id="MappingSchema-301"><a href="#MappingSchema-301"><span class="linenos">301</span></a> <span class="k">if</span> <span class="n">expression</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema-302"><a href="#MappingSchema-302"><span class="linenos">302</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not parse </span><span class="si">{</span><span class="n">schema_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="MappingSchema-303"><a href="#MappingSchema-303"><span class="linenos">303</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">[</span><span class="n">schema_type</span><span class="p">]</span> <span class="o">=</span> <span class="n">expression</span> <span class="c1"># type: ignore</span> +</span><span id="MappingSchema-304"><a href="#MappingSchema-304"><span class="linenos">304</span></a> <span class="k">except</span> <span class="ne">AttributeError</span><span class="p">:</span> +</span><span id="MappingSchema-305"><a href="#MappingSchema-305"><span class="linenos">305</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Failed to convert type </span><span class="si">{</span><span class="n">schema_type</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="MappingSchema-306"><a href="#MappingSchema-306"><span class="linenos">306</span></a> +</span><span id="MappingSchema-307"><a href="#MappingSchema-307"><span class="linenos">307</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">[</span><span class="n">schema_type</span><span class="p">]</span> +</span></pre></div> + + + <div class="docstring"><p>Schema based on a nested mapping.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>schema (dict):</strong> Mapping in one of the following forms: +<ol> +<li>{table: {col: type}}</li> +<li>{db: {table: {col: type}}}</li> +<li>{catalog: {db: {table: {col: type}}}}</li> +<li>None - Tables will be added later</li> +</ol></li> +<li><strong>visible (dict):</strong> Optional mapping of which columns in the schema are visible. If not provided, all columns +are assumed to be visible. The nesting should mirror that of the schema: +<ol> +<li>{table: set(<em>cols)}}</li> +<li>{db: {table: set(</em>cols)}}}</li> +<li>{catalog: {db: {table: set(*cols)}}}}</li> +</ol></li> +<li><strong>dialect (str):</strong> The dialect to be used for custom type mappings.</li> +</ul> +</div> + + + <div id="MappingSchema.__init__" class="classattr"> + <input id="MappingSchema.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">MappingSchema</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">schema</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">visible</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>,</span><span class="param"> <span class="n">dialect</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">,</span> <span class="n">Type</span><span class="p">[</span><span class="n"><a href="dialects/dialect.html#Dialect">sqlglot.dialects.dialect.Dialect</a></span><span class="p">],</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span>)</span> + + <label class="view-source-button" for="MappingSchema.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema.__init__-154"><a href="#MappingSchema.__init__-154"><span class="linenos">154</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="MappingSchema.__init__-155"><a href="#MappingSchema.__init__-155"><span class="linenos">155</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="MappingSchema.__init__-156"><a href="#MappingSchema.__init__-156"><span class="linenos">156</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="MappingSchema.__init__-157"><a href="#MappingSchema.__init__-157"><span class="linenos">157</span></a> <span class="n">visible</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="MappingSchema.__init__-158"><a href="#MappingSchema.__init__-158"><span class="linenos">158</span></a> <span class="n">dialect</span><span class="p">:</span> <span class="n">DialectType</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="MappingSchema.__init__-159"><a href="#MappingSchema.__init__-159"><span class="linenos">159</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema.__init__-160"><a href="#MappingSchema.__init__-160"><span class="linenos">160</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">dialect</span> <span class="o">=</span> <span class="n">dialect</span> +</span><span id="MappingSchema.__init__-161"><a href="#MappingSchema.__init__-161"><span class="linenos">161</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span> <span class="o">=</span> <span class="n">visible</span> <span class="ow">or</span> <span class="p">{}</span> +</span><span id="MappingSchema.__init__-162"><a href="#MappingSchema.__init__-162"><span class="linenos">162</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_type_mapping_cache</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="MappingSchema.__init__-163"><a href="#MappingSchema.__init__-163"><span class="linenos">163</span></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_normalize</span><span class="p">(</span><span class="n">schema</span> <span class="ow">or</span> <span class="p">{}))</span> +</span></pre></div> + + + + + </div> + <div id="MappingSchema.from_mapping_schema" class="classattr"> + <input id="MappingSchema.from_mapping_schema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">from_mapping_schema</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">cls</span>,</span><span class="param"> <span class="n">mapping_schema</span><span class="p">:</span> <span class="n"><a href="#MappingSchema">sqlglot.schema.MappingSchema</a></span></span><span class="return-annotation">) -> <span class="n"><a href="#MappingSchema">sqlglot.schema.MappingSchema</a></span>:</span></span> + + <label class="view-source-button" for="MappingSchema.from_mapping_schema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema.from_mapping_schema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema.from_mapping_schema-165"><a href="#MappingSchema.from_mapping_schema-165"><span class="linenos">165</span></a> <span class="nd">@classmethod</span> +</span><span id="MappingSchema.from_mapping_schema-166"><a href="#MappingSchema.from_mapping_schema-166"><span class="linenos">166</span></a> <span class="k">def</span> <span class="nf">from_mapping_schema</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">mapping_schema</span><span class="p">:</span> <span class="n">MappingSchema</span><span class="p">)</span> <span class="o">-></span> <span class="n">MappingSchema</span><span class="p">:</span> +</span><span id="MappingSchema.from_mapping_schema-167"><a href="#MappingSchema.from_mapping_schema-167"><span class="linenos">167</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span> +</span><span id="MappingSchema.from_mapping_schema-168"><a href="#MappingSchema.from_mapping_schema-168"><span class="linenos">168</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="MappingSchema.from_mapping_schema-169"><a href="#MappingSchema.from_mapping_schema-169"><span class="linenos">169</span></a> <span class="n">visible</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">visible</span><span class="p">,</span> +</span><span id="MappingSchema.from_mapping_schema-170"><a href="#MappingSchema.from_mapping_schema-170"><span class="linenos">170</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">mapping_schema</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="MappingSchema.from_mapping_schema-171"><a href="#MappingSchema.from_mapping_schema-171"><span class="linenos">171</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="MappingSchema.copy" class="classattr"> + <input id="MappingSchema.copy-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">copy</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="o">**</span><span class="n">kwargs</span></span><span class="return-annotation">) -> <span class="n"><a href="#MappingSchema">sqlglot.schema.MappingSchema</a></span>:</span></span> + + <label class="view-source-button" for="MappingSchema.copy-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema.copy"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema.copy-173"><a href="#MappingSchema.copy-173"><span class="linenos">173</span></a> <span class="k">def</span> <span class="nf">copy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">-></span> <span class="n">MappingSchema</span><span class="p">:</span> +</span><span id="MappingSchema.copy-174"><a href="#MappingSchema.copy-174"><span class="linenos">174</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span> +</span><span id="MappingSchema.copy-175"><a href="#MappingSchema.copy-175"><span class="linenos">175</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span> +</span><span id="MappingSchema.copy-176"><a href="#MappingSchema.copy-176"><span class="linenos">176</span></a> <span class="s2">"schema"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="MappingSchema.copy-177"><a href="#MappingSchema.copy-177"><span class="linenos">177</span></a> <span class="s2">"visible"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="o">.</span><span class="n">copy</span><span class="p">(),</span> +</span><span id="MappingSchema.copy-178"><a href="#MappingSchema.copy-178"><span class="linenos">178</span></a> <span class="s2">"dialect"</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="MappingSchema.copy-179"><a href="#MappingSchema.copy-179"><span class="linenos">179</span></a> <span class="o">**</span><span class="n">kwargs</span><span class="p">,</span> +</span><span id="MappingSchema.copy-180"><a href="#MappingSchema.copy-180"><span class="linenos">180</span></a> <span class="p">}</span> +</span><span id="MappingSchema.copy-181"><a href="#MappingSchema.copy-181"><span class="linenos">181</span></a> <span class="p">)</span> +</span></pre></div> + + + + + </div> + <div id="MappingSchema.add_table" class="classattr"> + <input id="MappingSchema.add_table-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">add_table</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span> <span class="o">|</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Dict</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">dataframe</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">types</span><span class="o">.</span><span class="n">StructType</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="MappingSchema.add_table-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema.add_table"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema.add_table-210"><a href="#MappingSchema.add_table-210"><span class="linenos">210</span></a> <span class="k">def</span> <span class="nf">add_table</span><span class="p">(</span> +</span><span id="MappingSchema.add_table-211"><a href="#MappingSchema.add_table-211"><span class="linenos">211</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column_mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="MappingSchema.add_table-212"><a href="#MappingSchema.add_table-212"><span class="linenos">212</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema.add_table-213"><a href="#MappingSchema.add_table-213"><span class="linenos">213</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="MappingSchema.add_table-214"><a href="#MappingSchema.add_table-214"><span class="linenos">214</span></a><span class="sd"> Register or update a table. Updates are only performed if a new column mapping is provided.</span> +</span><span id="MappingSchema.add_table-215"><a href="#MappingSchema.add_table-215"><span class="linenos">215</span></a> +</span><span id="MappingSchema.add_table-216"><a href="#MappingSchema.add_table-216"><span class="linenos">216</span></a><span class="sd"> Args:</span> +</span><span id="MappingSchema.add_table-217"><a href="#MappingSchema.add_table-217"><span class="linenos">217</span></a><span class="sd"> table: the `Table` expression instance or string representing the table.</span> +</span><span id="MappingSchema.add_table-218"><a href="#MappingSchema.add_table-218"><span class="linenos">218</span></a><span class="sd"> column_mapping: a column mapping that describes the structure of the table.</span> +</span><span id="MappingSchema.add_table-219"><a href="#MappingSchema.add_table-219"><span class="linenos">219</span></a><span class="sd"> """</span> +</span><span id="MappingSchema.add_table-220"><a href="#MappingSchema.add_table-220"><span class="linenos">220</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema.add_table-221"><a href="#MappingSchema.add_table-221"><span class="linenos">221</span></a> <span class="n">column_mapping</span> <span class="o">=</span> <span class="n">ensure_column_mapping</span><span class="p">(</span><span class="n">column_mapping</span><span class="p">)</span> +</span><span id="MappingSchema.add_table-222"><a href="#MappingSchema.add_table-222"><span class="linenos">222</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="MappingSchema.add_table-223"><a href="#MappingSchema.add_table-223"><span class="linenos">223</span></a> +</span><span id="MappingSchema.add_table-224"><a href="#MappingSchema.add_table-224"><span class="linenos">224</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">column_mapping</span><span class="p">:</span> +</span><span id="MappingSchema.add_table-225"><a href="#MappingSchema.add_table-225"><span class="linenos">225</span></a> <span class="k">return</span> +</span><span id="MappingSchema.add_table-226"><a href="#MappingSchema.add_table-226"><span class="linenos">226</span></a> +</span><span id="MappingSchema.add_table-227"><a href="#MappingSchema.add_table-227"><span class="linenos">227</span></a> <span class="n">_nested_set</span><span class="p">(</span> +</span><span id="MappingSchema.add_table-228"><a href="#MappingSchema.add_table-228"><span class="linenos">228</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">,</span> +</span><span id="MappingSchema.add_table-229"><a href="#MappingSchema.add_table-229"><span class="linenos">229</span></a> <span class="nb">list</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table_</span><span class="p">))),</span> +</span><span id="MappingSchema.add_table-230"><a href="#MappingSchema.add_table-230"><span class="linenos">230</span></a> <span class="n">column_mapping</span><span class="p">,</span> +</span><span id="MappingSchema.add_table-231"><a href="#MappingSchema.add_table-231"><span class="linenos">231</span></a> <span class="p">)</span> +</span><span id="MappingSchema.add_table-232"><a href="#MappingSchema.add_table-232"><span class="linenos">232</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">mapping_trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_build_trie</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mapping</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Register or update a table. Updates are only performed if a new column mapping is provided.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table:</strong> the <code>Table</code> expression instance or string representing the table.</li> +<li><strong>column_mapping:</strong> a column mapping that describes the structure of the table.</li> +</ul> +</div> + + + </div> + <div id="MappingSchema.column_names" class="classattr"> + <input id="MappingSchema.column_names-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">column_names</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span> <span class="o">|</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="MappingSchema.column_names-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema.column_names"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema.column_names-259"><a href="#MappingSchema.column_names-259"><span class="linenos">259</span></a> <span class="k">def</span> <span class="nf">column_names</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">only_visible</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="MappingSchema.column_names-260"><a href="#MappingSchema.column_names-260"><span class="linenos">260</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ensure_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema.column_names-261"><a href="#MappingSchema.column_names-261"><span class="linenos">261</span></a> <span class="n">schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">)</span> +</span><span id="MappingSchema.column_names-262"><a href="#MappingSchema.column_names-262"><span class="linenos">262</span></a> +</span><span id="MappingSchema.column_names-263"><a href="#MappingSchema.column_names-263"><span class="linenos">263</span></a> <span class="k">if</span> <span class="n">schema</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="MappingSchema.column_names-264"><a href="#MappingSchema.column_names-264"><span class="linenos">264</span></a> <span class="k">return</span> <span class="p">[]</span> +</span><span id="MappingSchema.column_names-265"><a href="#MappingSchema.column_names-265"><span class="linenos">265</span></a> +</span><span id="MappingSchema.column_names-266"><a href="#MappingSchema.column_names-266"><span class="linenos">266</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">only_visible</span> <span class="ow">or</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="p">:</span> +</span><span id="MappingSchema.column_names-267"><a href="#MappingSchema.column_names-267"><span class="linenos">267</span></a> <span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span><span id="MappingSchema.column_names-268"><a href="#MappingSchema.column_names-268"><span class="linenos">268</span></a> +</span><span id="MappingSchema.column_names-269"><a href="#MappingSchema.column_names-269"><span class="linenos">269</span></a> <span class="n">visible</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_nested_get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">table_parts</span><span class="p">(</span><span class="n">table_</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">visible</span><span class="p">)</span> +</span><span id="MappingSchema.column_names-270"><a href="#MappingSchema.column_names-270"><span class="linenos">270</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">col</span> <span class="k">for</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">schema</span> <span class="k">if</span> <span class="n">col</span> <span class="ow">in</span> <span class="n">visible</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span></pre></div> + + + <div class="docstring"><p>Get the column names for a table.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table:</strong> the <code>Table</code> expression instance.</li> +<li><strong>only_visible:</strong> whether to include invisible columns.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The list of column names.</p> +</blockquote> +</div> + + + </div> + <div id="MappingSchema.get_column_type" class="classattr"> + <input id="MappingSchema.get_column_type-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">get_column_type</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="bp">self</span>,</span><span class="param"> <span class="n">table</span><span class="p">:</span> <span class="n"><a href="expressions.html#Table">sqlglot.expressions.Table</a></span> <span class="o">|</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">column</span><span class="p">:</span> <span class="n"><a href="expressions.html#Column">sqlglot.expressions.Column</a></span> <span class="o">|</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="expressions.html#DataType">sqlglot.expressions.DataType</a></span>:</span></span> + + <label class="view-source-button" for="MappingSchema.get_column_type-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#MappingSchema.get_column_type"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="MappingSchema.get_column_type-272"><a href="#MappingSchema.get_column_type-272"><span class="linenos">272</span></a> <span class="k">def</span> <span class="nf">get_column_type</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">table</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Table</span> <span class="o">|</span> <span class="nb">str</span><span class="p">,</span> <span class="n">column</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span> <span class="o">|</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">:</span> +</span><span id="MappingSchema.get_column_type-273"><a href="#MappingSchema.get_column_type-273"><span class="linenos">273</span></a> <span class="n">column_name</span> <span class="o">=</span> <span class="n">column</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="n">column</span><span class="o">.</span><span class="n">name</span> +</span><span id="MappingSchema.get_column_type-274"><a href="#MappingSchema.get_column_type-274"><span class="linenos">274</span></a> <span class="n">table_</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">to_table</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="MappingSchema.get_column_type-275"><a href="#MappingSchema.get_column_type-275"><span class="linenos">275</span></a> <span class="k">if</span> <span class="n">table_</span><span class="p">:</span> +</span><span id="MappingSchema.get_column_type-276"><a href="#MappingSchema.get_column_type-276"><span class="linenos">276</span></a> <span class="n">table_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="n">table_</span><span class="p">,</span> <span class="n">raise_on_missing</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="MappingSchema.get_column_type-277"><a href="#MappingSchema.get_column_type-277"><span class="linenos">277</span></a> <span class="k">if</span> <span class="n">table_schema</span><span class="p">:</span> +</span><span id="MappingSchema.get_column_type-278"><a href="#MappingSchema.get_column_type-278"><span class="linenos">278</span></a> <span class="n">column_type</span> <span class="o">=</span> <span class="n">table_schema</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">column_name</span><span class="p">)</span> +</span><span id="MappingSchema.get_column_type-279"><a href="#MappingSchema.get_column_type-279"><span class="linenos">279</span></a> +</span><span id="MappingSchema.get_column_type-280"><a href="#MappingSchema.get_column_type-280"><span class="linenos">280</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column_type</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">):</span> +</span><span id="MappingSchema.get_column_type-281"><a href="#MappingSchema.get_column_type-281"><span class="linenos">281</span></a> <span class="k">return</span> <span class="n">column_type</span> +</span><span id="MappingSchema.get_column_type-282"><a href="#MappingSchema.get_column_type-282"><span class="linenos">282</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">column_type</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="MappingSchema.get_column_type-283"><a href="#MappingSchema.get_column_type-283"><span class="linenos">283</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_to_data_type</span><span class="p">(</span><span class="n">column_type</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> +</span><span id="MappingSchema.get_column_type-284"><a href="#MappingSchema.get_column_type-284"><span class="linenos">284</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unknown column type '</span><span class="si">{</span><span class="n">column_type</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span><span id="MappingSchema.get_column_type-285"><a href="#MappingSchema.get_column_type-285"><span class="linenos">285</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">UNKNOWN</span><span class="p">)</span> +</span><span id="MappingSchema.get_column_type-286"><a href="#MappingSchema.get_column_type-286"><span class="linenos">286</span></a> <span class="k">raise</span> <span class="n">SchemaError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Could not convert table '</span><span class="si">{</span><span class="n">table</span><span class="si">}</span><span class="s2">'"</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Get the <code>sqlglot.exp.DataType</code> type of a column in the schema.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>table:</strong> the source table.</li> +<li><strong>column:</strong> the target column.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The resulting column type.</p> +</blockquote> +</div> + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt><a href="#AbstractMappingSchema">AbstractMappingSchema</a></dt> + <dd id="MappingSchema.supported_table_args" class="variable"><a href="#AbstractMappingSchema.supported_table_args">supported_table_args</a></dd> + <dd id="MappingSchema.table_parts" class="function"><a href="#AbstractMappingSchema.table_parts">table_parts</a></dd> + <dd id="MappingSchema.find" class="function"><a href="#AbstractMappingSchema.find">find</a></dd> + + </div> + </dl> + </div> + </section> + <section id="ensure_schema"> + <input id="ensure_schema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ensure_schema</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">schema</span><span class="p">:</span> <span class="n">Any</span></span><span class="return-annotation">) -> <span class="n"><a href="#Schema">sqlglot.schema.Schema</a></span>:</span></span> + + <label class="view-source-button" for="ensure_schema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ensure_schema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ensure_schema-310"><a href="#ensure_schema-310"><span class="linenos">310</span></a><span class="k">def</span> <span class="nf">ensure_schema</span><span class="p">(</span><span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">)</span> <span class="o">-></span> <span class="n">Schema</span><span class="p">:</span> +</span><span id="ensure_schema-311"><a href="#ensure_schema-311"><span class="linenos">311</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">schema</span><span class="p">,</span> <span class="n">Schema</span><span class="p">):</span> +</span><span id="ensure_schema-312"><a href="#ensure_schema-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="n">schema</span> +</span><span id="ensure_schema-313"><a href="#ensure_schema-313"><span class="linenos">313</span></a> +</span><span id="ensure_schema-314"><a href="#ensure_schema-314"><span class="linenos">314</span></a> <span class="k">return</span> <span class="n">MappingSchema</span><span class="p">(</span><span class="n">schema</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="ensure_column_mapping"> + <input id="ensure_column_mapping-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">ensure_column_mapping</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">mapping</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">Dict</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="n">sqlglot</span><span class="o">.</span><span class="n">dataframe</span><span class="o">.</span><span class="n">sql</span><span class="o">.</span><span class="n">types</span><span class="o">.</span><span class="n">StructType</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">NoneType</span><span class="p">]</span></span><span class="return-annotation">):</span></span> + + <label class="view-source-button" for="ensure_column_mapping-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#ensure_column_mapping"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="ensure_column_mapping-317"><a href="#ensure_column_mapping-317"><span class="linenos">317</span></a><span class="k">def</span> <span class="nf">ensure_column_mapping</span><span class="p">(</span><span class="n">mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">ColumnMapping</span><span class="p">]):</span> +</span><span id="ensure_column_mapping-318"><a href="#ensure_column_mapping-318"><span class="linenos">318</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="ensure_column_mapping-319"><a href="#ensure_column_mapping-319"><span class="linenos">319</span></a> <span class="k">return</span> <span class="n">mapping</span> +</span><span id="ensure_column_mapping-320"><a href="#ensure_column_mapping-320"><span class="linenos">320</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> +</span><span id="ensure_column_mapping-321"><a href="#ensure_column_mapping-321"><span class="linenos">321</span></a> <span class="n">col_name_type_strs</span> <span class="o">=</span> <span class="p">[</span><span class="n">x</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">mapping</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">","</span><span class="p">)]</span> +</span><span id="ensure_column_mapping-322"><a href="#ensure_column_mapping-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="ensure_column_mapping-323"><a href="#ensure_column_mapping-323"><span class="linenos">323</span></a> <span class="n">name_type_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">":"</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">():</span> <span class="n">name_type_str</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">":"</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="ensure_column_mapping-324"><a href="#ensure_column_mapping-324"><span class="linenos">324</span></a> <span class="k">for</span> <span class="n">name_type_str</span> <span class="ow">in</span> <span class="n">col_name_type_strs</span> +</span><span id="ensure_column_mapping-325"><a href="#ensure_column_mapping-325"><span class="linenos">325</span></a> <span class="p">}</span> +</span><span id="ensure_column_mapping-326"><a href="#ensure_column_mapping-326"><span class="linenos">326</span></a> <span class="c1"># Check if mapping looks like a DataFrame StructType</span> +</span><span id="ensure_column_mapping-327"><a href="#ensure_column_mapping-327"><span class="linenos">327</span></a> <span class="k">elif</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="s2">"simpleString"</span><span class="p">):</span> +</span><span id="ensure_column_mapping-328"><a href="#ensure_column_mapping-328"><span class="linenos">328</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">struct_field</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="n">struct_field</span><span class="o">.</span><span class="n">dataType</span><span class="o">.</span><span class="n">simpleString</span><span class="p">()</span> <span class="k">for</span> <span class="n">struct_field</span> <span class="ow">in</span> <span class="n">mapping</span><span class="p">}</span> <span class="c1"># type: ignore</span> +</span><span id="ensure_column_mapping-329"><a href="#ensure_column_mapping-329"><span class="linenos">329</span></a> <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">mapping</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="ensure_column_mapping-330"><a href="#ensure_column_mapping-330"><span class="linenos">330</span></a> <span class="k">return</span> <span class="p">{</span><span class="n">x</span><span class="o">.</span><span class="n">strip</span><span class="p">():</span> <span class="kc">None</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">mapping</span><span class="p">}</span> +</span><span id="ensure_column_mapping-331"><a href="#ensure_column_mapping-331"><span class="linenos">331</span></a> <span class="k">elif</span> <span class="n">mapping</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="ensure_column_mapping-332"><a href="#ensure_column_mapping-332"><span class="linenos">332</span></a> <span class="k">return</span> <span class="p">{}</span> +</span><span id="ensure_column_mapping-333"><a href="#ensure_column_mapping-333"><span class="linenos">333</span></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Invalid mapping provided: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">mapping</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span></pre></div> + + + + + </section> + <section id="flatten_schema"> + <input id="flatten_schema-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">flatten_schema</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">schema</span><span class="p">:</span> <span class="n">Dict</span>,</span><span class="param"> <span class="n">depth</span><span class="p">:</span> <span class="nb">int</span>,</span><span class="param"> <span class="n">keys</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span>:</span></span> + + <label class="view-source-button" for="flatten_schema-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#flatten_schema"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="flatten_schema-336"><a href="#flatten_schema-336"><span class="linenos">336</span></a><span class="k">def</span> <span class="nf">flatten_schema</span><span class="p">(</span> +</span><span id="flatten_schema-337"><a href="#flatten_schema-337"><span class="linenos">337</span></a> <span class="n">schema</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">depth</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span> <span class="n">keys</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="flatten_schema-338"><a href="#flatten_schema-338"><span class="linenos">338</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]]:</span> +</span><span id="flatten_schema-339"><a href="#flatten_schema-339"><span class="linenos">339</span></a> <span class="n">tables</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="flatten_schema-340"><a href="#flatten_schema-340"><span class="linenos">340</span></a> <span class="n">keys</span> <span class="o">=</span> <span class="n">keys</span> <span class="ow">or</span> <span class="p">[]</span> +</span><span id="flatten_schema-341"><a href="#flatten_schema-341"><span class="linenos">341</span></a> +</span><span id="flatten_schema-342"><a href="#flatten_schema-342"><span class="linenos">342</span></a> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">schema</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> +</span><span id="flatten_schema-343"><a href="#flatten_schema-343"><span class="linenos">343</span></a> <span class="k">if</span> <span class="n">depth</span> <span class="o">>=</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="flatten_schema-344"><a href="#flatten_schema-344"><span class="linenos">344</span></a> <span class="n">tables</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">flatten_schema</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">depth</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">keys</span> <span class="o">+</span> <span class="p">[</span><span class="n">k</span><span class="p">]))</span> +</span><span id="flatten_schema-345"><a href="#flatten_schema-345"><span class="linenos">345</span></a> <span class="k">elif</span> <span class="n">depth</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="flatten_schema-346"><a href="#flatten_schema-346"><span class="linenos">346</span></a> <span class="n">tables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">keys</span> <span class="o">+</span> <span class="p">[</span><span class="n">k</span><span class="p">])</span> +</span><span id="flatten_schema-347"><a href="#flatten_schema-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="n">tables</span> +</span></pre></div> + + + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/serde.html b/docs/sqlglot/serde.html new file mode 100644 index 0000000..84be9d8 --- /dev/null +++ b/docs/sqlglot/serde.html @@ -0,0 +1,408 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.serde API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#dump">dump</a> + </li> + <li> + <a class="function" href="#load">load</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/serde.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.serde </h1> + + + <input id="mod-serde-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-serde-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="n">JSON</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="nb">dict</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">Node</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Union</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="s2">"Node"</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">,</span> <span class="n">JSON</span><span class="p">]</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">Node</span><span class="p">)</span> <span class="o">-></span> <span class="n">JSON</span><span class="p">:</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> Recursively dump an AST into a JSON-serializable dict.</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> """</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">dump</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">node</span><span class="p">]</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">):</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="s2">"class"</span><span class="p">:</span> <span class="s2">"DataType.Type"</span><span class="p">,</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="s2">"value"</span><span class="p">:</span> <span class="n">node</span><span class="o">.</span><span class="n">value</span><span class="p">,</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="p">}</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__qualname__</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span> <span class="o">!=</span> <span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="vm">__module__</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">klass</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">obj</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="s2">"class"</span><span class="p">:</span> <span class="n">klass</span><span class="p">,</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="s2">"args"</span><span class="p">:</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">dump</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">v</span> <span class="o">!=</span> <span class="p">[]},</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="p">}</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span><span class="p">:</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">obj</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">comments</span><span class="p">:</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">obj</span><span class="p">[</span><span class="s2">"comments"</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">comments</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="n">obj</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a><span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">JSON</span><span class="p">)</span> <span class="o">-></span> <span class="n">Node</span><span class="p">:</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a><span class="sd"> Recursively load a dict (as returned by `dump`) into an AST.</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a><span class="sd"> """</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">load</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">obj</span><span class="p">]</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> <span class="n">class_name</span> <span class="o">=</span> <span class="n">obj</span><span class="p">[</span><span class="s2">"class"</span><span class="p">]</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="k">if</span> <span class="n">class_name</span> <span class="o">==</span> <span class="s2">"DataType.Type"</span><span class="p">:</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">(</span><span class="n">obj</span><span class="p">[</span><span class="s2">"value"</span><span class="p">])</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="k">if</span> <span class="s2">"."</span> <span class="ow">in</span> <span class="n">class_name</span><span class="p">:</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> <span class="n">module_path</span><span class="p">,</span> <span class="n">class_name</span> <span class="o">=</span> <span class="n">class_name</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s2">"."</span><span class="p">,</span> <span class="n">maxsplit</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> <span class="n">module</span> <span class="o">=</span> <span class="nb">__import__</span><span class="p">(</span><span class="n">module_path</span><span class="p">,</span> <span class="n">fromlist</span><span class="o">=</span><span class="p">[</span><span class="n">class_name</span><span class="p">])</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> <span class="n">module</span> <span class="o">=</span> <span class="n">exp</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">module</span><span class="p">,</span> <span class="n">class_name</span><span class="p">)</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">klass</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">load</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">obj</span><span class="p">[</span><span class="s2">"args"</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()})</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="n">type_</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"type"</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> <span class="k">if</span> <span class="n">type_</span><span class="p">:</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">type_</span><span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"comments"</span><span class="p">)</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> <span class="k">if</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="n">comments</span><span class="p">)</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> <span class="k">return</span> <span class="n">obj</span> +</span></pre></div> + + + </section> + <section id="dump"> + <input id="dump-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">dump</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">node</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="n">ForwardRef</span><span class="p">(</span><span class="s1">'Node'</span><span class="p">)],</span> <span class="n"><a href="expressions.html#DataType.Type">sqlglot.expressions.DataType.Type</a></span><span class="p">,</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="nb">dict</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">Union</span><span class="p">[</span><span class="nb">dict</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="dump-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#dump"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="dump-13"><a href="#dump-13"><span class="linenos">13</span></a><span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="n">node</span><span class="p">:</span> <span class="n">Node</span><span class="p">)</span> <span class="o">-></span> <span class="n">JSON</span><span class="p">:</span> +</span><span id="dump-14"><a href="#dump-14"><span class="linenos">14</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="dump-15"><a href="#dump-15"><span class="linenos">15</span></a><span class="sd"> Recursively dump an AST into a JSON-serializable dict.</span> +</span><span id="dump-16"><a href="#dump-16"><span class="linenos">16</span></a><span class="sd"> """</span> +</span><span id="dump-17"><a href="#dump-17"><span class="linenos">17</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="dump-18"><a href="#dump-18"><span class="linenos">18</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">dump</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">node</span><span class="p">]</span> +</span><span id="dump-19"><a href="#dump-19"><span class="linenos">19</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">):</span> +</span><span id="dump-20"><a href="#dump-20"><span class="linenos">20</span></a> <span class="k">return</span> <span class="p">{</span> +</span><span id="dump-21"><a href="#dump-21"><span class="linenos">21</span></a> <span class="s2">"class"</span><span class="p">:</span> <span class="s2">"DataType.Type"</span><span class="p">,</span> +</span><span id="dump-22"><a href="#dump-22"><span class="linenos">22</span></a> <span class="s2">"value"</span><span class="p">:</span> <span class="n">node</span><span class="o">.</span><span class="n">value</span><span class="p">,</span> +</span><span id="dump-23"><a href="#dump-23"><span class="linenos">23</span></a> <span class="p">}</span> +</span><span id="dump-24"><a href="#dump-24"><span class="linenos">24</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">):</span> +</span><span id="dump-25"><a href="#dump-25"><span class="linenos">25</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__qualname__</span> +</span><span id="dump-26"><a href="#dump-26"><span class="linenos">26</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="vm">__class__</span><span class="o">.</span><span class="vm">__module__</span> <span class="o">!=</span> <span class="n">exp</span><span class="o">.</span><span class="vm">__name__</span><span class="p">:</span> +</span><span id="dump-27"><a href="#dump-27"><span class="linenos">27</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">node</span><span class="o">.</span><span class="vm">__module__</span><span class="si">}</span><span class="s2">.</span><span class="si">{</span><span class="n">klass</span><span class="si">}</span><span class="s2">"</span> +</span><span id="dump-28"><a href="#dump-28"><span class="linenos">28</span></a> <span class="n">obj</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="dump-29"><a href="#dump-29"><span class="linenos">29</span></a> <span class="s2">"class"</span><span class="p">:</span> <span class="n">klass</span><span class="p">,</span> +</span><span id="dump-30"><a href="#dump-30"><span class="linenos">30</span></a> <span class="s2">"args"</span><span class="p">:</span> <span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">dump</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> <span class="k">if</span> <span class="n">v</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">v</span> <span class="o">!=</span> <span class="p">[]},</span> +</span><span id="dump-31"><a href="#dump-31"><span class="linenos">31</span></a> <span class="p">}</span> +</span><span id="dump-32"><a href="#dump-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span><span class="p">:</span> +</span><span id="dump-33"><a href="#dump-33"><span class="linenos">33</span></a> <span class="n">obj</span><span class="p">[</span><span class="s2">"type"</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">type</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +</span><span id="dump-34"><a href="#dump-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="n">node</span><span class="o">.</span><span class="n">comments</span><span class="p">:</span> +</span><span id="dump-35"><a href="#dump-35"><span class="linenos">35</span></a> <span class="n">obj</span><span class="p">[</span><span class="s2">"comments"</span><span class="p">]</span> <span class="o">=</span> <span class="n">node</span><span class="o">.</span><span class="n">comments</span> +</span><span id="dump-36"><a href="#dump-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="n">obj</span> +</span><span id="dump-37"><a href="#dump-37"><span class="linenos">37</span></a> <span class="k">return</span> <span class="n">node</span> +</span></pre></div> + + + <div class="docstring"><p>Recursively dump an AST into a JSON-serializable dict.</p> +</div> + + + </section> + <section id="load"> + <input id="load-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">load</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">obj</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">dict</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">Union</span><span class="p">[</span><span class="n">List</span><span class="p">[</span><span class="n">ForwardRef</span><span class="p">(</span><span class="s1">'Node'</span><span class="p">)],</span> <span class="n"><a href="expressions.html#DataType.Type">sqlglot.expressions.DataType.Type</a></span><span class="p">,</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">,</span> <span class="nb">dict</span><span class="p">,</span> <span class="nb">list</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">float</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">bool</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="load-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#load"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="load-40"><a href="#load-40"><span class="linenos">40</span></a><span class="k">def</span> <span class="nf">load</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">JSON</span><span class="p">)</span> <span class="o">-></span> <span class="n">Node</span><span class="p">:</span> +</span><span id="load-41"><a href="#load-41"><span class="linenos">41</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="load-42"><a href="#load-42"><span class="linenos">42</span></a><span class="sd"> Recursively load a dict (as returned by `dump`) into an AST.</span> +</span><span id="load-43"><a href="#load-43"><span class="linenos">43</span></a><span class="sd"> """</span> +</span><span id="load-44"><a href="#load-44"><span class="linenos">44</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span> +</span><span id="load-45"><a href="#load-45"><span class="linenos">45</span></a> <span class="k">return</span> <span class="p">[</span><span class="n">load</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">obj</span><span class="p">]</span> +</span><span id="load-46"><a href="#load-46"><span class="linenos">46</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span> +</span><span id="load-47"><a href="#load-47"><span class="linenos">47</span></a> <span class="n">class_name</span> <span class="o">=</span> <span class="n">obj</span><span class="p">[</span><span class="s2">"class"</span><span class="p">]</span> +</span><span id="load-48"><a href="#load-48"><span class="linenos">48</span></a> +</span><span id="load-49"><a href="#load-49"><span class="linenos">49</span></a> <span class="k">if</span> <span class="n">class_name</span> <span class="o">==</span> <span class="s2">"DataType.Type"</span><span class="p">:</span> +</span><span id="load-50"><a href="#load-50"><span class="linenos">50</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="p">(</span><span class="n">obj</span><span class="p">[</span><span class="s2">"value"</span><span class="p">])</span> +</span><span id="load-51"><a href="#load-51"><span class="linenos">51</span></a> +</span><span id="load-52"><a href="#load-52"><span class="linenos">52</span></a> <span class="k">if</span> <span class="s2">"."</span> <span class="ow">in</span> <span class="n">class_name</span><span class="p">:</span> +</span><span id="load-53"><a href="#load-53"><span class="linenos">53</span></a> <span class="n">module_path</span><span class="p">,</span> <span class="n">class_name</span> <span class="o">=</span> <span class="n">class_name</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s2">"."</span><span class="p">,</span> <span class="n">maxsplit</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> +</span><span id="load-54"><a href="#load-54"><span class="linenos">54</span></a> <span class="n">module</span> <span class="o">=</span> <span class="nb">__import__</span><span class="p">(</span><span class="n">module_path</span><span class="p">,</span> <span class="n">fromlist</span><span class="o">=</span><span class="p">[</span><span class="n">class_name</span><span class="p">])</span> +</span><span id="load-55"><a href="#load-55"><span class="linenos">55</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="load-56"><a href="#load-56"><span class="linenos">56</span></a> <span class="n">module</span> <span class="o">=</span> <span class="n">exp</span> +</span><span id="load-57"><a href="#load-57"><span class="linenos">57</span></a> +</span><span id="load-58"><a href="#load-58"><span class="linenos">58</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">module</span><span class="p">,</span> <span class="n">class_name</span><span class="p">)</span> +</span><span id="load-59"><a href="#load-59"><span class="linenos">59</span></a> +</span><span id="load-60"><a href="#load-60"><span class="linenos">60</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">klass</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="n">k</span><span class="p">:</span> <span class="n">load</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">obj</span><span class="p">[</span><span class="s2">"args"</span><span class="p">]</span><span class="o">.</span><span class="n">items</span><span class="p">()})</span> +</span><span id="load-61"><a href="#load-61"><span class="linenos">61</span></a> <span class="n">type_</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"type"</span><span class="p">)</span> +</span><span id="load-62"><a href="#load-62"><span class="linenos">62</span></a> <span class="k">if</span> <span class="n">type_</span><span class="p">:</span> +</span><span id="load-63"><a href="#load-63"><span class="linenos">63</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">type_</span><span class="p">)</span> +</span><span id="load-64"><a href="#load-64"><span class="linenos">64</span></a> <span class="n">comments</span> <span class="o">=</span> <span class="n">obj</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"comments"</span><span class="p">)</span> +</span><span id="load-65"><a href="#load-65"><span class="linenos">65</span></a> <span class="k">if</span> <span class="n">comments</span><span class="p">:</span> +</span><span id="load-66"><a href="#load-66"><span class="linenos">66</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="n">comments</span><span class="p">)</span> +</span><span id="load-67"><a href="#load-67"><span class="linenos">67</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="load-68"><a href="#load-68"><span class="linenos">68</span></a> <span class="k">return</span> <span class="n">obj</span> +</span></pre></div> + + + <div class="docstring"><p>Recursively load a dict (as returned by <code><a href="#dump">dump</a></code>) into an AST.</p> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/time.html b/docs/sqlglot/time.html new file mode 100644 index 0000000..8d07b25 --- /dev/null +++ b/docs/sqlglot/time.html @@ -0,0 +1,385 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.time API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#format_time">format_time</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/time.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.time </h1> + + + <input id="mod-time-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-time-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="c1"># The generic time format is based on python time.strftime.</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="c1"># https://docs.python.org/3/library/time.html#time.strftime</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.trie</span> <span class="kn">import</span> <span class="n">in_trie</span><span class="p">,</span> <span class="n">new_trie</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">string</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a><span class="sd"> Converts a time string given a mapping.</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> Examples:</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> >>> format_time("%Y", {"%Y": "YYYY"})</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a><span class="sd"> 'YYYY'</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd"> Args:</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a><span class="sd"> mapping: dictionary of time format to target time format.</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="sd"> trie: optional trie, can be passed in for performance.</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a><span class="sd"> Returns:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a><span class="sd"> The converted time string.</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a><span class="sd"> """</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">string</span><span class="p">:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="n">start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="n">end</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">string</span><span class="p">)</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">trie</span> <span class="o">=</span> <span class="n">trie</span> <span class="ow">or</span> <span class="n">new_trie</span><span class="p">(</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="n">chunks</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="n">sym</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="k">while</span> <span class="n">end</span> <span class="o"><=</span> <span class="n">size</span><span class="p">:</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="n">string</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="n">result</span><span class="p">,</span> <span class="n">current</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="n">current</span><span class="p">,</span> <span class="n">chars</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="k">if</span> <span class="n">sym</span><span class="p">:</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> <span class="n">end</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="n">sym</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a> <span class="n">sym</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> <span class="n">start</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a> <span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> <span class="k">elif</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a> <span class="n">sym</span> <span class="o">=</span> <span class="n">chars</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a> <span class="n">end</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a> <span class="k">if</span> <span class="n">result</span> <span class="ow">and</span> <span class="n">end</span> <span class="o">></span> <span class="n">size</span><span class="p">:</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a> <span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a> <span class="k">return</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">chars</span><span class="p">,</span> <span class="n">chars</span><span class="p">)</span> <span class="k">for</span> <span class="n">chars</span> <span class="ow">in</span> <span class="n">chunks</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="format_time"> + <input id="format_time-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">format_time</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">string</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">mapping</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span>,</span><span class="param"> <span class="n">trie</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></span><span class="return-annotation">) -> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="format_time-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#format_time"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="format_time-9"><a href="#format_time-9"><span class="linenos"> 9</span></a><span class="k">def</span> <span class="nf">format_time</span><span class="p">(</span> +</span><span id="format_time-10"><a href="#format_time-10"><span class="linenos">10</span></a> <span class="n">string</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">mapping</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">],</span> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="format_time-11"><a href="#format_time-11"><span class="linenos">11</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span> +</span><span id="format_time-12"><a href="#format_time-12"><span class="linenos">12</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="format_time-13"><a href="#format_time-13"><span class="linenos">13</span></a><span class="sd"> Converts a time string given a mapping.</span> +</span><span id="format_time-14"><a href="#format_time-14"><span class="linenos">14</span></a> +</span><span id="format_time-15"><a href="#format_time-15"><span class="linenos">15</span></a><span class="sd"> Examples:</span> +</span><span id="format_time-16"><a href="#format_time-16"><span class="linenos">16</span></a><span class="sd"> >>> format_time("%Y", {"%Y": "YYYY"})</span> +</span><span id="format_time-17"><a href="#format_time-17"><span class="linenos">17</span></a><span class="sd"> 'YYYY'</span> +</span><span id="format_time-18"><a href="#format_time-18"><span class="linenos">18</span></a> +</span><span id="format_time-19"><a href="#format_time-19"><span class="linenos">19</span></a><span class="sd"> Args:</span> +</span><span id="format_time-20"><a href="#format_time-20"><span class="linenos">20</span></a><span class="sd"> mapping: dictionary of time format to target time format.</span> +</span><span id="format_time-21"><a href="#format_time-21"><span class="linenos">21</span></a><span class="sd"> trie: optional trie, can be passed in for performance.</span> +</span><span id="format_time-22"><a href="#format_time-22"><span class="linenos">22</span></a> +</span><span id="format_time-23"><a href="#format_time-23"><span class="linenos">23</span></a><span class="sd"> Returns:</span> +</span><span id="format_time-24"><a href="#format_time-24"><span class="linenos">24</span></a><span class="sd"> The converted time string.</span> +</span><span id="format_time-25"><a href="#format_time-25"><span class="linenos">25</span></a><span class="sd"> """</span> +</span><span id="format_time-26"><a href="#format_time-26"><span class="linenos">26</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">string</span><span class="p">:</span> +</span><span id="format_time-27"><a href="#format_time-27"><span class="linenos">27</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="format_time-28"><a href="#format_time-28"><span class="linenos">28</span></a> +</span><span id="format_time-29"><a href="#format_time-29"><span class="linenos">29</span></a> <span class="n">start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="format_time-30"><a href="#format_time-30"><span class="linenos">30</span></a> <span class="n">end</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="format_time-31"><a href="#format_time-31"><span class="linenos">31</span></a> <span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">string</span><span class="p">)</span> +</span><span id="format_time-32"><a href="#format_time-32"><span class="linenos">32</span></a> <span class="n">trie</span> <span class="o">=</span> <span class="n">trie</span> <span class="ow">or</span> <span class="n">new_trie</span><span class="p">(</span><span class="n">mapping</span><span class="p">)</span> +</span><span id="format_time-33"><a href="#format_time-33"><span class="linenos">33</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="format_time-34"><a href="#format_time-34"><span class="linenos">34</span></a> <span class="n">chunks</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="format_time-35"><a href="#format_time-35"><span class="linenos">35</span></a> <span class="n">sym</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="format_time-36"><a href="#format_time-36"><span class="linenos">36</span></a> +</span><span id="format_time-37"><a href="#format_time-37"><span class="linenos">37</span></a> <span class="k">while</span> <span class="n">end</span> <span class="o"><=</span> <span class="n">size</span><span class="p">:</span> +</span><span id="format_time-38"><a href="#format_time-38"><span class="linenos">38</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="n">string</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="format_time-39"><a href="#format_time-39"><span class="linenos">39</span></a> <span class="n">result</span><span class="p">,</span> <span class="n">current</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="n">current</span><span class="p">,</span> <span class="n">chars</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> +</span><span id="format_time-40"><a href="#format_time-40"><span class="linenos">40</span></a> +</span><span id="format_time-41"><a href="#format_time-41"><span class="linenos">41</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="format_time-42"><a href="#format_time-42"><span class="linenos">42</span></a> <span class="k">if</span> <span class="n">sym</span><span class="p">:</span> +</span><span id="format_time-43"><a href="#format_time-43"><span class="linenos">43</span></a> <span class="n">end</span> <span class="o">-=</span> <span class="mi">1</span> +</span><span id="format_time-44"><a href="#format_time-44"><span class="linenos">44</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="n">sym</span> +</span><span id="format_time-45"><a href="#format_time-45"><span class="linenos">45</span></a> <span class="n">sym</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="format_time-46"><a href="#format_time-46"><span class="linenos">46</span></a> <span class="n">start</span> <span class="o">+=</span> <span class="nb">len</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span> +</span><span id="format_time-47"><a href="#format_time-47"><span class="linenos">47</span></a> <span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span> +</span><span id="format_time-48"><a href="#format_time-48"><span class="linenos">48</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="format_time-49"><a href="#format_time-49"><span class="linenos">49</span></a> <span class="k">elif</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="format_time-50"><a href="#format_time-50"><span class="linenos">50</span></a> <span class="n">sym</span> <span class="o">=</span> <span class="n">chars</span> +</span><span id="format_time-51"><a href="#format_time-51"><span class="linenos">51</span></a> +</span><span id="format_time-52"><a href="#format_time-52"><span class="linenos">52</span></a> <span class="n">end</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="format_time-53"><a href="#format_time-53"><span class="linenos">53</span></a> +</span><span id="format_time-54"><a href="#format_time-54"><span class="linenos">54</span></a> <span class="k">if</span> <span class="n">result</span> <span class="ow">and</span> <span class="n">end</span> <span class="o">></span> <span class="n">size</span><span class="p">:</span> +</span><span id="format_time-55"><a href="#format_time-55"><span class="linenos">55</span></a> <span class="n">chunks</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span> +</span><span id="format_time-56"><a href="#format_time-56"><span class="linenos">56</span></a> <span class="k">return</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">chars</span><span class="p">,</span> <span class="n">chars</span><span class="p">)</span> <span class="k">for</span> <span class="n">chars</span> <span class="ow">in</span> <span class="n">chunks</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Converts a time string given a mapping.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">format_time</span><span class="p">(</span><span class="s2">"%Y"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"%Y"</span><span class="p">:</span> <span class="s2">"YYYY"</span><span class="p">})</span> +<span class="go">'YYYY'</span> +</code></pre> + </div> + + <p>Args: + mapping: dictionary of time format to target time format. + trie: optional trie, can be passed in for performance.</p> + + <p>Returns: + The converted time string.</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/tokens.html b/docs/sqlglot/tokens.html new file mode 100644 index 0000000..09ccc62 --- /dev/null +++ b/docs/sqlglot/tokens.html @@ -0,0 +1,6712 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.tokens API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="class" href="#TokenType">TokenType</a> + <ul class="memberlist"> + <li> + <a class="variable" href="#TokenType.L_PAREN">L_PAREN</a> + </li> + <li> + <a class="variable" href="#TokenType.R_PAREN">R_PAREN</a> + </li> + <li> + <a class="variable" href="#TokenType.L_BRACKET">L_BRACKET</a> + </li> + <li> + <a class="variable" href="#TokenType.R_BRACKET">R_BRACKET</a> + </li> + <li> + <a class="variable" href="#TokenType.L_BRACE">L_BRACE</a> + </li> + <li> + <a class="variable" href="#TokenType.R_BRACE">R_BRACE</a> + </li> + <li> + <a class="variable" href="#TokenType.COMMA">COMMA</a> + </li> + <li> + <a class="variable" href="#TokenType.DOT">DOT</a> + </li> + <li> + <a class="variable" href="#TokenType.DASH">DASH</a> + </li> + <li> + <a class="variable" href="#TokenType.PLUS">PLUS</a> + </li> + <li> + <a class="variable" href="#TokenType.COLON">COLON</a> + </li> + <li> + <a class="variable" href="#TokenType.DCOLON">DCOLON</a> + </li> + <li> + <a class="variable" href="#TokenType.SEMICOLON">SEMICOLON</a> + </li> + <li> + <a class="variable" href="#TokenType.STAR">STAR</a> + </li> + <li> + <a class="variable" href="#TokenType.BACKSLASH">BACKSLASH</a> + </li> + <li> + <a class="variable" href="#TokenType.SLASH">SLASH</a> + </li> + <li> + <a class="variable" href="#TokenType.LT">LT</a> + </li> + <li> + <a class="variable" href="#TokenType.LTE">LTE</a> + </li> + <li> + <a class="variable" href="#TokenType.GT">GT</a> + </li> + <li> + <a class="variable" href="#TokenType.GTE">GTE</a> + </li> + <li> + <a class="variable" href="#TokenType.NOT">NOT</a> + </li> + <li> + <a class="variable" href="#TokenType.EQ">EQ</a> + </li> + <li> + <a class="variable" href="#TokenType.NEQ">NEQ</a> + </li> + <li> + <a class="variable" href="#TokenType.NULLSAFE_EQ">NULLSAFE_EQ</a> + </li> + <li> + <a class="variable" href="#TokenType.AND">AND</a> + </li> + <li> + <a class="variable" href="#TokenType.OR">OR</a> + </li> + <li> + <a class="variable" href="#TokenType.AMP">AMP</a> + </li> + <li> + <a class="variable" href="#TokenType.DPIPE">DPIPE</a> + </li> + <li> + <a class="variable" href="#TokenType.PIPE">PIPE</a> + </li> + <li> + <a class="variable" href="#TokenType.CARET">CARET</a> + </li> + <li> + <a class="variable" href="#TokenType.TILDA">TILDA</a> + </li> + <li> + <a class="variable" href="#TokenType.ARROW">ARROW</a> + </li> + <li> + <a class="variable" href="#TokenType.DARROW">DARROW</a> + </li> + <li> + <a class="variable" href="#TokenType.FARROW">FARROW</a> + </li> + <li> + <a class="variable" href="#TokenType.HASH">HASH</a> + </li> + <li> + <a class="variable" href="#TokenType.HASH_ARROW">HASH_ARROW</a> + </li> + <li> + <a class="variable" href="#TokenType.DHASH_ARROW">DHASH_ARROW</a> + </li> + <li> + <a class="variable" href="#TokenType.LR_ARROW">LR_ARROW</a> + </li> + <li> + <a class="variable" href="#TokenType.DOLLAR">DOLLAR</a> + </li> + <li> + <a class="variable" href="#TokenType.PARAMETER">PARAMETER</a> + </li> + <li> + <a class="variable" href="#TokenType.SESSION_PARAMETER">SESSION_PARAMETER</a> + </li> + <li> + <a class="variable" href="#TokenType.NATIONAL">NATIONAL</a> + </li> + <li> + <a class="variable" href="#TokenType.BLOCK_START">BLOCK_START</a> + </li> + <li> + <a class="variable" href="#TokenType.BLOCK_END">BLOCK_END</a> + </li> + <li> + <a class="variable" href="#TokenType.SPACE">SPACE</a> + </li> + <li> + <a class="variable" href="#TokenType.BREAK">BREAK</a> + </li> + <li> + <a class="variable" href="#TokenType.STRING">STRING</a> + </li> + <li> + <a class="variable" href="#TokenType.NUMBER">NUMBER</a> + </li> + <li> + <a class="variable" href="#TokenType.IDENTIFIER">IDENTIFIER</a> + </li> + <li> + <a class="variable" href="#TokenType.COLUMN">COLUMN</a> + </li> + <li> + <a class="variable" href="#TokenType.COLUMN_DEF">COLUMN_DEF</a> + </li> + <li> + <a class="variable" href="#TokenType.SCHEMA">SCHEMA</a> + </li> + <li> + <a class="variable" href="#TokenType.TABLE">TABLE</a> + </li> + <li> + <a class="variable" href="#TokenType.VAR">VAR</a> + </li> + <li> + <a class="variable" href="#TokenType.BIT_STRING">BIT_STRING</a> + </li> + <li> + <a class="variable" href="#TokenType.HEX_STRING">HEX_STRING</a> + </li> + <li> + <a class="variable" href="#TokenType.BYTE_STRING">BYTE_STRING</a> + </li> + <li> + <a class="variable" href="#TokenType.BOOLEAN">BOOLEAN</a> + </li> + <li> + <a class="variable" href="#TokenType.TINYINT">TINYINT</a> + </li> + <li> + <a class="variable" href="#TokenType.SMALLINT">SMALLINT</a> + </li> + <li> + <a class="variable" href="#TokenType.INT">INT</a> + </li> + <li> + <a class="variable" href="#TokenType.BIGINT">BIGINT</a> + </li> + <li> + <a class="variable" href="#TokenType.FLOAT">FLOAT</a> + </li> + <li> + <a class="variable" href="#TokenType.DOUBLE">DOUBLE</a> + </li> + <li> + <a class="variable" href="#TokenType.DECIMAL">DECIMAL</a> + </li> + <li> + <a class="variable" href="#TokenType.CHAR">CHAR</a> + </li> + <li> + <a class="variable" href="#TokenType.NCHAR">NCHAR</a> + </li> + <li> + <a class="variable" href="#TokenType.VARCHAR">VARCHAR</a> + </li> + <li> + <a class="variable" href="#TokenType.NVARCHAR">NVARCHAR</a> + </li> + <li> + <a class="variable" href="#TokenType.TEXT">TEXT</a> + </li> + <li> + <a class="variable" href="#TokenType.MEDIUMTEXT">MEDIUMTEXT</a> + </li> + <li> + <a class="variable" href="#TokenType.LONGTEXT">LONGTEXT</a> + </li> + <li> + <a class="variable" href="#TokenType.MEDIUMBLOB">MEDIUMBLOB</a> + </li> + <li> + <a class="variable" href="#TokenType.LONGBLOB">LONGBLOB</a> + </li> + <li> + <a class="variable" href="#TokenType.BINARY">BINARY</a> + </li> + <li> + <a class="variable" href="#TokenType.VARBINARY">VARBINARY</a> + </li> + <li> + <a class="variable" href="#TokenType.JSON">JSON</a> + </li> + <li> + <a class="variable" href="#TokenType.JSONB">JSONB</a> + </li> + <li> + <a class="variable" href="#TokenType.TIME">TIME</a> + </li> + <li> + <a class="variable" href="#TokenType.TIMESTAMP">TIMESTAMP</a> + </li> + <li> + <a class="variable" href="#TokenType.TIMESTAMPTZ">TIMESTAMPTZ</a> + </li> + <li> + <a class="variable" href="#TokenType.TIMESTAMPLTZ">TIMESTAMPLTZ</a> + </li> + <li> + <a class="variable" href="#TokenType.DATETIME">DATETIME</a> + </li> + <li> + <a class="variable" href="#TokenType.DATE">DATE</a> + </li> + <li> + <a class="variable" href="#TokenType.UUID">UUID</a> + </li> + <li> + <a class="variable" href="#TokenType.GEOGRAPHY">GEOGRAPHY</a> + </li> + <li> + <a class="variable" href="#TokenType.NULLABLE">NULLABLE</a> + </li> + <li> + <a class="variable" href="#TokenType.GEOMETRY">GEOMETRY</a> + </li> + <li> + <a class="variable" href="#TokenType.HLLSKETCH">HLLSKETCH</a> + </li> + <li> + <a class="variable" href="#TokenType.HSTORE">HSTORE</a> + </li> + <li> + <a class="variable" href="#TokenType.SUPER">SUPER</a> + </li> + <li> + <a class="variable" href="#TokenType.SERIAL">SERIAL</a> + </li> + <li> + <a class="variable" href="#TokenType.SMALLSERIAL">SMALLSERIAL</a> + </li> + <li> + <a class="variable" href="#TokenType.BIGSERIAL">BIGSERIAL</a> + </li> + <li> + <a class="variable" href="#TokenType.XML">XML</a> + </li> + <li> + <a class="variable" href="#TokenType.UNIQUEIDENTIFIER">UNIQUEIDENTIFIER</a> + </li> + <li> + <a class="variable" href="#TokenType.MONEY">MONEY</a> + </li> + <li> + <a class="variable" href="#TokenType.SMALLMONEY">SMALLMONEY</a> + </li> + <li> + <a class="variable" href="#TokenType.ROWVERSION">ROWVERSION</a> + </li> + <li> + <a class="variable" href="#TokenType.IMAGE">IMAGE</a> + </li> + <li> + <a class="variable" href="#TokenType.VARIANT">VARIANT</a> + </li> + <li> + <a class="variable" href="#TokenType.OBJECT">OBJECT</a> + </li> + <li> + <a class="variable" href="#TokenType.ALIAS">ALIAS</a> + </li> + <li> + <a class="variable" href="#TokenType.ALTER">ALTER</a> + </li> + <li> + <a class="variable" href="#TokenType.ALWAYS">ALWAYS</a> + </li> + <li> + <a class="variable" href="#TokenType.ALL">ALL</a> + </li> + <li> + <a class="variable" href="#TokenType.ANTI">ANTI</a> + </li> + <li> + <a class="variable" href="#TokenType.ANY">ANY</a> + </li> + <li> + <a class="variable" href="#TokenType.APPLY">APPLY</a> + </li> + <li> + <a class="variable" href="#TokenType.ARRAY">ARRAY</a> + </li> + <li> + <a class="variable" href="#TokenType.ASC">ASC</a> + </li> + <li> + <a class="variable" href="#TokenType.ASOF">ASOF</a> + </li> + <li> + <a class="variable" href="#TokenType.AT_TIME_ZONE">AT_TIME_ZONE</a> + </li> + <li> + <a class="variable" href="#TokenType.AUTO_INCREMENT">AUTO_INCREMENT</a> + </li> + <li> + <a class="variable" href="#TokenType.BEGIN">BEGIN</a> + </li> + <li> + <a class="variable" href="#TokenType.BETWEEN">BETWEEN</a> + </li> + <li> + <a class="variable" href="#TokenType.BOTH">BOTH</a> + </li> + <li> + <a class="variable" href="#TokenType.BUCKET">BUCKET</a> + </li> + <li> + <a class="variable" href="#TokenType.BY_DEFAULT">BY_DEFAULT</a> + </li> + <li> + <a class="variable" href="#TokenType.CACHE">CACHE</a> + </li> + <li> + <a class="variable" href="#TokenType.CASCADE">CASCADE</a> + </li> + <li> + <a class="variable" href="#TokenType.CASE">CASE</a> + </li> + <li> + <a class="variable" href="#TokenType.CHARACTER_SET">CHARACTER_SET</a> + </li> + <li> + <a class="variable" href="#TokenType.CHECK">CHECK</a> + </li> + <li> + <a class="variable" href="#TokenType.CLUSTER_BY">CLUSTER_BY</a> + </li> + <li> + <a class="variable" href="#TokenType.COLLATE">COLLATE</a> + </li> + <li> + <a class="variable" href="#TokenType.COMMAND">COMMAND</a> + </li> + <li> + <a class="variable" href="#TokenType.COMMENT">COMMENT</a> + </li> + <li> + <a class="variable" href="#TokenType.COMMIT">COMMIT</a> + </li> + <li> + <a class="variable" href="#TokenType.COMPOUND">COMPOUND</a> + </li> + <li> + <a class="variable" href="#TokenType.CONSTRAINT">CONSTRAINT</a> + </li> + <li> + <a class="variable" href="#TokenType.CREATE">CREATE</a> + </li> + <li> + <a class="variable" href="#TokenType.CROSS">CROSS</a> + </li> + <li> + <a class="variable" href="#TokenType.CUBE">CUBE</a> + </li> + <li> + <a class="variable" href="#TokenType.CURRENT_DATE">CURRENT_DATE</a> + </li> + <li> + <a class="variable" href="#TokenType.CURRENT_DATETIME">CURRENT_DATETIME</a> + </li> + <li> + <a class="variable" href="#TokenType.CURRENT_ROW">CURRENT_ROW</a> + </li> + <li> + <a class="variable" href="#TokenType.CURRENT_TIME">CURRENT_TIME</a> + </li> + <li> + <a class="variable" href="#TokenType.CURRENT_TIMESTAMP">CURRENT_TIMESTAMP</a> + </li> + <li> + <a class="variable" href="#TokenType.DEFAULT">DEFAULT</a> + </li> + <li> + <a class="variable" href="#TokenType.DELETE">DELETE</a> + </li> + <li> + <a class="variable" href="#TokenType.DESC">DESC</a> + </li> + <li> + <a class="variable" href="#TokenType.DESCRIBE">DESCRIBE</a> + </li> + <li> + <a class="variable" href="#TokenType.DISTINCT">DISTINCT</a> + </li> + <li> + <a class="variable" href="#TokenType.DISTINCT_FROM">DISTINCT_FROM</a> + </li> + <li> + <a class="variable" href="#TokenType.DISTRIBUTE_BY">DISTRIBUTE_BY</a> + </li> + <li> + <a class="variable" href="#TokenType.DIV">DIV</a> + </li> + <li> + <a class="variable" href="#TokenType.DROP">DROP</a> + </li> + <li> + <a class="variable" href="#TokenType.ELSE">ELSE</a> + </li> + <li> + <a class="variable" href="#TokenType.ENCODE">ENCODE</a> + </li> + <li> + <a class="variable" href="#TokenType.END">END</a> + </li> + <li> + <a class="variable" href="#TokenType.ESCAPE">ESCAPE</a> + </li> + <li> + <a class="variable" href="#TokenType.EXCEPT">EXCEPT</a> + </li> + <li> + <a class="variable" href="#TokenType.EXECUTE">EXECUTE</a> + </li> + <li> + <a class="variable" href="#TokenType.EXISTS">EXISTS</a> + </li> + <li> + <a class="variable" href="#TokenType.FALSE">FALSE</a> + </li> + <li> + <a class="variable" href="#TokenType.FETCH">FETCH</a> + </li> + <li> + <a class="variable" href="#TokenType.FILTER">FILTER</a> + </li> + <li> + <a class="variable" href="#TokenType.FINAL">FINAL</a> + </li> + <li> + <a class="variable" href="#TokenType.FIRST">FIRST</a> + </li> + <li> + <a class="variable" href="#TokenType.FOLLOWING">FOLLOWING</a> + </li> + <li> + <a class="variable" href="#TokenType.FOR">FOR</a> + </li> + <li> + <a class="variable" href="#TokenType.FOREIGN_KEY">FOREIGN_KEY</a> + </li> + <li> + <a class="variable" href="#TokenType.FORMAT">FORMAT</a> + </li> + <li> + <a class="variable" href="#TokenType.FROM">FROM</a> + </li> + <li> + <a class="variable" href="#TokenType.FULL">FULL</a> + </li> + <li> + <a class="variable" href="#TokenType.FUNCTION">FUNCTION</a> + </li> + <li> + <a class="variable" href="#TokenType.GENERATED">GENERATED</a> + </li> + <li> + <a class="variable" href="#TokenType.GLOB">GLOB</a> + </li> + <li> + <a class="variable" href="#TokenType.GLOBAL">GLOBAL</a> + </li> + <li> + <a class="variable" href="#TokenType.GROUP_BY">GROUP_BY</a> + </li> + <li> + <a class="variable" href="#TokenType.GROUPING_SETS">GROUPING_SETS</a> + </li> + <li> + <a class="variable" href="#TokenType.HAVING">HAVING</a> + </li> + <li> + <a class="variable" href="#TokenType.HINT">HINT</a> + </li> + <li> + <a class="variable" href="#TokenType.IDENTITY">IDENTITY</a> + </li> + <li> + <a class="variable" href="#TokenType.IF">IF</a> + </li> + <li> + <a class="variable" href="#TokenType.IGNORE_NULLS">IGNORE_NULLS</a> + </li> + <li> + <a class="variable" href="#TokenType.ILIKE">ILIKE</a> + </li> + <li> + <a class="variable" href="#TokenType.IN">IN</a> + </li> + <li> + <a class="variable" href="#TokenType.INDEX">INDEX</a> + </li> + <li> + <a class="variable" href="#TokenType.INNER">INNER</a> + </li> + <li> + <a class="variable" href="#TokenType.INSERT">INSERT</a> + </li> + <li> + <a class="variable" href="#TokenType.INTERSECT">INTERSECT</a> + </li> + <li> + <a class="variable" href="#TokenType.INTERVAL">INTERVAL</a> + </li> + <li> + <a class="variable" href="#TokenType.INTO">INTO</a> + </li> + <li> + <a class="variable" href="#TokenType.INTRODUCER">INTRODUCER</a> + </li> + <li> + <a class="variable" href="#TokenType.IRLIKE">IRLIKE</a> + </li> + <li> + <a class="variable" href="#TokenType.IS">IS</a> + </li> + <li> + <a class="variable" href="#TokenType.ISNULL">ISNULL</a> + </li> + <li> + <a class="variable" href="#TokenType.JOIN">JOIN</a> + </li> + <li> + <a class="variable" href="#TokenType.LANGUAGE">LANGUAGE</a> + </li> + <li> + <a class="variable" href="#TokenType.LATERAL">LATERAL</a> + </li> + <li> + <a class="variable" href="#TokenType.LAZY">LAZY</a> + </li> + <li> + <a class="variable" href="#TokenType.LEADING">LEADING</a> + </li> + <li> + <a class="variable" href="#TokenType.LEFT">LEFT</a> + </li> + <li> + <a class="variable" href="#TokenType.LIKE">LIKE</a> + </li> + <li> + <a class="variable" href="#TokenType.LIMIT">LIMIT</a> + </li> + <li> + <a class="variable" href="#TokenType.LOAD_DATA">LOAD_DATA</a> + </li> + <li> + <a class="variable" href="#TokenType.LOCAL">LOCAL</a> + </li> + <li> + <a class="variable" href="#TokenType.MAP">MAP</a> + </li> + <li> + <a class="variable" href="#TokenType.MATCH_RECOGNIZE">MATCH_RECOGNIZE</a> + </li> + <li> + <a class="variable" href="#TokenType.MATERIALIZED">MATERIALIZED</a> + </li> + <li> + <a class="variable" href="#TokenType.MERGE">MERGE</a> + </li> + <li> + <a class="variable" href="#TokenType.MOD">MOD</a> + </li> + <li> + <a class="variable" href="#TokenType.NATURAL">NATURAL</a> + </li> + <li> + <a class="variable" href="#TokenType.NEXT">NEXT</a> + </li> + <li> + <a class="variable" href="#TokenType.NO_ACTION">NO_ACTION</a> + </li> + <li> + <a class="variable" href="#TokenType.NOTNULL">NOTNULL</a> + </li> + <li> + <a class="variable" href="#TokenType.NULL">NULL</a> + </li> + <li> + <a class="variable" href="#TokenType.NULLS_FIRST">NULLS_FIRST</a> + </li> + <li> + <a class="variable" href="#TokenType.NULLS_LAST">NULLS_LAST</a> + </li> + <li> + <a class="variable" href="#TokenType.OFFSET">OFFSET</a> + </li> + <li> + <a class="variable" href="#TokenType.ON">ON</a> + </li> + <li> + <a class="variable" href="#TokenType.ONLY">ONLY</a> + </li> + <li> + <a class="variable" href="#TokenType.OPTIONS">OPTIONS</a> + </li> + <li> + <a class="variable" href="#TokenType.ORDER_BY">ORDER_BY</a> + </li> + <li> + <a class="variable" href="#TokenType.ORDERED">ORDERED</a> + </li> + <li> + <a class="variable" href="#TokenType.ORDINALITY">ORDINALITY</a> + </li> + <li> + <a class="variable" href="#TokenType.OUTER">OUTER</a> + </li> + <li> + <a class="variable" href="#TokenType.OUT_OF">OUT_OF</a> + </li> + <li> + <a class="variable" href="#TokenType.OVER">OVER</a> + </li> + <li> + <a class="variable" href="#TokenType.OVERWRITE">OVERWRITE</a> + </li> + <li> + <a class="variable" href="#TokenType.PARTITION">PARTITION</a> + </li> + <li> + <a class="variable" href="#TokenType.PARTITION_BY">PARTITION_BY</a> + </li> + <li> + <a class="variable" href="#TokenType.PERCENT">PERCENT</a> + </li> + <li> + <a class="variable" href="#TokenType.PIVOT">PIVOT</a> + </li> + <li> + <a class="variable" href="#TokenType.PLACEHOLDER">PLACEHOLDER</a> + </li> + <li> + <a class="variable" href="#TokenType.PRECEDING">PRECEDING</a> + </li> + <li> + <a class="variable" href="#TokenType.PRIMARY_KEY">PRIMARY_KEY</a> + </li> + <li> + <a class="variable" href="#TokenType.PROCEDURE">PROCEDURE</a> + </li> + <li> + <a class="variable" href="#TokenType.PROPERTIES">PROPERTIES</a> + </li> + <li> + <a class="variable" href="#TokenType.PSEUDO_TYPE">PSEUDO_TYPE</a> + </li> + <li> + <a class="variable" href="#TokenType.QUALIFY">QUALIFY</a> + </li> + <li> + <a class="variable" href="#TokenType.QUOTE">QUOTE</a> + </li> + <li> + <a class="variable" href="#TokenType.RANGE">RANGE</a> + </li> + <li> + <a class="variable" href="#TokenType.RECURSIVE">RECURSIVE</a> + </li> + <li> + <a class="variable" href="#TokenType.REPLACE">REPLACE</a> + </li> + <li> + <a class="variable" href="#TokenType.RESPECT_NULLS">RESPECT_NULLS</a> + </li> + <li> + <a class="variable" href="#TokenType.REFERENCES">REFERENCES</a> + </li> + <li> + <a class="variable" href="#TokenType.RIGHT">RIGHT</a> + </li> + <li> + <a class="variable" href="#TokenType.RLIKE">RLIKE</a> + </li> + <li> + <a class="variable" href="#TokenType.ROLLBACK">ROLLBACK</a> + </li> + <li> + <a class="variable" href="#TokenType.ROLLUP">ROLLUP</a> + </li> + <li> + <a class="variable" href="#TokenType.ROW">ROW</a> + </li> + <li> + <a class="variable" href="#TokenType.ROWS">ROWS</a> + </li> + <li> + <a class="variable" href="#TokenType.SCHEMA_COMMENT">SCHEMA_COMMENT</a> + </li> + <li> + <a class="variable" href="#TokenType.SEED">SEED</a> + </li> + <li> + <a class="variable" href="#TokenType.SELECT">SELECT</a> + </li> + <li> + <a class="variable" href="#TokenType.SEMI">SEMI</a> + </li> + <li> + <a class="variable" href="#TokenType.SEPARATOR">SEPARATOR</a> + </li> + <li> + <a class="variable" href="#TokenType.SERDE_PROPERTIES">SERDE_PROPERTIES</a> + </li> + <li> + <a class="variable" href="#TokenType.SET">SET</a> + </li> + <li> + <a class="variable" href="#TokenType.SHOW">SHOW</a> + </li> + <li> + <a class="variable" href="#TokenType.SIMILAR_TO">SIMILAR_TO</a> + </li> + <li> + <a class="variable" href="#TokenType.SOME">SOME</a> + </li> + <li> + <a class="variable" href="#TokenType.SORTKEY">SORTKEY</a> + </li> + <li> + <a class="variable" href="#TokenType.SORT_BY">SORT_BY</a> + </li> + <li> + <a class="variable" href="#TokenType.STRUCT">STRUCT</a> + </li> + <li> + <a class="variable" href="#TokenType.TABLE_SAMPLE">TABLE_SAMPLE</a> + </li> + <li> + <a class="variable" href="#TokenType.TEMPORARY">TEMPORARY</a> + </li> + <li> + <a class="variable" href="#TokenType.TOP">TOP</a> + </li> + <li> + <a class="variable" href="#TokenType.THEN">THEN</a> + </li> + <li> + <a class="variable" href="#TokenType.TRAILING">TRAILING</a> + </li> + <li> + <a class="variable" href="#TokenType.TRUE">TRUE</a> + </li> + <li> + <a class="variable" href="#TokenType.UNBOUNDED">UNBOUNDED</a> + </li> + <li> + <a class="variable" href="#TokenType.UNCACHE">UNCACHE</a> + </li> + <li> + <a class="variable" href="#TokenType.UNION">UNION</a> + </li> + <li> + <a class="variable" href="#TokenType.UNLOGGED">UNLOGGED</a> + </li> + <li> + <a class="variable" href="#TokenType.UNNEST">UNNEST</a> + </li> + <li> + <a class="variable" href="#TokenType.UNPIVOT">UNPIVOT</a> + </li> + <li> + <a class="variable" href="#TokenType.UPDATE">UPDATE</a> + </li> + <li> + <a class="variable" href="#TokenType.USE">USE</a> + </li> + <li> + <a class="variable" href="#TokenType.USING">USING</a> + </li> + <li> + <a class="variable" href="#TokenType.VALUES">VALUES</a> + </li> + <li> + <a class="variable" href="#TokenType.VIEW">VIEW</a> + </li> + <li> + <a class="variable" href="#TokenType.VOLATILE">VOLATILE</a> + </li> + <li> + <a class="variable" href="#TokenType.WHEN">WHEN</a> + </li> + <li> + <a class="variable" href="#TokenType.WHERE">WHERE</a> + </li> + <li> + <a class="variable" href="#TokenType.WINDOW">WINDOW</a> + </li> + <li> + <a class="variable" href="#TokenType.WITH">WITH</a> + </li> + <li> + <a class="variable" href="#TokenType.WITH_TIME_ZONE">WITH_TIME_ZONE</a> + </li> + <li> + <a class="variable" href="#TokenType.WITH_LOCAL_TIME_ZONE">WITH_LOCAL_TIME_ZONE</a> + </li> + <li> + <a class="variable" href="#TokenType.WITHIN_GROUP">WITHIN_GROUP</a> + </li> + <li> + <a class="variable" href="#TokenType.WITHOUT_TIME_ZONE">WITHOUT_TIME_ZONE</a> + </li> + <li> + <a class="variable" href="#TokenType.UNIQUE">UNIQUE</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Token">Token</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Token.__init__">Token</a> + </li> + <li> + <a class="function" href="#Token.number">number</a> + </li> + <li> + <a class="function" href="#Token.string">string</a> + </li> + <li> + <a class="function" href="#Token.identifier">identifier</a> + </li> + <li> + <a class="function" href="#Token.var">var</a> + </li> + </ul> + + </li> + <li> + <a class="class" href="#Tokenizer">Tokenizer</a> + <ul class="memberlist"> + <li> + <a class="function" href="#Tokenizer.__init__">Tokenizer</a> + </li> + <li> + <a class="function" href="#Tokenizer.reset">reset</a> + </li> + <li> + <a class="function" href="#Tokenizer.tokenize">tokenize</a> + </li> + </ul> + + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/tokens.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.tokens </h1> + + + <input id="mod-tokens-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-tokens-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">enum</span> <span class="kn">import</span> <span class="n">auto</span> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">AutoName</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="kn">from</span> <span class="nn">sqlglot.trie</span> <span class="kn">import</span> <span class="n">in_trie</span><span class="p">,</span> <span class="n">new_trie</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="k">class</span> <span class="nc">TokenType</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="n">L_PAREN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="n">R_PAREN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="n">L_BRACKET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="n">R_BRACKET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="n">L_BRACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="n">R_BRACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="n">COMMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">DOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="n">DASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="n">PLUS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="n">COLON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="n">DCOLON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="n">SEMICOLON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="n">STAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="n">BACKSLASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="n">SLASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="n">LT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="n">LTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">GT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">GTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="n">NOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">EQ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="n">NEQ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="n">NULLSAFE_EQ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">AND</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">OR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="n">AMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="n">DPIPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">PIPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">CARET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">TILDA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">DARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">FARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">HASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="n">HASH_ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="n">DHASH_ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="n">LR_ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">DOLLAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">PARAMETER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">SESSION_PARAMETER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">NATIONAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">BLOCK_START</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">BLOCK_END</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">SPACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">BREAK</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="n">STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="n">NUMBER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="n">IDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="n">COLUMN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">COLUMN_DEF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">SCHEMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">TABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">VAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">BIT_STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">HEX_STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">BYTE_STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="c1"># types</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="n">BOOLEAN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">TINYINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">SMALLINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">INT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">BIGINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">FLOAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">DOUBLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">DECIMAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">CHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">NCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">VARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">NVARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="n">TEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">MEDIUMTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">LONGTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">MEDIUMBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">LONGBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">BINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">VARBINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">JSON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">JSONB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="n">TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">TIMESTAMPTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="n">TIMESTAMPLTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="n">DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="n">DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos"> 100</span></a> <span class="n">UUID</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos"> 101</span></a> <span class="n">GEOGRAPHY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos"> 102</span></a> <span class="n">NULLABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-103"><a href="#L-103"><span class="linenos"> 103</span></a> <span class="n">GEOMETRY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos"> 104</span></a> <span class="n">HLLSKETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos"> 105</span></a> <span class="n">HSTORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos"> 106</span></a> <span class="n">SUPER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos"> 107</span></a> <span class="n">SERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos"> 108</span></a> <span class="n">SMALLSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos"> 109</span></a> <span class="n">BIGSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos"> 110</span></a> <span class="n">XML</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos"> 111</span></a> <span class="n">UNIQUEIDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos"> 112</span></a> <span class="n">MONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos"> 113</span></a> <span class="n">SMALLMONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos"> 114</span></a> <span class="n">ROWVERSION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-115"><a href="#L-115"><span class="linenos"> 115</span></a> <span class="n">IMAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos"> 116</span></a> <span class="n">VARIANT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos"> 117</span></a> <span class="n">OBJECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos"> 118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos"> 119</span></a> <span class="c1"># keywords</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos"> 120</span></a> <span class="n">ALIAS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos"> 121</span></a> <span class="n">ALTER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos"> 122</span></a> <span class="n">ALWAYS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos"> 123</span></a> <span class="n">ALL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos"> 124</span></a> <span class="n">ANTI</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos"> 125</span></a> <span class="n">ANY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos"> 126</span></a> <span class="n">APPLY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-127"><a href="#L-127"><span class="linenos"> 127</span></a> <span class="n">ARRAY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-128"><a href="#L-128"><span class="linenos"> 128</span></a> <span class="n">ASC</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos"> 129</span></a> <span class="n">ASOF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos"> 130</span></a> <span class="n">AT_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos"> 131</span></a> <span class="n">AUTO_INCREMENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos"> 132</span></a> <span class="n">BEGIN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos"> 133</span></a> <span class="n">BETWEEN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos"> 134</span></a> <span class="n">BOTH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos"> 135</span></a> <span class="n">BUCKET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos"> 136</span></a> <span class="n">BY_DEFAULT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos"> 137</span></a> <span class="n">CACHE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos"> 138</span></a> <span class="n">CASCADE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos"> 139</span></a> <span class="n">CASE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos"> 140</span></a> <span class="n">CHARACTER_SET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos"> 141</span></a> <span class="n">CHECK</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos"> 142</span></a> <span class="n">CLUSTER_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos"> 143</span></a> <span class="n">COLLATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos"> 144</span></a> <span class="n">COMMAND</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos"> 145</span></a> <span class="n">COMMENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos"> 146</span></a> <span class="n">COMMIT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos"> 147</span></a> <span class="n">COMPOUND</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-148"><a href="#L-148"><span class="linenos"> 148</span></a> <span class="n">CONSTRAINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos"> 149</span></a> <span class="n">CREATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos"> 150</span></a> <span class="n">CROSS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-151"><a href="#L-151"><span class="linenos"> 151</span></a> <span class="n">CUBE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos"> 152</span></a> <span class="n">CURRENT_DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-153"><a href="#L-153"><span class="linenos"> 153</span></a> <span class="n">CURRENT_DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos"> 154</span></a> <span class="n">CURRENT_ROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-155"><a href="#L-155"><span class="linenos"> 155</span></a> <span class="n">CURRENT_TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-156"><a href="#L-156"><span class="linenos"> 156</span></a> <span class="n">CURRENT_TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos"> 157</span></a> <span class="n">DEFAULT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos"> 158</span></a> <span class="n">DELETE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-159"><a href="#L-159"><span class="linenos"> 159</span></a> <span class="n">DESC</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos"> 160</span></a> <span class="n">DESCRIBE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos"> 161</span></a> <span class="n">DISTINCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos"> 162</span></a> <span class="n">DISTINCT_FROM</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos"> 163</span></a> <span class="n">DISTRIBUTE_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos"> 164</span></a> <span class="n">DIV</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos"> 165</span></a> <span class="n">DROP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos"> 166</span></a> <span class="n">ELSE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos"> 167</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos"> 168</span></a> <span class="n">END</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos"> 169</span></a> <span class="n">ESCAPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos"> 170</span></a> <span class="n">EXCEPT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos"> 171</span></a> <span class="n">EXECUTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos"> 172</span></a> <span class="n">EXISTS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos"> 173</span></a> <span class="n">FALSE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos"> 174</span></a> <span class="n">FETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos"> 175</span></a> <span class="n">FILTER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos"> 176</span></a> <span class="n">FINAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-177"><a href="#L-177"><span class="linenos"> 177</span></a> <span class="n">FIRST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos"> 178</span></a> <span class="n">FOLLOWING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos"> 179</span></a> <span class="n">FOR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos"> 180</span></a> <span class="n">FOREIGN_KEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos"> 181</span></a> <span class="n">FORMAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos"> 182</span></a> <span class="n">FROM</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos"> 183</span></a> <span class="n">FULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos"> 184</span></a> <span class="n">FUNCTION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos"> 185</span></a> <span class="n">GENERATED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos"> 186</span></a> <span class="n">GLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos"> 187</span></a> <span class="n">GLOBAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos"> 188</span></a> <span class="n">GROUP_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos"> 189</span></a> <span class="n">GROUPING_SETS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos"> 190</span></a> <span class="n">HAVING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos"> 191</span></a> <span class="n">HINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos"> 192</span></a> <span class="n">IDENTITY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-193"><a href="#L-193"><span class="linenos"> 193</span></a> <span class="n">IF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos"> 194</span></a> <span class="n">IGNORE_NULLS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos"> 195</span></a> <span class="n">ILIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-196"><a href="#L-196"><span class="linenos"> 196</span></a> <span class="n">IN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos"> 197</span></a> <span class="n">INDEX</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos"> 198</span></a> <span class="n">INNER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-199"><a href="#L-199"><span class="linenos"> 199</span></a> <span class="n">INSERT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos"> 200</span></a> <span class="n">INTERSECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos"> 201</span></a> <span class="n">INTERVAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-202"><a href="#L-202"><span class="linenos"> 202</span></a> <span class="n">INTO</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos"> 203</span></a> <span class="n">INTRODUCER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos"> 204</span></a> <span class="n">IRLIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos"> 205</span></a> <span class="n">IS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-206"><a href="#L-206"><span class="linenos"> 206</span></a> <span class="n">ISNULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos"> 207</span></a> <span class="n">JOIN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos"> 208</span></a> <span class="n">LANGUAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos"> 209</span></a> <span class="n">LATERAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos"> 210</span></a> <span class="n">LAZY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos"> 211</span></a> <span class="n">LEADING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos"> 212</span></a> <span class="n">LEFT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos"> 213</span></a> <span class="n">LIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos"> 214</span></a> <span class="n">LIMIT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos"> 215</span></a> <span class="n">LOAD_DATA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos"> 216</span></a> <span class="n">LOCAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos"> 217</span></a> <span class="n">MAP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos"> 218</span></a> <span class="n">MATCH_RECOGNIZE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos"> 219</span></a> <span class="n">MATERIALIZED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos"> 220</span></a> <span class="n">MERGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos"> 221</span></a> <span class="n">MOD</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos"> 222</span></a> <span class="n">NATURAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos"> 223</span></a> <span class="n">NEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos"> 224</span></a> <span class="n">NO_ACTION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos"> 225</span></a> <span class="n">NOTNULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos"> 226</span></a> <span class="n">NULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos"> 227</span></a> <span class="n">NULLS_FIRST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos"> 228</span></a> <span class="n">NULLS_LAST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos"> 229</span></a> <span class="n">OFFSET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos"> 230</span></a> <span class="n">ON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos"> 231</span></a> <span class="n">ONLY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos"> 232</span></a> <span class="n">OPTIONS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos"> 233</span></a> <span class="n">ORDER_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos"> 234</span></a> <span class="n">ORDERED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos"> 235</span></a> <span class="n">ORDINALITY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos"> 236</span></a> <span class="n">OUTER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos"> 237</span></a> <span class="n">OUT_OF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos"> 238</span></a> <span class="n">OVER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos"> 239</span></a> <span class="n">OVERWRITE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos"> 240</span></a> <span class="n">PARTITION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos"> 241</span></a> <span class="n">PARTITION_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos"> 242</span></a> <span class="n">PERCENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos"> 243</span></a> <span class="n">PIVOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos"> 244</span></a> <span class="n">PLACEHOLDER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos"> 245</span></a> <span class="n">PRECEDING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos"> 246</span></a> <span class="n">PRIMARY_KEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos"> 247</span></a> <span class="n">PROCEDURE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos"> 248</span></a> <span class="n">PROPERTIES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos"> 249</span></a> <span class="n">PSEUDO_TYPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos"> 250</span></a> <span class="n">QUALIFY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos"> 251</span></a> <span class="n">QUOTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos"> 252</span></a> <span class="n">RANGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos"> 253</span></a> <span class="n">RECURSIVE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos"> 254</span></a> <span class="n">REPLACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos"> 255</span></a> <span class="n">RESPECT_NULLS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos"> 256</span></a> <span class="n">REFERENCES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos"> 257</span></a> <span class="n">RIGHT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos"> 258</span></a> <span class="n">RLIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos"> 259</span></a> <span class="n">ROLLBACK</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos"> 260</span></a> <span class="n">ROLLUP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos"> 261</span></a> <span class="n">ROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos"> 262</span></a> <span class="n">ROWS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos"> 263</span></a> <span class="n">SCHEMA_COMMENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos"> 264</span></a> <span class="n">SEED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos"> 265</span></a> <span class="n">SELECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos"> 266</span></a> <span class="n">SEMI</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos"> 267</span></a> <span class="n">SEPARATOR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos"> 268</span></a> <span class="n">SERDE_PROPERTIES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos"> 269</span></a> <span class="n">SET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos"> 270</span></a> <span class="n">SHOW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos"> 271</span></a> <span class="n">SIMILAR_TO</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos"> 272</span></a> <span class="n">SOME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos"> 273</span></a> <span class="n">SORTKEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos"> 274</span></a> <span class="n">SORT_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos"> 275</span></a> <span class="n">STRUCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos"> 276</span></a> <span class="n">TABLE_SAMPLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos"> 277</span></a> <span class="n">TEMPORARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos"> 278</span></a> <span class="n">TOP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos"> 279</span></a> <span class="n">THEN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos"> 280</span></a> <span class="n">TRAILING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos"> 281</span></a> <span class="n">TRUE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos"> 282</span></a> <span class="n">UNBOUNDED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos"> 283</span></a> <span class="n">UNCACHE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos"> 284</span></a> <span class="n">UNION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos"> 285</span></a> <span class="n">UNLOGGED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos"> 286</span></a> <span class="n">UNNEST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos"> 287</span></a> <span class="n">UNPIVOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos"> 288</span></a> <span class="n">UPDATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos"> 289</span></a> <span class="n">USE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos"> 290</span></a> <span class="n">USING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos"> 291</span></a> <span class="n">VALUES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos"> 292</span></a> <span class="n">VIEW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos"> 293</span></a> <span class="n">VOLATILE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos"> 294</span></a> <span class="n">WHEN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos"> 295</span></a> <span class="n">WHERE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos"> 296</span></a> <span class="n">WINDOW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos"> 297</span></a> <span class="n">WITH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos"> 298</span></a> <span class="n">WITH_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos"> 299</span></a> <span class="n">WITH_LOCAL_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos"> 300</span></a> <span class="n">WITHIN_GROUP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos"> 301</span></a> <span class="n">WITHOUT_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos"> 302</span></a> <span class="n">UNIQUE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos"> 303</span></a> +</span><span id="L-304"><a href="#L-304"><span class="linenos"> 304</span></a> +</span><span id="L-305"><a href="#L-305"><span class="linenos"> 305</span></a><span class="k">class</span> <span class="nc">Token</span><span class="p">:</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos"> 306</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"token_type"</span><span class="p">,</span> <span class="s2">"text"</span><span class="p">,</span> <span class="s2">"line"</span><span class="p">,</span> <span class="s2">"col"</span><span class="p">,</span> <span class="s2">"comments"</span><span class="p">)</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos"> 307</span></a> +</span><span id="L-308"><a href="#L-308"><span class="linenos"> 308</span></a> <span class="nd">@classmethod</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos"> 309</span></a> <span class="k">def</span> <span class="nf">number</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">number</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos"> 310</span></a><span class="w"> </span><span class="sd">"""Returns a NUMBER token with `number` as its text."""</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos"> 311</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">number</span><span class="p">))</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos"> 312</span></a> +</span><span id="L-313"><a href="#L-313"><span class="linenos"> 313</span></a> <span class="nd">@classmethod</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos"> 314</span></a> <span class="k">def</span> <span class="nf">string</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">string</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos"> 315</span></a><span class="w"> </span><span class="sd">"""Returns a STRING token with `string` as its text."""</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos"> 316</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">string</span><span class="p">)</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos"> 317</span></a> +</span><span id="L-318"><a href="#L-318"><span class="linenos"> 318</span></a> <span class="nd">@classmethod</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos"> 319</span></a> <span class="k">def</span> <span class="nf">identifier</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">identifier</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos"> 320</span></a><span class="w"> </span><span class="sd">"""Returns an IDENTIFIER token with `identifier` as its text."""</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos"> 321</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> <span class="n">identifier</span><span class="p">)</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos"> 322</span></a> +</span><span id="L-323"><a href="#L-323"><span class="linenos"> 323</span></a> <span class="nd">@classmethod</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos"> 324</span></a> <span class="k">def</span> <span class="nf">var</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">var</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos"> 325</span></a><span class="w"> </span><span class="sd">"""Returns an VAR token with `var` as its text."""</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos"> 326</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> <span class="n">var</span><span class="p">)</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos"> 327</span></a> +</span><span id="L-328"><a href="#L-328"><span class="linenos"> 328</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos"> 329</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos"> 330</span></a> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos"> 331</span></a> <span class="n">text</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos"> 332</span></a> <span class="n">line</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos"> 333</span></a> <span class="n">col</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos"> 334</span></a> <span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos"> 335</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos"> 336</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">token_type</span> <span class="o">=</span> <span class="n">token_type</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos"> 337</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="n">text</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos"> 338</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">line</span> <span class="o">=</span> <span class="n">line</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos"> 339</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">col</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">col</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">),</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos"> 340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos"> 341</span></a> +</span><span id="L-342"><a href="#L-342"><span class="linenos"> 342</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos"> 343</span></a> <span class="n">attributes</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">k</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__slots__</span><span class="p">)</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos"> 344</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"<Token </span><span class="si">{</span><span class="n">attributes</span><span class="si">}</span><span class="s2">>"</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos"> 345</span></a> +</span><span id="L-346"><a href="#L-346"><span class="linenos"> 346</span></a> +</span><span id="L-347"><a href="#L-347"><span class="linenos"> 347</span></a><span class="k">class</span> <span class="nc">_Tokenizer</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos"> 348</span></a> <span class="k">def</span> <span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">):</span> <span class="c1"># type: ignore</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos"> 349</span></a> <span class="n">klass</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__new__</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">clsname</span><span class="p">,</span> <span class="n">bases</span><span class="p">,</span> <span class="n">attrs</span><span class="p">)</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos"> 350</span></a> +</span><span id="L-351"><a href="#L-351"><span class="linenos"> 351</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_QUOTES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos"> 352</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">s</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">e</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos"> 353</span></a> <span class="k">for</span> <span class="n">s</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_delimeter_list_to_dict</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">QUOTES</span><span class="p">)</span><span class="o">.</span><span class="n">items</span><span class="p">()</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos"> 354</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">((</span><span class="s2">""</span><span class="p">,)</span> <span class="k">if</span> <span class="n">s</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">isalpha</span><span class="p">()</span> <span class="k">else</span> <span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"n"</span><span class="p">,</span> <span class="s2">"N"</span><span class="p">))</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos"> 355</span></a> <span class="p">}</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos"> 356</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_BIT_STRINGS</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_delimeter_list_to_dict</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">BIT_STRINGS</span><span class="p">)</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos"> 357</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_HEX_STRINGS</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_delimeter_list_to_dict</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">HEX_STRINGS</span><span class="p">)</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos"> 358</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_delimeter_list_to_dict</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">BYTE_STRINGS</span><span class="p">)</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos"> 359</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_IDENTIFIERS</span> <span class="o">=</span> <span class="bp">cls</span><span class="o">.</span><span class="n">_delimeter_list_to_dict</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">IDENTIFIERS</span><span class="p">)</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos"> 360</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">STRING_ESCAPES</span><span class="p">)</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos"> 361</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_IDENTIFIER_ESCAPES</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">klass</span><span class="o">.</span><span class="n">IDENTIFIER_ESCAPES</span><span class="p">)</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos"> 362</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">_COMMENTS</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos"> 363</span></a> <span class="p">(</span><span class="n">comment</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">comment</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="p">(</span><span class="n">comment</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">comment</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos"> 364</span></a> <span class="k">for</span> <span class="n">comment</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">COMMENTS</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos"> 365</span></a> <span class="p">)</span> +</span><span id="L-366"><a href="#L-366"><span class="linenos"> 366</span></a> +</span><span id="L-367"><a href="#L-367"><span class="linenos"> 367</span></a> <span class="n">klass</span><span class="o">.</span><span class="n">KEYWORD_TRIE</span> <span class="o">=</span> <span class="n">new_trie</span><span class="p">(</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos"> 368</span></a> <span class="n">key</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos"> 369</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">{</span> +</span><span id="L-370"><a href="#L-370"><span class="linenos"> 370</span></a> <span class="o">**</span><span class="n">klass</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos"> 371</span></a> <span class="o">**</span><span class="p">{</span><span class="n">comment</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMENT</span> <span class="k">for</span> <span class="n">comment</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">_COMMENTS</span><span class="p">},</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos"> 372</span></a> <span class="o">**</span><span class="p">{</span><span class="n">quote</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">QUOTE</span> <span class="k">for</span> <span class="n">quote</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">_QUOTES</span><span class="p">},</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos"> 373</span></a> <span class="o">**</span><span class="p">{</span><span class="n">bit_string</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span> <span class="k">for</span> <span class="n">bit_string</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">_BIT_STRINGS</span><span class="p">},</span> +</span><span id="L-374"><a href="#L-374"><span class="linenos"> 374</span></a> <span class="o">**</span><span class="p">{</span><span class="n">hex_string</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span> <span class="k">for</span> <span class="n">hex_string</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">_HEX_STRINGS</span><span class="p">},</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos"> 375</span></a> <span class="o">**</span><span class="p">{</span><span class="n">byte_string</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BYTE_STRING</span> <span class="k">for</span> <span class="n">byte_string</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span><span class="p">},</span> +</span><span id="L-376"><a href="#L-376"><span class="linenos"> 376</span></a> <span class="p">}</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos"> 377</span></a> <span class="k">if</span> <span class="s2">" "</span> <span class="ow">in</span> <span class="n">key</span> <span class="ow">or</span> <span class="nb">any</span><span class="p">(</span><span class="n">single</span> <span class="ow">in</span> <span class="n">key</span> <span class="k">for</span> <span class="n">single</span> <span class="ow">in</span> <span class="n">klass</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">)</span> +</span><span id="L-378"><a href="#L-378"><span class="linenos"> 378</span></a> <span class="p">)</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos"> 379</span></a> +</span><span id="L-380"><a href="#L-380"><span class="linenos"> 380</span></a> <span class="k">return</span> <span class="n">klass</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos"> 381</span></a> +</span><span id="L-382"><a href="#L-382"><span class="linenos"> 382</span></a> <span class="nd">@staticmethod</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos"> 383</span></a> <span class="k">def</span> <span class="nf">_delimeter_list_to_dict</span><span class="p">(</span><span class="nb">list</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos"> 384</span></a> <span class="k">return</span> <span class="nb">dict</span><span class="p">((</span><span class="n">item</span><span class="p">,</span> <span class="n">item</span><span class="p">)</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="k">else</span> <span class="p">(</span><span class="n">item</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">item</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">list</span><span class="p">)</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos"> 385</span></a> +</span><span id="L-386"><a href="#L-386"><span class="linenos"> 386</span></a> +</span><span id="L-387"><a href="#L-387"><span class="linenos"> 387</span></a><span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Tokenizer</span><span class="p">):</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos"> 388</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-389"><a href="#L-389"><span class="linenos"> 389</span></a> <span class="s2">"("</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> +</span><span id="L-390"><a href="#L-390"><span class="linenos"> 390</span></a> <span class="s2">")"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">,</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos"> 391</span></a> <span class="s2">"["</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos"> 392</span></a> <span class="s2">"]"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">,</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos"> 393</span></a> <span class="s2">"{"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">,</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos"> 394</span></a> <span class="s2">"}"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACE</span><span class="p">,</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos"> 395</span></a> <span class="s2">"&"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AMP</span><span class="p">,</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos"> 396</span></a> <span class="s2">"^"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">,</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos"> 397</span></a> <span class="s2">":"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">,</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos"> 398</span></a> <span class="s2">","</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">,</span> +</span><span id="L-399"><a href="#L-399"><span class="linenos"> 399</span></a> <span class="s2">"."</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">,</span> +</span><span id="L-400"><a href="#L-400"><span class="linenos"> 400</span></a> <span class="s2">"-"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DASH</span><span class="p">,</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos"> 401</span></a> <span class="s2">"="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos"> 402</span></a> <span class="s2">">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> +</span><span id="L-403"><a href="#L-403"><span class="linenos"> 403</span></a> <span class="s2">"<"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> +</span><span id="L-404"><a href="#L-404"><span class="linenos"> 404</span></a> <span class="s2">"%"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span> +</span><span id="L-405"><a href="#L-405"><span class="linenos"> 405</span></a> <span class="s2">"!"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">,</span> +</span><span id="L-406"><a href="#L-406"><span class="linenos"> 406</span></a> <span class="s2">"|"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIPE</span><span class="p">,</span> +</span><span id="L-407"><a href="#L-407"><span class="linenos"> 407</span></a> <span class="s2">"+"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLUS</span><span class="p">,</span> +</span><span id="L-408"><a href="#L-408"><span class="linenos"> 408</span></a> <span class="s2">";"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMICOLON</span><span class="p">,</span> +</span><span id="L-409"><a href="#L-409"><span class="linenos"> 409</span></a> <span class="s2">"/"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SLASH</span><span class="p">,</span> +</span><span id="L-410"><a href="#L-410"><span class="linenos"> 410</span></a> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BACKSLASH</span><span class="p">,</span> +</span><span id="L-411"><a href="#L-411"><span class="linenos"> 411</span></a> <span class="s2">"*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">,</span> +</span><span id="L-412"><a href="#L-412"><span class="linenos"> 412</span></a> <span class="s2">"~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TILDA</span><span class="p">,</span> +</span><span id="L-413"><a href="#L-413"><span class="linenos"> 413</span></a> <span class="s2">"?"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLACEHOLDER</span><span class="p">,</span> +</span><span id="L-414"><a href="#L-414"><span class="linenos"> 414</span></a> <span class="s2">"@"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="L-415"><a href="#L-415"><span class="linenos"> 415</span></a> <span class="c1"># used for breaking a var like x'y' but nothing else</span> +</span><span id="L-416"><a href="#L-416"><span class="linenos"> 416</span></a> <span class="c1"># the token type doesn't matter</span> +</span><span id="L-417"><a href="#L-417"><span class="linenos"> 417</span></a> <span class="s2">"'"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">QUOTE</span><span class="p">,</span> +</span><span id="L-418"><a href="#L-418"><span class="linenos"> 418</span></a> <span class="s2">"`"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> +</span><span id="L-419"><a href="#L-419"><span class="linenos"> 419</span></a> <span class="s1">'"'</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> +</span><span id="L-420"><a href="#L-420"><span class="linenos"> 420</span></a> <span class="s2">"#"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH</span><span class="p">,</span> +</span><span id="L-421"><a href="#L-421"><span class="linenos"> 421</span></a> <span class="p">}</span> +</span><span id="L-422"><a href="#L-422"><span class="linenos"> 422</span></a> +</span><span id="L-423"><a href="#L-423"><span class="linenos"> 423</span></a> <span class="n">QUOTES</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="L-424"><a href="#L-424"><span class="linenos"> 424</span></a> +</span><span id="L-425"><a href="#L-425"><span class="linenos"> 425</span></a> <span class="n">BIT_STRINGS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-426"><a href="#L-426"><span class="linenos"> 426</span></a> +</span><span id="L-427"><a href="#L-427"><span class="linenos"> 427</span></a> <span class="n">HEX_STRINGS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-428"><a href="#L-428"><span class="linenos"> 428</span></a> +</span><span id="L-429"><a href="#L-429"><span class="linenos"> 429</span></a> <span class="n">BYTE_STRINGS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-430"><a href="#L-430"><span class="linenos"> 430</span></a> +</span><span id="L-431"><a href="#L-431"><span class="linenos"> 431</span></a> <span class="n">IDENTIFIERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">]</span> +</span><span id="L-432"><a href="#L-432"><span class="linenos"> 432</span></a> +</span><span id="L-433"><a href="#L-433"><span class="linenos"> 433</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="L-434"><a href="#L-434"><span class="linenos"> 434</span></a> +</span><span id="L-435"><a href="#L-435"><span class="linenos"> 435</span></a> <span class="n">_STRING_ESCAPES</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-436"><a href="#L-436"><span class="linenos"> 436</span></a> +</span><span id="L-437"><a href="#L-437"><span class="linenos"> 437</span></a> <span class="n">IDENTIFIER_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">]</span> +</span><span id="L-438"><a href="#L-438"><span class="linenos"> 438</span></a> +</span><span id="L-439"><a href="#L-439"><span class="linenos"> 439</span></a> <span class="n">_IDENTIFIER_ESCAPES</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="L-440"><a href="#L-440"><span class="linenos"> 440</span></a> +</span><span id="L-441"><a href="#L-441"><span class="linenos"> 441</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-442"><a href="#L-442"><span class="linenos"> 442</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-443"><a href="#L-443"><span class="linenos"> 443</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">key</span><span class="si">}{</span><span class="n">postfix</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_START</span> +</span><span id="L-444"><a href="#L-444"><span class="linenos"> 444</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"{{"</span><span class="p">,</span> <span class="s2">"{%"</span><span class="p">,</span> <span class="s2">"{#"</span><span class="p">)</span> +</span><span id="L-445"><a href="#L-445"><span class="linenos"> 445</span></a> <span class="k">for</span> <span class="n">postfix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span><span id="L-446"><a href="#L-446"><span class="linenos"> 446</span></a> <span class="p">},</span> +</span><span id="L-447"><a href="#L-447"><span class="linenos"> 447</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-448"><a href="#L-448"><span class="linenos"> 448</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_END</span> +</span><span id="L-449"><a href="#L-449"><span class="linenos"> 449</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"%}"</span><span class="p">,</span> <span class="s2">"#}"</span><span class="p">)</span> +</span><span id="L-450"><a href="#L-450"><span class="linenos"> 450</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span><span id="L-451"><a href="#L-451"><span class="linenos"> 451</span></a> <span class="p">},</span> +</span><span id="L-452"><a href="#L-452"><span class="linenos"> 452</span></a> <span class="s2">"+}}"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_END</span><span class="p">,</span> +</span><span id="L-453"><a href="#L-453"><span class="linenos"> 453</span></a> <span class="s2">"-}}"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_END</span><span class="p">,</span> +</span><span id="L-454"><a href="#L-454"><span class="linenos"> 454</span></a> <span class="s2">"/*+"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HINT</span><span class="p">,</span> +</span><span id="L-455"><a href="#L-455"><span class="linenos"> 455</span></a> <span class="s2">"=="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="L-456"><a href="#L-456"><span class="linenos"> 456</span></a> <span class="s2">"::"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">,</span> +</span><span id="L-457"><a href="#L-457"><span class="linenos"> 457</span></a> <span class="s2">"||"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DPIPE</span><span class="p">,</span> +</span><span id="L-458"><a href="#L-458"><span class="linenos"> 458</span></a> <span class="s2">">="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span> +</span><span id="L-459"><a href="#L-459"><span class="linenos"> 459</span></a> <span class="s2">"<="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span> +</span><span id="L-460"><a href="#L-460"><span class="linenos"> 460</span></a> <span class="s2">"<>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="L-461"><a href="#L-461"><span class="linenos"> 461</span></a> <span class="s2">"!="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="L-462"><a href="#L-462"><span class="linenos"> 462</span></a> <span class="s2">"<=>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLSAFE_EQ</span><span class="p">,</span> +</span><span id="L-463"><a href="#L-463"><span class="linenos"> 463</span></a> <span class="s2">"->"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARROW</span><span class="p">,</span> +</span><span id="L-464"><a href="#L-464"><span class="linenos"> 464</span></a> <span class="s2">"->>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DARROW</span><span class="p">,</span> +</span><span id="L-465"><a href="#L-465"><span class="linenos"> 465</span></a> <span class="s2">"=>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FARROW</span><span class="p">,</span> +</span><span id="L-466"><a href="#L-466"><span class="linenos"> 466</span></a> <span class="s2">"#>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH_ARROW</span><span class="p">,</span> +</span><span id="L-467"><a href="#L-467"><span class="linenos"> 467</span></a> <span class="s2">"#>>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DHASH_ARROW</span><span class="p">,</span> +</span><span id="L-468"><a href="#L-468"><span class="linenos"> 468</span></a> <span class="s2">"<->"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LR_ARROW</span><span class="p">,</span> +</span><span id="L-469"><a href="#L-469"><span class="linenos"> 469</span></a> <span class="s2">"ALL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> +</span><span id="L-470"><a href="#L-470"><span class="linenos"> 470</span></a> <span class="s2">"ALWAYS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">,</span> +</span><span id="L-471"><a href="#L-471"><span class="linenos"> 471</span></a> <span class="s2">"AND"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">,</span> +</span><span id="L-472"><a href="#L-472"><span class="linenos"> 472</span></a> <span class="s2">"ANTI"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANTI</span><span class="p">,</span> +</span><span id="L-473"><a href="#L-473"><span class="linenos"> 473</span></a> <span class="s2">"ANY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">,</span> +</span><span id="L-474"><a href="#L-474"><span class="linenos"> 474</span></a> <span class="s2">"ASC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASC</span><span class="p">,</span> +</span><span id="L-475"><a href="#L-475"><span class="linenos"> 475</span></a> <span class="s2">"AS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> +</span><span id="L-476"><a href="#L-476"><span class="linenos"> 476</span></a> <span class="s2">"AT TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AT_TIME_ZONE</span><span class="p">,</span> +</span><span id="L-477"><a href="#L-477"><span class="linenos"> 477</span></a> <span class="s2">"AUTOINCREMENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> +</span><span id="L-478"><a href="#L-478"><span class="linenos"> 478</span></a> <span class="s2">"AUTO_INCREMENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> +</span><span id="L-479"><a href="#L-479"><span class="linenos"> 479</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="L-480"><a href="#L-480"><span class="linenos"> 480</span></a> <span class="s2">"BETWEEN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">,</span> +</span><span id="L-481"><a href="#L-481"><span class="linenos"> 481</span></a> <span class="s2">"BOTH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOTH</span><span class="p">,</span> +</span><span id="L-482"><a href="#L-482"><span class="linenos"> 482</span></a> <span class="s2">"BUCKET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BUCKET</span><span class="p">,</span> +</span><span id="L-483"><a href="#L-483"><span class="linenos"> 483</span></a> <span class="s2">"BY DEFAULT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BY_DEFAULT</span><span class="p">,</span> +</span><span id="L-484"><a href="#L-484"><span class="linenos"> 484</span></a> <span class="s2">"CACHE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CACHE</span><span class="p">,</span> +</span><span id="L-485"><a href="#L-485"><span class="linenos"> 485</span></a> <span class="s2">"UNCACHE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNCACHE</span><span class="p">,</span> +</span><span id="L-486"><a href="#L-486"><span class="linenos"> 486</span></a> <span class="s2">"CASE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASE</span><span class="p">,</span> +</span><span id="L-487"><a href="#L-487"><span class="linenos"> 487</span></a> <span class="s2">"CASCADE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">,</span> +</span><span id="L-488"><a href="#L-488"><span class="linenos"> 488</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHARACTER_SET</span><span class="p">,</span> +</span><span id="L-489"><a href="#L-489"><span class="linenos"> 489</span></a> <span class="s2">"CHECK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">,</span> +</span><span id="L-490"><a href="#L-490"><span class="linenos"> 490</span></a> <span class="s2">"CLUSTER BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CLUSTER_BY</span><span class="p">,</span> +</span><span id="L-491"><a href="#L-491"><span class="linenos"> 491</span></a> <span class="s2">"COLLATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">,</span> +</span><span id="L-492"><a href="#L-492"><span class="linenos"> 492</span></a> <span class="s2">"COLUMN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">,</span> +</span><span id="L-493"><a href="#L-493"><span class="linenos"> 493</span></a> <span class="s2">"COMMENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA_COMMENT</span><span class="p">,</span> +</span><span id="L-494"><a href="#L-494"><span class="linenos"> 494</span></a> <span class="s2">"COMMIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMIT</span><span class="p">,</span> +</span><span id="L-495"><a href="#L-495"><span class="linenos"> 495</span></a> <span class="s2">"COMPOUND"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMPOUND</span><span class="p">,</span> +</span><span id="L-496"><a href="#L-496"><span class="linenos"> 496</span></a> <span class="s2">"CONSTRAINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">,</span> +</span><span id="L-497"><a href="#L-497"><span class="linenos"> 497</span></a> <span class="s2">"CREATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CREATE</span><span class="p">,</span> +</span><span id="L-498"><a href="#L-498"><span class="linenos"> 498</span></a> <span class="s2">"CROSS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CROSS</span><span class="p">,</span> +</span><span id="L-499"><a href="#L-499"><span class="linenos"> 499</span></a> <span class="s2">"CUBE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CUBE</span><span class="p">,</span> +</span><span id="L-500"><a href="#L-500"><span class="linenos"> 500</span></a> <span class="s2">"CURRENT_DATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATE</span><span class="p">,</span> +</span><span id="L-501"><a href="#L-501"><span class="linenos"> 501</span></a> <span class="s2">"CURRENT ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_ROW</span><span class="p">,</span> +</span><span id="L-502"><a href="#L-502"><span class="linenos"> 502</span></a> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIMESTAMP</span><span class="p">,</span> +</span><span id="L-503"><a href="#L-503"><span class="linenos"> 503</span></a> <span class="s2">"DEFAULT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">,</span> +</span><span id="L-504"><a href="#L-504"><span class="linenos"> 504</span></a> <span class="s2">"DELETE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> +</span><span id="L-505"><a href="#L-505"><span class="linenos"> 505</span></a> <span class="s2">"DESC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">,</span> +</span><span id="L-506"><a href="#L-506"><span class="linenos"> 506</span></a> <span class="s2">"DESCRIBE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESCRIBE</span><span class="p">,</span> +</span><span id="L-507"><a href="#L-507"><span class="linenos"> 507</span></a> <span class="s2">"DISTINCT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">,</span> +</span><span id="L-508"><a href="#L-508"><span class="linenos"> 508</span></a> <span class="s2">"DISTINCT FROM"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT_FROM</span><span class="p">,</span> +</span><span id="L-509"><a href="#L-509"><span class="linenos"> 509</span></a> <span class="s2">"DISTRIBUTE BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DISTRIBUTE_BY</span><span class="p">,</span> +</span><span id="L-510"><a href="#L-510"><span class="linenos"> 510</span></a> <span class="s2">"DIV"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DIV</span><span class="p">,</span> +</span><span id="L-511"><a href="#L-511"><span class="linenos"> 511</span></a> <span class="s2">"DROP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">,</span> +</span><span id="L-512"><a href="#L-512"><span class="linenos"> 512</span></a> <span class="s2">"ELSE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ELSE</span><span class="p">,</span> +</span><span id="L-513"><a href="#L-513"><span class="linenos"> 513</span></a> <span class="s2">"END"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">,</span> +</span><span id="L-514"><a href="#L-514"><span class="linenos"> 514</span></a> <span class="s2">"ESCAPE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ESCAPE</span><span class="p">,</span> +</span><span id="L-515"><a href="#L-515"><span class="linenos"> 515</span></a> <span class="s2">"EXCEPT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="L-516"><a href="#L-516"><span class="linenos"> 516</span></a> <span class="s2">"EXECUTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXECUTE</span><span class="p">,</span> +</span><span id="L-517"><a href="#L-517"><span class="linenos"> 517</span></a> <span class="s2">"EXISTS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXISTS</span><span class="p">,</span> +</span><span id="L-518"><a href="#L-518"><span class="linenos"> 518</span></a> <span class="s2">"FALSE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">,</span> +</span><span id="L-519"><a href="#L-519"><span class="linenos"> 519</span></a> <span class="s2">"FETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FETCH</span><span class="p">,</span> +</span><span id="L-520"><a href="#L-520"><span class="linenos"> 520</span></a> <span class="s2">"FILTER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">,</span> +</span><span id="L-521"><a href="#L-521"><span class="linenos"> 521</span></a> <span class="s2">"FIRST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> +</span><span id="L-522"><a href="#L-522"><span class="linenos"> 522</span></a> <span class="s2">"FULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FULL</span><span class="p">,</span> +</span><span id="L-523"><a href="#L-523"><span class="linenos"> 523</span></a> <span class="s2">"FUNCTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> +</span><span id="L-524"><a href="#L-524"><span class="linenos"> 524</span></a> <span class="s2">"FOLLOWING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOLLOWING</span><span class="p">,</span> +</span><span id="L-525"><a href="#L-525"><span class="linenos"> 525</span></a> <span class="s2">"FOR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOR</span><span class="p">,</span> +</span><span id="L-526"><a href="#L-526"><span class="linenos"> 526</span></a> <span class="s2">"FOREIGN KEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">,</span> +</span><span id="L-527"><a href="#L-527"><span class="linenos"> 527</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">,</span> +</span><span id="L-528"><a href="#L-528"><span class="linenos"> 528</span></a> <span class="s2">"FROM"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> +</span><span id="L-529"><a href="#L-529"><span class="linenos"> 529</span></a> <span class="s2">"GENERATED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GENERATED</span><span class="p">,</span> +</span><span id="L-530"><a href="#L-530"><span class="linenos"> 530</span></a> <span class="s2">"GLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOB</span><span class="p">,</span> +</span><span id="L-531"><a href="#L-531"><span class="linenos"> 531</span></a> <span class="s2">"GROUP BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GROUP_BY</span><span class="p">,</span> +</span><span id="L-532"><a href="#L-532"><span class="linenos"> 532</span></a> <span class="s2">"GROUPING SETS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GROUPING_SETS</span><span class="p">,</span> +</span><span id="L-533"><a href="#L-533"><span class="linenos"> 533</span></a> <span class="s2">"HAVING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HAVING</span><span class="p">,</span> +</span><span id="L-534"><a href="#L-534"><span class="linenos"> 534</span></a> <span class="s2">"IDENTITY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">,</span> +</span><span id="L-535"><a href="#L-535"><span class="linenos"> 535</span></a> <span class="s2">"IF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">,</span> +</span><span id="L-536"><a href="#L-536"><span class="linenos"> 536</span></a> <span class="s2">"ILIKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="L-537"><a href="#L-537"><span class="linenos"> 537</span></a> <span class="s2">"IGNORE NULLS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IGNORE_NULLS</span><span class="p">,</span> +</span><span id="L-538"><a href="#L-538"><span class="linenos"> 538</span></a> <span class="s2">"IN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">,</span> +</span><span id="L-539"><a href="#L-539"><span class="linenos"> 539</span></a> <span class="s2">"INDEX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="L-540"><a href="#L-540"><span class="linenos"> 540</span></a> <span class="s2">"INNER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INNER</span><span class="p">,</span> +</span><span id="L-541"><a href="#L-541"><span class="linenos"> 541</span></a> <span class="s2">"INSERT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span> +</span><span id="L-542"><a href="#L-542"><span class="linenos"> 542</span></a> <span class="s2">"INTERVAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">,</span> +</span><span id="L-543"><a href="#L-543"><span class="linenos"> 543</span></a> <span class="s2">"INTERSECT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERSECT</span><span class="p">,</span> +</span><span id="L-544"><a href="#L-544"><span class="linenos"> 544</span></a> <span class="s2">"INTO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">,</span> +</span><span id="L-545"><a href="#L-545"><span class="linenos"> 545</span></a> <span class="s2">"IS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IS</span><span class="p">,</span> +</span><span id="L-546"><a href="#L-546"><span class="linenos"> 546</span></a> <span class="s2">"ISNULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">,</span> +</span><span id="L-547"><a href="#L-547"><span class="linenos"> 547</span></a> <span class="s2">"JOIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JOIN</span><span class="p">,</span> +</span><span id="L-548"><a href="#L-548"><span class="linenos"> 548</span></a> <span class="s2">"LATERAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LATERAL</span><span class="p">,</span> +</span><span id="L-549"><a href="#L-549"><span class="linenos"> 549</span></a> <span class="s2">"LAZY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LAZY</span><span class="p">,</span> +</span><span id="L-550"><a href="#L-550"><span class="linenos"> 550</span></a> <span class="s2">"LEADING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEADING</span><span class="p">,</span> +</span><span id="L-551"><a href="#L-551"><span class="linenos"> 551</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="L-552"><a href="#L-552"><span class="linenos"> 552</span></a> <span class="s2">"LIKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="L-553"><a href="#L-553"><span class="linenos"> 553</span></a> <span class="s2">"LIMIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIMIT</span><span class="p">,</span> +</span><span id="L-554"><a href="#L-554"><span class="linenos"> 554</span></a> <span class="s2">"LOAD DATA"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOAD_DATA</span><span class="p">,</span> +</span><span id="L-555"><a href="#L-555"><span class="linenos"> 555</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">,</span> +</span><span id="L-556"><a href="#L-556"><span class="linenos"> 556</span></a> <span class="s2">"MATERIALIZED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">,</span> +</span><span id="L-557"><a href="#L-557"><span class="linenos"> 557</span></a> <span class="s2">"MERGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">,</span> +</span><span id="L-558"><a href="#L-558"><span class="linenos"> 558</span></a> <span class="s2">"NATURAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">,</span> +</span><span id="L-559"><a href="#L-559"><span class="linenos"> 559</span></a> <span class="s2">"NEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEXT</span><span class="p">,</span> +</span><span id="L-560"><a href="#L-560"><span class="linenos"> 560</span></a> <span class="s2">"NO ACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NO_ACTION</span><span class="p">,</span> +</span><span id="L-561"><a href="#L-561"><span class="linenos"> 561</span></a> <span class="s2">"NOT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">,</span> +</span><span id="L-562"><a href="#L-562"><span class="linenos"> 562</span></a> <span class="s2">"NOTNULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOTNULL</span><span class="p">,</span> +</span><span id="L-563"><a href="#L-563"><span class="linenos"> 563</span></a> <span class="s2">"NULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> +</span><span id="L-564"><a href="#L-564"><span class="linenos"> 564</span></a> <span class="s2">"NULLS FIRST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_FIRST</span><span class="p">,</span> +</span><span id="L-565"><a href="#L-565"><span class="linenos"> 565</span></a> <span class="s2">"NULLS LAST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_LAST</span><span class="p">,</span> +</span><span id="L-566"><a href="#L-566"><span class="linenos"> 566</span></a> <span class="s2">"OBJECT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OBJECT</span><span class="p">,</span> +</span><span id="L-567"><a href="#L-567"><span class="linenos"> 567</span></a> <span class="s2">"OFFSET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="L-568"><a href="#L-568"><span class="linenos"> 568</span></a> <span class="s2">"ON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">,</span> +</span><span id="L-569"><a href="#L-569"><span class="linenos"> 569</span></a> <span class="s2">"ONLY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ONLY</span><span class="p">,</span> +</span><span id="L-570"><a href="#L-570"><span class="linenos"> 570</span></a> <span class="s2">"OPTIONS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OPTIONS</span><span class="p">,</span> +</span><span id="L-571"><a href="#L-571"><span class="linenos"> 571</span></a> <span class="s2">"OR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OR</span><span class="p">,</span> +</span><span id="L-572"><a href="#L-572"><span class="linenos"> 572</span></a> <span class="s2">"ORDER BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">,</span> +</span><span id="L-573"><a href="#L-573"><span class="linenos"> 573</span></a> <span class="s2">"ORDINALITY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ORDINALITY</span><span class="p">,</span> +</span><span id="L-574"><a href="#L-574"><span class="linenos"> 574</span></a> <span class="s2">"OUTER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">,</span> +</span><span id="L-575"><a href="#L-575"><span class="linenos"> 575</span></a> <span class="s2">"OUT OF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OUT_OF</span><span class="p">,</span> +</span><span id="L-576"><a href="#L-576"><span class="linenos"> 576</span></a> <span class="s2">"OVER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OVER</span><span class="p">,</span> +</span><span id="L-577"><a href="#L-577"><span class="linenos"> 577</span></a> <span class="s2">"OVERWRITE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OVERWRITE</span><span class="p">,</span> +</span><span id="L-578"><a href="#L-578"><span class="linenos"> 578</span></a> <span class="s2">"PARTITION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION</span><span class="p">,</span> +</span><span id="L-579"><a href="#L-579"><span class="linenos"> 579</span></a> <span class="s2">"PARTITION BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> +</span><span id="L-580"><a href="#L-580"><span class="linenos"> 580</span></a> <span class="s2">"PARTITIONED BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> +</span><span id="L-581"><a href="#L-581"><span class="linenos"> 581</span></a> <span class="s2">"PARTITIONED_BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> +</span><span id="L-582"><a href="#L-582"><span class="linenos"> 582</span></a> <span class="s2">"PERCENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">,</span> +</span><span id="L-583"><a href="#L-583"><span class="linenos"> 583</span></a> <span class="s2">"PIVOT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIVOT</span><span class="p">,</span> +</span><span id="L-584"><a href="#L-584"><span class="linenos"> 584</span></a> <span class="s2">"PRECEDING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRECEDING</span><span class="p">,</span> +</span><span id="L-585"><a href="#L-585"><span class="linenos"> 585</span></a> <span class="s2">"PRIMARY KEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">,</span> +</span><span id="L-586"><a href="#L-586"><span class="linenos"> 586</span></a> <span class="s2">"PROCEDURE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="L-587"><a href="#L-587"><span class="linenos"> 587</span></a> <span class="s2">"QUALIFY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">QUALIFY</span><span class="p">,</span> +</span><span id="L-588"><a href="#L-588"><span class="linenos"> 588</span></a> <span class="s2">"RANGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RANGE</span><span class="p">,</span> +</span><span id="L-589"><a href="#L-589"><span class="linenos"> 589</span></a> <span class="s2">"RECURSIVE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RECURSIVE</span><span class="p">,</span> +</span><span id="L-590"><a href="#L-590"><span class="linenos"> 590</span></a> <span class="s2">"REGEXP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="L-591"><a href="#L-591"><span class="linenos"> 591</span></a> <span class="s2">"REPLACE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="L-592"><a href="#L-592"><span class="linenos"> 592</span></a> <span class="s2">"RESPECT NULLS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RESPECT_NULLS</span><span class="p">,</span> +</span><span id="L-593"><a href="#L-593"><span class="linenos"> 593</span></a> <span class="s2">"REFERENCES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REFERENCES</span><span class="p">,</span> +</span><span id="L-594"><a href="#L-594"><span class="linenos"> 594</span></a> <span class="s2">"RIGHT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="L-595"><a href="#L-595"><span class="linenos"> 595</span></a> <span class="s2">"RLIKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="L-596"><a href="#L-596"><span class="linenos"> 596</span></a> <span class="s2">"ROLLBACK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLBACK</span><span class="p">,</span> +</span><span id="L-597"><a href="#L-597"><span class="linenos"> 597</span></a> <span class="s2">"ROLLUP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLUP</span><span class="p">,</span> +</span><span id="L-598"><a href="#L-598"><span class="linenos"> 598</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> +</span><span id="L-599"><a href="#L-599"><span class="linenos"> 599</span></a> <span class="s2">"ROWS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">,</span> +</span><span id="L-600"><a href="#L-600"><span class="linenos"> 600</span></a> <span class="s2">"SCHEMA"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="L-601"><a href="#L-601"><span class="linenos"> 601</span></a> <span class="s2">"SEED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEED</span><span class="p">,</span> +</span><span id="L-602"><a href="#L-602"><span class="linenos"> 602</span></a> <span class="s2">"SELECT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span> +</span><span id="L-603"><a href="#L-603"><span class="linenos"> 603</span></a> <span class="s2">"SEMI"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMI</span><span class="p">,</span> +</span><span id="L-604"><a href="#L-604"><span class="linenos"> 604</span></a> <span class="s2">"SET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> +</span><span id="L-605"><a href="#L-605"><span class="linenos"> 605</span></a> <span class="s2">"SHOW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">,</span> +</span><span id="L-606"><a href="#L-606"><span class="linenos"> 606</span></a> <span class="s2">"SIMILAR TO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SIMILAR_TO</span><span class="p">,</span> +</span><span id="L-607"><a href="#L-607"><span class="linenos"> 607</span></a> <span class="s2">"SOME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SOME</span><span class="p">,</span> +</span><span id="L-608"><a href="#L-608"><span class="linenos"> 608</span></a> <span class="s2">"SORTKEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORTKEY</span><span class="p">,</span> +</span><span id="L-609"><a href="#L-609"><span class="linenos"> 609</span></a> <span class="s2">"SORT BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORT_BY</span><span class="p">,</span> +</span><span id="L-610"><a href="#L-610"><span class="linenos"> 610</span></a> <span class="s2">"TABLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="L-611"><a href="#L-611"><span class="linenos"> 611</span></a> <span class="s2">"TABLESAMPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">,</span> +</span><span id="L-612"><a href="#L-612"><span class="linenos"> 612</span></a> <span class="s2">"TEMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="L-613"><a href="#L-613"><span class="linenos"> 613</span></a> <span class="s2">"TEMPORARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="L-614"><a href="#L-614"><span class="linenos"> 614</span></a> <span class="s2">"THEN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">,</span> +</span><span id="L-615"><a href="#L-615"><span class="linenos"> 615</span></a> <span class="s2">"TRUE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">,</span> +</span><span id="L-616"><a href="#L-616"><span class="linenos"> 616</span></a> <span class="s2">"TRAILING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRAILING</span><span class="p">,</span> +</span><span id="L-617"><a href="#L-617"><span class="linenos"> 617</span></a> <span class="s2">"UNBOUNDED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNBOUNDED</span><span class="p">,</span> +</span><span id="L-618"><a href="#L-618"><span class="linenos"> 618</span></a> <span class="s2">"UNION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNION</span><span class="p">,</span> +</span><span id="L-619"><a href="#L-619"><span class="linenos"> 619</span></a> <span class="s2">"UNLOGGED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNLOGGED</span><span class="p">,</span> +</span><span id="L-620"><a href="#L-620"><span class="linenos"> 620</span></a> <span class="s2">"UNNEST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNNEST</span><span class="p">,</span> +</span><span id="L-621"><a href="#L-621"><span class="linenos"> 621</span></a> <span class="s2">"UNPIVOT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNPIVOT</span><span class="p">,</span> +</span><span id="L-622"><a href="#L-622"><span class="linenos"> 622</span></a> <span class="s2">"UPDATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">,</span> +</span><span id="L-623"><a href="#L-623"><span class="linenos"> 623</span></a> <span class="s2">"USE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">USE</span><span class="p">,</span> +</span><span id="L-624"><a href="#L-624"><span class="linenos"> 624</span></a> <span class="s2">"USING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">,</span> +</span><span id="L-625"><a href="#L-625"><span class="linenos"> 625</span></a> <span class="s2">"VALUES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">,</span> +</span><span id="L-626"><a href="#L-626"><span class="linenos"> 626</span></a> <span class="s2">"VIEW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="L-627"><a href="#L-627"><span class="linenos"> 627</span></a> <span class="s2">"VOLATILE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="L-628"><a href="#L-628"><span class="linenos"> 628</span></a> <span class="s2">"WHEN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WHEN</span><span class="p">,</span> +</span><span id="L-629"><a href="#L-629"><span class="linenos"> 629</span></a> <span class="s2">"WHERE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WHERE</span><span class="p">,</span> +</span><span id="L-630"><a href="#L-630"><span class="linenos"> 630</span></a> <span class="s2">"WINDOW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="L-631"><a href="#L-631"><span class="linenos"> 631</span></a> <span class="s2">"WITH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">,</span> +</span><span id="L-632"><a href="#L-632"><span class="linenos"> 632</span></a> <span class="s2">"WITH TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_TIME_ZONE</span><span class="p">,</span> +</span><span id="L-633"><a href="#L-633"><span class="linenos"> 633</span></a> <span class="s2">"WITH LOCAL TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_LOCAL_TIME_ZONE</span><span class="p">,</span> +</span><span id="L-634"><a href="#L-634"><span class="linenos"> 634</span></a> <span class="s2">"WITHIN GROUP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITHIN_GROUP</span><span class="p">,</span> +</span><span id="L-635"><a href="#L-635"><span class="linenos"> 635</span></a> <span class="s2">"WITHOUT TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITHOUT_TIME_ZONE</span><span class="p">,</span> +</span><span id="L-636"><a href="#L-636"><span class="linenos"> 636</span></a> <span class="s2">"APPLY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">,</span> +</span><span id="L-637"><a href="#L-637"><span class="linenos"> 637</span></a> <span class="s2">"ARRAY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="L-638"><a href="#L-638"><span class="linenos"> 638</span></a> <span class="s2">"BOOL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="L-639"><a href="#L-639"><span class="linenos"> 639</span></a> <span class="s2">"BOOLEAN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="L-640"><a href="#L-640"><span class="linenos"> 640</span></a> <span class="s2">"BYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="L-641"><a href="#L-641"><span class="linenos"> 641</span></a> <span class="s2">"TINYINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="L-642"><a href="#L-642"><span class="linenos"> 642</span></a> <span class="s2">"SHORT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-643"><a href="#L-643"><span class="linenos"> 643</span></a> <span class="s2">"SMALLINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-644"><a href="#L-644"><span class="linenos"> 644</span></a> <span class="s2">"INT2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="L-645"><a href="#L-645"><span class="linenos"> 645</span></a> <span class="s2">"INTEGER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-646"><a href="#L-646"><span class="linenos"> 646</span></a> <span class="s2">"INT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-647"><a href="#L-647"><span class="linenos"> 647</span></a> <span class="s2">"INT4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="L-648"><a href="#L-648"><span class="linenos"> 648</span></a> <span class="s2">"LONG"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-649"><a href="#L-649"><span class="linenos"> 649</span></a> <span class="s2">"BIGINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-650"><a href="#L-650"><span class="linenos"> 650</span></a> <span class="s2">"INT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="L-651"><a href="#L-651"><span class="linenos"> 651</span></a> <span class="s2">"DECIMAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-652"><a href="#L-652"><span class="linenos"> 652</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MAP</span><span class="p">,</span> +</span><span id="L-653"><a href="#L-653"><span class="linenos"> 653</span></a> <span class="s2">"NULLABLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">,</span> +</span><span id="L-654"><a href="#L-654"><span class="linenos"> 654</span></a> <span class="s2">"NUMBER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-655"><a href="#L-655"><span class="linenos"> 655</span></a> <span class="s2">"NUMERIC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-656"><a href="#L-656"><span class="linenos"> 656</span></a> <span class="s2">"FIXED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="L-657"><a href="#L-657"><span class="linenos"> 657</span></a> <span class="s2">"REAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-658"><a href="#L-658"><span class="linenos"> 658</span></a> <span class="s2">"FLOAT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-659"><a href="#L-659"><span class="linenos"> 659</span></a> <span class="s2">"FLOAT4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="L-660"><a href="#L-660"><span class="linenos"> 660</span></a> <span class="s2">"FLOAT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-661"><a href="#L-661"><span class="linenos"> 661</span></a> <span class="s2">"DOUBLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-662"><a href="#L-662"><span class="linenos"> 662</span></a> <span class="s2">"DOUBLE PRECISION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="L-663"><a href="#L-663"><span class="linenos"> 663</span></a> <span class="s2">"JSON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSON</span><span class="p">,</span> +</span><span id="L-664"><a href="#L-664"><span class="linenos"> 664</span></a> <span class="s2">"CHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="L-665"><a href="#L-665"><span class="linenos"> 665</span></a> <span class="s2">"NCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="L-666"><a href="#L-666"><span class="linenos"> 666</span></a> <span class="s2">"VARCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-667"><a href="#L-667"><span class="linenos"> 667</span></a> <span class="s2">"VARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="L-668"><a href="#L-668"><span class="linenos"> 668</span></a> <span class="s2">"NVARCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-669"><a href="#L-669"><span class="linenos"> 669</span></a> <span class="s2">"NVARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="L-670"><a href="#L-670"><span class="linenos"> 670</span></a> <span class="s2">"STR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-671"><a href="#L-671"><span class="linenos"> 671</span></a> <span class="s2">"STRING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-672"><a href="#L-672"><span class="linenos"> 672</span></a> <span class="s2">"TEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-673"><a href="#L-673"><span class="linenos"> 673</span></a> <span class="s2">"CLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-674"><a href="#L-674"><span class="linenos"> 674</span></a> <span class="s2">"LONGVARCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="L-675"><a href="#L-675"><span class="linenos"> 675</span></a> <span class="s2">"BINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BINARY</span><span class="p">,</span> +</span><span id="L-676"><a href="#L-676"><span class="linenos"> 676</span></a> <span class="s2">"BLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="L-677"><a href="#L-677"><span class="linenos"> 677</span></a> <span class="s2">"BYTEA"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="L-678"><a href="#L-678"><span class="linenos"> 678</span></a> <span class="s2">"VARBINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="L-679"><a href="#L-679"><span class="linenos"> 679</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> +</span><span id="L-680"><a href="#L-680"><span class="linenos"> 680</span></a> <span class="s2">"TIMESTAMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="L-681"><a href="#L-681"><span class="linenos"> 681</span></a> <span class="s2">"TIMESTAMPTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="L-682"><a href="#L-682"><span class="linenos"> 682</span></a> <span class="s2">"TIMESTAMPLTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="L-683"><a href="#L-683"><span class="linenos"> 683</span></a> <span class="s2">"DATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="L-684"><a href="#L-684"><span class="linenos"> 684</span></a> <span class="s2">"DATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="L-685"><a href="#L-685"><span class="linenos"> 685</span></a> <span class="s2">"UNIQUE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">,</span> +</span><span id="L-686"><a href="#L-686"><span class="linenos"> 686</span></a> <span class="s2">"STRUCT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="L-687"><a href="#L-687"><span class="linenos"> 687</span></a> <span class="s2">"VARIANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="L-688"><a href="#L-688"><span class="linenos"> 688</span></a> <span class="s2">"ALTER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALTER</span><span class="p">,</span> +</span><span id="L-689"><a href="#L-689"><span class="linenos"> 689</span></a> <span class="s2">"ALTER AGGREGATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-690"><a href="#L-690"><span class="linenos"> 690</span></a> <span class="s2">"ALTER DEFAULT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-691"><a href="#L-691"><span class="linenos"> 691</span></a> <span class="s2">"ALTER DOMAIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-692"><a href="#L-692"><span class="linenos"> 692</span></a> <span class="s2">"ALTER ROLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-693"><a href="#L-693"><span class="linenos"> 693</span></a> <span class="s2">"ALTER RULE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-694"><a href="#L-694"><span class="linenos"> 694</span></a> <span class="s2">"ALTER SEQUENCE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-695"><a href="#L-695"><span class="linenos"> 695</span></a> <span class="s2">"ALTER TYPE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-696"><a href="#L-696"><span class="linenos"> 696</span></a> <span class="s2">"ALTER USER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-697"><a href="#L-697"><span class="linenos"> 697</span></a> <span class="s2">"ALTER VIEW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-698"><a href="#L-698"><span class="linenos"> 698</span></a> <span class="s2">"ANALYZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-699"><a href="#L-699"><span class="linenos"> 699</span></a> <span class="s2">"CALL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-700"><a href="#L-700"><span class="linenos"> 700</span></a> <span class="s2">"COPY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-701"><a href="#L-701"><span class="linenos"> 701</span></a> <span class="s2">"EXPLAIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-702"><a href="#L-702"><span class="linenos"> 702</span></a> <span class="s2">"OPTIMIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-703"><a href="#L-703"><span class="linenos"> 703</span></a> <span class="s2">"PREPARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-704"><a href="#L-704"><span class="linenos"> 704</span></a> <span class="s2">"TRUNCATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-705"><a href="#L-705"><span class="linenos"> 705</span></a> <span class="s2">"VACUUM"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-706"><a href="#L-706"><span class="linenos"> 706</span></a> <span class="p">}</span> +</span><span id="L-707"><a href="#L-707"><span class="linenos"> 707</span></a> +</span><span id="L-708"><a href="#L-708"><span class="linenos"> 708</span></a> <span class="n">WHITE_SPACE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-709"><a href="#L-709"><span class="linenos"> 709</span></a> <span class="s2">" "</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SPACE</span><span class="p">,</span> +</span><span id="L-710"><a href="#L-710"><span class="linenos"> 710</span></a> <span class="s2">"</span><span class="se">\t</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SPACE</span><span class="p">,</span> +</span><span id="L-711"><a href="#L-711"><span class="linenos"> 711</span></a> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">,</span> +</span><span id="L-712"><a href="#L-712"><span class="linenos"> 712</span></a> <span class="s2">"</span><span class="se">\r</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">,</span> +</span><span id="L-713"><a href="#L-713"><span class="linenos"> 713</span></a> <span class="s2">"</span><span class="se">\r\n</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">,</span> +</span><span id="L-714"><a href="#L-714"><span class="linenos"> 714</span></a> <span class="p">}</span> +</span><span id="L-715"><a href="#L-715"><span class="linenos"> 715</span></a> +</span><span id="L-716"><a href="#L-716"><span class="linenos"> 716</span></a> <span class="n">COMMANDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-717"><a href="#L-717"><span class="linenos"> 717</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-718"><a href="#L-718"><span class="linenos"> 718</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXECUTE</span><span class="p">,</span> +</span><span id="L-719"><a href="#L-719"><span class="linenos"> 719</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FETCH</span><span class="p">,</span> +</span><span id="L-720"><a href="#L-720"><span class="linenos"> 720</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> +</span><span id="L-721"><a href="#L-721"><span class="linenos"> 721</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">,</span> +</span><span id="L-722"><a href="#L-722"><span class="linenos"> 722</span></a> <span class="p">}</span> +</span><span id="L-723"><a href="#L-723"><span class="linenos"> 723</span></a> +</span><span id="L-724"><a href="#L-724"><span class="linenos"> 724</span></a> <span class="n">COMMAND_PREFIX_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEMICOLON</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">}</span> +</span><span id="L-725"><a href="#L-725"><span class="linenos"> 725</span></a> +</span><span id="L-726"><a href="#L-726"><span class="linenos"> 726</span></a> <span class="c1"># handle numeric literals like in hive (3L = BIGINT)</span> +</span><span id="L-727"><a href="#L-727"><span class="linenos"> 727</span></a> <span class="n">NUMERIC_LITERALS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-728"><a href="#L-728"><span class="linenos"> 728</span></a> <span class="n">ENCODE</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-729"><a href="#L-729"><span class="linenos"> 729</span></a> +</span><span id="L-730"><a href="#L-730"><span class="linenos"> 730</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="L-731"><a href="#L-731"><span class="linenos"> 731</span></a> <span class="n">KEYWORD_TRIE</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># autofilled</span> +</span><span id="L-732"><a href="#L-732"><span class="linenos"> 732</span></a> +</span><span id="L-733"><a href="#L-733"><span class="linenos"> 733</span></a> <span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-734"><a href="#L-734"><span class="linenos"> 734</span></a> +</span><span id="L-735"><a href="#L-735"><span class="linenos"> 735</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-736"><a href="#L-736"><span class="linenos"> 736</span></a> <span class="s2">"sql"</span><span class="p">,</span> +</span><span id="L-737"><a href="#L-737"><span class="linenos"> 737</span></a> <span class="s2">"size"</span><span class="p">,</span> +</span><span id="L-738"><a href="#L-738"><span class="linenos"> 738</span></a> <span class="s2">"tokens"</span><span class="p">,</span> +</span><span id="L-739"><a href="#L-739"><span class="linenos"> 739</span></a> <span class="s2">"_start"</span><span class="p">,</span> +</span><span id="L-740"><a href="#L-740"><span class="linenos"> 740</span></a> <span class="s2">"_current"</span><span class="p">,</span> +</span><span id="L-741"><a href="#L-741"><span class="linenos"> 741</span></a> <span class="s2">"_line"</span><span class="p">,</span> +</span><span id="L-742"><a href="#L-742"><span class="linenos"> 742</span></a> <span class="s2">"_col"</span><span class="p">,</span> +</span><span id="L-743"><a href="#L-743"><span class="linenos"> 743</span></a> <span class="s2">"_comments"</span><span class="p">,</span> +</span><span id="L-744"><a href="#L-744"><span class="linenos"> 744</span></a> <span class="s2">"_char"</span><span class="p">,</span> +</span><span id="L-745"><a href="#L-745"><span class="linenos"> 745</span></a> <span class="s2">"_end"</span><span class="p">,</span> +</span><span id="L-746"><a href="#L-746"><span class="linenos"> 746</span></a> <span class="s2">"_peek"</span><span class="p">,</span> +</span><span id="L-747"><a href="#L-747"><span class="linenos"> 747</span></a> <span class="s2">"_prev_token_line"</span><span class="p">,</span> +</span><span id="L-748"><a href="#L-748"><span class="linenos"> 748</span></a> <span class="s2">"_prev_token_comments"</span><span class="p">,</span> +</span><span id="L-749"><a href="#L-749"><span class="linenos"> 749</span></a> <span class="s2">"_prev_token_type"</span><span class="p">,</span> +</span><span id="L-750"><a href="#L-750"><span class="linenos"> 750</span></a> <span class="s2">"_replace_backslash"</span><span class="p">,</span> +</span><span id="L-751"><a href="#L-751"><span class="linenos"> 751</span></a> <span class="p">)</span> +</span><span id="L-752"><a href="#L-752"><span class="linenos"> 752</span></a> +</span><span id="L-753"><a href="#L-753"><span class="linenos"> 753</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-754"><a href="#L-754"><span class="linenos"> 754</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span> +</span><span id="L-755"><a href="#L-755"><span class="linenos"> 755</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="L-756"><a href="#L-756"><span class="linenos"> 756</span></a> +</span><span id="L-757"><a href="#L-757"><span class="linenos"> 757</span></a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-758"><a href="#L-758"><span class="linenos"> 758</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-759"><a href="#L-759"><span class="linenos"> 759</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-760"><a href="#L-760"><span class="linenos"> 760</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-761"><a href="#L-761"><span class="linenos"> 761</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-762"><a href="#L-762"><span class="linenos"> 762</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-763"><a href="#L-763"><span class="linenos"> 763</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-764"><a href="#L-764"><span class="linenos"> 764</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-765"><a href="#L-765"><span class="linenos"> 765</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-766"><a href="#L-766"><span class="linenos"> 766</span></a> +</span><span id="L-767"><a href="#L-767"><span class="linenos"> 767</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-768"><a href="#L-768"><span class="linenos"> 768</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-769"><a href="#L-769"><span class="linenos"> 769</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-770"><a href="#L-770"><span class="linenos"> 770</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="L-771"><a href="#L-771"><span class="linenos"> 771</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-772"><a href="#L-772"><span class="linenos"> 772</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-773"><a href="#L-773"><span class="linenos"> 773</span></a> +</span><span id="L-774"><a href="#L-774"><span class="linenos"> 774</span></a> <span class="k">def</span> <span class="nf">tokenize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]:</span> +</span><span id="L-775"><a href="#L-775"><span class="linenos"> 775</span></a><span class="w"> </span><span class="sd">"""Returns a list of tokens corresponding to the SQL string `sql`."""</span> +</span><span id="L-776"><a href="#L-776"><span class="linenos"> 776</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="L-777"><a href="#L-777"><span class="linenos"> 777</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span> +</span><span id="L-778"><a href="#L-778"><span class="linenos"> 778</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +</span><span id="L-779"><a href="#L-779"><span class="linenos"> 779</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan</span><span class="p">()</span> +</span><span id="L-780"><a href="#L-780"><span class="linenos"> 780</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span> +</span><span id="L-781"><a href="#L-781"><span class="linenos"> 781</span></a> +</span><span id="L-782"><a href="#L-782"><span class="linenos"> 782</span></a> <span class="k">def</span> <span class="nf">_scan</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">until</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-783"><a href="#L-783"><span class="linenos"> 783</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">:</span> +</span><span id="L-784"><a href="#L-784"><span class="linenos"> 784</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> +</span><span id="L-785"><a href="#L-785"><span class="linenos"> 785</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-786"><a href="#L-786"><span class="linenos"> 786</span></a> +</span><span id="L-787"><a href="#L-787"><span class="linenos"> 787</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">:</span> +</span><span id="L-788"><a href="#L-788"><span class="linenos"> 788</span></a> <span class="k">break</span> +</span><span id="L-789"><a href="#L-789"><span class="linenos"> 789</span></a> +</span><span id="L-790"><a href="#L-790"><span class="linenos"> 790</span></a> <span class="n">white_space</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">WHITE_SPACE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-791"><a href="#L-791"><span class="linenos"> 791</span></a> <span class="n">identifier_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_IDENTIFIERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-792"><a href="#L-792"><span class="linenos"> 792</span></a> +</span><span id="L-793"><a href="#L-793"><span class="linenos"> 793</span></a> <span class="k">if</span> <span class="n">white_space</span><span class="p">:</span> +</span><span id="L-794"><a href="#L-794"><span class="linenos"> 794</span></a> <span class="k">if</span> <span class="n">white_space</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">:</span> +</span><span id="L-795"><a href="#L-795"><span class="linenos"> 795</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-796"><a href="#L-796"><span class="linenos"> 796</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-797"><a href="#L-797"><span class="linenos"> 797</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="o">.</span><span class="n">isdigit</span><span class="p">():</span> <span class="c1"># type:ignore</span> +</span><span id="L-798"><a href="#L-798"><span class="linenos"> 798</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_number</span><span class="p">()</span> +</span><span id="L-799"><a href="#L-799"><span class="linenos"> 799</span></a> <span class="k">elif</span> <span class="n">identifier_end</span><span class="p">:</span> +</span><span id="L-800"><a href="#L-800"><span class="linenos"> 800</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_identifier</span><span class="p">(</span><span class="n">identifier_end</span><span class="p">)</span> +</span><span id="L-801"><a href="#L-801"><span class="linenos"> 801</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-802"><a href="#L-802"><span class="linenos"> 802</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_keywords</span><span class="p">()</span> +</span><span id="L-803"><a href="#L-803"><span class="linenos"> 803</span></a> +</span><span id="L-804"><a href="#L-804"><span class="linenos"> 804</span></a> <span class="k">if</span> <span class="n">until</span> <span class="ow">and</span> <span class="n">until</span><span class="p">():</span> +</span><span id="L-805"><a href="#L-805"><span class="linenos"> 805</span></a> <span class="k">break</span> +</span><span id="L-806"><a href="#L-806"><span class="linenos"> 806</span></a> +</span><span id="L-807"><a href="#L-807"><span class="linenos"> 807</span></a> <span class="k">def</span> <span class="nf">_chars</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">size</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-808"><a href="#L-808"><span class="linenos"> 808</span></a> <span class="k">if</span> <span class="n">size</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-809"><a href="#L-809"><span class="linenos"> 809</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="c1"># type: ignore</span> +</span><span id="L-810"><a href="#L-810"><span class="linenos"> 810</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="L-811"><a href="#L-811"><span class="linenos"> 811</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="n">size</span> +</span><span id="L-812"><a href="#L-812"><span class="linenos"> 812</span></a> <span class="k">if</span> <span class="n">end</span> <span class="o"><=</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span><span class="p">:</span> +</span><span id="L-813"><a href="#L-813"><span class="linenos"> 813</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="L-814"><a href="#L-814"><span class="linenos"> 814</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-815"><a href="#L-815"><span class="linenos"> 815</span></a> +</span><span id="L-816"><a href="#L-816"><span class="linenos"> 816</span></a> <span class="k">def</span> <span class="nf">_advance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">i</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-817"><a href="#L-817"><span class="linenos"> 817</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">+=</span> <span class="n">i</span> +</span><span id="L-818"><a href="#L-818"><span class="linenos"> 818</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">+=</span> <span class="n">i</span> +</span><span id="L-819"><a href="#L-819"><span class="linenos"> 819</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">>=</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="c1"># type: ignore</span> +</span><span id="L-820"><a href="#L-820"><span class="linenos"> 820</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="L-821"><a href="#L-821"><span class="linenos"> 821</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_current</span><span class="p">]</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="k">else</span> <span class="s2">""</span> <span class="c1"># type: ignore</span> +</span><span id="L-822"><a href="#L-822"><span class="linenos"> 822</span></a> +</span><span id="L-823"><a href="#L-823"><span class="linenos"> 823</span></a> <span class="nd">@property</span> +</span><span id="L-824"><a href="#L-824"><span class="linenos"> 824</span></a> <span class="k">def</span> <span class="nf">_text</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-825"><a href="#L-825"><span class="linenos"> 825</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span><span class="p">]</span> +</span><span id="L-826"><a href="#L-826"><span class="linenos"> 826</span></a> +</span><span id="L-827"><a href="#L-827"><span class="linenos"> 827</span></a> <span class="k">def</span> <span class="nf">_add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> <span class="n">text</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-828"><a href="#L-828"><span class="linenos"> 828</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> +</span><span id="L-829"><a href="#L-829"><span class="linenos"> 829</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> +</span><span id="L-830"><a href="#L-830"><span class="linenos"> 830</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">=</span> <span class="n">token_type</span> <span class="c1"># type: ignore</span> +</span><span id="L-831"><a href="#L-831"><span class="linenos"> 831</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-832"><a href="#L-832"><span class="linenos"> 832</span></a> <span class="n">Token</span><span class="p">(</span> +</span><span id="L-833"><a href="#L-833"><span class="linenos"> 833</span></a> <span class="n">token_type</span><span class="p">,</span> +</span><span id="L-834"><a href="#L-834"><span class="linenos"> 834</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> <span class="k">if</span> <span class="n">text</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">text</span><span class="p">,</span> +</span><span id="L-835"><a href="#L-835"><span class="linenos"> 835</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="p">,</span> +</span><span id="L-836"><a href="#L-836"><span class="linenos"> 836</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span><span class="p">,</span> +</span><span id="L-837"><a href="#L-837"><span class="linenos"> 837</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">,</span> +</span><span id="L-838"><a href="#L-838"><span class="linenos"> 838</span></a> <span class="p">)</span> +</span><span id="L-839"><a href="#L-839"><span class="linenos"> 839</span></a> <span class="p">)</span> +</span><span id="L-840"><a href="#L-840"><span class="linenos"> 840</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-841"><a href="#L-841"><span class="linenos"> 841</span></a> +</span><span id="L-842"><a href="#L-842"><span class="linenos"> 842</span></a> <span class="c1"># If we have either a semicolon or a begin token before the command's token, we'll parse</span> +</span><span id="L-843"><a href="#L-843"><span class="linenos"> 843</span></a> <span class="c1"># whatever follows the command's token as a string</span> +</span><span id="L-844"><a href="#L-844"><span class="linenos"> 844</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">COMMANDS</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="L-845"><a href="#L-845"><span class="linenos"> 845</span></a> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">[</span><span class="o">-</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">COMMAND_PREFIX_TOKENS</span> +</span><span id="L-846"><a href="#L-846"><span class="linenos"> 846</span></a> <span class="p">):</span> +</span><span id="L-847"><a href="#L-847"><span class="linenos"> 847</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> +</span><span id="L-848"><a href="#L-848"><span class="linenos"> 848</span></a> <span class="n">tokens</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">)</span> +</span><span id="L-849"><a href="#L-849"><span class="linenos"> 849</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="s2">";"</span><span class="p">)</span> +</span><span id="L-850"><a href="#L-850"><span class="linenos"> 850</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">[:</span><span class="n">tokens</span><span class="p">]</span> +</span><span id="L-851"><a href="#L-851"><span class="linenos"> 851</span></a> <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span> <span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="L-852"><a href="#L-852"><span class="linenos"> 852</span></a> <span class="k">if</span> <span class="n">text</span><span class="p">:</span> +</span><span id="L-853"><a href="#L-853"><span class="linenos"> 853</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="L-854"><a href="#L-854"><span class="linenos"> 854</span></a> +</span><span id="L-855"><a href="#L-855"><span class="linenos"> 855</span></a> <span class="k">def</span> <span class="nf">_scan_keywords</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-856"><a href="#L-856"><span class="linenos"> 856</span></a> <span class="n">size</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-857"><a href="#L-857"><span class="linenos"> 857</span></a> <span class="n">word</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-858"><a href="#L-858"><span class="linenos"> 858</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> +</span><span id="L-859"><a href="#L-859"><span class="linenos"> 859</span></a> <span class="n">char</span> <span class="o">=</span> <span class="n">chars</span> +</span><span id="L-860"><a href="#L-860"><span class="linenos"> 860</span></a> <span class="n">prev_space</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-861"><a href="#L-861"><span class="linenos"> 861</span></a> <span class="n">skip</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-862"><a href="#L-862"><span class="linenos"> 862</span></a> <span class="n">trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEYWORD_TRIE</span> +</span><span id="L-863"><a href="#L-863"><span class="linenos"> 863</span></a> +</span><span id="L-864"><a href="#L-864"><span class="linenos"> 864</span></a> <span class="k">while</span> <span class="n">chars</span><span class="p">:</span> +</span><span id="L-865"><a href="#L-865"><span class="linenos"> 865</span></a> <span class="k">if</span> <span class="n">skip</span><span class="p">:</span> +</span><span id="L-866"><a href="#L-866"><span class="linenos"> 866</span></a> <span class="n">result</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="L-867"><a href="#L-867"><span class="linenos"> 867</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-868"><a href="#L-868"><span class="linenos"> 868</span></a> <span class="n">result</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">char</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> <span class="c1"># type: ignore</span> +</span><span id="L-869"><a href="#L-869"><span class="linenos"> 869</span></a> +</span><span id="L-870"><a href="#L-870"><span class="linenos"> 870</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="L-871"><a href="#L-871"><span class="linenos"> 871</span></a> <span class="k">break</span> +</span><span id="L-872"><a href="#L-872"><span class="linenos"> 872</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="L-873"><a href="#L-873"><span class="linenos"> 873</span></a> <span class="n">word</span> <span class="o">=</span> <span class="n">chars</span> +</span><span id="L-874"><a href="#L-874"><span class="linenos"> 874</span></a> <span class="n">size</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-875"><a href="#L-875"><span class="linenos"> 875</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">-</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">size</span> +</span><span id="L-876"><a href="#L-876"><span class="linenos"> 876</span></a> +</span><span id="L-877"><a href="#L-877"><span class="linenos"> 877</span></a> <span class="k">if</span> <span class="n">end</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span><span class="p">:</span> +</span><span id="L-878"><a href="#L-878"><span class="linenos"> 878</span></a> <span class="n">char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">end</span><span class="p">]</span> +</span><span id="L-879"><a href="#L-879"><span class="linenos"> 879</span></a> <span class="n">is_space</span> <span class="o">=</span> <span class="n">char</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">WHITE_SPACE</span> +</span><span id="L-880"><a href="#L-880"><span class="linenos"> 880</span></a> +</span><span id="L-881"><a href="#L-881"><span class="linenos"> 881</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">is_space</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">prev_space</span><span class="p">:</span> +</span><span id="L-882"><a href="#L-882"><span class="linenos"> 882</span></a> <span class="k">if</span> <span class="n">is_space</span><span class="p">:</span> +</span><span id="L-883"><a href="#L-883"><span class="linenos"> 883</span></a> <span class="n">char</span> <span class="o">=</span> <span class="s2">" "</span> +</span><span id="L-884"><a href="#L-884"><span class="linenos"> 884</span></a> <span class="n">chars</span> <span class="o">+=</span> <span class="n">char</span> +</span><span id="L-885"><a href="#L-885"><span class="linenos"> 885</span></a> <span class="n">prev_space</span> <span class="o">=</span> <span class="n">is_space</span> +</span><span id="L-886"><a href="#L-886"><span class="linenos"> 886</span></a> <span class="n">skip</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-887"><a href="#L-887"><span class="linenos"> 887</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-888"><a href="#L-888"><span class="linenos"> 888</span></a> <span class="n">skip</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-889"><a href="#L-889"><span class="linenos"> 889</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-890"><a href="#L-890"><span class="linenos"> 890</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># type: ignore</span> +</span><span id="L-891"><a href="#L-891"><span class="linenos"> 891</span></a> +</span><span id="L-892"><a href="#L-892"><span class="linenos"> 892</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">word</span><span class="p">:</span> +</span><span id="L-893"><a href="#L-893"><span class="linenos"> 893</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> +</span><span id="L-894"><a href="#L-894"><span class="linenos"> 894</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">])</span> <span class="c1"># type: ignore</span> +</span><span id="L-895"><a href="#L-895"><span class="linenos"> 895</span></a> <span class="k">return</span> +</span><span id="L-896"><a href="#L-896"><span class="linenos"> 896</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_var</span><span class="p">()</span> +</span><span id="L-897"><a href="#L-897"><span class="linenos"> 897</span></a> <span class="k">return</span> +</span><span id="L-898"><a href="#L-898"><span class="linenos"> 898</span></a> +</span><span id="L-899"><a href="#L-899"><span class="linenos"> 899</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_string</span><span class="p">(</span><span class="n">word</span><span class="p">):</span> +</span><span id="L-900"><a href="#L-900"><span class="linenos"> 900</span></a> <span class="k">return</span> +</span><span id="L-901"><a href="#L-901"><span class="linenos"> 901</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_formatted_string</span><span class="p">(</span><span class="n">word</span><span class="p">):</span> +</span><span id="L-902"><a href="#L-902"><span class="linenos"> 902</span></a> <span class="k">return</span> +</span><span id="L-903"><a href="#L-903"><span class="linenos"> 903</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_comment</span><span class="p">(</span><span class="n">word</span><span class="p">):</span> +</span><span id="L-904"><a href="#L-904"><span class="linenos"> 904</span></a> <span class="k">return</span> +</span><span id="L-905"><a href="#L-905"><span class="linenos"> 905</span></a> +</span><span id="L-906"><a href="#L-906"><span class="linenos"> 906</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-907"><a href="#L-907"><span class="linenos"> 907</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">[</span><span class="n">word</span><span class="o">.</span><span class="n">upper</span><span class="p">()])</span> +</span><span id="L-908"><a href="#L-908"><span class="linenos"> 908</span></a> +</span><span id="L-909"><a href="#L-909"><span class="linenos"> 909</span></a> <span class="k">def</span> <span class="nf">_scan_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comment_start</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-910"><a href="#L-910"><span class="linenos"> 910</span></a> <span class="k">if</span> <span class="n">comment_start</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_COMMENTS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-911"><a href="#L-911"><span class="linenos"> 911</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-912"><a href="#L-912"><span class="linenos"> 912</span></a> +</span><span id="L-913"><a href="#L-913"><span class="linenos"> 913</span></a> <span class="n">comment_start_line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> +</span><span id="L-914"><a href="#L-914"><span class="linenos"> 914</span></a> <span class="n">comment_start_size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">comment_start</span><span class="p">)</span> +</span><span id="L-915"><a href="#L-915"><span class="linenos"> 915</span></a> <span class="n">comment_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_COMMENTS</span><span class="p">[</span><span class="n">comment_start</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="L-916"><a href="#L-916"><span class="linenos"> 916</span></a> +</span><span id="L-917"><a href="#L-917"><span class="linenos"> 917</span></a> <span class="k">if</span> <span class="n">comment_end</span><span class="p">:</span> +</span><span id="L-918"><a href="#L-918"><span class="linenos"> 918</span></a> <span class="n">comment_end_size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">comment_end</span><span class="p">)</span> +</span><span id="L-919"><a href="#L-919"><span class="linenos"> 919</span></a> +</span><span id="L-920"><a href="#L-920"><span class="linenos"> 920</span></a> <span class="k">while</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_chars</span><span class="p">(</span><span class="n">comment_end_size</span><span class="p">)</span> <span class="o">!=</span> <span class="n">comment_end</span><span class="p">:</span> +</span><span id="L-921"><a href="#L-921"><span class="linenos"> 921</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-922"><a href="#L-922"><span class="linenos"> 922</span></a> +</span><span id="L-923"><a href="#L-923"><span class="linenos"> 923</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_text</span><span class="p">[</span><span class="n">comment_start_size</span> <span class="p">:</span> <span class="o">-</span><span class="n">comment_end_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">])</span> <span class="c1"># type: ignore</span> +</span><span id="L-924"><a href="#L-924"><span class="linenos"> 924</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">comment_end_size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-925"><a href="#L-925"><span class="linenos"> 925</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-926"><a href="#L-926"><span class="linenos"> 926</span></a> <span class="k">while</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">WHITE_SPACE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="p">)</span> <span class="o">!=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-927"><a href="#L-927"><span class="linenos"> 927</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-928"><a href="#L-928"><span class="linenos"> 928</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_text</span><span class="p">[</span><span class="n">comment_start_size</span><span class="p">:])</span> <span class="c1"># type: ignore</span> +</span><span id="L-929"><a href="#L-929"><span class="linenos"> 929</span></a> +</span><span id="L-930"><a href="#L-930"><span class="linenos"> 930</span></a> <span class="c1"># Leading comment is attached to the succeeding token, whilst trailing comment to the preceding.</span> +</span><span id="L-931"><a href="#L-931"><span class="linenos"> 931</span></a> <span class="c1"># Multiple consecutive comments are preserved by appending them to the current comments list.</span> +</span><span id="L-932"><a href="#L-932"><span class="linenos"> 932</span></a> <span class="k">if</span> <span class="n">comment_start_line</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span><span class="p">:</span> +</span><span id="L-933"><a href="#L-933"><span class="linenos"> 933</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">comments</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">)</span> +</span><span id="L-934"><a href="#L-934"><span class="linenos"> 934</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-935"><a href="#L-935"><span class="linenos"> 935</span></a> +</span><span id="L-936"><a href="#L-936"><span class="linenos"> 936</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-937"><a href="#L-937"><span class="linenos"> 937</span></a> +</span><span id="L-938"><a href="#L-938"><span class="linenos"> 938</span></a> <span class="k">def</span> <span class="nf">_scan_number</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-939"><a href="#L-939"><span class="linenos"> 939</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">==</span> <span class="s2">"0"</span><span class="p">:</span> +</span><span id="L-940"><a href="#L-940"><span class="linenos"> 940</span></a> <span class="n">peek</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="L-941"><a href="#L-941"><span class="linenos"> 941</span></a> <span class="k">if</span> <span class="n">peek</span> <span class="o">==</span> <span class="s2">"B"</span><span class="p">:</span> +</span><span id="L-942"><a href="#L-942"><span class="linenos"> 942</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_bits</span><span class="p">()</span> +</span><span id="L-943"><a href="#L-943"><span class="linenos"> 943</span></a> <span class="k">elif</span> <span class="n">peek</span> <span class="o">==</span> <span class="s2">"X"</span><span class="p">:</span> +</span><span id="L-944"><a href="#L-944"><span class="linenos"> 944</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_hex</span><span class="p">()</span> +</span><span id="L-945"><a href="#L-945"><span class="linenos"> 945</span></a> +</span><span id="L-946"><a href="#L-946"><span class="linenos"> 946</span></a> <span class="n">decimal</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-947"><a href="#L-947"><span class="linenos"> 947</span></a> <span class="n">scientific</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="L-948"><a href="#L-948"><span class="linenos"> 948</span></a> +</span><span id="L-949"><a href="#L-949"><span class="linenos"> 949</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-950"><a href="#L-950"><span class="linenos"> 950</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">isdigit</span><span class="p">():</span> <span class="c1"># type: ignore</span> +</span><span id="L-951"><a href="#L-951"><span class="linenos"> 951</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-952"><a href="#L-952"><span class="linenos"> 952</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="s2">"."</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">decimal</span><span class="p">:</span> +</span><span id="L-953"><a href="#L-953"><span class="linenos"> 953</span></a> <span class="n">decimal</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-954"><a href="#L-954"><span class="linenos"> 954</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-955"><a href="#L-955"><span class="linenos"> 955</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"-"</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">scientific</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-956"><a href="#L-956"><span class="linenos"> 956</span></a> <span class="n">scientific</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-957"><a href="#L-957"><span class="linenos"> 957</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-958"><a href="#L-958"><span class="linenos"> 958</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"E"</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">scientific</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-959"><a href="#L-959"><span class="linenos"> 959</span></a> <span class="n">scientific</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="L-960"><a href="#L-960"><span class="linenos"> 960</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-961"><a href="#L-961"><span class="linenos"> 961</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">isidentifier</span><span class="p">():</span> <span class="c1"># type: ignore</span> +</span><span id="L-962"><a href="#L-962"><span class="linenos"> 962</span></a> <span class="n">number_text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> +</span><span id="L-963"><a href="#L-963"><span class="linenos"> 963</span></a> <span class="n">literal</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-964"><a href="#L-964"><span class="linenos"> 964</span></a> +</span><span id="L-965"><a href="#L-965"><span class="linenos"> 965</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-966"><a href="#L-966"><span class="linenos"> 966</span></a> <span class="n">literal</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> <span class="c1"># type: ignore</span> +</span><span id="L-967"><a href="#L-967"><span class="linenos"> 967</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-968"><a href="#L-968"><span class="linenos"> 968</span></a> +</span><span id="L-969"><a href="#L-969"><span class="linenos"> 969</span></a> <span class="n">literal</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">literal</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-970"><a href="#L-970"><span class="linenos"> 970</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">NUMERIC_LITERALS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">literal</span><span class="p">))</span> <span class="c1"># type: ignore</span> +</span><span id="L-971"><a href="#L-971"><span class="linenos"> 971</span></a> +</span><span id="L-972"><a href="#L-972"><span class="linenos"> 972</span></a> <span class="k">if</span> <span class="n">token_type</span><span class="p">:</span> +</span><span id="L-973"><a href="#L-973"><span class="linenos"> 973</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="n">number_text</span><span class="p">)</span> +</span><span id="L-974"><a href="#L-974"><span class="linenos"> 974</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">,</span> <span class="s2">"::"</span><span class="p">)</span> +</span><span id="L-975"><a href="#L-975"><span class="linenos"> 975</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">literal</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-976"><a href="#L-976"><span class="linenos"> 976</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span><span class="p">:</span> +</span><span id="L-977"><a href="#L-977"><span class="linenos"> 977</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">)</span> +</span><span id="L-978"><a href="#L-978"><span class="linenos"> 978</span></a> +</span><span id="L-979"><a href="#L-979"><span class="linenos"> 979</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="n">number_text</span><span class="p">)</span> +</span><span id="L-980"><a href="#L-980"><span class="linenos"> 980</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="o">-</span><span class="nb">len</span><span class="p">(</span><span class="n">literal</span><span class="p">))</span> +</span><span id="L-981"><a href="#L-981"><span class="linenos"> 981</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-982"><a href="#L-982"><span class="linenos"> 982</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">)</span> +</span><span id="L-983"><a href="#L-983"><span class="linenos"> 983</span></a> +</span><span id="L-984"><a href="#L-984"><span class="linenos"> 984</span></a> <span class="k">def</span> <span class="nf">_scan_bits</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-985"><a href="#L-985"><span class="linenos"> 985</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-986"><a href="#L-986"><span class="linenos"> 986</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_value</span><span class="p">()</span> +</span><span id="L-987"><a href="#L-987"><span class="linenos"> 987</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-988"><a href="#L-988"><span class="linenos"> 988</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-989"><a href="#L-989"><span class="linenos"> 989</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="L-990"><a href="#L-990"><span class="linenos"> 990</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">)</span> +</span><span id="L-991"><a href="#L-991"><span class="linenos"> 991</span></a> +</span><span id="L-992"><a href="#L-992"><span class="linenos"> 992</span></a> <span class="k">def</span> <span class="nf">_scan_hex</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-993"><a href="#L-993"><span class="linenos"> 993</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-994"><a href="#L-994"><span class="linenos"> 994</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_value</span><span class="p">()</span> +</span><span id="L-995"><a href="#L-995"><span class="linenos"> 995</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-996"><a href="#L-996"><span class="linenos"> 996</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="w"> </span><span class="mi">16</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-997"><a href="#L-997"><span class="linenos"> 997</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="L-998"><a href="#L-998"><span class="linenos"> 998</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">)</span> +</span><span id="L-999"><a href="#L-999"><span class="linenos"> 999</span></a> +</span><span id="L-1000"><a href="#L-1000"><span class="linenos">1000</span></a> <span class="k">def</span> <span class="nf">_extract_value</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1001"><a href="#L-1001"><span class="linenos">1001</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1002"><a href="#L-1002"><span class="linenos">1002</span></a> <span class="n">char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="L-1003"><a href="#L-1003"><span class="linenos">1003</span></a> <span class="k">if</span> <span class="n">char</span> <span class="ow">and</span> <span class="n">char</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> +</span><span id="L-1004"><a href="#L-1004"><span class="linenos">1004</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-1005"><a href="#L-1005"><span class="linenos">1005</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1006"><a href="#L-1006"><span class="linenos">1006</span></a> <span class="k">break</span> +</span><span id="L-1007"><a href="#L-1007"><span class="linenos">1007</span></a> +</span><span id="L-1008"><a href="#L-1008"><span class="linenos">1008</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> +</span><span id="L-1009"><a href="#L-1009"><span class="linenos">1009</span></a> +</span><span id="L-1010"><a href="#L-1010"><span class="linenos">1010</span></a> <span class="k">def</span> <span class="nf">_scan_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">quote</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-1011"><a href="#L-1011"><span class="linenos">1011</span></a> <span class="n">quote_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_QUOTES</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">quote</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="L-1012"><a href="#L-1012"><span class="linenos">1012</span></a> <span class="k">if</span> <span class="n">quote_end</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1013"><a href="#L-1013"><span class="linenos">1013</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-1014"><a href="#L-1014"><span class="linenos">1014</span></a> +</span><span id="L-1015"><a href="#L-1015"><span class="linenos">1015</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">quote</span><span class="p">))</span> +</span><span id="L-1016"><a href="#L-1016"><span class="linenos">1016</span></a> <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_string</span><span class="p">(</span><span class="n">quote_end</span><span class="p">)</span> +</span><span id="L-1017"><a href="#L-1017"><span class="linenos">1017</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">)</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENCODE</span> <span class="k">else</span> <span class="n">text</span> <span class="c1"># type: ignore</span> +</span><span id="L-1018"><a href="#L-1018"><span class="linenos">1018</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"</span><span class="se">\\\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="k">else</span> <span class="n">text</span> +</span><span id="L-1019"><a href="#L-1019"><span class="linenos">1019</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NATIONAL</span> <span class="k">if</span> <span class="n">quote</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"N"</span> <span class="k">else</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="L-1020"><a href="#L-1020"><span class="linenos">1020</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-1021"><a href="#L-1021"><span class="linenos">1021</span></a> +</span><span id="L-1022"><a href="#L-1022"><span class="linenos">1022</span></a> <span class="c1"># X'1234, b'0110', E'\\\\\' etc.</span> +</span><span id="L-1023"><a href="#L-1023"><span class="linenos">1023</span></a> <span class="k">def</span> <span class="nf">_scan_formatted_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">string_start</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="L-1024"><a href="#L-1024"><span class="linenos">1024</span></a> <span class="k">if</span> <span class="n">string_start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_HEX_STRINGS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-1025"><a href="#L-1025"><span class="linenos">1025</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_HEX_STRINGS</span> <span class="c1"># type: ignore</span> +</span><span id="L-1026"><a href="#L-1026"><span class="linenos">1026</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span> +</span><span id="L-1027"><a href="#L-1027"><span class="linenos">1027</span></a> <span class="n">base</span> <span class="o">=</span> <span class="mi">16</span> +</span><span id="L-1028"><a href="#L-1028"><span class="linenos">1028</span></a> <span class="k">elif</span> <span class="n">string_start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BIT_STRINGS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-1029"><a href="#L-1029"><span class="linenos">1029</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BIT_STRINGS</span> <span class="c1"># type: ignore</span> +</span><span id="L-1030"><a href="#L-1030"><span class="linenos">1030</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span> +</span><span id="L-1031"><a href="#L-1031"><span class="linenos">1031</span></a> <span class="n">base</span> <span class="o">=</span> <span class="mi">2</span> +</span><span id="L-1032"><a href="#L-1032"><span class="linenos">1032</span></a> <span class="k">elif</span> <span class="n">string_start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="L-1033"><a href="#L-1033"><span class="linenos">1033</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span> <span class="c1"># type: ignore</span> +</span><span id="L-1034"><a href="#L-1034"><span class="linenos">1034</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BYTE_STRING</span> +</span><span id="L-1035"><a href="#L-1035"><span class="linenos">1035</span></a> <span class="n">base</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-1036"><a href="#L-1036"><span class="linenos">1036</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1037"><a href="#L-1037"><span class="linenos">1037</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="L-1038"><a href="#L-1038"><span class="linenos">1038</span></a> +</span><span id="L-1039"><a href="#L-1039"><span class="linenos">1039</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">string_start</span><span class="p">))</span> +</span><span id="L-1040"><a href="#L-1040"><span class="linenos">1040</span></a> <span class="n">string_end</span> <span class="o">=</span> <span class="n">delimiters</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">string_start</span><span class="p">)</span> +</span><span id="L-1041"><a href="#L-1041"><span class="linenos">1041</span></a> <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_string</span><span class="p">(</span><span class="n">string_end</span><span class="p">)</span> +</span><span id="L-1042"><a href="#L-1042"><span class="linenos">1042</span></a> +</span><span id="L-1043"><a href="#L-1043"><span class="linenos">1043</span></a> <span class="k">if</span> <span class="n">base</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1044"><a href="#L-1044"><span class="linenos">1044</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="L-1045"><a href="#L-1045"><span class="linenos">1045</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1046"><a href="#L-1046"><span class="linenos">1046</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="L-1047"><a href="#L-1047"><span class="linenos">1047</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">int</span><span class="p">(</span><span class="n">text</span><span class="p">,</span><span class="w"> </span><span class="n">base</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1048"><a href="#L-1048"><span class="linenos">1048</span></a> <span class="k">except</span><span class="p">:</span> +</span><span id="L-1049"><a href="#L-1049"><span class="linenos">1049</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span> +</span><span id="L-1050"><a href="#L-1050"><span class="linenos">1050</span></a> <span class="sa">f</span><span class="s2">"Numeric string contains invalid characters from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-1051"><a href="#L-1051"><span class="linenos">1051</span></a> <span class="p">)</span> +</span><span id="L-1052"><a href="#L-1052"><span class="linenos">1052</span></a> +</span><span id="L-1053"><a href="#L-1053"><span class="linenos">1053</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="L-1054"><a href="#L-1054"><span class="linenos">1054</span></a> +</span><span id="L-1055"><a href="#L-1055"><span class="linenos">1055</span></a> <span class="k">def</span> <span class="nf">_scan_identifier</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">identifier_end</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1056"><a href="#L-1056"><span class="linenos">1056</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-1057"><a href="#L-1057"><span class="linenos">1057</span></a> <span class="n">identifier_end_is_escape</span> <span class="o">=</span> <span class="n">identifier_end</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_IDENTIFIER_ESCAPES</span> +</span><span id="L-1058"><a href="#L-1058"><span class="linenos">1058</span></a> +</span><span id="L-1059"><a href="#L-1059"><span class="linenos">1059</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1060"><a href="#L-1060"><span class="linenos">1060</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">:</span> +</span><span id="L-1061"><a href="#L-1061"><span class="linenos">1061</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Missing </span><span class="si">{</span><span class="n">identifier_end</span><span class="si">}</span><span class="s2"> from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1062"><a href="#L-1062"><span class="linenos">1062</span></a> +</span><span id="L-1063"><a href="#L-1063"><span class="linenos">1063</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-1064"><a href="#L-1064"><span class="linenos">1064</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">==</span> <span class="n">identifier_end</span><span class="p">:</span> +</span><span id="L-1065"><a href="#L-1065"><span class="linenos">1065</span></a> <span class="k">if</span> <span class="n">identifier_end_is_escape</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="n">identifier_end</span><span class="p">:</span> +</span><span id="L-1066"><a href="#L-1066"><span class="linenos">1066</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="n">identifier_end</span> <span class="c1"># type: ignore</span> +</span><span id="L-1067"><a href="#L-1067"><span class="linenos">1067</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-1068"><a href="#L-1068"><span class="linenos">1068</span></a> <span class="k">continue</span> +</span><span id="L-1069"><a href="#L-1069"><span class="linenos">1069</span></a> +</span><span id="L-1070"><a href="#L-1070"><span class="linenos">1070</span></a> <span class="k">break</span> +</span><span id="L-1071"><a href="#L-1071"><span class="linenos">1071</span></a> +</span><span id="L-1072"><a href="#L-1072"><span class="linenos">1072</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="c1"># type: ignore</span> +</span><span id="L-1073"><a href="#L-1073"><span class="linenos">1073</span></a> +</span><span id="L-1074"><a href="#L-1074"><span class="linenos">1074</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="L-1075"><a href="#L-1075"><span class="linenos">1075</span></a> +</span><span id="L-1076"><a href="#L-1076"><span class="linenos">1076</span></a> <span class="k">def</span> <span class="nf">_scan_var</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="L-1077"><a href="#L-1077"><span class="linenos">1077</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1078"><a href="#L-1078"><span class="linenos">1078</span></a> <span class="n">char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="L-1079"><a href="#L-1079"><span class="linenos">1079</span></a> <span class="k">if</span> <span class="n">char</span> <span class="ow">and</span> <span class="n">char</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> +</span><span id="L-1080"><a href="#L-1080"><span class="linenos">1080</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-1081"><a href="#L-1081"><span class="linenos">1081</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1082"><a href="#L-1082"><span class="linenos">1082</span></a> <span class="k">break</span> +</span><span id="L-1083"><a href="#L-1083"><span class="linenos">1083</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span> +</span><span id="L-1084"><a href="#L-1084"><span class="linenos">1084</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span> +</span><span id="L-1085"><a href="#L-1085"><span class="linenos">1085</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span> +</span><span id="L-1086"><a href="#L-1086"><span class="linenos">1086</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_text</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">)</span> +</span><span id="L-1087"><a href="#L-1087"><span class="linenos">1087</span></a> <span class="p">)</span> +</span><span id="L-1088"><a href="#L-1088"><span class="linenos">1088</span></a> +</span><span id="L-1089"><a href="#L-1089"><span class="linenos">1089</span></a> <span class="k">def</span> <span class="nf">_extract_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">delimiter</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-1090"><a href="#L-1090"><span class="linenos">1090</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="L-1091"><a href="#L-1091"><span class="linenos">1091</span></a> <span class="n">delim_size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">delimiter</span><span class="p">)</span> +</span><span id="L-1092"><a href="#L-1092"><span class="linenos">1092</span></a> +</span><span id="L-1093"><a href="#L-1093"><span class="linenos">1093</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="L-1094"><a href="#L-1094"><span class="linenos">1094</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-1095"><a href="#L-1095"><span class="linenos">1095</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span> +</span><span id="L-1096"><a href="#L-1096"><span class="linenos">1096</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> +</span><span id="L-1097"><a href="#L-1097"><span class="linenos">1097</span></a> <span class="ow">and</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="n">delimiter</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span><span class="p">)</span> +</span><span id="L-1098"><a href="#L-1098"><span class="linenos">1098</span></a> <span class="p">):</span> +</span><span id="L-1099"><a href="#L-1099"><span class="linenos">1099</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> +</span><span id="L-1100"><a href="#L-1100"><span class="linenos">1100</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> +</span><span id="L-1101"><a href="#L-1101"><span class="linenos">1101</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-1102"><a href="#L-1102"><span class="linenos">1102</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_chars</span><span class="p">(</span><span class="n">delim_size</span><span class="p">)</span> <span class="o">==</span> <span class="n">delimiter</span><span class="p">:</span> +</span><span id="L-1103"><a href="#L-1103"><span class="linenos">1103</span></a> <span class="k">if</span> <span class="n">delim_size</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-1104"><a href="#L-1104"><span class="linenos">1104</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">delim_size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="L-1105"><a href="#L-1105"><span class="linenos">1105</span></a> <span class="k">break</span> +</span><span id="L-1106"><a href="#L-1106"><span class="linenos">1106</span></a> +</span><span id="L-1107"><a href="#L-1107"><span class="linenos">1107</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">:</span> +</span><span id="L-1108"><a href="#L-1108"><span class="linenos">1108</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Missing </span><span class="si">{</span><span class="n">delimiter</span><span class="si">}</span><span class="s2"> from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-1109"><a href="#L-1109"><span class="linenos">1109</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="c1"># type: ignore</span> +</span><span id="L-1110"><a href="#L-1110"><span class="linenos">1110</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="L-1111"><a href="#L-1111"><span class="linenos">1111</span></a> +</span><span id="L-1112"><a href="#L-1112"><span class="linenos">1112</span></a> <span class="k">return</span> <span class="n">text</span> +</span></pre></div> + + + </section> + <section id="TokenType"> + <input id="TokenType-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">TokenType</span><wbr>(<span class="base"><a href="helper.html#AutoName">sqlglot.helper.AutoName</a></span>): + + <label class="view-source-button" for="TokenType-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#TokenType"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="TokenType-11"><a href="#TokenType-11"><span class="linenos"> 11</span></a><span class="k">class</span> <span class="nc">TokenType</span><span class="p">(</span><span class="n">AutoName</span><span class="p">):</span> +</span><span id="TokenType-12"><a href="#TokenType-12"><span class="linenos"> 12</span></a> <span class="n">L_PAREN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-13"><a href="#TokenType-13"><span class="linenos"> 13</span></a> <span class="n">R_PAREN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-14"><a href="#TokenType-14"><span class="linenos"> 14</span></a> <span class="n">L_BRACKET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-15"><a href="#TokenType-15"><span class="linenos"> 15</span></a> <span class="n">R_BRACKET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-16"><a href="#TokenType-16"><span class="linenos"> 16</span></a> <span class="n">L_BRACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-17"><a href="#TokenType-17"><span class="linenos"> 17</span></a> <span class="n">R_BRACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-18"><a href="#TokenType-18"><span class="linenos"> 18</span></a> <span class="n">COMMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-19"><a href="#TokenType-19"><span class="linenos"> 19</span></a> <span class="n">DOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-20"><a href="#TokenType-20"><span class="linenos"> 20</span></a> <span class="n">DASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-21"><a href="#TokenType-21"><span class="linenos"> 21</span></a> <span class="n">PLUS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-22"><a href="#TokenType-22"><span class="linenos"> 22</span></a> <span class="n">COLON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-23"><a href="#TokenType-23"><span class="linenos"> 23</span></a> <span class="n">DCOLON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-24"><a href="#TokenType-24"><span class="linenos"> 24</span></a> <span class="n">SEMICOLON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-25"><a href="#TokenType-25"><span class="linenos"> 25</span></a> <span class="n">STAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-26"><a href="#TokenType-26"><span class="linenos"> 26</span></a> <span class="n">BACKSLASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-27"><a href="#TokenType-27"><span class="linenos"> 27</span></a> <span class="n">SLASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-28"><a href="#TokenType-28"><span class="linenos"> 28</span></a> <span class="n">LT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-29"><a href="#TokenType-29"><span class="linenos"> 29</span></a> <span class="n">LTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-30"><a href="#TokenType-30"><span class="linenos"> 30</span></a> <span class="n">GT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-31"><a href="#TokenType-31"><span class="linenos"> 31</span></a> <span class="n">GTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-32"><a href="#TokenType-32"><span class="linenos"> 32</span></a> <span class="n">NOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-33"><a href="#TokenType-33"><span class="linenos"> 33</span></a> <span class="n">EQ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-34"><a href="#TokenType-34"><span class="linenos"> 34</span></a> <span class="n">NEQ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-35"><a href="#TokenType-35"><span class="linenos"> 35</span></a> <span class="n">NULLSAFE_EQ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-36"><a href="#TokenType-36"><span class="linenos"> 36</span></a> <span class="n">AND</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-37"><a href="#TokenType-37"><span class="linenos"> 37</span></a> <span class="n">OR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-38"><a href="#TokenType-38"><span class="linenos"> 38</span></a> <span class="n">AMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-39"><a href="#TokenType-39"><span class="linenos"> 39</span></a> <span class="n">DPIPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-40"><a href="#TokenType-40"><span class="linenos"> 40</span></a> <span class="n">PIPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-41"><a href="#TokenType-41"><span class="linenos"> 41</span></a> <span class="n">CARET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-42"><a href="#TokenType-42"><span class="linenos"> 42</span></a> <span class="n">TILDA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-43"><a href="#TokenType-43"><span class="linenos"> 43</span></a> <span class="n">ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-44"><a href="#TokenType-44"><span class="linenos"> 44</span></a> <span class="n">DARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-45"><a href="#TokenType-45"><span class="linenos"> 45</span></a> <span class="n">FARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-46"><a href="#TokenType-46"><span class="linenos"> 46</span></a> <span class="n">HASH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-47"><a href="#TokenType-47"><span class="linenos"> 47</span></a> <span class="n">HASH_ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-48"><a href="#TokenType-48"><span class="linenos"> 48</span></a> <span class="n">DHASH_ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-49"><a href="#TokenType-49"><span class="linenos"> 49</span></a> <span class="n">LR_ARROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-50"><a href="#TokenType-50"><span class="linenos"> 50</span></a> <span class="n">DOLLAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-51"><a href="#TokenType-51"><span class="linenos"> 51</span></a> <span class="n">PARAMETER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-52"><a href="#TokenType-52"><span class="linenos"> 52</span></a> <span class="n">SESSION_PARAMETER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-53"><a href="#TokenType-53"><span class="linenos"> 53</span></a> <span class="n">NATIONAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-54"><a href="#TokenType-54"><span class="linenos"> 54</span></a> +</span><span id="TokenType-55"><a href="#TokenType-55"><span class="linenos"> 55</span></a> <span class="n">BLOCK_START</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-56"><a href="#TokenType-56"><span class="linenos"> 56</span></a> <span class="n">BLOCK_END</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-57"><a href="#TokenType-57"><span class="linenos"> 57</span></a> +</span><span id="TokenType-58"><a href="#TokenType-58"><span class="linenos"> 58</span></a> <span class="n">SPACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-59"><a href="#TokenType-59"><span class="linenos"> 59</span></a> <span class="n">BREAK</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-60"><a href="#TokenType-60"><span class="linenos"> 60</span></a> +</span><span id="TokenType-61"><a href="#TokenType-61"><span class="linenos"> 61</span></a> <span class="n">STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-62"><a href="#TokenType-62"><span class="linenos"> 62</span></a> <span class="n">NUMBER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-63"><a href="#TokenType-63"><span class="linenos"> 63</span></a> <span class="n">IDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-64"><a href="#TokenType-64"><span class="linenos"> 64</span></a> <span class="n">COLUMN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-65"><a href="#TokenType-65"><span class="linenos"> 65</span></a> <span class="n">COLUMN_DEF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-66"><a href="#TokenType-66"><span class="linenos"> 66</span></a> <span class="n">SCHEMA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-67"><a href="#TokenType-67"><span class="linenos"> 67</span></a> <span class="n">TABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-68"><a href="#TokenType-68"><span class="linenos"> 68</span></a> <span class="n">VAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-69"><a href="#TokenType-69"><span class="linenos"> 69</span></a> <span class="n">BIT_STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-70"><a href="#TokenType-70"><span class="linenos"> 70</span></a> <span class="n">HEX_STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-71"><a href="#TokenType-71"><span class="linenos"> 71</span></a> <span class="n">BYTE_STRING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-72"><a href="#TokenType-72"><span class="linenos"> 72</span></a> +</span><span id="TokenType-73"><a href="#TokenType-73"><span class="linenos"> 73</span></a> <span class="c1"># types</span> +</span><span id="TokenType-74"><a href="#TokenType-74"><span class="linenos"> 74</span></a> <span class="n">BOOLEAN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-75"><a href="#TokenType-75"><span class="linenos"> 75</span></a> <span class="n">TINYINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-76"><a href="#TokenType-76"><span class="linenos"> 76</span></a> <span class="n">SMALLINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-77"><a href="#TokenType-77"><span class="linenos"> 77</span></a> <span class="n">INT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-78"><a href="#TokenType-78"><span class="linenos"> 78</span></a> <span class="n">BIGINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-79"><a href="#TokenType-79"><span class="linenos"> 79</span></a> <span class="n">FLOAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-80"><a href="#TokenType-80"><span class="linenos"> 80</span></a> <span class="n">DOUBLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-81"><a href="#TokenType-81"><span class="linenos"> 81</span></a> <span class="n">DECIMAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-82"><a href="#TokenType-82"><span class="linenos"> 82</span></a> <span class="n">CHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-83"><a href="#TokenType-83"><span class="linenos"> 83</span></a> <span class="n">NCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-84"><a href="#TokenType-84"><span class="linenos"> 84</span></a> <span class="n">VARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-85"><a href="#TokenType-85"><span class="linenos"> 85</span></a> <span class="n">NVARCHAR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-86"><a href="#TokenType-86"><span class="linenos"> 86</span></a> <span class="n">TEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-87"><a href="#TokenType-87"><span class="linenos"> 87</span></a> <span class="n">MEDIUMTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-88"><a href="#TokenType-88"><span class="linenos"> 88</span></a> <span class="n">LONGTEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-89"><a href="#TokenType-89"><span class="linenos"> 89</span></a> <span class="n">MEDIUMBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-90"><a href="#TokenType-90"><span class="linenos"> 90</span></a> <span class="n">LONGBLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-91"><a href="#TokenType-91"><span class="linenos"> 91</span></a> <span class="n">BINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-92"><a href="#TokenType-92"><span class="linenos"> 92</span></a> <span class="n">VARBINARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-93"><a href="#TokenType-93"><span class="linenos"> 93</span></a> <span class="n">JSON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-94"><a href="#TokenType-94"><span class="linenos"> 94</span></a> <span class="n">JSONB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-95"><a href="#TokenType-95"><span class="linenos"> 95</span></a> <span class="n">TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-96"><a href="#TokenType-96"><span class="linenos"> 96</span></a> <span class="n">TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-97"><a href="#TokenType-97"><span class="linenos"> 97</span></a> <span class="n">TIMESTAMPTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-98"><a href="#TokenType-98"><span class="linenos"> 98</span></a> <span class="n">TIMESTAMPLTZ</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-99"><a href="#TokenType-99"><span class="linenos"> 99</span></a> <span class="n">DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-100"><a href="#TokenType-100"><span class="linenos">100</span></a> <span class="n">DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-101"><a href="#TokenType-101"><span class="linenos">101</span></a> <span class="n">UUID</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-102"><a href="#TokenType-102"><span class="linenos">102</span></a> <span class="n">GEOGRAPHY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-103"><a href="#TokenType-103"><span class="linenos">103</span></a> <span class="n">NULLABLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-104"><a href="#TokenType-104"><span class="linenos">104</span></a> <span class="n">GEOMETRY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-105"><a href="#TokenType-105"><span class="linenos">105</span></a> <span class="n">HLLSKETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-106"><a href="#TokenType-106"><span class="linenos">106</span></a> <span class="n">HSTORE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-107"><a href="#TokenType-107"><span class="linenos">107</span></a> <span class="n">SUPER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-108"><a href="#TokenType-108"><span class="linenos">108</span></a> <span class="n">SERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-109"><a href="#TokenType-109"><span class="linenos">109</span></a> <span class="n">SMALLSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-110"><a href="#TokenType-110"><span class="linenos">110</span></a> <span class="n">BIGSERIAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-111"><a href="#TokenType-111"><span class="linenos">111</span></a> <span class="n">XML</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-112"><a href="#TokenType-112"><span class="linenos">112</span></a> <span class="n">UNIQUEIDENTIFIER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-113"><a href="#TokenType-113"><span class="linenos">113</span></a> <span class="n">MONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-114"><a href="#TokenType-114"><span class="linenos">114</span></a> <span class="n">SMALLMONEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-115"><a href="#TokenType-115"><span class="linenos">115</span></a> <span class="n">ROWVERSION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-116"><a href="#TokenType-116"><span class="linenos">116</span></a> <span class="n">IMAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-117"><a href="#TokenType-117"><span class="linenos">117</span></a> <span class="n">VARIANT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-118"><a href="#TokenType-118"><span class="linenos">118</span></a> <span class="n">OBJECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-119"><a href="#TokenType-119"><span class="linenos">119</span></a> +</span><span id="TokenType-120"><a href="#TokenType-120"><span class="linenos">120</span></a> <span class="c1"># keywords</span> +</span><span id="TokenType-121"><a href="#TokenType-121"><span class="linenos">121</span></a> <span class="n">ALIAS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-122"><a href="#TokenType-122"><span class="linenos">122</span></a> <span class="n">ALTER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-123"><a href="#TokenType-123"><span class="linenos">123</span></a> <span class="n">ALWAYS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-124"><a href="#TokenType-124"><span class="linenos">124</span></a> <span class="n">ALL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-125"><a href="#TokenType-125"><span class="linenos">125</span></a> <span class="n">ANTI</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-126"><a href="#TokenType-126"><span class="linenos">126</span></a> <span class="n">ANY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-127"><a href="#TokenType-127"><span class="linenos">127</span></a> <span class="n">APPLY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-128"><a href="#TokenType-128"><span class="linenos">128</span></a> <span class="n">ARRAY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-129"><a href="#TokenType-129"><span class="linenos">129</span></a> <span class="n">ASC</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-130"><a href="#TokenType-130"><span class="linenos">130</span></a> <span class="n">ASOF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-131"><a href="#TokenType-131"><span class="linenos">131</span></a> <span class="n">AT_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-132"><a href="#TokenType-132"><span class="linenos">132</span></a> <span class="n">AUTO_INCREMENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-133"><a href="#TokenType-133"><span class="linenos">133</span></a> <span class="n">BEGIN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-134"><a href="#TokenType-134"><span class="linenos">134</span></a> <span class="n">BETWEEN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-135"><a href="#TokenType-135"><span class="linenos">135</span></a> <span class="n">BOTH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-136"><a href="#TokenType-136"><span class="linenos">136</span></a> <span class="n">BUCKET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-137"><a href="#TokenType-137"><span class="linenos">137</span></a> <span class="n">BY_DEFAULT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-138"><a href="#TokenType-138"><span class="linenos">138</span></a> <span class="n">CACHE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-139"><a href="#TokenType-139"><span class="linenos">139</span></a> <span class="n">CASCADE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-140"><a href="#TokenType-140"><span class="linenos">140</span></a> <span class="n">CASE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-141"><a href="#TokenType-141"><span class="linenos">141</span></a> <span class="n">CHARACTER_SET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-142"><a href="#TokenType-142"><span class="linenos">142</span></a> <span class="n">CHECK</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-143"><a href="#TokenType-143"><span class="linenos">143</span></a> <span class="n">CLUSTER_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-144"><a href="#TokenType-144"><span class="linenos">144</span></a> <span class="n">COLLATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-145"><a href="#TokenType-145"><span class="linenos">145</span></a> <span class="n">COMMAND</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-146"><a href="#TokenType-146"><span class="linenos">146</span></a> <span class="n">COMMENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-147"><a href="#TokenType-147"><span class="linenos">147</span></a> <span class="n">COMMIT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-148"><a href="#TokenType-148"><span class="linenos">148</span></a> <span class="n">COMPOUND</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-149"><a href="#TokenType-149"><span class="linenos">149</span></a> <span class="n">CONSTRAINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-150"><a href="#TokenType-150"><span class="linenos">150</span></a> <span class="n">CREATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-151"><a href="#TokenType-151"><span class="linenos">151</span></a> <span class="n">CROSS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-152"><a href="#TokenType-152"><span class="linenos">152</span></a> <span class="n">CUBE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-153"><a href="#TokenType-153"><span class="linenos">153</span></a> <span class="n">CURRENT_DATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-154"><a href="#TokenType-154"><span class="linenos">154</span></a> <span class="n">CURRENT_DATETIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-155"><a href="#TokenType-155"><span class="linenos">155</span></a> <span class="n">CURRENT_ROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-156"><a href="#TokenType-156"><span class="linenos">156</span></a> <span class="n">CURRENT_TIME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-157"><a href="#TokenType-157"><span class="linenos">157</span></a> <span class="n">CURRENT_TIMESTAMP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-158"><a href="#TokenType-158"><span class="linenos">158</span></a> <span class="n">DEFAULT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-159"><a href="#TokenType-159"><span class="linenos">159</span></a> <span class="n">DELETE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-160"><a href="#TokenType-160"><span class="linenos">160</span></a> <span class="n">DESC</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-161"><a href="#TokenType-161"><span class="linenos">161</span></a> <span class="n">DESCRIBE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-162"><a href="#TokenType-162"><span class="linenos">162</span></a> <span class="n">DISTINCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-163"><a href="#TokenType-163"><span class="linenos">163</span></a> <span class="n">DISTINCT_FROM</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-164"><a href="#TokenType-164"><span class="linenos">164</span></a> <span class="n">DISTRIBUTE_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-165"><a href="#TokenType-165"><span class="linenos">165</span></a> <span class="n">DIV</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-166"><a href="#TokenType-166"><span class="linenos">166</span></a> <span class="n">DROP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-167"><a href="#TokenType-167"><span class="linenos">167</span></a> <span class="n">ELSE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-168"><a href="#TokenType-168"><span class="linenos">168</span></a> <span class="n">ENCODE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-169"><a href="#TokenType-169"><span class="linenos">169</span></a> <span class="n">END</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-170"><a href="#TokenType-170"><span class="linenos">170</span></a> <span class="n">ESCAPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-171"><a href="#TokenType-171"><span class="linenos">171</span></a> <span class="n">EXCEPT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-172"><a href="#TokenType-172"><span class="linenos">172</span></a> <span class="n">EXECUTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-173"><a href="#TokenType-173"><span class="linenos">173</span></a> <span class="n">EXISTS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-174"><a href="#TokenType-174"><span class="linenos">174</span></a> <span class="n">FALSE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-175"><a href="#TokenType-175"><span class="linenos">175</span></a> <span class="n">FETCH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-176"><a href="#TokenType-176"><span class="linenos">176</span></a> <span class="n">FILTER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-177"><a href="#TokenType-177"><span class="linenos">177</span></a> <span class="n">FINAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-178"><a href="#TokenType-178"><span class="linenos">178</span></a> <span class="n">FIRST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-179"><a href="#TokenType-179"><span class="linenos">179</span></a> <span class="n">FOLLOWING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-180"><a href="#TokenType-180"><span class="linenos">180</span></a> <span class="n">FOR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-181"><a href="#TokenType-181"><span class="linenos">181</span></a> <span class="n">FOREIGN_KEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-182"><a href="#TokenType-182"><span class="linenos">182</span></a> <span class="n">FORMAT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-183"><a href="#TokenType-183"><span class="linenos">183</span></a> <span class="n">FROM</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-184"><a href="#TokenType-184"><span class="linenos">184</span></a> <span class="n">FULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-185"><a href="#TokenType-185"><span class="linenos">185</span></a> <span class="n">FUNCTION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-186"><a href="#TokenType-186"><span class="linenos">186</span></a> <span class="n">GENERATED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-187"><a href="#TokenType-187"><span class="linenos">187</span></a> <span class="n">GLOB</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-188"><a href="#TokenType-188"><span class="linenos">188</span></a> <span class="n">GLOBAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-189"><a href="#TokenType-189"><span class="linenos">189</span></a> <span class="n">GROUP_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-190"><a href="#TokenType-190"><span class="linenos">190</span></a> <span class="n">GROUPING_SETS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-191"><a href="#TokenType-191"><span class="linenos">191</span></a> <span class="n">HAVING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-192"><a href="#TokenType-192"><span class="linenos">192</span></a> <span class="n">HINT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-193"><a href="#TokenType-193"><span class="linenos">193</span></a> <span class="n">IDENTITY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-194"><a href="#TokenType-194"><span class="linenos">194</span></a> <span class="n">IF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-195"><a href="#TokenType-195"><span class="linenos">195</span></a> <span class="n">IGNORE_NULLS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-196"><a href="#TokenType-196"><span class="linenos">196</span></a> <span class="n">ILIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-197"><a href="#TokenType-197"><span class="linenos">197</span></a> <span class="n">IN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-198"><a href="#TokenType-198"><span class="linenos">198</span></a> <span class="n">INDEX</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-199"><a href="#TokenType-199"><span class="linenos">199</span></a> <span class="n">INNER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-200"><a href="#TokenType-200"><span class="linenos">200</span></a> <span class="n">INSERT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-201"><a href="#TokenType-201"><span class="linenos">201</span></a> <span class="n">INTERSECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-202"><a href="#TokenType-202"><span class="linenos">202</span></a> <span class="n">INTERVAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-203"><a href="#TokenType-203"><span class="linenos">203</span></a> <span class="n">INTO</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-204"><a href="#TokenType-204"><span class="linenos">204</span></a> <span class="n">INTRODUCER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-205"><a href="#TokenType-205"><span class="linenos">205</span></a> <span class="n">IRLIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-206"><a href="#TokenType-206"><span class="linenos">206</span></a> <span class="n">IS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-207"><a href="#TokenType-207"><span class="linenos">207</span></a> <span class="n">ISNULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-208"><a href="#TokenType-208"><span class="linenos">208</span></a> <span class="n">JOIN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-209"><a href="#TokenType-209"><span class="linenos">209</span></a> <span class="n">LANGUAGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-210"><a href="#TokenType-210"><span class="linenos">210</span></a> <span class="n">LATERAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-211"><a href="#TokenType-211"><span class="linenos">211</span></a> <span class="n">LAZY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-212"><a href="#TokenType-212"><span class="linenos">212</span></a> <span class="n">LEADING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-213"><a href="#TokenType-213"><span class="linenos">213</span></a> <span class="n">LEFT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-214"><a href="#TokenType-214"><span class="linenos">214</span></a> <span class="n">LIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-215"><a href="#TokenType-215"><span class="linenos">215</span></a> <span class="n">LIMIT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-216"><a href="#TokenType-216"><span class="linenos">216</span></a> <span class="n">LOAD_DATA</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-217"><a href="#TokenType-217"><span class="linenos">217</span></a> <span class="n">LOCAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-218"><a href="#TokenType-218"><span class="linenos">218</span></a> <span class="n">MAP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-219"><a href="#TokenType-219"><span class="linenos">219</span></a> <span class="n">MATCH_RECOGNIZE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-220"><a href="#TokenType-220"><span class="linenos">220</span></a> <span class="n">MATERIALIZED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-221"><a href="#TokenType-221"><span class="linenos">221</span></a> <span class="n">MERGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-222"><a href="#TokenType-222"><span class="linenos">222</span></a> <span class="n">MOD</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-223"><a href="#TokenType-223"><span class="linenos">223</span></a> <span class="n">NATURAL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-224"><a href="#TokenType-224"><span class="linenos">224</span></a> <span class="n">NEXT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-225"><a href="#TokenType-225"><span class="linenos">225</span></a> <span class="n">NO_ACTION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-226"><a href="#TokenType-226"><span class="linenos">226</span></a> <span class="n">NOTNULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-227"><a href="#TokenType-227"><span class="linenos">227</span></a> <span class="n">NULL</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-228"><a href="#TokenType-228"><span class="linenos">228</span></a> <span class="n">NULLS_FIRST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-229"><a href="#TokenType-229"><span class="linenos">229</span></a> <span class="n">NULLS_LAST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-230"><a href="#TokenType-230"><span class="linenos">230</span></a> <span class="n">OFFSET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-231"><a href="#TokenType-231"><span class="linenos">231</span></a> <span class="n">ON</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-232"><a href="#TokenType-232"><span class="linenos">232</span></a> <span class="n">ONLY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-233"><a href="#TokenType-233"><span class="linenos">233</span></a> <span class="n">OPTIONS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-234"><a href="#TokenType-234"><span class="linenos">234</span></a> <span class="n">ORDER_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-235"><a href="#TokenType-235"><span class="linenos">235</span></a> <span class="n">ORDERED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-236"><a href="#TokenType-236"><span class="linenos">236</span></a> <span class="n">ORDINALITY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-237"><a href="#TokenType-237"><span class="linenos">237</span></a> <span class="n">OUTER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-238"><a href="#TokenType-238"><span class="linenos">238</span></a> <span class="n">OUT_OF</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-239"><a href="#TokenType-239"><span class="linenos">239</span></a> <span class="n">OVER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-240"><a href="#TokenType-240"><span class="linenos">240</span></a> <span class="n">OVERWRITE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-241"><a href="#TokenType-241"><span class="linenos">241</span></a> <span class="n">PARTITION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-242"><a href="#TokenType-242"><span class="linenos">242</span></a> <span class="n">PARTITION_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-243"><a href="#TokenType-243"><span class="linenos">243</span></a> <span class="n">PERCENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-244"><a href="#TokenType-244"><span class="linenos">244</span></a> <span class="n">PIVOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-245"><a href="#TokenType-245"><span class="linenos">245</span></a> <span class="n">PLACEHOLDER</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-246"><a href="#TokenType-246"><span class="linenos">246</span></a> <span class="n">PRECEDING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-247"><a href="#TokenType-247"><span class="linenos">247</span></a> <span class="n">PRIMARY_KEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-248"><a href="#TokenType-248"><span class="linenos">248</span></a> <span class="n">PROCEDURE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-249"><a href="#TokenType-249"><span class="linenos">249</span></a> <span class="n">PROPERTIES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-250"><a href="#TokenType-250"><span class="linenos">250</span></a> <span class="n">PSEUDO_TYPE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-251"><a href="#TokenType-251"><span class="linenos">251</span></a> <span class="n">QUALIFY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-252"><a href="#TokenType-252"><span class="linenos">252</span></a> <span class="n">QUOTE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-253"><a href="#TokenType-253"><span class="linenos">253</span></a> <span class="n">RANGE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-254"><a href="#TokenType-254"><span class="linenos">254</span></a> <span class="n">RECURSIVE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-255"><a href="#TokenType-255"><span class="linenos">255</span></a> <span class="n">REPLACE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-256"><a href="#TokenType-256"><span class="linenos">256</span></a> <span class="n">RESPECT_NULLS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-257"><a href="#TokenType-257"><span class="linenos">257</span></a> <span class="n">REFERENCES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-258"><a href="#TokenType-258"><span class="linenos">258</span></a> <span class="n">RIGHT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-259"><a href="#TokenType-259"><span class="linenos">259</span></a> <span class="n">RLIKE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-260"><a href="#TokenType-260"><span class="linenos">260</span></a> <span class="n">ROLLBACK</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-261"><a href="#TokenType-261"><span class="linenos">261</span></a> <span class="n">ROLLUP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-262"><a href="#TokenType-262"><span class="linenos">262</span></a> <span class="n">ROW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-263"><a href="#TokenType-263"><span class="linenos">263</span></a> <span class="n">ROWS</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-264"><a href="#TokenType-264"><span class="linenos">264</span></a> <span class="n">SCHEMA_COMMENT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-265"><a href="#TokenType-265"><span class="linenos">265</span></a> <span class="n">SEED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-266"><a href="#TokenType-266"><span class="linenos">266</span></a> <span class="n">SELECT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-267"><a href="#TokenType-267"><span class="linenos">267</span></a> <span class="n">SEMI</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-268"><a href="#TokenType-268"><span class="linenos">268</span></a> <span class="n">SEPARATOR</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-269"><a href="#TokenType-269"><span class="linenos">269</span></a> <span class="n">SERDE_PROPERTIES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-270"><a href="#TokenType-270"><span class="linenos">270</span></a> <span class="n">SET</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-271"><a href="#TokenType-271"><span class="linenos">271</span></a> <span class="n">SHOW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-272"><a href="#TokenType-272"><span class="linenos">272</span></a> <span class="n">SIMILAR_TO</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-273"><a href="#TokenType-273"><span class="linenos">273</span></a> <span class="n">SOME</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-274"><a href="#TokenType-274"><span class="linenos">274</span></a> <span class="n">SORTKEY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-275"><a href="#TokenType-275"><span class="linenos">275</span></a> <span class="n">SORT_BY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-276"><a href="#TokenType-276"><span class="linenos">276</span></a> <span class="n">STRUCT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-277"><a href="#TokenType-277"><span class="linenos">277</span></a> <span class="n">TABLE_SAMPLE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-278"><a href="#TokenType-278"><span class="linenos">278</span></a> <span class="n">TEMPORARY</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-279"><a href="#TokenType-279"><span class="linenos">279</span></a> <span class="n">TOP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-280"><a href="#TokenType-280"><span class="linenos">280</span></a> <span class="n">THEN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-281"><a href="#TokenType-281"><span class="linenos">281</span></a> <span class="n">TRAILING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-282"><a href="#TokenType-282"><span class="linenos">282</span></a> <span class="n">TRUE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-283"><a href="#TokenType-283"><span class="linenos">283</span></a> <span class="n">UNBOUNDED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-284"><a href="#TokenType-284"><span class="linenos">284</span></a> <span class="n">UNCACHE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-285"><a href="#TokenType-285"><span class="linenos">285</span></a> <span class="n">UNION</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-286"><a href="#TokenType-286"><span class="linenos">286</span></a> <span class="n">UNLOGGED</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-287"><a href="#TokenType-287"><span class="linenos">287</span></a> <span class="n">UNNEST</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-288"><a href="#TokenType-288"><span class="linenos">288</span></a> <span class="n">UNPIVOT</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-289"><a href="#TokenType-289"><span class="linenos">289</span></a> <span class="n">UPDATE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-290"><a href="#TokenType-290"><span class="linenos">290</span></a> <span class="n">USE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-291"><a href="#TokenType-291"><span class="linenos">291</span></a> <span class="n">USING</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-292"><a href="#TokenType-292"><span class="linenos">292</span></a> <span class="n">VALUES</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-293"><a href="#TokenType-293"><span class="linenos">293</span></a> <span class="n">VIEW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-294"><a href="#TokenType-294"><span class="linenos">294</span></a> <span class="n">VOLATILE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-295"><a href="#TokenType-295"><span class="linenos">295</span></a> <span class="n">WHEN</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-296"><a href="#TokenType-296"><span class="linenos">296</span></a> <span class="n">WHERE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-297"><a href="#TokenType-297"><span class="linenos">297</span></a> <span class="n">WINDOW</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-298"><a href="#TokenType-298"><span class="linenos">298</span></a> <span class="n">WITH</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-299"><a href="#TokenType-299"><span class="linenos">299</span></a> <span class="n">WITH_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-300"><a href="#TokenType-300"><span class="linenos">300</span></a> <span class="n">WITH_LOCAL_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-301"><a href="#TokenType-301"><span class="linenos">301</span></a> <span class="n">WITHIN_GROUP</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-302"><a href="#TokenType-302"><span class="linenos">302</span></a> <span class="n">WITHOUT_TIME_ZONE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span><span id="TokenType-303"><a href="#TokenType-303"><span class="linenos">303</span></a> <span class="n">UNIQUE</span> <span class="o">=</span> <span class="n">auto</span><span class="p">()</span> +</span></pre></div> + + + <div class="docstring"><p>An enumeration.</p> +</div> + + + <div id="TokenType.L_PAREN" class="classattr"> + <div class="attr variable"> + <span class="name">L_PAREN</span><span class="default_value"> = <<a href="#TokenType.L_PAREN">TokenType.L_PAREN</a>: 'L_PAREN'></span> + + + </div> + <a class="headerlink" href="#TokenType.L_PAREN"></a> + + + + </div> + <div id="TokenType.R_PAREN" class="classattr"> + <div class="attr variable"> + <span class="name">R_PAREN</span><span class="default_value"> = <<a href="#TokenType.R_PAREN">TokenType.R_PAREN</a>: 'R_PAREN'></span> + + + </div> + <a class="headerlink" href="#TokenType.R_PAREN"></a> + + + + </div> + <div id="TokenType.L_BRACKET" class="classattr"> + <div class="attr variable"> + <span class="name">L_BRACKET</span><span class="default_value"> = <<a href="#TokenType.L_BRACKET">TokenType.L_BRACKET</a>: 'L_BRACKET'></span> + + + </div> + <a class="headerlink" href="#TokenType.L_BRACKET"></a> + + + + </div> + <div id="TokenType.R_BRACKET" class="classattr"> + <div class="attr variable"> + <span class="name">R_BRACKET</span><span class="default_value"> = <<a href="#TokenType.R_BRACKET">TokenType.R_BRACKET</a>: 'R_BRACKET'></span> + + + </div> + <a class="headerlink" href="#TokenType.R_BRACKET"></a> + + + + </div> + <div id="TokenType.L_BRACE" class="classattr"> + <div class="attr variable"> + <span class="name">L_BRACE</span><span class="default_value"> = <<a href="#TokenType.L_BRACE">TokenType.L_BRACE</a>: 'L_BRACE'></span> + + + </div> + <a class="headerlink" href="#TokenType.L_BRACE"></a> + + + + </div> + <div id="TokenType.R_BRACE" class="classattr"> + <div class="attr variable"> + <span class="name">R_BRACE</span><span class="default_value"> = <<a href="#TokenType.R_BRACE">TokenType.R_BRACE</a>: 'R_BRACE'></span> + + + </div> + <a class="headerlink" href="#TokenType.R_BRACE"></a> + + + + </div> + <div id="TokenType.COMMA" class="classattr"> + <div class="attr variable"> + <span class="name">COMMA</span><span class="default_value"> = <<a href="#TokenType.COMMA">TokenType.COMMA</a>: 'COMMA'></span> + + + </div> + <a class="headerlink" href="#TokenType.COMMA"></a> + + + + </div> + <div id="TokenType.DOT" class="classattr"> + <div class="attr variable"> + <span class="name">DOT</span><span class="default_value"> = <<a href="#TokenType.DOT">TokenType.DOT</a>: 'DOT'></span> + + + </div> + <a class="headerlink" href="#TokenType.DOT"></a> + + + + </div> + <div id="TokenType.DASH" class="classattr"> + <div class="attr variable"> + <span class="name">DASH</span><span class="default_value"> = <<a href="#TokenType.DASH">TokenType.DASH</a>: 'DASH'></span> + + + </div> + <a class="headerlink" href="#TokenType.DASH"></a> + + + + </div> + <div id="TokenType.PLUS" class="classattr"> + <div class="attr variable"> + <span class="name">PLUS</span><span class="default_value"> = <<a href="#TokenType.PLUS">TokenType.PLUS</a>: 'PLUS'></span> + + + </div> + <a class="headerlink" href="#TokenType.PLUS"></a> + + + + </div> + <div id="TokenType.COLON" class="classattr"> + <div class="attr variable"> + <span class="name">COLON</span><span class="default_value"> = <<a href="#TokenType.COLON">TokenType.COLON</a>: 'COLON'></span> + + + </div> + <a class="headerlink" href="#TokenType.COLON"></a> + + + + </div> + <div id="TokenType.DCOLON" class="classattr"> + <div class="attr variable"> + <span class="name">DCOLON</span><span class="default_value"> = <<a href="#TokenType.DCOLON">TokenType.DCOLON</a>: 'DCOLON'></span> + + + </div> + <a class="headerlink" href="#TokenType.DCOLON"></a> + + + + </div> + <div id="TokenType.SEMICOLON" class="classattr"> + <div class="attr variable"> + <span class="name">SEMICOLON</span><span class="default_value"> = <<a href="#TokenType.SEMICOLON">TokenType.SEMICOLON</a>: 'SEMICOLON'></span> + + + </div> + <a class="headerlink" href="#TokenType.SEMICOLON"></a> + + + + </div> + <div id="TokenType.STAR" class="classattr"> + <div class="attr variable"> + <span class="name">STAR</span><span class="default_value"> = <<a href="#TokenType.STAR">TokenType.STAR</a>: 'STAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.STAR"></a> + + + + </div> + <div id="TokenType.BACKSLASH" class="classattr"> + <div class="attr variable"> + <span class="name">BACKSLASH</span><span class="default_value"> = <<a href="#TokenType.BACKSLASH">TokenType.BACKSLASH</a>: 'BACKSLASH'></span> + + + </div> + <a class="headerlink" href="#TokenType.BACKSLASH"></a> + + + + </div> + <div id="TokenType.SLASH" class="classattr"> + <div class="attr variable"> + <span class="name">SLASH</span><span class="default_value"> = <<a href="#TokenType.SLASH">TokenType.SLASH</a>: 'SLASH'></span> + + + </div> + <a class="headerlink" href="#TokenType.SLASH"></a> + + + + </div> + <div id="TokenType.LT" class="classattr"> + <div class="attr variable"> + <span class="name">LT</span><span class="default_value"> = <<a href="#TokenType.LT">TokenType.LT</a>: 'LT'></span> + + + </div> + <a class="headerlink" href="#TokenType.LT"></a> + + + + </div> + <div id="TokenType.LTE" class="classattr"> + <div class="attr variable"> + <span class="name">LTE</span><span class="default_value"> = <<a href="#TokenType.LTE">TokenType.LTE</a>: 'LTE'></span> + + + </div> + <a class="headerlink" href="#TokenType.LTE"></a> + + + + </div> + <div id="TokenType.GT" class="classattr"> + <div class="attr variable"> + <span class="name">GT</span><span class="default_value"> = <<a href="#TokenType.GT">TokenType.GT</a>: 'GT'></span> + + + </div> + <a class="headerlink" href="#TokenType.GT"></a> + + + + </div> + <div id="TokenType.GTE" class="classattr"> + <div class="attr variable"> + <span class="name">GTE</span><span class="default_value"> = <<a href="#TokenType.GTE">TokenType.GTE</a>: 'GTE'></span> + + + </div> + <a class="headerlink" href="#TokenType.GTE"></a> + + + + </div> + <div id="TokenType.NOT" class="classattr"> + <div class="attr variable"> + <span class="name">NOT</span><span class="default_value"> = <<a href="#TokenType.NOT">TokenType.NOT</a>: 'NOT'></span> + + + </div> + <a class="headerlink" href="#TokenType.NOT"></a> + + + + </div> + <div id="TokenType.EQ" class="classattr"> + <div class="attr variable"> + <span class="name">EQ</span><span class="default_value"> = <<a href="#TokenType.EQ">TokenType.EQ</a>: 'EQ'></span> + + + </div> + <a class="headerlink" href="#TokenType.EQ"></a> + + + + </div> + <div id="TokenType.NEQ" class="classattr"> + <div class="attr variable"> + <span class="name">NEQ</span><span class="default_value"> = <<a href="#TokenType.NEQ">TokenType.NEQ</a>: 'NEQ'></span> + + + </div> + <a class="headerlink" href="#TokenType.NEQ"></a> + + + + </div> + <div id="TokenType.NULLSAFE_EQ" class="classattr"> + <div class="attr variable"> + <span class="name">NULLSAFE_EQ</span><span class="default_value"> = <<a href="#TokenType.NULLSAFE_EQ">TokenType.NULLSAFE_EQ</a>: 'NULLSAFE_EQ'></span> + + + </div> + <a class="headerlink" href="#TokenType.NULLSAFE_EQ"></a> + + + + </div> + <div id="TokenType.AND" class="classattr"> + <div class="attr variable"> + <span class="name">AND</span><span class="default_value"> = <<a href="#TokenType.AND">TokenType.AND</a>: 'AND'></span> + + + </div> + <a class="headerlink" href="#TokenType.AND"></a> + + + + </div> + <div id="TokenType.OR" class="classattr"> + <div class="attr variable"> + <span class="name">OR</span><span class="default_value"> = <<a href="#TokenType.OR">TokenType.OR</a>: 'OR'></span> + + + </div> + <a class="headerlink" href="#TokenType.OR"></a> + + + + </div> + <div id="TokenType.AMP" class="classattr"> + <div class="attr variable"> + <span class="name">AMP</span><span class="default_value"> = <<a href="#TokenType.AMP">TokenType.AMP</a>: 'AMP'></span> + + + </div> + <a class="headerlink" href="#TokenType.AMP"></a> + + + + </div> + <div id="TokenType.DPIPE" class="classattr"> + <div class="attr variable"> + <span class="name">DPIPE</span><span class="default_value"> = <<a href="#TokenType.DPIPE">TokenType.DPIPE</a>: 'DPIPE'></span> + + + </div> + <a class="headerlink" href="#TokenType.DPIPE"></a> + + + + </div> + <div id="TokenType.PIPE" class="classattr"> + <div class="attr variable"> + <span class="name">PIPE</span><span class="default_value"> = <<a href="#TokenType.PIPE">TokenType.PIPE</a>: 'PIPE'></span> + + + </div> + <a class="headerlink" href="#TokenType.PIPE"></a> + + + + </div> + <div id="TokenType.CARET" class="classattr"> + <div class="attr variable"> + <span class="name">CARET</span><span class="default_value"> = <<a href="#TokenType.CARET">TokenType.CARET</a>: 'CARET'></span> + + + </div> + <a class="headerlink" href="#TokenType.CARET"></a> + + + + </div> + <div id="TokenType.TILDA" class="classattr"> + <div class="attr variable"> + <span class="name">TILDA</span><span class="default_value"> = <<a href="#TokenType.TILDA">TokenType.TILDA</a>: 'TILDA'></span> + + + </div> + <a class="headerlink" href="#TokenType.TILDA"></a> + + + + </div> + <div id="TokenType.ARROW" class="classattr"> + <div class="attr variable"> + <span class="name">ARROW</span><span class="default_value"> = <<a href="#TokenType.ARROW">TokenType.ARROW</a>: 'ARROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.ARROW"></a> + + + + </div> + <div id="TokenType.DARROW" class="classattr"> + <div class="attr variable"> + <span class="name">DARROW</span><span class="default_value"> = <<a href="#TokenType.DARROW">TokenType.DARROW</a>: 'DARROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.DARROW"></a> + + + + </div> + <div id="TokenType.FARROW" class="classattr"> + <div class="attr variable"> + <span class="name">FARROW</span><span class="default_value"> = <<a href="#TokenType.FARROW">TokenType.FARROW</a>: 'FARROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.FARROW"></a> + + + + </div> + <div id="TokenType.HASH" class="classattr"> + <div class="attr variable"> + <span class="name">HASH</span><span class="default_value"> = <<a href="#TokenType.HASH">TokenType.HASH</a>: 'HASH'></span> + + + </div> + <a class="headerlink" href="#TokenType.HASH"></a> + + + + </div> + <div id="TokenType.HASH_ARROW" class="classattr"> + <div class="attr variable"> + <span class="name">HASH_ARROW</span><span class="default_value"> = <<a href="#TokenType.HASH_ARROW">TokenType.HASH_ARROW</a>: 'HASH_ARROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.HASH_ARROW"></a> + + + + </div> + <div id="TokenType.DHASH_ARROW" class="classattr"> + <div class="attr variable"> + <span class="name">DHASH_ARROW</span><span class="default_value"> = <<a href="#TokenType.DHASH_ARROW">TokenType.DHASH_ARROW</a>: 'DHASH_ARROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.DHASH_ARROW"></a> + + + + </div> + <div id="TokenType.LR_ARROW" class="classattr"> + <div class="attr variable"> + <span class="name">LR_ARROW</span><span class="default_value"> = <<a href="#TokenType.LR_ARROW">TokenType.LR_ARROW</a>: 'LR_ARROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.LR_ARROW"></a> + + + + </div> + <div id="TokenType.DOLLAR" class="classattr"> + <div class="attr variable"> + <span class="name">DOLLAR</span><span class="default_value"> = <<a href="#TokenType.DOLLAR">TokenType.DOLLAR</a>: 'DOLLAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.DOLLAR"></a> + + + + </div> + <div id="TokenType.PARAMETER" class="classattr"> + <div class="attr variable"> + <span class="name">PARAMETER</span><span class="default_value"> = <<a href="#TokenType.PARAMETER">TokenType.PARAMETER</a>: 'PARAMETER'></span> + + + </div> + <a class="headerlink" href="#TokenType.PARAMETER"></a> + + + + </div> + <div id="TokenType.SESSION_PARAMETER" class="classattr"> + <div class="attr variable"> + <span class="name">SESSION_PARAMETER</span><span class="default_value"> = <<a href="#TokenType.SESSION_PARAMETER">TokenType.SESSION_PARAMETER</a>: 'SESSION_PARAMETER'></span> + + + </div> + <a class="headerlink" href="#TokenType.SESSION_PARAMETER"></a> + + + + </div> + <div id="TokenType.NATIONAL" class="classattr"> + <div class="attr variable"> + <span class="name">NATIONAL</span><span class="default_value"> = <<a href="#TokenType.NATIONAL">TokenType.NATIONAL</a>: 'NATIONAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.NATIONAL"></a> + + + + </div> + <div id="TokenType.BLOCK_START" class="classattr"> + <div class="attr variable"> + <span class="name">BLOCK_START</span><span class="default_value"> = <<a href="#TokenType.BLOCK_START">TokenType.BLOCK_START</a>: 'BLOCK_START'></span> + + + </div> + <a class="headerlink" href="#TokenType.BLOCK_START"></a> + + + + </div> + <div id="TokenType.BLOCK_END" class="classattr"> + <div class="attr variable"> + <span class="name">BLOCK_END</span><span class="default_value"> = <<a href="#TokenType.BLOCK_END">TokenType.BLOCK_END</a>: 'BLOCK_END'></span> + + + </div> + <a class="headerlink" href="#TokenType.BLOCK_END"></a> + + + + </div> + <div id="TokenType.SPACE" class="classattr"> + <div class="attr variable"> + <span class="name">SPACE</span><span class="default_value"> = <<a href="#TokenType.SPACE">TokenType.SPACE</a>: 'SPACE'></span> + + + </div> + <a class="headerlink" href="#TokenType.SPACE"></a> + + + + </div> + <div id="TokenType.BREAK" class="classattr"> + <div class="attr variable"> + <span class="name">BREAK</span><span class="default_value"> = <<a href="#TokenType.BREAK">TokenType.BREAK</a>: 'BREAK'></span> + + + </div> + <a class="headerlink" href="#TokenType.BREAK"></a> + + + + </div> + <div id="TokenType.STRING" class="classattr"> + <div class="attr variable"> + <span class="name">STRING</span><span class="default_value"> = <<a href="#TokenType.STRING">TokenType.STRING</a>: 'STRING'></span> + + + </div> + <a class="headerlink" href="#TokenType.STRING"></a> + + + + </div> + <div id="TokenType.NUMBER" class="classattr"> + <div class="attr variable"> + <span class="name">NUMBER</span><span class="default_value"> = <<a href="#TokenType.NUMBER">TokenType.NUMBER</a>: 'NUMBER'></span> + + + </div> + <a class="headerlink" href="#TokenType.NUMBER"></a> + + + + </div> + <div id="TokenType.IDENTIFIER" class="classattr"> + <div class="attr variable"> + <span class="name">IDENTIFIER</span><span class="default_value"> = <<a href="#TokenType.IDENTIFIER">TokenType.IDENTIFIER</a>: 'IDENTIFIER'></span> + + + </div> + <a class="headerlink" href="#TokenType.IDENTIFIER"></a> + + + + </div> + <div id="TokenType.COLUMN" class="classattr"> + <div class="attr variable"> + <span class="name">COLUMN</span><span class="default_value"> = <<a href="#TokenType.COLUMN">TokenType.COLUMN</a>: 'COLUMN'></span> + + + </div> + <a class="headerlink" href="#TokenType.COLUMN"></a> + + + + </div> + <div id="TokenType.COLUMN_DEF" class="classattr"> + <div class="attr variable"> + <span class="name">COLUMN_DEF</span><span class="default_value"> = <<a href="#TokenType.COLUMN_DEF">TokenType.COLUMN_DEF</a>: 'COLUMN_DEF'></span> + + + </div> + <a class="headerlink" href="#TokenType.COLUMN_DEF"></a> + + + + </div> + <div id="TokenType.SCHEMA" class="classattr"> + <div class="attr variable"> + <span class="name">SCHEMA</span><span class="default_value"> = <<a href="#TokenType.SCHEMA">TokenType.SCHEMA</a>: 'SCHEMA'></span> + + + </div> + <a class="headerlink" href="#TokenType.SCHEMA"></a> + + + + </div> + <div id="TokenType.TABLE" class="classattr"> + <div class="attr variable"> + <span class="name">TABLE</span><span class="default_value"> = <<a href="#TokenType.TABLE">TokenType.TABLE</a>: 'TABLE'></span> + + + </div> + <a class="headerlink" href="#TokenType.TABLE"></a> + + + + </div> + <div id="TokenType.VAR" class="classattr"> + <div class="attr variable"> + <span class="name">VAR</span><span class="default_value"> = <<a href="#TokenType.VAR">TokenType.VAR</a>: 'VAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.VAR"></a> + + + + </div> + <div id="TokenType.BIT_STRING" class="classattr"> + <div class="attr variable"> + <span class="name">BIT_STRING</span><span class="default_value"> = <<a href="#TokenType.BIT_STRING">TokenType.BIT_STRING</a>: 'BIT_STRING'></span> + + + </div> + <a class="headerlink" href="#TokenType.BIT_STRING"></a> + + + + </div> + <div id="TokenType.HEX_STRING" class="classattr"> + <div class="attr variable"> + <span class="name">HEX_STRING</span><span class="default_value"> = <<a href="#TokenType.HEX_STRING">TokenType.HEX_STRING</a>: 'HEX_STRING'></span> + + + </div> + <a class="headerlink" href="#TokenType.HEX_STRING"></a> + + + + </div> + <div id="TokenType.BYTE_STRING" class="classattr"> + <div class="attr variable"> + <span class="name">BYTE_STRING</span><span class="default_value"> = <<a href="#TokenType.BYTE_STRING">TokenType.BYTE_STRING</a>: 'BYTE_STRING'></span> + + + </div> + <a class="headerlink" href="#TokenType.BYTE_STRING"></a> + + + + </div> + <div id="TokenType.BOOLEAN" class="classattr"> + <div class="attr variable"> + <span class="name">BOOLEAN</span><span class="default_value"> = <<a href="#TokenType.BOOLEAN">TokenType.BOOLEAN</a>: 'BOOLEAN'></span> + + + </div> + <a class="headerlink" href="#TokenType.BOOLEAN"></a> + + + + </div> + <div id="TokenType.TINYINT" class="classattr"> + <div class="attr variable"> + <span class="name">TINYINT</span><span class="default_value"> = <<a href="#TokenType.TINYINT">TokenType.TINYINT</a>: 'TINYINT'></span> + + + </div> + <a class="headerlink" href="#TokenType.TINYINT"></a> + + + + </div> + <div id="TokenType.SMALLINT" class="classattr"> + <div class="attr variable"> + <span class="name">SMALLINT</span><span class="default_value"> = <<a href="#TokenType.SMALLINT">TokenType.SMALLINT</a>: 'SMALLINT'></span> + + + </div> + <a class="headerlink" href="#TokenType.SMALLINT"></a> + + + + </div> + <div id="TokenType.INT" class="classattr"> + <div class="attr variable"> + <span class="name">INT</span><span class="default_value"> = <<a href="#TokenType.INT">TokenType.INT</a>: 'INT'></span> + + + </div> + <a class="headerlink" href="#TokenType.INT"></a> + + + + </div> + <div id="TokenType.BIGINT" class="classattr"> + <div class="attr variable"> + <span class="name">BIGINT</span><span class="default_value"> = <<a href="#TokenType.BIGINT">TokenType.BIGINT</a>: 'BIGINT'></span> + + + </div> + <a class="headerlink" href="#TokenType.BIGINT"></a> + + + + </div> + <div id="TokenType.FLOAT" class="classattr"> + <div class="attr variable"> + <span class="name">FLOAT</span><span class="default_value"> = <<a href="#TokenType.FLOAT">TokenType.FLOAT</a>: 'FLOAT'></span> + + + </div> + <a class="headerlink" href="#TokenType.FLOAT"></a> + + + + </div> + <div id="TokenType.DOUBLE" class="classattr"> + <div class="attr variable"> + <span class="name">DOUBLE</span><span class="default_value"> = <<a href="#TokenType.DOUBLE">TokenType.DOUBLE</a>: 'DOUBLE'></span> + + + </div> + <a class="headerlink" href="#TokenType.DOUBLE"></a> + + + + </div> + <div id="TokenType.DECIMAL" class="classattr"> + <div class="attr variable"> + <span class="name">DECIMAL</span><span class="default_value"> = <<a href="#TokenType.DECIMAL">TokenType.DECIMAL</a>: 'DECIMAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.DECIMAL"></a> + + + + </div> + <div id="TokenType.CHAR" class="classattr"> + <div class="attr variable"> + <span class="name">CHAR</span><span class="default_value"> = <<a href="#TokenType.CHAR">TokenType.CHAR</a>: 'CHAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.CHAR"></a> + + + + </div> + <div id="TokenType.NCHAR" class="classattr"> + <div class="attr variable"> + <span class="name">NCHAR</span><span class="default_value"> = <<a href="#TokenType.NCHAR">TokenType.NCHAR</a>: 'NCHAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.NCHAR"></a> + + + + </div> + <div id="TokenType.VARCHAR" class="classattr"> + <div class="attr variable"> + <span class="name">VARCHAR</span><span class="default_value"> = <<a href="#TokenType.VARCHAR">TokenType.VARCHAR</a>: 'VARCHAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.VARCHAR"></a> + + + + </div> + <div id="TokenType.NVARCHAR" class="classattr"> + <div class="attr variable"> + <span class="name">NVARCHAR</span><span class="default_value"> = <<a href="#TokenType.NVARCHAR">TokenType.NVARCHAR</a>: 'NVARCHAR'></span> + + + </div> + <a class="headerlink" href="#TokenType.NVARCHAR"></a> + + + + </div> + <div id="TokenType.TEXT" class="classattr"> + <div class="attr variable"> + <span class="name">TEXT</span><span class="default_value"> = <<a href="#TokenType.TEXT">TokenType.TEXT</a>: 'TEXT'></span> + + + </div> + <a class="headerlink" href="#TokenType.TEXT"></a> + + + + </div> + <div id="TokenType.MEDIUMTEXT" class="classattr"> + <div class="attr variable"> + <span class="name">MEDIUMTEXT</span><span class="default_value"> = <<a href="#TokenType.MEDIUMTEXT">TokenType.MEDIUMTEXT</a>: 'MEDIUMTEXT'></span> + + + </div> + <a class="headerlink" href="#TokenType.MEDIUMTEXT"></a> + + + + </div> + <div id="TokenType.LONGTEXT" class="classattr"> + <div class="attr variable"> + <span class="name">LONGTEXT</span><span class="default_value"> = <<a href="#TokenType.LONGTEXT">TokenType.LONGTEXT</a>: 'LONGTEXT'></span> + + + </div> + <a class="headerlink" href="#TokenType.LONGTEXT"></a> + + + + </div> + <div id="TokenType.MEDIUMBLOB" class="classattr"> + <div class="attr variable"> + <span class="name">MEDIUMBLOB</span><span class="default_value"> = <<a href="#TokenType.MEDIUMBLOB">TokenType.MEDIUMBLOB</a>: 'MEDIUMBLOB'></span> + + + </div> + <a class="headerlink" href="#TokenType.MEDIUMBLOB"></a> + + + + </div> + <div id="TokenType.LONGBLOB" class="classattr"> + <div class="attr variable"> + <span class="name">LONGBLOB</span><span class="default_value"> = <<a href="#TokenType.LONGBLOB">TokenType.LONGBLOB</a>: 'LONGBLOB'></span> + + + </div> + <a class="headerlink" href="#TokenType.LONGBLOB"></a> + + + + </div> + <div id="TokenType.BINARY" class="classattr"> + <div class="attr variable"> + <span class="name">BINARY</span><span class="default_value"> = <<a href="#TokenType.BINARY">TokenType.BINARY</a>: 'BINARY'></span> + + + </div> + <a class="headerlink" href="#TokenType.BINARY"></a> + + + + </div> + <div id="TokenType.VARBINARY" class="classattr"> + <div class="attr variable"> + <span class="name">VARBINARY</span><span class="default_value"> = <<a href="#TokenType.VARBINARY">TokenType.VARBINARY</a>: 'VARBINARY'></span> + + + </div> + <a class="headerlink" href="#TokenType.VARBINARY"></a> + + + + </div> + <div id="TokenType.JSON" class="classattr"> + <div class="attr variable"> + <span class="name">JSON</span><span class="default_value"> = <<a href="#TokenType.JSON">TokenType.JSON</a>: 'JSON'></span> + + + </div> + <a class="headerlink" href="#TokenType.JSON"></a> + + + + </div> + <div id="TokenType.JSONB" class="classattr"> + <div class="attr variable"> + <span class="name">JSONB</span><span class="default_value"> = <<a href="#TokenType.JSONB">TokenType.JSONB</a>: 'JSONB'></span> + + + </div> + <a class="headerlink" href="#TokenType.JSONB"></a> + + + + </div> + <div id="TokenType.TIME" class="classattr"> + <div class="attr variable"> + <span class="name">TIME</span><span class="default_value"> = <<a href="#TokenType.TIME">TokenType.TIME</a>: 'TIME'></span> + + + </div> + <a class="headerlink" href="#TokenType.TIME"></a> + + + + </div> + <div id="TokenType.TIMESTAMP" class="classattr"> + <div class="attr variable"> + <span class="name">TIMESTAMP</span><span class="default_value"> = <<a href="#TokenType.TIMESTAMP">TokenType.TIMESTAMP</a>: 'TIMESTAMP'></span> + + + </div> + <a class="headerlink" href="#TokenType.TIMESTAMP"></a> + + + + </div> + <div id="TokenType.TIMESTAMPTZ" class="classattr"> + <div class="attr variable"> + <span class="name">TIMESTAMPTZ</span><span class="default_value"> = <<a href="#TokenType.TIMESTAMPTZ">TokenType.TIMESTAMPTZ</a>: 'TIMESTAMPTZ'></span> + + + </div> + <a class="headerlink" href="#TokenType.TIMESTAMPTZ"></a> + + + + </div> + <div id="TokenType.TIMESTAMPLTZ" class="classattr"> + <div class="attr variable"> + <span class="name">TIMESTAMPLTZ</span><span class="default_value"> = <<a href="#TokenType.TIMESTAMPLTZ">TokenType.TIMESTAMPLTZ</a>: 'TIMESTAMPLTZ'></span> + + + </div> + <a class="headerlink" href="#TokenType.TIMESTAMPLTZ"></a> + + + + </div> + <div id="TokenType.DATETIME" class="classattr"> + <div class="attr variable"> + <span class="name">DATETIME</span><span class="default_value"> = <<a href="#TokenType.DATETIME">TokenType.DATETIME</a>: 'DATETIME'></span> + + + </div> + <a class="headerlink" href="#TokenType.DATETIME"></a> + + + + </div> + <div id="TokenType.DATE" class="classattr"> + <div class="attr variable"> + <span class="name">DATE</span><span class="default_value"> = <<a href="#TokenType.DATE">TokenType.DATE</a>: 'DATE'></span> + + + </div> + <a class="headerlink" href="#TokenType.DATE"></a> + + + + </div> + <div id="TokenType.UUID" class="classattr"> + <div class="attr variable"> + <span class="name">UUID</span><span class="default_value"> = <<a href="#TokenType.UUID">TokenType.UUID</a>: 'UUID'></span> + + + </div> + <a class="headerlink" href="#TokenType.UUID"></a> + + + + </div> + <div id="TokenType.GEOGRAPHY" class="classattr"> + <div class="attr variable"> + <span class="name">GEOGRAPHY</span><span class="default_value"> = <<a href="#TokenType.GEOGRAPHY">TokenType.GEOGRAPHY</a>: 'GEOGRAPHY'></span> + + + </div> + <a class="headerlink" href="#TokenType.GEOGRAPHY"></a> + + + + </div> + <div id="TokenType.NULLABLE" class="classattr"> + <div class="attr variable"> + <span class="name">NULLABLE</span><span class="default_value"> = <<a href="#TokenType.NULLABLE">TokenType.NULLABLE</a>: 'NULLABLE'></span> + + + </div> + <a class="headerlink" href="#TokenType.NULLABLE"></a> + + + + </div> + <div id="TokenType.GEOMETRY" class="classattr"> + <div class="attr variable"> + <span class="name">GEOMETRY</span><span class="default_value"> = <<a href="#TokenType.GEOMETRY">TokenType.GEOMETRY</a>: 'GEOMETRY'></span> + + + </div> + <a class="headerlink" href="#TokenType.GEOMETRY"></a> + + + + </div> + <div id="TokenType.HLLSKETCH" class="classattr"> + <div class="attr variable"> + <span class="name">HLLSKETCH</span><span class="default_value"> = <<a href="#TokenType.HLLSKETCH">TokenType.HLLSKETCH</a>: 'HLLSKETCH'></span> + + + </div> + <a class="headerlink" href="#TokenType.HLLSKETCH"></a> + + + + </div> + <div id="TokenType.HSTORE" class="classattr"> + <div class="attr variable"> + <span class="name">HSTORE</span><span class="default_value"> = <<a href="#TokenType.HSTORE">TokenType.HSTORE</a>: 'HSTORE'></span> + + + </div> + <a class="headerlink" href="#TokenType.HSTORE"></a> + + + + </div> + <div id="TokenType.SUPER" class="classattr"> + <div class="attr variable"> + <span class="name">SUPER</span><span class="default_value"> = <<a href="#TokenType.SUPER">TokenType.SUPER</a>: 'SUPER'></span> + + + </div> + <a class="headerlink" href="#TokenType.SUPER"></a> + + + + </div> + <div id="TokenType.SERIAL" class="classattr"> + <div class="attr variable"> + <span class="name">SERIAL</span><span class="default_value"> = <<a href="#TokenType.SERIAL">TokenType.SERIAL</a>: 'SERIAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.SERIAL"></a> + + + + </div> + <div id="TokenType.SMALLSERIAL" class="classattr"> + <div class="attr variable"> + <span class="name">SMALLSERIAL</span><span class="default_value"> = <<a href="#TokenType.SMALLSERIAL">TokenType.SMALLSERIAL</a>: 'SMALLSERIAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.SMALLSERIAL"></a> + + + + </div> + <div id="TokenType.BIGSERIAL" class="classattr"> + <div class="attr variable"> + <span class="name">BIGSERIAL</span><span class="default_value"> = <<a href="#TokenType.BIGSERIAL">TokenType.BIGSERIAL</a>: 'BIGSERIAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.BIGSERIAL"></a> + + + + </div> + <div id="TokenType.XML" class="classattr"> + <div class="attr variable"> + <span class="name">XML</span><span class="default_value"> = <<a href="#TokenType.XML">TokenType.XML</a>: 'XML'></span> + + + </div> + <a class="headerlink" href="#TokenType.XML"></a> + + + + </div> + <div id="TokenType.UNIQUEIDENTIFIER" class="classattr"> + <div class="attr variable"> + <span class="name">UNIQUEIDENTIFIER</span><span class="default_value"> = <<a href="#TokenType.UNIQUEIDENTIFIER">TokenType.UNIQUEIDENTIFIER</a>: 'UNIQUEIDENTIFIER'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNIQUEIDENTIFIER"></a> + + + + </div> + <div id="TokenType.MONEY" class="classattr"> + <div class="attr variable"> + <span class="name">MONEY</span><span class="default_value"> = <<a href="#TokenType.MONEY">TokenType.MONEY</a>: 'MONEY'></span> + + + </div> + <a class="headerlink" href="#TokenType.MONEY"></a> + + + + </div> + <div id="TokenType.SMALLMONEY" class="classattr"> + <div class="attr variable"> + <span class="name">SMALLMONEY</span><span class="default_value"> = <<a href="#TokenType.SMALLMONEY">TokenType.SMALLMONEY</a>: 'SMALLMONEY'></span> + + + </div> + <a class="headerlink" href="#TokenType.SMALLMONEY"></a> + + + + </div> + <div id="TokenType.ROWVERSION" class="classattr"> + <div class="attr variable"> + <span class="name">ROWVERSION</span><span class="default_value"> = <<a href="#TokenType.ROWVERSION">TokenType.ROWVERSION</a>: 'ROWVERSION'></span> + + + </div> + <a class="headerlink" href="#TokenType.ROWVERSION"></a> + + + + </div> + <div id="TokenType.IMAGE" class="classattr"> + <div class="attr variable"> + <span class="name">IMAGE</span><span class="default_value"> = <<a href="#TokenType.IMAGE">TokenType.IMAGE</a>: 'IMAGE'></span> + + + </div> + <a class="headerlink" href="#TokenType.IMAGE"></a> + + + + </div> + <div id="TokenType.VARIANT" class="classattr"> + <div class="attr variable"> + <span class="name">VARIANT</span><span class="default_value"> = <<a href="#TokenType.VARIANT">TokenType.VARIANT</a>: 'VARIANT'></span> + + + </div> + <a class="headerlink" href="#TokenType.VARIANT"></a> + + + + </div> + <div id="TokenType.OBJECT" class="classattr"> + <div class="attr variable"> + <span class="name">OBJECT</span><span class="default_value"> = <<a href="#TokenType.OBJECT">TokenType.OBJECT</a>: 'OBJECT'></span> + + + </div> + <a class="headerlink" href="#TokenType.OBJECT"></a> + + + + </div> + <div id="TokenType.ALIAS" class="classattr"> + <div class="attr variable"> + <span class="name">ALIAS</span><span class="default_value"> = <<a href="#TokenType.ALIAS">TokenType.ALIAS</a>: 'ALIAS'></span> + + + </div> + <a class="headerlink" href="#TokenType.ALIAS"></a> + + + + </div> + <div id="TokenType.ALTER" class="classattr"> + <div class="attr variable"> + <span class="name">ALTER</span><span class="default_value"> = <<a href="#TokenType.ALTER">TokenType.ALTER</a>: 'ALTER'></span> + + + </div> + <a class="headerlink" href="#TokenType.ALTER"></a> + + + + </div> + <div id="TokenType.ALWAYS" class="classattr"> + <div class="attr variable"> + <span class="name">ALWAYS</span><span class="default_value"> = <<a href="#TokenType.ALWAYS">TokenType.ALWAYS</a>: 'ALWAYS'></span> + + + </div> + <a class="headerlink" href="#TokenType.ALWAYS"></a> + + + + </div> + <div id="TokenType.ALL" class="classattr"> + <div class="attr variable"> + <span class="name">ALL</span><span class="default_value"> = <<a href="#TokenType.ALL">TokenType.ALL</a>: 'ALL'></span> + + + </div> + <a class="headerlink" href="#TokenType.ALL"></a> + + + + </div> + <div id="TokenType.ANTI" class="classattr"> + <div class="attr variable"> + <span class="name">ANTI</span><span class="default_value"> = <<a href="#TokenType.ANTI">TokenType.ANTI</a>: 'ANTI'></span> + + + </div> + <a class="headerlink" href="#TokenType.ANTI"></a> + + + + </div> + <div id="TokenType.ANY" class="classattr"> + <div class="attr variable"> + <span class="name">ANY</span><span class="default_value"> = <<a href="#TokenType.ANY">TokenType.ANY</a>: 'ANY'></span> + + + </div> + <a class="headerlink" href="#TokenType.ANY"></a> + + + + </div> + <div id="TokenType.APPLY" class="classattr"> + <div class="attr variable"> + <span class="name">APPLY</span><span class="default_value"> = <<a href="#TokenType.APPLY">TokenType.APPLY</a>: 'APPLY'></span> + + + </div> + <a class="headerlink" href="#TokenType.APPLY"></a> + + + + </div> + <div id="TokenType.ARRAY" class="classattr"> + <div class="attr variable"> + <span class="name">ARRAY</span><span class="default_value"> = <<a href="#TokenType.ARRAY">TokenType.ARRAY</a>: 'ARRAY'></span> + + + </div> + <a class="headerlink" href="#TokenType.ARRAY"></a> + + + + </div> + <div id="TokenType.ASC" class="classattr"> + <div class="attr variable"> + <span class="name">ASC</span><span class="default_value"> = <<a href="#TokenType.ASC">TokenType.ASC</a>: 'ASC'></span> + + + </div> + <a class="headerlink" href="#TokenType.ASC"></a> + + + + </div> + <div id="TokenType.ASOF" class="classattr"> + <div class="attr variable"> + <span class="name">ASOF</span><span class="default_value"> = <<a href="#TokenType.ASOF">TokenType.ASOF</a>: 'ASOF'></span> + + + </div> + <a class="headerlink" href="#TokenType.ASOF"></a> + + + + </div> + <div id="TokenType.AT_TIME_ZONE" class="classattr"> + <div class="attr variable"> + <span class="name">AT_TIME_ZONE</span><span class="default_value"> = <<a href="#TokenType.AT_TIME_ZONE">TokenType.AT_TIME_ZONE</a>: 'AT_TIME_ZONE'></span> + + + </div> + <a class="headerlink" href="#TokenType.AT_TIME_ZONE"></a> + + + + </div> + <div id="TokenType.AUTO_INCREMENT" class="classattr"> + <div class="attr variable"> + <span class="name">AUTO_INCREMENT</span><span class="default_value"> = <<a href="#TokenType.AUTO_INCREMENT">TokenType.AUTO_INCREMENT</a>: 'AUTO_INCREMENT'></span> + + + </div> + <a class="headerlink" href="#TokenType.AUTO_INCREMENT"></a> + + + + </div> + <div id="TokenType.BEGIN" class="classattr"> + <div class="attr variable"> + <span class="name">BEGIN</span><span class="default_value"> = <<a href="#TokenType.BEGIN">TokenType.BEGIN</a>: 'BEGIN'></span> + + + </div> + <a class="headerlink" href="#TokenType.BEGIN"></a> + + + + </div> + <div id="TokenType.BETWEEN" class="classattr"> + <div class="attr variable"> + <span class="name">BETWEEN</span><span class="default_value"> = <<a href="#TokenType.BETWEEN">TokenType.BETWEEN</a>: 'BETWEEN'></span> + + + </div> + <a class="headerlink" href="#TokenType.BETWEEN"></a> + + + + </div> + <div id="TokenType.BOTH" class="classattr"> + <div class="attr variable"> + <span class="name">BOTH</span><span class="default_value"> = <<a href="#TokenType.BOTH">TokenType.BOTH</a>: 'BOTH'></span> + + + </div> + <a class="headerlink" href="#TokenType.BOTH"></a> + + + + </div> + <div id="TokenType.BUCKET" class="classattr"> + <div class="attr variable"> + <span class="name">BUCKET</span><span class="default_value"> = <<a href="#TokenType.BUCKET">TokenType.BUCKET</a>: 'BUCKET'></span> + + + </div> + <a class="headerlink" href="#TokenType.BUCKET"></a> + + + + </div> + <div id="TokenType.BY_DEFAULT" class="classattr"> + <div class="attr variable"> + <span class="name">BY_DEFAULT</span><span class="default_value"> = <<a href="#TokenType.BY_DEFAULT">TokenType.BY_DEFAULT</a>: 'BY_DEFAULT'></span> + + + </div> + <a class="headerlink" href="#TokenType.BY_DEFAULT"></a> + + + + </div> + <div id="TokenType.CACHE" class="classattr"> + <div class="attr variable"> + <span class="name">CACHE</span><span class="default_value"> = <<a href="#TokenType.CACHE">TokenType.CACHE</a>: 'CACHE'></span> + + + </div> + <a class="headerlink" href="#TokenType.CACHE"></a> + + + + </div> + <div id="TokenType.CASCADE" class="classattr"> + <div class="attr variable"> + <span class="name">CASCADE</span><span class="default_value"> = <<a href="#TokenType.CASCADE">TokenType.CASCADE</a>: 'CASCADE'></span> + + + </div> + <a class="headerlink" href="#TokenType.CASCADE"></a> + + + + </div> + <div id="TokenType.CASE" class="classattr"> + <div class="attr variable"> + <span class="name">CASE</span><span class="default_value"> = <<a href="#TokenType.CASE">TokenType.CASE</a>: 'CASE'></span> + + + </div> + <a class="headerlink" href="#TokenType.CASE"></a> + + + + </div> + <div id="TokenType.CHARACTER_SET" class="classattr"> + <div class="attr variable"> + <span class="name">CHARACTER_SET</span><span class="default_value"> = <<a href="#TokenType.CHARACTER_SET">TokenType.CHARACTER_SET</a>: 'CHARACTER_SET'></span> + + + </div> + <a class="headerlink" href="#TokenType.CHARACTER_SET"></a> + + + + </div> + <div id="TokenType.CHECK" class="classattr"> + <div class="attr variable"> + <span class="name">CHECK</span><span class="default_value"> = <<a href="#TokenType.CHECK">TokenType.CHECK</a>: 'CHECK'></span> + + + </div> + <a class="headerlink" href="#TokenType.CHECK"></a> + + + + </div> + <div id="TokenType.CLUSTER_BY" class="classattr"> + <div class="attr variable"> + <span class="name">CLUSTER_BY</span><span class="default_value"> = <<a href="#TokenType.CLUSTER_BY">TokenType.CLUSTER_BY</a>: 'CLUSTER_BY'></span> + + + </div> + <a class="headerlink" href="#TokenType.CLUSTER_BY"></a> + + + + </div> + <div id="TokenType.COLLATE" class="classattr"> + <div class="attr variable"> + <span class="name">COLLATE</span><span class="default_value"> = <<a href="#TokenType.COLLATE">TokenType.COLLATE</a>: 'COLLATE'></span> + + + </div> + <a class="headerlink" href="#TokenType.COLLATE"></a> + + + + </div> + <div id="TokenType.COMMAND" class="classattr"> + <div class="attr variable"> + <span class="name">COMMAND</span><span class="default_value"> = <<a href="#TokenType.COMMAND">TokenType.COMMAND</a>: 'COMMAND'></span> + + + </div> + <a class="headerlink" href="#TokenType.COMMAND"></a> + + + + </div> + <div id="TokenType.COMMENT" class="classattr"> + <div class="attr variable"> + <span class="name">COMMENT</span><span class="default_value"> = <<a href="#TokenType.COMMENT">TokenType.COMMENT</a>: 'COMMENT'></span> + + + </div> + <a class="headerlink" href="#TokenType.COMMENT"></a> + + + + </div> + <div id="TokenType.COMMIT" class="classattr"> + <div class="attr variable"> + <span class="name">COMMIT</span><span class="default_value"> = <<a href="#TokenType.COMMIT">TokenType.COMMIT</a>: 'COMMIT'></span> + + + </div> + <a class="headerlink" href="#TokenType.COMMIT"></a> + + + + </div> + <div id="TokenType.COMPOUND" class="classattr"> + <div class="attr variable"> + <span class="name">COMPOUND</span><span class="default_value"> = <<a href="#TokenType.COMPOUND">TokenType.COMPOUND</a>: 'COMPOUND'></span> + + + </div> + <a class="headerlink" href="#TokenType.COMPOUND"></a> + + + + </div> + <div id="TokenType.CONSTRAINT" class="classattr"> + <div class="attr variable"> + <span class="name">CONSTRAINT</span><span class="default_value"> = <<a href="#TokenType.CONSTRAINT">TokenType.CONSTRAINT</a>: 'CONSTRAINT'></span> + + + </div> + <a class="headerlink" href="#TokenType.CONSTRAINT"></a> + + + + </div> + <div id="TokenType.CREATE" class="classattr"> + <div class="attr variable"> + <span class="name">CREATE</span><span class="default_value"> = <<a href="#TokenType.CREATE">TokenType.CREATE</a>: 'CREATE'></span> + + + </div> + <a class="headerlink" href="#TokenType.CREATE"></a> + + + + </div> + <div id="TokenType.CROSS" class="classattr"> + <div class="attr variable"> + <span class="name">CROSS</span><span class="default_value"> = <<a href="#TokenType.CROSS">TokenType.CROSS</a>: 'CROSS'></span> + + + </div> + <a class="headerlink" href="#TokenType.CROSS"></a> + + + + </div> + <div id="TokenType.CUBE" class="classattr"> + <div class="attr variable"> + <span class="name">CUBE</span><span class="default_value"> = <<a href="#TokenType.CUBE">TokenType.CUBE</a>: 'CUBE'></span> + + + </div> + <a class="headerlink" href="#TokenType.CUBE"></a> + + + + </div> + <div id="TokenType.CURRENT_DATE" class="classattr"> + <div class="attr variable"> + <span class="name">CURRENT_DATE</span><span class="default_value"> = <<a href="#TokenType.CURRENT_DATE">TokenType.CURRENT_DATE</a>: 'CURRENT_DATE'></span> + + + </div> + <a class="headerlink" href="#TokenType.CURRENT_DATE"></a> + + + + </div> + <div id="TokenType.CURRENT_DATETIME" class="classattr"> + <div class="attr variable"> + <span class="name">CURRENT_DATETIME</span><span class="default_value"> = <<a href="#TokenType.CURRENT_DATETIME">TokenType.CURRENT_DATETIME</a>: 'CURRENT_DATETIME'></span> + + + </div> + <a class="headerlink" href="#TokenType.CURRENT_DATETIME"></a> + + + + </div> + <div id="TokenType.CURRENT_ROW" class="classattr"> + <div class="attr variable"> + <span class="name">CURRENT_ROW</span><span class="default_value"> = <<a href="#TokenType.CURRENT_ROW">TokenType.CURRENT_ROW</a>: 'CURRENT_ROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.CURRENT_ROW"></a> + + + + </div> + <div id="TokenType.CURRENT_TIME" class="classattr"> + <div class="attr variable"> + <span class="name">CURRENT_TIME</span><span class="default_value"> = <<a href="#TokenType.CURRENT_TIME">TokenType.CURRENT_TIME</a>: 'CURRENT_TIME'></span> + + + </div> + <a class="headerlink" href="#TokenType.CURRENT_TIME"></a> + + + + </div> + <div id="TokenType.CURRENT_TIMESTAMP" class="classattr"> + <div class="attr variable"> + <span class="name">CURRENT_TIMESTAMP</span><span class="default_value"> = <<a href="#TokenType.CURRENT_TIMESTAMP">TokenType.CURRENT_TIMESTAMP</a>: 'CURRENT_TIMESTAMP'></span> + + + </div> + <a class="headerlink" href="#TokenType.CURRENT_TIMESTAMP"></a> + + + + </div> + <div id="TokenType.DEFAULT" class="classattr"> + <div class="attr variable"> + <span class="name">DEFAULT</span><span class="default_value"> = <<a href="#TokenType.DEFAULT">TokenType.DEFAULT</a>: 'DEFAULT'></span> + + + </div> + <a class="headerlink" href="#TokenType.DEFAULT"></a> + + + + </div> + <div id="TokenType.DELETE" class="classattr"> + <div class="attr variable"> + <span class="name">DELETE</span><span class="default_value"> = <<a href="#TokenType.DELETE">TokenType.DELETE</a>: 'DELETE'></span> + + + </div> + <a class="headerlink" href="#TokenType.DELETE"></a> + + + + </div> + <div id="TokenType.DESC" class="classattr"> + <div class="attr variable"> + <span class="name">DESC</span><span class="default_value"> = <<a href="#TokenType.DESC">TokenType.DESC</a>: 'DESC'></span> + + + </div> + <a class="headerlink" href="#TokenType.DESC"></a> + + + + </div> + <div id="TokenType.DESCRIBE" class="classattr"> + <div class="attr variable"> + <span class="name">DESCRIBE</span><span class="default_value"> = <<a href="#TokenType.DESCRIBE">TokenType.DESCRIBE</a>: 'DESCRIBE'></span> + + + </div> + <a class="headerlink" href="#TokenType.DESCRIBE"></a> + + + + </div> + <div id="TokenType.DISTINCT" class="classattr"> + <div class="attr variable"> + <span class="name">DISTINCT</span><span class="default_value"> = <<a href="#TokenType.DISTINCT">TokenType.DISTINCT</a>: 'DISTINCT'></span> + + + </div> + <a class="headerlink" href="#TokenType.DISTINCT"></a> + + + + </div> + <div id="TokenType.DISTINCT_FROM" class="classattr"> + <div class="attr variable"> + <span class="name">DISTINCT_FROM</span><span class="default_value"> = <<a href="#TokenType.DISTINCT_FROM">TokenType.DISTINCT_FROM</a>: 'DISTINCT_FROM'></span> + + + </div> + <a class="headerlink" href="#TokenType.DISTINCT_FROM"></a> + + + + </div> + <div id="TokenType.DISTRIBUTE_BY" class="classattr"> + <div class="attr variable"> + <span class="name">DISTRIBUTE_BY</span><span class="default_value"> = <<a href="#TokenType.DISTRIBUTE_BY">TokenType.DISTRIBUTE_BY</a>: 'DISTRIBUTE_BY'></span> + + + </div> + <a class="headerlink" href="#TokenType.DISTRIBUTE_BY"></a> + + + + </div> + <div id="TokenType.DIV" class="classattr"> + <div class="attr variable"> + <span class="name">DIV</span><span class="default_value"> = <<a href="#TokenType.DIV">TokenType.DIV</a>: 'DIV'></span> + + + </div> + <a class="headerlink" href="#TokenType.DIV"></a> + + + + </div> + <div id="TokenType.DROP" class="classattr"> + <div class="attr variable"> + <span class="name">DROP</span><span class="default_value"> = <<a href="#TokenType.DROP">TokenType.DROP</a>: 'DROP'></span> + + + </div> + <a class="headerlink" href="#TokenType.DROP"></a> + + + + </div> + <div id="TokenType.ELSE" class="classattr"> + <div class="attr variable"> + <span class="name">ELSE</span><span class="default_value"> = <<a href="#TokenType.ELSE">TokenType.ELSE</a>: 'ELSE'></span> + + + </div> + <a class="headerlink" href="#TokenType.ELSE"></a> + + + + </div> + <div id="TokenType.ENCODE" class="classattr"> + <div class="attr variable"> + <span class="name">ENCODE</span><span class="default_value"> = <<a href="#TokenType.ENCODE">TokenType.ENCODE</a>: 'ENCODE'></span> + + + </div> + <a class="headerlink" href="#TokenType.ENCODE"></a> + + + + </div> + <div id="TokenType.END" class="classattr"> + <div class="attr variable"> + <span class="name">END</span><span class="default_value"> = <<a href="#TokenType.END">TokenType.END</a>: 'END'></span> + + + </div> + <a class="headerlink" href="#TokenType.END"></a> + + + + </div> + <div id="TokenType.ESCAPE" class="classattr"> + <div class="attr variable"> + <span class="name">ESCAPE</span><span class="default_value"> = <<a href="#TokenType.ESCAPE">TokenType.ESCAPE</a>: 'ESCAPE'></span> + + + </div> + <a class="headerlink" href="#TokenType.ESCAPE"></a> + + + + </div> + <div id="TokenType.EXCEPT" class="classattr"> + <div class="attr variable"> + <span class="name">EXCEPT</span><span class="default_value"> = <<a href="#TokenType.EXCEPT">TokenType.EXCEPT</a>: 'EXCEPT'></span> + + + </div> + <a class="headerlink" href="#TokenType.EXCEPT"></a> + + + + </div> + <div id="TokenType.EXECUTE" class="classattr"> + <div class="attr variable"> + <span class="name">EXECUTE</span><span class="default_value"> = <<a href="#TokenType.EXECUTE">TokenType.EXECUTE</a>: 'EXECUTE'></span> + + + </div> + <a class="headerlink" href="#TokenType.EXECUTE"></a> + + + + </div> + <div id="TokenType.EXISTS" class="classattr"> + <div class="attr variable"> + <span class="name">EXISTS</span><span class="default_value"> = <<a href="#TokenType.EXISTS">TokenType.EXISTS</a>: 'EXISTS'></span> + + + </div> + <a class="headerlink" href="#TokenType.EXISTS"></a> + + + + </div> + <div id="TokenType.FALSE" class="classattr"> + <div class="attr variable"> + <span class="name">FALSE</span><span class="default_value"> = <<a href="#TokenType.FALSE">TokenType.FALSE</a>: 'FALSE'></span> + + + </div> + <a class="headerlink" href="#TokenType.FALSE"></a> + + + + </div> + <div id="TokenType.FETCH" class="classattr"> + <div class="attr variable"> + <span class="name">FETCH</span><span class="default_value"> = <<a href="#TokenType.FETCH">TokenType.FETCH</a>: 'FETCH'></span> + + + </div> + <a class="headerlink" href="#TokenType.FETCH"></a> + + + + </div> + <div id="TokenType.FILTER" class="classattr"> + <div class="attr variable"> + <span class="name">FILTER</span><span class="default_value"> = <<a href="#TokenType.FILTER">TokenType.FILTER</a>: 'FILTER'></span> + + + </div> + <a class="headerlink" href="#TokenType.FILTER"></a> + + + + </div> + <div id="TokenType.FINAL" class="classattr"> + <div class="attr variable"> + <span class="name">FINAL</span><span class="default_value"> = <<a href="#TokenType.FINAL">TokenType.FINAL</a>: 'FINAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.FINAL"></a> + + + + </div> + <div id="TokenType.FIRST" class="classattr"> + <div class="attr variable"> + <span class="name">FIRST</span><span class="default_value"> = <<a href="#TokenType.FIRST">TokenType.FIRST</a>: 'FIRST'></span> + + + </div> + <a class="headerlink" href="#TokenType.FIRST"></a> + + + + </div> + <div id="TokenType.FOLLOWING" class="classattr"> + <div class="attr variable"> + <span class="name">FOLLOWING</span><span class="default_value"> = <<a href="#TokenType.FOLLOWING">TokenType.FOLLOWING</a>: 'FOLLOWING'></span> + + + </div> + <a class="headerlink" href="#TokenType.FOLLOWING"></a> + + + + </div> + <div id="TokenType.FOR" class="classattr"> + <div class="attr variable"> + <span class="name">FOR</span><span class="default_value"> = <<a href="#TokenType.FOR">TokenType.FOR</a>: 'FOR'></span> + + + </div> + <a class="headerlink" href="#TokenType.FOR"></a> + + + + </div> + <div id="TokenType.FOREIGN_KEY" class="classattr"> + <div class="attr variable"> + <span class="name">FOREIGN_KEY</span><span class="default_value"> = <<a href="#TokenType.FOREIGN_KEY">TokenType.FOREIGN_KEY</a>: 'FOREIGN_KEY'></span> + + + </div> + <a class="headerlink" href="#TokenType.FOREIGN_KEY"></a> + + + + </div> + <div id="TokenType.FORMAT" class="classattr"> + <div class="attr variable"> + <span class="name">FORMAT</span><span class="default_value"> = <<a href="#TokenType.FORMAT">TokenType.FORMAT</a>: 'FORMAT'></span> + + + </div> + <a class="headerlink" href="#TokenType.FORMAT"></a> + + + + </div> + <div id="TokenType.FROM" class="classattr"> + <div class="attr variable"> + <span class="name">FROM</span><span class="default_value"> = <<a href="#TokenType.FROM">TokenType.FROM</a>: 'FROM'></span> + + + </div> + <a class="headerlink" href="#TokenType.FROM"></a> + + + + </div> + <div id="TokenType.FULL" class="classattr"> + <div class="attr variable"> + <span class="name">FULL</span><span class="default_value"> = <<a href="#TokenType.FULL">TokenType.FULL</a>: 'FULL'></span> + + + </div> + <a class="headerlink" href="#TokenType.FULL"></a> + + + + </div> + <div id="TokenType.FUNCTION" class="classattr"> + <div class="attr variable"> + <span class="name">FUNCTION</span><span class="default_value"> = <<a href="#TokenType.FUNCTION">TokenType.FUNCTION</a>: 'FUNCTION'></span> + + + </div> + <a class="headerlink" href="#TokenType.FUNCTION"></a> + + + + </div> + <div id="TokenType.GENERATED" class="classattr"> + <div class="attr variable"> + <span class="name">GENERATED</span><span class="default_value"> = <<a href="#TokenType.GENERATED">TokenType.GENERATED</a>: 'GENERATED'></span> + + + </div> + <a class="headerlink" href="#TokenType.GENERATED"></a> + + + + </div> + <div id="TokenType.GLOB" class="classattr"> + <div class="attr variable"> + <span class="name">GLOB</span><span class="default_value"> = <<a href="#TokenType.GLOB">TokenType.GLOB</a>: 'GLOB'></span> + + + </div> + <a class="headerlink" href="#TokenType.GLOB"></a> + + + + </div> + <div id="TokenType.GLOBAL" class="classattr"> + <div class="attr variable"> + <span class="name">GLOBAL</span><span class="default_value"> = <<a href="#TokenType.GLOBAL">TokenType.GLOBAL</a>: 'GLOBAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.GLOBAL"></a> + + + + </div> + <div id="TokenType.GROUP_BY" class="classattr"> + <div class="attr variable"> + <span class="name">GROUP_BY</span><span class="default_value"> = <<a href="#TokenType.GROUP_BY">TokenType.GROUP_BY</a>: 'GROUP_BY'></span> + + + </div> + <a class="headerlink" href="#TokenType.GROUP_BY"></a> + + + + </div> + <div id="TokenType.GROUPING_SETS" class="classattr"> + <div class="attr variable"> + <span class="name">GROUPING_SETS</span><span class="default_value"> = <<a href="#TokenType.GROUPING_SETS">TokenType.GROUPING_SETS</a>: 'GROUPING_SETS'></span> + + + </div> + <a class="headerlink" href="#TokenType.GROUPING_SETS"></a> + + + + </div> + <div id="TokenType.HAVING" class="classattr"> + <div class="attr variable"> + <span class="name">HAVING</span><span class="default_value"> = <<a href="#TokenType.HAVING">TokenType.HAVING</a>: 'HAVING'></span> + + + </div> + <a class="headerlink" href="#TokenType.HAVING"></a> + + + + </div> + <div id="TokenType.HINT" class="classattr"> + <div class="attr variable"> + <span class="name">HINT</span><span class="default_value"> = <<a href="#TokenType.HINT">TokenType.HINT</a>: 'HINT'></span> + + + </div> + <a class="headerlink" href="#TokenType.HINT"></a> + + + + </div> + <div id="TokenType.IDENTITY" class="classattr"> + <div class="attr variable"> + <span class="name">IDENTITY</span><span class="default_value"> = <<a href="#TokenType.IDENTITY">TokenType.IDENTITY</a>: 'IDENTITY'></span> + + + </div> + <a class="headerlink" href="#TokenType.IDENTITY"></a> + + + + </div> + <div id="TokenType.IF" class="classattr"> + <div class="attr variable"> + <span class="name">IF</span><span class="default_value"> = <<a href="#TokenType.IF">TokenType.IF</a>: 'IF'></span> + + + </div> + <a class="headerlink" href="#TokenType.IF"></a> + + + + </div> + <div id="TokenType.IGNORE_NULLS" class="classattr"> + <div class="attr variable"> + <span class="name">IGNORE_NULLS</span><span class="default_value"> = <<a href="#TokenType.IGNORE_NULLS">TokenType.IGNORE_NULLS</a>: 'IGNORE_NULLS'></span> + + + </div> + <a class="headerlink" href="#TokenType.IGNORE_NULLS"></a> + + + + </div> + <div id="TokenType.ILIKE" class="classattr"> + <div class="attr variable"> + <span class="name">ILIKE</span><span class="default_value"> = <<a href="#TokenType.ILIKE">TokenType.ILIKE</a>: 'ILIKE'></span> + + + </div> + <a class="headerlink" href="#TokenType.ILIKE"></a> + + + + </div> + <div id="TokenType.IN" class="classattr"> + <div class="attr variable"> + <span class="name">IN</span><span class="default_value"> = <<a href="#TokenType.IN">TokenType.IN</a>: 'IN'></span> + + + </div> + <a class="headerlink" href="#TokenType.IN"></a> + + + + </div> + <div id="TokenType.INDEX" class="classattr"> + <div class="attr variable"> + <span class="name">INDEX</span><span class="default_value"> = <<a href="#TokenType.INDEX">TokenType.INDEX</a>: 'INDEX'></span> + + + </div> + <a class="headerlink" href="#TokenType.INDEX"></a> + + + + </div> + <div id="TokenType.INNER" class="classattr"> + <div class="attr variable"> + <span class="name">INNER</span><span class="default_value"> = <<a href="#TokenType.INNER">TokenType.INNER</a>: 'INNER'></span> + + + </div> + <a class="headerlink" href="#TokenType.INNER"></a> + + + + </div> + <div id="TokenType.INSERT" class="classattr"> + <div class="attr variable"> + <span class="name">INSERT</span><span class="default_value"> = <<a href="#TokenType.INSERT">TokenType.INSERT</a>: 'INSERT'></span> + + + </div> + <a class="headerlink" href="#TokenType.INSERT"></a> + + + + </div> + <div id="TokenType.INTERSECT" class="classattr"> + <div class="attr variable"> + <span class="name">INTERSECT</span><span class="default_value"> = <<a href="#TokenType.INTERSECT">TokenType.INTERSECT</a>: 'INTERSECT'></span> + + + </div> + <a class="headerlink" href="#TokenType.INTERSECT"></a> + + + + </div> + <div id="TokenType.INTERVAL" class="classattr"> + <div class="attr variable"> + <span class="name">INTERVAL</span><span class="default_value"> = <<a href="#TokenType.INTERVAL">TokenType.INTERVAL</a>: 'INTERVAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.INTERVAL"></a> + + + + </div> + <div id="TokenType.INTO" class="classattr"> + <div class="attr variable"> + <span class="name">INTO</span><span class="default_value"> = <<a href="#TokenType.INTO">TokenType.INTO</a>: 'INTO'></span> + + + </div> + <a class="headerlink" href="#TokenType.INTO"></a> + + + + </div> + <div id="TokenType.INTRODUCER" class="classattr"> + <div class="attr variable"> + <span class="name">INTRODUCER</span><span class="default_value"> = <<a href="#TokenType.INTRODUCER">TokenType.INTRODUCER</a>: 'INTRODUCER'></span> + + + </div> + <a class="headerlink" href="#TokenType.INTRODUCER"></a> + + + + </div> + <div id="TokenType.IRLIKE" class="classattr"> + <div class="attr variable"> + <span class="name">IRLIKE</span><span class="default_value"> = <<a href="#TokenType.IRLIKE">TokenType.IRLIKE</a>: 'IRLIKE'></span> + + + </div> + <a class="headerlink" href="#TokenType.IRLIKE"></a> + + + + </div> + <div id="TokenType.IS" class="classattr"> + <div class="attr variable"> + <span class="name">IS</span><span class="default_value"> = <<a href="#TokenType.IS">TokenType.IS</a>: 'IS'></span> + + + </div> + <a class="headerlink" href="#TokenType.IS"></a> + + + + </div> + <div id="TokenType.ISNULL" class="classattr"> + <div class="attr variable"> + <span class="name">ISNULL</span><span class="default_value"> = <<a href="#TokenType.ISNULL">TokenType.ISNULL</a>: 'ISNULL'></span> + + + </div> + <a class="headerlink" href="#TokenType.ISNULL"></a> + + + + </div> + <div id="TokenType.JOIN" class="classattr"> + <div class="attr variable"> + <span class="name">JOIN</span><span class="default_value"> = <<a href="#TokenType.JOIN">TokenType.JOIN</a>: 'JOIN'></span> + + + </div> + <a class="headerlink" href="#TokenType.JOIN"></a> + + + + </div> + <div id="TokenType.LANGUAGE" class="classattr"> + <div class="attr variable"> + <span class="name">LANGUAGE</span><span class="default_value"> = <<a href="#TokenType.LANGUAGE">TokenType.LANGUAGE</a>: 'LANGUAGE'></span> + + + </div> + <a class="headerlink" href="#TokenType.LANGUAGE"></a> + + + + </div> + <div id="TokenType.LATERAL" class="classattr"> + <div class="attr variable"> + <span class="name">LATERAL</span><span class="default_value"> = <<a href="#TokenType.LATERAL">TokenType.LATERAL</a>: 'LATERAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.LATERAL"></a> + + + + </div> + <div id="TokenType.LAZY" class="classattr"> + <div class="attr variable"> + <span class="name">LAZY</span><span class="default_value"> = <<a href="#TokenType.LAZY">TokenType.LAZY</a>: 'LAZY'></span> + + + </div> + <a class="headerlink" href="#TokenType.LAZY"></a> + + + + </div> + <div id="TokenType.LEADING" class="classattr"> + <div class="attr variable"> + <span class="name">LEADING</span><span class="default_value"> = <<a href="#TokenType.LEADING">TokenType.LEADING</a>: 'LEADING'></span> + + + </div> + <a class="headerlink" href="#TokenType.LEADING"></a> + + + + </div> + <div id="TokenType.LEFT" class="classattr"> + <div class="attr variable"> + <span class="name">LEFT</span><span class="default_value"> = <<a href="#TokenType.LEFT">TokenType.LEFT</a>: 'LEFT'></span> + + + </div> + <a class="headerlink" href="#TokenType.LEFT"></a> + + + + </div> + <div id="TokenType.LIKE" class="classattr"> + <div class="attr variable"> + <span class="name">LIKE</span><span class="default_value"> = <<a href="#TokenType.LIKE">TokenType.LIKE</a>: 'LIKE'></span> + + + </div> + <a class="headerlink" href="#TokenType.LIKE"></a> + + + + </div> + <div id="TokenType.LIMIT" class="classattr"> + <div class="attr variable"> + <span class="name">LIMIT</span><span class="default_value"> = <<a href="#TokenType.LIMIT">TokenType.LIMIT</a>: 'LIMIT'></span> + + + </div> + <a class="headerlink" href="#TokenType.LIMIT"></a> + + + + </div> + <div id="TokenType.LOAD_DATA" class="classattr"> + <div class="attr variable"> + <span class="name">LOAD_DATA</span><span class="default_value"> = <<a href="#TokenType.LOAD_DATA">TokenType.LOAD_DATA</a>: 'LOAD_DATA'></span> + + + </div> + <a class="headerlink" href="#TokenType.LOAD_DATA"></a> + + + + </div> + <div id="TokenType.LOCAL" class="classattr"> + <div class="attr variable"> + <span class="name">LOCAL</span><span class="default_value"> = <<a href="#TokenType.LOCAL">TokenType.LOCAL</a>: 'LOCAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.LOCAL"></a> + + + + </div> + <div id="TokenType.MAP" class="classattr"> + <div class="attr variable"> + <span class="name">MAP</span><span class="default_value"> = <<a href="#TokenType.MAP">TokenType.MAP</a>: 'MAP'></span> + + + </div> + <a class="headerlink" href="#TokenType.MAP"></a> + + + + </div> + <div id="TokenType.MATCH_RECOGNIZE" class="classattr"> + <div class="attr variable"> + <span class="name">MATCH_RECOGNIZE</span><span class="default_value"> = <<a href="#TokenType.MATCH_RECOGNIZE">TokenType.MATCH_RECOGNIZE</a>: 'MATCH_RECOGNIZE'></span> + + + </div> + <a class="headerlink" href="#TokenType.MATCH_RECOGNIZE"></a> + + + + </div> + <div id="TokenType.MATERIALIZED" class="classattr"> + <div class="attr variable"> + <span class="name">MATERIALIZED</span><span class="default_value"> = <<a href="#TokenType.MATERIALIZED">TokenType.MATERIALIZED</a>: 'MATERIALIZED'></span> + + + </div> + <a class="headerlink" href="#TokenType.MATERIALIZED"></a> + + + + </div> + <div id="TokenType.MERGE" class="classattr"> + <div class="attr variable"> + <span class="name">MERGE</span><span class="default_value"> = <<a href="#TokenType.MERGE">TokenType.MERGE</a>: 'MERGE'></span> + + + </div> + <a class="headerlink" href="#TokenType.MERGE"></a> + + + + </div> + <div id="TokenType.MOD" class="classattr"> + <div class="attr variable"> + <span class="name">MOD</span><span class="default_value"> = <<a href="#TokenType.MOD">TokenType.MOD</a>: 'MOD'></span> + + + </div> + <a class="headerlink" href="#TokenType.MOD"></a> + + + + </div> + <div id="TokenType.NATURAL" class="classattr"> + <div class="attr variable"> + <span class="name">NATURAL</span><span class="default_value"> = <<a href="#TokenType.NATURAL">TokenType.NATURAL</a>: 'NATURAL'></span> + + + </div> + <a class="headerlink" href="#TokenType.NATURAL"></a> + + + + </div> + <div id="TokenType.NEXT" class="classattr"> + <div class="attr variable"> + <span class="name">NEXT</span><span class="default_value"> = <<a href="#TokenType.NEXT">TokenType.NEXT</a>: 'NEXT'></span> + + + </div> + <a class="headerlink" href="#TokenType.NEXT"></a> + + + + </div> + <div id="TokenType.NO_ACTION" class="classattr"> + <div class="attr variable"> + <span class="name">NO_ACTION</span><span class="default_value"> = <<a href="#TokenType.NO_ACTION">TokenType.NO_ACTION</a>: 'NO_ACTION'></span> + + + </div> + <a class="headerlink" href="#TokenType.NO_ACTION"></a> + + + + </div> + <div id="TokenType.NOTNULL" class="classattr"> + <div class="attr variable"> + <span class="name">NOTNULL</span><span class="default_value"> = <<a href="#TokenType.NOTNULL">TokenType.NOTNULL</a>: 'NOTNULL'></span> + + + </div> + <a class="headerlink" href="#TokenType.NOTNULL"></a> + + + + </div> + <div id="TokenType.NULL" class="classattr"> + <div class="attr variable"> + <span class="name">NULL</span><span class="default_value"> = <<a href="#TokenType.NULL">TokenType.NULL</a>: 'NULL'></span> + + + </div> + <a class="headerlink" href="#TokenType.NULL"></a> + + + + </div> + <div id="TokenType.NULLS_FIRST" class="classattr"> + <div class="attr variable"> + <span class="name">NULLS_FIRST</span><span class="default_value"> = <<a href="#TokenType.NULLS_FIRST">TokenType.NULLS_FIRST</a>: 'NULLS_FIRST'></span> + + + </div> + <a class="headerlink" href="#TokenType.NULLS_FIRST"></a> + + + + </div> + <div id="TokenType.NULLS_LAST" class="classattr"> + <div class="attr variable"> + <span class="name">NULLS_LAST</span><span class="default_value"> = <<a href="#TokenType.NULLS_LAST">TokenType.NULLS_LAST</a>: 'NULLS_LAST'></span> + + + </div> + <a class="headerlink" href="#TokenType.NULLS_LAST"></a> + + + + </div> + <div id="TokenType.OFFSET" class="classattr"> + <div class="attr variable"> + <span class="name">OFFSET</span><span class="default_value"> = <<a href="#TokenType.OFFSET">TokenType.OFFSET</a>: 'OFFSET'></span> + + + </div> + <a class="headerlink" href="#TokenType.OFFSET"></a> + + + + </div> + <div id="TokenType.ON" class="classattr"> + <div class="attr variable"> + <span class="name">ON</span><span class="default_value"> = <<a href="#TokenType.ON">TokenType.ON</a>: 'ON'></span> + + + </div> + <a class="headerlink" href="#TokenType.ON"></a> + + + + </div> + <div id="TokenType.ONLY" class="classattr"> + <div class="attr variable"> + <span class="name">ONLY</span><span class="default_value"> = <<a href="#TokenType.ONLY">TokenType.ONLY</a>: 'ONLY'></span> + + + </div> + <a class="headerlink" href="#TokenType.ONLY"></a> + + + + </div> + <div id="TokenType.OPTIONS" class="classattr"> + <div class="attr variable"> + <span class="name">OPTIONS</span><span class="default_value"> = <<a href="#TokenType.OPTIONS">TokenType.OPTIONS</a>: 'OPTIONS'></span> + + + </div> + <a class="headerlink" href="#TokenType.OPTIONS"></a> + + + + </div> + <div id="TokenType.ORDER_BY" class="classattr"> + <div class="attr variable"> + <span class="name">ORDER_BY</span><span class="default_value"> = <<a href="#TokenType.ORDER_BY">TokenType.ORDER_BY</a>: 'ORDER_BY'></span> + + + </div> + <a class="headerlink" href="#TokenType.ORDER_BY"></a> + + + + </div> + <div id="TokenType.ORDERED" class="classattr"> + <div class="attr variable"> + <span class="name">ORDERED</span><span class="default_value"> = <<a href="#TokenType.ORDERED">TokenType.ORDERED</a>: 'ORDERED'></span> + + + </div> + <a class="headerlink" href="#TokenType.ORDERED"></a> + + + + </div> + <div id="TokenType.ORDINALITY" class="classattr"> + <div class="attr variable"> + <span class="name">ORDINALITY</span><span class="default_value"> = <<a href="#TokenType.ORDINALITY">TokenType.ORDINALITY</a>: 'ORDINALITY'></span> + + + </div> + <a class="headerlink" href="#TokenType.ORDINALITY"></a> + + + + </div> + <div id="TokenType.OUTER" class="classattr"> + <div class="attr variable"> + <span class="name">OUTER</span><span class="default_value"> = <<a href="#TokenType.OUTER">TokenType.OUTER</a>: 'OUTER'></span> + + + </div> + <a class="headerlink" href="#TokenType.OUTER"></a> + + + + </div> + <div id="TokenType.OUT_OF" class="classattr"> + <div class="attr variable"> + <span class="name">OUT_OF</span><span class="default_value"> = <<a href="#TokenType.OUT_OF">TokenType.OUT_OF</a>: 'OUT_OF'></span> + + + </div> + <a class="headerlink" href="#TokenType.OUT_OF"></a> + + + + </div> + <div id="TokenType.OVER" class="classattr"> + <div class="attr variable"> + <span class="name">OVER</span><span class="default_value"> = <<a href="#TokenType.OVER">TokenType.OVER</a>: 'OVER'></span> + + + </div> + <a class="headerlink" href="#TokenType.OVER"></a> + + + + </div> + <div id="TokenType.OVERWRITE" class="classattr"> + <div class="attr variable"> + <span class="name">OVERWRITE</span><span class="default_value"> = <<a href="#TokenType.OVERWRITE">TokenType.OVERWRITE</a>: 'OVERWRITE'></span> + + + </div> + <a class="headerlink" href="#TokenType.OVERWRITE"></a> + + + + </div> + <div id="TokenType.PARTITION" class="classattr"> + <div class="attr variable"> + <span class="name">PARTITION</span><span class="default_value"> = <<a href="#TokenType.PARTITION">TokenType.PARTITION</a>: 'PARTITION'></span> + + + </div> + <a class="headerlink" href="#TokenType.PARTITION"></a> + + + + </div> + <div id="TokenType.PARTITION_BY" class="classattr"> + <div class="attr variable"> + <span class="name">PARTITION_BY</span><span class="default_value"> = <<a href="#TokenType.PARTITION_BY">TokenType.PARTITION_BY</a>: 'PARTITION_BY'></span> + + + </div> + <a class="headerlink" href="#TokenType.PARTITION_BY"></a> + + + + </div> + <div id="TokenType.PERCENT" class="classattr"> + <div class="attr variable"> + <span class="name">PERCENT</span><span class="default_value"> = <<a href="#TokenType.PERCENT">TokenType.PERCENT</a>: 'PERCENT'></span> + + + </div> + <a class="headerlink" href="#TokenType.PERCENT"></a> + + + + </div> + <div id="TokenType.PIVOT" class="classattr"> + <div class="attr variable"> + <span class="name">PIVOT</span><span class="default_value"> = <<a href="#TokenType.PIVOT">TokenType.PIVOT</a>: 'PIVOT'></span> + + + </div> + <a class="headerlink" href="#TokenType.PIVOT"></a> + + + + </div> + <div id="TokenType.PLACEHOLDER" class="classattr"> + <div class="attr variable"> + <span class="name">PLACEHOLDER</span><span class="default_value"> = <<a href="#TokenType.PLACEHOLDER">TokenType.PLACEHOLDER</a>: 'PLACEHOLDER'></span> + + + </div> + <a class="headerlink" href="#TokenType.PLACEHOLDER"></a> + + + + </div> + <div id="TokenType.PRECEDING" class="classattr"> + <div class="attr variable"> + <span class="name">PRECEDING</span><span class="default_value"> = <<a href="#TokenType.PRECEDING">TokenType.PRECEDING</a>: 'PRECEDING'></span> + + + </div> + <a class="headerlink" href="#TokenType.PRECEDING"></a> + + + + </div> + <div id="TokenType.PRIMARY_KEY" class="classattr"> + <div class="attr variable"> + <span class="name">PRIMARY_KEY</span><span class="default_value"> = <<a href="#TokenType.PRIMARY_KEY">TokenType.PRIMARY_KEY</a>: 'PRIMARY_KEY'></span> + + + </div> + <a class="headerlink" href="#TokenType.PRIMARY_KEY"></a> + + + + </div> + <div id="TokenType.PROCEDURE" class="classattr"> + <div class="attr variable"> + <span class="name">PROCEDURE</span><span class="default_value"> = <<a href="#TokenType.PROCEDURE">TokenType.PROCEDURE</a>: 'PROCEDURE'></span> + + + </div> + <a class="headerlink" href="#TokenType.PROCEDURE"></a> + + + + </div> + <div id="TokenType.PROPERTIES" class="classattr"> + <div class="attr variable"> + <span class="name">PROPERTIES</span><span class="default_value"> = <<a href="#TokenType.PROPERTIES">TokenType.PROPERTIES</a>: 'PROPERTIES'></span> + + + </div> + <a class="headerlink" href="#TokenType.PROPERTIES"></a> + + + + </div> + <div id="TokenType.PSEUDO_TYPE" class="classattr"> + <div class="attr variable"> + <span class="name">PSEUDO_TYPE</span><span class="default_value"> = <<a href="#TokenType.PSEUDO_TYPE">TokenType.PSEUDO_TYPE</a>: 'PSEUDO_TYPE'></span> + + + </div> + <a class="headerlink" href="#TokenType.PSEUDO_TYPE"></a> + + + + </div> + <div id="TokenType.QUALIFY" class="classattr"> + <div class="attr variable"> + <span class="name">QUALIFY</span><span class="default_value"> = <<a href="#TokenType.QUALIFY">TokenType.QUALIFY</a>: 'QUALIFY'></span> + + + </div> + <a class="headerlink" href="#TokenType.QUALIFY"></a> + + + + </div> + <div id="TokenType.QUOTE" class="classattr"> + <div class="attr variable"> + <span class="name">QUOTE</span><span class="default_value"> = <<a href="#TokenType.QUOTE">TokenType.QUOTE</a>: 'QUOTE'></span> + + + </div> + <a class="headerlink" href="#TokenType.QUOTE"></a> + + + + </div> + <div id="TokenType.RANGE" class="classattr"> + <div class="attr variable"> + <span class="name">RANGE</span><span class="default_value"> = <<a href="#TokenType.RANGE">TokenType.RANGE</a>: 'RANGE'></span> + + + </div> + <a class="headerlink" href="#TokenType.RANGE"></a> + + + + </div> + <div id="TokenType.RECURSIVE" class="classattr"> + <div class="attr variable"> + <span class="name">RECURSIVE</span><span class="default_value"> = <<a href="#TokenType.RECURSIVE">TokenType.RECURSIVE</a>: 'RECURSIVE'></span> + + + </div> + <a class="headerlink" href="#TokenType.RECURSIVE"></a> + + + + </div> + <div id="TokenType.REPLACE" class="classattr"> + <div class="attr variable"> + <span class="name">REPLACE</span><span class="default_value"> = <<a href="#TokenType.REPLACE">TokenType.REPLACE</a>: 'REPLACE'></span> + + + </div> + <a class="headerlink" href="#TokenType.REPLACE"></a> + + + + </div> + <div id="TokenType.RESPECT_NULLS" class="classattr"> + <div class="attr variable"> + <span class="name">RESPECT_NULLS</span><span class="default_value"> = <<a href="#TokenType.RESPECT_NULLS">TokenType.RESPECT_NULLS</a>: 'RESPECT_NULLS'></span> + + + </div> + <a class="headerlink" href="#TokenType.RESPECT_NULLS"></a> + + + + </div> + <div id="TokenType.REFERENCES" class="classattr"> + <div class="attr variable"> + <span class="name">REFERENCES</span><span class="default_value"> = <<a href="#TokenType.REFERENCES">TokenType.REFERENCES</a>: 'REFERENCES'></span> + + + </div> + <a class="headerlink" href="#TokenType.REFERENCES"></a> + + + + </div> + <div id="TokenType.RIGHT" class="classattr"> + <div class="attr variable"> + <span class="name">RIGHT</span><span class="default_value"> = <<a href="#TokenType.RIGHT">TokenType.RIGHT</a>: 'RIGHT'></span> + + + </div> + <a class="headerlink" href="#TokenType.RIGHT"></a> + + + + </div> + <div id="TokenType.RLIKE" class="classattr"> + <div class="attr variable"> + <span class="name">RLIKE</span><span class="default_value"> = <<a href="#TokenType.RLIKE">TokenType.RLIKE</a>: 'RLIKE'></span> + + + </div> + <a class="headerlink" href="#TokenType.RLIKE"></a> + + + + </div> + <div id="TokenType.ROLLBACK" class="classattr"> + <div class="attr variable"> + <span class="name">ROLLBACK</span><span class="default_value"> = <<a href="#TokenType.ROLLBACK">TokenType.ROLLBACK</a>: 'ROLLBACK'></span> + + + </div> + <a class="headerlink" href="#TokenType.ROLLBACK"></a> + + + + </div> + <div id="TokenType.ROLLUP" class="classattr"> + <div class="attr variable"> + <span class="name">ROLLUP</span><span class="default_value"> = <<a href="#TokenType.ROLLUP">TokenType.ROLLUP</a>: 'ROLLUP'></span> + + + </div> + <a class="headerlink" href="#TokenType.ROLLUP"></a> + + + + </div> + <div id="TokenType.ROW" class="classattr"> + <div class="attr variable"> + <span class="name">ROW</span><span class="default_value"> = <<a href="#TokenType.ROW">TokenType.ROW</a>: 'ROW'></span> + + + </div> + <a class="headerlink" href="#TokenType.ROW"></a> + + + + </div> + <div id="TokenType.ROWS" class="classattr"> + <div class="attr variable"> + <span class="name">ROWS</span><span class="default_value"> = <<a href="#TokenType.ROWS">TokenType.ROWS</a>: 'ROWS'></span> + + + </div> + <a class="headerlink" href="#TokenType.ROWS"></a> + + + + </div> + <div id="TokenType.SCHEMA_COMMENT" class="classattr"> + <div class="attr variable"> + <span class="name">SCHEMA_COMMENT</span><span class="default_value"> = <<a href="#TokenType.SCHEMA_COMMENT">TokenType.SCHEMA_COMMENT</a>: 'SCHEMA_COMMENT'></span> + + + </div> + <a class="headerlink" href="#TokenType.SCHEMA_COMMENT"></a> + + + + </div> + <div id="TokenType.SEED" class="classattr"> + <div class="attr variable"> + <span class="name">SEED</span><span class="default_value"> = <<a href="#TokenType.SEED">TokenType.SEED</a>: 'SEED'></span> + + + </div> + <a class="headerlink" href="#TokenType.SEED"></a> + + + + </div> + <div id="TokenType.SELECT" class="classattr"> + <div class="attr variable"> + <span class="name">SELECT</span><span class="default_value"> = <<a href="#TokenType.SELECT">TokenType.SELECT</a>: 'SELECT'></span> + + + </div> + <a class="headerlink" href="#TokenType.SELECT"></a> + + + + </div> + <div id="TokenType.SEMI" class="classattr"> + <div class="attr variable"> + <span class="name">SEMI</span><span class="default_value"> = <<a href="#TokenType.SEMI">TokenType.SEMI</a>: 'SEMI'></span> + + + </div> + <a class="headerlink" href="#TokenType.SEMI"></a> + + + + </div> + <div id="TokenType.SEPARATOR" class="classattr"> + <div class="attr variable"> + <span class="name">SEPARATOR</span><span class="default_value"> = <<a href="#TokenType.SEPARATOR">TokenType.SEPARATOR</a>: 'SEPARATOR'></span> + + + </div> + <a class="headerlink" href="#TokenType.SEPARATOR"></a> + + + + </div> + <div id="TokenType.SERDE_PROPERTIES" class="classattr"> + <div class="attr variable"> + <span class="name">SERDE_PROPERTIES</span><span class="default_value"> = <<a href="#TokenType.SERDE_PROPERTIES">TokenType.SERDE_PROPERTIES</a>: 'SERDE_PROPERTIES'></span> + + + </div> + <a class="headerlink" href="#TokenType.SERDE_PROPERTIES"></a> + + + + </div> + <div id="TokenType.SET" class="classattr"> + <div class="attr variable"> + <span class="name">SET</span><span class="default_value"> = <<a href="#TokenType.SET">TokenType.SET</a>: 'SET'></span> + + + </div> + <a class="headerlink" href="#TokenType.SET"></a> + + + + </div> + <div id="TokenType.SHOW" class="classattr"> + <div class="attr variable"> + <span class="name">SHOW</span><span class="default_value"> = <<a href="#TokenType.SHOW">TokenType.SHOW</a>: 'SHOW'></span> + + + </div> + <a class="headerlink" href="#TokenType.SHOW"></a> + + + + </div> + <div id="TokenType.SIMILAR_TO" class="classattr"> + <div class="attr variable"> + <span class="name">SIMILAR_TO</span><span class="default_value"> = <<a href="#TokenType.SIMILAR_TO">TokenType.SIMILAR_TO</a>: 'SIMILAR_TO'></span> + + + </div> + <a class="headerlink" href="#TokenType.SIMILAR_TO"></a> + + + + </div> + <div id="TokenType.SOME" class="classattr"> + <div class="attr variable"> + <span class="name">SOME</span><span class="default_value"> = <<a href="#TokenType.SOME">TokenType.SOME</a>: 'SOME'></span> + + + </div> + <a class="headerlink" href="#TokenType.SOME"></a> + + + + </div> + <div id="TokenType.SORTKEY" class="classattr"> + <div class="attr variable"> + <span class="name">SORTKEY</span><span class="default_value"> = <<a href="#TokenType.SORTKEY">TokenType.SORTKEY</a>: 'SORTKEY'></span> + + + </div> + <a class="headerlink" href="#TokenType.SORTKEY"></a> + + + + </div> + <div id="TokenType.SORT_BY" class="classattr"> + <div class="attr variable"> + <span class="name">SORT_BY</span><span class="default_value"> = <<a href="#TokenType.SORT_BY">TokenType.SORT_BY</a>: 'SORT_BY'></span> + + + </div> + <a class="headerlink" href="#TokenType.SORT_BY"></a> + + + + </div> + <div id="TokenType.STRUCT" class="classattr"> + <div class="attr variable"> + <span class="name">STRUCT</span><span class="default_value"> = <<a href="#TokenType.STRUCT">TokenType.STRUCT</a>: 'STRUCT'></span> + + + </div> + <a class="headerlink" href="#TokenType.STRUCT"></a> + + + + </div> + <div id="TokenType.TABLE_SAMPLE" class="classattr"> + <div class="attr variable"> + <span class="name">TABLE_SAMPLE</span><span class="default_value"> = <<a href="#TokenType.TABLE_SAMPLE">TokenType.TABLE_SAMPLE</a>: 'TABLE_SAMPLE'></span> + + + </div> + <a class="headerlink" href="#TokenType.TABLE_SAMPLE"></a> + + + + </div> + <div id="TokenType.TEMPORARY" class="classattr"> + <div class="attr variable"> + <span class="name">TEMPORARY</span><span class="default_value"> = <<a href="#TokenType.TEMPORARY">TokenType.TEMPORARY</a>: 'TEMPORARY'></span> + + + </div> + <a class="headerlink" href="#TokenType.TEMPORARY"></a> + + + + </div> + <div id="TokenType.TOP" class="classattr"> + <div class="attr variable"> + <span class="name">TOP</span><span class="default_value"> = <<a href="#TokenType.TOP">TokenType.TOP</a>: 'TOP'></span> + + + </div> + <a class="headerlink" href="#TokenType.TOP"></a> + + + + </div> + <div id="TokenType.THEN" class="classattr"> + <div class="attr variable"> + <span class="name">THEN</span><span class="default_value"> = <<a href="#TokenType.THEN">TokenType.THEN</a>: 'THEN'></span> + + + </div> + <a class="headerlink" href="#TokenType.THEN"></a> + + + + </div> + <div id="TokenType.TRAILING" class="classattr"> + <div class="attr variable"> + <span class="name">TRAILING</span><span class="default_value"> = <<a href="#TokenType.TRAILING">TokenType.TRAILING</a>: 'TRAILING'></span> + + + </div> + <a class="headerlink" href="#TokenType.TRAILING"></a> + + + + </div> + <div id="TokenType.TRUE" class="classattr"> + <div class="attr variable"> + <span class="name">TRUE</span><span class="default_value"> = <<a href="#TokenType.TRUE">TokenType.TRUE</a>: 'TRUE'></span> + + + </div> + <a class="headerlink" href="#TokenType.TRUE"></a> + + + + </div> + <div id="TokenType.UNBOUNDED" class="classattr"> + <div class="attr variable"> + <span class="name">UNBOUNDED</span><span class="default_value"> = <<a href="#TokenType.UNBOUNDED">TokenType.UNBOUNDED</a>: 'UNBOUNDED'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNBOUNDED"></a> + + + + </div> + <div id="TokenType.UNCACHE" class="classattr"> + <div class="attr variable"> + <span class="name">UNCACHE</span><span class="default_value"> = <<a href="#TokenType.UNCACHE">TokenType.UNCACHE</a>: 'UNCACHE'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNCACHE"></a> + + + + </div> + <div id="TokenType.UNION" class="classattr"> + <div class="attr variable"> + <span class="name">UNION</span><span class="default_value"> = <<a href="#TokenType.UNION">TokenType.UNION</a>: 'UNION'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNION"></a> + + + + </div> + <div id="TokenType.UNLOGGED" class="classattr"> + <div class="attr variable"> + <span class="name">UNLOGGED</span><span class="default_value"> = <<a href="#TokenType.UNLOGGED">TokenType.UNLOGGED</a>: 'UNLOGGED'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNLOGGED"></a> + + + + </div> + <div id="TokenType.UNNEST" class="classattr"> + <div class="attr variable"> + <span class="name">UNNEST</span><span class="default_value"> = <<a href="#TokenType.UNNEST">TokenType.UNNEST</a>: 'UNNEST'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNNEST"></a> + + + + </div> + <div id="TokenType.UNPIVOT" class="classattr"> + <div class="attr variable"> + <span class="name">UNPIVOT</span><span class="default_value"> = <<a href="#TokenType.UNPIVOT">TokenType.UNPIVOT</a>: 'UNPIVOT'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNPIVOT"></a> + + + + </div> + <div id="TokenType.UPDATE" class="classattr"> + <div class="attr variable"> + <span class="name">UPDATE</span><span class="default_value"> = <<a href="#TokenType.UPDATE">TokenType.UPDATE</a>: 'UPDATE'></span> + + + </div> + <a class="headerlink" href="#TokenType.UPDATE"></a> + + + + </div> + <div id="TokenType.USE" class="classattr"> + <div class="attr variable"> + <span class="name">USE</span><span class="default_value"> = <<a href="#TokenType.USE">TokenType.USE</a>: 'USE'></span> + + + </div> + <a class="headerlink" href="#TokenType.USE"></a> + + + + </div> + <div id="TokenType.USING" class="classattr"> + <div class="attr variable"> + <span class="name">USING</span><span class="default_value"> = <<a href="#TokenType.USING">TokenType.USING</a>: 'USING'></span> + + + </div> + <a class="headerlink" href="#TokenType.USING"></a> + + + + </div> + <div id="TokenType.VALUES" class="classattr"> + <div class="attr variable"> + <span class="name">VALUES</span><span class="default_value"> = <<a href="#TokenType.VALUES">TokenType.VALUES</a>: 'VALUES'></span> + + + </div> + <a class="headerlink" href="#TokenType.VALUES"></a> + + + + </div> + <div id="TokenType.VIEW" class="classattr"> + <div class="attr variable"> + <span class="name">VIEW</span><span class="default_value"> = <<a href="#TokenType.VIEW">TokenType.VIEW</a>: 'VIEW'></span> + + + </div> + <a class="headerlink" href="#TokenType.VIEW"></a> + + + + </div> + <div id="TokenType.VOLATILE" class="classattr"> + <div class="attr variable"> + <span class="name">VOLATILE</span><span class="default_value"> = <<a href="#TokenType.VOLATILE">TokenType.VOLATILE</a>: 'VOLATILE'></span> + + + </div> + <a class="headerlink" href="#TokenType.VOLATILE"></a> + + + + </div> + <div id="TokenType.WHEN" class="classattr"> + <div class="attr variable"> + <span class="name">WHEN</span><span class="default_value"> = <<a href="#TokenType.WHEN">TokenType.WHEN</a>: 'WHEN'></span> + + + </div> + <a class="headerlink" href="#TokenType.WHEN"></a> + + + + </div> + <div id="TokenType.WHERE" class="classattr"> + <div class="attr variable"> + <span class="name">WHERE</span><span class="default_value"> = <<a href="#TokenType.WHERE">TokenType.WHERE</a>: 'WHERE'></span> + + + </div> + <a class="headerlink" href="#TokenType.WHERE"></a> + + + + </div> + <div id="TokenType.WINDOW" class="classattr"> + <div class="attr variable"> + <span class="name">WINDOW</span><span class="default_value"> = <<a href="#TokenType.WINDOW">TokenType.WINDOW</a>: 'WINDOW'></span> + + + </div> + <a class="headerlink" href="#TokenType.WINDOW"></a> + + + + </div> + <div id="TokenType.WITH" class="classattr"> + <div class="attr variable"> + <span class="name">WITH</span><span class="default_value"> = <<a href="#TokenType.WITH">TokenType.WITH</a>: 'WITH'></span> + + + </div> + <a class="headerlink" href="#TokenType.WITH"></a> + + + + </div> + <div id="TokenType.WITH_TIME_ZONE" class="classattr"> + <div class="attr variable"> + <span class="name">WITH_TIME_ZONE</span><span class="default_value"> = <<a href="#TokenType.WITH_TIME_ZONE">TokenType.WITH_TIME_ZONE</a>: 'WITH_TIME_ZONE'></span> + + + </div> + <a class="headerlink" href="#TokenType.WITH_TIME_ZONE"></a> + + + + </div> + <div id="TokenType.WITH_LOCAL_TIME_ZONE" class="classattr"> + <div class="attr variable"> + <span class="name">WITH_LOCAL_TIME_ZONE</span><span class="default_value"> = <<a href="#TokenType.WITH_LOCAL_TIME_ZONE">TokenType.WITH_LOCAL_TIME_ZONE</a>: 'WITH_LOCAL_TIME_ZONE'></span> + + + </div> + <a class="headerlink" href="#TokenType.WITH_LOCAL_TIME_ZONE"></a> + + + + </div> + <div id="TokenType.WITHIN_GROUP" class="classattr"> + <div class="attr variable"> + <span class="name">WITHIN_GROUP</span><span class="default_value"> = <<a href="#TokenType.WITHIN_GROUP">TokenType.WITHIN_GROUP</a>: 'WITHIN_GROUP'></span> + + + </div> + <a class="headerlink" href="#TokenType.WITHIN_GROUP"></a> + + + + </div> + <div id="TokenType.WITHOUT_TIME_ZONE" class="classattr"> + <div class="attr variable"> + <span class="name">WITHOUT_TIME_ZONE</span><span class="default_value"> = <<a href="#TokenType.WITHOUT_TIME_ZONE">TokenType.WITHOUT_TIME_ZONE</a>: 'WITHOUT_TIME_ZONE'></span> + + + </div> + <a class="headerlink" href="#TokenType.WITHOUT_TIME_ZONE"></a> + + + + </div> + <div id="TokenType.UNIQUE" class="classattr"> + <div class="attr variable"> + <span class="name">UNIQUE</span><span class="default_value"> = <<a href="#TokenType.UNIQUE">TokenType.UNIQUE</a>: 'UNIQUE'></span> + + + </div> + <a class="headerlink" href="#TokenType.UNIQUE"></a> + + + + </div> + <div class="inherited"> + <h5>Inherited Members</h5> + <dl> + <div><dt>enum.Enum</dt> + <dd id="TokenType.name" class="variable">name</dd> + <dd id="TokenType.value" class="variable">value</dd> + + </div> + </dl> + </div> + </section> + <section id="Token"> + <input id="Token-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Token</span>: + + <label class="view-source-button" for="Token-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Token"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Token-306"><a href="#Token-306"><span class="linenos">306</span></a><span class="k">class</span> <span class="nc">Token</span><span class="p">:</span> +</span><span id="Token-307"><a href="#Token-307"><span class="linenos">307</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"token_type"</span><span class="p">,</span> <span class="s2">"text"</span><span class="p">,</span> <span class="s2">"line"</span><span class="p">,</span> <span class="s2">"col"</span><span class="p">,</span> <span class="s2">"comments"</span><span class="p">)</span> +</span><span id="Token-308"><a href="#Token-308"><span class="linenos">308</span></a> +</span><span id="Token-309"><a href="#Token-309"><span class="linenos">309</span></a> <span class="nd">@classmethod</span> +</span><span id="Token-310"><a href="#Token-310"><span class="linenos">310</span></a> <span class="k">def</span> <span class="nf">number</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">number</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token-311"><a href="#Token-311"><span class="linenos">311</span></a><span class="w"> </span><span class="sd">"""Returns a NUMBER token with `number` as its text."""</span> +</span><span id="Token-312"><a href="#Token-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">number</span><span class="p">))</span> +</span><span id="Token-313"><a href="#Token-313"><span class="linenos">313</span></a> +</span><span id="Token-314"><a href="#Token-314"><span class="linenos">314</span></a> <span class="nd">@classmethod</span> +</span><span id="Token-315"><a href="#Token-315"><span class="linenos">315</span></a> <span class="k">def</span> <span class="nf">string</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">string</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token-316"><a href="#Token-316"><span class="linenos">316</span></a><span class="w"> </span><span class="sd">"""Returns a STRING token with `string` as its text."""</span> +</span><span id="Token-317"><a href="#Token-317"><span class="linenos">317</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">string</span><span class="p">)</span> +</span><span id="Token-318"><a href="#Token-318"><span class="linenos">318</span></a> +</span><span id="Token-319"><a href="#Token-319"><span class="linenos">319</span></a> <span class="nd">@classmethod</span> +</span><span id="Token-320"><a href="#Token-320"><span class="linenos">320</span></a> <span class="k">def</span> <span class="nf">identifier</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">identifier</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token-321"><a href="#Token-321"><span class="linenos">321</span></a><span class="w"> </span><span class="sd">"""Returns an IDENTIFIER token with `identifier` as its text."""</span> +</span><span id="Token-322"><a href="#Token-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> <span class="n">identifier</span><span class="p">)</span> +</span><span id="Token-323"><a href="#Token-323"><span class="linenos">323</span></a> +</span><span id="Token-324"><a href="#Token-324"><span class="linenos">324</span></a> <span class="nd">@classmethod</span> +</span><span id="Token-325"><a href="#Token-325"><span class="linenos">325</span></a> <span class="k">def</span> <span class="nf">var</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">var</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token-326"><a href="#Token-326"><span class="linenos">326</span></a><span class="w"> </span><span class="sd">"""Returns an VAR token with `var` as its text."""</span> +</span><span id="Token-327"><a href="#Token-327"><span class="linenos">327</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> <span class="n">var</span><span class="p">)</span> +</span><span id="Token-328"><a href="#Token-328"><span class="linenos">328</span></a> +</span><span id="Token-329"><a href="#Token-329"><span class="linenos">329</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Token-330"><a href="#Token-330"><span class="linenos">330</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Token-331"><a href="#Token-331"><span class="linenos">331</span></a> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> +</span><span id="Token-332"><a href="#Token-332"><span class="linenos">332</span></a> <span class="n">text</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="Token-333"><a href="#Token-333"><span class="linenos">333</span></a> <span class="n">line</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +</span><span id="Token-334"><a href="#Token-334"><span class="linenos">334</span></a> <span class="n">col</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +</span><span id="Token-335"><a href="#Token-335"><span class="linenos">335</span></a> <span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span> +</span><span id="Token-336"><a href="#Token-336"><span class="linenos">336</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Token-337"><a href="#Token-337"><span class="linenos">337</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">token_type</span> <span class="o">=</span> <span class="n">token_type</span> +</span><span id="Token-338"><a href="#Token-338"><span class="linenos">338</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="n">text</span> +</span><span id="Token-339"><a href="#Token-339"><span class="linenos">339</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">line</span> <span class="o">=</span> <span class="n">line</span> +</span><span id="Token-340"><a href="#Token-340"><span class="linenos">340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">col</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">col</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">),</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Token-341"><a href="#Token-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span><span id="Token-342"><a href="#Token-342"><span class="linenos">342</span></a> +</span><span id="Token-343"><a href="#Token-343"><span class="linenos">343</span></a> <span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Token-344"><a href="#Token-344"><span class="linenos">344</span></a> <span class="n">attributes</span> <span class="o">=</span> <span class="s2">", "</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">k</span><span class="si">}</span><span class="s2">: </span><span class="si">{</span><span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">k</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="vm">__slots__</span><span class="p">)</span> +</span><span id="Token-345"><a href="#Token-345"><span class="linenos">345</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"<Token </span><span class="si">{</span><span class="n">attributes</span><span class="si">}</span><span class="s2">>"</span> +</span></pre></div> + + + + + <div id="Token.__init__" class="classattr"> + <input id="Token.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Token</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">token_type</span><span class="p">:</span> <span class="n"><a href="#TokenType">sqlglot.tokens.TokenType</a></span>,</span><span class="param"> <span class="n">text</span><span class="p">:</span> <span class="nb">str</span>,</span><span class="param"> <span class="n">line</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span>,</span><span class="param"> <span class="n">col</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span>,</span><span class="param"> <span class="n">comments</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span></span>)</span> + + <label class="view-source-button" for="Token.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Token.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Token.__init__-329"><a href="#Token.__init__-329"><span class="linenos">329</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="Token.__init__-330"><a href="#Token.__init__-330"><span class="linenos">330</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Token.__init__-331"><a href="#Token.__init__-331"><span class="linenos">331</span></a> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> +</span><span id="Token.__init__-332"><a href="#Token.__init__-332"><span class="linenos">332</span></a> <span class="n">text</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> +</span><span id="Token.__init__-333"><a href="#Token.__init__-333"><span class="linenos">333</span></a> <span class="n">line</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +</span><span id="Token.__init__-334"><a href="#Token.__init__-334"><span class="linenos">334</span></a> <span class="n">col</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> +</span><span id="Token.__init__-335"><a href="#Token.__init__-335"><span class="linenos">335</span></a> <span class="n">comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span> +</span><span id="Token.__init__-336"><a href="#Token.__init__-336"><span class="linenos">336</span></a> <span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Token.__init__-337"><a href="#Token.__init__-337"><span class="linenos">337</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">token_type</span> <span class="o">=</span> <span class="n">token_type</span> +</span><span id="Token.__init__-338"><a href="#Token.__init__-338"><span class="linenos">338</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">text</span> <span class="o">=</span> <span class="n">text</span> +</span><span id="Token.__init__-339"><a href="#Token.__init__-339"><span class="linenos">339</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">line</span> <span class="o">=</span> <span class="n">line</span> +</span><span id="Token.__init__-340"><a href="#Token.__init__-340"><span class="linenos">340</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">col</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">col</span> <span class="o">-</span> <span class="nb">len</span><span class="p">(</span><span class="n">text</span><span class="p">),</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Token.__init__-341"><a href="#Token.__init__-341"><span class="linenos">341</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">comments</span> <span class="o">=</span> <span class="n">comments</span> +</span></pre></div> + + + + + </div> + <div id="Token.number" class="classattr"> + <input id="Token.number-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">number</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">number</span><span class="p">:</span> <span class="nb">int</span></span><span class="return-annotation">) -> <span class="n"><a href="#Token">sqlglot.tokens.Token</a></span>:</span></span> + + <label class="view-source-button" for="Token.number-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Token.number"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Token.number-309"><a href="#Token.number-309"><span class="linenos">309</span></a> <span class="nd">@classmethod</span> +</span><span id="Token.number-310"><a href="#Token.number-310"><span class="linenos">310</span></a> <span class="k">def</span> <span class="nf">number</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">number</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token.number-311"><a href="#Token.number-311"><span class="linenos">311</span></a><span class="w"> </span><span class="sd">"""Returns a NUMBER token with `number` as its text."""</span> +</span><span id="Token.number-312"><a href="#Token.number-312"><span class="linenos">312</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">number</span><span class="p">))</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a NUMBER token with <code><a href="#Token.number">number</a></code> as its text.</p> +</div> + + + </div> + <div id="Token.string" class="classattr"> + <input id="Token.string-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">string</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">string</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#Token">sqlglot.tokens.Token</a></span>:</span></span> + + <label class="view-source-button" for="Token.string-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Token.string"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Token.string-314"><a href="#Token.string-314"><span class="linenos">314</span></a> <span class="nd">@classmethod</span> +</span><span id="Token.string-315"><a href="#Token.string-315"><span class="linenos">315</span></a> <span class="k">def</span> <span class="nf">string</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">string</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token.string-316"><a href="#Token.string-316"><span class="linenos">316</span></a><span class="w"> </span><span class="sd">"""Returns a STRING token with `string` as its text."""</span> +</span><span id="Token.string-317"><a href="#Token.string-317"><span class="linenos">317</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">string</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a STRING token with <code><a href="#Token.string">string</a></code> as its text.</p> +</div> + + + </div> + <div id="Token.identifier" class="classattr"> + <input id="Token.identifier-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">identifier</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">identifier</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#Token">sqlglot.tokens.Token</a></span>:</span></span> + + <label class="view-source-button" for="Token.identifier-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Token.identifier"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Token.identifier-319"><a href="#Token.identifier-319"><span class="linenos">319</span></a> <span class="nd">@classmethod</span> +</span><span id="Token.identifier-320"><a href="#Token.identifier-320"><span class="linenos">320</span></a> <span class="k">def</span> <span class="nf">identifier</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">identifier</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token.identifier-321"><a href="#Token.identifier-321"><span class="linenos">321</span></a><span class="w"> </span><span class="sd">"""Returns an IDENTIFIER token with `identifier` as its text."""</span> +</span><span id="Token.identifier-322"><a href="#Token.identifier-322"><span class="linenos">322</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> <span class="n">identifier</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns an IDENTIFIER token with <code><a href="#Token.identifier">identifier</a></code> as its text.</p> +</div> + + + </div> + <div id="Token.var" class="classattr"> + <input id="Token.var-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + <div class="decorator">@classmethod</div> + + <span class="def">def</span> + <span class="name">var</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">cls</span>, </span><span class="param"><span class="n">var</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n"><a href="#Token">sqlglot.tokens.Token</a></span>:</span></span> + + <label class="view-source-button" for="Token.var-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Token.var"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Token.var-324"><a href="#Token.var-324"><span class="linenos">324</span></a> <span class="nd">@classmethod</span> +</span><span id="Token.var-325"><a href="#Token.var-325"><span class="linenos">325</span></a> <span class="k">def</span> <span class="nf">var</span><span class="p">(</span><span class="bp">cls</span><span class="p">,</span> <span class="n">var</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">Token</span><span class="p">:</span> +</span><span id="Token.var-326"><a href="#Token.var-326"><span class="linenos">326</span></a><span class="w"> </span><span class="sd">"""Returns an VAR token with `var` as its text."""</span> +</span><span id="Token.var-327"><a href="#Token.var-327"><span class="linenos">327</span></a> <span class="k">return</span> <span class="bp">cls</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">,</span> <span class="n">var</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Returns an VAR token with <code><a href="#Token.var">var</a></code> as its text.</p> +</div> + + + </div> + </section> + <section id="Tokenizer"> + <input id="Tokenizer-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr class"> + + <span class="def">class</span> + <span class="name">Tokenizer</span>: + + <label class="view-source-button" for="Tokenizer-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tokenizer"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tokenizer-388"><a href="#Tokenizer-388"><span class="linenos"> 388</span></a><span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">metaclass</span><span class="o">=</span><span class="n">_Tokenizer</span><span class="p">):</span> +</span><span id="Tokenizer-389"><a href="#Tokenizer-389"><span class="linenos"> 389</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tokenizer-390"><a href="#Tokenizer-390"><span class="linenos"> 390</span></a> <span class="s2">"("</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_PAREN</span><span class="p">,</span> +</span><span id="Tokenizer-391"><a href="#Tokenizer-391"><span class="linenos"> 391</span></a> <span class="s2">")"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_PAREN</span><span class="p">,</span> +</span><span id="Tokenizer-392"><a href="#Tokenizer-392"><span class="linenos"> 392</span></a> <span class="s2">"["</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACKET</span><span class="p">,</span> +</span><span id="Tokenizer-393"><a href="#Tokenizer-393"><span class="linenos"> 393</span></a> <span class="s2">"]"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACKET</span><span class="p">,</span> +</span><span id="Tokenizer-394"><a href="#Tokenizer-394"><span class="linenos"> 394</span></a> <span class="s2">"{"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">L_BRACE</span><span class="p">,</span> +</span><span id="Tokenizer-395"><a href="#Tokenizer-395"><span class="linenos"> 395</span></a> <span class="s2">"}"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">R_BRACE</span><span class="p">,</span> +</span><span id="Tokenizer-396"><a href="#Tokenizer-396"><span class="linenos"> 396</span></a> <span class="s2">"&"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AMP</span><span class="p">,</span> +</span><span id="Tokenizer-397"><a href="#Tokenizer-397"><span class="linenos"> 397</span></a> <span class="s2">"^"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CARET</span><span class="p">,</span> +</span><span id="Tokenizer-398"><a href="#Tokenizer-398"><span class="linenos"> 398</span></a> <span class="s2">":"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLON</span><span class="p">,</span> +</span><span id="Tokenizer-399"><a href="#Tokenizer-399"><span class="linenos"> 399</span></a> <span class="s2">","</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMA</span><span class="p">,</span> +</span><span id="Tokenizer-400"><a href="#Tokenizer-400"><span class="linenos"> 400</span></a> <span class="s2">"."</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOT</span><span class="p">,</span> +</span><span id="Tokenizer-401"><a href="#Tokenizer-401"><span class="linenos"> 401</span></a> <span class="s2">"-"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DASH</span><span class="p">,</span> +</span><span id="Tokenizer-402"><a href="#Tokenizer-402"><span class="linenos"> 402</span></a> <span class="s2">"="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="Tokenizer-403"><a href="#Tokenizer-403"><span class="linenos"> 403</span></a> <span class="s2">">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span> +</span><span id="Tokenizer-404"><a href="#Tokenizer-404"><span class="linenos"> 404</span></a> <span class="s2">"<"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span> +</span><span id="Tokenizer-405"><a href="#Tokenizer-405"><span class="linenos"> 405</span></a> <span class="s2">"%"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span> +</span><span id="Tokenizer-406"><a href="#Tokenizer-406"><span class="linenos"> 406</span></a> <span class="s2">"!"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">,</span> +</span><span id="Tokenizer-407"><a href="#Tokenizer-407"><span class="linenos"> 407</span></a> <span class="s2">"|"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIPE</span><span class="p">,</span> +</span><span id="Tokenizer-408"><a href="#Tokenizer-408"><span class="linenos"> 408</span></a> <span class="s2">"+"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLUS</span><span class="p">,</span> +</span><span id="Tokenizer-409"><a href="#Tokenizer-409"><span class="linenos"> 409</span></a> <span class="s2">";"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMICOLON</span><span class="p">,</span> +</span><span id="Tokenizer-410"><a href="#Tokenizer-410"><span class="linenos"> 410</span></a> <span class="s2">"/"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SLASH</span><span class="p">,</span> +</span><span id="Tokenizer-411"><a href="#Tokenizer-411"><span class="linenos"> 411</span></a> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BACKSLASH</span><span class="p">,</span> +</span><span id="Tokenizer-412"><a href="#Tokenizer-412"><span class="linenos"> 412</span></a> <span class="s2">"*"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STAR</span><span class="p">,</span> +</span><span id="Tokenizer-413"><a href="#Tokenizer-413"><span class="linenos"> 413</span></a> <span class="s2">"~"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TILDA</span><span class="p">,</span> +</span><span id="Tokenizer-414"><a href="#Tokenizer-414"><span class="linenos"> 414</span></a> <span class="s2">"?"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PLACEHOLDER</span><span class="p">,</span> +</span><span id="Tokenizer-415"><a href="#Tokenizer-415"><span class="linenos"> 415</span></a> <span class="s2">"@"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span><span class="p">,</span> +</span><span id="Tokenizer-416"><a href="#Tokenizer-416"><span class="linenos"> 416</span></a> <span class="c1"># used for breaking a var like x'y' but nothing else</span> +</span><span id="Tokenizer-417"><a href="#Tokenizer-417"><span class="linenos"> 417</span></a> <span class="c1"># the token type doesn't matter</span> +</span><span id="Tokenizer-418"><a href="#Tokenizer-418"><span class="linenos"> 418</span></a> <span class="s2">"'"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">QUOTE</span><span class="p">,</span> +</span><span id="Tokenizer-419"><a href="#Tokenizer-419"><span class="linenos"> 419</span></a> <span class="s2">"`"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> +</span><span id="Tokenizer-420"><a href="#Tokenizer-420"><span class="linenos"> 420</span></a> <span class="s1">'"'</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> +</span><span id="Tokenizer-421"><a href="#Tokenizer-421"><span class="linenos"> 421</span></a> <span class="s2">"#"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH</span><span class="p">,</span> +</span><span id="Tokenizer-422"><a href="#Tokenizer-422"><span class="linenos"> 422</span></a> <span class="p">}</span> +</span><span id="Tokenizer-423"><a href="#Tokenizer-423"><span class="linenos"> 423</span></a> +</span><span id="Tokenizer-424"><a href="#Tokenizer-424"><span class="linenos"> 424</span></a> <span class="n">QUOTES</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">|</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="Tokenizer-425"><a href="#Tokenizer-425"><span class="linenos"> 425</span></a> +</span><span id="Tokenizer-426"><a href="#Tokenizer-426"><span class="linenos"> 426</span></a> <span class="n">BIT_STRINGS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-427"><a href="#Tokenizer-427"><span class="linenos"> 427</span></a> +</span><span id="Tokenizer-428"><a href="#Tokenizer-428"><span class="linenos"> 428</span></a> <span class="n">HEX_STRINGS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-429"><a href="#Tokenizer-429"><span class="linenos"> 429</span></a> +</span><span id="Tokenizer-430"><a href="#Tokenizer-430"><span class="linenos"> 430</span></a> <span class="n">BYTE_STRINGS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-431"><a href="#Tokenizer-431"><span class="linenos"> 431</span></a> +</span><span id="Tokenizer-432"><a href="#Tokenizer-432"><span class="linenos"> 432</span></a> <span class="n">IDENTIFIERS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span> <span class="o">|</span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">]</span> +</span><span id="Tokenizer-433"><a href="#Tokenizer-433"><span class="linenos"> 433</span></a> +</span><span id="Tokenizer-434"><a href="#Tokenizer-434"><span class="linenos"> 434</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"'"</span><span class="p">]</span> +</span><span id="Tokenizer-435"><a href="#Tokenizer-435"><span class="linenos"> 435</span></a> +</span><span id="Tokenizer-436"><a href="#Tokenizer-436"><span class="linenos"> 436</span></a> <span class="n">_STRING_ESCAPES</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Tokenizer-437"><a href="#Tokenizer-437"><span class="linenos"> 437</span></a> +</span><span id="Tokenizer-438"><a href="#Tokenizer-438"><span class="linenos"> 438</span></a> <span class="n">IDENTIFIER_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'"'</span><span class="p">]</span> +</span><span id="Tokenizer-439"><a href="#Tokenizer-439"><span class="linenos"> 439</span></a> +</span><span id="Tokenizer-440"><a href="#Tokenizer-440"><span class="linenos"> 440</span></a> <span class="n">_IDENTIFIER_ESCAPES</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Set</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> +</span><span id="Tokenizer-441"><a href="#Tokenizer-441"><span class="linenos"> 441</span></a> +</span><span id="Tokenizer-442"><a href="#Tokenizer-442"><span class="linenos"> 442</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tokenizer-443"><a href="#Tokenizer-443"><span class="linenos"> 443</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="Tokenizer-444"><a href="#Tokenizer-444"><span class="linenos"> 444</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">key</span><span class="si">}{</span><span class="n">postfix</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_START</span> +</span><span id="Tokenizer-445"><a href="#Tokenizer-445"><span class="linenos"> 445</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"{{"</span><span class="p">,</span> <span class="s2">"{%"</span><span class="p">,</span> <span class="s2">"{#"</span><span class="p">)</span> +</span><span id="Tokenizer-446"><a href="#Tokenizer-446"><span class="linenos"> 446</span></a> <span class="k">for</span> <span class="n">postfix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span><span id="Tokenizer-447"><a href="#Tokenizer-447"><span class="linenos"> 447</span></a> <span class="p">},</span> +</span><span id="Tokenizer-448"><a href="#Tokenizer-448"><span class="linenos"> 448</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="Tokenizer-449"><a href="#Tokenizer-449"><span class="linenos"> 449</span></a> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">prefix</span><span class="si">}{</span><span class="n">key</span><span class="si">}</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_END</span> +</span><span id="Tokenizer-450"><a href="#Tokenizer-450"><span class="linenos"> 450</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"%}"</span><span class="p">,</span> <span class="s2">"#}"</span><span class="p">)</span> +</span><span id="Tokenizer-451"><a href="#Tokenizer-451"><span class="linenos"> 451</span></a> <span class="k">for</span> <span class="n">prefix</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">""</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">,</span> <span class="s2">"-"</span><span class="p">)</span> +</span><span id="Tokenizer-452"><a href="#Tokenizer-452"><span class="linenos"> 452</span></a> <span class="p">},</span> +</span><span id="Tokenizer-453"><a href="#Tokenizer-453"><span class="linenos"> 453</span></a> <span class="s2">"+}}"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_END</span><span class="p">,</span> +</span><span id="Tokenizer-454"><a href="#Tokenizer-454"><span class="linenos"> 454</span></a> <span class="s2">"-}}"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BLOCK_END</span><span class="p">,</span> +</span><span id="Tokenizer-455"><a href="#Tokenizer-455"><span class="linenos"> 455</span></a> <span class="s2">"/*+"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HINT</span><span class="p">,</span> +</span><span id="Tokenizer-456"><a href="#Tokenizer-456"><span class="linenos"> 456</span></a> <span class="s2">"=="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EQ</span><span class="p">,</span> +</span><span id="Tokenizer-457"><a href="#Tokenizer-457"><span class="linenos"> 457</span></a> <span class="s2">"::"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">,</span> +</span><span id="Tokenizer-458"><a href="#Tokenizer-458"><span class="linenos"> 458</span></a> <span class="s2">"||"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DPIPE</span><span class="p">,</span> +</span><span id="Tokenizer-459"><a href="#Tokenizer-459"><span class="linenos"> 459</span></a> <span class="s2">">="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span> +</span><span id="Tokenizer-460"><a href="#Tokenizer-460"><span class="linenos"> 460</span></a> <span class="s2">"<="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span> +</span><span id="Tokenizer-461"><a href="#Tokenizer-461"><span class="linenos"> 461</span></a> <span class="s2">"<>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="Tokenizer-462"><a href="#Tokenizer-462"><span class="linenos"> 462</span></a> <span class="s2">"!="</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span> +</span><span id="Tokenizer-463"><a href="#Tokenizer-463"><span class="linenos"> 463</span></a> <span class="s2">"<=>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLSAFE_EQ</span><span class="p">,</span> +</span><span id="Tokenizer-464"><a href="#Tokenizer-464"><span class="linenos"> 464</span></a> <span class="s2">"->"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARROW</span><span class="p">,</span> +</span><span id="Tokenizer-465"><a href="#Tokenizer-465"><span class="linenos"> 465</span></a> <span class="s2">"->>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DARROW</span><span class="p">,</span> +</span><span id="Tokenizer-466"><a href="#Tokenizer-466"><span class="linenos"> 466</span></a> <span class="s2">"=>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FARROW</span><span class="p">,</span> +</span><span id="Tokenizer-467"><a href="#Tokenizer-467"><span class="linenos"> 467</span></a> <span class="s2">"#>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HASH_ARROW</span><span class="p">,</span> +</span><span id="Tokenizer-468"><a href="#Tokenizer-468"><span class="linenos"> 468</span></a> <span class="s2">"#>>"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DHASH_ARROW</span><span class="p">,</span> +</span><span id="Tokenizer-469"><a href="#Tokenizer-469"><span class="linenos"> 469</span></a> <span class="s2">"<->"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LR_ARROW</span><span class="p">,</span> +</span><span id="Tokenizer-470"><a href="#Tokenizer-470"><span class="linenos"> 470</span></a> <span class="s2">"ALL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALL</span><span class="p">,</span> +</span><span id="Tokenizer-471"><a href="#Tokenizer-471"><span class="linenos"> 471</span></a> <span class="s2">"ALWAYS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALWAYS</span><span class="p">,</span> +</span><span id="Tokenizer-472"><a href="#Tokenizer-472"><span class="linenos"> 472</span></a> <span class="s2">"AND"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AND</span><span class="p">,</span> +</span><span id="Tokenizer-473"><a href="#Tokenizer-473"><span class="linenos"> 473</span></a> <span class="s2">"ANTI"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANTI</span><span class="p">,</span> +</span><span id="Tokenizer-474"><a href="#Tokenizer-474"><span class="linenos"> 474</span></a> <span class="s2">"ANY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ANY</span><span class="p">,</span> +</span><span id="Tokenizer-475"><a href="#Tokenizer-475"><span class="linenos"> 475</span></a> <span class="s2">"ASC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ASC</span><span class="p">,</span> +</span><span id="Tokenizer-476"><a href="#Tokenizer-476"><span class="linenos"> 476</span></a> <span class="s2">"AS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALIAS</span><span class="p">,</span> +</span><span id="Tokenizer-477"><a href="#Tokenizer-477"><span class="linenos"> 477</span></a> <span class="s2">"AT TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AT_TIME_ZONE</span><span class="p">,</span> +</span><span id="Tokenizer-478"><a href="#Tokenizer-478"><span class="linenos"> 478</span></a> <span class="s2">"AUTOINCREMENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> +</span><span id="Tokenizer-479"><a href="#Tokenizer-479"><span class="linenos"> 479</span></a> <span class="s2">"AUTO_INCREMENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">AUTO_INCREMENT</span><span class="p">,</span> +</span><span id="Tokenizer-480"><a href="#Tokenizer-480"><span class="linenos"> 480</span></a> <span class="s2">"BEGIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">,</span> +</span><span id="Tokenizer-481"><a href="#Tokenizer-481"><span class="linenos"> 481</span></a> <span class="s2">"BETWEEN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">,</span> +</span><span id="Tokenizer-482"><a href="#Tokenizer-482"><span class="linenos"> 482</span></a> <span class="s2">"BOTH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOTH</span><span class="p">,</span> +</span><span id="Tokenizer-483"><a href="#Tokenizer-483"><span class="linenos"> 483</span></a> <span class="s2">"BUCKET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BUCKET</span><span class="p">,</span> +</span><span id="Tokenizer-484"><a href="#Tokenizer-484"><span class="linenos"> 484</span></a> <span class="s2">"BY DEFAULT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BY_DEFAULT</span><span class="p">,</span> +</span><span id="Tokenizer-485"><a href="#Tokenizer-485"><span class="linenos"> 485</span></a> <span class="s2">"CACHE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CACHE</span><span class="p">,</span> +</span><span id="Tokenizer-486"><a href="#Tokenizer-486"><span class="linenos"> 486</span></a> <span class="s2">"UNCACHE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNCACHE</span><span class="p">,</span> +</span><span id="Tokenizer-487"><a href="#Tokenizer-487"><span class="linenos"> 487</span></a> <span class="s2">"CASE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASE</span><span class="p">,</span> +</span><span id="Tokenizer-488"><a href="#Tokenizer-488"><span class="linenos"> 488</span></a> <span class="s2">"CASCADE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CASCADE</span><span class="p">,</span> +</span><span id="Tokenizer-489"><a href="#Tokenizer-489"><span class="linenos"> 489</span></a> <span class="s2">"CHARACTER SET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHARACTER_SET</span><span class="p">,</span> +</span><span id="Tokenizer-490"><a href="#Tokenizer-490"><span class="linenos"> 490</span></a> <span class="s2">"CHECK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHECK</span><span class="p">,</span> +</span><span id="Tokenizer-491"><a href="#Tokenizer-491"><span class="linenos"> 491</span></a> <span class="s2">"CLUSTER BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CLUSTER_BY</span><span class="p">,</span> +</span><span id="Tokenizer-492"><a href="#Tokenizer-492"><span class="linenos"> 492</span></a> <span class="s2">"COLLATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLLATE</span><span class="p">,</span> +</span><span id="Tokenizer-493"><a href="#Tokenizer-493"><span class="linenos"> 493</span></a> <span class="s2">"COLUMN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COLUMN</span><span class="p">,</span> +</span><span id="Tokenizer-494"><a href="#Tokenizer-494"><span class="linenos"> 494</span></a> <span class="s2">"COMMENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA_COMMENT</span><span class="p">,</span> +</span><span id="Tokenizer-495"><a href="#Tokenizer-495"><span class="linenos"> 495</span></a> <span class="s2">"COMMIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMIT</span><span class="p">,</span> +</span><span id="Tokenizer-496"><a href="#Tokenizer-496"><span class="linenos"> 496</span></a> <span class="s2">"COMPOUND"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMPOUND</span><span class="p">,</span> +</span><span id="Tokenizer-497"><a href="#Tokenizer-497"><span class="linenos"> 497</span></a> <span class="s2">"CONSTRAINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CONSTRAINT</span><span class="p">,</span> +</span><span id="Tokenizer-498"><a href="#Tokenizer-498"><span class="linenos"> 498</span></a> <span class="s2">"CREATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CREATE</span><span class="p">,</span> +</span><span id="Tokenizer-499"><a href="#Tokenizer-499"><span class="linenos"> 499</span></a> <span class="s2">"CROSS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CROSS</span><span class="p">,</span> +</span><span id="Tokenizer-500"><a href="#Tokenizer-500"><span class="linenos"> 500</span></a> <span class="s2">"CUBE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CUBE</span><span class="p">,</span> +</span><span id="Tokenizer-501"><a href="#Tokenizer-501"><span class="linenos"> 501</span></a> <span class="s2">"CURRENT_DATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_DATE</span><span class="p">,</span> +</span><span id="Tokenizer-502"><a href="#Tokenizer-502"><span class="linenos"> 502</span></a> <span class="s2">"CURRENT ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_ROW</span><span class="p">,</span> +</span><span id="Tokenizer-503"><a href="#Tokenizer-503"><span class="linenos"> 503</span></a> <span class="s2">"CURRENT_TIMESTAMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CURRENT_TIMESTAMP</span><span class="p">,</span> +</span><span id="Tokenizer-504"><a href="#Tokenizer-504"><span class="linenos"> 504</span></a> <span class="s2">"DEFAULT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DEFAULT</span><span class="p">,</span> +</span><span id="Tokenizer-505"><a href="#Tokenizer-505"><span class="linenos"> 505</span></a> <span class="s2">"DELETE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> +</span><span id="Tokenizer-506"><a href="#Tokenizer-506"><span class="linenos"> 506</span></a> <span class="s2">"DESC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESC</span><span class="p">,</span> +</span><span id="Tokenizer-507"><a href="#Tokenizer-507"><span class="linenos"> 507</span></a> <span class="s2">"DESCRIBE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DESCRIBE</span><span class="p">,</span> +</span><span id="Tokenizer-508"><a href="#Tokenizer-508"><span class="linenos"> 508</span></a> <span class="s2">"DISTINCT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT</span><span class="p">,</span> +</span><span id="Tokenizer-509"><a href="#Tokenizer-509"><span class="linenos"> 509</span></a> <span class="s2">"DISTINCT FROM"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DISTINCT_FROM</span><span class="p">,</span> +</span><span id="Tokenizer-510"><a href="#Tokenizer-510"><span class="linenos"> 510</span></a> <span class="s2">"DISTRIBUTE BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DISTRIBUTE_BY</span><span class="p">,</span> +</span><span id="Tokenizer-511"><a href="#Tokenizer-511"><span class="linenos"> 511</span></a> <span class="s2">"DIV"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DIV</span><span class="p">,</span> +</span><span id="Tokenizer-512"><a href="#Tokenizer-512"><span class="linenos"> 512</span></a> <span class="s2">"DROP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DROP</span><span class="p">,</span> +</span><span id="Tokenizer-513"><a href="#Tokenizer-513"><span class="linenos"> 513</span></a> <span class="s2">"ELSE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ELSE</span><span class="p">,</span> +</span><span id="Tokenizer-514"><a href="#Tokenizer-514"><span class="linenos"> 514</span></a> <span class="s2">"END"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">END</span><span class="p">,</span> +</span><span id="Tokenizer-515"><a href="#Tokenizer-515"><span class="linenos"> 515</span></a> <span class="s2">"ESCAPE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ESCAPE</span><span class="p">,</span> +</span><span id="Tokenizer-516"><a href="#Tokenizer-516"><span class="linenos"> 516</span></a> <span class="s2">"EXCEPT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXCEPT</span><span class="p">,</span> +</span><span id="Tokenizer-517"><a href="#Tokenizer-517"><span class="linenos"> 517</span></a> <span class="s2">"EXECUTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXECUTE</span><span class="p">,</span> +</span><span id="Tokenizer-518"><a href="#Tokenizer-518"><span class="linenos"> 518</span></a> <span class="s2">"EXISTS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXISTS</span><span class="p">,</span> +</span><span id="Tokenizer-519"><a href="#Tokenizer-519"><span class="linenos"> 519</span></a> <span class="s2">"FALSE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FALSE</span><span class="p">,</span> +</span><span id="Tokenizer-520"><a href="#Tokenizer-520"><span class="linenos"> 520</span></a> <span class="s2">"FETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FETCH</span><span class="p">,</span> +</span><span id="Tokenizer-521"><a href="#Tokenizer-521"><span class="linenos"> 521</span></a> <span class="s2">"FILTER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FILTER</span><span class="p">,</span> +</span><span id="Tokenizer-522"><a href="#Tokenizer-522"><span class="linenos"> 522</span></a> <span class="s2">"FIRST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FIRST</span><span class="p">,</span> +</span><span id="Tokenizer-523"><a href="#Tokenizer-523"><span class="linenos"> 523</span></a> <span class="s2">"FULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FULL</span><span class="p">,</span> +</span><span id="Tokenizer-524"><a href="#Tokenizer-524"><span class="linenos"> 524</span></a> <span class="s2">"FUNCTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FUNCTION</span><span class="p">,</span> +</span><span id="Tokenizer-525"><a href="#Tokenizer-525"><span class="linenos"> 525</span></a> <span class="s2">"FOLLOWING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOLLOWING</span><span class="p">,</span> +</span><span id="Tokenizer-526"><a href="#Tokenizer-526"><span class="linenos"> 526</span></a> <span class="s2">"FOR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOR</span><span class="p">,</span> +</span><span id="Tokenizer-527"><a href="#Tokenizer-527"><span class="linenos"> 527</span></a> <span class="s2">"FOREIGN KEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FOREIGN_KEY</span><span class="p">,</span> +</span><span id="Tokenizer-528"><a href="#Tokenizer-528"><span class="linenos"> 528</span></a> <span class="s2">"FORMAT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">,</span> +</span><span id="Tokenizer-529"><a href="#Tokenizer-529"><span class="linenos"> 529</span></a> <span class="s2">"FROM"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FROM</span><span class="p">,</span> +</span><span id="Tokenizer-530"><a href="#Tokenizer-530"><span class="linenos"> 530</span></a> <span class="s2">"GENERATED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GENERATED</span><span class="p">,</span> +</span><span id="Tokenizer-531"><a href="#Tokenizer-531"><span class="linenos"> 531</span></a> <span class="s2">"GLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GLOB</span><span class="p">,</span> +</span><span id="Tokenizer-532"><a href="#Tokenizer-532"><span class="linenos"> 532</span></a> <span class="s2">"GROUP BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GROUP_BY</span><span class="p">,</span> +</span><span id="Tokenizer-533"><a href="#Tokenizer-533"><span class="linenos"> 533</span></a> <span class="s2">"GROUPING SETS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GROUPING_SETS</span><span class="p">,</span> +</span><span id="Tokenizer-534"><a href="#Tokenizer-534"><span class="linenos"> 534</span></a> <span class="s2">"HAVING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HAVING</span><span class="p">,</span> +</span><span id="Tokenizer-535"><a href="#Tokenizer-535"><span class="linenos"> 535</span></a> <span class="s2">"IDENTITY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTITY</span><span class="p">,</span> +</span><span id="Tokenizer-536"><a href="#Tokenizer-536"><span class="linenos"> 536</span></a> <span class="s2">"IF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IF</span><span class="p">,</span> +</span><span id="Tokenizer-537"><a href="#Tokenizer-537"><span class="linenos"> 537</span></a> <span class="s2">"ILIKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ILIKE</span><span class="p">,</span> +</span><span id="Tokenizer-538"><a href="#Tokenizer-538"><span class="linenos"> 538</span></a> <span class="s2">"IGNORE NULLS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IGNORE_NULLS</span><span class="p">,</span> +</span><span id="Tokenizer-539"><a href="#Tokenizer-539"><span class="linenos"> 539</span></a> <span class="s2">"IN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IN</span><span class="p">,</span> +</span><span id="Tokenizer-540"><a href="#Tokenizer-540"><span class="linenos"> 540</span></a> <span class="s2">"INDEX"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INDEX</span><span class="p">,</span> +</span><span id="Tokenizer-541"><a href="#Tokenizer-541"><span class="linenos"> 541</span></a> <span class="s2">"INNER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INNER</span><span class="p">,</span> +</span><span id="Tokenizer-542"><a href="#Tokenizer-542"><span class="linenos"> 542</span></a> <span class="s2">"INSERT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span> +</span><span id="Tokenizer-543"><a href="#Tokenizer-543"><span class="linenos"> 543</span></a> <span class="s2">"INTERVAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERVAL</span><span class="p">,</span> +</span><span id="Tokenizer-544"><a href="#Tokenizer-544"><span class="linenos"> 544</span></a> <span class="s2">"INTERSECT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTERSECT</span><span class="p">,</span> +</span><span id="Tokenizer-545"><a href="#Tokenizer-545"><span class="linenos"> 545</span></a> <span class="s2">"INTO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INTO</span><span class="p">,</span> +</span><span id="Tokenizer-546"><a href="#Tokenizer-546"><span class="linenos"> 546</span></a> <span class="s2">"IS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">IS</span><span class="p">,</span> +</span><span id="Tokenizer-547"><a href="#Tokenizer-547"><span class="linenos"> 547</span></a> <span class="s2">"ISNULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ISNULL</span><span class="p">,</span> +</span><span id="Tokenizer-548"><a href="#Tokenizer-548"><span class="linenos"> 548</span></a> <span class="s2">"JOIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JOIN</span><span class="p">,</span> +</span><span id="Tokenizer-549"><a href="#Tokenizer-549"><span class="linenos"> 549</span></a> <span class="s2">"LATERAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LATERAL</span><span class="p">,</span> +</span><span id="Tokenizer-550"><a href="#Tokenizer-550"><span class="linenos"> 550</span></a> <span class="s2">"LAZY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LAZY</span><span class="p">,</span> +</span><span id="Tokenizer-551"><a href="#Tokenizer-551"><span class="linenos"> 551</span></a> <span class="s2">"LEADING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEADING</span><span class="p">,</span> +</span><span id="Tokenizer-552"><a href="#Tokenizer-552"><span class="linenos"> 552</span></a> <span class="s2">"LEFT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LEFT</span><span class="p">,</span> +</span><span id="Tokenizer-553"><a href="#Tokenizer-553"><span class="linenos"> 553</span></a> <span class="s2">"LIKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIKE</span><span class="p">,</span> +</span><span id="Tokenizer-554"><a href="#Tokenizer-554"><span class="linenos"> 554</span></a> <span class="s2">"LIMIT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LIMIT</span><span class="p">,</span> +</span><span id="Tokenizer-555"><a href="#Tokenizer-555"><span class="linenos"> 555</span></a> <span class="s2">"LOAD DATA"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOAD_DATA</span><span class="p">,</span> +</span><span id="Tokenizer-556"><a href="#Tokenizer-556"><span class="linenos"> 556</span></a> <span class="s2">"LOCAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">,</span> +</span><span id="Tokenizer-557"><a href="#Tokenizer-557"><span class="linenos"> 557</span></a> <span class="s2">"MATERIALIZED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MATERIALIZED</span><span class="p">,</span> +</span><span id="Tokenizer-558"><a href="#Tokenizer-558"><span class="linenos"> 558</span></a> <span class="s2">"MERGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MERGE</span><span class="p">,</span> +</span><span id="Tokenizer-559"><a href="#Tokenizer-559"><span class="linenos"> 559</span></a> <span class="s2">"NATURAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NATURAL</span><span class="p">,</span> +</span><span id="Tokenizer-560"><a href="#Tokenizer-560"><span class="linenos"> 560</span></a> <span class="s2">"NEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEXT</span><span class="p">,</span> +</span><span id="Tokenizer-561"><a href="#Tokenizer-561"><span class="linenos"> 561</span></a> <span class="s2">"NO ACTION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NO_ACTION</span><span class="p">,</span> +</span><span id="Tokenizer-562"><a href="#Tokenizer-562"><span class="linenos"> 562</span></a> <span class="s2">"NOT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOT</span><span class="p">,</span> +</span><span id="Tokenizer-563"><a href="#Tokenizer-563"><span class="linenos"> 563</span></a> <span class="s2">"NOTNULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NOTNULL</span><span class="p">,</span> +</span><span id="Tokenizer-564"><a href="#Tokenizer-564"><span class="linenos"> 564</span></a> <span class="s2">"NULL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULL</span><span class="p">,</span> +</span><span id="Tokenizer-565"><a href="#Tokenizer-565"><span class="linenos"> 565</span></a> <span class="s2">"NULLS FIRST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_FIRST</span><span class="p">,</span> +</span><span id="Tokenizer-566"><a href="#Tokenizer-566"><span class="linenos"> 566</span></a> <span class="s2">"NULLS LAST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLS_LAST</span><span class="p">,</span> +</span><span id="Tokenizer-567"><a href="#Tokenizer-567"><span class="linenos"> 567</span></a> <span class="s2">"OBJECT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OBJECT</span><span class="p">,</span> +</span><span id="Tokenizer-568"><a href="#Tokenizer-568"><span class="linenos"> 568</span></a> <span class="s2">"OFFSET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OFFSET</span><span class="p">,</span> +</span><span id="Tokenizer-569"><a href="#Tokenizer-569"><span class="linenos"> 569</span></a> <span class="s2">"ON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ON</span><span class="p">,</span> +</span><span id="Tokenizer-570"><a href="#Tokenizer-570"><span class="linenos"> 570</span></a> <span class="s2">"ONLY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ONLY</span><span class="p">,</span> +</span><span id="Tokenizer-571"><a href="#Tokenizer-571"><span class="linenos"> 571</span></a> <span class="s2">"OPTIONS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OPTIONS</span><span class="p">,</span> +</span><span id="Tokenizer-572"><a href="#Tokenizer-572"><span class="linenos"> 572</span></a> <span class="s2">"OR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OR</span><span class="p">,</span> +</span><span id="Tokenizer-573"><a href="#Tokenizer-573"><span class="linenos"> 573</span></a> <span class="s2">"ORDER BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ORDER_BY</span><span class="p">,</span> +</span><span id="Tokenizer-574"><a href="#Tokenizer-574"><span class="linenos"> 574</span></a> <span class="s2">"ORDINALITY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ORDINALITY</span><span class="p">,</span> +</span><span id="Tokenizer-575"><a href="#Tokenizer-575"><span class="linenos"> 575</span></a> <span class="s2">"OUTER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OUTER</span><span class="p">,</span> +</span><span id="Tokenizer-576"><a href="#Tokenizer-576"><span class="linenos"> 576</span></a> <span class="s2">"OUT OF"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OUT_OF</span><span class="p">,</span> +</span><span id="Tokenizer-577"><a href="#Tokenizer-577"><span class="linenos"> 577</span></a> <span class="s2">"OVER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OVER</span><span class="p">,</span> +</span><span id="Tokenizer-578"><a href="#Tokenizer-578"><span class="linenos"> 578</span></a> <span class="s2">"OVERWRITE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">OVERWRITE</span><span class="p">,</span> +</span><span id="Tokenizer-579"><a href="#Tokenizer-579"><span class="linenos"> 579</span></a> <span class="s2">"PARTITION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION</span><span class="p">,</span> +</span><span id="Tokenizer-580"><a href="#Tokenizer-580"><span class="linenos"> 580</span></a> <span class="s2">"PARTITION BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> +</span><span id="Tokenizer-581"><a href="#Tokenizer-581"><span class="linenos"> 581</span></a> <span class="s2">"PARTITIONED BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> +</span><span id="Tokenizer-582"><a href="#Tokenizer-582"><span class="linenos"> 582</span></a> <span class="s2">"PARTITIONED_BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARTITION_BY</span><span class="p">,</span> +</span><span id="Tokenizer-583"><a href="#Tokenizer-583"><span class="linenos"> 583</span></a> <span class="s2">"PERCENT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PERCENT</span><span class="p">,</span> +</span><span id="Tokenizer-584"><a href="#Tokenizer-584"><span class="linenos"> 584</span></a> <span class="s2">"PIVOT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PIVOT</span><span class="p">,</span> +</span><span id="Tokenizer-585"><a href="#Tokenizer-585"><span class="linenos"> 585</span></a> <span class="s2">"PRECEDING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRECEDING</span><span class="p">,</span> +</span><span id="Tokenizer-586"><a href="#Tokenizer-586"><span class="linenos"> 586</span></a> <span class="s2">"PRIMARY KEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PRIMARY_KEY</span><span class="p">,</span> +</span><span id="Tokenizer-587"><a href="#Tokenizer-587"><span class="linenos"> 587</span></a> <span class="s2">"PROCEDURE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PROCEDURE</span><span class="p">,</span> +</span><span id="Tokenizer-588"><a href="#Tokenizer-588"><span class="linenos"> 588</span></a> <span class="s2">"QUALIFY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">QUALIFY</span><span class="p">,</span> +</span><span id="Tokenizer-589"><a href="#Tokenizer-589"><span class="linenos"> 589</span></a> <span class="s2">"RANGE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RANGE</span><span class="p">,</span> +</span><span id="Tokenizer-590"><a href="#Tokenizer-590"><span class="linenos"> 590</span></a> <span class="s2">"RECURSIVE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RECURSIVE</span><span class="p">,</span> +</span><span id="Tokenizer-591"><a href="#Tokenizer-591"><span class="linenos"> 591</span></a> <span class="s2">"REGEXP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="Tokenizer-592"><a href="#Tokenizer-592"><span class="linenos"> 592</span></a> <span class="s2">"REPLACE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">,</span> +</span><span id="Tokenizer-593"><a href="#Tokenizer-593"><span class="linenos"> 593</span></a> <span class="s2">"RESPECT NULLS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RESPECT_NULLS</span><span class="p">,</span> +</span><span id="Tokenizer-594"><a href="#Tokenizer-594"><span class="linenos"> 594</span></a> <span class="s2">"REFERENCES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">REFERENCES</span><span class="p">,</span> +</span><span id="Tokenizer-595"><a href="#Tokenizer-595"><span class="linenos"> 595</span></a> <span class="s2">"RIGHT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RIGHT</span><span class="p">,</span> +</span><span id="Tokenizer-596"><a href="#Tokenizer-596"><span class="linenos"> 596</span></a> <span class="s2">"RLIKE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">RLIKE</span><span class="p">,</span> +</span><span id="Tokenizer-597"><a href="#Tokenizer-597"><span class="linenos"> 597</span></a> <span class="s2">"ROLLBACK"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLBACK</span><span class="p">,</span> +</span><span id="Tokenizer-598"><a href="#Tokenizer-598"><span class="linenos"> 598</span></a> <span class="s2">"ROLLUP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROLLUP</span><span class="p">,</span> +</span><span id="Tokenizer-599"><a href="#Tokenizer-599"><span class="linenos"> 599</span></a> <span class="s2">"ROW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROW</span><span class="p">,</span> +</span><span id="Tokenizer-600"><a href="#Tokenizer-600"><span class="linenos"> 600</span></a> <span class="s2">"ROWS"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ROWS</span><span class="p">,</span> +</span><span id="Tokenizer-601"><a href="#Tokenizer-601"><span class="linenos"> 601</span></a> <span class="s2">"SCHEMA"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SCHEMA</span><span class="p">,</span> +</span><span id="Tokenizer-602"><a href="#Tokenizer-602"><span class="linenos"> 602</span></a> <span class="s2">"SEED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEED</span><span class="p">,</span> +</span><span id="Tokenizer-603"><a href="#Tokenizer-603"><span class="linenos"> 603</span></a> <span class="s2">"SELECT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span> +</span><span id="Tokenizer-604"><a href="#Tokenizer-604"><span class="linenos"> 604</span></a> <span class="s2">"SEMI"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SEMI</span><span class="p">,</span> +</span><span id="Tokenizer-605"><a href="#Tokenizer-605"><span class="linenos"> 605</span></a> <span class="s2">"SET"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> +</span><span id="Tokenizer-606"><a href="#Tokenizer-606"><span class="linenos"> 606</span></a> <span class="s2">"SHOW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">,</span> +</span><span id="Tokenizer-607"><a href="#Tokenizer-607"><span class="linenos"> 607</span></a> <span class="s2">"SIMILAR TO"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SIMILAR_TO</span><span class="p">,</span> +</span><span id="Tokenizer-608"><a href="#Tokenizer-608"><span class="linenos"> 608</span></a> <span class="s2">"SOME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SOME</span><span class="p">,</span> +</span><span id="Tokenizer-609"><a href="#Tokenizer-609"><span class="linenos"> 609</span></a> <span class="s2">"SORTKEY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORTKEY</span><span class="p">,</span> +</span><span id="Tokenizer-610"><a href="#Tokenizer-610"><span class="linenos"> 610</span></a> <span class="s2">"SORT BY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SORT_BY</span><span class="p">,</span> +</span><span id="Tokenizer-611"><a href="#Tokenizer-611"><span class="linenos"> 611</span></a> <span class="s2">"TABLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE</span><span class="p">,</span> +</span><span id="Tokenizer-612"><a href="#Tokenizer-612"><span class="linenos"> 612</span></a> <span class="s2">"TABLESAMPLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TABLE_SAMPLE</span><span class="p">,</span> +</span><span id="Tokenizer-613"><a href="#Tokenizer-613"><span class="linenos"> 613</span></a> <span class="s2">"TEMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="Tokenizer-614"><a href="#Tokenizer-614"><span class="linenos"> 614</span></a> <span class="s2">"TEMPORARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEMPORARY</span><span class="p">,</span> +</span><span id="Tokenizer-615"><a href="#Tokenizer-615"><span class="linenos"> 615</span></a> <span class="s2">"THEN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">THEN</span><span class="p">,</span> +</span><span id="Tokenizer-616"><a href="#Tokenizer-616"><span class="linenos"> 616</span></a> <span class="s2">"TRUE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRUE</span><span class="p">,</span> +</span><span id="Tokenizer-617"><a href="#Tokenizer-617"><span class="linenos"> 617</span></a> <span class="s2">"TRAILING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TRAILING</span><span class="p">,</span> +</span><span id="Tokenizer-618"><a href="#Tokenizer-618"><span class="linenos"> 618</span></a> <span class="s2">"UNBOUNDED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNBOUNDED</span><span class="p">,</span> +</span><span id="Tokenizer-619"><a href="#Tokenizer-619"><span class="linenos"> 619</span></a> <span class="s2">"UNION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNION</span><span class="p">,</span> +</span><span id="Tokenizer-620"><a href="#Tokenizer-620"><span class="linenos"> 620</span></a> <span class="s2">"UNLOGGED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNLOGGED</span><span class="p">,</span> +</span><span id="Tokenizer-621"><a href="#Tokenizer-621"><span class="linenos"> 621</span></a> <span class="s2">"UNNEST"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNNEST</span><span class="p">,</span> +</span><span id="Tokenizer-622"><a href="#Tokenizer-622"><span class="linenos"> 622</span></a> <span class="s2">"UNPIVOT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNPIVOT</span><span class="p">,</span> +</span><span id="Tokenizer-623"><a href="#Tokenizer-623"><span class="linenos"> 623</span></a> <span class="s2">"UPDATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UPDATE</span><span class="p">,</span> +</span><span id="Tokenizer-624"><a href="#Tokenizer-624"><span class="linenos"> 624</span></a> <span class="s2">"USE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">USE</span><span class="p">,</span> +</span><span id="Tokenizer-625"><a href="#Tokenizer-625"><span class="linenos"> 625</span></a> <span class="s2">"USING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">,</span> +</span><span id="Tokenizer-626"><a href="#Tokenizer-626"><span class="linenos"> 626</span></a> <span class="s2">"VALUES"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VALUES</span><span class="p">,</span> +</span><span id="Tokenizer-627"><a href="#Tokenizer-627"><span class="linenos"> 627</span></a> <span class="s2">"VIEW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VIEW</span><span class="p">,</span> +</span><span id="Tokenizer-628"><a href="#Tokenizer-628"><span class="linenos"> 628</span></a> <span class="s2">"VOLATILE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VOLATILE</span><span class="p">,</span> +</span><span id="Tokenizer-629"><a href="#Tokenizer-629"><span class="linenos"> 629</span></a> <span class="s2">"WHEN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WHEN</span><span class="p">,</span> +</span><span id="Tokenizer-630"><a href="#Tokenizer-630"><span class="linenos"> 630</span></a> <span class="s2">"WHERE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WHERE</span><span class="p">,</span> +</span><span id="Tokenizer-631"><a href="#Tokenizer-631"><span class="linenos"> 631</span></a> <span class="s2">"WINDOW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WINDOW</span><span class="p">,</span> +</span><span id="Tokenizer-632"><a href="#Tokenizer-632"><span class="linenos"> 632</span></a> <span class="s2">"WITH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH</span><span class="p">,</span> +</span><span id="Tokenizer-633"><a href="#Tokenizer-633"><span class="linenos"> 633</span></a> <span class="s2">"WITH TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_TIME_ZONE</span><span class="p">,</span> +</span><span id="Tokenizer-634"><a href="#Tokenizer-634"><span class="linenos"> 634</span></a> <span class="s2">"WITH LOCAL TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITH_LOCAL_TIME_ZONE</span><span class="p">,</span> +</span><span id="Tokenizer-635"><a href="#Tokenizer-635"><span class="linenos"> 635</span></a> <span class="s2">"WITHIN GROUP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITHIN_GROUP</span><span class="p">,</span> +</span><span id="Tokenizer-636"><a href="#Tokenizer-636"><span class="linenos"> 636</span></a> <span class="s2">"WITHOUT TIME ZONE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">WITHOUT_TIME_ZONE</span><span class="p">,</span> +</span><span id="Tokenizer-637"><a href="#Tokenizer-637"><span class="linenos"> 637</span></a> <span class="s2">"APPLY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">APPLY</span><span class="p">,</span> +</span><span id="Tokenizer-638"><a href="#Tokenizer-638"><span class="linenos"> 638</span></a> <span class="s2">"ARRAY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ARRAY</span><span class="p">,</span> +</span><span id="Tokenizer-639"><a href="#Tokenizer-639"><span class="linenos"> 639</span></a> <span class="s2">"BOOL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="Tokenizer-640"><a href="#Tokenizer-640"><span class="linenos"> 640</span></a> <span class="s2">"BOOLEAN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BOOLEAN</span><span class="p">,</span> +</span><span id="Tokenizer-641"><a href="#Tokenizer-641"><span class="linenos"> 641</span></a> <span class="s2">"BYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="Tokenizer-642"><a href="#Tokenizer-642"><span class="linenos"> 642</span></a> <span class="s2">"TINYINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TINYINT</span><span class="p">,</span> +</span><span id="Tokenizer-643"><a href="#Tokenizer-643"><span class="linenos"> 643</span></a> <span class="s2">"SHORT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="Tokenizer-644"><a href="#Tokenizer-644"><span class="linenos"> 644</span></a> <span class="s2">"SMALLINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="Tokenizer-645"><a href="#Tokenizer-645"><span class="linenos"> 645</span></a> <span class="s2">"INT2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span> +</span><span id="Tokenizer-646"><a href="#Tokenizer-646"><span class="linenos"> 646</span></a> <span class="s2">"INTEGER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="Tokenizer-647"><a href="#Tokenizer-647"><span class="linenos"> 647</span></a> <span class="s2">"INT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="Tokenizer-648"><a href="#Tokenizer-648"><span class="linenos"> 648</span></a> <span class="s2">"INT4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INT</span><span class="p">,</span> +</span><span id="Tokenizer-649"><a href="#Tokenizer-649"><span class="linenos"> 649</span></a> <span class="s2">"LONG"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="Tokenizer-650"><a href="#Tokenizer-650"><span class="linenos"> 650</span></a> <span class="s2">"BIGINT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="Tokenizer-651"><a href="#Tokenizer-651"><span class="linenos"> 651</span></a> <span class="s2">"INT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIGINT</span><span class="p">,</span> +</span><span id="Tokenizer-652"><a href="#Tokenizer-652"><span class="linenos"> 652</span></a> <span class="s2">"DECIMAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="Tokenizer-653"><a href="#Tokenizer-653"><span class="linenos"> 653</span></a> <span class="s2">"MAP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MAP</span><span class="p">,</span> +</span><span id="Tokenizer-654"><a href="#Tokenizer-654"><span class="linenos"> 654</span></a> <span class="s2">"NULLABLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NULLABLE</span><span class="p">,</span> +</span><span id="Tokenizer-655"><a href="#Tokenizer-655"><span class="linenos"> 655</span></a> <span class="s2">"NUMBER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="Tokenizer-656"><a href="#Tokenizer-656"><span class="linenos"> 656</span></a> <span class="s2">"NUMERIC"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="Tokenizer-657"><a href="#Tokenizer-657"><span class="linenos"> 657</span></a> <span class="s2">"FIXED"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DECIMAL</span><span class="p">,</span> +</span><span id="Tokenizer-658"><a href="#Tokenizer-658"><span class="linenos"> 658</span></a> <span class="s2">"REAL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="Tokenizer-659"><a href="#Tokenizer-659"><span class="linenos"> 659</span></a> <span class="s2">"FLOAT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="Tokenizer-660"><a href="#Tokenizer-660"><span class="linenos"> 660</span></a> <span class="s2">"FLOAT4"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">FLOAT</span><span class="p">,</span> +</span><span id="Tokenizer-661"><a href="#Tokenizer-661"><span class="linenos"> 661</span></a> <span class="s2">"FLOAT8"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="Tokenizer-662"><a href="#Tokenizer-662"><span class="linenos"> 662</span></a> <span class="s2">"DOUBLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="Tokenizer-663"><a href="#Tokenizer-663"><span class="linenos"> 663</span></a> <span class="s2">"DOUBLE PRECISION"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DOUBLE</span><span class="p">,</span> +</span><span id="Tokenizer-664"><a href="#Tokenizer-664"><span class="linenos"> 664</span></a> <span class="s2">"JSON"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">JSON</span><span class="p">,</span> +</span><span id="Tokenizer-665"><a href="#Tokenizer-665"><span class="linenos"> 665</span></a> <span class="s2">"CHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">CHAR</span><span class="p">,</span> +</span><span id="Tokenizer-666"><a href="#Tokenizer-666"><span class="linenos"> 666</span></a> <span class="s2">"NCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NCHAR</span><span class="p">,</span> +</span><span id="Tokenizer-667"><a href="#Tokenizer-667"><span class="linenos"> 667</span></a> <span class="s2">"VARCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Tokenizer-668"><a href="#Tokenizer-668"><span class="linenos"> 668</span></a> <span class="s2">"VARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARCHAR</span><span class="p">,</span> +</span><span id="Tokenizer-669"><a href="#Tokenizer-669"><span class="linenos"> 669</span></a> <span class="s2">"NVARCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="Tokenizer-670"><a href="#Tokenizer-670"><span class="linenos"> 670</span></a> <span class="s2">"NVARCHAR2"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NVARCHAR</span><span class="p">,</span> +</span><span id="Tokenizer-671"><a href="#Tokenizer-671"><span class="linenos"> 671</span></a> <span class="s2">"STR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="Tokenizer-672"><a href="#Tokenizer-672"><span class="linenos"> 672</span></a> <span class="s2">"STRING"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="Tokenizer-673"><a href="#Tokenizer-673"><span class="linenos"> 673</span></a> <span class="s2">"TEXT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="Tokenizer-674"><a href="#Tokenizer-674"><span class="linenos"> 674</span></a> <span class="s2">"CLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="Tokenizer-675"><a href="#Tokenizer-675"><span class="linenos"> 675</span></a> <span class="s2">"LONGVARCHAR"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TEXT</span><span class="p">,</span> +</span><span id="Tokenizer-676"><a href="#Tokenizer-676"><span class="linenos"> 676</span></a> <span class="s2">"BINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BINARY</span><span class="p">,</span> +</span><span id="Tokenizer-677"><a href="#Tokenizer-677"><span class="linenos"> 677</span></a> <span class="s2">"BLOB"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Tokenizer-678"><a href="#Tokenizer-678"><span class="linenos"> 678</span></a> <span class="s2">"BYTEA"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Tokenizer-679"><a href="#Tokenizer-679"><span class="linenos"> 679</span></a> <span class="s2">"VARBINARY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Tokenizer-680"><a href="#Tokenizer-680"><span class="linenos"> 680</span></a> <span class="s2">"TIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIME</span><span class="p">,</span> +</span><span id="Tokenizer-681"><a href="#Tokenizer-681"><span class="linenos"> 681</span></a> <span class="s2">"TIMESTAMP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMP</span><span class="p">,</span> +</span><span id="Tokenizer-682"><a href="#Tokenizer-682"><span class="linenos"> 682</span></a> <span class="s2">"TIMESTAMPTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">,</span> +</span><span id="Tokenizer-683"><a href="#Tokenizer-683"><span class="linenos"> 683</span></a> <span class="s2">"TIMESTAMPLTZ"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TIMESTAMPLTZ</span><span class="p">,</span> +</span><span id="Tokenizer-684"><a href="#Tokenizer-684"><span class="linenos"> 684</span></a> <span class="s2">"DATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATE</span><span class="p">,</span> +</span><span id="Tokenizer-685"><a href="#Tokenizer-685"><span class="linenos"> 685</span></a> <span class="s2">"DATETIME"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">DATETIME</span><span class="p">,</span> +</span><span id="Tokenizer-686"><a href="#Tokenizer-686"><span class="linenos"> 686</span></a> <span class="s2">"UNIQUE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">UNIQUE</span><span class="p">,</span> +</span><span id="Tokenizer-687"><a href="#Tokenizer-687"><span class="linenos"> 687</span></a> <span class="s2">"STRUCT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRUCT</span><span class="p">,</span> +</span><span id="Tokenizer-688"><a href="#Tokenizer-688"><span class="linenos"> 688</span></a> <span class="s2">"VARIANT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARIANT</span><span class="p">,</span> +</span><span id="Tokenizer-689"><a href="#Tokenizer-689"><span class="linenos"> 689</span></a> <span class="s2">"ALTER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">ALTER</span><span class="p">,</span> +</span><span id="Tokenizer-690"><a href="#Tokenizer-690"><span class="linenos"> 690</span></a> <span class="s2">"ALTER AGGREGATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-691"><a href="#Tokenizer-691"><span class="linenos"> 691</span></a> <span class="s2">"ALTER DEFAULT"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-692"><a href="#Tokenizer-692"><span class="linenos"> 692</span></a> <span class="s2">"ALTER DOMAIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-693"><a href="#Tokenizer-693"><span class="linenos"> 693</span></a> <span class="s2">"ALTER ROLE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-694"><a href="#Tokenizer-694"><span class="linenos"> 694</span></a> <span class="s2">"ALTER RULE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-695"><a href="#Tokenizer-695"><span class="linenos"> 695</span></a> <span class="s2">"ALTER SEQUENCE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-696"><a href="#Tokenizer-696"><span class="linenos"> 696</span></a> <span class="s2">"ALTER TYPE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-697"><a href="#Tokenizer-697"><span class="linenos"> 697</span></a> <span class="s2">"ALTER USER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-698"><a href="#Tokenizer-698"><span class="linenos"> 698</span></a> <span class="s2">"ALTER VIEW"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-699"><a href="#Tokenizer-699"><span class="linenos"> 699</span></a> <span class="s2">"ANALYZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-700"><a href="#Tokenizer-700"><span class="linenos"> 700</span></a> <span class="s2">"CALL"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-701"><a href="#Tokenizer-701"><span class="linenos"> 701</span></a> <span class="s2">"COPY"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-702"><a href="#Tokenizer-702"><span class="linenos"> 702</span></a> <span class="s2">"EXPLAIN"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-703"><a href="#Tokenizer-703"><span class="linenos"> 703</span></a> <span class="s2">"OPTIMIZE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-704"><a href="#Tokenizer-704"><span class="linenos"> 704</span></a> <span class="s2">"PREPARE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-705"><a href="#Tokenizer-705"><span class="linenos"> 705</span></a> <span class="s2">"TRUNCATE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-706"><a href="#Tokenizer-706"><span class="linenos"> 706</span></a> <span class="s2">"VACUUM"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-707"><a href="#Tokenizer-707"><span class="linenos"> 707</span></a> <span class="p">}</span> +</span><span id="Tokenizer-708"><a href="#Tokenizer-708"><span class="linenos"> 708</span></a> +</span><span id="Tokenizer-709"><a href="#Tokenizer-709"><span class="linenos"> 709</span></a> <span class="n">WHITE_SPACE</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tokenizer-710"><a href="#Tokenizer-710"><span class="linenos"> 710</span></a> <span class="s2">" "</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SPACE</span><span class="p">,</span> +</span><span id="Tokenizer-711"><a href="#Tokenizer-711"><span class="linenos"> 711</span></a> <span class="s2">"</span><span class="se">\t</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SPACE</span><span class="p">,</span> +</span><span id="Tokenizer-712"><a href="#Tokenizer-712"><span class="linenos"> 712</span></a> <span class="s2">"</span><span class="se">\n</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">,</span> +</span><span id="Tokenizer-713"><a href="#Tokenizer-713"><span class="linenos"> 713</span></a> <span class="s2">"</span><span class="se">\r</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">,</span> +</span><span id="Tokenizer-714"><a href="#Tokenizer-714"><span class="linenos"> 714</span></a> <span class="s2">"</span><span class="se">\r\n</span><span class="s2">"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">,</span> +</span><span id="Tokenizer-715"><a href="#Tokenizer-715"><span class="linenos"> 715</span></a> <span class="p">}</span> +</span><span id="Tokenizer-716"><a href="#Tokenizer-716"><span class="linenos"> 716</span></a> +</span><span id="Tokenizer-717"><a href="#Tokenizer-717"><span class="linenos"> 717</span></a> <span class="n">COMMANDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tokenizer-718"><a href="#Tokenizer-718"><span class="linenos"> 718</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Tokenizer-719"><a href="#Tokenizer-719"><span class="linenos"> 719</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">EXECUTE</span><span class="p">,</span> +</span><span id="Tokenizer-720"><a href="#Tokenizer-720"><span class="linenos"> 720</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">FETCH</span><span class="p">,</span> +</span><span id="Tokenizer-721"><a href="#Tokenizer-721"><span class="linenos"> 721</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">,</span> +</span><span id="Tokenizer-722"><a href="#Tokenizer-722"><span class="linenos"> 722</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">SHOW</span><span class="p">,</span> +</span><span id="Tokenizer-723"><a href="#Tokenizer-723"><span class="linenos"> 723</span></a> <span class="p">}</span> +</span><span id="Tokenizer-724"><a href="#Tokenizer-724"><span class="linenos"> 724</span></a> +</span><span id="Tokenizer-725"><a href="#Tokenizer-725"><span class="linenos"> 725</span></a> <span class="n">COMMAND_PREFIX_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SEMICOLON</span><span class="p">,</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BEGIN</span><span class="p">}</span> +</span><span id="Tokenizer-726"><a href="#Tokenizer-726"><span class="linenos"> 726</span></a> +</span><span id="Tokenizer-727"><a href="#Tokenizer-727"><span class="linenos"> 727</span></a> <span class="c1"># handle numeric literals like in hive (3L = BIGINT)</span> +</span><span id="Tokenizer-728"><a href="#Tokenizer-728"><span class="linenos"> 728</span></a> <span class="n">NUMERIC_LITERALS</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="Tokenizer-729"><a href="#Tokenizer-729"><span class="linenos"> 729</span></a> <span class="n">ENCODE</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-730"><a href="#Tokenizer-730"><span class="linenos"> 730</span></a> +</span><span id="Tokenizer-731"><a href="#Tokenizer-731"><span class="linenos"> 731</span></a> <span class="n">COMMENTS</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"--"</span><span class="p">,</span> <span class="p">(</span><span class="s2">"/*"</span><span class="p">,</span> <span class="s2">"*/"</span><span class="p">)]</span> +</span><span id="Tokenizer-732"><a href="#Tokenizer-732"><span class="linenos"> 732</span></a> <span class="n">KEYWORD_TRIE</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># autofilled</span> +</span><span id="Tokenizer-733"><a href="#Tokenizer-733"><span class="linenos"> 733</span></a> +</span><span id="Tokenizer-734"><a href="#Tokenizer-734"><span class="linenos"> 734</span></a> <span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tokenizer-735"><a href="#Tokenizer-735"><span class="linenos"> 735</span></a> +</span><span id="Tokenizer-736"><a href="#Tokenizer-736"><span class="linenos"> 736</span></a> <span class="vm">__slots__</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="Tokenizer-737"><a href="#Tokenizer-737"><span class="linenos"> 737</span></a> <span class="s2">"sql"</span><span class="p">,</span> +</span><span id="Tokenizer-738"><a href="#Tokenizer-738"><span class="linenos"> 738</span></a> <span class="s2">"size"</span><span class="p">,</span> +</span><span id="Tokenizer-739"><a href="#Tokenizer-739"><span class="linenos"> 739</span></a> <span class="s2">"tokens"</span><span class="p">,</span> +</span><span id="Tokenizer-740"><a href="#Tokenizer-740"><span class="linenos"> 740</span></a> <span class="s2">"_start"</span><span class="p">,</span> +</span><span id="Tokenizer-741"><a href="#Tokenizer-741"><span class="linenos"> 741</span></a> <span class="s2">"_current"</span><span class="p">,</span> +</span><span id="Tokenizer-742"><a href="#Tokenizer-742"><span class="linenos"> 742</span></a> <span class="s2">"_line"</span><span class="p">,</span> +</span><span id="Tokenizer-743"><a href="#Tokenizer-743"><span class="linenos"> 743</span></a> <span class="s2">"_col"</span><span class="p">,</span> +</span><span id="Tokenizer-744"><a href="#Tokenizer-744"><span class="linenos"> 744</span></a> <span class="s2">"_comments"</span><span class="p">,</span> +</span><span id="Tokenizer-745"><a href="#Tokenizer-745"><span class="linenos"> 745</span></a> <span class="s2">"_char"</span><span class="p">,</span> +</span><span id="Tokenizer-746"><a href="#Tokenizer-746"><span class="linenos"> 746</span></a> <span class="s2">"_end"</span><span class="p">,</span> +</span><span id="Tokenizer-747"><a href="#Tokenizer-747"><span class="linenos"> 747</span></a> <span class="s2">"_peek"</span><span class="p">,</span> +</span><span id="Tokenizer-748"><a href="#Tokenizer-748"><span class="linenos"> 748</span></a> <span class="s2">"_prev_token_line"</span><span class="p">,</span> +</span><span id="Tokenizer-749"><a href="#Tokenizer-749"><span class="linenos"> 749</span></a> <span class="s2">"_prev_token_comments"</span><span class="p">,</span> +</span><span id="Tokenizer-750"><a href="#Tokenizer-750"><span class="linenos"> 750</span></a> <span class="s2">"_prev_token_type"</span><span class="p">,</span> +</span><span id="Tokenizer-751"><a href="#Tokenizer-751"><span class="linenos"> 751</span></a> <span class="s2">"_replace_backslash"</span><span class="p">,</span> +</span><span id="Tokenizer-752"><a href="#Tokenizer-752"><span class="linenos"> 752</span></a> <span class="p">)</span> +</span><span id="Tokenizer-753"><a href="#Tokenizer-753"><span class="linenos"> 753</span></a> +</span><span id="Tokenizer-754"><a href="#Tokenizer-754"><span class="linenos"> 754</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-755"><a href="#Tokenizer-755"><span class="linenos"> 755</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span> +</span><span id="Tokenizer-756"><a href="#Tokenizer-756"><span class="linenos"> 756</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="Tokenizer-757"><a href="#Tokenizer-757"><span class="linenos"> 757</span></a> +</span><span id="Tokenizer-758"><a href="#Tokenizer-758"><span class="linenos"> 758</span></a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-759"><a href="#Tokenizer-759"><span class="linenos"> 759</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Tokenizer-760"><a href="#Tokenizer-760"><span class="linenos"> 760</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer-761"><a href="#Tokenizer-761"><span class="linenos"> 761</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-762"><a href="#Tokenizer-762"><span class="linenos"> 762</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer-763"><a href="#Tokenizer-763"><span class="linenos"> 763</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer-764"><a href="#Tokenizer-764"><span class="linenos"> 764</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Tokenizer-765"><a href="#Tokenizer-765"><span class="linenos"> 765</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Tokenizer-766"><a href="#Tokenizer-766"><span class="linenos"> 766</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-767"><a href="#Tokenizer-767"><span class="linenos"> 767</span></a> +</span><span id="Tokenizer-768"><a href="#Tokenizer-768"><span class="linenos"> 768</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-769"><a href="#Tokenizer-769"><span class="linenos"> 769</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-770"><a href="#Tokenizer-770"><span class="linenos"> 770</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-771"><a href="#Tokenizer-771"><span class="linenos"> 771</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="Tokenizer-772"><a href="#Tokenizer-772"><span class="linenos"> 772</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-773"><a href="#Tokenizer-773"><span class="linenos"> 773</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-774"><a href="#Tokenizer-774"><span class="linenos"> 774</span></a> +</span><span id="Tokenizer-775"><a href="#Tokenizer-775"><span class="linenos"> 775</span></a> <span class="k">def</span> <span class="nf">tokenize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]:</span> +</span><span id="Tokenizer-776"><a href="#Tokenizer-776"><span class="linenos"> 776</span></a><span class="w"> </span><span class="sd">"""Returns a list of tokens corresponding to the SQL string `sql`."""</span> +</span><span id="Tokenizer-777"><a href="#Tokenizer-777"><span class="linenos"> 777</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="Tokenizer-778"><a href="#Tokenizer-778"><span class="linenos"> 778</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span> +</span><span id="Tokenizer-779"><a href="#Tokenizer-779"><span class="linenos"> 779</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +</span><span id="Tokenizer-780"><a href="#Tokenizer-780"><span class="linenos"> 780</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan</span><span class="p">()</span> +</span><span id="Tokenizer-781"><a href="#Tokenizer-781"><span class="linenos"> 781</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span> +</span><span id="Tokenizer-782"><a href="#Tokenizer-782"><span class="linenos"> 782</span></a> +</span><span id="Tokenizer-783"><a href="#Tokenizer-783"><span class="linenos"> 783</span></a> <span class="k">def</span> <span class="nf">_scan</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">until</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-784"><a href="#Tokenizer-784"><span class="linenos"> 784</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">:</span> +</span><span id="Tokenizer-785"><a href="#Tokenizer-785"><span class="linenos"> 785</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> +</span><span id="Tokenizer-786"><a href="#Tokenizer-786"><span class="linenos"> 786</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-787"><a href="#Tokenizer-787"><span class="linenos"> 787</span></a> +</span><span id="Tokenizer-788"><a href="#Tokenizer-788"><span class="linenos"> 788</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">:</span> +</span><span id="Tokenizer-789"><a href="#Tokenizer-789"><span class="linenos"> 789</span></a> <span class="k">break</span> +</span><span id="Tokenizer-790"><a href="#Tokenizer-790"><span class="linenos"> 790</span></a> +</span><span id="Tokenizer-791"><a href="#Tokenizer-791"><span class="linenos"> 791</span></a> <span class="n">white_space</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">WHITE_SPACE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-792"><a href="#Tokenizer-792"><span class="linenos"> 792</span></a> <span class="n">identifier_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_IDENTIFIERS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-793"><a href="#Tokenizer-793"><span class="linenos"> 793</span></a> +</span><span id="Tokenizer-794"><a href="#Tokenizer-794"><span class="linenos"> 794</span></a> <span class="k">if</span> <span class="n">white_space</span><span class="p">:</span> +</span><span id="Tokenizer-795"><a href="#Tokenizer-795"><span class="linenos"> 795</span></a> <span class="k">if</span> <span class="n">white_space</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">:</span> +</span><span id="Tokenizer-796"><a href="#Tokenizer-796"><span class="linenos"> 796</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Tokenizer-797"><a href="#Tokenizer-797"><span class="linenos"> 797</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Tokenizer-798"><a href="#Tokenizer-798"><span class="linenos"> 798</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="o">.</span><span class="n">isdigit</span><span class="p">():</span> <span class="c1"># type:ignore</span> +</span><span id="Tokenizer-799"><a href="#Tokenizer-799"><span class="linenos"> 799</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_number</span><span class="p">()</span> +</span><span id="Tokenizer-800"><a href="#Tokenizer-800"><span class="linenos"> 800</span></a> <span class="k">elif</span> <span class="n">identifier_end</span><span class="p">:</span> +</span><span id="Tokenizer-801"><a href="#Tokenizer-801"><span class="linenos"> 801</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_identifier</span><span class="p">(</span><span class="n">identifier_end</span><span class="p">)</span> +</span><span id="Tokenizer-802"><a href="#Tokenizer-802"><span class="linenos"> 802</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-803"><a href="#Tokenizer-803"><span class="linenos"> 803</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_keywords</span><span class="p">()</span> +</span><span id="Tokenizer-804"><a href="#Tokenizer-804"><span class="linenos"> 804</span></a> +</span><span id="Tokenizer-805"><a href="#Tokenizer-805"><span class="linenos"> 805</span></a> <span class="k">if</span> <span class="n">until</span> <span class="ow">and</span> <span class="n">until</span><span class="p">():</span> +</span><span id="Tokenizer-806"><a href="#Tokenizer-806"><span class="linenos"> 806</span></a> <span class="k">break</span> +</span><span id="Tokenizer-807"><a href="#Tokenizer-807"><span class="linenos"> 807</span></a> +</span><span id="Tokenizer-808"><a href="#Tokenizer-808"><span class="linenos"> 808</span></a> <span class="k">def</span> <span class="nf">_chars</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">size</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tokenizer-809"><a href="#Tokenizer-809"><span class="linenos"> 809</span></a> <span class="k">if</span> <span class="n">size</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Tokenizer-810"><a href="#Tokenizer-810"><span class="linenos"> 810</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-811"><a href="#Tokenizer-811"><span class="linenos"> 811</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="Tokenizer-812"><a href="#Tokenizer-812"><span class="linenos"> 812</span></a> <span class="n">end</span> <span class="o">=</span> <span class="n">start</span> <span class="o">+</span> <span class="n">size</span> +</span><span id="Tokenizer-813"><a href="#Tokenizer-813"><span class="linenos"> 813</span></a> <span class="k">if</span> <span class="n">end</span> <span class="o"><=</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span><span class="p">:</span> +</span><span id="Tokenizer-814"><a href="#Tokenizer-814"><span class="linenos"> 814</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span><span class="p">:</span><span class="n">end</span><span class="p">]</span> +</span><span id="Tokenizer-815"><a href="#Tokenizer-815"><span class="linenos"> 815</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Tokenizer-816"><a href="#Tokenizer-816"><span class="linenos"> 816</span></a> +</span><span id="Tokenizer-817"><a href="#Tokenizer-817"><span class="linenos"> 817</span></a> <span class="k">def</span> <span class="nf">_advance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">i</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-818"><a href="#Tokenizer-818"><span class="linenos"> 818</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">+=</span> <span class="n">i</span> +</span><span id="Tokenizer-819"><a href="#Tokenizer-819"><span class="linenos"> 819</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">+=</span> <span class="n">i</span> +</span><span id="Tokenizer-820"><a href="#Tokenizer-820"><span class="linenos"> 820</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">>=</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-821"><a href="#Tokenizer-821"><span class="linenos"> 821</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-822"><a href="#Tokenizer-822"><span class="linenos"> 822</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_current</span><span class="p">]</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="k">else</span> <span class="s2">""</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-823"><a href="#Tokenizer-823"><span class="linenos"> 823</span></a> +</span><span id="Tokenizer-824"><a href="#Tokenizer-824"><span class="linenos"> 824</span></a> <span class="nd">@property</span> +</span><span id="Tokenizer-825"><a href="#Tokenizer-825"><span class="linenos"> 825</span></a> <span class="k">def</span> <span class="nf">_text</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tokenizer-826"><a href="#Tokenizer-826"><span class="linenos"> 826</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span><span class="p">]</span> +</span><span id="Tokenizer-827"><a href="#Tokenizer-827"><span class="linenos"> 827</span></a> +</span><span id="Tokenizer-828"><a href="#Tokenizer-828"><span class="linenos"> 828</span></a> <span class="k">def</span> <span class="nf">_add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">token_type</span><span class="p">:</span> <span class="n">TokenType</span><span class="p">,</span> <span class="n">text</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-829"><a href="#Tokenizer-829"><span class="linenos"> 829</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> +</span><span id="Tokenizer-830"><a href="#Tokenizer-830"><span class="linenos"> 830</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_comments</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> +</span><span id="Tokenizer-831"><a href="#Tokenizer-831"><span class="linenos"> 831</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">=</span> <span class="n">token_type</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-832"><a href="#Tokenizer-832"><span class="linenos"> 832</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="Tokenizer-833"><a href="#Tokenizer-833"><span class="linenos"> 833</span></a> <span class="n">Token</span><span class="p">(</span> +</span><span id="Tokenizer-834"><a href="#Tokenizer-834"><span class="linenos"> 834</span></a> <span class="n">token_type</span><span class="p">,</span> +</span><span id="Tokenizer-835"><a href="#Tokenizer-835"><span class="linenos"> 835</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> <span class="k">if</span> <span class="n">text</span> <span class="ow">is</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">text</span><span class="p">,</span> +</span><span id="Tokenizer-836"><a href="#Tokenizer-836"><span class="linenos"> 836</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="p">,</span> +</span><span id="Tokenizer-837"><a href="#Tokenizer-837"><span class="linenos"> 837</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span><span class="p">,</span> +</span><span id="Tokenizer-838"><a href="#Tokenizer-838"><span class="linenos"> 838</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">,</span> +</span><span id="Tokenizer-839"><a href="#Tokenizer-839"><span class="linenos"> 839</span></a> <span class="p">)</span> +</span><span id="Tokenizer-840"><a href="#Tokenizer-840"><span class="linenos"> 840</span></a> <span class="p">)</span> +</span><span id="Tokenizer-841"><a href="#Tokenizer-841"><span class="linenos"> 841</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-842"><a href="#Tokenizer-842"><span class="linenos"> 842</span></a> +</span><span id="Tokenizer-843"><a href="#Tokenizer-843"><span class="linenos"> 843</span></a> <span class="c1"># If we have either a semicolon or a begin token before the command's token, we'll parse</span> +</span><span id="Tokenizer-844"><a href="#Tokenizer-844"><span class="linenos"> 844</span></a> <span class="c1"># whatever follows the command's token as a string</span> +</span><span id="Tokenizer-845"><a href="#Tokenizer-845"><span class="linenos"> 845</span></a> <span class="k">if</span> <span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">COMMANDS</span> <span class="ow">and</span> <span class="p">(</span> +</span><span id="Tokenizer-846"><a href="#Tokenizer-846"><span class="linenos"> 846</span></a> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">[</span><span class="o">-</span><span class="mi">2</span><span class="p">]</span><span class="o">.</span><span class="n">token_type</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">COMMAND_PREFIX_TOKENS</span> +</span><span id="Tokenizer-847"><a href="#Tokenizer-847"><span class="linenos"> 847</span></a> <span class="p">):</span> +</span><span id="Tokenizer-848"><a href="#Tokenizer-848"><span class="linenos"> 848</span></a> <span class="n">start</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> +</span><span id="Tokenizer-849"><a href="#Tokenizer-849"><span class="linenos"> 849</span></a> <span class="n">tokens</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">)</span> +</span><span id="Tokenizer-850"><a href="#Tokenizer-850"><span class="linenos"> 850</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan</span><span class="p">(</span><span class="k">lambda</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="s2">";"</span><span class="p">)</span> +</span><span id="Tokenizer-851"><a href="#Tokenizer-851"><span class="linenos"> 851</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">[:</span><span class="n">tokens</span><span class="p">]</span> +</span><span id="Tokenizer-852"><a href="#Tokenizer-852"><span class="linenos"> 852</span></a> <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">start</span> <span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> +</span><span id="Tokenizer-853"><a href="#Tokenizer-853"><span class="linenos"> 853</span></a> <span class="k">if</span> <span class="n">text</span><span class="p">:</span> +</span><span id="Tokenizer-854"><a href="#Tokenizer-854"><span class="linenos"> 854</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="Tokenizer-855"><a href="#Tokenizer-855"><span class="linenos"> 855</span></a> +</span><span id="Tokenizer-856"><a href="#Tokenizer-856"><span class="linenos"> 856</span></a> <span class="k">def</span> <span class="nf">_scan_keywords</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-857"><a href="#Tokenizer-857"><span class="linenos"> 857</span></a> <span class="n">size</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer-858"><a href="#Tokenizer-858"><span class="linenos"> 858</span></a> <span class="n">word</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-859"><a href="#Tokenizer-859"><span class="linenos"> 859</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> +</span><span id="Tokenizer-860"><a href="#Tokenizer-860"><span class="linenos"> 860</span></a> <span class="n">char</span> <span class="o">=</span> <span class="n">chars</span> +</span><span id="Tokenizer-861"><a href="#Tokenizer-861"><span class="linenos"> 861</span></a> <span class="n">prev_space</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tokenizer-862"><a href="#Tokenizer-862"><span class="linenos"> 862</span></a> <span class="n">skip</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tokenizer-863"><a href="#Tokenizer-863"><span class="linenos"> 863</span></a> <span class="n">trie</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEYWORD_TRIE</span> +</span><span id="Tokenizer-864"><a href="#Tokenizer-864"><span class="linenos"> 864</span></a> +</span><span id="Tokenizer-865"><a href="#Tokenizer-865"><span class="linenos"> 865</span></a> <span class="k">while</span> <span class="n">chars</span><span class="p">:</span> +</span><span id="Tokenizer-866"><a href="#Tokenizer-866"><span class="linenos"> 866</span></a> <span class="k">if</span> <span class="n">skip</span><span class="p">:</span> +</span><span id="Tokenizer-867"><a href="#Tokenizer-867"><span class="linenos"> 867</span></a> <span class="n">result</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Tokenizer-868"><a href="#Tokenizer-868"><span class="linenos"> 868</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-869"><a href="#Tokenizer-869"><span class="linenos"> 869</span></a> <span class="n">result</span><span class="p">,</span> <span class="n">trie</span> <span class="o">=</span> <span class="n">in_trie</span><span class="p">(</span><span class="n">trie</span><span class="p">,</span> <span class="n">char</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-870"><a href="#Tokenizer-870"><span class="linenos"> 870</span></a> +</span><span id="Tokenizer-871"><a href="#Tokenizer-871"><span class="linenos"> 871</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> +</span><span id="Tokenizer-872"><a href="#Tokenizer-872"><span class="linenos"> 872</span></a> <span class="k">break</span> +</span><span id="Tokenizer-873"><a href="#Tokenizer-873"><span class="linenos"> 873</span></a> <span class="k">if</span> <span class="n">result</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> +</span><span id="Tokenizer-874"><a href="#Tokenizer-874"><span class="linenos"> 874</span></a> <span class="n">word</span> <span class="o">=</span> <span class="n">chars</span> +</span><span id="Tokenizer-875"><a href="#Tokenizer-875"><span class="linenos"> 875</span></a> <span class="n">size</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Tokenizer-876"><a href="#Tokenizer-876"><span class="linenos"> 876</span></a> <span class="n">end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">-</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">size</span> +</span><span id="Tokenizer-877"><a href="#Tokenizer-877"><span class="linenos"> 877</span></a> +</span><span id="Tokenizer-878"><a href="#Tokenizer-878"><span class="linenos"> 878</span></a> <span class="k">if</span> <span class="n">end</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">size</span><span class="p">:</span> +</span><span id="Tokenizer-879"><a href="#Tokenizer-879"><span class="linenos"> 879</span></a> <span class="n">char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">[</span><span class="n">end</span><span class="p">]</span> +</span><span id="Tokenizer-880"><a href="#Tokenizer-880"><span class="linenos"> 880</span></a> <span class="n">is_space</span> <span class="o">=</span> <span class="n">char</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">WHITE_SPACE</span> +</span><span id="Tokenizer-881"><a href="#Tokenizer-881"><span class="linenos"> 881</span></a> +</span><span id="Tokenizer-882"><a href="#Tokenizer-882"><span class="linenos"> 882</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">is_space</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">prev_space</span><span class="p">:</span> +</span><span id="Tokenizer-883"><a href="#Tokenizer-883"><span class="linenos"> 883</span></a> <span class="k">if</span> <span class="n">is_space</span><span class="p">:</span> +</span><span id="Tokenizer-884"><a href="#Tokenizer-884"><span class="linenos"> 884</span></a> <span class="n">char</span> <span class="o">=</span> <span class="s2">" "</span> +</span><span id="Tokenizer-885"><a href="#Tokenizer-885"><span class="linenos"> 885</span></a> <span class="n">chars</span> <span class="o">+=</span> <span class="n">char</span> +</span><span id="Tokenizer-886"><a href="#Tokenizer-886"><span class="linenos"> 886</span></a> <span class="n">prev_space</span> <span class="o">=</span> <span class="n">is_space</span> +</span><span id="Tokenizer-887"><a href="#Tokenizer-887"><span class="linenos"> 887</span></a> <span class="n">skip</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tokenizer-888"><a href="#Tokenizer-888"><span class="linenos"> 888</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-889"><a href="#Tokenizer-889"><span class="linenos"> 889</span></a> <span class="n">skip</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Tokenizer-890"><a href="#Tokenizer-890"><span class="linenos"> 890</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-891"><a href="#Tokenizer-891"><span class="linenos"> 891</span></a> <span class="n">chars</span> <span class="o">=</span> <span class="kc">None</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-892"><a href="#Tokenizer-892"><span class="linenos"> 892</span></a> +</span><span id="Tokenizer-893"><a href="#Tokenizer-893"><span class="linenos"> 893</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">word</span><span class="p">:</span> +</span><span id="Tokenizer-894"><a href="#Tokenizer-894"><span class="linenos"> 894</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> +</span><span id="Tokenizer-895"><a href="#Tokenizer-895"><span class="linenos"> 895</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_char</span><span class="p">])</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-896"><a href="#Tokenizer-896"><span class="linenos"> 896</span></a> <span class="k">return</span> +</span><span id="Tokenizer-897"><a href="#Tokenizer-897"><span class="linenos"> 897</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_var</span><span class="p">()</span> +</span><span id="Tokenizer-898"><a href="#Tokenizer-898"><span class="linenos"> 898</span></a> <span class="k">return</span> +</span><span id="Tokenizer-899"><a href="#Tokenizer-899"><span class="linenos"> 899</span></a> +</span><span id="Tokenizer-900"><a href="#Tokenizer-900"><span class="linenos"> 900</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_string</span><span class="p">(</span><span class="n">word</span><span class="p">):</span> +</span><span id="Tokenizer-901"><a href="#Tokenizer-901"><span class="linenos"> 901</span></a> <span class="k">return</span> +</span><span id="Tokenizer-902"><a href="#Tokenizer-902"><span class="linenos"> 902</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_formatted_string</span><span class="p">(</span><span class="n">word</span><span class="p">):</span> +</span><span id="Tokenizer-903"><a href="#Tokenizer-903"><span class="linenos"> 903</span></a> <span class="k">return</span> +</span><span id="Tokenizer-904"><a href="#Tokenizer-904"><span class="linenos"> 904</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_comment</span><span class="p">(</span><span class="n">word</span><span class="p">):</span> +</span><span id="Tokenizer-905"><a href="#Tokenizer-905"><span class="linenos"> 905</span></a> <span class="k">return</span> +</span><span id="Tokenizer-906"><a href="#Tokenizer-906"><span class="linenos"> 906</span></a> +</span><span id="Tokenizer-907"><a href="#Tokenizer-907"><span class="linenos"> 907</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Tokenizer-908"><a href="#Tokenizer-908"><span class="linenos"> 908</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">[</span><span class="n">word</span><span class="o">.</span><span class="n">upper</span><span class="p">()])</span> +</span><span id="Tokenizer-909"><a href="#Tokenizer-909"><span class="linenos"> 909</span></a> +</span><span id="Tokenizer-910"><a href="#Tokenizer-910"><span class="linenos"> 910</span></a> <span class="k">def</span> <span class="nf">_scan_comment</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">comment_start</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Tokenizer-911"><a href="#Tokenizer-911"><span class="linenos"> 911</span></a> <span class="k">if</span> <span class="n">comment_start</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_COMMENTS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-912"><a href="#Tokenizer-912"><span class="linenos"> 912</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="Tokenizer-913"><a href="#Tokenizer-913"><span class="linenos"> 913</span></a> +</span><span id="Tokenizer-914"><a href="#Tokenizer-914"><span class="linenos"> 914</span></a> <span class="n">comment_start_line</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> +</span><span id="Tokenizer-915"><a href="#Tokenizer-915"><span class="linenos"> 915</span></a> <span class="n">comment_start_size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">comment_start</span><span class="p">)</span> +</span><span id="Tokenizer-916"><a href="#Tokenizer-916"><span class="linenos"> 916</span></a> <span class="n">comment_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_COMMENTS</span><span class="p">[</span><span class="n">comment_start</span><span class="p">]</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-917"><a href="#Tokenizer-917"><span class="linenos"> 917</span></a> +</span><span id="Tokenizer-918"><a href="#Tokenizer-918"><span class="linenos"> 918</span></a> <span class="k">if</span> <span class="n">comment_end</span><span class="p">:</span> +</span><span id="Tokenizer-919"><a href="#Tokenizer-919"><span class="linenos"> 919</span></a> <span class="n">comment_end_size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">comment_end</span><span class="p">)</span> +</span><span id="Tokenizer-920"><a href="#Tokenizer-920"><span class="linenos"> 920</span></a> +</span><span id="Tokenizer-921"><a href="#Tokenizer-921"><span class="linenos"> 921</span></a> <span class="k">while</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_chars</span><span class="p">(</span><span class="n">comment_end_size</span><span class="p">)</span> <span class="o">!=</span> <span class="n">comment_end</span><span class="p">:</span> +</span><span id="Tokenizer-922"><a href="#Tokenizer-922"><span class="linenos"> 922</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-923"><a href="#Tokenizer-923"><span class="linenos"> 923</span></a> +</span><span id="Tokenizer-924"><a href="#Tokenizer-924"><span class="linenos"> 924</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_text</span><span class="p">[</span><span class="n">comment_start_size</span> <span class="p">:</span> <span class="o">-</span><span class="n">comment_end_size</span> <span class="o">+</span> <span class="mi">1</span><span class="p">])</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-925"><a href="#Tokenizer-925"><span class="linenos"> 925</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">comment_end_size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Tokenizer-926"><a href="#Tokenizer-926"><span class="linenos"> 926</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-927"><a href="#Tokenizer-927"><span class="linenos"> 927</span></a> <span class="k">while</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">WHITE_SPACE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="p">)</span> <span class="o">!=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BREAK</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-928"><a href="#Tokenizer-928"><span class="linenos"> 928</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-929"><a href="#Tokenizer-929"><span class="linenos"> 929</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_text</span><span class="p">[</span><span class="n">comment_start_size</span><span class="p">:])</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-930"><a href="#Tokenizer-930"><span class="linenos"> 930</span></a> +</span><span id="Tokenizer-931"><a href="#Tokenizer-931"><span class="linenos"> 931</span></a> <span class="c1"># Leading comment is attached to the succeeding token, whilst trailing comment to the preceding.</span> +</span><span id="Tokenizer-932"><a href="#Tokenizer-932"><span class="linenos"> 932</span></a> <span class="c1"># Multiple consecutive comments are preserved by appending them to the current comments list.</span> +</span><span id="Tokenizer-933"><a href="#Tokenizer-933"><span class="linenos"> 933</span></a> <span class="k">if</span> <span class="n">comment_start_line</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span><span class="p">:</span> +</span><span id="Tokenizer-934"><a href="#Tokenizer-934"><span class="linenos"> 934</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">comments</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">)</span> +</span><span id="Tokenizer-935"><a href="#Tokenizer-935"><span class="linenos"> 935</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-936"><a href="#Tokenizer-936"><span class="linenos"> 936</span></a> +</span><span id="Tokenizer-937"><a href="#Tokenizer-937"><span class="linenos"> 937</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Tokenizer-938"><a href="#Tokenizer-938"><span class="linenos"> 938</span></a> +</span><span id="Tokenizer-939"><a href="#Tokenizer-939"><span class="linenos"> 939</span></a> <span class="k">def</span> <span class="nf">_scan_number</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-940"><a href="#Tokenizer-940"><span class="linenos"> 940</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">==</span> <span class="s2">"0"</span><span class="p">:</span> +</span><span id="Tokenizer-941"><a href="#Tokenizer-941"><span class="linenos"> 941</span></a> <span class="n">peek</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-942"><a href="#Tokenizer-942"><span class="linenos"> 942</span></a> <span class="k">if</span> <span class="n">peek</span> <span class="o">==</span> <span class="s2">"B"</span><span class="p">:</span> +</span><span id="Tokenizer-943"><a href="#Tokenizer-943"><span class="linenos"> 943</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_bits</span><span class="p">()</span> +</span><span id="Tokenizer-944"><a href="#Tokenizer-944"><span class="linenos"> 944</span></a> <span class="k">elif</span> <span class="n">peek</span> <span class="o">==</span> <span class="s2">"X"</span><span class="p">:</span> +</span><span id="Tokenizer-945"><a href="#Tokenizer-945"><span class="linenos"> 945</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_scan_hex</span><span class="p">()</span> +</span><span id="Tokenizer-946"><a href="#Tokenizer-946"><span class="linenos"> 946</span></a> +</span><span id="Tokenizer-947"><a href="#Tokenizer-947"><span class="linenos"> 947</span></a> <span class="n">decimal</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tokenizer-948"><a href="#Tokenizer-948"><span class="linenos"> 948</span></a> <span class="n">scientific</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer-949"><a href="#Tokenizer-949"><span class="linenos"> 949</span></a> +</span><span id="Tokenizer-950"><a href="#Tokenizer-950"><span class="linenos"> 950</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Tokenizer-951"><a href="#Tokenizer-951"><span class="linenos"> 951</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">isdigit</span><span class="p">():</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-952"><a href="#Tokenizer-952"><span class="linenos"> 952</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-953"><a href="#Tokenizer-953"><span class="linenos"> 953</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="s2">"."</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">decimal</span><span class="p">:</span> +</span><span id="Tokenizer-954"><a href="#Tokenizer-954"><span class="linenos"> 954</span></a> <span class="n">decimal</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Tokenizer-955"><a href="#Tokenizer-955"><span class="linenos"> 955</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-956"><a href="#Tokenizer-956"><span class="linenos"> 956</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="ow">in</span> <span class="p">(</span><span class="s2">"-"</span><span class="p">,</span> <span class="s2">"+"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">scientific</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Tokenizer-957"><a href="#Tokenizer-957"><span class="linenos"> 957</span></a> <span class="n">scientific</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Tokenizer-958"><a href="#Tokenizer-958"><span class="linenos"> 958</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-959"><a href="#Tokenizer-959"><span class="linenos"> 959</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"E"</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">scientific</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-960"><a href="#Tokenizer-960"><span class="linenos"> 960</span></a> <span class="n">scientific</span> <span class="o">+=</span> <span class="mi">1</span> +</span><span id="Tokenizer-961"><a href="#Tokenizer-961"><span class="linenos"> 961</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-962"><a href="#Tokenizer-962"><span class="linenos"> 962</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">isidentifier</span><span class="p">():</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-963"><a href="#Tokenizer-963"><span class="linenos"> 963</span></a> <span class="n">number_text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> +</span><span id="Tokenizer-964"><a href="#Tokenizer-964"><span class="linenos"> 964</span></a> <span class="n">literal</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer-965"><a href="#Tokenizer-965"><span class="linenos"> 965</span></a> +</span><span id="Tokenizer-966"><a href="#Tokenizer-966"><span class="linenos"> 966</span></a> <span class="k">while</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-967"><a href="#Tokenizer-967"><span class="linenos"> 967</span></a> <span class="n">literal</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">upper</span><span class="p">())</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-968"><a href="#Tokenizer-968"><span class="linenos"> 968</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-969"><a href="#Tokenizer-969"><span class="linenos"> 969</span></a> +</span><span id="Tokenizer-970"><a href="#Tokenizer-970"><span class="linenos"> 970</span></a> <span class="n">literal</span> <span class="o">=</span> <span class="s2">""</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">literal</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-971"><a href="#Tokenizer-971"><span class="linenos"> 971</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">NUMERIC_LITERALS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">literal</span><span class="p">))</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-972"><a href="#Tokenizer-972"><span class="linenos"> 972</span></a> +</span><span id="Tokenizer-973"><a href="#Tokenizer-973"><span class="linenos"> 973</span></a> <span class="k">if</span> <span class="n">token_type</span><span class="p">:</span> +</span><span id="Tokenizer-974"><a href="#Tokenizer-974"><span class="linenos"> 974</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="n">number_text</span><span class="p">)</span> +</span><span id="Tokenizer-975"><a href="#Tokenizer-975"><span class="linenos"> 975</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">DCOLON</span><span class="p">,</span> <span class="s2">"::"</span><span class="p">)</span> +</span><span id="Tokenizer-976"><a href="#Tokenizer-976"><span class="linenos"> 976</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">literal</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-977"><a href="#Tokenizer-977"><span class="linenos"> 977</span></a> <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">IDENTIFIER_CAN_START_WITH_DIGIT</span><span class="p">:</span> +</span><span id="Tokenizer-978"><a href="#Tokenizer-978"><span class="linenos"> 978</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">)</span> +</span><span id="Tokenizer-979"><a href="#Tokenizer-979"><span class="linenos"> 979</span></a> +</span><span id="Tokenizer-980"><a href="#Tokenizer-980"><span class="linenos"> 980</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">,</span> <span class="n">number_text</span><span class="p">)</span> +</span><span id="Tokenizer-981"><a href="#Tokenizer-981"><span class="linenos"> 981</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="o">-</span><span class="nb">len</span><span class="p">(</span><span class="n">literal</span><span class="p">))</span> +</span><span id="Tokenizer-982"><a href="#Tokenizer-982"><span class="linenos"> 982</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-983"><a href="#Tokenizer-983"><span class="linenos"> 983</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NUMBER</span><span class="p">)</span> +</span><span id="Tokenizer-984"><a href="#Tokenizer-984"><span class="linenos"> 984</span></a> +</span><span id="Tokenizer-985"><a href="#Tokenizer-985"><span class="linenos"> 985</span></a> <span class="k">def</span> <span class="nf">_scan_bits</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-986"><a href="#Tokenizer-986"><span class="linenos"> 986</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-987"><a href="#Tokenizer-987"><span class="linenos"> 987</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_value</span><span class="p">()</span> +</span><span id="Tokenizer-988"><a href="#Tokenizer-988"><span class="linenos"> 988</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Tokenizer-989"><a href="#Tokenizer-989"><span class="linenos"> 989</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Tokenizer-990"><a href="#Tokenizer-990"><span class="linenos"> 990</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="Tokenizer-991"><a href="#Tokenizer-991"><span class="linenos"> 991</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">)</span> +</span><span id="Tokenizer-992"><a href="#Tokenizer-992"><span class="linenos"> 992</span></a> +</span><span id="Tokenizer-993"><a href="#Tokenizer-993"><span class="linenos"> 993</span></a> <span class="k">def</span> <span class="nf">_scan_hex</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-994"><a href="#Tokenizer-994"><span class="linenos"> 994</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-995"><a href="#Tokenizer-995"><span class="linenos"> 995</span></a> <span class="n">value</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_value</span><span class="p">()</span> +</span><span id="Tokenizer-996"><a href="#Tokenizer-996"><span class="linenos"> 996</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Tokenizer-997"><a href="#Tokenizer-997"><span class="linenos"> 997</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">int</span><span class="p">(</span><span class="n">value</span><span class="p">,</span><span class="w"> </span><span class="mi">16</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Tokenizer-998"><a href="#Tokenizer-998"><span class="linenos"> 998</span></a> <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span> +</span><span id="Tokenizer-999"><a href="#Tokenizer-999"><span class="linenos"> 999</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">)</span> +</span><span id="Tokenizer-1000"><a href="#Tokenizer-1000"><span class="linenos">1000</span></a> +</span><span id="Tokenizer-1001"><a href="#Tokenizer-1001"><span class="linenos">1001</span></a> <span class="k">def</span> <span class="nf">_extract_value</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tokenizer-1002"><a href="#Tokenizer-1002"><span class="linenos">1002</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Tokenizer-1003"><a href="#Tokenizer-1003"><span class="linenos">1003</span></a> <span class="n">char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1004"><a href="#Tokenizer-1004"><span class="linenos">1004</span></a> <span class="k">if</span> <span class="n">char</span> <span class="ow">and</span> <span class="n">char</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> +</span><span id="Tokenizer-1005"><a href="#Tokenizer-1005"><span class="linenos">1005</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-1006"><a href="#Tokenizer-1006"><span class="linenos">1006</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-1007"><a href="#Tokenizer-1007"><span class="linenos">1007</span></a> <span class="k">break</span> +</span><span id="Tokenizer-1008"><a href="#Tokenizer-1008"><span class="linenos">1008</span></a> +</span><span id="Tokenizer-1009"><a href="#Tokenizer-1009"><span class="linenos">1009</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_text</span> +</span><span id="Tokenizer-1010"><a href="#Tokenizer-1010"><span class="linenos">1010</span></a> +</span><span id="Tokenizer-1011"><a href="#Tokenizer-1011"><span class="linenos">1011</span></a> <span class="k">def</span> <span class="nf">_scan_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">quote</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Tokenizer-1012"><a href="#Tokenizer-1012"><span class="linenos">1012</span></a> <span class="n">quote_end</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_QUOTES</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">quote</span><span class="p">)</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1013"><a href="#Tokenizer-1013"><span class="linenos">1013</span></a> <span class="k">if</span> <span class="n">quote_end</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-1014"><a href="#Tokenizer-1014"><span class="linenos">1014</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="Tokenizer-1015"><a href="#Tokenizer-1015"><span class="linenos">1015</span></a> +</span><span id="Tokenizer-1016"><a href="#Tokenizer-1016"><span class="linenos">1016</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">quote</span><span class="p">))</span> +</span><span id="Tokenizer-1017"><a href="#Tokenizer-1017"><span class="linenos">1017</span></a> <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_string</span><span class="p">(</span><span class="n">quote_end</span><span class="p">)</span> +</span><span id="Tokenizer-1018"><a href="#Tokenizer-1018"><span class="linenos">1018</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">)</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ENCODE</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ENCODE</span> <span class="k">else</span> <span class="n">text</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1019"><a href="#Tokenizer-1019"><span class="linenos">1019</span></a> <span class="n">text</span> <span class="o">=</span> <span class="n">text</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">"</span><span class="se">\\\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">)</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="k">else</span> <span class="n">text</span> +</span><span id="Tokenizer-1020"><a href="#Tokenizer-1020"><span class="linenos">1020</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">NATIONAL</span> <span class="k">if</span> <span class="n">quote</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span> <span class="o">==</span> <span class="s2">"N"</span> <span class="k">else</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">STRING</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="Tokenizer-1021"><a href="#Tokenizer-1021"><span class="linenos">1021</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Tokenizer-1022"><a href="#Tokenizer-1022"><span class="linenos">1022</span></a> +</span><span id="Tokenizer-1023"><a href="#Tokenizer-1023"><span class="linenos">1023</span></a> <span class="c1"># X'1234, b'0110', E'\\\\\' etc.</span> +</span><span id="Tokenizer-1024"><a href="#Tokenizer-1024"><span class="linenos">1024</span></a> <span class="k">def</span> <span class="nf">_scan_formatted_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">string_start</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">bool</span><span class="p">:</span> +</span><span id="Tokenizer-1025"><a href="#Tokenizer-1025"><span class="linenos">1025</span></a> <span class="k">if</span> <span class="n">string_start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_HEX_STRINGS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1026"><a href="#Tokenizer-1026"><span class="linenos">1026</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_HEX_STRINGS</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1027"><a href="#Tokenizer-1027"><span class="linenos">1027</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HEX_STRING</span> +</span><span id="Tokenizer-1028"><a href="#Tokenizer-1028"><span class="linenos">1028</span></a> <span class="n">base</span> <span class="o">=</span> <span class="mi">16</span> +</span><span id="Tokenizer-1029"><a href="#Tokenizer-1029"><span class="linenos">1029</span></a> <span class="k">elif</span> <span class="n">string_start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BIT_STRINGS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1030"><a href="#Tokenizer-1030"><span class="linenos">1030</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BIT_STRINGS</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1031"><a href="#Tokenizer-1031"><span class="linenos">1031</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BIT_STRING</span> +</span><span id="Tokenizer-1032"><a href="#Tokenizer-1032"><span class="linenos">1032</span></a> <span class="n">base</span> <span class="o">=</span> <span class="mi">2</span> +</span><span id="Tokenizer-1033"><a href="#Tokenizer-1033"><span class="linenos">1033</span></a> <span class="k">elif</span> <span class="n">string_start</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span><span class="p">:</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1034"><a href="#Tokenizer-1034"><span class="linenos">1034</span></a> <span class="n">delimiters</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_BYTE_STRINGS</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1035"><a href="#Tokenizer-1035"><span class="linenos">1035</span></a> <span class="n">token_type</span> <span class="o">=</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">BYTE_STRING</span> +</span><span id="Tokenizer-1036"><a href="#Tokenizer-1036"><span class="linenos">1036</span></a> <span class="n">base</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer-1037"><a href="#Tokenizer-1037"><span class="linenos">1037</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-1038"><a href="#Tokenizer-1038"><span class="linenos">1038</span></a> <span class="k">return</span> <span class="kc">False</span> +</span><span id="Tokenizer-1039"><a href="#Tokenizer-1039"><span class="linenos">1039</span></a> +</span><span id="Tokenizer-1040"><a href="#Tokenizer-1040"><span class="linenos">1040</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">string_start</span><span class="p">))</span> +</span><span id="Tokenizer-1041"><a href="#Tokenizer-1041"><span class="linenos">1041</span></a> <span class="n">string_end</span> <span class="o">=</span> <span class="n">delimiters</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">string_start</span><span class="p">)</span> +</span><span id="Tokenizer-1042"><a href="#Tokenizer-1042"><span class="linenos">1042</span></a> <span class="n">text</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_extract_string</span><span class="p">(</span><span class="n">string_end</span><span class="p">)</span> +</span><span id="Tokenizer-1043"><a href="#Tokenizer-1043"><span class="linenos">1043</span></a> +</span><span id="Tokenizer-1044"><a href="#Tokenizer-1044"><span class="linenos">1044</span></a> <span class="k">if</span> <span class="n">base</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-1045"><a href="#Tokenizer-1045"><span class="linenos">1045</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="Tokenizer-1046"><a href="#Tokenizer-1046"><span class="linenos">1046</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-1047"><a href="#Tokenizer-1047"><span class="linenos">1047</span></a> <span class="k">try</span><span class="p">:</span> +</span><span id="Tokenizer-1048"><a href="#Tokenizer-1048"><span class="linenos">1048</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">token_type</span><span class="p">,</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="nb">int</span><span class="p">(</span><span class="n">text</span><span class="p">,</span><span class="w"> </span><span class="n">base</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Tokenizer-1049"><a href="#Tokenizer-1049"><span class="linenos">1049</span></a> <span class="k">except</span><span class="p">:</span> +</span><span id="Tokenizer-1050"><a href="#Tokenizer-1050"><span class="linenos">1050</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span> +</span><span id="Tokenizer-1051"><a href="#Tokenizer-1051"><span class="linenos">1051</span></a> <span class="sa">f</span><span class="s2">"Numeric string contains invalid characters from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Tokenizer-1052"><a href="#Tokenizer-1052"><span class="linenos">1052</span></a> <span class="p">)</span> +</span><span id="Tokenizer-1053"><a href="#Tokenizer-1053"><span class="linenos">1053</span></a> +</span><span id="Tokenizer-1054"><a href="#Tokenizer-1054"><span class="linenos">1054</span></a> <span class="k">return</span> <span class="kc">True</span> +</span><span id="Tokenizer-1055"><a href="#Tokenizer-1055"><span class="linenos">1055</span></a> +</span><span id="Tokenizer-1056"><a href="#Tokenizer-1056"><span class="linenos">1056</span></a> <span class="k">def</span> <span class="nf">_scan_identifier</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">identifier_end</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-1057"><a href="#Tokenizer-1057"><span class="linenos">1057</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Tokenizer-1058"><a href="#Tokenizer-1058"><span class="linenos">1058</span></a> <span class="n">identifier_end_is_escape</span> <span class="o">=</span> <span class="n">identifier_end</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_IDENTIFIER_ESCAPES</span> +</span><span id="Tokenizer-1059"><a href="#Tokenizer-1059"><span class="linenos">1059</span></a> +</span><span id="Tokenizer-1060"><a href="#Tokenizer-1060"><span class="linenos">1060</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Tokenizer-1061"><a href="#Tokenizer-1061"><span class="linenos">1061</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">:</span> +</span><span id="Tokenizer-1062"><a href="#Tokenizer-1062"><span class="linenos">1062</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Missing </span><span class="si">{</span><span class="n">identifier_end</span><span class="si">}</span><span class="s2"> from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Tokenizer-1063"><a href="#Tokenizer-1063"><span class="linenos">1063</span></a> +</span><span id="Tokenizer-1064"><a href="#Tokenizer-1064"><span class="linenos">1064</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-1065"><a href="#Tokenizer-1065"><span class="linenos">1065</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">==</span> <span class="n">identifier_end</span><span class="p">:</span> +</span><span id="Tokenizer-1066"><a href="#Tokenizer-1066"><span class="linenos">1066</span></a> <span class="k">if</span> <span class="n">identifier_end_is_escape</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="n">identifier_end</span><span class="p">:</span> +</span><span id="Tokenizer-1067"><a href="#Tokenizer-1067"><span class="linenos">1067</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="n">identifier_end</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1068"><a href="#Tokenizer-1068"><span class="linenos">1068</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-1069"><a href="#Tokenizer-1069"><span class="linenos">1069</span></a> <span class="k">continue</span> +</span><span id="Tokenizer-1070"><a href="#Tokenizer-1070"><span class="linenos">1070</span></a> +</span><span id="Tokenizer-1071"><a href="#Tokenizer-1071"><span class="linenos">1071</span></a> <span class="k">break</span> +</span><span id="Tokenizer-1072"><a href="#Tokenizer-1072"><span class="linenos">1072</span></a> +</span><span id="Tokenizer-1073"><a href="#Tokenizer-1073"><span class="linenos">1073</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1074"><a href="#Tokenizer-1074"><span class="linenos">1074</span></a> +</span><span id="Tokenizer-1075"><a href="#Tokenizer-1075"><span class="linenos">1075</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">IDENTIFIER</span><span class="p">,</span> <span class="n">text</span><span class="p">)</span> +</span><span id="Tokenizer-1076"><a href="#Tokenizer-1076"><span class="linenos">1076</span></a> +</span><span id="Tokenizer-1077"><a href="#Tokenizer-1077"><span class="linenos">1077</span></a> <span class="k">def</span> <span class="nf">_scan_var</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer-1078"><a href="#Tokenizer-1078"><span class="linenos">1078</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Tokenizer-1079"><a href="#Tokenizer-1079"><span class="linenos">1079</span></a> <span class="n">char</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1080"><a href="#Tokenizer-1080"><span class="linenos">1080</span></a> <span class="k">if</span> <span class="n">char</span> <span class="ow">and</span> <span class="n">char</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">:</span> +</span><span id="Tokenizer-1081"><a href="#Tokenizer-1081"><span class="linenos">1081</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-1082"><a href="#Tokenizer-1082"><span class="linenos">1082</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-1083"><a href="#Tokenizer-1083"><span class="linenos">1083</span></a> <span class="k">break</span> +</span><span id="Tokenizer-1084"><a href="#Tokenizer-1084"><span class="linenos">1084</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_add</span><span class="p">(</span> +</span><span id="Tokenizer-1085"><a href="#Tokenizer-1085"><span class="linenos">1085</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span> +</span><span id="Tokenizer-1086"><a href="#Tokenizer-1086"><span class="linenos">1086</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">==</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">PARAMETER</span> +</span><span id="Tokenizer-1087"><a href="#Tokenizer-1087"><span class="linenos">1087</span></a> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_text</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VAR</span><span class="p">)</span> +</span><span id="Tokenizer-1088"><a href="#Tokenizer-1088"><span class="linenos">1088</span></a> <span class="p">)</span> +</span><span id="Tokenizer-1089"><a href="#Tokenizer-1089"><span class="linenos">1089</span></a> +</span><span id="Tokenizer-1090"><a href="#Tokenizer-1090"><span class="linenos">1090</span></a> <span class="k">def</span> <span class="nf">_extract_string</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">delimiter</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tokenizer-1091"><a href="#Tokenizer-1091"><span class="linenos">1091</span></a> <span class="n">text</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Tokenizer-1092"><a href="#Tokenizer-1092"><span class="linenos">1092</span></a> <span class="n">delim_size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">delimiter</span><span class="p">)</span> +</span><span id="Tokenizer-1093"><a href="#Tokenizer-1093"><span class="linenos">1093</span></a> +</span><span id="Tokenizer-1094"><a href="#Tokenizer-1094"><span class="linenos">1094</span></a> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span> +</span><span id="Tokenizer-1095"><a href="#Tokenizer-1095"><span class="linenos">1095</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="Tokenizer-1096"><a href="#Tokenizer-1096"><span class="linenos">1096</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span> +</span><span id="Tokenizer-1097"><a href="#Tokenizer-1097"><span class="linenos">1097</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> +</span><span id="Tokenizer-1098"><a href="#Tokenizer-1098"><span class="linenos">1098</span></a> <span class="ow">and</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">==</span> <span class="n">delimiter</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span><span class="p">)</span> +</span><span id="Tokenizer-1099"><a href="#Tokenizer-1099"><span class="linenos">1099</span></a> <span class="p">):</span> +</span><span id="Tokenizer-1100"><a href="#Tokenizer-1100"><span class="linenos">1100</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> +</span><span id="Tokenizer-1101"><a href="#Tokenizer-1101"><span class="linenos">1101</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> +</span><span id="Tokenizer-1102"><a href="#Tokenizer-1102"><span class="linenos">1102</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="Tokenizer-1103"><a href="#Tokenizer-1103"><span class="linenos">1103</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_chars</span><span class="p">(</span><span class="n">delim_size</span><span class="p">)</span> <span class="o">==</span> <span class="n">delimiter</span><span class="p">:</span> +</span><span id="Tokenizer-1104"><a href="#Tokenizer-1104"><span class="linenos">1104</span></a> <span class="k">if</span> <span class="n">delim_size</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Tokenizer-1105"><a href="#Tokenizer-1105"><span class="linenos">1105</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">(</span><span class="n">delim_size</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> +</span><span id="Tokenizer-1106"><a href="#Tokenizer-1106"><span class="linenos">1106</span></a> <span class="k">break</span> +</span><span id="Tokenizer-1107"><a href="#Tokenizer-1107"><span class="linenos">1107</span></a> +</span><span id="Tokenizer-1108"><a href="#Tokenizer-1108"><span class="linenos">1108</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span><span class="p">:</span> +</span><span id="Tokenizer-1109"><a href="#Tokenizer-1109"><span class="linenos">1109</span></a> <span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Missing </span><span class="si">{</span><span class="n">delimiter</span><span class="si">}</span><span class="s2"> from </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_line</span><span class="si">}</span><span class="s2">:</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">_start</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Tokenizer-1110"><a href="#Tokenizer-1110"><span class="linenos">1110</span></a> <span class="n">text</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="c1"># type: ignore</span> +</span><span id="Tokenizer-1111"><a href="#Tokenizer-1111"><span class="linenos">1111</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_advance</span><span class="p">()</span> +</span><span id="Tokenizer-1112"><a href="#Tokenizer-1112"><span class="linenos">1112</span></a> +</span><span id="Tokenizer-1113"><a href="#Tokenizer-1113"><span class="linenos">1113</span></a> <span class="k">return</span> <span class="n">text</span> +</span></pre></div> + + + + + <div id="Tokenizer.__init__" class="classattr"> + <input id="Tokenizer.__init__-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="name">Tokenizer</span><span class="signature pdoc-code condensed">()</span> + + <label class="view-source-button" for="Tokenizer.__init__-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tokenizer.__init__"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tokenizer.__init__-754"><a href="#Tokenizer.__init__-754"><span class="linenos">754</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer.__init__-755"><a href="#Tokenizer.__init__-755"><span class="linenos">755</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_replace_backslash</span> <span class="o">=</span> <span class="s2">"</span><span class="se">\\</span><span class="s2">"</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_STRING_ESCAPES</span> +</span><span id="Tokenizer.__init__-756"><a href="#Tokenizer.__init__-756"><span class="linenos">756</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span></pre></div> + + + + + </div> + <div id="Tokenizer.reset" class="classattr"> + <input id="Tokenizer.reset-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">reset</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span></span><span class="return-annotation">) -> <span class="kc">None</span>:</span></span> + + <label class="view-source-button" for="Tokenizer.reset-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tokenizer.reset"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tokenizer.reset-758"><a href="#Tokenizer.reset-758"><span class="linenos">758</span></a> <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="kc">None</span><span class="p">:</span> +</span><span id="Tokenizer.reset-759"><a href="#Tokenizer.reset-759"><span class="linenos">759</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="s2">""</span> +</span><span id="Tokenizer.reset-760"><a href="#Tokenizer.reset-760"><span class="linenos">760</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer.reset-761"><a href="#Tokenizer.reset-761"><span class="linenos">761</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer.reset-762"><a href="#Tokenizer.reset-762"><span class="linenos">762</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_start</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer.reset-763"><a href="#Tokenizer.reset-763"><span class="linenos">763</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_current</span> <span class="o">=</span> <span class="mi">0</span> +</span><span id="Tokenizer.reset-764"><a href="#Tokenizer.reset-764"><span class="linenos">764</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_line</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Tokenizer.reset-765"><a href="#Tokenizer.reset-765"><span class="linenos">765</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_col</span> <span class="o">=</span> <span class="mi">1</span> +</span><span id="Tokenizer.reset-766"><a href="#Tokenizer.reset-766"><span class="linenos">766</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer.reset-767"><a href="#Tokenizer.reset-767"><span class="linenos">767</span></a> +</span><span id="Tokenizer.reset-768"><a href="#Tokenizer.reset-768"><span class="linenos">768</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_char</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer.reset-769"><a href="#Tokenizer.reset-769"><span class="linenos">769</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_end</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer.reset-770"><a href="#Tokenizer.reset-770"><span class="linenos">770</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_peek</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Tokenizer.reset-771"><a href="#Tokenizer.reset-771"><span class="linenos">771</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_line</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> +</span><span id="Tokenizer.reset-772"><a href="#Tokenizer.reset-772"><span class="linenos">772</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_comments</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Tokenizer.reset-773"><a href="#Tokenizer.reset-773"><span class="linenos">773</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_prev_token_type</span> <span class="o">=</span> <span class="kc">None</span> +</span></pre></div> + + + + + </div> + <div id="Tokenizer.tokenize" class="classattr"> + <input id="Tokenizer.tokenize-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">tokenize</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">sql</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n">List</span><span class="p">[</span><span class="n"><a href="#Token">sqlglot.tokens.Token</a></span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="Tokenizer.tokenize-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#Tokenizer.tokenize"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tokenizer.tokenize-775"><a href="#Tokenizer.tokenize-775"><span class="linenos">775</span></a> <span class="k">def</span> <span class="nf">tokenize</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sql</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">Token</span><span class="p">]:</span> +</span><span id="Tokenizer.tokenize-776"><a href="#Tokenizer.tokenize-776"><span class="linenos">776</span></a><span class="w"> </span><span class="sd">"""Returns a list of tokens corresponding to the SQL string `sql`."""</span> +</span><span id="Tokenizer.tokenize-777"><a href="#Tokenizer.tokenize-777"><span class="linenos">777</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span> +</span><span id="Tokenizer.tokenize-778"><a href="#Tokenizer.tokenize-778"><span class="linenos">778</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span> <span class="o">=</span> <span class="n">sql</span> +</span><span id="Tokenizer.tokenize-779"><a href="#Tokenizer.tokenize-779"><span class="linenos">779</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">size</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">sql</span><span class="p">)</span> +</span><span id="Tokenizer.tokenize-780"><a href="#Tokenizer.tokenize-780"><span class="linenos">780</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_scan</span><span class="p">()</span> +</span><span id="Tokenizer.tokenize-781"><a href="#Tokenizer.tokenize-781"><span class="linenos">781</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">tokens</span> +</span></pre></div> + + + <div class="docstring"><p>Returns a list of tokens corresponding to the SQL string <code>sql</code>.</p> +</div> + + + </div> + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/transforms.html b/docs/sqlglot/transforms.html new file mode 100644 index 0000000..77a2307 --- /dev/null +++ b/docs/sqlglot/transforms.html @@ -0,0 +1,667 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.transforms API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#unalias_group">unalias_group</a> + </li> + <li> + <a class="function" href="#eliminate_distinct_on">eliminate_distinct_on</a> + </li> + <li> + <a class="function" href="#remove_precision_parameterized_types">remove_precision_parameterized_types</a> + </li> + <li> + <a class="function" href="#preprocess">preprocess</a> + </li> + <li> + <a class="function" href="#delegate">delegate</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/transforms.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.transforms </h1> + + + <input id="mod-transforms-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-transforms-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.helper</span> <span class="kn">import</span> <span class="n">find_new_name</span> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="kn">from</span> <span class="nn">sqlglot.generator</span> <span class="kn">import</span> <span class="n">Generator</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">expressions</span> <span class="k">as</span> <span class="n">exp</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> +</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a><span class="k">def</span> <span class="nf">unalias_group</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a><span class="sd"> Replace references to select aliases in GROUP BY clauses.</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a><span class="sd"> Example:</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT a AS b FROM x GROUP BY b").transform(unalias_group).sql()</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a><span class="sd"> 'SELECT a AS b FROM x GROUP BY 1'</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> +</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a><span class="sd"> Args:</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a><span class="sd"> expression: the expression that will be transformed.</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a><span class="sd"> Returns:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a><span class="sd"> The transformed expression.</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a><span class="sd"> """</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="n">aliased_selects</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="n">e</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> <span class="n">i</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="p">}</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> +</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="k">for</span> <span class="n">group_by</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">group_by</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">group_by</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="ow">and</span> <span class="n">group_by</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">aliased_selects</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="p">):</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">group_by</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">aliased_selects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">group_by</span><span class="o">.</span><span class="n">name</span><span class="p">)))</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a><span class="k">def</span> <span class="nf">eliminate_distinct_on</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a><span class="sd"> Convert SELECT DISTINCT ON statements to a subquery with a window function.</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a><span class="sd"> This is useful for dialects that don't support SELECT DISTINCT ON but support window functions.</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a><span class="sd"> Args:</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a><span class="sd"> expression: the expression that will be transformed.</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a><span class="sd"> Returns:</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a><span class="sd"> The transformed expression.</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a><span class="sd"> """</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"on"</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="p">):</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="n">distinct_cols</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"on"</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="n">outer_selects</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="n">row_number</span> <span class="o">=</span> <span class="n">find_new_name</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span><span class="p">,</span> <span class="s2">"_row_number"</span><span class="p">)</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">window</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">(</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">RowNumber</span><span class="p">(),</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="n">partition_by</span><span class="o">=</span><span class="n">distinct_cols</span><span class="p">,</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="p">)</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="k">if</span> <span class="n">order</span><span class="p">:</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">window</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"order"</span><span class="p">,</span> <span class="n">order</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">order</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="n">window</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">row_number</span><span class="p">)</span> +</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">outer_selects</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">subquery</span><span class="p">())</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="sa">f</span><span class="s1">'"</span><span class="si">{</span><span class="n">row_number</span><span class="si">}</span><span class="s1">" = 1'</span><span class="p">)</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="k">return</span> <span class="n">expression</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a><span class="k">def</span> <span class="nf">remove_precision_parameterized_types</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a><span class="sd"> Some dialects only allow the precision for parameterized types to be defined in the DDL and not in other expressions.</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a><span class="sd"> This transforms removes the precision from parameterized types in expressions.</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a><span class="sd"> """</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="p">[</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">node_expression</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="k">for</span> <span class="n">node_expression</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="p">],</span> +</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="p">}</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="p">)</span> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="p">)</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> +</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a><span class="k">def</span> <span class="nf">preprocess</span><span class="p">(</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="n">transforms</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]],</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="n">to_sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">],</span> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a><span class="sd"> Creates a new transform by chaining a sequence of transformations and converts the resulting</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a><span class="sd"> expression to SQL, using an appropriate `Generator.TRANSFORMS` function.</span> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a><span class="sd"> Args:</span> +</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a><span class="sd"> transforms: sequence of transform functions. These will be called in order.</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a><span class="sd"> to_sql: final transform that converts the resulting expression to a SQL string.</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a><span class="sd"> Returns:</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a><span class="sd"> Function that can be used as a generator transform.</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a><span class="sd"> """</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> +</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">def</span> <span class="nf">_to_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">transforms</span><span class="p">[</span><span class="mi">0</span><span class="p">](</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">transforms</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">t</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="n">to_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">return</span> <span class="n">_to_sql</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> +</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> +</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a><span class="k">def</span> <span class="nf">delegate</span><span class="p">(</span><span class="n">attr</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">:</span> +</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a><span class="sd"> Create a new method that delegates to `attr`. This is useful for creating `Generator.TRANSFORMS`</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a><span class="sd"> functions that delegate to existing generator methods.</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a><span class="sd"> """</span> +</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="k">def</span> <span class="nf">_transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">return</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">attr</span><span class="p">)(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="n">_transform</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a><span class="n">UNALIAS_GROUP</span> <span class="o">=</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">:</span> <span class="n">preprocess</span><span class="p">([</span><span class="n">unalias_group</span><span class="p">],</span> <span class="n">delegate</span><span class="p">(</span><span class="s2">"group_sql"</span><span class="p">))}</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a><span class="n">ELIMINATE_DISTINCT_ON</span> <span class="o">=</span> <span class="p">{</span><span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">preprocess</span><span class="p">([</span><span class="n">eliminate_distinct_on</span><span class="p">],</span> <span class="n">delegate</span><span class="p">(</span><span class="s2">"select_sql"</span><span class="p">))}</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a><span class="n">REMOVE_PRECISION_PARAMETERIZED_TYPES</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">:</span> <span class="n">preprocess</span><span class="p">([</span><span class="n">remove_precision_parameterized_types</span><span class="p">],</span> <span class="n">delegate</span><span class="p">(</span><span class="s2">"cast_sql"</span><span class="p">))</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a><span class="p">}</span> +</span></pre></div> + + + </section> + <section id="unalias_group"> + <input id="unalias_group-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">unalias_group</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="unalias_group-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#unalias_group"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="unalias_group-14"><a href="#unalias_group-14"><span class="linenos">14</span></a><span class="k">def</span> <span class="nf">unalias_group</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="unalias_group-15"><a href="#unalias_group-15"><span class="linenos">15</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="unalias_group-16"><a href="#unalias_group-16"><span class="linenos">16</span></a><span class="sd"> Replace references to select aliases in GROUP BY clauses.</span> +</span><span id="unalias_group-17"><a href="#unalias_group-17"><span class="linenos">17</span></a> +</span><span id="unalias_group-18"><a href="#unalias_group-18"><span class="linenos">18</span></a><span class="sd"> Example:</span> +</span><span id="unalias_group-19"><a href="#unalias_group-19"><span class="linenos">19</span></a><span class="sd"> >>> import sqlglot</span> +</span><span id="unalias_group-20"><a href="#unalias_group-20"><span class="linenos">20</span></a><span class="sd"> >>> sqlglot.parse_one("SELECT a AS b FROM x GROUP BY b").transform(unalias_group).sql()</span> +</span><span id="unalias_group-21"><a href="#unalias_group-21"><span class="linenos">21</span></a><span class="sd"> 'SELECT a AS b FROM x GROUP BY 1'</span> +</span><span id="unalias_group-22"><a href="#unalias_group-22"><span class="linenos">22</span></a> +</span><span id="unalias_group-23"><a href="#unalias_group-23"><span class="linenos">23</span></a><span class="sd"> Args:</span> +</span><span id="unalias_group-24"><a href="#unalias_group-24"><span class="linenos">24</span></a><span class="sd"> expression: the expression that will be transformed.</span> +</span><span id="unalias_group-25"><a href="#unalias_group-25"><span class="linenos">25</span></a> +</span><span id="unalias_group-26"><a href="#unalias_group-26"><span class="linenos">26</span></a><span class="sd"> Returns:</span> +</span><span id="unalias_group-27"><a href="#unalias_group-27"><span class="linenos">27</span></a><span class="sd"> The transformed expression.</span> +</span><span id="unalias_group-28"><a href="#unalias_group-28"><span class="linenos">28</span></a><span class="sd"> """</span> +</span><span id="unalias_group-29"><a href="#unalias_group-29"><span class="linenos">29</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Group</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">):</span> +</span><span id="unalias_group-30"><a href="#unalias_group-30"><span class="linenos">30</span></a> <span class="n">aliased_selects</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="unalias_group-31"><a href="#unalias_group-31"><span class="linenos">31</span></a> <span class="n">e</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> <span class="n">i</span> +</span><span id="unalias_group-32"><a href="#unalias_group-32"><span class="linenos">32</span></a> <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">e</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="n">start</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> +</span><span id="unalias_group-33"><a href="#unalias_group-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">e</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Alias</span><span class="p">)</span> +</span><span id="unalias_group-34"><a href="#unalias_group-34"><span class="linenos">34</span></a> <span class="p">}</span> +</span><span id="unalias_group-35"><a href="#unalias_group-35"><span class="linenos">35</span></a> +</span><span id="unalias_group-36"><a href="#unalias_group-36"><span class="linenos">36</span></a> <span class="k">for</span> <span class="n">group_by</span> <span class="ow">in</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span><span class="p">:</span> +</span><span id="unalias_group-37"><a href="#unalias_group-37"><span class="linenos">37</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="unalias_group-38"><a href="#unalias_group-38"><span class="linenos">38</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">group_by</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">)</span> +</span><span id="unalias_group-39"><a href="#unalias_group-39"><span class="linenos">39</span></a> <span class="ow">and</span> <span class="ow">not</span> <span class="n">group_by</span><span class="o">.</span><span class="n">table</span> +</span><span id="unalias_group-40"><a href="#unalias_group-40"><span class="linenos">40</span></a> <span class="ow">and</span> <span class="n">group_by</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">aliased_selects</span> +</span><span id="unalias_group-41"><a href="#unalias_group-41"><span class="linenos">41</span></a> <span class="p">):</span> +</span><span id="unalias_group-42"><a href="#unalias_group-42"><span class="linenos">42</span></a> <span class="n">group_by</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Literal</span><span class="o">.</span><span class="n">number</span><span class="p">(</span><span class="n">aliased_selects</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">group_by</span><span class="o">.</span><span class="n">name</span><span class="p">)))</span> +</span><span id="unalias_group-43"><a href="#unalias_group-43"><span class="linenos">43</span></a> +</span><span id="unalias_group-44"><a href="#unalias_group-44"><span class="linenos">44</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Replace references to select aliases in GROUP BY clauses.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">sqlglot</span> +<span class="gp">>>> </span><span class="n"><a href="../sqlglot.html#parse_one">sqlglot.parse_one</a></span><span class="p">(</span><span class="s2">"SELECT a AS b FROM x GROUP BY b"</span><span class="p">)</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span><span class="n">unalias_group</span><span class="p">)</span><span class="o">.</span><span class="n">sql</span><span class="p">()</span> +<span class="go">'SELECT a AS b FROM x GROUP BY 1'</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression that will be transformed.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The transformed expression.</p> +</blockquote> +</div> + + + </section> + <section id="eliminate_distinct_on"> + <input id="eliminate_distinct_on-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">eliminate_distinct_on</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="eliminate_distinct_on-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#eliminate_distinct_on"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="eliminate_distinct_on-47"><a href="#eliminate_distinct_on-47"><span class="linenos">47</span></a><span class="k">def</span> <span class="nf">eliminate_distinct_on</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="eliminate_distinct_on-48"><a href="#eliminate_distinct_on-48"><span class="linenos">48</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="eliminate_distinct_on-49"><a href="#eliminate_distinct_on-49"><span class="linenos">49</span></a><span class="sd"> Convert SELECT DISTINCT ON statements to a subquery with a window function.</span> +</span><span id="eliminate_distinct_on-50"><a href="#eliminate_distinct_on-50"><span class="linenos">50</span></a> +</span><span id="eliminate_distinct_on-51"><a href="#eliminate_distinct_on-51"><span class="linenos">51</span></a><span class="sd"> This is useful for dialects that don't support SELECT DISTINCT ON but support window functions.</span> +</span><span id="eliminate_distinct_on-52"><a href="#eliminate_distinct_on-52"><span class="linenos">52</span></a> +</span><span id="eliminate_distinct_on-53"><a href="#eliminate_distinct_on-53"><span class="linenos">53</span></a><span class="sd"> Args:</span> +</span><span id="eliminate_distinct_on-54"><a href="#eliminate_distinct_on-54"><span class="linenos">54</span></a><span class="sd"> expression: the expression that will be transformed.</span> +</span><span id="eliminate_distinct_on-55"><a href="#eliminate_distinct_on-55"><span class="linenos">55</span></a> +</span><span id="eliminate_distinct_on-56"><a href="#eliminate_distinct_on-56"><span class="linenos">56</span></a><span class="sd"> Returns:</span> +</span><span id="eliminate_distinct_on-57"><a href="#eliminate_distinct_on-57"><span class="linenos">57</span></a><span class="sd"> The transformed expression.</span> +</span><span id="eliminate_distinct_on-58"><a href="#eliminate_distinct_on-58"><span class="linenos">58</span></a><span class="sd"> """</span> +</span><span id="eliminate_distinct_on-59"><a href="#eliminate_distinct_on-59"><span class="linenos">59</span></a> <span class="k">if</span> <span class="p">(</span> +</span><span id="eliminate_distinct_on-60"><a href="#eliminate_distinct_on-60"><span class="linenos">60</span></a> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-61"><a href="#eliminate_distinct_on-61"><span class="linenos">61</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"distinct"</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-62"><a href="#eliminate_distinct_on-62"><span class="linenos">62</span></a> <span class="ow">and</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"on"</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-63"><a href="#eliminate_distinct_on-63"><span class="linenos">63</span></a> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"on"</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Tuple</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-64"><a href="#eliminate_distinct_on-64"><span class="linenos">64</span></a> <span class="p">):</span> +</span><span id="eliminate_distinct_on-65"><a href="#eliminate_distinct_on-65"><span class="linenos">65</span></a> <span class="n">distinct_cols</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"on"</span><span class="p">]</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="eliminate_distinct_on-66"><a href="#eliminate_distinct_on-66"><span class="linenos">66</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s2">"distinct"</span><span class="p">]</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="eliminate_distinct_on-67"><a href="#eliminate_distinct_on-67"><span class="linenos">67</span></a> <span class="n">outer_selects</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">selects</span> +</span><span id="eliminate_distinct_on-68"><a href="#eliminate_distinct_on-68"><span class="linenos">68</span></a> <span class="n">row_number</span> <span class="o">=</span> <span class="n">find_new_name</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">named_selects</span><span class="p">,</span> <span class="s2">"_row_number"</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-69"><a href="#eliminate_distinct_on-69"><span class="linenos">69</span></a> <span class="n">window</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">Window</span><span class="p">(</span> +</span><span id="eliminate_distinct_on-70"><a href="#eliminate_distinct_on-70"><span class="linenos">70</span></a> <span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">RowNumber</span><span class="p">(),</span> +</span><span id="eliminate_distinct_on-71"><a href="#eliminate_distinct_on-71"><span class="linenos">71</span></a> <span class="n">partition_by</span><span class="o">=</span><span class="n">distinct_cols</span><span class="p">,</span> +</span><span id="eliminate_distinct_on-72"><a href="#eliminate_distinct_on-72"><span class="linenos">72</span></a> <span class="p">)</span> +</span><span id="eliminate_distinct_on-73"><a href="#eliminate_distinct_on-73"><span class="linenos">73</span></a> <span class="n">order</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"order"</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-74"><a href="#eliminate_distinct_on-74"><span class="linenos">74</span></a> <span class="k">if</span> <span class="n">order</span><span class="p">:</span> +</span><span id="eliminate_distinct_on-75"><a href="#eliminate_distinct_on-75"><span class="linenos">75</span></a> <span class="n">window</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"order"</span><span class="p">,</span> <span class="n">order</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="eliminate_distinct_on-76"><a href="#eliminate_distinct_on-76"><span class="linenos">76</span></a> <span class="n">order</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> +</span><span id="eliminate_distinct_on-77"><a href="#eliminate_distinct_on-77"><span class="linenos">77</span></a> <span class="n">window</span> <span class="o">=</span> <span class="n">exp</span><span class="o">.</span><span class="n">alias_</span><span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">row_number</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-78"><a href="#eliminate_distinct_on-78"><span class="linenos">78</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">window</span><span class="p">,</span> <span class="n">copy</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-79"><a href="#eliminate_distinct_on-79"><span class="linenos">79</span></a> <span class="k">return</span> <span class="n">exp</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="o">*</span><span class="n">outer_selects</span><span class="p">)</span><span class="o">.</span><span class="n">from_</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">subquery</span><span class="p">())</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="sa">f</span><span class="s1">'"</span><span class="si">{</span><span class="n">row_number</span><span class="si">}</span><span class="s1">" = 1'</span><span class="p">)</span> +</span><span id="eliminate_distinct_on-80"><a href="#eliminate_distinct_on-80"><span class="linenos">80</span></a> <span class="k">return</span> <span class="n">expression</span> +</span></pre></div> + + + <div class="docstring"><p>Convert SELECT DISTINCT ON statements to a subquery with a window function.</p> + +<p>This is useful for dialects that don't support SELECT DISTINCT ON but support window functions.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>expression:</strong> the expression that will be transformed.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The transformed expression.</p> +</blockquote> +</div> + + + </section> + <section id="remove_precision_parameterized_types"> + <input id="remove_precision_parameterized_types-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">remove_precision_parameterized_types</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">expression</span><span class="p">:</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span></span><span class="return-annotation">) -> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span>:</span></span> + + <label class="view-source-button" for="remove_precision_parameterized_types-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#remove_precision_parameterized_types"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="remove_precision_parameterized_types-83"><a href="#remove_precision_parameterized_types-83"><span class="linenos"> 83</span></a><span class="k">def</span> <span class="nf">remove_precision_parameterized_types</span><span class="p">(</span><span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">)</span> <span class="o">-></span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span> +</span><span id="remove_precision_parameterized_types-84"><a href="#remove_precision_parameterized_types-84"><span class="linenos"> 84</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="remove_precision_parameterized_types-85"><a href="#remove_precision_parameterized_types-85"><span class="linenos"> 85</span></a><span class="sd"> Some dialects only allow the precision for parameterized types to be defined in the DDL and not in other expressions.</span> +</span><span id="remove_precision_parameterized_types-86"><a href="#remove_precision_parameterized_types-86"><span class="linenos"> 86</span></a><span class="sd"> This transforms removes the precision from parameterized types in expressions.</span> +</span><span id="remove_precision_parameterized_types-87"><a href="#remove_precision_parameterized_types-87"><span class="linenos"> 87</span></a><span class="sd"> """</span> +</span><span id="remove_precision_parameterized_types-88"><a href="#remove_precision_parameterized_types-88"><span class="linenos"> 88</span></a> <span class="k">return</span> <span class="n">expression</span><span class="o">.</span><span class="n">transform</span><span class="p">(</span> +</span><span id="remove_precision_parameterized_types-89"><a href="#remove_precision_parameterized_types-89"><span class="linenos"> 89</span></a> <span class="k">lambda</span> <span class="n">node</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">(</span> +</span><span id="remove_precision_parameterized_types-90"><a href="#remove_precision_parameterized_types-90"><span class="linenos"> 90</span></a> <span class="o">**</span><span class="p">{</span> +</span><span id="remove_precision_parameterized_types-91"><a href="#remove_precision_parameterized_types-91"><span class="linenos"> 91</span></a> <span class="o">**</span><span class="n">node</span><span class="o">.</span><span class="n">args</span><span class="p">,</span> +</span><span id="remove_precision_parameterized_types-92"><a href="#remove_precision_parameterized_types-92"><span class="linenos"> 92</span></a> <span class="s2">"expressions"</span><span class="p">:</span> <span class="p">[</span> +</span><span id="remove_precision_parameterized_types-93"><a href="#remove_precision_parameterized_types-93"><span class="linenos"> 93</span></a> <span class="n">node_expression</span> +</span><span id="remove_precision_parameterized_types-94"><a href="#remove_precision_parameterized_types-94"><span class="linenos"> 94</span></a> <span class="k">for</span> <span class="n">node_expression</span> <span class="ow">in</span> <span class="n">node</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="remove_precision_parameterized_types-95"><a href="#remove_precision_parameterized_types-95"><span class="linenos"> 95</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node_expression</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="remove_precision_parameterized_types-96"><a href="#remove_precision_parameterized_types-96"><span class="linenos"> 96</span></a> <span class="p">],</span> +</span><span id="remove_precision_parameterized_types-97"><a href="#remove_precision_parameterized_types-97"><span class="linenos"> 97</span></a> <span class="p">}</span> +</span><span id="remove_precision_parameterized_types-98"><a href="#remove_precision_parameterized_types-98"><span class="linenos"> 98</span></a> <span class="p">)</span> +</span><span id="remove_precision_parameterized_types-99"><a href="#remove_precision_parameterized_types-99"><span class="linenos"> 99</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="p">)</span> +</span><span id="remove_precision_parameterized_types-100"><a href="#remove_precision_parameterized_types-100"><span class="linenos">100</span></a> <span class="k">else</span> <span class="n">node</span><span class="p">,</span> +</span><span id="remove_precision_parameterized_types-101"><a href="#remove_precision_parameterized_types-101"><span class="linenos">101</span></a> <span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Some dialects only allow the precision for parameterized types to be defined in the DDL and not in other expressions. +This transforms removes the precision from parameterized types in expressions.</p> +</div> + + + </section> + <section id="preprocess"> + <input id="preprocess-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">preprocess</span><span class="signature pdoc-code multiline">(<span class="param"> <span class="n">transforms</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">Callable</span><span class="p">[[</span><span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">]]</span>,</span><span class="param"> <span class="n">to_sql</span><span class="p">:</span> <span class="n">Callable</span><span class="p">[[</span><span class="n"><a href="generator.html#Generator">sqlglot.generator.Generator</a></span><span class="p">,</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="nb">str</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">Callable</span><span class="p">[[</span><span class="n"><a href="generator.html#Generator">sqlglot.generator.Generator</a></span><span class="p">,</span> <span class="n"><a href="expressions.html#Expression">sqlglot.expressions.Expression</a></span><span class="p">],</span> <span class="nb">str</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="preprocess-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#preprocess"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="preprocess-104"><a href="#preprocess-104"><span class="linenos">104</span></a><span class="k">def</span> <span class="nf">preprocess</span><span class="p">(</span> +</span><span id="preprocess-105"><a href="#preprocess-105"><span class="linenos">105</span></a> <span class="n">transforms</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]],</span> +</span><span id="preprocess-106"><a href="#preprocess-106"><span class="linenos">106</span></a> <span class="n">to_sql</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">],</span> +</span><span id="preprocess-107"><a href="#preprocess-107"><span class="linenos">107</span></a><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">[[</span><span class="n">Generator</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">],</span> <span class="nb">str</span><span class="p">]:</span> +</span><span id="preprocess-108"><a href="#preprocess-108"><span class="linenos">108</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="preprocess-109"><a href="#preprocess-109"><span class="linenos">109</span></a><span class="sd"> Creates a new transform by chaining a sequence of transformations and converts the resulting</span> +</span><span id="preprocess-110"><a href="#preprocess-110"><span class="linenos">110</span></a><span class="sd"> expression to SQL, using an appropriate `Generator.TRANSFORMS` function.</span> +</span><span id="preprocess-111"><a href="#preprocess-111"><span class="linenos">111</span></a> +</span><span id="preprocess-112"><a href="#preprocess-112"><span class="linenos">112</span></a><span class="sd"> Args:</span> +</span><span id="preprocess-113"><a href="#preprocess-113"><span class="linenos">113</span></a><span class="sd"> transforms: sequence of transform functions. These will be called in order.</span> +</span><span id="preprocess-114"><a href="#preprocess-114"><span class="linenos">114</span></a><span class="sd"> to_sql: final transform that converts the resulting expression to a SQL string.</span> +</span><span id="preprocess-115"><a href="#preprocess-115"><span class="linenos">115</span></a> +</span><span id="preprocess-116"><a href="#preprocess-116"><span class="linenos">116</span></a><span class="sd"> Returns:</span> +</span><span id="preprocess-117"><a href="#preprocess-117"><span class="linenos">117</span></a><span class="sd"> Function that can be used as a generator transform.</span> +</span><span id="preprocess-118"><a href="#preprocess-118"><span class="linenos">118</span></a><span class="sd"> """</span> +</span><span id="preprocess-119"><a href="#preprocess-119"><span class="linenos">119</span></a> +</span><span id="preprocess-120"><a href="#preprocess-120"><span class="linenos">120</span></a> <span class="k">def</span> <span class="nf">_to_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">):</span> +</span><span id="preprocess-121"><a href="#preprocess-121"><span class="linenos">121</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">transforms</span><span class="p">[</span><span class="mi">0</span><span class="p">](</span><span class="n">expression</span><span class="o">.</span><span class="n">copy</span><span class="p">())</span> +</span><span id="preprocess-122"><a href="#preprocess-122"><span class="linenos">122</span></a> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">transforms</span><span class="p">[</span><span class="mi">1</span><span class="p">:]:</span> +</span><span id="preprocess-123"><a href="#preprocess-123"><span class="linenos">123</span></a> <span class="n">expression</span> <span class="o">=</span> <span class="n">t</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span> +</span><span id="preprocess-124"><a href="#preprocess-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="n">to_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">)</span> +</span><span id="preprocess-125"><a href="#preprocess-125"><span class="linenos">125</span></a> +</span><span id="preprocess-126"><a href="#preprocess-126"><span class="linenos">126</span></a> <span class="k">return</span> <span class="n">_to_sql</span> +</span></pre></div> + + + <div class="docstring"><p>Creates a new transform by chaining a sequence of transformations and converts the resulting +expression to SQL, using an appropriate <code>Generator.TRANSFORMS</code> function.</p> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>transforms:</strong> sequence of transform functions. These will be called in order.</li> +<li><strong>to_sql:</strong> final transform that converts the resulting expression to a SQL string.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>Function that can be used as a generator transform.</p> +</blockquote> +</div> + + + </section> + <section id="delegate"> + <input id="delegate-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">delegate</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">attr</span><span class="p">:</span> <span class="nb">str</span></span><span class="return-annotation">) -> <span class="n">Callable</span>:</span></span> + + <label class="view-source-button" for="delegate-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#delegate"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="delegate-129"><a href="#delegate-129"><span class="linenos">129</span></a><span class="k">def</span> <span class="nf">delegate</span><span class="p">(</span><span class="n">attr</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Callable</span><span class="p">:</span> +</span><span id="delegate-130"><a href="#delegate-130"><span class="linenos">130</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="delegate-131"><a href="#delegate-131"><span class="linenos">131</span></a><span class="sd"> Create a new method that delegates to `attr`. This is useful for creating `Generator.TRANSFORMS`</span> +</span><span id="delegate-132"><a href="#delegate-132"><span class="linenos">132</span></a><span class="sd"> functions that delegate to existing generator methods.</span> +</span><span id="delegate-133"><a href="#delegate-133"><span class="linenos">133</span></a><span class="sd"> """</span> +</span><span id="delegate-134"><a href="#delegate-134"><span class="linenos">134</span></a> +</span><span id="delegate-135"><a href="#delegate-135"><span class="linenos">135</span></a> <span class="k">def</span> <span class="nf">_transform</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> +</span><span id="delegate-136"><a href="#delegate-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">attr</span><span class="p">)(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> +</span><span id="delegate-137"><a href="#delegate-137"><span class="linenos">137</span></a> +</span><span id="delegate-138"><a href="#delegate-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="n">_transform</span> +</span></pre></div> + + + <div class="docstring"><p>Create a new method that delegates to <code>attr</code>. This is useful for creating <code>Generator.TRANSFORMS</code> +functions that delegate to existing generator methods.</p> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/docs/sqlglot/trie.html b/docs/sqlglot/trie.html new file mode 100644 index 0000000..29dfb54 --- /dev/null +++ b/docs/sqlglot/trie.html @@ -0,0 +1,479 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="generator" content="pdoc 12.3.1"/> + <title>sqlglot.trie API documentation</title> + + <style>/*! * Bootstrap Reboot v5.0.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) */*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}</style> + <style>/*! syntax-highlighting.css */pre{line-height:125%;}span.linenos{color:inherit; background-color:transparent; padding-left:5px; padding-right:20px;}.pdoc-code .hll{background-color:#ffffcc}.pdoc-code{background:#f8f8f8;}.pdoc-code .c{color:#3D7B7B; font-style:italic}.pdoc-code .err{border:1px solid #FF0000}.pdoc-code .k{color:#008000; font-weight:bold}.pdoc-code .o{color:#666666}.pdoc-code .ch{color:#3D7B7B; font-style:italic}.pdoc-code .cm{color:#3D7B7B; font-style:italic}.pdoc-code .cp{color:#9C6500}.pdoc-code .cpf{color:#3D7B7B; font-style:italic}.pdoc-code .c1{color:#3D7B7B; font-style:italic}.pdoc-code .cs{color:#3D7B7B; font-style:italic}.pdoc-code .gd{color:#A00000}.pdoc-code .ge{font-style:italic}.pdoc-code .gr{color:#E40000}.pdoc-code .gh{color:#000080; font-weight:bold}.pdoc-code .gi{color:#008400}.pdoc-code .go{color:#717171}.pdoc-code .gp{color:#000080; font-weight:bold}.pdoc-code .gs{font-weight:bold}.pdoc-code .gu{color:#800080; font-weight:bold}.pdoc-code .gt{color:#0044DD}.pdoc-code .kc{color:#008000; font-weight:bold}.pdoc-code .kd{color:#008000; font-weight:bold}.pdoc-code .kn{color:#008000; font-weight:bold}.pdoc-code .kp{color:#008000}.pdoc-code .kr{color:#008000; font-weight:bold}.pdoc-code .kt{color:#B00040}.pdoc-code .m{color:#666666}.pdoc-code .s{color:#BA2121}.pdoc-code .na{color:#687822}.pdoc-code .nb{color:#008000}.pdoc-code .nc{color:#0000FF; font-weight:bold}.pdoc-code .no{color:#880000}.pdoc-code .nd{color:#AA22FF}.pdoc-code .ni{color:#717171; font-weight:bold}.pdoc-code .ne{color:#CB3F38; font-weight:bold}.pdoc-code .nf{color:#0000FF}.pdoc-code .nl{color:#767600}.pdoc-code .nn{color:#0000FF; font-weight:bold}.pdoc-code .nt{color:#008000; font-weight:bold}.pdoc-code .nv{color:#19177C}.pdoc-code .ow{color:#AA22FF; font-weight:bold}.pdoc-code .w{color:#bbbbbb}.pdoc-code .mb{color:#666666}.pdoc-code .mf{color:#666666}.pdoc-code .mh{color:#666666}.pdoc-code .mi{color:#666666}.pdoc-code .mo{color:#666666}.pdoc-code .sa{color:#BA2121}.pdoc-code .sb{color:#BA2121}.pdoc-code .sc{color:#BA2121}.pdoc-code .dl{color:#BA2121}.pdoc-code .sd{color:#BA2121; font-style:italic}.pdoc-code .s2{color:#BA2121}.pdoc-code .se{color:#AA5D1F; font-weight:bold}.pdoc-code .sh{color:#BA2121}.pdoc-code .si{color:#A45A77; font-weight:bold}.pdoc-code .sx{color:#008000}.pdoc-code .sr{color:#A45A77}.pdoc-code .s1{color:#BA2121}.pdoc-code .ss{color:#19177C}.pdoc-code .bp{color:#008000}.pdoc-code .fm{color:#0000FF}.pdoc-code .vc{color:#19177C}.pdoc-code .vg{color:#19177C}.pdoc-code .vi{color:#19177C}.pdoc-code .vm{color:#19177C}.pdoc-code .il{color:#666666}</style> + <style>/*! theme.css */:root{--pdoc-background:#fff;}.pdoc{--text:#212529;--muted:#6c757d;--link:#3660a5;--link-hover:#1659c5;--code:#f8f8f8;--active:#fff598;--accent:#eee;--accent2:#c1c1c1;--nav-hover:rgba(255, 255, 255, 0.5);--name:#0066BB;--def:#008800;--annotation:#007020;}</style> + <style>/*! layout.css */html, body{width:100%;height:100%;}html, main{scroll-behavior:smooth;}body{background-color:var(--pdoc-background);}@media (max-width:769px){#navtoggle{cursor:pointer;position:absolute;width:50px;height:40px;top:1rem;right:1rem;border-color:var(--text);color:var(--text);display:flex;opacity:0.8;}#navtoggle:hover{opacity:1;}#togglestate + div{display:none;}#togglestate:checked + div{display:inherit;}main, header{padding:2rem 3vw;}header + main{margin-top:-3rem;}.git-button{display:none !important;}nav input[type="search"]{max-width:77%;}nav input[type="search"]:first-child{margin-top:-6px;}nav input[type="search"]:valid ~ *{display:none !important;}}@media (min-width:770px){:root{--sidebar-width:clamp(12.5rem, 28vw, 22rem);}nav{position:fixed;overflow:auto;height:100vh;width:var(--sidebar-width);}main, header{padding:3rem 2rem 3rem calc(var(--sidebar-width) + 3rem);width:calc(54rem + var(--sidebar-width));max-width:100%;}header + main{margin-top:-4rem;}#navtoggle{display:none;}}#togglestate{position:absolute;height:0;opacity:0;}nav.pdoc{--pad:clamp(0.5rem, 2vw, 1.75rem);--indent:1.5rem;background-color:var(--accent);border-right:1px solid var(--accent2);box-shadow:0 0 20px rgba(50, 50, 50, .2) inset;padding:0 0 0 var(--pad);overflow-wrap:anywhere;scrollbar-width:thin; scrollbar-color:var(--accent2) transparent }nav.pdoc::-webkit-scrollbar{width:.4rem; }nav.pdoc::-webkit-scrollbar-thumb{background-color:var(--accent2); }nav.pdoc > div{padding:var(--pad) 0;}nav.pdoc .module-list-button{display:inline-flex;align-items:center;color:var(--text);border-color:var(--muted);margin-bottom:1rem;}nav.pdoc .module-list-button:hover{border-color:var(--text);}nav.pdoc input[type=search]{display:block;outline-offset:0;width:calc(100% - var(--pad));}nav.pdoc .logo{max-width:calc(100% - var(--pad));max-height:35vh;display:block;margin:0 auto 1rem;transform:translate(calc(-.5 * var(--pad)), 0);}nav.pdoc ul{list-style:none;padding-left:0;}nav.pdoc > div > ul{margin-left:calc(0px - var(--pad));}nav.pdoc li a{padding:.2rem 0 .2rem calc(var(--pad) + var(--indent));}nav.pdoc > div > ul > li > a{padding-left:var(--pad);}nav.pdoc li{transition:all 100ms;}nav.pdoc li:hover{background-color:var(--nav-hover);}nav.pdoc a, nav.pdoc a:hover{color:var(--text);}nav.pdoc a{display:block;}nav.pdoc > h2:first-of-type{margin-top:1.5rem;}nav.pdoc .class:before{content:"class ";color:var(--muted);}nav.pdoc .function:after{content:"()";color:var(--muted);}nav.pdoc footer:before{content:"";display:block;width:calc(100% - var(--pad));border-top:solid var(--accent2) 1px;margin-top:1.5rem;padding-top:.5rem;}nav.pdoc footer{font-size:small;}</style> + <style>/*! content.css */.pdoc{color:var(--text);box-sizing:border-box;line-height:1.5;background:none;}.pdoc .pdoc-button{display:inline-block;border:solid black 1px;border-radius:2px;font-size:.75rem;padding:calc(0.5em - 1px) 1em;transition:100ms all;}.pdoc .pdoc-alert{padding:1rem 1rem 1rem calc(1.5rem + 24px);border:1px solid transparent;border-radius:.25rem;background-repeat:no-repeat;background-position:1rem center;margin-bottom:1rem;}.pdoc .pdoc-alert > *:last-child{margin-bottom:0;}.pdoc .pdoc-alert-note {color:#084298;background-color:#cfe2ff;border-color:#b6d4fe;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23084298%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8%2016A8%208%200%201%200%208%200a8%208%200%200%200%200%2016zm.93-9.412-1%204.705c-.07.34.029.533.304.533.194%200%20.487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703%200-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381%202.29-.287zM8%205.5a1%201%200%201%201%200-2%201%201%200%200%201%200%202z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-warning{color:#664d03;background-color:#fff3cd;border-color:#ffecb5;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23664d03%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M8.982%201.566a1.13%201.13%200%200%200-1.96%200L.165%2013.233c-.457.778.091%201.767.98%201.767h13.713c.889%200%201.438-.99.98-1.767L8.982%201.566zM8%205c.535%200%20.954.462.9.995l-.35%203.507a.552.552%200%200%201-1.1%200L7.1%205.995A.905.905%200%200%201%208%205zm.002%206a1%201%200%201%201%200%202%201%201%200%200%201%200-2z%22/%3E%3C/svg%3E");}.pdoc .pdoc-alert-danger{color:#842029;background-color:#f8d7da;border-color:#f5c2c7;background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22%23842029%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cpath%20d%3D%22M5.52.359A.5.5%200%200%201%206%200h4a.5.5%200%200%201%20.474.658L8.694%206H12.5a.5.5%200%200%201%20.395.807l-7%209a.5.5%200%200%201-.873-.454L6.823%209.5H3.5a.5.5%200%200%201-.48-.641l2.5-8.5z%22/%3E%3C/svg%3E");}.pdoc .visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important;}.pdoc h1, .pdoc h2, .pdoc h3{font-weight:300;margin:.3em 0;padding:.2em 0;}.pdoc > section:not(.module-info) h1{font-size:1.5rem;font-weight:500;}.pdoc > section:not(.module-info) h2{font-size:1.4rem;font-weight:500;}.pdoc > section:not(.module-info) h3{font-size:1.3rem;font-weight:500;}.pdoc > section:not(.module-info) h4{font-size:1.2rem;}.pdoc > section:not(.module-info) h5{font-size:1.1rem;}.pdoc a{text-decoration:none;color:var(--link);}.pdoc a:hover{color:var(--link-hover);}.pdoc blockquote{margin-left:2rem;}.pdoc pre{border-top:1px solid var(--accent2);border-bottom:1px solid var(--accent2);margin-top:0;margin-bottom:1em;padding:.5rem 0 .5rem .5rem;overflow-x:auto;background-color:var(--code);}.pdoc code{color:var(--text);padding:.2em .4em;margin:0;font-size:85%;background-color:var(--code);border-radius:6px;}.pdoc a > code{color:inherit;}.pdoc pre > code{display:inline-block;font-size:inherit;background:none;border:none;padding:0;}.pdoc > section:not(.module-info){margin-bottom:1.5rem;}.pdoc .modulename{margin-top:0;font-weight:bold;}.pdoc .modulename a{color:var(--link);transition:100ms all;}.pdoc .git-button{float:right;border:solid var(--link) 1px;}.pdoc .git-button:hover{background-color:var(--link);color:var(--pdoc-background);}.view-source-toggle-state,.view-source-toggle-state ~ .pdoc-code{display:none;}.view-source-toggle-state:checked ~ .pdoc-code{display:block;}.view-source-button{display:inline-block;float:right;font-size:.75rem;line-height:1.5rem;color:var(--muted);padding:0 .4rem 0 1.3rem;cursor:pointer;text-indent:-2px;}.view-source-button > span{visibility:hidden;}.module-info .view-source-button{float:none;display:flex;justify-content:flex-end;margin:-1.2rem .4rem -.2rem 0;}.view-source-button::before{position:absolute;content:"View Source";display:list-item;list-style-type:disclosure-closed;}.view-source-toggle-state:checked ~ .attr .view-source-button::before,.view-source-toggle-state:checked ~ .view-source-button::before{list-style-type:disclosure-open;}.pdoc .docstring{margin-bottom:1.5rem;}.pdoc section:not(.module-info) .docstring{margin-left:clamp(0rem, 5vw - 2rem, 1rem);}.pdoc .docstring .pdoc-code{margin-left:1em;margin-right:1em;}.pdoc h1:target,.pdoc h2:target,.pdoc h3:target,.pdoc h4:target,.pdoc h5:target,.pdoc h6:target,.pdoc .pdoc-code > pre > span:target{background-color:var(--active);box-shadow:-1rem 0 0 0 var(--active);}.pdoc .pdoc-code > pre > span:target{display:block;}.pdoc div:target > .attr,.pdoc section:target > .attr,.pdoc dd:target > a{background-color:var(--active);}.pdoc *{scroll-margin:2rem;}.pdoc .pdoc-code .linenos{user-select:none;}.pdoc .attr:hover{filter:contrast(0.95);}.pdoc section, .pdoc .classattr{position:relative;}.pdoc .headerlink{--width:clamp(1rem, 3vw, 2rem);position:absolute;top:0;left:calc(0rem - var(--width));transition:all 100ms ease-in-out;opacity:0;}.pdoc .headerlink::before{content:"#";display:block;text-align:center;width:var(--width);height:2.3rem;line-height:2.3rem;font-size:1.5rem;}.pdoc .attr:hover ~ .headerlink,.pdoc *:target > .headerlink,.pdoc .headerlink:hover{opacity:1;}.pdoc .attr{display:block;margin:.5rem 0 .5rem;padding:.4rem .4rem .4rem 1rem;background-color:var(--accent);overflow-x:auto;}.pdoc .classattr{margin-left:2rem;}.pdoc .name{color:var(--name);font-weight:bold;}.pdoc .def{color:var(--def);font-weight:bold;}.pdoc .signature{background-color:transparent;}.pdoc .param, .pdoc .return-annotation{white-space:pre;}.pdoc .signature.multiline .param{display:block;}.pdoc .signature.condensed .param{display:inline-block;}.pdoc .annotation{color:var(--annotation);}.pdoc .inherited{margin-left:2rem;}.pdoc .inherited dt{font-weight:700;}.pdoc .inherited dt, .pdoc .inherited dd{display:inline;margin-left:0;margin-bottom:.5rem;}.pdoc .inherited dd:not(:last-child):after{content:", ";}.pdoc .inherited .class:before{content:"class ";}.pdoc .inherited .function a:after{content:"()";}.pdoc .search-result .docstring{overflow:auto;max-height:25vh;}.pdoc .search-result.focused > .attr{background-color:var(--active);}.pdoc .attribution{margin-top:2rem;display:block;opacity:0.5;transition:all 200ms;filter:grayscale(100%);}.pdoc .attribution:hover{opacity:1;filter:grayscale(0%);}.pdoc .attribution img{margin-left:5px;height:35px;vertical-align:middle;width:70px;transition:all 200ms;}.pdoc table{display:block;width:max-content;max-width:100%;overflow:auto;margin-bottom:1rem;}.pdoc table th{font-weight:600;}.pdoc table th, .pdoc table td{padding:6px 13px;border:1px solid var(--accent2);}</style> + <style>/*! custom.css */</style></head> +<body> + <nav class="pdoc"> + <label id="navtoggle" for="togglestate" class="pdoc-button"><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke-linecap='round' stroke="currentColor" stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg></label> + <input id="togglestate" type="checkbox" aria-hidden="true" tabindex="-1"> + <div> <a class="pdoc-button module-list-button" href="../sqlglot.html"> +<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-left" viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M10 3.5a.5.5 0 0 0-.5-.5h-8a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-2a.5.5 0 0 1 1 0v2A1.5 1.5 0 0 1 9.5 14h-8A1.5 1.5 0 0 1 0 12.5v-9A1.5 1.5 0 0 1 1.5 2h8A1.5 1.5 0 0 1 11 3.5v2a.5.5 0 0 1-1 0v-2z"/> + <path fill-rule="evenodd" d="M4.146 8.354a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5H14.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3z"/> +</svg> sqlglot</a> + + + <input type="search" placeholder="Search..." role="searchbox" aria-label="search" + pattern=".+" required> + + + + <h2>API Documentation</h2> + <ul class="memberlist"> + <li> + <a class="function" href="#new_trie">new_trie</a> + </li> + <li> + <a class="function" href="#in_trie">in_trie</a> + </li> + </ul> + + + <footer>Copyright (c) 2023 Toby Mao</footer> + + <a class="attribution" title="pdoc: Python API documentation generator" href="https://pdoc.dev" target="_blank"> + built with <span class="visually-hidden">pdoc</span><img + alt="pdoc logo" + src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20role%3D%22img%22%20aria-label%3D%22pdoc%20logo%22%20width%3D%22300%22%20height%3D%22150%22%20viewBox%3D%22-1%200%2060%2030%22%3E%3Ctitle%3Epdoc%3C/title%3E%3Cpath%20d%3D%22M29.621%2021.293c-.011-.273-.214-.475-.511-.481a.5.5%200%200%200-.489.503l-.044%201.393c-.097.551-.695%201.215-1.566%201.704-.577.428-1.306.486-2.193.182-1.426-.617-2.467-1.654-3.304-2.487l-.173-.172a3.43%203.43%200%200%200-.365-.306.49.49%200%200%200-.286-.196c-1.718-1.06-4.931-1.47-7.353.191l-.219.15c-1.707%201.187-3.413%202.131-4.328%201.03-.02-.027-.49-.685-.141-1.763.233-.721.546-2.408.772-4.076.042-.09.067-.187.046-.288.166-1.347.277-2.625.241-3.351%201.378-1.008%202.271-2.586%202.271-4.362%200-.976-.272-1.935-.788-2.774-.057-.094-.122-.18-.184-.268.033-.167.052-.339.052-.516%200-1.477-1.202-2.679-2.679-2.679-.791%200-1.496.352-1.987.9a6.3%206.3%200%200%200-1.001.029c-.492-.564-1.207-.929-2.012-.929-1.477%200-2.679%201.202-2.679%202.679A2.65%202.65%200%200%200%20.97%206.554c-.383.747-.595%201.572-.595%202.41%200%202.311%201.507%204.29%203.635%205.107-.037.699-.147%202.27-.423%203.294l-.137.461c-.622%202.042-2.515%208.257%201.727%2010.643%201.614.908%203.06%201.248%204.317%201.248%202.665%200%204.492-1.524%205.322-2.401%201.476-1.559%202.886-1.854%206.491.82%201.877%201.393%203.514%201.753%204.861%201.068%202.223-1.713%202.811-3.867%203.399-6.374.077-.846.056-1.469.054-1.537zm-4.835%204.313c-.054.305-.156.586-.242.629-.034-.007-.131-.022-.307-.157-.145-.111-.314-.478-.456-.908.221.121.432.25.675.355.115.039.219.051.33.081zm-2.251-1.238c-.05.33-.158.648-.252.694-.022.001-.125-.018-.307-.157-.217-.166-.488-.906-.639-1.573.358.344.754.693%201.198%201.036zm-3.887-2.337c-.006-.116-.018-.231-.041-.342.635.145%201.189.368%201.599.625.097.231.166.481.174.642-.03.049-.055.101-.067.158-.046.013-.128.026-.298.004-.278-.037-.901-.57-1.367-1.087zm-1.127-.497c.116.306.176.625.12.71-.019.014-.117.045-.345.016-.206-.027-.604-.332-.986-.695.41-.051.816-.056%201.211-.031zm-4.535%201.535c.209.22.379.47.358.598-.006.041-.088.138-.351.234-.144.055-.539-.063-.979-.259a11.66%2011.66%200%200%200%20.972-.573zm.983-.664c.359-.237.738-.418%201.126-.554.25.237.479.548.457.694-.006.042-.087.138-.351.235-.174.064-.694-.105-1.232-.375zm-3.381%201.794c-.022.145-.061.29-.149.401-.133.166-.358.248-.69.251h-.002c-.133%200-.306-.26-.45-.621.417.091.854.07%201.291-.031zm-2.066-8.077a4.78%204.78%200%200%201-.775-.584c.172-.115.505-.254.88-.378l-.105.962zm-.331%202.302a10.32%2010.32%200%200%201-.828-.502c.202-.143.576-.328.984-.49l-.156.992zm-.45%202.157l-.701-.403c.214-.115.536-.249.891-.376a11.57%2011.57%200%200%201-.19.779zm-.181%201.716c.064.398.194.702.298.893-.194-.051-.435-.162-.736-.398.061-.119.224-.3.438-.495zM8.87%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zm-.735-.389a1.15%201.15%200%200%200-.314.783%201.16%201.16%200%200%200%201.162%201.162c.457%200%20.842-.27%201.032-.653.026.117.042.238.042.362a1.68%201.68%200%200%201-1.679%201.679%201.68%201.68%200%200%201-1.679-1.679c0-.843.626-1.535%201.436-1.654zM5.059%205.406A1.68%201.68%200%200%201%203.38%207.085a1.68%201.68%200%200%201-1.679-1.679c0-.037.009-.072.011-.109.21.3.541.508.935.508a1.16%201.16%200%200%200%201.162-1.162%201.14%201.14%200%200%200-.474-.912c.015%200%20.03-.005.045-.005.926.001%201.679.754%201.679%201.68zM3.198%204.141c0%20.152-.123.276-.276.276s-.275-.124-.275-.276.123-.276.276-.276.275.124.275.276zM1.375%208.964c0-.52.103-1.035.288-1.52.466.394%201.06.64%201.717.64%201.144%200%202.116-.725%202.499-1.738.383%201.012%201.355%201.738%202.499%201.738.867%200%201.631-.421%202.121-1.062.307.605.478%201.267.478%201.942%200%202.486-2.153%204.51-4.801%204.51s-4.801-2.023-4.801-4.51zm24.342%2019.349c-.985.498-2.267.168-3.813-.979-3.073-2.281-5.453-3.199-7.813-.705-1.315%201.391-4.163%203.365-8.423.97-3.174-1.786-2.239-6.266-1.261-9.479l.146-.492c.276-1.02.395-2.457.444-3.268a6.11%206.11%200%200%200%201.18.115%206.01%206.01%200%200%200%202.536-.562l-.006.175c-.802.215-1.848.612-2.021%201.25-.079.295.021.601.274.837.219.203.415.364.598.501-.667.304-1.243.698-1.311%201.179-.02.144-.022.507.393.787.213.144.395.26.564.365-1.285.521-1.361.96-1.381%201.126-.018.142-.011.496.427.746l.854.489c-.473.389-.971.914-.999%201.429-.018.278.095.532.316.713.675.556%201.231.721%201.653.721.059%200%20.104-.014.158-.02.207.707.641%201.64%201.513%201.64h.013c.8-.008%201.236-.345%201.462-.626.173-.216.268-.457.325-.692.424.195.93.374%201.372.374.151%200%20.294-.021.423-.068.732-.27.944-.704.993-1.021.009-.061.003-.119.002-.179.266.086.538.147.789.147.15%200%20.294-.021.423-.069.542-.2.797-.489.914-.754.237.147.478.258.704.288.106.014.205.021.296.021.356%200%20.595-.101.767-.229.438.435%201.094.992%201.656%201.067.106.014.205.021.296.021a1.56%201.56%200%200%200%20.323-.035c.17.575.453%201.289.866%201.605.358.273.665.362.914.362a.99.99%200%200%200%20.421-.093%201.03%201.03%200%200%200%20.245-.164c.168.428.39.846.68%201.068.358.273.665.362.913.362a.99.99%200%200%200%20.421-.093c.317-.148.512-.448.639-.762.251.157.495.257.726.257.127%200%20.25-.024.37-.071.427-.17.706-.617.841-1.314.022-.015.047-.022.068-.038.067-.051.133-.104.196-.159-.443%201.486-1.107%202.761-2.086%203.257zM8.66%209.925a.5.5%200%201%200-1%200c0%20.653-.818%201.205-1.787%201.205s-1.787-.552-1.787-1.205a.5.5%200%201%200-1%200c0%201.216%201.25%202.205%202.787%202.205s2.787-.989%202.787-2.205zm4.4%2015.965l-.208.097c-2.661%201.258-4.708%201.436-6.086.527-1.542-1.017-1.88-3.19-1.844-4.198a.4.4%200%200%200-.385-.414c-.242-.029-.406.164-.414.385-.046%201.249.367%203.686%202.202%204.896.708.467%201.547.7%202.51.7%201.248%200%202.706-.392%204.362-1.174l.185-.086a.4.4%200%200%200%20.205-.527c-.089-.204-.326-.291-.527-.206zM9.547%202.292c.093.077.205.114.317.114a.5.5%200%200%200%20.318-.886L8.817.397a.5.5%200%200%200-.703.068.5.5%200%200%200%20.069.703l1.364%201.124zm-7.661-.065c.086%200%20.173-.022.253-.068l1.523-.893a.5.5%200%200%200-.506-.863l-1.523.892a.5.5%200%200%200-.179.685c.094.158.261.247.432.247z%22%20transform%3D%22matrix%28-1%200%200%201%2058%200%29%22%20fill%3D%22%233bb300%22/%3E%3Cpath%20d%3D%22M.3%2021.86V10.18q0-.46.02-.68.04-.22.18-.5.28-.54%201.34-.54%201.06%200%201.42.28.38.26.44.78.76-1.04%202.38-1.04%201.64%200%203.1%201.54%201.46%201.54%201.46%203.58%200%202.04-1.46%203.58-1.44%201.54-3.08%201.54-1.64%200-2.38-.92v4.04q0%20.46-.04.68-.02.22-.18.5-.14.3-.5.42-.36.12-.98.12-.62%200-1-.12-.36-.12-.52-.4-.14-.28-.18-.5-.02-.22-.02-.68zm3.96-9.42q-.46.54-.46%201.18%200%20.64.46%201.18.48.52%201.2.52.74%200%201.24-.52.52-.52.52-1.18%200-.66-.48-1.18-.48-.54-1.26-.54-.76%200-1.22.54zm14.741-8.36q.16-.3.54-.42.38-.12%201-.12.64%200%201.02.12.38.12.52.42.16.3.18.54.04.22.04.68v11.94q0%20.46-.04.7-.02.22-.18.5-.3.54-1.7.54-1.38%200-1.54-.98-.84.96-2.34.96-1.8%200-3.28-1.56-1.48-1.58-1.48-3.66%200-2.1%201.48-3.68%201.5-1.58%203.28-1.58%201.48%200%202.3%201v-4.2q0-.46.02-.68.04-.24.18-.52zm-3.24%2010.86q.52.54%201.26.54.74%200%201.22-.54.5-.54.5-1.18%200-.66-.48-1.22-.46-.56-1.26-.56-.8%200-1.28.56-.48.54-.48%201.2%200%20.66.52%201.2zm7.833-1.2q0-2.4%201.68-3.96%201.68-1.56%203.84-1.56%202.16%200%203.82%201.56%201.66%201.54%201.66%203.94%200%201.66-.86%202.96-.86%201.28-2.1%201.9-1.22.6-2.54.6-1.32%200-2.56-.64-1.24-.66-2.1-1.92-.84-1.28-.84-2.88zm4.18%201.44q.64.48%201.3.48.66%200%201.32-.5.66-.5.66-1.48%200-.98-.62-1.46-.62-.48-1.34-.48-.72%200-1.34.5-.62.5-.62%201.48%200%20.96.64%201.46zm11.412-1.44q0%20.84.56%201.32.56.46%201.18.46.64%200%201.18-.36.56-.38.9-.38.6%200%201.46%201.06.46.58.46%201.04%200%20.76-1.1%201.42-1.14.8-2.8.8-1.86%200-3.58-1.34-.82-.64-1.34-1.7-.52-1.08-.52-2.36%200-1.3.52-2.34.52-1.06%201.34-1.7%201.66-1.32%203.54-1.32.76%200%201.48.22.72.2%201.06.4l.32.2q.36.24.56.38.52.4.52.92%200%20.5-.42%201.14-.72%201.1-1.38%201.1-.38%200-1.08-.44-.36-.34-1.04-.34-.66%200-1.24.48-.58.48-.58%201.34z%22%20fill%3D%22green%22/%3E%3C/svg%3E"/> + </a> +</div> + </nav> + <main class="pdoc"> + <section class="module-info"> + <a class="pdoc-button git-button" href="https://github.com/tobymao/sqlglot/tree/main/sqlglot/trie.py">Edit on GitHub</a> + <h1 class="modulename"> +<a href="./../sqlglot.html">sqlglot</a><wbr>.trie </h1> + + + <input id="mod-trie-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> + + <label class="view-source-button" for="mod-trie-view-source"><span>View Source</span></label> + + <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span> +</span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> +</span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="n">key</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">Sequence</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Hashable</span><span class="p">]</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a> +</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> +</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="k">def</span> <span class="nf">new_trie</span><span class="p">(</span><span class="n">keywords</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">key</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="sd"> Creates a new trie out of a collection of keywords.</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a><span class="sd"> The trie is represented as a sequence of nested dictionaries keyed by either single character</span> +</span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a><span class="sd"> strings, or by 0, which is used to designate that a keyword is in the trie.</span> +</span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> +</span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a><span class="sd"> Example:</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a><span class="sd"> >>> new_trie(["bla", "foo", "blab"])</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a><span class="sd"> {'b': {'l': {'a': {0: True, 'b': {0: True}}}}, 'f': {'o': {'o': {0: True}}}}</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a><span class="sd"> Args:</span> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a><span class="sd"> keywords: the keywords to create the trie from.</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a><span class="sd"> Returns:</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a><span class="sd"> The trie corresponding to `keywords`.</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a><span class="sd"> """</span> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keywords</span><span class="p">:</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="k">for</span> <span class="n">char</span> <span class="ow">in</span> <span class="n">key</span><span class="p">:</span> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">current</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">char</span><span class="p">,</span> <span class="p">{})</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">current</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="k">return</span> <span class="n">trie</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a><span class="k">def</span> <span class="nf">in_trie</span><span class="p">(</span><span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="n">key</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]:</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a><span class="sd"> Checks whether a key is in a trie.</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a><span class="sd"> Examples:</span> +</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a><span class="sd"> >>> in_trie(new_trie(["cat"]), "bob")</span> +</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a><span class="sd"> (0, {'c': {'a': {'t': {0: True}}}})</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos">42</span></a> +</span><span id="L-43"><a href="#L-43"><span class="linenos">43</span></a><span class="sd"> >>> in_trie(new_trie(["cat"]), "ca")</span> +</span><span id="L-44"><a href="#L-44"><span class="linenos">44</span></a><span class="sd"> (1, {'t': {0: True}})</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos">45</span></a> +</span><span id="L-46"><a href="#L-46"><span class="linenos">46</span></a><span class="sd"> >>> in_trie(new_trie(["cat"]), "cat")</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos">47</span></a><span class="sd"> (2, {0: True})</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos">48</span></a> +</span><span id="L-49"><a href="#L-49"><span class="linenos">49</span></a><span class="sd"> Args:</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos">50</span></a><span class="sd"> trie: the trie to be searched.</span> +</span><span id="L-51"><a href="#L-51"><span class="linenos">51</span></a><span class="sd"> key: the target key.</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos">52</span></a> +</span><span id="L-53"><a href="#L-53"><span class="linenos">53</span></a><span class="sd"> Returns:</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos">54</span></a><span class="sd"> A pair `(value, subtrie)`, where `subtrie` is the sub-trie we get at the point where the search stops, and `value`</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos">55</span></a><span class="sd"> is either 0 (search was unsuccessful), 1 (`value` is a prefix of a keyword in `trie`) or 2 (`key is in `trie`).</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos">56</span></a><span class="sd"> """</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos">57</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">key</span><span class="p">:</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos">58</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">trie</span><span class="p">)</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos">59</span></a> +</span><span id="L-60"><a href="#L-60"><span class="linenos">60</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos">61</span></a> +</span><span id="L-62"><a href="#L-62"><span class="linenos">62</span></a> <span class="k">for</span> <span class="n">char</span> <span class="ow">in</span> <span class="n">key</span><span class="p">:</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos">63</span></a> <span class="k">if</span> <span class="n">char</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">current</span><span class="p">:</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos">64</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">current</span><span class="p">)</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos">65</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">current</span><span class="p">[</span><span class="n">char</span><span class="p">]</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos">66</span></a> +</span><span id="L-67"><a href="#L-67"><span class="linenos">67</span></a> <span class="k">if</span> <span class="mi">0</span> <span class="ow">in</span> <span class="n">current</span><span class="p">:</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos">68</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">current</span><span class="p">)</span> +</span><span id="L-69"><a href="#L-69"><span class="linenos">69</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">current</span><span class="p">)</span> +</span></pre></div> + + + </section> + <section id="new_trie"> + <input id="new_trie-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">new_trie</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">keywords</span><span class="p">:</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">Sequence</span><span class="p">[</span><span class="n">Hashable</span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="n">Dict</span>:</span></span> + + <label class="view-source-button" for="new_trie-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#new_trie"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="new_trie-7"><a href="#new_trie-7"><span class="linenos"> 7</span></a><span class="k">def</span> <span class="nf">new_trie</span><span class="p">(</span><span class="n">keywords</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Iterable</span><span class="p">[</span><span class="n">key</span><span class="p">])</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">:</span> +</span><span id="new_trie-8"><a href="#new_trie-8"><span class="linenos"> 8</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="new_trie-9"><a href="#new_trie-9"><span class="linenos"> 9</span></a><span class="sd"> Creates a new trie out of a collection of keywords.</span> +</span><span id="new_trie-10"><a href="#new_trie-10"><span class="linenos">10</span></a> +</span><span id="new_trie-11"><a href="#new_trie-11"><span class="linenos">11</span></a><span class="sd"> The trie is represented as a sequence of nested dictionaries keyed by either single character</span> +</span><span id="new_trie-12"><a href="#new_trie-12"><span class="linenos">12</span></a><span class="sd"> strings, or by 0, which is used to designate that a keyword is in the trie.</span> +</span><span id="new_trie-13"><a href="#new_trie-13"><span class="linenos">13</span></a> +</span><span id="new_trie-14"><a href="#new_trie-14"><span class="linenos">14</span></a><span class="sd"> Example:</span> +</span><span id="new_trie-15"><a href="#new_trie-15"><span class="linenos">15</span></a><span class="sd"> >>> new_trie(["bla", "foo", "blab"])</span> +</span><span id="new_trie-16"><a href="#new_trie-16"><span class="linenos">16</span></a><span class="sd"> {'b': {'l': {'a': {0: True, 'b': {0: True}}}}, 'f': {'o': {'o': {0: True}}}}</span> +</span><span id="new_trie-17"><a href="#new_trie-17"><span class="linenos">17</span></a> +</span><span id="new_trie-18"><a href="#new_trie-18"><span class="linenos">18</span></a><span class="sd"> Args:</span> +</span><span id="new_trie-19"><a href="#new_trie-19"><span class="linenos">19</span></a><span class="sd"> keywords: the keywords to create the trie from.</span> +</span><span id="new_trie-20"><a href="#new_trie-20"><span class="linenos">20</span></a> +</span><span id="new_trie-21"><a href="#new_trie-21"><span class="linenos">21</span></a><span class="sd"> Returns:</span> +</span><span id="new_trie-22"><a href="#new_trie-22"><span class="linenos">22</span></a><span class="sd"> The trie corresponding to `keywords`.</span> +</span><span id="new_trie-23"><a href="#new_trie-23"><span class="linenos">23</span></a><span class="sd"> """</span> +</span><span id="new_trie-24"><a href="#new_trie-24"><span class="linenos">24</span></a> <span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span> <span class="o">=</span> <span class="p">{}</span> +</span><span id="new_trie-25"><a href="#new_trie-25"><span class="linenos">25</span></a> +</span><span id="new_trie-26"><a href="#new_trie-26"><span class="linenos">26</span></a> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keywords</span><span class="p">:</span> +</span><span id="new_trie-27"><a href="#new_trie-27"><span class="linenos">27</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="new_trie-28"><a href="#new_trie-28"><span class="linenos">28</span></a> +</span><span id="new_trie-29"><a href="#new_trie-29"><span class="linenos">29</span></a> <span class="k">for</span> <span class="n">char</span> <span class="ow">in</span> <span class="n">key</span><span class="p">:</span> +</span><span id="new_trie-30"><a href="#new_trie-30"><span class="linenos">30</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">current</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="n">char</span><span class="p">,</span> <span class="p">{})</span> +</span><span id="new_trie-31"><a href="#new_trie-31"><span class="linenos">31</span></a> <span class="n">current</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="new_trie-32"><a href="#new_trie-32"><span class="linenos">32</span></a> +</span><span id="new_trie-33"><a href="#new_trie-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="n">trie</span> +</span></pre></div> + + + <div class="docstring"><p>Creates a new trie out of a collection of keywords.</p> + +<p>The trie is represented as a sequence of nested dictionaries keyed by either single character +strings, or by 0, which is used to designate that a keyword is in the trie.</p> + +<h6 id="example">Example:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">new_trie</span><span class="p">([</span><span class="s2">"bla"</span><span class="p">,</span> <span class="s2">"foo"</span><span class="p">,</span> <span class="s2">"blab"</span><span class="p">])</span> +<span class="go">{'b': {'l': {'a': {0: True, 'b': {0: True}}}}, 'f': {'o': {'o': {0: True}}}}</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>keywords:</strong> the keywords to create the trie from.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>The trie corresponding to <code>keywords</code>.</p> +</blockquote> +</div> + + + </section> + <section id="in_trie"> + <input id="in_trie-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> +<div class="attr function"> + + <span class="def">def</span> + <span class="name">in_trie</span><span class="signature pdoc-code condensed">(<span class="param"><span class="n">trie</span><span class="p">:</span> <span class="n">Dict</span>, </span><span class="param"><span class="n">key</span><span class="p">:</span> <span class="n">Sequence</span><span class="p">[</span><span class="n">Hashable</span><span class="p">]</span></span><span class="return-annotation">) -> <span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">Dict</span><span class="p">]</span>:</span></span> + + <label class="view-source-button" for="in_trie-view-source"><span>View Source</span></label> + + </div> + <a class="headerlink" href="#in_trie"></a> + <div class="pdoc-code codehilite"><pre><span></span><span id="in_trie-36"><a href="#in_trie-36"><span class="linenos">36</span></a><span class="k">def</span> <span class="nf">in_trie</span><span class="p">(</span><span class="n">trie</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="n">key</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Tuple</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]:</span> +</span><span id="in_trie-37"><a href="#in_trie-37"><span class="linenos">37</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="in_trie-38"><a href="#in_trie-38"><span class="linenos">38</span></a><span class="sd"> Checks whether a key is in a trie.</span> +</span><span id="in_trie-39"><a href="#in_trie-39"><span class="linenos">39</span></a> +</span><span id="in_trie-40"><a href="#in_trie-40"><span class="linenos">40</span></a><span class="sd"> Examples:</span> +</span><span id="in_trie-41"><a href="#in_trie-41"><span class="linenos">41</span></a><span class="sd"> >>> in_trie(new_trie(["cat"]), "bob")</span> +</span><span id="in_trie-42"><a href="#in_trie-42"><span class="linenos">42</span></a><span class="sd"> (0, {'c': {'a': {'t': {0: True}}}})</span> +</span><span id="in_trie-43"><a href="#in_trie-43"><span class="linenos">43</span></a> +</span><span id="in_trie-44"><a href="#in_trie-44"><span class="linenos">44</span></a><span class="sd"> >>> in_trie(new_trie(["cat"]), "ca")</span> +</span><span id="in_trie-45"><a href="#in_trie-45"><span class="linenos">45</span></a><span class="sd"> (1, {'t': {0: True}})</span> +</span><span id="in_trie-46"><a href="#in_trie-46"><span class="linenos">46</span></a> +</span><span id="in_trie-47"><a href="#in_trie-47"><span class="linenos">47</span></a><span class="sd"> >>> in_trie(new_trie(["cat"]), "cat")</span> +</span><span id="in_trie-48"><a href="#in_trie-48"><span class="linenos">48</span></a><span class="sd"> (2, {0: True})</span> +</span><span id="in_trie-49"><a href="#in_trie-49"><span class="linenos">49</span></a> +</span><span id="in_trie-50"><a href="#in_trie-50"><span class="linenos">50</span></a><span class="sd"> Args:</span> +</span><span id="in_trie-51"><a href="#in_trie-51"><span class="linenos">51</span></a><span class="sd"> trie: the trie to be searched.</span> +</span><span id="in_trie-52"><a href="#in_trie-52"><span class="linenos">52</span></a><span class="sd"> key: the target key.</span> +</span><span id="in_trie-53"><a href="#in_trie-53"><span class="linenos">53</span></a> +</span><span id="in_trie-54"><a href="#in_trie-54"><span class="linenos">54</span></a><span class="sd"> Returns:</span> +</span><span id="in_trie-55"><a href="#in_trie-55"><span class="linenos">55</span></a><span class="sd"> A pair `(value, subtrie)`, where `subtrie` is the sub-trie we get at the point where the search stops, and `value`</span> +</span><span id="in_trie-56"><a href="#in_trie-56"><span class="linenos">56</span></a><span class="sd"> is either 0 (search was unsuccessful), 1 (`value` is a prefix of a keyword in `trie`) or 2 (`key is in `trie`).</span> +</span><span id="in_trie-57"><a href="#in_trie-57"><span class="linenos">57</span></a><span class="sd"> """</span> +</span><span id="in_trie-58"><a href="#in_trie-58"><span class="linenos">58</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">key</span><span class="p">:</span> +</span><span id="in_trie-59"><a href="#in_trie-59"><span class="linenos">59</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">trie</span><span class="p">)</span> +</span><span id="in_trie-60"><a href="#in_trie-60"><span class="linenos">60</span></a> +</span><span id="in_trie-61"><a href="#in_trie-61"><span class="linenos">61</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">trie</span> +</span><span id="in_trie-62"><a href="#in_trie-62"><span class="linenos">62</span></a> +</span><span id="in_trie-63"><a href="#in_trie-63"><span class="linenos">63</span></a> <span class="k">for</span> <span class="n">char</span> <span class="ow">in</span> <span class="n">key</span><span class="p">:</span> +</span><span id="in_trie-64"><a href="#in_trie-64"><span class="linenos">64</span></a> <span class="k">if</span> <span class="n">char</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">current</span><span class="p">:</span> +</span><span id="in_trie-65"><a href="#in_trie-65"><span class="linenos">65</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">current</span><span class="p">)</span> +</span><span id="in_trie-66"><a href="#in_trie-66"><span class="linenos">66</span></a> <span class="n">current</span> <span class="o">=</span> <span class="n">current</span><span class="p">[</span><span class="n">char</span><span class="p">]</span> +</span><span id="in_trie-67"><a href="#in_trie-67"><span class="linenos">67</span></a> +</span><span id="in_trie-68"><a href="#in_trie-68"><span class="linenos">68</span></a> <span class="k">if</span> <span class="mi">0</span> <span class="ow">in</span> <span class="n">current</span><span class="p">:</span> +</span><span id="in_trie-69"><a href="#in_trie-69"><span class="linenos">69</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">current</span><span class="p">)</span> +</span><span id="in_trie-70"><a href="#in_trie-70"><span class="linenos">70</span></a> <span class="k">return</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">current</span><span class="p">)</span> +</span></pre></div> + + + <div class="docstring"><p>Checks whether a key is in a trie.</p> + +<h6 id="examples">Examples:</h6> + +<blockquote> + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">in_trie</span><span class="p">(</span><span class="n">new_trie</span><span class="p">([</span><span class="s2">"cat"</span><span class="p">]),</span> <span class="s2">"bob"</span><span class="p">)</span> +<span class="go">(0, {'c': {'a': {'t': {0: True}}}})</span> +</code></pre> + </div> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">in_trie</span><span class="p">(</span><span class="n">new_trie</span><span class="p">([</span><span class="s2">"cat"</span><span class="p">]),</span> <span class="s2">"ca"</span><span class="p">)</span> +<span class="go">(1, {'t': {0: True}})</span> +</code></pre> + </div> + + <div class="pdoc-code codehilite"> +<pre><span></span><code><span class="gp">>>> </span><span class="n">in_trie</span><span class="p">(</span><span class="n">new_trie</span><span class="p">([</span><span class="s2">"cat"</span><span class="p">]),</span> <span class="s2">"cat"</span><span class="p">)</span> +<span class="go">(2, {0: True})</span> +</code></pre> + </div> +</blockquote> + +<h6 id="arguments">Arguments:</h6> + +<ul> +<li><strong>trie:</strong> the trie to be searched.</li> +<li><strong>key:</strong> the target key.</li> +</ul> + +<h6 id="returns">Returns:</h6> + +<blockquote> + <p>A pair <code>(value, subtrie)</code>, where <code>subtrie</code> is the sub-trie we get at the point where the search stops, and <code>value</code> + is either 0 (search was unsuccessful), 1 (<code>value</code> is a prefix of a keyword in <code>trie</code>) or 2 (<code>key is in</code>trie`).</p> +</blockquote> +</div> + + + </section> + </main> +<script> + function escapeHTML(html) { + return document.createElement('div').appendChild(document.createTextNode(html)).parentNode.innerHTML; + } + + const originalContent = document.querySelector("main.pdoc"); + let currentContent = originalContent; + + function setContent(innerHTML) { + let elem; + if (innerHTML) { + elem = document.createElement("main"); + elem.classList.add("pdoc"); + elem.innerHTML = innerHTML; + } else { + elem = originalContent; + } + if (currentContent !== elem) { + currentContent.replaceWith(elem); + currentContent = elem; + } + } + + function getSearchTerm() { + return (new URL(window.location)).searchParams.get("search"); + } + + const searchBox = document.querySelector(".pdoc input[type=search]"); + searchBox.addEventListener("input", function () { + let url = new URL(window.location); + if (searchBox.value.trim()) { + url.hash = ""; + url.searchParams.set("search", searchBox.value); + } else { + url.searchParams.delete("search"); + } + history.replaceState("", "", url.toString()); + onInput(); + }); + window.addEventListener("popstate", onInput); + + + let search, searchErr; + + async function initialize() { + try { + search = await new Promise((resolve, reject) => { + const script = document.createElement("script"); + script.type = "text/javascript"; + script.async = true; + script.onload = () => resolve(window.pdocSearch); + script.onerror = (e) => reject(e); + script.src = "../search.js"; + document.getElementsByTagName("head")[0].appendChild(script); + }); + } catch (e) { + console.error("Cannot fetch pdoc search index"); + searchErr = "Cannot fetch search index."; + } + onInput(); + + document.querySelector("nav.pdoc").addEventListener("click", e => { + if (e.target.hash) { + searchBox.value = ""; + searchBox.dispatchEvent(new Event("input")); + } + }); + } + + function onInput() { + setContent((() => { + const term = getSearchTerm(); + if (!term) { + return null + } + if (searchErr) { + return `<h3>Error: ${searchErr}</h3>` + } + if (!search) { + return "<h3>Searching...</h3>" + } + + window.scrollTo({top: 0, left: 0, behavior: 'auto'}); + + const results = search(term); + + let html; + if (results.length === 0) { + html = `No search results for '${escapeHTML(term)}'.` + } else { + html = `<h4>${results.length} search result${results.length > 1 ? "s" : ""} for '${escapeHTML(term)}'.</h4>`; + } + for (let result of results.slice(0, 10)) { + let doc = result.doc; + let url = `../${doc.modulename.replaceAll(".", "/")}.html`; + if (doc.qualname) { + url += `#${doc.qualname}`; + } + + let heading; + switch (result.doc.kind) { + case "function": + if (doc.fullname.endsWith(".__init__")) { + heading = `<span class="name">${doc.fullname.replace(/\.__init__$/, "")}</span>${doc.signature}`; + } else { + heading = `<span class="def">${doc.funcdef}</span> <span class="name">${doc.fullname}</span>${doc.signature}`; + } + break; + case "class": + heading = `<span class="def">class</span> <span class="name">${doc.fullname}</span>`; + if (doc.bases) + heading += `<wbr>(<span class="base">${doc.bases}</span>)`; + heading += `:`; + break; + case "variable": + heading = `<span class="name">${doc.fullname}</span>`; + if (doc.annotation) + heading += `<span class="annotation">${doc.annotation}</span>`; + if (doc.default_value) + heading += `<span class="default_value">${doc.default_value}</span>`; + break; + default: + heading = `<span class="name">${doc.fullname}</span>`; + break; + } + html += ` + <section class="search-result"> + <a href="${url}" class="attr ${doc.kind}">${heading}</a> + <div class="docstring">${doc.doc}</div> + </section> + `; + + } + return html; + })()); + } + + if (getSearchTerm()) { + initialize(); + searchBox.value = getSearchTerm(); + onInput(); + } else { + searchBox.addEventListener("focus", initialize, {once: true}); + } + + searchBox.addEventListener("keydown", e => { + if (["ArrowDown", "ArrowUp", "Enter"].includes(e.key)) { + let focused = currentContent.querySelector(".search-result.focused"); + if (!focused) { + currentContent.querySelector(".search-result").classList.add("focused"); + } else if ( + e.key === "ArrowDown" + && focused.nextElementSibling + && focused.nextElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.nextElementSibling.classList.add("focused"); + focused.nextElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "ArrowUp" + && focused.previousElementSibling + && focused.previousElementSibling.classList.contains("search-result") + ) { + focused.classList.remove("focused"); + focused.previousElementSibling.classList.add("focused"); + focused.previousElementSibling.scrollIntoView({ + behavior: "smooth", + block: "nearest", + inline: "nearest" + }); + } else if ( + e.key === "Enter" + ) { + focused.querySelector("a").click(); + } + } + }); +</script></body> +</html>
\ No newline at end of file diff --git a/pdoc/cli.py b/pdoc/cli.py index 72a986d..1db895e 100755 --- a/pdoc/cli.py +++ b/pdoc/cli.py @@ -26,9 +26,9 @@ if __name__ == "__main__": opts = parser.parse_args() opts.docformat = "google" opts.modules = ["sqlglot"] - opts.footer_text = "Copyright (c) 2022 Toby Mao" + opts.footer_text = "Copyright (c) 2023 Toby Mao" opts.template_directory = Path(__file__).parent.joinpath("templates").absolute() - opts.edit_url = ["sqlglot=https://github.com/tobymao/sqlglot/"] + opts.edit_url = ["sqlglot=https://github.com/tobymao/sqlglot/tree/main/sqlglot/"] with mock.patch("pdoc.__main__.parser", **{"parse_args.return_value": opts}): cli() diff --git a/sqlglot/__init__.py b/sqlglot/__init__.py index 714897f..7b07ae1 100644 --- a/sqlglot/__init__.py +++ b/sqlglot/__init__.py @@ -1,5 +1,6 @@ """ .. include:: ../README.md + ---- """ @@ -39,7 +40,7 @@ if t.TYPE_CHECKING: T = t.TypeVar("T", bound=Expression) -__version__ = "10.6.3" +__version__ = "11.0.1" pretty = False """Whether to format generated SQL by default.""" diff --git a/sqlglot/dialects/bigquery.py b/sqlglot/dialects/bigquery.py index 90ae229..6a19b46 100644 --- a/sqlglot/dialects/bigquery.py +++ b/sqlglot/dialects/bigquery.py @@ -2,6 +2,8 @@ from __future__ import annotations +import typing as t + from sqlglot import exp, generator, parser, tokens, transforms from sqlglot.dialects.dialect import ( Dialect, @@ -14,8 +16,10 @@ from sqlglot.dialects.dialect import ( from sqlglot.helper import seq_get from sqlglot.tokens import TokenType +E = t.TypeVar("E", bound=exp.Expression) + -def _date_add(expression_class): +def _date_add(expression_class: t.Type[E]) -> t.Callable[[t.Sequence], E]: def func(args): interval = seq_get(args, 1) return expression_class( @@ -27,26 +31,26 @@ def _date_add(expression_class): return func -def _date_trunc(args): +def _date_trunc(args: t.Sequence) -> exp.Expression: unit = seq_get(args, 1) if isinstance(unit, exp.Column): unit = exp.Var(this=unit.name) return exp.DateTrunc(this=seq_get(args, 0), expression=unit) -def _date_add_sql(data_type, kind): +def _date_add_sql( + data_type: str, kind: str +) -> t.Callable[[generator.Generator, exp.Expression], str]: def func(self, expression): this = self.sql(expression, "this") - unit = self.sql(expression, "unit") or "'day'" - expression = self.sql(expression, "expression") - return f"{data_type}_{kind}({this}, INTERVAL {expression} {unit})" + return f"{data_type}_{kind}({this}, {self.sql(exp.Interval(this=expression.expression, unit=expression.args.get('unit') or exp.Literal.string('day')))})" return func -def _derived_table_values_to_unnest(self, expression): +def _derived_table_values_to_unnest(self: generator.Generator, expression: exp.Values) -> str: if not isinstance(expression.unnest().parent, exp.From): - expression = transforms.remove_precision_parameterized_types(expression) + expression = t.cast(exp.Values, transforms.remove_precision_parameterized_types(expression)) return self.values_sql(expression) rows = [tuple_exp.expressions for tuple_exp in expression.find_all(exp.Tuple)] structs = [] @@ -60,7 +64,7 @@ def _derived_table_values_to_unnest(self, expression): return self.unnest_sql(unnest_exp) -def _returnsproperty_sql(self, expression): +def _returnsproperty_sql(self: generator.Generator, expression: exp.ReturnsProperty) -> str: this = expression.this if isinstance(this, exp.Schema): this = f"{this.this} <{self.expressions(this)}>" @@ -69,8 +73,8 @@ def _returnsproperty_sql(self, expression): return f"RETURNS {this}" -def _create_sql(self, expression): - kind = expression.args.get("kind") +def _create_sql(self: generator.Generator, expression: exp.Create) -> str: + kind = expression.args["kind"] returns = expression.find(exp.ReturnsProperty) if kind.upper() == "FUNCTION" and returns and returns.args.get("is_table"): expression = expression.copy() @@ -89,6 +93,29 @@ def _create_sql(self, expression): return self.create_sql(expression) +def _unqualify_unnest(expression: exp.Expression) -> exp.Expression: + """Remove references to unnest table aliases since bigquery doesn't allow them. + + These are added by the optimizer's qualify_column step. + """ + if isinstance(expression, exp.Select): + unnests = { + unnest.alias + for unnest in expression.args.get("from", exp.From(expressions=[])).expressions + if isinstance(unnest, exp.Unnest) and unnest.alias + } + + if unnests: + expression = expression.copy() + + for select in expression.expressions: + for column in select.find_all(exp.Column): + if column.table in unnests: + column.set("table", None) + + return expression + + class BigQuery(Dialect): unnest_column_only = True time_mapping = { @@ -110,7 +137,7 @@ class BigQuery(Dialect): ] COMMENTS = ["--", "#", ("/*", "*/")] IDENTIFIERS = ["`"] - ESCAPES = ["\\"] + STRING_ESCAPES = ["\\"] HEX_STRINGS = [("0x", ""), ("0X", "")] KEYWORDS = { @@ -190,6 +217,9 @@ class BigQuery(Dialect): exp.GroupConcat: rename_func("STRING_AGG"), exp.ILike: no_ilike_sql, exp.IntDiv: rename_func("DIV"), + exp.Select: transforms.preprocess( + [_unqualify_unnest], transforms.delegate("select_sql") + ), exp.StrToTime: lambda self, e: f"PARSE_TIMESTAMP({self.format_time(e)}, {self.sql(e, 'this')})", exp.TimeAdd: _date_add_sql("TIME", "ADD"), exp.TimeSub: _date_add_sql("TIME", "SUB"), diff --git a/sqlglot/dialects/clickhouse.py b/sqlglot/dialects/clickhouse.py index 9e8c691..b553df2 100644 --- a/sqlglot/dialects/clickhouse.py +++ b/sqlglot/dialects/clickhouse.py @@ -9,7 +9,7 @@ from sqlglot.parser import parse_var_map from sqlglot.tokens import TokenType -def _lower_func(sql): +def _lower_func(sql: str) -> str: index = sql.index("(") return sql[:index].lower() + sql[index:] diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py index 1b20e0a..176a8ce 100644 --- a/sqlglot/dialects/dialect.py +++ b/sqlglot/dialects/dialect.py @@ -11,6 +11,8 @@ from sqlglot.time import format_time from sqlglot.tokens import Tokenizer from sqlglot.trie import new_trie +E = t.TypeVar("E", bound=exp.Expression) + class Dialects(str, Enum): DIALECT = "" @@ -37,14 +39,16 @@ class Dialects(str, Enum): class _Dialect(type): - classes: t.Dict[str, Dialect] = {} + classes: t.Dict[str, t.Type[Dialect]] = {} @classmethod - def __getitem__(cls, key): + def __getitem__(cls, key: str) -> t.Type[Dialect]: return cls.classes[key] @classmethod - def get(cls, key, default=None): + def get( + cls, key: str, default: t.Optional[t.Type[Dialect]] = None + ) -> t.Optional[t.Type[Dialect]]: return cls.classes.get(key, default) def __new__(cls, clsname, bases, attrs): @@ -119,7 +123,7 @@ class Dialect(metaclass=_Dialect): generator_class = None @classmethod - def get_or_raise(cls, dialect): + def get_or_raise(cls, dialect: DialectType) -> t.Type[Dialect]: if not dialect: return cls if isinstance(dialect, _Dialect): @@ -134,7 +138,9 @@ class Dialect(metaclass=_Dialect): return result @classmethod - def format_time(cls, expression): + def format_time( + cls, expression: t.Optional[str | exp.Expression] + ) -> t.Optional[exp.Expression]: if isinstance(expression, str): return exp.Literal.string( format_time( @@ -153,26 +159,28 @@ class Dialect(metaclass=_Dialect): ) return expression - def parse(self, sql, **opts): + def parse(self, sql: str, **opts) -> t.List[t.Optional[exp.Expression]]: return self.parser(**opts).parse(self.tokenizer.tokenize(sql), sql) - def parse_into(self, expression_type, sql, **opts): + def parse_into( + self, expression_type: exp.IntoType, sql: str, **opts + ) -> t.List[t.Optional[exp.Expression]]: return self.parser(**opts).parse_into(expression_type, self.tokenizer.tokenize(sql), sql) - def generate(self, expression, **opts): + def generate(self, expression: t.Optional[exp.Expression], **opts) -> str: return self.generator(**opts).generate(expression) - def transpile(self, code, **opts): - return self.generate(self.parse(code), **opts) + def transpile(self, sql: str, **opts) -> t.List[str]: + return [self.generate(expression, **opts) for expression in self.parse(sql)] @property - def tokenizer(self): + def tokenizer(self) -> Tokenizer: if not hasattr(self, "_tokenizer"): - self._tokenizer = self.tokenizer_class() + self._tokenizer = self.tokenizer_class() # type: ignore return self._tokenizer - def parser(self, **opts): - return self.parser_class( + def parser(self, **opts) -> Parser: + return self.parser_class( # type: ignore **{ "index_offset": self.index_offset, "unnest_column_only": self.unnest_column_only, @@ -182,14 +190,15 @@ class Dialect(metaclass=_Dialect): }, ) - def generator(self, **opts): - return self.generator_class( + def generator(self, **opts) -> Generator: + return self.generator_class( # type: ignore **{ "quote_start": self.quote_start, "quote_end": self.quote_end, "identifier_start": self.identifier_start, "identifier_end": self.identifier_end, - "escape": self.tokenizer_class.ESCAPES[0], + "string_escape": self.tokenizer_class.STRING_ESCAPES[0], + "identifier_escape": self.tokenizer_class.IDENTIFIER_ESCAPES[0], "index_offset": self.index_offset, "time_mapping": self.inverse_time_mapping, "time_trie": self.inverse_time_trie, @@ -202,11 +211,10 @@ class Dialect(metaclass=_Dialect): ) -if t.TYPE_CHECKING: - DialectType = t.Union[str, Dialect, t.Type[Dialect], None] +DialectType = t.Union[str, Dialect, t.Type[Dialect], None] -def rename_func(name): +def rename_func(name: str) -> t.Callable[[Generator, exp.Expression], str]: def _rename(self, expression): args = flatten(expression.args.values()) return f"{self.normalize_func(name)}({self.format_args(*args)})" @@ -214,32 +222,34 @@ def rename_func(name): return _rename -def approx_count_distinct_sql(self, expression): +def approx_count_distinct_sql(self: Generator, expression: exp.ApproxDistinct) -> str: if expression.args.get("accuracy"): self.unsupported("APPROX_COUNT_DISTINCT does not support accuracy") return f"APPROX_COUNT_DISTINCT({self.format_args(expression.this)})" -def if_sql(self, expression): +def if_sql(self: Generator, expression: exp.If) -> str: expressions = self.format_args( expression.this, expression.args.get("true"), expression.args.get("false") ) return f"IF({expressions})" -def arrow_json_extract_sql(self, expression): +def arrow_json_extract_sql(self: Generator, expression: exp.JSONExtract | exp.JSONBExtract) -> str: return self.binary(expression, "->") -def arrow_json_extract_scalar_sql(self, expression): +def arrow_json_extract_scalar_sql( + self: Generator, expression: exp.JSONExtractScalar | exp.JSONBExtractScalar +) -> str: return self.binary(expression, "->>") -def inline_array_sql(self, expression): +def inline_array_sql(self: Generator, expression: exp.Array) -> str: return f"[{self.expressions(expression)}]" -def no_ilike_sql(self, expression): +def no_ilike_sql(self: Generator, expression: exp.ILike) -> str: return self.like_sql( exp.Like( this=exp.Lower(this=expression.this), @@ -248,44 +258,44 @@ def no_ilike_sql(self, expression): ) -def no_paren_current_date_sql(self, expression): +def no_paren_current_date_sql(self: Generator, expression: exp.CurrentDate) -> str: zone = self.sql(expression, "this") return f"CURRENT_DATE AT TIME ZONE {zone}" if zone else "CURRENT_DATE" -def no_recursive_cte_sql(self, expression): +def no_recursive_cte_sql(self: Generator, expression: exp.With) -> str: if expression.args.get("recursive"): self.unsupported("Recursive CTEs are unsupported") expression.args["recursive"] = False return self.with_sql(expression) -def no_safe_divide_sql(self, expression): +def no_safe_divide_sql(self: Generator, expression: exp.SafeDivide) -> str: n = self.sql(expression, "this") d = self.sql(expression, "expression") return f"IF({d} <> 0, {n} / {d}, NULL)" -def no_tablesample_sql(self, expression): +def no_tablesample_sql(self: Generator, expression: exp.TableSample) -> str: self.unsupported("TABLESAMPLE unsupported") return self.sql(expression.this) -def no_pivot_sql(self, expression): +def no_pivot_sql(self: Generator, expression: exp.Pivot) -> str: self.unsupported("PIVOT unsupported") return self.sql(expression) -def no_trycast_sql(self, expression): +def no_trycast_sql(self: Generator, expression: exp.TryCast) -> str: return self.cast_sql(expression) -def no_properties_sql(self, expression): +def no_properties_sql(self: Generator, expression: exp.Properties) -> str: self.unsupported("Properties unsupported") return "" -def str_position_sql(self, expression): +def str_position_sql(self: Generator, expression: exp.StrPosition) -> str: this = self.sql(expression, "this") substr = self.sql(expression, "substr") position = self.sql(expression, "position") @@ -294,13 +304,15 @@ def str_position_sql(self, expression): return f"STRPOS({this}, {substr})" -def struct_extract_sql(self, expression): +def struct_extract_sql(self: Generator, expression: exp.StructExtract) -> str: this = self.sql(expression, "this") struct_key = self.sql(exp.Identifier(this=expression.expression, quoted=True)) return f"{this}.{struct_key}" -def var_map_sql(self, expression, map_func_name="MAP"): +def var_map_sql( + self: Generator, expression: exp.Map | exp.VarMap, map_func_name: str = "MAP" +) -> str: keys = expression.args["keys"] values = expression.args["values"] @@ -315,27 +327,33 @@ def var_map_sql(self, expression, map_func_name="MAP"): return f"{map_func_name}({self.format_args(*args)})" -def format_time_lambda(exp_class, dialect, default=None): +def format_time_lambda( + exp_class: t.Type[E], dialect: str, default: t.Optional[bool | str] = None +) -> t.Callable[[t.Sequence], E]: """Helper used for time expressions. - Args - exp_class (Class): the expression class to instantiate - dialect (string): sql dialect - default (Option[bool | str]): the default format, True being time + Args: + exp_class: the expression class to instantiate. + dialect: target sql dialect. + default: the default format, True being time. + + Returns: + A callable that can be used to return the appropriately formatted time expression. """ - def _format_time(args): + def _format_time(args: t.Sequence): return exp_class( this=seq_get(args, 0), format=Dialect[dialect].format_time( - seq_get(args, 1) or (Dialect[dialect].time_format if default is True else default) + seq_get(args, 1) + or (Dialect[dialect].time_format if default is True else default or None) ), ) return _format_time -def create_with_partitions_sql(self, expression): +def create_with_partitions_sql(self: Generator, expression: exp.Create) -> str: """ In Hive and Spark, the PARTITIONED BY property acts as an extension of a table's schema. When the PARTITIONED BY value is an array of column names, they are transformed into a schema. The corresponding @@ -359,19 +377,21 @@ def create_with_partitions_sql(self, expression): return self.create_sql(expression) -def parse_date_delta(exp_class, unit_mapping=None): - def inner_func(args): +def parse_date_delta( + exp_class: t.Type[E], unit_mapping: t.Optional[t.Dict[str, str]] = None +) -> t.Callable[[t.Sequence], E]: + def inner_func(args: t.Sequence) -> E: unit_based = len(args) == 3 this = seq_get(args, 2) if unit_based else seq_get(args, 0) expression = seq_get(args, 1) if unit_based else seq_get(args, 1) unit = seq_get(args, 0) if unit_based else exp.Literal.string("DAY") - unit = unit_mapping.get(unit.name.lower(), unit) if unit_mapping else unit + unit = unit_mapping.get(unit.name.lower(), unit) if unit_mapping else unit # type: ignore return exp_class(this=this, expression=expression, unit=unit) return inner_func -def locate_to_strposition(args): +def locate_to_strposition(args: t.Sequence) -> exp.Expression: return exp.StrPosition( this=seq_get(args, 1), substr=seq_get(args, 0), @@ -379,22 +399,22 @@ def locate_to_strposition(args): ) -def strposition_to_locate_sql(self, expression): +def strposition_to_locate_sql(self: Generator, expression: exp.StrPosition) -> str: args = self.format_args( expression.args.get("substr"), expression.this, expression.args.get("position") ) return f"LOCATE({args})" -def timestrtotime_sql(self, expression: exp.TimeStrToTime) -> str: +def timestrtotime_sql(self: Generator, expression: exp.TimeStrToTime) -> str: return f"CAST({self.sql(expression, 'this')} AS TIMESTAMP)" -def datestrtodate_sql(self, expression: exp.DateStrToDate) -> str: +def datestrtodate_sql(self: Generator, expression: exp.DateStrToDate) -> str: return f"CAST({self.sql(expression, 'this')} AS DATE)" -def trim_sql(self, expression): +def trim_sql(self: Generator, expression: exp.Trim) -> str: target = self.sql(expression, "this") trim_type = self.sql(expression, "position") remove_chars = self.sql(expression, "expression") diff --git a/sqlglot/dialects/drill.py b/sqlglot/dialects/drill.py index d0a0251..1730eaf 100644 --- a/sqlglot/dialects/drill.py +++ b/sqlglot/dialects/drill.py @@ -1,6 +1,7 @@ from __future__ import annotations import re +import typing as t from sqlglot import exp, generator, parser, tokens from sqlglot.dialects.dialect import ( @@ -16,35 +17,29 @@ from sqlglot.dialects.dialect import ( ) -def _to_timestamp(args): - # TO_TIMESTAMP accepts either a single double argument or (text, text) - if len(args) == 1 and args[0].is_number: - return exp.UnixToTime.from_arg_list(args) - return format_time_lambda(exp.StrToTime, "drill")(args) - - -def _str_to_time_sql(self, expression): +def _str_to_time_sql(self: generator.Generator, expression: exp.TsOrDsToDate) -> str: return f"STRPTIME({self.sql(expression, 'this')}, {self.format_time(expression)})" -def _ts_or_ds_to_date_sql(self, expression): +def _ts_or_ds_to_date_sql(self: generator.Generator, expression: exp.TsOrDsToDate) -> str: time_format = self.format_time(expression) if time_format and time_format not in (Drill.time_format, Drill.date_format): return f"CAST({_str_to_time_sql(self, expression)} AS DATE)" return f"CAST({self.sql(expression, 'this')} AS DATE)" -def _date_add_sql(kind): - def func(self, expression): +def _date_add_sql(kind: str) -> t.Callable[[generator.Generator, exp.DateAdd | exp.DateSub], str]: + def func(self: generator.Generator, expression: exp.DateAdd | exp.DateSub) -> str: this = self.sql(expression, "this") - unit = expression.text("unit").upper() or "DAY" - expression = self.sql(expression, "expression") - return f"DATE_{kind}({this}, INTERVAL '{expression}' {unit})" + unit = exp.Var(this=expression.text("unit").upper() or "DAY") + return ( + f"DATE_{kind}({this}, {self.sql(exp.Interval(this=expression.expression, unit=unit))})" + ) return func -def if_sql(self, expression): +def if_sql(self: generator.Generator, expression: exp.If) -> str: """ Drill requires backticks around certain SQL reserved words, IF being one of them, This function adds the backticks around the keyword IF. @@ -61,7 +56,7 @@ def if_sql(self, expression): return f"`IF`({expressions})" -def _str_to_date(self, expression): +def _str_to_date(self: generator.Generator, expression: exp.StrToDate) -> str: this = self.sql(expression, "this") time_format = self.format_time(expression) if time_format == Drill.date_format: @@ -111,7 +106,7 @@ class Drill(Dialect): class Tokenizer(tokens.Tokenizer): QUOTES = ["'"] IDENTIFIERS = ["`"] - ESCAPES = ["\\"] + STRING_ESCAPES = ["\\"] ENCODE = "utf-8" class Parser(parser.Parser): @@ -168,10 +163,10 @@ class Drill(Dialect): exp.TimeToStr: lambda self, e: f"TO_CHAR({self.sql(e, 'this')}, {self.format_time(e)})", exp.TimeToUnix: rename_func("UNIX_TIMESTAMP"), exp.TryCast: no_trycast_sql, - exp.TsOrDsAdd: lambda self, e: f"DATE_ADD(CAST({self.sql(e, 'this')} AS DATE), INTERVAL '{self.sql(e, 'expression')}' DAY)", + exp.TsOrDsAdd: lambda self, e: f"DATE_ADD(CAST({self.sql(e, 'this')} AS DATE), {self.sql(exp.Interval(this=e.expression, unit=exp.Var(this='DAY')))})", exp.TsOrDsToDate: _ts_or_ds_to_date_sql, exp.TsOrDiToDi: lambda self, e: f"CAST(SUBSTR(REPLACE(CAST({self.sql(e, 'this')} AS VARCHAR), '-', ''), 1, 8) AS INT)", } - def normalize_func(self, name): + def normalize_func(self, name: str) -> str: return name if re.match(exp.SAFE_IDENTIFIER_RE, name) else f"`{name}`" diff --git a/sqlglot/dialects/duckdb.py b/sqlglot/dialects/duckdb.py index 95ff95c..959e5e2 100644 --- a/sqlglot/dialects/duckdb.py +++ b/sqlglot/dialects/duckdb.py @@ -25,10 +25,9 @@ def _str_to_time_sql(self, expression): def _ts_or_ds_add(self, expression): - this = self.sql(expression, "this") - e = self.sql(expression, "expression") + this = expression.args.get("this") unit = self.sql(expression, "unit").strip("'") or "DAY" - return f"CAST({this} AS DATE) + INTERVAL {e} {unit}" + return f"CAST({this} AS DATE) + {self.sql(exp.Interval(this=expression.expression, unit=unit))}" def _ts_or_ds_to_date_sql(self, expression): @@ -40,9 +39,8 @@ def _ts_or_ds_to_date_sql(self, expression): def _date_add(self, expression): this = self.sql(expression, "this") - e = self.sql(expression, "expression") unit = self.sql(expression, "unit").strip("'") or "DAY" - return f"{this} + INTERVAL {e} {unit}" + return f"{this} + {self.sql(exp.Interval(this=expression.expression, unit=unit))}" def _array_sort_sql(self, expression): diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py index f2b6eaa..c558b70 100644 --- a/sqlglot/dialects/hive.py +++ b/sqlglot/dialects/hive.py @@ -172,7 +172,7 @@ class Hive(Dialect): class Tokenizer(tokens.Tokenizer): QUOTES = ["'", '"'] IDENTIFIERS = ["`"] - ESCAPES = ["\\"] + STRING_ESCAPES = ["\\"] ENCODE = "utf-8" KEYWORDS = { diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py index a5bd86b..c2c2c8c 100644 --- a/sqlglot/dialects/mysql.py +++ b/sqlglot/dialects/mysql.py @@ -89,8 +89,9 @@ def _date_add_sql(kind): def func(self, expression): this = self.sql(expression, "this") unit = expression.text("unit").upper() or "DAY" - expression = self.sql(expression, "expression") - return f"DATE_{kind}({this}, INTERVAL {expression} {unit})" + return ( + f"DATE_{kind}({this}, {self.sql(exp.Interval(this=expression.expression, unit=unit))})" + ) return func @@ -117,7 +118,7 @@ class MySQL(Dialect): QUOTES = ["'", '"'] COMMENTS = ["--", "#", ("/*", "*/")] IDENTIFIERS = ["`"] - ESCAPES = ["'", "\\"] + STRING_ESCAPES = ["'", "\\"] BIT_STRINGS = [("b'", "'"), ("B'", "'"), ("0b", "")] HEX_STRINGS = [("x'", "'"), ("X'", "'"), ("0x", "")] diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py index 6418032..c709665 100644 --- a/sqlglot/dialects/postgres.py +++ b/sqlglot/dialects/postgres.py @@ -40,8 +40,7 @@ def _date_add_sql(kind): expression = expression.copy() expression.args["is_string"] = True - expression = self.sql(expression) - return f"{this} {kind} INTERVAL {expression} {unit}" + return f"{this} {kind} {self.sql(exp.Interval(this=expression, unit=unit))}" return func diff --git a/sqlglot/dialects/redshift.py b/sqlglot/dialects/redshift.py index c3c99eb..813ee5f 100644 --- a/sqlglot/dialects/redshift.py +++ b/sqlglot/dialects/redshift.py @@ -37,11 +37,10 @@ class Redshift(Postgres): return this class Tokenizer(Postgres.Tokenizer): - ESCAPES = ["\\"] + STRING_ESCAPES = ["\\"] KEYWORDS = { **Postgres.Tokenizer.KEYWORDS, # type: ignore - "COPY": TokenType.COMMAND, "ENCODE": TokenType.ENCODE, "GEOMETRY": TokenType.GEOMETRY, "GEOGRAPHY": TokenType.GEOGRAPHY, diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py index 3b83b02..55a6bd3 100644 --- a/sqlglot/dialects/snowflake.py +++ b/sqlglot/dialects/snowflake.py @@ -180,7 +180,7 @@ class Snowflake(Dialect): class Tokenizer(tokens.Tokenizer): QUOTES = ["'", "$$"] - ESCAPES = ["\\", "'"] + STRING_ESCAPES = ["\\", "'"] SINGLE_TOKENS = { **tokens.Tokenizer.SINGLE_TOKENS, @@ -191,6 +191,7 @@ class Snowflake(Dialect): **tokens.Tokenizer.KEYWORDS, "EXCLUDE": TokenType.EXCEPT, "MATCH_RECOGNIZE": TokenType.MATCH_RECOGNIZE, + "PUT": TokenType.COMMAND, "RENAME": TokenType.REPLACE, "TIMESTAMP_LTZ": TokenType.TIMESTAMPLTZ, "TIMESTAMP_NTZ": TokenType.TIMESTAMP, @@ -222,6 +223,7 @@ class Snowflake(Dialect): exp.TimeToUnix: lambda self, e: f"EXTRACT(epoch_second FROM {self.sql(e, 'this')})", exp.Trim: lambda self, e: f"TRIM({self.format_args(e.this, e.expression)})", exp.UnixToTime: _unix_to_time_sql, + exp.DayOfWeek: rename_func("DAYOFWEEK"), } TYPE_MAPPING = { @@ -294,3 +296,12 @@ class Snowflake(Dialect): kind = f" {kind_value}" if kind_value else "" this = f" {self.sql(expression, 'this')}" return f"DESCRIBE{kind}{this}" + + def generatedasidentitycolumnconstraint_sql( + self, expression: exp.GeneratedAsIdentityColumnConstraint + ) -> str: + start = expression.args.get("start") + start = f" START {start}" if start else "" + increment = expression.args.get("increment") + increment = f" INCREMENT {increment}" if increment else "" + return f"AUTOINCREMENT{start}{increment}" diff --git a/sqlglot/dialects/spark.py b/sqlglot/dialects/spark.py index 8ef4a87..03ec211 100644 --- a/sqlglot/dialects/spark.py +++ b/sqlglot/dialects/spark.py @@ -157,6 +157,7 @@ class Spark(Hive): TRANSFORMS.pop(exp.ILike) WRAP_DERIVED_VALUES = False + CREATE_FUNCTION_AS = False def cast_sql(self, expression: exp.Cast) -> str: if isinstance(expression.this, exp.Cast) and expression.this.is_type( diff --git a/sqlglot/dialects/sqlite.py b/sqlglot/dialects/sqlite.py index 1b39449..a428dd5 100644 --- a/sqlglot/dialects/sqlite.py +++ b/sqlglot/dialects/sqlite.py @@ -49,7 +49,6 @@ class SQLite(Dialect): KEYWORDS = { **tokens.Tokenizer.KEYWORDS, - "AUTOINCREMENT": TokenType.AUTO_INCREMENT, } class Parser(parser.Parser): diff --git a/sqlglot/diff.py b/sqlglot/diff.py index 7d5ec21..7530613 100644 --- a/sqlglot/diff.py +++ b/sqlglot/diff.py @@ -1,5 +1,6 @@ """ .. include:: ../posts/sql_diff.md + ---- """ diff --git a/sqlglot/errors.py b/sqlglot/errors.py index b5ef5ad..300c215 100644 --- a/sqlglot/errors.py +++ b/sqlglot/errors.py @@ -7,10 +7,17 @@ from sqlglot.helper import AutoName class ErrorLevel(AutoName): - IGNORE = auto() # Ignore any parser errors - WARN = auto() # Log any parser errors with ERROR level - RAISE = auto() # Collect all parser errors and raise a single exception - IMMEDIATE = auto() # Immediately raise an exception on the first parser error + IGNORE = auto() + """Ignore all errors.""" + + WARN = auto() + """Log all errors.""" + + RAISE = auto() + """Collect all errors and raise a single exception.""" + + IMMEDIATE = auto() + """Immediately raise an exception on the first error found.""" class SqlglotError(Exception): diff --git a/sqlglot/executor/__init__.py b/sqlglot/executor/__init__.py index 67b4b00..c3d2701 100644 --- a/sqlglot/executor/__init__.py +++ b/sqlglot/executor/__init__.py @@ -1,5 +1,6 @@ """ .. include:: ../../posts/python_sql_engine.md + ---- """ diff --git a/sqlglot/executor/python.py b/sqlglot/executor/python.py index 29848c6..de570b0 100644 --- a/sqlglot/executor/python.py +++ b/sqlglot/executor/python.py @@ -408,7 +408,7 @@ def _lambda_sql(self, e: exp.Lambda) -> str: class Python(Dialect): class Tokenizer(tokens.Tokenizer): - ESCAPES = ["\\"] + STRING_ESCAPES = ["\\"] class Generator(generator.Generator): TRANSFORMS = { diff --git a/sqlglot/expressions.py b/sqlglot/expressions.py index 6bb083a..6800cd5 100644 --- a/sqlglot/expressions.py +++ b/sqlglot/expressions.py @@ -6,6 +6,7 @@ Every AST node in SQLGlot is represented by a subclass of `Expression`. This module contains the implementation of all supported `Expression` types. Additionally, it exposes a number of helper functions, which are mainly used to programmatically build SQL expressions, such as `sqlglot.expressions.select`. + ---- """ @@ -137,6 +138,8 @@ class Expression(metaclass=_Expression): return field if isinstance(field, (Identifier, Literal, Var)): return field.this + if isinstance(field, (Star, Null)): + return field.name return "" @property @@ -176,13 +179,11 @@ class Expression(metaclass=_Expression): return self.text("alias") @property - def name(self): + def name(self) -> str: return self.text("this") @property def alias_or_name(self): - if isinstance(self, Null): - return "NULL" return self.alias or self.name @property @@ -589,12 +590,11 @@ class Expression(metaclass=_Expression): return load(obj) -if t.TYPE_CHECKING: - IntoType = t.Union[ - str, - t.Type[Expression], - t.Collection[t.Union[str, t.Type[Expression]]], - ] +IntoType = t.Union[ + str, + t.Type[Expression], + t.Collection[t.Union[str, t.Type[Expression]]], +] class Condition(Expression): @@ -939,7 +939,7 @@ class EncodeColumnConstraint(ColumnConstraintKind): class GeneratedAsIdentityColumnConstraint(ColumnConstraintKind): # this: True -> ALWAYS, this: False -> BY DEFAULT - arg_types = {"this": True, "start": False, "increment": False} + arg_types = {"this": False, "start": False, "increment": False} class NotNullColumnConstraint(ColumnConstraintKind): @@ -2390,7 +2390,7 @@ class Star(Expression): arg_types = {"except": False, "replace": False} @property - def name(self): + def name(self) -> str: return "*" @property @@ -2413,6 +2413,10 @@ class Placeholder(Expression): class Null(Condition): arg_types: t.Dict[str, t.Any] = {} + @property + def name(self) -> str: + return "NULL" + class Boolean(Condition): pass @@ -2644,7 +2648,9 @@ class Div(Binary): class Dot(Binary): - pass + @property + def name(self) -> str: + return self.expression.name class DPipe(Binary): @@ -2961,7 +2967,7 @@ class Cast(Func): arg_types = {"this": True, "to": True} @property - def name(self): + def name(self) -> str: return self.this.name @property @@ -4027,17 +4033,39 @@ def paren(expression) -> Paren: SAFE_IDENTIFIER_RE = re.compile(r"^[_a-zA-Z][\w]*$") -def to_identifier(alias, quoted=None) -> t.Optional[Identifier]: - if alias is None: +@t.overload +def to_identifier(name: None, quoted: t.Optional[bool] = None) -> None: + ... + + +@t.overload +def to_identifier(name: str | Identifier, quoted: t.Optional[bool] = None) -> Identifier: + ... + + +def to_identifier(name, quoted=None): + """Builds an identifier. + + Args: + name: The name to turn into an identifier. + quoted: Whether or not force quote the identifier. + + Returns: + The identifier ast node. + """ + + if name is None: return None - if isinstance(alias, Identifier): - identifier = alias - elif isinstance(alias, str): - if quoted is None: - quoted = not re.match(SAFE_IDENTIFIER_RE, alias) - identifier = Identifier(this=alias, quoted=quoted) + + if isinstance(name, Identifier): + identifier = name + elif isinstance(name, str): + identifier = Identifier( + this=name, + quoted=not re.match(SAFE_IDENTIFIER_RE, name) if quoted is None else quoted, + ) else: - raise ValueError(f"Alias needs to be a string or an Identifier, got: {alias.__class__}") + raise ValueError(f"Name needs to be a string or an Identifier, got: {name.__class__}") return identifier @@ -4112,20 +4140,31 @@ def to_column(sql_path: str | Column, **kwargs) -> Column: return Column(this=column_name, table=table_name, **kwargs) -def alias_(expression, alias, table=False, dialect=None, quoted=None, **opts): - """ - Create an Alias expression. +def alias_( + expression: str | Expression, + alias: str | Identifier, + table: bool | t.Sequence[str | Identifier] = False, + quoted: t.Optional[bool] = None, + dialect: DialectType = None, + **opts, +): + """Create an Alias expression. + Example: >>> alias_('foo', 'bar').sql() 'foo AS bar' + >>> alias_('(select 1, 2)', 'bar', table=['a', 'b']).sql() + '(SELECT 1, 2) AS bar(a, b)' + Args: - expression (str | Expression): the SQL code strings to parse. + expression: the SQL code strings to parse. If an Expression instance is passed, this is used as-is. - alias (str | Identifier): the alias name to use. If the name has + alias: the alias name to use. If the name has special characters it is quoted. - table (bool): create a table alias, default false - dialect (str): the dialect used to parse the input expression. + table: Whether or not to create a table alias, can also be a list of columns. + quoted: whether or not to quote the alias + dialect: the dialect used to parse the input expression. **opts: other options to use to parse the input expressions. Returns: @@ -4135,8 +4174,14 @@ def alias_(expression, alias, table=False, dialect=None, quoted=None, **opts): alias = to_identifier(alias, quoted=quoted) if table: - expression.set("alias", TableAlias(this=alias)) - return expression + table_alias = TableAlias(this=alias) + exp.set("alias", table_alias) + + if not isinstance(table, bool): + for column in table: + table_alias.append("columns", to_identifier(column, quoted=quoted)) + + return exp # We don't set the "alias" arg for Window expressions, because that would add an IDENTIFIER node in # the AST, representing a "named_window" [1] construct (eg. bigquery). What we want is an ALIAS node diff --git a/sqlglot/generator.py b/sqlglot/generator.py index b95e9bc..0d72fe3 100644 --- a/sqlglot/generator.py +++ b/sqlglot/generator.py @@ -1,6 +1,7 @@ from __future__ import annotations import logging +import re import typing as t from sqlglot import exp @@ -11,6 +12,8 @@ from sqlglot.tokens import TokenType logger = logging.getLogger("sqlglot") +BACKSLASH_RE = re.compile(r"\\(?!b|f|n|r|t|0)") + class Generator: """ @@ -28,7 +31,8 @@ class Generator: identify (bool): if set to True all identifiers will be delimited by the corresponding character. normalize (bool): if set to True all identifiers will lower cased - escape (str): specifies an escape character. Default: '. + string_escape (str): specifies a string escape character. Default: '. + identifier_escape (str): specifies an identifier escape character. Default: ". pad (int): determines padding in a formatted string. Default: 2. indent (int): determines the size of indentation in a formatted string. Default: 4. unnest_column_only (bool): if true unnest table aliases are considered only as column aliases @@ -85,6 +89,9 @@ class Generator: # Wrap derived values in parens, usually standard but spark doesn't support it WRAP_DERIVED_VALUES = True + # Whether or not create function uses an AS before the def. + CREATE_FUNCTION_AS = True + TYPE_MAPPING = { exp.DataType.Type.NCHAR: "CHAR", exp.DataType.Type.NVARCHAR: "VARCHAR", @@ -154,7 +161,8 @@ class Generator: "identifier_end", "identify", "normalize", - "escape", + "string_escape", + "identifier_escape", "pad", "index_offset", "unnest_column_only", @@ -167,6 +175,7 @@ class Generator: "_indent", "_replace_backslash", "_escaped_quote_end", + "_escaped_identifier_end", "_leading_comma", "_max_text_width", "_comments", @@ -183,7 +192,8 @@ class Generator: identifier_end=None, identify=False, normalize=False, - escape=None, + string_escape=None, + identifier_escape=None, pad=2, indent=2, index_offset=0, @@ -208,7 +218,8 @@ class Generator: self.identifier_end = identifier_end or '"' self.identify = identify self.normalize = normalize - self.escape = escape or "'" + self.string_escape = string_escape or "'" + self.identifier_escape = identifier_escape or '"' self.pad = pad self.index_offset = index_offset self.unnest_column_only = unnest_column_only @@ -219,8 +230,9 @@ class Generator: self.max_unsupported = max_unsupported self.null_ordering = null_ordering self._indent = indent - self._replace_backslash = self.escape == "\\" - self._escaped_quote_end = self.escape + self.quote_end + self._replace_backslash = self.string_escape == "\\" + self._escaped_quote_end = self.string_escape + self.quote_end + self._escaped_identifier_end = self.identifier_escape + self.identifier_end self._leading_comma = leading_comma self._max_text_width = max_text_width self._comments = comments @@ -441,6 +453,9 @@ class Generator: def generatedasidentitycolumnconstraint_sql( self, expression: exp.GeneratedAsIdentityColumnConstraint ) -> str: + this = "" + if expression.this is not None: + this = " ALWAYS " if expression.this else " BY DEFAULT " start = expression.args.get("start") start = f"START WITH {start}" if start else "" increment = expression.args.get("increment") @@ -449,9 +464,7 @@ class Generator: if start or increment: sequence_opts = f"{start} {increment}" sequence_opts = f" ({sequence_opts.strip()})" - return ( - f"GENERATED {'ALWAYS' if expression.this else 'BY DEFAULT'} AS IDENTITY{sequence_opts}" - ) + return f"GENERATED{this}AS IDENTITY{sequence_opts}" def notnullcolumnconstraint_sql(self, expression: exp.NotNullColumnConstraint) -> str: return f"{'' if expression.args.get('allow_null') else 'NOT '}NULL" @@ -496,7 +509,12 @@ class Generator: properties_sql = self.sql(properties_exp, "properties") begin = " BEGIN" if expression.args.get("begin") else "" expression_sql = self.sql(expression, "expression") - expression_sql = f" AS{begin}{self.sep()}{expression_sql}" if expression_sql else "" + if expression_sql: + expression_sql = f"{begin}{self.sep()}{expression_sql}" + + if self.CREATE_FUNCTION_AS or kind != "FUNCTION": + expression_sql = f" AS{expression_sql}" + temporary = " TEMPORARY" if expression.args.get("temporary") else "" transient = ( " TRANSIENT" if self.CREATE_TRANSIENT and expression.args.get("transient") else "" @@ -701,6 +719,7 @@ class Generator: def identifier_sql(self, expression: exp.Identifier) -> str: text = expression.name text = text.lower() if self.normalize else text + text = text.replace(self.identifier_end, self._escaped_identifier_end) if expression.args.get("quoted") or self.identify: text = f"{self.identifier_start}{text}{self.identifier_end}" return text @@ -1121,7 +1140,7 @@ class Generator: text = expression.this or "" if expression.is_string: if self._replace_backslash: - text = text.replace("\\", "\\\\") + text = BACKSLASH_RE.sub(r"\\\\", text) text = text.replace(self.quote_end, self._escaped_quote_end) if self.pretty: text = text.replace("\n", self.SENTINEL_LINE_BREAK) @@ -1486,9 +1505,16 @@ class Generator: return f"(SELECT {self.sql(unnest)})" def interval_sql(self, expression: exp.Interval) -> str: - this = self.sql(expression, "this") - this = f" {this}" if this else "" - unit = self.sql(expression, "unit") + this = expression.args.get("this") + if this: + this = ( + f" {this}" + if isinstance(this, exp.Literal) or isinstance(this, exp.Paren) + else f" ({this})" + ) + else: + this = "" + unit = expression.args.get("unit") unit = f" {unit}" if unit else "" return f"INTERVAL{this}{unit}" diff --git a/sqlglot/lineage.py b/sqlglot/lineage.py index a39ad8c..908f126 100644 --- a/sqlglot/lineage.py +++ b/sqlglot/lineage.py @@ -6,6 +6,7 @@ from dataclasses import dataclass, field from sqlglot import Schema, exp, maybe_parse from sqlglot.optimizer import Scope, build_scope, optimize +from sqlglot.optimizer.expand_laterals import expand_laterals from sqlglot.optimizer.qualify_columns import qualify_columns from sqlglot.optimizer.qualify_tables import qualify_tables @@ -38,7 +39,7 @@ def lineage( sql: str | exp.Expression, schema: t.Optional[t.Dict | Schema] = None, sources: t.Optional[t.Dict[str, str | exp.Subqueryable]] = None, - rules: t.Sequence[t.Callable] = (qualify_tables, qualify_columns), + rules: t.Sequence[t.Callable] = (qualify_tables, qualify_columns, expand_laterals), dialect: DialectType = None, ) -> Node: """Build the lineage graph for a column of a SQL query. diff --git a/sqlglot/optimizer/annotate_types.py b/sqlglot/optimizer/annotate_types.py index bfb2bb8..66f97a9 100644 --- a/sqlglot/optimizer/annotate_types.py +++ b/sqlglot/optimizer/annotate_types.py @@ -255,12 +255,23 @@ class TypeAnnotator: for name, source in scope.sources.items(): if not isinstance(source, Scope): continue - if isinstance(source.expression, exp.Values): + if isinstance(source.expression, exp.UDTF): + values = [] + + if isinstance(source.expression, exp.Lateral): + if isinstance(source.expression.this, exp.Explode): + values = [source.expression.this.this] + else: + values = source.expression.expressions[0].expressions + + if not values: + continue + selects[name] = { alias: column for alias, column in zip( source.expression.alias_column_names, - source.expression.expressions[0].expressions, + values, ) } else: @@ -272,7 +283,7 @@ class TypeAnnotator: source = scope.sources.get(col.table) if isinstance(source, exp.Table): col.type = self.schema.get_column_type(source, col) - elif source: + elif source and col.table in selects: col.type = selects[col.table][col.name].type # Then (possibly) annotate the remaining expressions in the scope self._maybe_annotate(scope.expression) diff --git a/sqlglot/optimizer/expand_laterals.py b/sqlglot/optimizer/expand_laterals.py new file mode 100644 index 0000000..59f3fec --- /dev/null +++ b/sqlglot/optimizer/expand_laterals.py @@ -0,0 +1,34 @@ +from __future__ import annotations + +import typing as t + +from sqlglot import exp + + +def expand_laterals(expression: exp.Expression) -> exp.Expression: + """ + Expand lateral column alias references. + + This assumes `qualify_columns` as already run. + + Example: + >>> import sqlglot + >>> sql = "SELECT x.a + 1 AS b, b + 1 AS c FROM x" + >>> expression = sqlglot.parse_one(sql) + >>> expand_laterals(expression).sql() + 'SELECT x.a + 1 AS b, x.a + 1 + 1 AS c FROM x' + + Args: + expression: expression to optimize + Returns: + optimized expression + """ + for select in expression.find_all(exp.Select): + alias_to_expression: t.Dict[str, exp.Expression] = {} + for projection in select.expressions: + for column in projection.find_all(exp.Column): + if not column.table and column.name in alias_to_expression: + column.replace(alias_to_expression[column.name].copy()) + if isinstance(projection, exp.Alias): + alias_to_expression[projection.alias] = projection.this + return expression diff --git a/sqlglot/optimizer/optimizer.py b/sqlglot/optimizer/optimizer.py index 766e059..96fd56b 100644 --- a/sqlglot/optimizer/optimizer.py +++ b/sqlglot/optimizer/optimizer.py @@ -4,6 +4,7 @@ from sqlglot.optimizer.canonicalize import canonicalize from sqlglot.optimizer.eliminate_ctes import eliminate_ctes from sqlglot.optimizer.eliminate_joins import eliminate_joins from sqlglot.optimizer.eliminate_subqueries import eliminate_subqueries +from sqlglot.optimizer.expand_laterals import expand_laterals from sqlglot.optimizer.expand_multi_table_selects import expand_multi_table_selects from sqlglot.optimizer.isolate_table_selects import isolate_table_selects from sqlglot.optimizer.lower_identities import lower_identities @@ -12,7 +13,7 @@ from sqlglot.optimizer.normalize import normalize from sqlglot.optimizer.optimize_joins import optimize_joins from sqlglot.optimizer.pushdown_predicates import pushdown_predicates from sqlglot.optimizer.pushdown_projections import pushdown_projections -from sqlglot.optimizer.qualify_columns import qualify_columns +from sqlglot.optimizer.qualify_columns import qualify_columns, validate_qualify_columns from sqlglot.optimizer.qualify_tables import qualify_tables from sqlglot.optimizer.unnest_subqueries import unnest_subqueries from sqlglot.schema import ensure_schema @@ -22,6 +23,8 @@ RULES = ( qualify_tables, isolate_table_selects, qualify_columns, + expand_laterals, + validate_qualify_columns, pushdown_projections, normalize, unnest_subqueries, diff --git a/sqlglot/optimizer/pushdown_projections.py b/sqlglot/optimizer/pushdown_projections.py index a73647c..54c5021 100644 --- a/sqlglot/optimizer/pushdown_projections.py +++ b/sqlglot/optimizer/pushdown_projections.py @@ -7,7 +7,7 @@ from sqlglot.optimizer.scope import Scope, traverse_scope SELECT_ALL = object() # Selection to use if selection list is empty -DEFAULT_SELECTION = alias("1", "_") +DEFAULT_SELECTION = lambda: alias("1", "_") def pushdown_projections(expression): @@ -93,7 +93,7 @@ def _remove_unused_selections(scope, parent_selections): # If there are no remaining selections, just select a single constant if not new_selections: - new_selections.append(DEFAULT_SELECTION.copy()) + new_selections.append(DEFAULT_SELECTION()) scope.expression.set("expressions", new_selections) if removed: @@ -106,5 +106,5 @@ def _remove_indexed_selections(scope, indexes_to_remove): selection for i, selection in enumerate(scope.selects) if i not in indexes_to_remove ] if not new_selections: - new_selections.append(DEFAULT_SELECTION.copy()) + new_selections.append(DEFAULT_SELECTION()) scope.expression.set("expressions", new_selections) diff --git a/sqlglot/optimizer/qualify_columns.py b/sqlglot/optimizer/qualify_columns.py index 54425a8..ab13d01 100644 --- a/sqlglot/optimizer/qualify_columns.py +++ b/sqlglot/optimizer/qualify_columns.py @@ -37,11 +37,24 @@ def qualify_columns(expression, schema): if not isinstance(scope.expression, exp.UDTF): _expand_stars(scope, resolver) _qualify_outputs(scope) - _check_unknown_tables(scope) return expression +def validate_qualify_columns(expression): + """Raise an `OptimizeError` if any columns aren't qualified""" + unqualified_columns = [] + for scope in traverse_scope(expression): + if isinstance(scope.expression, exp.Select): + unqualified_columns.extend(scope.unqualified_columns) + if scope.external_columns and not scope.is_correlated_subquery: + raise OptimizeError(f"Unknown table: {scope.external_columns[0].table}") + + if unqualified_columns: + raise OptimizeError(f"Ambiguous columns: {unqualified_columns}") + return expression + + def _pop_table_column_aliases(derived_tables): """ Remove table column aliases. @@ -199,10 +212,6 @@ def _qualify_columns(scope, resolver): if not column_table: column_table = resolver.get_table(column_name) - if not scope.is_subquery and not scope.is_udtf: - if column_table is None: - raise OptimizeError(f"Ambiguous column: {column_name}") - # column_table can be a '' because bigquery unnest has no table alias if column_table: column.set("table", exp.to_identifier(column_table)) @@ -231,10 +240,8 @@ def _qualify_columns(scope, resolver): for column in columns_missing_from_scope: column_table = resolver.get_table(column.name) - if column_table is None: - raise OptimizeError(f"Ambiguous column: {column.name}") - - column.set("table", exp.to_identifier(column_table)) + if column_table: + column.set("table", exp.to_identifier(column_table)) def _expand_stars(scope, resolver): @@ -322,11 +329,6 @@ def _qualify_outputs(scope): scope.expression.set("expressions", new_selections) -def _check_unknown_tables(scope): - if scope.external_columns and not scope.is_udtf and not scope.is_correlated_subquery: - raise OptimizeError(f"Unknown table: {scope.external_columns[0].text('table')}") - - class _Resolver: """ Helper for resolving columns. diff --git a/sqlglot/optimizer/qualify_tables.py b/sqlglot/optimizer/qualify_tables.py index 5d8e0d9..65593bd 100644 --- a/sqlglot/optimizer/qualify_tables.py +++ b/sqlglot/optimizer/qualify_tables.py @@ -2,7 +2,7 @@ import itertools from sqlglot import alias, exp from sqlglot.helper import csv_reader -from sqlglot.optimizer.scope import traverse_scope +from sqlglot.optimizer.scope import Scope, traverse_scope def qualify_tables(expression, db=None, catalog=None, schema=None): @@ -25,6 +25,8 @@ def qualify_tables(expression, db=None, catalog=None, schema=None): """ sequence = itertools.count() + next_name = lambda: f"_q_{next(sequence)}" + for scope in traverse_scope(expression): for derived_table in scope.ctes + scope.derived_tables: if not derived_table.args.get("alias"): @@ -46,7 +48,7 @@ def qualify_tables(expression, db=None, catalog=None, schema=None): source = source.replace( alias( source.copy(), - source.this if identifier else f"_q_{next(sequence)}", + source.this if identifier else next_name(), table=True, ) ) @@ -58,5 +60,12 @@ def qualify_tables(expression, db=None, catalog=None, schema=None): schema.add_table( source, {k: type(v).__name__ for k, v in zip(header, columns)} ) + elif isinstance(source, Scope) and source.is_udtf: + udtf = source.expression + table_alias = udtf.args.get("alias") or exp.TableAlias(this=next_name()) + udtf.set("alias", table_alias) + + if not table_alias.name: + table_alias.set("this", next_name()) return expression diff --git a/sqlglot/optimizer/scope.py b/sqlglot/optimizer/scope.py index badbb87..8565c64 100644 --- a/sqlglot/optimizer/scope.py +++ b/sqlglot/optimizer/scope.py @@ -237,6 +237,8 @@ class Scope: ancestor = column.find_ancestor(exp.Qualify, exp.Order, exp.Having, exp.Hint) if ( not ancestor + # Window functions can have an ORDER BY clause + or not isinstance(ancestor.parent, exp.Select) or column.table or (column.name not in named_selects and not isinstance(ancestor, exp.Hint)) ): @@ -479,7 +481,7 @@ def _traverse_scope(scope): elif isinstance(scope.expression, exp.Union): yield from _traverse_union(scope) elif isinstance(scope.expression, exp.UDTF): - pass + _set_udtf_scope(scope) elif isinstance(scope.expression, exp.Subquery): yield from _traverse_subqueries(scope) else: @@ -509,6 +511,22 @@ def _traverse_union(scope): scope.union_scopes = [left, right] +def _set_udtf_scope(scope): + parent = scope.expression.parent + from_ = parent.args.get("from") + + if not from_: + return + + for table in from_.expressions: + if isinstance(table, exp.Table): + scope.tables.append(table) + elif isinstance(table, exp.Subquery): + scope.subqueries.append(table) + _add_table_sources(scope) + _traverse_subqueries(scope) + + def _traverse_derived_tables(derived_tables, scope, scope_type): sources = {} is_cte = scope_type == ScopeType.CTE diff --git a/sqlglot/parser.py b/sqlglot/parser.py index e2b2c54..579c2ce 100644 --- a/sqlglot/parser.py +++ b/sqlglot/parser.py @@ -194,6 +194,7 @@ class Parser(metaclass=_Parser): TokenType.INTERVAL, TokenType.LAZY, TokenType.LEADING, + TokenType.LEFT, TokenType.LOCAL, TokenType.MATERIALIZED, TokenType.MERGE, @@ -208,6 +209,7 @@ class Parser(metaclass=_Parser): TokenType.PRECEDING, TokenType.RANGE, TokenType.REFERENCES, + TokenType.RIGHT, TokenType.ROW, TokenType.ROWS, TokenType.SCHEMA, @@ -237,8 +239,10 @@ class Parser(metaclass=_Parser): TABLE_ALIAS_TOKENS = ID_VAR_TOKENS - { TokenType.APPLY, + TokenType.LEFT, TokenType.NATURAL, TokenType.OFFSET, + TokenType.RIGHT, TokenType.WINDOW, } @@ -258,6 +262,8 @@ class Parser(metaclass=_Parser): TokenType.IDENTIFIER, TokenType.INDEX, TokenType.ISNULL, + TokenType.ILIKE, + TokenType.LIKE, TokenType.MERGE, TokenType.OFFSET, TokenType.PRIMARY_KEY, @@ -971,13 +977,14 @@ class Parser(metaclass=_Parser): if create_token.token_type in (TokenType.FUNCTION, TokenType.PROCEDURE): this = self._parse_user_defined_function(kind=create_token.token_type) properties = self._parse_properties() - if self._match(TokenType.ALIAS): - begin = self._match(TokenType.BEGIN) - return_ = self._match_text_seq("RETURN") - expression = self._parse_statement() - if return_: - expression = self.expression(exp.Return, this=expression) + self._match(TokenType.ALIAS) + begin = self._match(TokenType.BEGIN) + return_ = self._match_text_seq("RETURN") + expression = self._parse_statement() + + if return_: + expression = self.expression(exp.Return, this=expression) elif create_token.token_type == TokenType.INDEX: this = self._parse_index() elif create_token.token_type in ( @@ -2163,7 +2170,9 @@ class Parser(metaclass=_Parser): ) -> t.Optional[exp.Expression]: if self._match(TokenType.TOP if top else TokenType.LIMIT): limit_paren = self._match(TokenType.L_PAREN) - limit_exp = self.expression(exp.Limit, this=this, expression=self._parse_number()) + limit_exp = self.expression( + exp.Limit, this=this, expression=self._parse_number() if top else self._parse_term() + ) if limit_paren: self._match_r_paren() @@ -2740,8 +2749,23 @@ class Parser(metaclass=_Parser): kind: exp.Expression - if self._match(TokenType.AUTO_INCREMENT): - kind = exp.AutoIncrementColumnConstraint() + if self._match_set((TokenType.AUTO_INCREMENT, TokenType.IDENTITY)): + start = None + increment = None + + if self._match(TokenType.L_PAREN, advance=False): + args = self._parse_wrapped_csv(self._parse_bitwise) + start = seq_get(args, 0) + increment = seq_get(args, 1) + elif self._match_text_seq("START"): + start = self._parse_bitwise() + self._match_text_seq("INCREMENT") + increment = self._parse_bitwise() + + if start and increment: + kind = exp.GeneratedAsIdentityColumnConstraint(start=start, increment=increment) + else: + kind = exp.AutoIncrementColumnConstraint() elif self._match(TokenType.CHECK): constraint = self._parse_wrapped(self._parse_conjunction) kind = self.expression(exp.CheckColumnConstraint, this=constraint) @@ -3294,8 +3318,8 @@ class Parser(metaclass=_Parser): if not self._match(TokenType.EXCEPT): return None if self._match(TokenType.L_PAREN, advance=False): - return self._parse_wrapped_id_vars() - return self._parse_csv(self._parse_id_var) + return self._parse_wrapped_csv(self._parse_column) + return self._parse_csv(self._parse_column) def _parse_replace(self) -> t.Optional[t.List[t.Optional[exp.Expression]]]: if not self._match(TokenType.REPLACE): @@ -3442,7 +3466,7 @@ class Parser(metaclass=_Parser): def _parse_alter(self) -> t.Optional[exp.Expression]: if not self._match(TokenType.TABLE): - return None + return self._parse_as_command(self._prev) exists = self._parse_exists() this = self._parse_table(schema=True) diff --git a/sqlglot/tokens.py b/sqlglot/tokens.py index e95057a..8cf17a7 100644 --- a/sqlglot/tokens.py +++ b/sqlglot/tokens.py @@ -357,7 +357,8 @@ class _Tokenizer(type): klass._HEX_STRINGS = cls._delimeter_list_to_dict(klass.HEX_STRINGS) klass._BYTE_STRINGS = cls._delimeter_list_to_dict(klass.BYTE_STRINGS) klass._IDENTIFIERS = cls._delimeter_list_to_dict(klass.IDENTIFIERS) - klass._ESCAPES = set(klass.ESCAPES) + klass._STRING_ESCAPES = set(klass.STRING_ESCAPES) + klass._IDENTIFIER_ESCAPES = set(klass.IDENTIFIER_ESCAPES) klass._COMMENTS = dict( (comment, None) if isinstance(comment, str) else (comment[0], comment[1]) for comment in klass.COMMENTS @@ -429,9 +430,13 @@ class Tokenizer(metaclass=_Tokenizer): IDENTIFIERS: t.List[str | t.Tuple[str, str]] = ['"'] - ESCAPES = ["'"] + STRING_ESCAPES = ["'"] - _ESCAPES: t.Set[str] = set() + _STRING_ESCAPES: t.Set[str] = set() + + IDENTIFIER_ESCAPES = ['"'] + + _IDENTIFIER_ESCAPES: t.Set[str] = set() KEYWORDS = { **{ @@ -469,6 +474,7 @@ class Tokenizer(metaclass=_Tokenizer): "ASC": TokenType.ASC, "AS": TokenType.ALIAS, "AT TIME ZONE": TokenType.AT_TIME_ZONE, + "AUTOINCREMENT": TokenType.AUTO_INCREMENT, "AUTO_INCREMENT": TokenType.AUTO_INCREMENT, "BEGIN": TokenType.BEGIN, "BETWEEN": TokenType.BETWEEN, @@ -691,6 +697,7 @@ class Tokenizer(metaclass=_Tokenizer): "ALTER VIEW": TokenType.COMMAND, "ANALYZE": TokenType.COMMAND, "CALL": TokenType.COMMAND, + "COPY": TokenType.COMMAND, "EXPLAIN": TokenType.COMMAND, "OPTIMIZE": TokenType.COMMAND, "PREPARE": TokenType.COMMAND, @@ -744,7 +751,7 @@ class Tokenizer(metaclass=_Tokenizer): ) def __init__(self) -> None: - self._replace_backslash = "\\" in self._ESCAPES + self._replace_backslash = "\\" in self._STRING_ESCAPES self.reset() def reset(self) -> None: @@ -1046,12 +1053,25 @@ class Tokenizer(metaclass=_Tokenizer): return True def _scan_identifier(self, identifier_end: str) -> None: - while self._peek != identifier_end: + text = "" + identifier_end_is_escape = identifier_end in self._IDENTIFIER_ESCAPES + + while True: if self._end: raise RuntimeError(f"Missing {identifier_end} from {self._line}:{self._start}") + self._advance() - self._advance() - self._add(TokenType.IDENTIFIER, self._text[1:-1]) + if self._char == identifier_end: + if identifier_end_is_escape and self._peek == identifier_end: + text += identifier_end # type: ignore + self._advance() + continue + + break + + text += self._char # type: ignore + + self._add(TokenType.IDENTIFIER, text) def _scan_var(self) -> None: while True: @@ -1072,9 +1092,9 @@ class Tokenizer(metaclass=_Tokenizer): while True: if ( - self._char in self._ESCAPES + self._char in self._STRING_ESCAPES and self._peek - and (self._peek == delimiter or self._peek in self._ESCAPES) + and (self._peek == delimiter or self._peek in self._STRING_ESCAPES) ): text += self._peek self._advance(2) diff --git a/tests/dialects/test_databricks.py b/tests/dialects/test_databricks.py index 1d80dc0..5ae5c6f 100644 --- a/tests/dialects/test_databricks.py +++ b/tests/dialects/test_databricks.py @@ -4,6 +4,9 @@ from tests.dialects.test_dialect import Validator class TestDatabricks(Validator): dialect = "databricks" + def test_databricks(self): + self.validate_identity("CREATE FUNCTION a.b(x INT) RETURNS INT RETURN x + 1") + def test_datediff(self): self.validate_all( "SELECT DATEDIFF(year, 'start', 'end')", diff --git a/tests/dialects/test_dialect.py b/tests/dialects/test_dialect.py index a456415..442fbbb 100644 --- a/tests/dialects/test_dialect.py +++ b/tests/dialects/test_dialect.py @@ -508,7 +508,7 @@ class TestDialect(Validator): }, write={ "bigquery": "DATE_ADD(x, INTERVAL 1 'day')", - "drill": "DATE_ADD(x, INTERVAL '1' DAY)", + "drill": "DATE_ADD(x, INTERVAL 1 DAY)", "duckdb": "x + INTERVAL 1 day", "hive": "DATE_ADD(x, 1)", "mysql": "DATE_ADD(x, INTERVAL 1 DAY)", @@ -525,7 +525,7 @@ class TestDialect(Validator): "DATE_ADD(x, 1)", write={ "bigquery": "DATE_ADD(x, INTERVAL 1 'day')", - "drill": "DATE_ADD(x, INTERVAL '1' DAY)", + "drill": "DATE_ADD(x, INTERVAL 1 DAY)", "duckdb": "x + INTERVAL 1 DAY", "hive": "DATE_ADD(x, 1)", "mysql": "DATE_ADD(x, INTERVAL 1 DAY)", @@ -628,7 +628,7 @@ class TestDialect(Validator): self.validate_all( "TS_OR_DS_ADD('2021-02-01', 1, 'DAY')", write={ - "drill": "DATE_ADD(CAST('2021-02-01' AS DATE), INTERVAL '1' DAY)", + "drill": "DATE_ADD(CAST('2021-02-01' AS DATE), INTERVAL 1 DAY)", "duckdb": "CAST('2021-02-01' AS DATE) + INTERVAL 1 DAY", "hive": "DATE_ADD('2021-02-01', 1)", "presto": "DATE_ADD('DAY', 1, DATE_PARSE(SUBSTR('2021-02-01', 1, 10), '%Y-%m-%d'))", @@ -638,7 +638,7 @@ class TestDialect(Validator): self.validate_all( "DATE_ADD(CAST('2020-01-01' AS DATE), 1)", write={ - "drill": "DATE_ADD(CAST('2020-01-01' AS DATE), INTERVAL '1' DAY)", + "drill": "DATE_ADD(CAST('2020-01-01' AS DATE), INTERVAL 1 DAY)", "duckdb": "CAST('2020-01-01' AS DATE) + INTERVAL 1 DAY", "hive": "DATE_ADD(CAST('2020-01-01' AS DATE), 1)", "presto": "DATE_ADD('day', 1, CAST('2020-01-01' AS DATE))", diff --git a/tests/dialects/test_duckdb.py b/tests/dialects/test_duckdb.py index f01a604..e5cb833 100644 --- a/tests/dialects/test_duckdb.py +++ b/tests/dialects/test_duckdb.py @@ -343,6 +343,10 @@ class TestDuckDB(Validator): }, ) + self.validate_all( + "CAST(x AS DATE) + INTERVAL (7 * -1) DAY", read={"spark": "DATE_SUB(x, 7)"} + ) + def test_bool_or(self): self.validate_all( "SELECT a, LOGICAL_OR(b) FROM table GROUP BY a", diff --git a/tests/dialects/test_hive.py b/tests/dialects/test_hive.py index 1f35d1d..42d9943 100644 --- a/tests/dialects/test_hive.py +++ b/tests/dialects/test_hive.py @@ -287,7 +287,7 @@ class TestHive(Validator): self.validate_all( "DATE_SUB('2020-01-01', 1)", write={ - "duckdb": "CAST('2020-01-01' AS DATE) + INTERVAL 1 * -1 DAY", + "duckdb": "CAST('2020-01-01' AS DATE) + INTERVAL (1 * -1) DAY", "presto": "DATE_ADD('DAY', 1 * -1, DATE_PARSE(SUBSTR('2020-01-01', 1, 10), '%Y-%m-%d'))", "hive": "DATE_ADD('2020-01-01', 1 * -1)", "spark": "DATE_ADD('2020-01-01', 1 * -1)", diff --git a/tests/dialects/test_snowflake.py b/tests/dialects/test_snowflake.py index f3e8e24..201cc4e 100644 --- a/tests/dialects/test_snowflake.py +++ b/tests/dialects/test_snowflake.py @@ -6,6 +6,43 @@ class TestSnowflake(Validator): dialect = "snowflake" def test_snowflake(self): + self.validate_identity("SELECT REGEXP_LIKE(a, b, c)") + self.validate_identity("PUT file:///dir/tmp.csv @%table") + self.validate_identity("CREATE TABLE foo (bar FLOAT AUTOINCREMENT START 0 INCREMENT 1)") + self.validate_identity( + 'COPY INTO NEW_TABLE ("foo", "bar") FROM (SELECT $1, $2, $3, $4 FROM @%old_table)' + ) + + self.validate_all( + "CREATE OR REPLACE TEMPORARY TABLE x (y NUMBER IDENTITY(0, 1))", + write={ + "snowflake": "CREATE OR REPLACE TEMPORARY TABLE x (y DECIMAL AUTOINCREMENT START 0 INCREMENT 1)", + }, + ) + self.validate_all( + "CREATE TEMPORARY TABLE x (y NUMBER AUTOINCREMENT(0, 1))", + write={ + "snowflake": "CREATE TEMPORARY TABLE x (y DECIMAL AUTOINCREMENT START 0 INCREMENT 1)", + }, + ) + self.validate_all( + "CREATE TABLE x (y NUMBER IDENTITY START 0 INCREMENT 1)", + write={ + "snowflake": "CREATE TABLE x (y DECIMAL AUTOINCREMENT START 0 INCREMENT 1)", + }, + ) + self.validate_all( + "ALTER TABLE foo ADD COLUMN id INT identity(1, 1)", + write={ + "snowflake": "ALTER TABLE foo ADD COLUMN id INT AUTOINCREMENT START 1 INCREMENT 1", + }, + ) + self.validate_all( + "SELECT DAYOFWEEK('2016-01-02T23:39:20.123-07:00'::TIMESTAMP)", + write={ + "snowflake": "SELECT DAYOFWEEK(CAST('2016-01-02T23:39:20.123-07:00' AS TIMESTAMPNTZ))", + }, + ) self.validate_all( "SELECT * FROM xxx WHERE col ilike '%Don''t%'", write={ @@ -165,10 +202,10 @@ class TestSnowflake(Validator): self.validate_all( r"SELECT $$a ' \ \t \x21 z $ $$", write={ - "snowflake": r"SELECT 'a \' \\ \\t \\x21 z $ '", + "snowflake": r"SELECT 'a \' \\ \t \\x21 z $ '", }, ) - self.validate_identity("SELECT REGEXP_LIKE(a, b, c)") + self.validate_identity(r"REGEXP_REPLACE('target', 'pattern', '\n')") self.validate_all( "SELECT RLIKE(a, b)", write={ @@ -253,6 +290,8 @@ class TestSnowflake(Validator): ) def test_timestamps(self): + self.validate_identity("SELECT EXTRACT(month FROM a)") + self.validate_all( "SELECT CAST(a AS TIMESTAMP)", write={ @@ -277,7 +316,6 @@ class TestSnowflake(Validator): "snowflake": "SELECT CAST(a AS TIMESTAMPLTZ)", }, ) - self.validate_identity("SELECT EXTRACT(month FROM a)") self.validate_all( "SELECT EXTRACT('month', a)", write={ @@ -313,6 +351,8 @@ class TestSnowflake(Validator): def test_semi_structured_types(self): self.validate_identity("SELECT CAST(a AS VARIANT)") + self.validate_identity("SELECT CAST(a AS ARRAY)") + self.validate_all( "SELECT a::VARIANT", write={ @@ -320,7 +360,6 @@ class TestSnowflake(Validator): "tsql": "SELECT CAST(a AS SQL_VARIANT)", }, ) - self.validate_identity("SELECT CAST(a AS ARRAY)") self.validate_all( "ARRAY_CONSTRUCT(0, 1, 2)", write={ @@ -343,6 +382,7 @@ class TestSnowflake(Validator): "CREATE TABLE a (x DATE, y BIGINT) WITH (PARTITION BY (x), integration='q', auto_refresh=TRUE, file_format=(type = parquet))" ) self.validate_identity("CREATE MATERIALIZED VIEW a COMMENT='...' AS SELECT 1 FROM x") + self.validate_all( "CREATE OR REPLACE TRANSIENT TABLE a (id INT)", read={ diff --git a/tests/fixtures/identity.sql b/tests/fixtures/identity.sql index 5a4871d..b3f546b 100644 --- a/tests/fixtures/identity.sql +++ b/tests/fixtures/identity.sql @@ -17,6 +17,7 @@ SUM(CASE WHEN x > 1 THEN 1 ELSE 0 END) / y '\x' "x" "" +"""x""" N'abc' x x % 1 @@ -101,6 +102,8 @@ SPLIT(SPLIT(referrer, 'utm_source=')[OFFSET(1)], "&")[OFFSET(0)] x[ORDINAL(1)][SAFE_OFFSET(2)] x GLOB '??-*' x GLOB y +LIKE(x, 'z') +ILIKE(x, 'z') x LIKE SUBSTR('abc', 1, 1) x LIKE y x LIKE a.y @@ -113,7 +116,7 @@ INTERVAL '1' day INTERVAL '1' MONTH INTERVAL '1 day' INTERVAL 2 months -INTERVAL 1 + 3 DAYS +INTERVAL (1 + 3) DAYS CAST('45' AS INTERVAL DAYS) TIMESTAMP_DIFF(CURRENT_TIMESTAMP(), 1, DAY) DATETIME_DIFF(CURRENT_DATE, 1, DAY) @@ -221,6 +224,7 @@ SELECT JSON_EXTRACT(x, '$.name') SELECT JSON_EXTRACT_SCALAR(x, '$.name') SELECT x LIKE '%x%' FROM test SELECT * FROM test LIMIT 100 +SELECT * FROM test LIMIT 1 + 1 SELECT * FROM test LIMIT 100 OFFSET 200 SELECT * FROM test FETCH FIRST ROWS ONLY SELECT * FROM test FETCH FIRST 1 ROWS ONLY @@ -393,6 +397,7 @@ SELECT * EXCEPT (a, b) REPLACE (a AS b, b AS C) SELECT * EXCEPT (a, b) REPLACE (a AS b, b AS C) FROM y SELECT a.* EXCEPT (a, b), b.* REPLACE (a AS b, b AS C) SELECT a.* EXCEPT (a, b), b.* REPLACE (a AS b, b AS C) FROM x +SELECT A.* EXCEPT (A.COL_1) FROM TABLE_1 AS A SELECT zoo, animals FROM (VALUES ('oakland', ARRAY('a', 'b')), ('sf', ARRAY('b', 'c'))) AS t(zoo, animals) SELECT zoo, animals FROM UNNEST(ARRAY(STRUCT('oakland' AS zoo, ARRAY('a', 'b') AS animals), STRUCT('sf' AS zoo, ARRAY('b', 'c') AS animals))) AS t(zoo, animals) WITH a AS (SELECT 1) SELECT 1 UNION ALL SELECT 2 @@ -558,6 +563,7 @@ CREATE FUNCTION f AS 'g' CREATE FUNCTION a(b INT, c VARCHAR) AS 'SELECT 1' CREATE FUNCTION a() LANGUAGE sql CREATE FUNCTION a() LANGUAGE sql RETURNS INT +CREATE FUNCTION a.b(x INT) RETURNS INT AS RETURN x + 1 CREATE FUNCTION a.b.c() CREATE INDEX abc ON t (a) CREATE INDEX abc ON t (a, b, b) @@ -585,6 +591,7 @@ INSERT OVERWRITE TABLE a.b PARTITION(ds) SELECT x FROM y INSERT OVERWRITE TABLE a.b PARTITION(ds = 'YYYY-MM-DD') SELECT x FROM y INSERT OVERWRITE TABLE a.b PARTITION(ds, hour) SELECT x FROM y INSERT OVERWRITE TABLE a.b PARTITION(ds = 'YYYY-MM-DD', hour = 'hh') SELECT x FROM y +ALTER SESSION SET STATEMENT_TIMEOUT_IN_SECONDS=3 ALTER AGGREGATE bla(foo) OWNER TO CURRENT_USER ALTER RULE foo ON bla RENAME TO baz ALTER ROLE CURRENT_USER WITH REPLICATION @@ -721,3 +728,6 @@ ALTER TABLE a ADD PRIMARY KEY (x, y) NOT ENFORCED ALTER TABLE a ADD FOREIGN KEY (x, y) REFERENCES bla SELECT end FROM a SELECT id FROM b.a AS a QUALIFY ROW_NUMBER() OVER (PARTITION BY br ORDER BY sadf DESC) = 1 +SELECT LEFT.FOO FROM BLA AS LEFT +SELECT RIGHT.FOO FROM BLA AS RIGHT +SELECT LEFT FROM LEFT LEFT JOIN RIGHT RIGHT JOIN LEFT diff --git a/tests/fixtures/optimizer/expand_laterals.sql b/tests/fixtures/optimizer/expand_laterals.sql new file mode 100644 index 0000000..09bbd0f --- /dev/null +++ b/tests/fixtures/optimizer/expand_laterals.sql @@ -0,0 +1,40 @@ +# title: expand alias reference +SELECT + x.a + 1 AS i, + i + 1 AS j, + j + 1 AS k +FROM x; +SELECT + x.a + 1 AS i, + x.a + 1 + 1 AS j, + x.a + 1 + 1 + 1 AS k +FROM x; + +# title: noop - reference comes before alias +SELECT + b + 1 AS j, + x.a + 1 AS i +FROM x; +SELECT + b + 1 AS j, + x.a + 1 AS i +FROM x; + + +# title: subquery +SELECT + * +FROM ( + SELECT + x.a + 1 AS i, + i + 1 AS j + FROM x +); +SELECT + * +FROM ( + SELECT + x.a + 1 AS i, + x.a + 1 + 1 AS j + FROM x +); diff --git a/tests/fixtures/optimizer/optimizer.sql b/tests/fixtures/optimizer/optimizer.sql index 664b3c7..9c14ec1 100644 --- a/tests/fixtures/optimizer/optimizer.sql +++ b/tests/fixtures/optimizer/optimizer.sql @@ -1,14 +1,20 @@ # title: lateral # execute: false SELECT a, m FROM z LATERAL VIEW EXPLODE([1, 2]) q AS m; +WITH "z_2" AS ( + SELECT + "z"."a" AS "a" + FROM "z" AS "z" +) SELECT "z"."a" AS "a", "q"."m" AS "m" -FROM "z" AS "z" +FROM "z_2" AS "z" LATERAL VIEW EXPLODE(ARRAY(1, 2)) q AS "m"; # title: unnest +# execute: false SELECT x FROM UNNEST([1, 2]) AS q(x, y); SELECT "q"."x" AS "x" @@ -369,3 +375,18 @@ SELECT FROM "x" AS "x" RIGHT JOIN "y_2" AS "y" ON "x"."a" = "y"."b"; + + +# title: lateral column alias reference +SELECT x.a + 1 AS c, c + 1 AS d FROM x; +SELECT + "x"."a" + 1 AS "c", + "x"."a" + 2 AS "d" +FROM "x" AS "x"; + +# title: column reference takes priority over lateral column alias reference +SELECT x.a + 1 AS b, b + 1 AS c FROM x; +SELECT + "x"."a" + 1 AS "b", + "x"."b" + 1 AS "c" +FROM "x" AS "x"; diff --git a/tests/fixtures/optimizer/qualify_columns.sql b/tests/fixtures/optimizer/qualify_columns.sql index ee041e2..141f028 100644 --- a/tests/fixtures/optimizer/qualify_columns.sql +++ b/tests/fixtures/optimizer/qualify_columns.sql @@ -104,14 +104,6 @@ SELECT x.a AS a FROM x AS x ORDER BY x.b; SELECT SUM(a) AS a FROM x ORDER BY SUM(a); SELECT SUM(x.a) AS a FROM x AS x ORDER BY SUM(x.a); -# dialect: bigquery -SELECT ROW_NUMBER() OVER (PARTITION BY a ORDER BY b) AS row_num FROM x QUALIFY row_num = 1; -SELECT ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.b) AS row_num FROM x AS x QUALIFY row_num = 1; - -# dialect: bigquery -SELECT x.b, x.a FROM x LEFT JOIN y ON x.b = y.b QUALIFY ROW_NUMBER() OVER(PARTITION BY x.b ORDER BY x.a DESC) = 1; -SELECT x.b AS b, x.a AS a FROM x AS x LEFT JOIN y AS y ON x.b = y.b QUALIFY ROW_NUMBER() OVER (PARTITION BY x.b ORDER BY x.a DESC) = 1; - # execute: false SELECT AGGREGATE(ARRAY(a, x.b), 0, (x, acc) -> x + acc + a) AS sum_agg FROM x; SELECT AGGREGATE(ARRAY(x.a, x.b), 0, (x, acc) -> x + acc + x.a) AS sum_agg FROM x AS x; @@ -199,15 +191,6 @@ SELECT x.a AS a FROM x AS x WHERE x.b IN (SELECT x.b AS b FROM y AS x); SELECT a FROM x AS i WHERE b IN (SELECT b FROM y AS j WHERE j.b IN (SELECT c FROM y AS k WHERE k.b = j.b)); SELECT i.a AS a FROM x AS i WHERE i.b IN (SELECT j.b AS b FROM y AS j WHERE j.b IN (SELECT k.c AS c FROM y AS k WHERE k.b = j.b)); -# execute: false -# dialect: bigquery -SELECT aa FROM x, UNNEST(a) AS aa; -SELECT aa AS aa FROM x AS x, UNNEST(x.a) AS aa; - -# execute: false -SELECT aa FROM x, UNNEST(a) AS t(aa); -SELECT t.aa AS aa FROM x AS x, UNNEST(x.a) AS t(aa); - -------------------------------------- -- Expand * -------------------------------------- @@ -302,3 +285,43 @@ SELECT COALESCE(x.b, y.b, z.b) AS b FROM x AS x JOIN y AS y ON x.b = y.b JOIN z # dialect: spark SELECT /*+ BROADCAST(y) */ x.b FROM x JOIN y ON x.b = y.b; SELECT /*+ BROADCAST(y) */ x.b AS b FROM x AS x JOIN y AS y ON x.b = y.b; + +-------------------------------------- +-- UDTF +-------------------------------------- +# execute: false +SELECT c FROM x LATERAL VIEW EXPLODE (a) AS c; +SELECT _q_0.c AS c FROM x AS x LATERAL VIEW EXPLODE(x.a) _q_0 AS c; + +# execute: false +SELECT c FROM xx LATERAL VIEW EXPLODE (a) AS c; +SELECT _q_0.c AS c FROM xx AS xx LATERAL VIEW EXPLODE(xx.a) _q_0 AS c; + +# execute: false +SELECT c FROM x LATERAL VIEW EXPLODE (a) t AS c; +SELECT t.c AS c FROM x AS x LATERAL VIEW EXPLODE(x.a) t AS c; + +# execute: false +SELECT aa FROM x, UNNEST(a) AS t(aa); +SELECT t.aa AS aa FROM x AS x, UNNEST(x.a) AS t(aa); + +# execute: false +# dialect: bigquery +SELECT aa FROM x, UNNEST(a) AS aa; +SELECT aa AS aa FROM x AS x, UNNEST(x.a) AS aa; + +-------------------------------------- +-- Window functions +-------------------------------------- + +-- ORDER BY in window function +SELECT a + 1 AS a, ROW_NUMBER() OVER (PARTITION BY b ORDER BY a) AS row_num FROM x; +SELECT x.a + 1 AS a, ROW_NUMBER() OVER (PARTITION BY x.b ORDER BY x.a) AS row_num FROM x AS x; + +# dialect: bigquery +SELECT ROW_NUMBER() OVER (PARTITION BY a ORDER BY b) AS row_num FROM x QUALIFY row_num = 1; +SELECT ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.b) AS row_num FROM x AS x QUALIFY row_num = 1; + +# dialect: bigquery +SELECT x.b, x.a FROM x LEFT JOIN y ON x.b = y.b QUALIFY ROW_NUMBER() OVER(PARTITION BY x.b ORDER BY x.a DESC) = 1; +SELECT x.b AS b, x.a AS a FROM x AS x LEFT JOIN y AS y ON x.b = y.b QUALIFY ROW_NUMBER() OVER (PARTITION BY x.b ORDER BY x.a DESC) = 1; diff --git a/tests/fixtures/pretty.sql b/tests/fixtures/pretty.sql index a240597..c67ba5d 100644 --- a/tests/fixtures/pretty.sql +++ b/tests/fixtures/pretty.sql @@ -342,3 +342,8 @@ SELECT basket_index FROM table_data CROSS JOIN UNNEST(fruit_basket) AS fruit WITH OFFSET AS basket_index; +SELECT A.* EXCEPT A.COL_1, A.COL_2 FROM TABLE_1 A; +SELECT + A.* + EXCEPT (A.COL_1, A.COL_2) +FROM TABLE_1 AS A; diff --git a/tests/test_expressions.py b/tests/test_expressions.py index 55e07d1..7acc0fa 100644 --- a/tests/test_expressions.py +++ b/tests/test_expressions.py @@ -122,6 +122,10 @@ class TestExpressions(unittest.TestCase): ["first", "second", "third"], ) + self.assertEqual(parse_one("x.*").name, "*") + self.assertEqual(parse_one("NULL").name, "NULL") + self.assertEqual(parse_one("a.b.c").name, "c") + def test_table_name(self): self.assertEqual(exp.table_name(parse_one("a", into=exp.Table)), "a") self.assertEqual(exp.table_name(parse_one("a.b", into=exp.Table)), "a.b") diff --git a/tests/test_optimizer.py b/tests/test_optimizer.py index 360dfb5..b6993ba 100644 --- a/tests/test_optimizer.py +++ b/tests/test_optimizer.py @@ -163,7 +163,10 @@ class TestOptimizer(unittest.TestCase): for sql in load_sql_fixtures("optimizer/qualify_columns__invalid.sql"): with self.subTest(sql): with self.assertRaises((OptimizeError, SchemaError)): - optimizer.qualify_columns.qualify_columns(parse_one(sql), schema=self.schema) + expression = optimizer.qualify_columns.qualify_columns( + parse_one(sql), schema=self.schema + ) + optimizer.qualify_columns.validate_qualify_columns(expression) def test_lower_identities(self): self.check_file("lower_identities", optimizer.lower_identities.lower_identities) @@ -190,6 +193,14 @@ class TestOptimizer(unittest.TestCase): def test_pushdown_predicates(self): self.check_file("pushdown_predicates", optimizer.pushdown_predicates.pushdown_predicates) + def test_expand_laterals(self): + self.check_file( + "expand_laterals", + optimizer.expand_laterals.expand_laterals, + pretty=True, + execute=True, + ) + def test_expand_multi_table_selects(self): self.check_file( "expand_multi_table_selects", @@ -369,6 +380,12 @@ FROM READ_CSV('tests/fixtures/optimizer/tpc-h/nation.csv.gz', 'delimiter', '|') self.assertEqual(expression.right.this.left.type.this, exp.DataType.Type.INT) self.assertEqual(expression.right.this.right.type.this, exp.DataType.Type.INT) + def test_lateral_annotation(self): + expression = optimizer.optimize( + parse_one("SELECT c FROM (select 1 a) as x LATERAL VIEW EXPLODE (a) AS c") + ).expressions[0] + self.assertEqual(expression.type.this, exp.DataType.Type.INT) + def test_derived_tables_column_annotation(self): schema = {"x": {"cola": "INT"}, "y": {"cola": "FLOAT"}} sql = """ |